- (emit "mov %rcx, %rdx") ; number of bytes
- (emit "mov %rax, %rsi") ; addr of string
- (emit "mov $1, %rax") ; file handle 1 (stdout)
- (emit "mov $1, %rdi") ; syscall 1 (write)
+ (case target
+ ('darwin
+ (emit "movq %rax, %rsi") ; string addr
+ (emit "movq %rcx, %rdx") ; num bytes
+ (emit "movq $1, %rdi") ; file handle (stdout)
+ (emit "movq $0x2000004, %rax")) ; syscall 4 (write)
+ ('linux
+ (emit "mov %rax, %rsi") ; string addr
+ (emit "mov %rcx, %rdx") ; num bytes
+ (emit "mov $1, %rax") ; file handle (stdout)
+ (emit "mov $1, %rdi"))) ; syscall 1 (write)