diff options
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | init.linux | 14 | ||||
-rw-r--r-- | init.soso | 6 |
3 files changed, 14 insertions, 13 deletions
diff --git a/README.md b/README.md index 4686be6b..d4c5765c 100644 --- a/README.md +++ b/README.md @@ -465,11 +465,12 @@ trace, or if you have questions or complaints. ### Data Structures -* Kernel strings: null-terminated arrays of bytes. Unsafe and to be avoided, +* Kernel strings: null-terminated regions of memory. Unsafe and to be avoided, but needed for interacting with the kernel. -* Strings: length-prefixed arrays of bytes. String contents are preceded by - 4 bytes (32 bytes) containing the `length` of the array. +* Arrays: length-prefixed regions of memory containing multiple elements of a + single type. Contents are preceded by 4 bytes (32 bits) containing the + `length` of the array in bytes. * Slices: a pair of 32-bit addresses denoting a [half-open](https://en.wikipedia.org/wiki/Interval_(mathematics)) \[`start`, `end`) interval to live memory with a consistent lifetime. diff --git a/init.linux b/init.linux index 4dcb77be..eb84beab 100644 --- a/init.linux +++ b/init.linux @@ -19,19 +19,19 @@ syscall_exit: # status/ebx : int cd/syscall 0x80/imm8 # http://man7.org/linux/man-pages/man2/read.2.html -syscall_read: # fd/ebx : int, buf/ecx : address, size/edx : int -> nbytes-or-error/eax : int +syscall_read: # fd/ebx : int, buf/ecx : addr, size/edx : int -> nbytes-or-error/eax : int b8/copy-to-eax 3/imm32 cd/syscall 0x80/imm8 c3/return # http://man7.org/linux/man-pages/man2/write.2.html -syscall_write: # fd/ebx : int, buf/ecx : address, size/edx : int -> nbytes-or-error/eax : int +syscall_write: # fd/ebx : int, buf/ecx : addr, size/edx : int -> nbytes-or-error/eax : int b8/copy-to-eax 4/imm32 cd/syscall 0x80/imm8 c3/return # http://man7.org/linux/man-pages/man2/open.2.html -syscall_open: # filename/ebx : (address null-terminated-string), flags/ecx : int -> fd-or-error/eax : int +syscall_open: # filename/ebx : (addr kernel-string), flags/ecx : int -> fd-or-error/eax : int b8/copy-to-eax 5/imm32 cd/syscall 0x80/imm8 c3/return @@ -43,25 +43,25 @@ syscall_close: # fd/ebx : int -> status/eax c3/return # http://man7.org/linux/man-pages/man2/creat.2.html -syscall_creat: # filename/ebx : (address null-terminated-string) -> fd-or-error/eax : int +syscall_creat: # filename/ebx : (addr kernel-string) -> fd-or-error/eax : int b8/copy-to-eax 8/imm32 cd/syscall 0x80/imm8 c3/return # http://man7.org/linux/man-pages/man2/unlink.2.html -syscall_unlink: # filename/ebx : (address null-terminated-string) -> status/eax : int +syscall_unlink: # filename/ebx : (addr kernel-string) -> status/eax : int b8/copy-to-eax 0xa/imm32 cd/syscall 0x80/imm8 c3/return # http://man7.org/linux/man-pages/man2/rename.2.html -syscall_rename: # source/ebx : (address null-terminated-string), dest/ecx : (address null-terminated-string) -> status/eax : int +syscall_rename: # source/ebx : (addr kernel-string), dest/ecx : (addr kernel-string) -> status/eax : int b8/copy-to-eax 0x26/imm32 cd/syscall 0x80/imm8 c3/return # https://github.com/torvalds/linux/blob/fa121bb3fed6313b1f0af23952301e06cf6d32ed/mm/nommu.c#L1352 -syscall_mmap: # arg/ebx : (address mmap_arg_struct) -> status/eax : int +syscall_mmap: # arg/ebx : (addr mmap_arg_struct) -> status/eax : int # the important thing: ebx+4 contains the 32-bit size to be allocated b8/copy-to-eax 0x5a/imm32 cd/syscall 0x80/imm8 diff --git a/init.soso b/init.soso index c24709b1..8753b412 100644 --- a/init.soso +++ b/init.soso @@ -17,17 +17,17 @@ syscall_exit: # status/ebx : int b8/copy-to-eax 8/imm32 cd/syscall 0x80/imm8 -syscall_read: # fd/ebx : int, buf/ecx : address, size/edx : int -> nbytes-or-error/eax : int +syscall_read: # fd/ebx : int, buf/ecx : addr, size/edx : int -> nbytes-or-error/eax : int b8/copy-to-eax 2/imm32 cd/syscall 0x80/imm8 c3/return -syscall_write: # fd/ebx : int, buf/ecx : address, size/edx : int -> nbytes-or-error/eax : int +syscall_write: # fd/ebx : int, buf/ecx : addr, size/edx : int -> nbytes-or-error/eax : int b8/copy-to-eax 3/imm32 cd/syscall 0x80/imm8 c3/return -syscall_open: # filename/ebx : (address null-terminated-string), flags/ecx : int -> fd-or-error/eax : int +syscall_open: # filename/ebx : (addr kernel-string), flags/ecx : int -> fd-or-error/eax : int b8/copy-to-eax 0/imm32 cd/syscall 0x80/imm8 c3/return |