[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-trivial] [PULL 07/17] x86: only allow real mode to access 32bit wi
From: |
Michael Tokarev |
Subject: |
[Qemu-trivial] [PULL 07/17] x86: only allow real mode to access 32bit without LMA |
Date: |
Sat, 28 Dec 2013 02:07:20 +0400 |
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>
---
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.10.4
- [Qemu-trivial] [PULL 00/17] trivial patches for 2013-12-27, Michael Tokarev, 2013/12/27
- [Qemu-trivial] [PULL 01/17] hw/arm/highbank: Simplify code (memory region in device state), Michael Tokarev, 2013/12/27
- [Qemu-trivial] [PULL 05/17] exynos4210: Use macro ARRAY_SIZE where possible, Michael Tokarev, 2013/12/27
- [Qemu-trivial] [PULL 03/17] misc: Use macro ARRAY_SIZE where possible, Michael Tokarev, 2013/12/27
- [Qemu-trivial] [PULL 07/17] x86: only allow real mode to access 32bit without LMA,
Michael Tokarev <=
- [Qemu-trivial] [PULL 02/17] openrisc: Fix spelling in comment (transaltion -> translation), Michael Tokarev, 2013/12/27
- [Qemu-trivial] [PULL 08/17] vl: make boot_strict variable static (not used outside vl.c), Michael Tokarev, 2013/12/27
- [Qemu-trivial] [PULL 15/17] pxa27x: Add 'const' attribute to keyboard maps, Michael Tokarev, 2013/12/27
- [Qemu-trivial] [PULL 06/17] linux-user: Use macro TARGET_NSIG_WORDS where possible, Michael Tokarev, 2013/12/27
- [Qemu-trivial] [PULL 11/17] configure: Rewrite code for help message, Michael Tokarev, 2013/12/27
- [Qemu-trivial] [PULL 12/17] configure: Python tests must be done before help message, Michael Tokarev, 2013/12/27
- [Qemu-trivial] [PULL 09/17] fix -boot strict regressed in commit 6ef4716, Michael Tokarev, 2013/12/27
- [Qemu-trivial] [PULL 17/17] acpi unit-test: Remove temporary disk after test, Michael Tokarev, 2013/12/27
- [Qemu-trivial] [PULL 04/17] ui/cocoa: Use macro ARRAY_SIZE where possible, Michael Tokarev, 2013/12/27
- [Qemu-trivial] [PULL 14/17] pxa27x: Reduce size of keyboard matrix mapping, Michael Tokarev, 2013/12/27