x86: ia32: set access based on linker regions
This will set program text and rodata as read-only even in non-XIP systems. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
bc6ad3cd82
commit
08a9fcdb80
1 changed files with 10 additions and 12 deletions
|
@ -18,21 +18,19 @@
|
|||
#include <device.h>
|
||||
#include <init.h>
|
||||
#include <mmustructs.h>
|
||||
#include <linker/linker-defs.h>
|
||||
|
||||
#ifdef CONFIG_X86_MMU
|
||||
/* Mark text and rodata as read-only, for XIP rest of flash unmapped */
|
||||
MMU_BOOT_REGION((u32_t)&_image_rom_start, (u32_t)&_image_rom_size,
|
||||
MMU_ENTRY_READ);
|
||||
|
||||
#ifdef CONFIG_XIP
|
||||
MMU_BOOT_REGION(CONFIG_PHYS_LOAD_ADDR, CONFIG_ROM_SIZE*1024, MMU_ENTRY_READ);
|
||||
/* From _image_ram_start to the end of all RAM, read/write */
|
||||
MMU_BOOT_REGION((u32_t)&_image_ram_start, (u32_t)&_image_ram_all,
|
||||
MMU_ENTRY_WRITE);
|
||||
|
||||
MMU_BOOT_REGION(CONFIG_PHYS_RAM_ADDR, CONFIG_RAM_SIZE*1024, MMU_ENTRY_WRITE);
|
||||
#else
|
||||
MMU_BOOT_REGION(CONFIG_PHYS_LOAD_ADDR, CONFIG_RAM_SIZE*1024, MMU_ENTRY_WRITE);
|
||||
#endif /*CONFIG_XIP */
|
||||
|
||||
MMU_BOOT_REGION(CONFIG_LOAPIC_BASE_ADDRESS, 4*1024, MMU_ENTRY_WRITE);
|
||||
MMU_BOOT_REGION(CONFIG_IOAPIC_BASE_ADDRESS, 1024*1024, MMU_ENTRY_WRITE);
|
||||
|
||||
/*HPET */
|
||||
MMU_BOOT_REGION(CONFIG_HPET_TIMER_BASE_ADDRESS, 4*1024, MMU_ENTRY_WRITE);
|
||||
MMU_BOOT_REGION(CONFIG_LOAPIC_BASE_ADDRESS, KB(4), MMU_ENTRY_WRITE);
|
||||
MMU_BOOT_REGION(CONFIG_IOAPIC_BASE_ADDRESS, MB(1), MMU_ENTRY_WRITE);
|
||||
MMU_BOOT_REGION(CONFIG_HPET_TIMER_BASE_ADDRESS, KB(4), MMU_ENTRY_WRITE);
|
||||
|
||||
#endif /* CONFIG_X86_MMU*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue