diff options
| author | Hanjie Wu <hanjiew@andrew.cmu.edu> | 2023-04-18 02:21:10 -0400 |
|---|---|---|
| committer | Hanjie Wu <hanjiew@andrew.cmu.edu> | 2023-04-18 02:21:10 -0400 |
| commit | c71294cdd3581c3738d24ffd65414f8644a1094d (patch) | |
| tree | c86245d50fad9eee4163dbba169bd1839edbf88f /kern/usermem_asm.S | |
initial commit
Diffstat (limited to 'kern/usermem_asm.S')
| -rw-r--r-- | kern/usermem_asm.S | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/kern/usermem_asm.S b/kern/usermem_asm.S new file mode 100644 index 0000000..0eee6f8 --- /dev/null +++ b/kern/usermem_asm.S @@ -0,0 +1,35 @@ +/** @file usermem_asm.S + * + * @brief userspace r/w functions. + * + * @author Hanjie Wu (hanjiew) + * @bug No functional bugs + */ + +.text + +.global try_read +.type try_read, %function +try_read: + mov 0x4(%esp), %eax + mov 0x8(%esp), %esi + mov (%eax), %al + mov %al, (%esi) + xor %eax, %eax + ret + +.global try_write +.type try_write, %function +try_write: + mov 0x4(%esp), %eax + mov 0x8(%esp), %edx + mov %dl, (%eax) + xor %eax, %eax + ret + +/* unsuccessful r/w will jump to this function and we return 1 */ +.global usermem_fail +.type usermem_fail, %function +usermem_fail: + mov $0xffffffff, %eax + ret |
