mirror of
https://github.com/pkivolowitz/asm_book.git
synced 2026-06-22 10:46:51 +08:00
Merge branch 'main' of https://github.com/pkivolowitz/asm_book
iwjfoijwrofijworijf
This commit is contained in:
commit
ab115d6fce
1 changed files with 9 additions and 2 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
This book is written to the Linux calling convention as stated early on.
|
This book is written to the Linux calling convention as stated early on.
|
||||||
Unfortunately, this means that even if you own an Apple Silicon machine,
|
Unfortunately, this means that even if you own an Apple Silicon machine,
|
||||||
which is AARCH64, you'd still need a Linux virtual machine.
|
which is AARCH64, you'd still need a Linux virtual machine.
|
||||||
|
|
||||||
This didn't sit well with some on reddit and rightfully so. We undertook
|
This didn't sit well with some on reddit and rightfully so. We undertook
|
||||||
to develop a way of writing assembly code once and having it work on
|
to develop a way of writing assembly code once and having it work on
|
||||||
|
|
@ -62,6 +62,13 @@ file ends in .S*
|
||||||
|
|
||||||
## Differences between Apple and Linux
|
## Differences between Apple and Linux
|
||||||
|
|
||||||
|
### Getting the address of `errno`
|
||||||
|
|
||||||
|
`errno` is an externally defined `int32_t` used by many "system"
|
||||||
|
provided APIs to report error conditions back to calling programs. The
|
||||||
|
macro `ERRNO_ADDR` can be used to converge how Linux and Apple get the
|
||||||
|
address of the variable (which is left in `x0`).
|
||||||
|
|
||||||
### Variadic functions
|
### Variadic functions
|
||||||
|
|
||||||
*This is important! Understand this section in order to be able to use
|
*This is important! Understand this section in order to be able to use
|
||||||
|
|
@ -142,7 +149,7 @@ stack pointer. This is faster as the addition makes no reference to RAM
|
||||||
Apple requires that `x29` be kept as a valid stack frame pointer. The
|
Apple requires that `x29` be kept as a valid stack frame pointer. The
|
||||||
frame pointer should always start out as equal to the stack pointer.
|
frame pointer should always start out as equal to the stack pointer.
|
||||||
However, within the function, the stack pointer is free to change. The
|
However, within the function, the stack pointer is free to change. The
|
||||||
frame pointer must remain fixed so that debuggers always know how to
|
frame pointer must remain fixed so that debuggers always know how to
|
||||||
find the initial stack *frame*.
|
find the initial stack *frame*.
|
||||||
|
|
||||||
To be Apple compatible, in addition to backing up `x30` also back up
|
To be Apple compatible, in addition to backing up `x30` also back up
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue