Opened 10 years ago
Closed 10 years ago
#10984 closed bug (fixed)
Fault raised due to invalid memory access when MMU is turned on
Reported by: | arvindsraj | Owned by: | ithamar |
---|---|---|---|
Priority: | normal | Milestone: | R1 |
Component: | System/Boot Loader | Version: | R1/Development |
Keywords: | gsoc2014 | Cc: | |
Blocked By: | Blocking: | ||
Platform: | arm |
Description
As soon as MMU is enabled, the pre-MMU stack becomes invalid because a valid mapping doesn't exist. This has been fixed by moving the stack to the an address specified in LOADER_MEMORYMAP array such that the stack remains valid even after MMU is enabled.
Attachments (3)
Change History (13)
by , 10 years ago
Attachment: | 0001-Move-stack-to-SDRAM-as-specified-in-memory-map.patch added |
---|
comment:1 by , 10 years ago
patch: | 0 → 1 |
---|
comment:2 by , 10 years ago
Component: | - General → System/Boot Loader |
---|---|
Owner: | changed from | to
Platform: | All → arm |
Status: | new → assigned |
comment:3 by , 10 years ago
comment:4 by , 10 years ago
Yes, pdziepak suggestion would be much better, there is no point in doing the math at runtime when the C preprocessor can do it for us. I think even
ldr sp,=SDRAM_BASE + 0x1200000
should work? But if it doesn't, a define is ok.
by , 10 years ago
Attachment: | 0001-Move-stack-to-SDRAM-as-specified-in-memory-map.2.patch added |
---|
comment:5 by , 10 years ago
I tested pulkomandy's suggestion and it works fine. I've attached a revised patch.
comment:6 by , 10 years ago
I think there is another problem. Like on most systems, the stack grows downward (towards lower addresses), so the initial pointer must be set to the end of the stack area, rather than the beginning. Otherwise, you risk overwriting things below SDRAM_BASE+0x1200000.
by , 10 years ago
Attachment: | 0001-Move-stack-to-SDRAM-as-specified-in-memory-map.3.patch added |
---|
comment:7 by , 10 years ago
In the newest version of the patch, sp points to the highest address of the RAM_stack specified in LOADER_MEMORYMAP.
Also, mmu_init sets the amount of physical memory allocated to 0(http://cgit.haiku-os.org/haiku/tree/src/system/boot/arch/arm/arch_mmu.cpp#n621) but the stack frames for start_netbsd and start_raw are using up physical memory. Would that be a problem?
comment:8 by , 10 years ago
no, those values are for the kernel to use, and since the kernel takes over the machine, with no way of returning to the loader or U-Boot, this is fine. All the loader's memory will be reused by the kernel anyway.
comment:10 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
What is the point of using
r2
instead of directly accessingsp
?Also, what about something like: