a heap from scratch in x86 assembly | SCHIZONE EP-11
HTML-код
- Опубликовано: 9 сен 2024
- 11th video in a series on scientific computing from scratch using x86-64 assembly. This video describes heaps, dynamic memory allocation, and linked lists.
code: github.com/xmd...
3 good resources:
x86 instruction reference:
www.felixclout...
linux/freebsd syscall concordance:
www.lurklurk.o...
old draft of System-V ABI:
refspecs.linux...
secret discord link:
xmdi.us/misc/d...
love it!
Nice video! I'm just confused about one thing - how do you pick the HEAP_START_ADDRESS so that you know that everything that follows is just free memory?
2 things. There is an entry in the program header (top of the examples, after the ELF header) that specifies the amount of bytes the OS should load into memory for the process. For this entry, we usually sum up the number of bytes for all our code instructions, our print buffer, and our heap. Our code starts at address START, the print buffer is defined at the end of the program to start at address PRINT_BUFFER, which is also the byte after our code ends, and if you look at the last NASM macro at the past line in the examples, we set the HEAP_START_ADDRESS to be located right after the print buffer. All of those extra bytes after the final instruction will be initialized by the OS to be zero when the program starts.
Sigma (( Σ ))