Browse Source

fix(UserString): mark %al as clobbered

greatbridf 4 months ago
parent
commit
faa54c5e0a
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/kernel/user/dataflow.rs

+ 6 - 4
src/kernel/user/dataflow.rs

@@ -260,11 +260,11 @@ impl<'lt> UserString<'lt> {
         unsafe {
             asm!(
                 "2:",
-                "mov al, byte ptr [rdx]",
+                "movb ({ptr}), %al",
                 "4:",
-                "test al, al",
+                "test %al, %al",
                 "jz 3f",
-                "add rdx, 1",
+                "add $1, {ptr}",
                 "loop 2b",
                 "3:",
                 "nop",
@@ -275,8 +275,10 @@ impl<'lt> UserString<'lt> {
                 ".quad 3b",  // fix jump address
                 ".quad 0x2", // type: string
                 ".popsection",
-                inout("rdx") ptr.get_const::<u8>() => _,
+                out("al") _,
                 inout("rcx") MAX_LEN => result,
+                ptr = inout(reg) ptr.ptr => _,
+                options(att_syntax),
             )
         };