diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-04-25 20:21:08 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-04-25 20:24:54 -0700 |
commit | 39c4ddb4aa4a4d116e79b9306bb8ae67a500fd83 (patch) | |
tree | 29f1824f16b6bc22978553d16cfea86bcfa8a225 | |
parent | ace5351a9b03b44c4582a060ba1060b01d25adb9 (diff) | |
download | mu-39c4ddb4aa4a4d116e79b9306bb8ae67a500fd83.tar.gz |
6211
-rw-r--r-- | 052kernel-string-equal.subx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/052kernel-string-equal.subx b/052kernel-string-equal.subx index 9fd22d8d..4eeffe11 100644 --- a/052kernel-string-equal.subx +++ b/052kernel-string-equal.subx @@ -1,11 +1,12 @@ -# Checking null-terminated ascii strings. +# Checking null-terminated strings. # # By default we create strings as arrays of bytes, and all arrays have a 4-byte # size prefix. # -# However, we sometimes need to deal with null-prefixed strings when interacting -# with the Linux kernel. This layer implements a function for comparing a -# null-terminated 'kernel string' with a size-prefixed 'SubX string'. +# However, we sometimes need to deal with null-terminated strings when +# interacting with the Linux kernel. This layer implements a function for +# comparing a null-terminated 'kernel string' with a size-prefixed 'SubX +# string'. # # To run (from the subx directory): # $ ./bootstrap translate 05[0-2]*.subx -o /tmp/tmp52 @@ -28,8 +29,6 @@ Entry: # run all tests b8/copy-to-eax 1/imm32/exit cd/syscall 0x80/imm8 -# compare a null-terminated ascii string with a more idiomatic size-prefixed byte array -# reason for the name: the only place we should have null-terminated ascii strings is from commandline args kernel-string-equal?: # s: (addr kernel-string), benchmark: (addr array byte) -> eax: boolean # pseudocode: # n = benchmark->size |