From b8284137d4e0eec11c78bc14047243fce6a51373 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sun, 6 Sep 2020 15:47:06 -0400 Subject: minor changes, redoing makefile, meminfo program --- src/user/include/pland/syscall.h | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src/user/include/pland/syscall.h') diff --git a/src/user/include/pland/syscall.h b/src/user/include/pland/syscall.h index 5858d16..298fc51 100644 --- a/src/user/include/pland/syscall.h +++ b/src/user/include/pland/syscall.h @@ -7,6 +7,8 @@ typedef uint32_t _file_handle_t; typedef uint32_t _task_handle_t; typedef uint32_t _drive_number_t; +typedef uint32_t _pages_t; + typedef enum { _KEY_BACKSPACE = '\b', _KEY_RETURN = '\n', @@ -40,7 +42,8 @@ enum _scn { _SCN_START_TASK, _SCN_LOG_STRING, _SCN_GET_KEY, - _SCN_ALLOCATE_RAM + _SCN_ALLOCATE_RAM, + _SCN_MEMORY_INFO }; static inline uint32_t _sc0(enum _scn eax) { @@ -133,8 +136,28 @@ static inline _key_code_t _get_key() { return _sc0(_SCN_GET_KEY); } -static inline void *_allocate_ram(uint32_t pages) { +static inline void *_allocate_ram(_pages_t pages) { return (void *)_sc1(_SCN_ALLOCATE_RAM, pages); } +static inline _pages_t _kernel_dynamic_area_size() { + return _sc1(_SCN_MEMORY_INFO, 0x0); +} + +static inline _pages_t _kernel_dynamic_area_left() { + return _sc1(_SCN_MEMORY_INFO, 0x1); +} + +static inline _pages_t _total_userspace_size() { + return _sc1(_SCN_MEMORY_INFO, 0x2); +} + +static inline _pages_t _total_userspace_left() { + return _sc1(_SCN_MEMORY_INFO, 0x3); +} + +static inline _pages_t _this_process_memory_left() { + return _sc1(_SCN_MEMORY_INFO, 0x4); +} + #endif \ No newline at end of file -- cgit v1.2.3