Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvme磁盘测试报错 #398

Open
fish4terrisa-MSDSM opened this issue Nov 7, 2022 · 1 comment
Open

nvme磁盘测试报错 #398

fish4terrisa-MSDSM opened this issue Nov 7, 2022 · 1 comment

Comments

@fish4terrisa-MSDSM
Copy link

fish4terrisa-MSDSM commented Nov 7, 2022

log:

BdsDxe: starting Boot0001 "UEFI QEMU HARDDISK QM00001 " from PciRoot(0x0)/Pci(0x1,0x1)/Ata(Primary,Master,0x0)
[ INFO]:  src/main.rs@043: bootloader is running
[ INFO]:  src/main.rs@159: opening file: \EFI\Boot\rboot.conf
[ INFO]:  src/main.rs@181: loading file to memory
[ WARN]: src/config.rs@071: undefined config key: LOG
[ INFO]:  src/main.rs@211: switching graphic mode
[ INFO]:  src/main.rs@052: config: Config {
[ INFO]:  src/main.rs@052:     kernel_stack_address: 0xffffff0100000000,
[ INFO]:  src/main.rs@052:     kernel_stack_size: 0x200,
[ INFO]:  src/main.rs@052:     physical_memory_offset: 0xffff800000000000,
[ INFO]:  src/main.rs@052:     kernel_path: "\\EFI\\zCore\\zcore.elf",
[ INFO]:  src/main.rs@052:     resolution: Some(
[ INFO]:  src/main.rs@052:         (
[ INFO]:  src/main.rs@052:             0x320,
[ INFO]:  src/main.rs@052:             0x258,                                                     [ INFO]:  src/main.rs@052:         ),                                                             [ INFO]:  src/main.rs@052:     ),                                                                 [ INFO]:  src/main.rs@052:     initramfs: Some(                                                   [ INFO]:  src/main.rs@052:         "\\EFI\\zCore\\x86_64.img",
[ INFO]:  src/main.rs@052:     ),
[ INFO]:  src/main.rs@052:     cmdline: "LOG=info",                                               [ INFO]:  src/main.rs@052: }
[ INFO]:  src/main.rs@060: acpi2: 0xbedfa014
[ INFO]:  src/main.rs@068: smbios: 0xbedcc000                                                     [ INFO]:  src/main.rs@159: opening file: \EFI\zCore\zcore.elf
[ INFO]:  src/main.rs@181: loading file to memory
[ INFO]:  src/main.rs@159: opening file: \EFI\zCore\x86_64.img                                    [ INFO]:  src/main.rs@181: loading file to memory
[ INFO]: src/page_table.rs@012: mapping ELF                                                       [DEBUG]: src/page_table.rs@056: mapping segment: Ph64(
[DEBUG]: src/page_table.rs@056:     ProgramHeader64 {                                             [DEBUG]: src/page_table.rs@056:         type_: Ok(
[DEBUG]: src/page_table.rs@056:             Load,                                                 [DEBUG]: src/page_table.rs@056:         ),
[DEBUG]: src/page_table.rs@056:         flags: Flags(
[DEBUG]: src/page_table.rs@056:             0x5,
[DEBUG]: src/page_table.rs@056:         ),
[DEBUG]: src/page_table.rs@056:         offset: 0x1000,
[DEBUG]: src/page_table.rs@056:         virtual_addr: 0xffffff0000000000,
[DEBUG]: src/page_table.rs@056:         physical_addr: 0xffffff0000000000,
[DEBUG]: src/page_table.rs@056:         file_size: 0xee6bb,
[DEBUG]: src/page_table.rs@056:         mem_size: 0xee6bb,
[DEBUG]: src/page_table.rs@056:         align: 0x1000,
[DEBUG]: src/page_table.rs@056:     },
[DEBUG]: src/page_table.rs@056: )
[DEBUG]: src/page_table.rs@056: mapping segment: Ph64(
[DEBUG]: src/page_table.rs@056:     ProgramHeader64 {
[DEBUG]: src/page_table.rs@056:         type_: Ok(
[DEBUG]: src/page_table.rs@056:             Load,
[DEBUG]: src/page_table.rs@056:         ),
[DEBUG]: src/page_table.rs@056:         flags: Flags(
[DEBUG]: src/page_table.rs@056:             0x4,
[DEBUG]: src/page_table.rs@056:         ),
[DEBUG]: src/page_table.rs@056:         offset: 0xf0000,
[DEBUG]: src/page_table.rs@056:         virtual_addr: 0xffffff00000ef000,
[DEBUG]: src/page_table.rs@056:         physical_addr: 0xffffff00000ef000,
[DEBUG]: src/page_table.rs@056:         file_size: 0x2d56c,
[DEBUG]: src/page_table.rs@056:         mem_size: 0x2d56c,
[DEBUG]: src/page_table.rs@056:         align: 0x1000,
[DEBUG]: src/page_table.rs@056:     },
[DEBUG]: src/page_table.rs@056: )
[DEBUG]: src/page_table.rs@056: mapping segment: Ph64(
[DEBUG]: src/page_table.rs@056:     ProgramHeader64 {
[DEBUG]: src/page_table.rs@056:         type_: Ok(
[DEBUG]: src/page_table.rs@056:             Load,
[DEBUG]: src/page_table.rs@056:         ),
[DEBUG]: src/page_table.rs@056:         flags: Flags(
[DEBUG]: src/page_table.rs@056:             0x6,
[DEBUG]: src/page_table.rs@056:         ),
[DEBUG]: src/page_table.rs@056:         offset: 0x11e000,
[DEBUG]: src/page_table.rs@056:         virtual_addr: 0xffffff000011d000,
[DEBUG]: src/page_table.rs@056:         physical_addr: 0xffffff000011d000,
[DEBUG]: src/page_table.rs@056:         file_size: 0x10090,
[DEBUG]: src/page_table.rs@056:         mem_size: 0x10090,
[DEBUG]: src/page_table.rs@056:         align: 0x1000,
[DEBUG]: src/page_table.rs@056:     },
[DEBUG]: src/page_table.rs@056: )
[DEBUG]: src/page_table.rs@056: mapping segment: Ph64(
[DEBUG]: src/page_table.rs@056:     ProgramHeader64 {
[DEBUG]: src/page_table.rs@056:         type_: Ok(
[DEBUG]: src/page_table.rs@056:             Load,
[DEBUG]: src/page_table.rs@056:         ),
[DEBUG]: src/page_table.rs@056:         flags: Flags(
[DEBUG]: src/page_table.rs@056:             0x6,
[DEBUG]: src/page_table.rs@056:         ),
[DEBUG]: src/page_table.rs@056:         offset: 0x12f000,
[DEBUG]: src/page_table.rs@056:         virtual_addr: 0xffffff000012e000,
[DEBUG]: src/page_table.rs@056:         physical_addr: 0xffffff000012e000,
[DEBUG]: src/page_table.rs@056:         file_size: 0x0,
[DEBUG]: src/page_table.rs@056:         mem_size: 0x1223038,
[DEBUG]: src/page_table.rs@056:         align: 0x1000,
[DEBUG]: src/page_table.rs@056:     },
[DEBUG]: src/page_table.rs@056: )
[ INFO]: src/page_table.rs@026: mapping stack at 0xffffff0100000000
[ INFO]: src/page_table.rs@160: mapping physical memory
[ INFO]:  src/main.rs@127: exit boot services
[  2.082413 INFO  0 0:0 zcore] Boot options: BootOptions {
    cmdline: "LOG=info",
    log_level: "info",
    root_proc: "/bin/busybox?sh",
}
[  2.084389 INFO  0 0:0 zcore::memory] Frame allocator: add range 0x1000..0x87000
[  2.086268 INFO  0 0:0 zcore::memory] Frame allocator: add range 0x88000..0xa0000
[  2.086797 INFO  0 0:0 zcore::memory] Frame allocator: add range 0x100000..0x800000
[  2.087148 INFO  0 0:0 zcore::memory] Frame allocator: add range 0x808000..0x810000
[  2.088095 INFO  0 0:0 zcore::memory] Frame allocator: add range 0x1400000..0xba493000
[  2.088471 INFO  0 0:0 zcore::memory] Frame allocator: add range 0xbec1b000..0xbec1c000
[  2.088707 INFO  0 0:0 zcore::memory] Frame allocator: add range 0xbf000000..0xbf0bd000
[  2.088815 INFO  0 0:0 zcore::memory] Frame allocator init end.
[  2.089354 INFO  0 0:0 kernel_hal::imp::boot] Primary CPU 0 init...
[  2.091969 INFO  0 0:0 zcore_drivers::utils::irq_manager] IRQ register handler 0
[  2.092588 INFO  0 0:0 zcore_drivers::utils::irq_manager] IRQ register handler 0
[  2.092943 INFO  0 0:0 zcore_drivers::utils::irq_manager] IRQ register handler 1
[  2.093592 INFO  0 0:0 zcore_drivers::bus::pci]
[  2.093931 INFO  0 0:0 zcore_drivers::bus::pci] --------- PCI bus:device:function ---------
[  2.094861 INFO  0 0:0 zcore_drivers::bus::pci] pci: 0:0:0 8086:1237 (6 0) irq: 255:None
[  2.095718 WARN  0 0:0 zcore_drivers::bus::pci] NoResources, failed to initialize PCI device: 8086:1237
[  2.096194 INFO  0 0:0 zcore_drivers::bus::pci] pci: 0:1:0 8086:7000 (6 1) irq: 255:None
[  2.096523 WARN  0 0:0 zcore_drivers::bus::pci] NoResources, failed to initialize PCI device: 8086:7000
[  2.097258 INFO  0 0:0 zcore_drivers::bus::pci] pci: 0:1:1 8086:7010 (1 1) irq: 255:None
[  2.098590 WARN  0 0:0 zcore_drivers::bus::pci] NoResources, failed to initialize PCI device: 8086:7010
[  2.098831 INFO  0 0:0 zcore_drivers::bus::pci] pci: 0:1:3 8086:7113 (6 128) irq: 10:Some(INTA)
[  2.099205 WARN  0 0:0 zcore_drivers::bus::pci] NoResources, failed to initialize PCI device: 8086:7113
[  2.100227 INFO  0 0:0 zcore_drivers::bus::pci] pci: 0:2:0 1234:1111 (3 0) irq: 255:None
[  2.100724 WARN  0 0:0 zcore_drivers::bus::pci] NoResources, failed to initialize PCI device: 1234:1111
[  2.102478 INFO  0 0:0 zcore_drivers::bus::pci] pci: 0:3:0 8086:10d3 (2 0) irq: 11:Some(INTA)
[  2.102977 WARN  0 0:0 zcore_drivers::bus::pci] BAR0 set from 0xc1060000 to 0xc1060000
[  2.103680 WARN  0 0:0 zcore_drivers::bus::pci] pci device enable done
[  2.104536 INFO  0 0:0 zcore_drivers::net::e1000] Probing e1000 enp0s3f0
[  2.106720 INFO  0 0:0 zcore_drivers::net::e1000] e1000 interface enp0s3f0 up with addr 10.0.2.15/24
[  2.107829 INFO  0 0:0 zcore_drivers::bus::pci] pci: 0:4:0 1b36:0010 (1 8) irq: 11:Some(INTA)
[  2.108401 WARN  0 0:0 zcore_drivers::bus::pci] BAR0 set from 0x4 to 0x4
[  2.108699 WARN  0 0:0 zcore_drivers::bus::pci] pci device enable done


panic cpu=0
panicked at 'page fault from kernel private address 0xffff800800000024, flags = WRITE', zCore/src/handler.rs:32:13
[  2.110027 ERROR 0 0:0 zcore::lang]

panicked at 'page fault from kernel private address 0xffff800800000024, flags = WRITE', zCore/src/handler.rs:32:13

命令
qemu-system-x86_64 -net nic,model=e1000e,macaddr=00:20:91:37:33:77 -net user -m 3058 -pflash /storage/emulated/0/OVMF.fd -cpu max,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on --accel tcg,thread=multi -smp 4 -vga std -vnc :3 -serial mon:stdio -drive format=raw,file=fat:rw:./esp -device isa-debug-exit -device nvme,id=nvme-ctrl-0,serial=deadbeef -drive file=/storage/emulated/0/xinhao/windows/arch.qcow2,if=none,id=nvm-1 -device nvme-ns,drive=nvm-1

@yuoo655
Copy link
Contributor

yuoo655 commented Nov 8, 2022

It looks like zcore didn't map the BAR space for device(used to config device under pci)
If you look up query_or_map trait, you can see it's only implemented by arch riscv64.
So you will have a page fault in any other arch. Maybe you can write config to BAR space use physical address directly. Or implement query_or_map for x86 arch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants