Kernel Loader: Difference between revisions
→KernelLdr_LoadKernel: .rel.ro |
|||
Line 183: | Line 183: | ||
// Maps .rodata as R-- | // Maps .rodata as R-- | ||
attribute = 0x60000000000788; | attribute = 0x60000000000788; | ||
// 9.0.0+ | |||
{ | |||
// On 9.0.0+, .rodata is initially RW- to facilitate .rel.ro. | |||
attribute = 0x60000000000708; | |||
} | |||
ttbr1_page_table.Map(final_virtual_kernel_base + ro_offset, ro_end_offset - ro_offset, kernel_base + ro_offset, &attribute, &g_InitialPageAllocator); | ttbr1_page_table.Map(final_virtual_kernel_base + ro_offset, ro_end_offset - ro_offset, kernel_base + ro_offset, &attribute, &g_InitialPageAllocator); | ||
Line 197: | Line 204: | ||
// Applies all R_AARCH64_RELATIVE relocations. | // Applies all R_AARCH64_RELATIVE relocations. | ||
KernelLdr_ApplyRelocations(final_kernel_virtual_base, final_kernel_virtual_base + dynamic_offset); | KernelLdr_ApplyRelocations(final_kernel_virtual_base, final_kernel_virtual_base + dynamic_offset); | ||
// 9.0.0+: Reprotects .rodata as R--. | |||
ttbr1_page_table.ReprotectToReadOnly(final_virtual_kernel_base + ro_offset, ro_end_offset - ro_offset); | |||
// This is standard libc init_array code, but called for the kernel's binary instead of kernelldr's. | // This is standard libc init_array code, but called for the kernel's binary instead of kernelldr's. |