We have changed the ABI. Pray we do not change it further.
Guild Navigator <[email protected]> wrote: > # as why.asm -o why.o > # ld why.o -e start -static -o why > > .global start > > .equ SYS_EXIT, 0x01 > .equ SYS_WRITE, 0x04 > .equ STD_OUT, 0x01 > > # this example works in linux (with changed syscalls) > # also in netbsd, but not in openbsd. why? > > .macro sys > syscall > .endm > > .text > > start: > # print first message > leaq msg1 (%rip), %rsi > call print > > # print second message > leaq msg2 (%rip), %rsi > call print > > # print first message, but > # this time from the array > movq array (%rip), %rsi > call print > > exit: > movl $SYS_EXIT, %eax > subl %edi, %edi > sys > > # prints 9-char string > # in %rsi address of string > print: > push %rax > push %rcx > push %rdx > push %rdi > push %r11 > movl $9, %edx # string length > movl $STD_OUT, %edi > movl $SYS_WRITE, %eax > sys > pop %r11 > pop %rdi > pop %rdx > pop %rcx > pop %rax > ret > > .data > > msg1: .ascii "string 1\n" > msg2: .ascii "string 2\n" > > array: .quad msg1, msg2 > > .section ".note.openbsd.ident", "a" > > .align 2 > .long 8, 4, 1 > .asciz "OpenBSD" > .long 0 > .align 2

