I've been trying to find a way to use the brk
system call in a Yasm program on macOS. I've looked in the syscall.inc
file for that system call, but I couldn't find it there.
Is there any alternative to brk
on macOS?
Asked
Active
Viewed 360 times
1

nullbyte
- 1,178
- 8
- 16
-
2`69 NONE NONE ALL { int sbrk(int incr); } ` in x86-64 you need to add 0x20000000 to the system call number so it would be (0x20000000)+69. System call numbers can be found here: https://opensource.apple.com/source/xnu/xnu-792.13.8/bsd/kern/syscalls.master – Michael Petch Feb 25 '18 at 04:38
-
1Here is an example of MacOS system calls (plus additional info)using NASM syntax (compatible with YASM in this case:: https://stackoverflow.com/questions/34190930/how-to-get-this-simple-assembly-to-run/34191324#34191324 – Michael Petch Feb 25 '18 at 04:42
-
1`mmap(MAP_PRIVATE|MAP_ANONYMOUS)` is usually simpler in asm than adjusting the break for dynamic allocation. You can `munmap` it in any order. – Peter Cordes Feb 25 '18 at 04:57