mikaku / Fiwix

A UNIX-like kernel for the i386 architecture
https://www.fiwix.org
Other
407 stars 32 forks source link

[coreboot/AMD] Page Fault at 0x00400000 (writing) with error code 0x00000002 (0b10) #2

Closed informer2016 closed 5 years ago

informer2016 commented 5 years ago

@mikaku after #1 happened in QEMU , today I tested Fiwix v1.0.1 as a virtual floppy inside coreboot+SeaBIOS build for quadcore AMD A10-5750M Lenovo G505S laptop with 16GB RAM installed (great powerful coreboot-supported laptop by the way, it doesn't have Intel ME / AMD PSP hardware backdoors inside its' CPU and could be found online for $100-$150 in good condition, if any questions I'll be happy to answer) However I also got an error, this time an earlier different one : cb-amd.txt Memory map lines marked with <- ??? are questionable because after the first screen (ending with console) it waits for a few seconds but then dumps a lot of info very quickly and despite my best efforts I couldn't take a reliable clear photo of the middle part - it's being skipped very quickly (is there a way to slow down the logs printing?)

mikaku commented 5 years ago

The 3 or 4 seconds of wait is because it is initializing the keyboard, then the memory is initialized. It's strange to have that page fault at 0x00400000. Please, check if Linux is giving the same memory map.

It looks like this map is unreal, otherwise the kernel should have shown a message saying it will only use the first 1GB of memory. Which is the maximum amount of physical memory supported.

informer2016 commented 5 years ago

@mikaku, here is my memory map at Linux

[    0.000000] e820: BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000bfb5cfff] usable
[    0.000000] BIOS-e820: [mem 0x00000000bfb5d000-0x00000000bfcc4fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000bfcc5000-0x00000000bfd1ffff] usable
[    0.000000] BIOS-e820: [mem 0x00000000bfd20000-0x00000000dfffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000f8000000-0x00000000fbffffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000041effffff] usable
informer2016 commented 5 years ago

@mikaku as you see it's almost matching the Fiwix memory map, except 1st and 3rd of the last 3 lines:

          0x00000000BFD20000-0x00000000F8000000 reserved  <- ???
          0x00000000F8000000-0x0000000FC0000000 reserved
          0x0000000100000000-0x00000001F0000000 available
mikaku commented 5 years ago

It looks like you found a bug! :smiley:

Please, use this patched image fiwix-floppy.zip and let me know if it now works as expected.

Thanks.

informer2016 commented 5 years ago

@mikaku finally a Fiwix boot log for new floppy inside cb+SB at G505S, cb-amd-2.txt , please take a look

mikaku commented 5 years ago

I think I know what is happening here.

The Fiwix kernel supports only ISA devices. That is, it won't detect any PCI devices as explained in the Fiwix web site. The virtual floppy created by the coreboot+SeaBIOS is probably a PCI device. That's why once the kernel booted it is unable to detect the floppy drive and continue reading from there.

This is also related to #1.

You should try to configure the virtual floppy drive as ISA, not PCI.

informer2016 commented 5 years ago

@mikaku I'm not sure if changing it from PCI to ISA is possible, without rewriting a lot of SeaBIOS code at least. Please tell, is there an easy way to somehow attach the Fiwix filesystem closer to Fiwix kernel, so that if kernel successfully booted it could guaranteed access the rest of files from its' own filesystem?

mikaku commented 5 years ago

Please tell, is there an easy way to somehow attach the Fiwix filesystem closer to Fiwix kernel, so that if kernel successfully booted it could guaranteed access the rest of files from its' own filesystem?

No, the Fiwix kernel doesn't has support for an initrd (initial ramdisk) image.

Another option, is to use a CDROM (ISO) image instead of a floppy image.

informer2016 commented 5 years ago

@mikaku sadly only floppy format is supported for this "internal ramdisk" storage... By the way, SeaBIOS unpacks the whole floppy image to RAM as a single 1.44MB piece - both Fiwix kernel and all the other files from this floppy as well. Is it true that currently the Fiwix kernel doesn't try to use these files in RAM which got unpacked together with kernel?

mikaku commented 5 years ago

This issue can be closed, let's talk about SeaBIOS in #1