diff --git a/api/syscalls.json b/api/syscalls.json index 11b769a..7f392b3 100644 --- a/api/syscalls.json +++ b/api/syscalls.json @@ -95,12 +95,12 @@ ] ], "returns": [ - "bool", - "success" + "u64", + "new_size" ], "permission": "default_allowed", "const_idx": 17, - "description": "Resize the heap to a new size given in bytes. This is similar to the `brk()` system call on POSIX systems. Note that the heap may be resized to a size larger than requested. The heap size is guaranteed to be a multiple of at least 8 bytes. Returns the new heap size in bytes if successful, or `UINT64_MAX` on failure." + "description": "Resize the heap to a new size given in bytes. This is similar to the `brk()` system call on POSIX systems. Note that the heap may be resized to a size larger than requested. The heap size is guaranteed to be a multiple of 8 bytes. Returns the new heap size in bytes if successful, or `UINT64_MAX` on failure." } ], "constants": [] diff --git a/doc/syscalls.md b/doc/syscalls.md index 29af29d..d8c4ea9 100644 --- a/doc/syscalls.md +++ b/doc/syscalls.md @@ -51,12 +51,12 @@ Report the current heap size in bytes. ## vm_resize_heap ``` -bool vm_resize_heap(u64 num_bytes) +u64 vm_resize_heap(u64 num_bytes) ``` -**Returns:** `bool success` +**Returns:** `u64 new_size` -Resize the heap to a new size given in bytes. This is similar to the `brk()` system call on POSIX systems. Note that the heap may be resized to a size larger than requested. The heap size is guaranteed to be a multiple of at least 8 bytes. Returns the new heap size in bytes if successful, or `UINT64_MAX` on failure. +Resize the heap to a new size given in bytes. This is similar to the `brk()` system call on POSIX systems. Note that the heap may be resized to a size larger than requested. The heap size is guaranteed to be a multiple of 8 bytes. Returns the new heap size in bytes if successful, or `UINT64_MAX` on failure. # io diff --git a/ncc/include/uvm/syscalls.h b/ncc/include/uvm/syscalls.h index 3268a37..2af7c02 100644 --- a/ncc/include/uvm/syscalls.h +++ b/ncc/include/uvm/syscalls.h @@ -21,9 +21,9 @@ // Report the current heap size in bytes. #define vm_heap_size() asm () -> u64 { syscall vm_heap_size; } -// bool vm_resize_heap(u64 num_bytes) -// Resize the heap to a new size given in bytes. This is similar to the `brk()` system call on POSIX systems. Note that the heap may be resized to a size larger than requested. The heap size is guaranteed to be a multiple of at least 8 bytes. Returns the new heap size in bytes if successful, or `UINT64_MAX` on failure. -#define vm_resize_heap(__num_bytes) asm (__num_bytes) -> bool { syscall vm_resize_heap; } +// u64 vm_resize_heap(u64 num_bytes) +// Resize the heap to a new size given in bytes. This is similar to the `brk()` system call on POSIX systems. Note that the heap may be resized to a size larger than requested. The heap size is guaranteed to be a multiple of 8 bytes. Returns the new heap size in bytes if successful, or `UINT64_MAX` on failure. +#define vm_resize_heap(__num_bytes) asm (__num_bytes) -> u64 { syscall vm_resize_heap; } // void print_i64(i64 val) // Print an i64 value to standard output.