X86-64: Difference between revisions

1 byte removed ,  4 years ago
m
→‎Text Segment Types: typo fix: nothing -> noting
[unchecked revision][unchecked revision]
m (→‎Text Segment Types: typo fix: nothing -> noting)
Line 190:
| The kernel runs in the negative 2 GB of the address space. This model has to be used for Linux kernel code.
|}
It worth nothingnoting that code models are different for architectures, as they are tied with the instruction encoding. For example, AArch64 has a "-mcmodel=tiny" too, which allows 1M addressing, and for AArch64 "-mcmodel=small" has a 4G limitation, not 2G.
 
From experience, you should not use "-mcmodel=kernel". That is a hack for the Linux kernel on x86_64. It is not available for other architectures, and you should not rely on a hack that was written for a kernel with non-stable API. It might change any time. It is better if you use a proper linker script instead to place your kernel into the negative address range.
Anonymous user