aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-03-31 18:47:14 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-03-31 18:47:14 +0100
commit7d4d7975e58b66de6a67ecb5aa9656653653a658 (patch)
treee80fcd044516d50dadf27226fb25facebb783e0a
parent8648fcd52a9bcc2aa415cbe87b7c636e545acb38 (diff)
parent0d6d1ab4990b6e8c6f24e9b1308801d657d411ad (diff)
Merge remote-tracking branch 'remotes/afaerber/tags/qom-cpu-for-2.0' into staging
QOM CPUState refactorings / X86CPU * X86CPU IA32e 1GB paging support * Performance quickfix for CPU() cast macro # gpg: Signature made Mon 31 Mar 2014 18:33:27 BST using RSA key ID 3E7E013F # gpg: Good signature from "Andreas Färber <afaerber@suse.de>" # gpg: aka "Andreas Färber <afaerber@suse.com>" * remotes/afaerber/tags/qom-cpu-for-2.0: cpu: Avoid QOM casts for CPU() target-i386: x86_cpu_get_phys_page_debug(): support 1GB page translation Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--include/qom/cpu.h7
-rw-r--r--target-i386/helper.c11
2 files changed, 17 insertions, 1 deletions
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index f99885a137..df977c88f0 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -53,7 +53,12 @@ typedef uint64_t vaddr;
#define TYPE_CPU "cpu"
-#define CPU(obj) OBJECT_CHECK(CPUState, (obj), TYPE_CPU)
+/* Since this macro is used a lot in hot code paths and in conjunction with
+ * FooCPU *foo_env_get_cpu(), we deviate from usual QOM practice by using
+ * an unchecked cast.
+ */
+#define CPU(obj) ((CPUState *)(obj))
+
#define CPU_CLASS(class) OBJECT_CLASS_CHECK(CPUClass, (class), TYPE_CPU)
#define CPU_GET_CLASS(obj) OBJECT_GET_CLASS(CPUClass, (obj), TYPE_CPU)
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 4f447b8cf9..372f0e3ecb 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -941,6 +941,14 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
pdpe = ldq_phys(cs->as, pdpe_addr);
if (!(pdpe & PG_PRESENT_MASK))
return -1;
+
+ if (pdpe & PG_PSE_MASK) {
+ page_size = 1024 * 1024 * 1024;
+ pte = pdpe & ~( (page_size - 1) & ~0xfff);
+ pte &= ~(PG_NX_MASK | PG_HI_USER_MASK);
+ goto out;
+ }
+
} else
#endif
{
@@ -993,6 +1001,9 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
pte = pte & env->a20_mask;
}
+#ifdef TARGET_X86_64
+out:
+#endif
page_offset = (addr & TARGET_PAGE_MASK) & (page_size - 1);
paddr = (pte & TARGET_PAGE_MASK) + page_offset;
return paddr;