* Izik Eidus <[EMAIL PROTECTED]> [2007-08-14 10:22]:
> Index: rombios.c
> ===================================================================
> RCS file: /cvsroot/bochs/bochs/bios/rombios.c,v
> retrieving revision 1.182
> diff -u -r1.182 rombios.c
> --- rombios.c 1 Aug 2007 17:09:51 -0000 1.182
> +++ rombios.c 14 Aug 2007 10:33:39 -0000
> @@ -4077,24 +4077,32 @@
> }
> #endif
>
> +struct MemoryMap {
Style. Nothing else in rombios.c uses MixedCase.
struct memory_map
> + Bit32u start;
> + Bit16u extra_start;
> + Bit32u end;
> + Bit8u extra_end;
> +};
> +
> +typedef struct MemoryMap *MemoryMap_t;
typedef struct memory_map memory_map_t;
> diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
> index 7bec234..7b767c0 100644
> --- a/qemu/hw/pc.c
> +++ b/qemu/hw/pc.c
> @@ -163,12 +163,13 @@ static void cmos_init_hd(int type_ofs, int info_ofs,
> BlockDriverState *hd)
> }
>
> /* hd_table must contain 4 block drivers */
> -static void cmos_init(unsigned long ram_size, int boot_device,
> BlockDriverState **hd_table)
> +static void cmos_init(unsigned long ram_size, unsigned long
> above_bios_ram_size, int boot_device, BlockDriverState **hd_table)
> {
> RTCState *s = rtc_state;
> int val;
> int fd0, fd1, nb;
> int i;
> + unsigned long above_bios_mem_bits;
>
> /* various important CMOS locations needed by PC/Bochs bios */
>
> @@ -185,6 +186,11 @@ static void cmos_init(unsigned long ram_size, int
> boot_device, BlockDriverState
> rtc_set_memory(s, 0x30, val);
> rtc_set_memory(s, 0x31, val >> 8);
>
> + val = (unsigned int)above_bios_ram_size / 65536;
> + rtc_set_memory(s, 0x5b, val);
> + rtc_set_memory(s, 0x5c, val >> 8);
> + rtc_set_memory(s, 0x5d, above_bios_ram_size/0x100000000);
above_bios_ram_size >> 32 ?
> +
> if (ram_size > (16 * 1024 * 1024))
> val = (ram_size / 65536) - ((16 * 1024 * 1024) / 65536);
> else
> @@ -465,7 +471,7 @@ static void pc_init1(unsigned long ram_size, int
> vga_ram_size, int boot_device,
> {
> char buf[1024];
> int ret, linux_boot, initrd_size, i;
> - unsigned long bios_offset, vga_bios_offset, option_rom_offset;
> + unsigned long bios_offset, vga_bios_offset, option_rom_offset,
> above_bios_mem_size = 0;
> ram_addr_t initrd_offset;
> int bios_size, isa_bios_size;
> PCIBus *pci_bus;
> @@ -473,6 +479,10 @@ static void pc_init1(unsigned long ram_size, int
> vga_ram_size, int boot_device,
> CPUState *env;
> NICInfo *nd;
>
> + if (ram_size + (phys_ram_size - ram_size) >= 0xf0000000 ) {
> + above_bios_mem_size = ram_size - 0xf0000000 + (phys_ram_size -
> ram_size);
> + ram_size = 0xf0000000 - (phys_ram_size - ram_size);
> + }
0xf0000000 is magic number, but related to the Cirrus VGA VRAM base
addr, maybe:
#define VGA_VRAM_BASE 0xf0000000
> linux_boot = (kernel_filename != NULL);
>
> /* init CPUs */
> @@ -492,7 +502,9 @@ static void pc_init1(unsigned long ram_size, int
> vga_ram_size, int boot_device,
> }
>
> /* allocate RAM */
> - cpu_register_physical_memory(0, ram_size, 0);
> + cpu_register_physical_memory(0, ram_size , 0);
whitespace damage, note the comma after ram_size.
> + if (above_bios_mem_size > 0)
> + cpu_register_physical_memory(0x100000000, above_bios_mem_size, 0x0);
>
> /* BIOS load */
> bios_offset = ram_size + vga_ram_size;
> @@ -668,11 +680,10 @@ static void pc_init1(unsigned long ram_size, int
> vga_ram_size, int boot_device,
> register_ioport_write(0x80, 1, 1, ioport80_write, NULL);
>
> register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL);
> -
whitespace.
> if (cirrus_vga_enabled) {
> if (pci_enabled) {
> pci_cirrus_vga_init(pci_bus,
> - ds, phys_ram_base + ram_size, ram_size,
> + ds, phys_ram_base + ram_size, ram_size,
whitespace
> vga_ram_size);
> } else {
> isa_cirrus_vga_init(ds, phys_ram_base + ram_size, ram_size,
> @@ -756,7 +767,7 @@ static void pc_init1(unsigned long ram_size, int
> vga_ram_size, int boot_device,
>
> floppy_controller = fdctrl_init(6, 2, 0, 0x3f0, fd_table);
>
> - cmos_init(ram_size, boot_device, bs_table);
> + cmos_init(ram_size , above_bios_mem_size, boot_device, bs_table);
note the comma after ram_size.
>
> if (pci_enabled && usb_enabled) {
> usb_uhci_init(pci_bus, piix3_devfn + 2);
> diff --git a/user/kvmctl.c b/user/kvmctl.c
> index 43b374d..b07f8a8 100644
> --- a/user/kvmctl.c
> +++ b/user/kvmctl.c
> @@ -43,7 +43,7 @@ static int kvm_abi = EXPECTED_KVM_API_VERSION;
>
> /* FIXME: share this number with kvm */
> /* FIXME: or dynamically alloc/realloc regions */
> -#define KVM_MAX_NUM_MEM_REGIONS 4u
> +#define KVM_MAX_NUM_MEM_REGIONS 5u
> #define MAX_VCPUS 4
>
> /**
> @@ -236,6 +236,7 @@ int kvm_create(kvm_context_t kvm, unsigned long memory,
> void **vm_mem)
> {
> unsigned long dosmem = 0xa0000;
> unsigned long exmem = 0xc0000;
> + unsigned long pcimem = 0xf0000000;
> int fd = kvm->fd;
> int zfd;
> int r;
> @@ -249,6 +250,14 @@ int kvm_create(kvm_context_t kvm, unsigned long memory,
> void **vm_mem)
> .memory_size = memory < exmem ? 0 : memory - exmem,
> .guest_phys_addr = exmem,
> };
> + struct kvm_memory_region above_bios_memory = {
> + .slot = 4,
> + .memory_size = memory < pcimem ? 0 : memory - pcimem,
> + .guest_phys_addr = 0x100000000,
> + };
> +
> + if (extended_memory.memory_size > pcimem)
> + extended_memory.memory_size = pcimem - exmem;
>
> kvm->vcpu_fd[0] = -1;
>
> @@ -273,8 +282,17 @@ int kvm_create(kvm_context_t kvm, unsigned long memory,
> void **vm_mem)
> }
> }
>
> + if (above_bios_memory.memory_size) {
> + r = ioctl(fd, KVM_SET_MEMORY_REGION, &above_bios_memory);
> + if (r == -1) {
> + fprintf(stderr, "kvm_create_memory_region: %m\n");
> + return -1;
> + }
> + }
> +
> kvm_memory_region_save_params(kvm, &low_memory);
> kvm_memory_region_save_params(kvm, &extended_memory);
> + kvm_memory_region_save_params(kvm, &above_bios_memory);
>
> *vm_mem = mmap(NULL, memory, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
> if (*vm_mem == MAP_FAILED) {
> diff --git a/qemu/cpu-all.h b/qemu/cpu-all.h
> index a325e05..90e4351 100644
> --- a/qemu/cpu-all.h
> +++ b/qemu/cpu-all.h
> @@ -822,7 +822,7 @@ int cpu_inl(CPUState *env, int addr);
>
> /* memory API */
>
> -extern int phys_ram_size;
> +extern unsigned long phys_ram_size;
> extern int phys_ram_fd;
> extern uint8_t *phys_ram_base;
> extern uint8_t *phys_ram_dirty;
> diff --git a/qemu/exec.c b/qemu/exec.c
> index 2b050d1..f5cce06 100644
> --- a/qemu/exec.c
> +++ b/qemu/exec.c
> @@ -85,7 +85,7 @@ spinlock_t tb_lock = SPIN_LOCK_UNLOCKED;
> uint8_t code_gen_buffer[CODE_GEN_BUFFER_SIZE] __attribute__((aligned (32)));
> uint8_t *code_gen_ptr;
>
> -int phys_ram_size;
> +unsigned long phys_ram_size;
> int phys_ram_fd;
> uint8_t *phys_ram_base;
> uint8_t *phys_ram_dirty;
> @@ -111,7 +111,7 @@ typedef struct PageDesc {
>
> typedef struct PhysPageDesc {
> /* offset in host memory of the page + io_index in the low 12 bits */
> - uint32_t phys_offset;
> + unsigned long phys_offset;
> } PhysPageDesc;
>
> #define L2_BITS 10
> diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
> index ae92173..7bec234 100644
> --- a/qemu/hw/pc.c
> +++ b/qemu/hw/pc.c
> @@ -163,7 +163,7 @@ static void cmos_init_hd(int type_ofs, int info_ofs,
> BlockDriverState *hd)
> }
>
> /* hd_table must contain 4 block drivers */
> -static void cmos_init(int ram_size, int boot_device, BlockDriverState
> **hd_table)
> +static void cmos_init(unsigned long ram_size, int boot_device,
> BlockDriverState **hd_table)
> {
> RTCState *s = rtc_state;
> int val;
> @@ -457,7 +457,7 @@ extern int kvm_allowed;
> #endif
>
> /* PC hardware initialisation */
> -static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
> +static void pc_init1(unsigned long ram_size, int vga_ram_size, int
> boot_device,
> DisplayState *ds, const char **fd_filename, int
> snapshot,
> const char *kernel_filename, const char *kernel_cmdline,
> const char *initrd_filename,
> @@ -794,7 +794,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int
> boot_device,
> #endif
> }
>
> -static void pc_init_pci(int ram_size, int vga_ram_size, int boot_device,
> +static void pc_init_pci(unsigned long ram_size, int vga_ram_size, int
> boot_device,
> DisplayState *ds, const char **fd_filename,
> int snapshot,
> const char *kernel_filename,
> @@ -807,7 +807,7 @@ static void pc_init_pci(int ram_size, int vga_ram_size,
> int boot_device,
> initrd_filename, 1);
> }
>
> -static void pc_init_isa(int ram_size, int vga_ram_size, int boot_device,
> +static void pc_init_isa(unsigned long ram_size, int vga_ram_size, int
> boot_device,
> DisplayState *ds, const char **fd_filename,
> int snapshot,
> const char *kernel_filename,
> diff --git a/qemu/hw/vga.c b/qemu/hw/vga.c
> index fcb19b0..c1edd88 100644
> --- a/qemu/hw/vga.c
> +++ b/qemu/hw/vga.c
> @@ -1399,10 +1399,11 @@ extern int kvm_allowed;
> static void vga_draw_graphic(VGAState *s, int full_update)
> {
> int y1, y, update, page_min, page_max, linesize, y_start, double_scan,
> mask;
> - int width, height, shift_control, line_offset, page0, page1, bwidth;
> + int width, height, shift_control, line_offset, bwidth;
> int disp_width, multi_scan, multi_run;
> uint8_t *d;
> uint32_t v, addr1, addr;
> + unsigned long page0, page1;
> vga_draw_line_func *vga_draw_line;
>
> #ifdef USE_KVM
> diff --git a/qemu/vl.c b/qemu/vl.c
> index b14233c..5dd6eec 100644
> --- a/qemu/vl.c
> +++ b/qemu/vl.c
> @@ -101,8 +101,11 @@
>
> //#define DEBUG_UNUSED_IOPORT
> //#define DEBUG_IOPORT
> -
whitespace damage.
> +#if HOST_LONG_BITS < 64
> #define PHYS_RAM_MAX_SIZE (2047 * 1024 * 1024)
> +#else
> +#define PHYS_RAM_MAX_SIZE (2047 * 1024 * 1024 * 1024ULL)
> +#endif
>
> #ifdef TARGET_PPC
> #define DEFAULT_RAM_SIZE 144
> @@ -135,7 +138,7 @@ int nographic;
> const char* keyboard_layout = NULL;
> int64_t ticks_per_sec;
> int boot_device = 'c';
> -int ram_size;
> +unsigned long ram_size;
> int pit_min_timer_count = 0;
> int nb_nics;
> NICInfo nd_table[MAX_NICS];
> @@ -7182,7 +7185,7 @@ int main(int argc, char **argv)
> help();
> break;
> case QEMU_OPTION_m:
> - ram_size = atoi(optarg) * 1024 * 1024;
> + ram_size = (unsigned long)atoi(optarg) * 1024 * 1024;
> if (ram_size <= 0)
> help();
> if (ram_size > PHYS_RAM_MAX_SIZE) {
> diff --git a/qemu/vl.h b/qemu/vl.h
> index 43f56bd..d35b47f 100644
> --- a/qemu/vl.h
> +++ b/qemu/vl.h
> @@ -153,7 +153,7 @@ void qemu_system_powerdown(void);
>
> void main_loop_wait(int timeout);
>
> -extern int ram_size;
> +extern unsigned long ram_size;
> extern int bios_size;
> extern int rtc_utc;
> extern int cirrus_vga_enabled;
> @@ -716,7 +716,7 @@ void path_combine(char *dest, int dest_size,
>
> #ifndef QEMU_TOOL
>
> -typedef void QEMUMachineInitFunc(int ram_size, int vga_ram_size,
> +typedef void QEMUMachineInitFunc(unsigned long ram_size, int vga_ram_size,
> int boot_device,
> DisplayState *ds, const char **fd_filename, int snapshot,
> const char *kernel_filename, const char *kernel_cmdline,
> diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
> index dac2f93..1613f23 100644
> --- a/drivers/kvm/vmx.c
> +++ b/drivers/kvm/vmx.c
> @@ -905,7 +905,7 @@ static void enter_pmode(struct kvm_vcpu *vcpu)
> vmcs_write32(GUEST_CS_AR_BYTES, 0x9b);
> }
>
> -static int rmode_tss_base(struct kvm* kvm)
> +static gva_t rmode_tss_base(struct kvm* kvm)
> {
> gfn_t base_gfn = kvm->memslots[0].base_gfn + kvm->memslots[0].npages -
> 3;
> return base_gfn << PAGE_SHIFT;
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> kvm-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/kvm-devel
--
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253 T/L: 678-9253
[EMAIL PROTECTED]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel