[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 20/51] x86: only allow real mode to access 32bit wit
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 20/51] x86: only allow real mode to access 32bit without LMA |
Date: |
Fri, 21 Feb 2014 02:16:56 -0600 |
From: Alexander Graf <address@hidden>
When we're running in non-64bit mode with qemu-system-x86_64 we can
still end up with virtual addresses that are above the 32bit boundary
if a segment offset is set up.
GNU Hurd does exactly that. It sets the segment offset to 0x80000000 and
puts its EIP value to 0x8xxxxxxx to access low memory.
This doesn't hit us when we enable paging, as there we just mask away the
unused bits. But with real mode, we assume that vaddr == paddr which is
wrong in this case. Real hardware wraps the virtual address around at the
32bit boundary. So let's do the same.
This fixes booting GNU Hurd in qemu-system-x86_64 for me.
Reported-by: Michael Tokarev <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
(cherry picked from commit 33dfdb56f2f3c8686d218395b871ec12fd5bf30b)
Signed-off-by: Michael Roth <address@hidden>
---
target-i386/helper.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 7c196ff..ed965d6 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -531,6 +531,12 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env,
target_ulong addr,
if (!(env->cr[0] & CR0_PG_MASK)) {
pte = addr;
+#ifdef TARGET_X86_64
+ if (!(env->hflags & HF_LMA_MASK)) {
+ /* Without long mode we can only address 32bits in real mode */
+ pte = (uint32_t)pte;
+ }
+#endif
virt_addr = addr & TARGET_PAGE_MASK;
prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
page_size = 4096;
--
1.7.9.5
- [Qemu-devel] [PATCH 11/51] virtio-rng: switch exit callback to VirtioDeviceClass, (continued)
- [Qemu-devel] [PATCH 11/51] virtio-rng: switch exit callback to VirtioDeviceClass, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 09/51] virtio-scsi: switch exit callback to VirtioDeviceClass, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 12/51] virtio-pci: add device_unplugged callback, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 13/51] scsi-bus: fix transfer length and direction for VERIFY command, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 14/51] scsi-disk: fix VERIFY emulation, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 17/51] qom: Split out object and class caches, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 16/51] memory.c: bugfix - ref counting mismatch in memory_region_find, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 15/51] intel-hda: fix position buffer, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 19/51] vl: add missing transition debug->finish_migrate, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 18/51] migration: Fix rate limit, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 20/51] x86: only allow real mode to access 32bit without LMA,
Michael Roth <=
- [Qemu-devel] [PATCH 21/51] qdev-monitor: Avoid device_add crashing on non-device driver name, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 22/51] split definitions for exec.c and translate-all.c radix trees, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 06/51] virtio-blk: switch exit callback to VirtioDeviceClass, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 24/51] exec: pass hw address to phys_page_find, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 23/51] exec: replace leaf with skip, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 25/51] exec: separate sections and nodes per address space, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 26/51] pc: map PCI address space as catchall region for not mapped addresses, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 28/51] target-mips: fix 64-bit FPU config for user-mode emulation, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 29/51] linux-user: pass correct parameter to do_shmctl(), Michael Roth, 2014/02/21