Index: ioemu/hw/pc.c =================================================================== --- ioemu.orig/hw/pc.c 2006-08-06 02:15:39.708879311 +0100 +++ ioemu/hw/pc.c 2006-08-06 02:18:18.875135656 +0100 @@ -646,7 +646,9 @@ } /* allocate RAM */ +#ifndef CONFIG_DM /* HVM domain owns memory */ cpu_register_physical_memory(0, ram_size, 0); +#endif /* BIOS load */ bios_offset = ram_size + vga_ram_size; @@ -678,8 +680,10 @@ ret = load_image(buf, phys_ram_base + vga_bios_offset); /* setup basic memory access */ +#ifndef CONFIG_DM /* HVM domain owns memory */ cpu_register_physical_memory(0xc0000, 0x10000, vga_bios_offset | IO_MEM_ROM); +#endif /* map the last 128KB of the BIOS in ISA space */ isa_bios_size = bios_size; Index: ioemu/vl.c =================================================================== --- ioemu.orig/vl.c 2006-08-06 02:18:12.550840673 +0100 +++ ioemu/vl.c 2006-08-06 02:18:45.608155528 +0100 @@ -158,6 +158,8 @@ int acpi_enabled = 1; int fd_bootchk = 1; +int xc_handle; + char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'}; extern int domid; @@ -5650,6 +5652,9 @@ QEMUMachine *machine; char usb_devices[MAX_USB_CMDLINE][128]; int usb_devices_index; + unsigned long nr_pages; + xen_pfn_t *page_array; + extern void *shared_page; char qemu_dm_logfilename[64]; @@ -5917,11 +5922,13 @@ ram_size = atol(optarg) * 1024 * 1024; if (ram_size <= 0) help(); +#ifndef CONFIG_DM if (ram_size > PHYS_RAM_MAX_SIZE) { fprintf(stderr, "qemu: at most %d MB RAM can be simulated\n", PHYS_RAM_MAX_SIZE / (1024 * 1024)); exit(1); } +#endif /* !CONFIG_DM */ break; case QEMU_OPTION_l: { @@ -6133,12 +6140,49 @@ /* init the memory */ phys_ram_size = ram_size + vga_ram_size + bios_size; +#ifdef CONFIG_DM + + nr_pages = ram_size/PAGE_SIZE; + xc_handle = xc_interface_open(); + + page_array = (xen_pfn_t *)malloc(nr_pages * sizeof(xen_pfn_t)); + if (page_array == NULL) { + fprintf(logfile, "malloc returned error %d\n", errno); + exit(-1); + } + + if (xc_get_pfn_list(xc_handle, domid, page_array, nr_pages) != nr_pages) { + fprintf(logfile, "xc_get_pfn_list returned error %d\n", errno); + exit(-1); + } + + phys_ram_base = xc_map_foreign_batch(xc_handle, domid, + PROT_READ|PROT_WRITE, page_array, + nr_pages - 1); + if (phys_ram_base == 0) { + fprintf(logfile, "xc_map_foreign_batch returned error %d\n", errno); + exit(-1); + } + + shared_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE, + PROT_READ|PROT_WRITE, + page_array[nr_pages - 1]); + + fprintf(logfile, "shared page at pfn:%lx, mfn: %"PRIx64"\n", nr_pages - 1, + (uint64_t)(page_array[nr_pages - 1])); + + free(page_array); + +#else /* !CONFIG_DM */ + phys_ram_base = qemu_vmalloc(phys_ram_size); if (!phys_ram_base) { fprintf(stderr, "Could not allocate physical memory\n"); exit(1); } +#endif /* !CONFIG_DM */ + /* we always create the cdrom drive, even if no disk is there */ bdrv_init(); if (cdrom_index >= 0) { d='n17' href='#n17'>17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
# group `sysex_tools` {#group__sysex__tools}
## Summary
Members | Descriptions
--------------------------------|---------------------------------------------
`public uint16_t `[`sysex_encoded_length`](#group__sysex__tools_1ga061e5607030412d6e62e2390d8013f0a)`(uint16_t decoded_length)` | Compute the length of a message after it is encoded.
`public uint16_t `[`sysex_decoded_length`](#group__sysex__tools_1ga121fc227d3acc1c0ea08c9a5c26fa3b0)`(uint16_t encoded_length)` | Compute the length of a message after it is decoded.
`public uint16_t `[`sysex_encode`](#group__sysex__tools_1ga54d77f8d32f92a6f329daefa2b314742)`(uint8_t * encoded,const uint8_t * source,uint16_t length)` | Encode data so that it can be transmitted safely in a sysex message.
`public uint16_t `[`sysex_decode`](#group__sysex__tools_1gaaad1d9ba2d5eca709a0ab4ba40662229)`(uint8_t * decoded,const uint8_t * source,uint16_t length)` | Decode encoded data.
## Members
#### `public uint16_t `[`sysex_encoded_length`](#group__sysex__tools_1ga061e5607030412d6e62e2390d8013f0a)`(uint16_t decoded_length)` {#group__sysex__tools_1ga061e5607030412d6e62e2390d8013f0a}
Compute the length of a message after it is encoded.
#### Parameters
* `decoded_length` The length, in bytes, of the message to encode.
#### Returns
The length, in bytes, of the message after encodeing.
#### `public uint16_t `[`sysex_decoded_length`](#group__sysex__tools_1ga121fc227d3acc1c0ea08c9a5c26fa3b0)`(uint16_t encoded_length)` {#group__sysex__tools_1ga121fc227d3acc1c0ea08c9a5c26fa3b0}
Compute the length of a message after it is decoded.
#### Parameters
* `encoded_length` The length, in bytes, of the encoded message.
#### Returns
The length, in bytes, of the message after it is decoded.
#### `public uint16_t `[`sysex_encode`](#group__sysex__tools_1ga54d77f8d32f92a6f329daefa2b314742)`(uint8_t * encoded,const uint8_t * source,uint16_t length)` {#group__sysex__tools_1ga54d77f8d32f92a6f329daefa2b314742}
Encode data so that it can be transmitted safely in a sysex message.
#### Parameters
* `encoded` The output data buffer, must be at least sysex_encoded_length(length) bytes long.
* `source` The input buffer of data to be encoded.
* `length` The number of bytes from the input buffer to encode.
#### Returns
number of bytes encoded.
#### `public uint16_t `[`sysex_decode`](#group__sysex__tools_1gaaad1d9ba2d5eca709a0ab4ba40662229)`(uint8_t * decoded,const uint8_t * source,uint16_t length)` {#group__sysex__tools_1gaaad1d9ba2d5eca709a0ab4ba40662229}
Decode encoded data.
#### Parameters
* `decoded` The output data buffer, must be at least sysex_decoded_length(length) bytes long.
* `source` The input buffer of data to be decoded.
* `length` The number of bytes from the input buffer to decode.
#### Returns
number of bytes decoded.