Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD support #1

Open
iamgreaser opened this issue Feb 26, 2014 · 0 comments
Open

FreeBSD support #1

iamgreaser opened this issue Feb 26, 2014 · 0 comments

Comments

@iamgreaser
Copy link

I'm not sure how to sort out the nasm autoinstall crap, so I just ran this instead:

nasm 8queens.asm -o 8queens.o -f elf64 && ld -o 8queens 8queens.o

Anyway, the syscalls are different. FreeBSD uses 1 for exit, and 4 for write. Calling convention for 64-bit x86 is identical to Linux, or at least close enough for 8queens to work.

Do not be an idiot like I was and blindly go "ok, 2 means write". It means fork. Yeah, I accidentally forkbombed myself. Fortunately, the process limit was reached and it stopped, or something like that.

With that said, support should be pretty easy.

EDIT: Also, exit() appears to return something else. rdi is the correct register, but it appears that r8 is getting mangled somewhere.

EDIT 2: -DNOPRETTY returns the correct value of 92. push r8/pop r8 around the write() syscalls results in values which are randomly larger, about 105 or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant