diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-04-30 11:28:11 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-04-30 11:28:11 -0400 |
| commit | 29defd705dcaf25d4a080f7db8f76e8787fca146 (patch) | |
| tree | 2524f7c0433dfb8bfcac7f2379976d67c5cac1ad /std | |
| parent | cbfe4b4bae61682e367a477283e4d64a518203a8 (diff) | |
| download | zig-29defd705dcaf25d4a080f7db8f76e8787fca146.tar.gz zig-29defd705dcaf25d4a080f7db8f76e8787fca146.zip | |
back to AT&T syntax for assembly
this reverts 5c04730534ea7933855429c5fc5dc7b22eba7bc2.
sadly the quality of the intel dialect in llvm's assembly
parser has many frustrating bugs, and generally has unfortunate
syntax.
the plan is to use AT&T for now since it at least works,
and eventually zig will have its own assembly parser for
x86 and it will be as close to NASM as possible.
Diffstat (limited to 'std')
| -rw-r--r-- | std/os/linux_i386.zig | 14 | ||||
| -rw-r--r-- | std/special/bootstrap.zig | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/std/os/linux_i386.zig b/std/os/linux_i386.zig index 218043307e..d76d614a36 100644 --- a/std/os/linux_i386.zig +++ b/std/os/linux_i386.zig @@ -420,20 +420,20 @@ pub const F_GETOWN_EX = 16; pub const F_GETOWNER_UIDS = 17; pub inline fn syscall0(number: usize) -> usize { - asm volatile ("int 80h" + asm volatile ("int $0x80" : [ret] "={eax}" (-> usize) : [number] "{eax}" (number)) } pub inline fn syscall1(number: usize, arg1: usize) -> usize { - asm volatile ("int 80h" + asm volatile ("int $0x80" : [ret] "={eax}" (-> usize) : [number] "{eax}" (number), [arg1] "{ebx}" (arg1)) } pub inline fn syscall2(number: usize, arg1: usize, arg2: usize) -> usize { - asm volatile ("int 80h" + asm volatile ("int $0x80" : [ret] "={eax}" (-> usize) : [number] "{eax}" (number), [arg1] "{ebx}" (arg1), @@ -441,7 +441,7 @@ pub inline fn syscall2(number: usize, arg1: usize, arg2: usize) -> usize { } pub inline fn syscall3(number: usize, arg1: usize, arg2: usize, arg3: usize) -> usize { - asm volatile ("int 80h" + asm volatile ("int $0x80" : [ret] "={eax}" (-> usize) : [number] "{eax}" (number), [arg1] "{ebx}" (arg1), @@ -450,7 +450,7 @@ pub inline fn syscall3(number: usize, arg1: usize, arg2: usize, arg3: usize) -> } pub inline fn syscall4(number: usize, arg1: usize, arg2: usize, arg3: usize, arg4: usize) -> usize { - asm volatile ("int 80h" + asm volatile ("int $0x80" : [ret] "={eax}" (-> usize) : [number] "{eax}" (number), [arg1] "{ebx}" (arg1), @@ -462,7 +462,7 @@ pub inline fn syscall4(number: usize, arg1: usize, arg2: usize, arg3: usize, arg pub inline fn syscall5(number: usize, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) -> usize { - asm volatile ("int 80h" + asm volatile ("int $0x80" : [ret] "={eax}" (-> usize) : [number] "{eax}" (number), [arg1] "{ebx}" (arg1), @@ -475,7 +475,7 @@ pub inline fn syscall5(number: usize, arg1: usize, arg2: usize, arg3: usize, pub inline fn syscall6(number: usize, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize, arg6: usize) -> usize { - asm volatile ("int 80h" + asm volatile ("int $0x80" : [ret] "={eax}" (-> usize) : [number] "{eax}" (number), [arg1] "{ebx}" (arg1), diff --git a/std/special/bootstrap.zig b/std/special/bootstrap.zig index f7e6a35c88..00010bf0c9 100644 --- a/std/special/bootstrap.zig +++ b/std/special/bootstrap.zig @@ -19,10 +19,10 @@ export nakedcc fn _start() -> noreturn { switch (@compileVar("arch")) { Arch.x86_64 => { - argc_ptr = asm("lea %[argc], [rsp]": [argc] "=r" (-> &usize)); + argc_ptr = asm("lea (%%rsp), %[argc]": [argc] "=r" (-> &usize)); }, Arch.i386 => { - argc_ptr = asm("lea %[argc], [esp]": [argc] "=r" (-> &usize)); + argc_ptr = asm("lea (%%esp), %[argc]": [argc] "=r" (-> &usize)); }, else => @compileError("unsupported arch"), } |
