From 54340b17eb042b484652b9f5292ad193bdb02e65 Mon Sep 17 00:00:00 2001
From: Zhang Xiantao <xiantao.zhang@intel.com>
Date: Tue, 11 Dec 2007 18:54:27 +0800
Subject: [PATCH] kvm: qemu: Check page size at initialization time.

Currently, we assume Qemu target page size = HOST page
size, this patch check them. if not equal, print error
info and exit.
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
---
 qemu/hw/ipf.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/qemu/hw/ipf.c b/qemu/hw/ipf.c
index 012073d..9466707 100644
--- a/qemu/hw/ipf.c
+++ b/qemu/hw/ipf.c
@@ -27,6 +27,8 @@
 #include "vl.h"
 #include "firmware.h"
 #include "ia64intrin.h"
+#include <unistd.h>
+
 #ifdef USE_KVM
 #include "qemu-kvm.h"
 extern int kvm_allowed;
@@ -143,6 +145,14 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size, int boot_device,
 	NICInfo *nd;
 	qemu_irq *cpu_irq;
 	qemu_irq *i8259;
+	int page_size;
+
+	page_size = getpagesize();
+	if(page_size != TARGET_PAGE_SIZE) {
+		fprintf(stderr,"Error! Host page size != qemu target page size,\
+			you may need to change TARGET_PAGE_BITS in qemu!!\n");
+		exit(-1);
+	}
 
 	if (ram_size >= 0xc0000000 ) {
 		above_4g_mem_size = ram_size - 0xc0000000;
-- 
1.5.2

