[haiku-bugs] Re: [Haiku] #11896: ARM loader: arch_mmu positioning dynamic va start incorrectly. (was: ARM: arch_mmu assumes RAM starts at 80000000)

  • From: "kallisti5" <trac@xxxxxxxxxxxx>
  • Date: Thu, 12 Mar 2015 12:35:57 -0000

#11896: ARM loader: arch_mmu positioning dynamic va start incorrectly.
------------------------------+--------------------------------------------
   Reporter:  kallisti5       |      Owner:  pdziepak
       Type:  bug             |     Status:  new
   Priority:  normal          |  Milestone:  Unscheduled
  Component:  System/Boot     |    Version:  R1/Development
  Loader                      |   Keywords:  ARM MMU pfoetchen mmu_man rpi2
 Resolution:                  |   Blocking:
 Blocked By:                  |   Platform:  arm
Has a Patch:  1               |
------------------------------+--------------------------------------------
Description changed by kallisti5:

Old description:

> arch_mmu assumes that system RAM always starts at 80000000 which isn't
> true for all arm boards.
>

> **src/system/boot/arch/arm/arch_mmu.cpp**
>
> {{{
> // Mark start for dynamic allocation
> IsNextPhysicalAddress =
> IsNextVirtualAddress = sPageTableRegionEnd;
> }}}
>

> (per mmu_man)
>
> {{{
>
> src/system/boot/arch/arm/arch_mmu.cpp:  sPageTableRegionEnd =
> (addr_t)sPageDirectory + 0x200000;
>
> src/system/boot/arch/arm/arch_mmu.cpp:  sPageDirectory = (uint32
> *)ROUNDUP((addr_t)&_end, 0x100000);
>

> src/system/boot/arch/arm/arch_mmu.cpp:extern int _start, _end;
>

> ./src/system/ldscripts/arm/boot_loader_u-boot.ld
>       . = BOARD_LOADER_BASE;
>       .
>       .
>       _end = . ;
> }}}
>
> Example boot on Raspberry Pi 2..
> {{{
> reading /boot.scr
> 312 bytes read in 15 ms (19.5 KiB/s)
> ## Executing script at 00000000
> reading bcm2836-rpi-2-b.dtb
> 5690 bytes read in 16 ms (346.7 KiB/s)
> reading haiku-floppyboot.tgz.ub
> 1596766 bytes read in 600 ms (2.5 MiB/s)
> reading haiku_loader_linux.ub
> 288696 bytes read in 124 ms (2.2 MiB/s)
> ## Booting kernel from Legacy Image at 01000000 ...
>    Image Name:   haiku_loader rpi2
>    Image Type:   ARM Linux Kernel Image (uncompressed)
>    Data Size:    288632 Bytes = 281.9 KiB
>    Load Address: 00080000
>    Entry Point:  00080010
>    Verifying Checksum ... OK
> ## Loading init Ramdisk from Legacy Image at 02100000 ...
>    Image Name:   haiku-floppyboot.tgz rpi2
>    Image Type:   ARM Linux RAMDisk Image (uncompressed)
>    Data Size:    1596702 Bytes = 1.5 MiB
>    Load Address: 00000000
>    Entry Point:  00000000
>    Verifying Checksum ... OK
> ## Flattened Device Tree blob at 02000000
>    Booting using the fdt blob at 0x2000000
>    Loading Kernel Image ... OK
>    Loading Ramdisk to 079c4000, end 07b49d1e ... OK
>    Loading Device Tree to 079bf000, end 079c3639 ... OK
>
> Starting kernel ...
>
> �check_cpu_features: implementor=0x41('A'), arch=9, variant=0x0,
> part=0xc07, revision=0x5
> Found boot tgz from FDT @ 0x079c4000, 1596702 bytes
> argc = 0
> os: 2
> gd @ 0x00000000
> FDT @ 0x079bf000:
> fdt_totalsize: 8320
> fdt_off_dt_struct: 88
> fdt_off_dt_strings: 5252
> fdt_off_mem_rsvmap: 40
> fdt_version: 17
> fdt_last_comp_version: 16
> fdt_boot_cpuid_phys: 0
> fdt_size_dt_strings: 733
> fdt_size_dt_struct: 5164
> checking for memory...
> 0: base = 0,size = 134217728
> total physical memory = 128MB
> *** PANIC ***
> *** PANIC ***
> map_page: asked to map invalid page 0x00300000!
> map_page: asked to map invalid page 0x00300000!
>

> Press key to reboot.
> *** PANIC ***
> *** PANIC ***
> map_page: asked to map invalid page 0x00301000!
> map_page: asked to map invalid page 0x00301000!
>

> Press key to reboot.
> *** PANIC ***
> *** PANIC ***
> map_page: asked to map invalid page 0x00302000!
> map_page: asked to map invalid page 0x00302000!
>

> Press key to reboot.
> .
> .
> }}}

New description:

 **src/system/boot/arch/arm/arch_mmu.cpp**

 {{{
 // Mark start for dynamic allocation
 IsNextPhysicalAddress =
 IsNextVirtualAddress = sPageTableRegionEnd;
 }}}


 (per mmu_man)

 {{{

 src/system/boot/arch/arm/arch_mmu.cpp:  sPageTableRegionEnd =
 (addr_t)sPageDirectory + 0x200000;

 src/system/boot/arch/arm/arch_mmu.cpp:  sPageDirectory = (uint32
 *)ROUNDUP((addr_t)&_end, 0x100000);


 src/system/boot/arch/arm/arch_mmu.cpp:extern int _start, _end;


 ./src/system/ldscripts/arm/boot_loader_u-boot.ld
       . = BOARD_LOADER_BASE;
       .
       .
       _end = . ;
 }}}

 Example boot on Raspberry Pi 2..
 {{{
 reading /boot.scr
 312 bytes read in 15 ms (19.5 KiB/s)
 ## Executing script at 00000000
 reading bcm2836-rpi-2-b.dtb
 5690 bytes read in 16 ms (346.7 KiB/s)
 reading haiku-floppyboot.tgz.ub
 1596766 bytes read in 600 ms (2.5 MiB/s)
 reading haiku_loader_linux.ub
 288696 bytes read in 124 ms (2.2 MiB/s)
 ## Booting kernel from Legacy Image at 01000000 ...
    Image Name:   haiku_loader rpi2
    Image Type:   ARM Linux Kernel Image (uncompressed)
    Data Size:    288632 Bytes = 281.9 KiB
    Load Address: 00080000
    Entry Point:  00080010
    Verifying Checksum ... OK
 ## Loading init Ramdisk from Legacy Image at 02100000 ...
    Image Name:   haiku-floppyboot.tgz rpi2
    Image Type:   ARM Linux RAMDisk Image (uncompressed)
    Data Size:    1596702 Bytes = 1.5 MiB
    Load Address: 00000000
    Entry Point:  00000000
    Verifying Checksum ... OK
 ## Flattened Device Tree blob at 02000000
    Booting using the fdt blob at 0x2000000
    Loading Kernel Image ... OK
    Loading Ramdisk to 079c4000, end 07b49d1e ... OK
    Loading Device Tree to 079bf000, end 079c3639 ... OK

 Starting kernel ...

 �check_cpu_features: implementor=0x41('A'), arch=9, variant=0x0,
 part=0xc07, revision=0x5
 Found boot tgz from FDT @ 0x079c4000, 1596702 bytes
 argc = 0
 os: 2
 gd @ 0x00000000
 FDT @ 0x079bf000:
 fdt_totalsize: 8320
 fdt_off_dt_struct: 88
 fdt_off_dt_strings: 5252
 fdt_off_mem_rsvmap: 40
 fdt_version: 17
 fdt_last_comp_version: 16
 fdt_boot_cpuid_phys: 0
 fdt_size_dt_strings: 733
 fdt_size_dt_struct: 5164
 checking for memory...
 0: base = 0,size = 134217728
 total physical memory = 128MB
 *** PANIC ***
 *** PANIC ***
 map_page: asked to map invalid page 0x00300000!
 map_page: asked to map invalid page 0x00300000!


 Press key to reboot.
 *** PANIC ***
 *** PANIC ***
 map_page: asked to map invalid page 0x00301000!
 map_page: asked to map invalid page 0x00301000!


 Press key to reboot.
 *** PANIC ***
 *** PANIC ***
 map_page: asked to map invalid page 0x00302000!
 map_page: asked to map invalid page 0x00302000!


 Press key to reboot.
 .
 .
 }}}

--

--
Ticket URL: <https://dev.haiku-os.org/ticket/11896#comment:12>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts:

  • » [haiku-bugs] Re: [Haiku] #11896: ARM loader: arch_mmu positioning dynamic va start incorrectly. (was: ARM: arch_mmu assumes RAM starts at 80000000) - kallisti5