|
From: | Blue Swirl |
Subject: | RE: [Qemu-devel] Potential sparc32 MMU bug |
Date: | Sat, 17 Feb 2007 09:21:29 +0100 |
While working on getting SunOS to boot under qemu, I ran into a very odd bug, and I'm not sure whose fault it is.
Excellent, there are not too many Sparc developers!
The SunOS bootloader tries to install trap 0 by writing to the trap table. The trap table is in the .text (read-only) section of the OpenBIOS ROM. The bug is that the write to the read-only section silently fails -- it doesn't cause an interrupt in the VM. It looks like the VM believes all of the ROM is rwx (based on my examination of cpu_sparc_handle_mmu_fault). I presume the write fails because of Linux's memory protection (since the OpenBIOS ELF is mmap'd). But I'm not sure why the disallowed write doesn't cause _something_ to happen. Should qemu be catching the failed write and passing it on to the VM? Does qemu need to tell the VM's MMU which portions of the loaded ROM are read-only? Or does OpenBIOS need to inform the VM's MMU that the loaded .text section is read-only? I presume it's something OpenBIOS should be doing, but that mailing list is very very quiet, and I figured I'd make sure it wasn't an underlying qemu bug.How should qemu be handling this? What parts of qemu should I look at next?
OpenBIOS programs the MMU as the first thing in startup, please see arch/sparc32/head.S. It maps the .text area of ROM with 1:1 mapping, the protection is RWX despite the comment saying that it's execute-only (sorry). This explains why the fault does not happen. In OpenBIOS, .data is not used at all, only .rodata and .bss, so changing just the ELF directive does not help but the ROM should be copied to RAM.
Qemu is correct (unless writes to ROM on real Sparc hardware cause MMU/IOMMU faults), but OpenBIOS should be modified. We should continue this in OpenBIOS mailing list as this is not related to Qemu.
_________________________________________________________________Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/
[Prev in Thread] | Current Thread | [Next in Thread] |