Opened 10 years ago
Closed 10 years ago
#11067 closed bug (fixed)
Kernel loaded to virtual address that overlaps with loader
Reported by: | arvindsraj | Owned by: | axeld |
---|---|---|---|
Priority: | normal | Milestone: | R1 |
Component: | System/Boot Loader | Version: | R1/Development |
Keywords: | gsoc2014 | Cc: | |
Blocked By: | Blocking: | ||
Platform: | arm |
Description
Currently, the kernel gets loaded at the virtual address where loader is present; this will cause problem later on. The patch attached with this report moves the entire memory map to a higher memory address which prevents the loader from being overwritten.
Attachments (3)
Change History (11)
by , 10 years ago
Attachment: | Moved-entire-memory-to-higher-memory-location.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
comment:3 by , 10 years ago
by , 10 years ago
Attachment: | Reserve-8MB-space-for-kernel-before-RAM_loader.patch added |
---|
comment:4 by , 10 years ago
HAIKU_BOARD_LOADER_ENTRY_RAW = 0x80800000 ; HAIKU_BOARD_LOADER_ENTRY_NBSD = 0x80800008 ;
These should be defined relative to HAIKU_BOARD_LOADER_BASE. This would allow a single common definition for all ARM targets.
{ "RAM_stack", // stack kLoaderBaseAddress + 0x1200000, kLoaderBaseAddress + 0x1ffffff, ARM_MMU_L2_FLAG_C, }, { "RAM_initrd", // stack kLoaderBaseAddress + 0x2000000, kLoaderBaseAddress + 0x2500000, ARM_MMU_L2_FLAG_C, },
And these should be defined against HAIKU_BOARD_LOADER_UIBASE and HAIKU_BOARD_LOADER_STACK_BASE as defined in the Jamfile. These can be added to the CXXFLAGS if that's not already done, so we can use it from C++ sources. Also, please fix the " stack" comment for the initrd section, It does not contain the stack.
comment:5 by , 10 years ago
There's a small issue in setting value of HAIKU_BOARD_LOADER_ENTRY_NBSD relative to HAIKU_BOARD_LOADER_BASE. Jam doesn't support arithmetic which makes assigning a value to LOADER_ENTRY_NBSD slightly tricky. I tried invoking Add from build/jam/MathRules as
HAIKU_BOARD_LOADER_ENTRY_NBSD = [ Add $(HAIKU_BOARD_LOADER_BASE) + 8 ]
but that doesn't work because a hex value is passed to Add, which is classified as NaN by the rule Num. I don't think the other rules(AddNumAbs and AddNum) are meant to be invoked directly. One solution is to add a rule that accepts hex values but that might be too much work right now. Another solution is to perhaps perform all computations in sh using printf and bc perhaps. The problem is that this variable is passed directly to mkimage and thus should be a hex string.
comment:6 by , 10 years ago
You can use bc with hex numbers. To get hex input and output you use:
echo "obase=16;ibase=16;80800000+8" | bc
Be careful to set obase first, otherwise, you have to set the obase using the ibase previously configured:
echo "ibase=16;obase=10;80800000+8" | bc # Note obase is set to 0x10 here.
http://docstore.mik.ua/orelly/unix/upt/ch49_02.htm http://docstore.mik.ua/orelly/unix/upt/ch49_03.htm
bc (with both obase and ibase) is part of POSIX, and should be safe to use on all our supported build platforms: http://pubs.opengroup.org/onlinepubs/009695399/utilities/bc.html
by , 10 years ago
Attachment: | Reserve-8MB-space-for-kernel-before-RAM_loader-2.patch added |
---|
comment:7 by , 10 years ago
Changes in the new patch from previous one.
- LOADER_ENTRY_RAW and LOADER_ENTRY_NBSD values are relative to LOADER_BASE.
- Sections RAM_stack and RAM_initrd are defined relative to LOADER_STACK_BASE and LOADER_UIBASE. The latter two values are passed along with ASFLAGS, CCFLAGS and C++FLAGS defined in BoardSetup.
Revised patch to reserve 8MB space for kernel just before RAM_loader instead of moving the entire memory map to a higher address.