Skip to content

FreeBSD support #1

@iamgreaser

Description

@iamgreaser

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions