Anonymous user
Creating a 64-bit kernel: Difference between revisions
→Compiling: -mcmodel=large is discouraged; check the SysV AMD64 ABI spec
[unchecked revision] | [unchecked revision] |
(→Compiling: Do not use AMD64 ABI 'red zone', or your long mode kernel will be interrupt unsafe) |
(→Compiling: -mcmodel=large is discouraged; check the SysV AMD64 ABI spec) |
||
Line 27:
<source lang="bash">x86_64-pc-elf-gcc -ffreestanding -mcmodel=large -mno-red-zone -nostdlib <other options> -c -o <object file> <source file></source>
The -mcmodel=large argument enables us to run the kernel at any 64-bit virtual memory address we want (only in GCC 4.3+), and -nostdlib makes sure that GCC doesn't add any
You will need to instruct GCC not to use the the AMD64 ABI 128-byte 'red zone', which resides below the stack pointer, or your kernel will be ''interrupt unsafe''. Check this [http://forum.osdev.org/viewtopic.php?t=21720 thread] on the forums for extra context.
|