//struct vm_device * timer = create_timer();
struct vm_device * pic = create_pic();
struct vm_device * keyboard = create_keyboard();
- struct vm_device * pit = create_pit();
+ struct vm_device * pit = create_pit();
-#define GENERIC 0
+#define GENERIC 1
#if GENERIC
generic_port_range_type range[] = {
/*
- {0x00, 0x07}, // DMA 1 channels 0,1,2,3 (address, counter)
- {0xc0, 0xc7}, // DMA 2 channels 4,5,6,7 (address, counter)
- {0x87, 0x87}, // DMA 1 channel 0 page register
- {0x83, 0x83}, // DMA 1 channel 1 page register
- {0x81, 0x81}, // DMA 1 channel 2 page register
- {0x82, 0x82}, // DMA 1 channel 3 page register
- {0x8f, 0x8f}, // DMA 2 channel 4 page register
- {0x8b, 0x8b}, // DMA 2 channel 5 page register
- {0x89, 0x89}, // DMA 2 channel 6 page register
- {0x8a, 0x8a}, // DMA 2 channel 7 page register
- {0x08, 0x0f}, // DMA 1 misc registers (csr, req, smask,mode,clearff,reset,enable,mmask)
- {0xd0, 0xde}, // DMA 2 misc registers
+ {0x00, 0x07, GENERIC_PRINT_AND_PASSTHROUGH}, // DMA 1 channels 0,1,2,3 (address, counter)
+ {0xc0, 0xc7, GENERIC_PRINT_AND_PASSTHROUGH}, // DMA 2 channels 4,5,6,7 (address, counter)
+ {0x87, 0x87, GENERIC_PRINT_AND_PASSTHROUGH}, // DMA 1 channel 0 page register
+ {0x83, 0x83, GENERIC_PRINT_AND_PASSTHROUGH}, // DMA 1 channel 1 page register
+ {0x81, 0x81, GENERIC_PRINT_AND_PASSTHROUGH}, // DMA 1 channel 2 page register
+ {0x82, 0x82, GENERIC_PRINT_AND_PASSTHROUGH}, // DMA 1 channel 3 page register
+ {0x8f, 0x8f, GENERIC_PRINT_AND_PASSTHROUGH}, // DMA 2 channel 4 page register
+ {0x8b, 0x8b, GENERIC_PRINT_AND_PASSTHROUGH}, // DMA 2 channel 5 page register
+ {0x89, 0x89, GENERIC_PRINT_AND_PASSTHROUGH}, // DMA 2 channel 6 page register
+ {0x8a, 0x8a, GENERIC_PRINT_AND_PASSTHROUGH}, // DMA 2 channel 7 page register
+ {0x08, 0x0f, GENERIC_PRINT_AND_PASSTHROUGH}, // DMA 1 misc registers (csr, req, smask,mode,clearff,reset,enable,mmask)
+ {0xd0, 0xde, GENERIC_PRINT_AND_PASSTHROUGH}, // DMA 2 misc registers
*/
- {0x170, 0x178}, // IDE 1
- {0x376, 0x377}, // IDE 1
- {0x1f0, 0x1f8}, // IDE 0
- {0x3f6, 0x3f7}, // IDE 0
+ {0x3f8, 0x3f8+7, GENERIC_PRINT_AND_IGNORE}, // COM 1
+ {0x2f8, 0x2f8+7, GENERIC_PRINT_AND_IGNORE}, // COM 2
+ {0x3e8, 0x3e8+7, GENERIC_PRINT_AND_IGNORE}, // COM 2
+ {0x2e8, 0x2e8+7, GENERIC_PRINT_AND_IGNORE}, // COM 2
+
+ {0x170, 0x178, GENERIC_PRINT_AND_PASSTHROUGH}, // IDE 1
+ {0x376, 0x377, GENERIC_PRINT_AND_PASSTHROUGH}, // IDE 1
+ {0x1f0, 0x1f8, GENERIC_PRINT_AND_PASSTHROUGH}, // IDE 0
+ {0x3f6, 0x3f7, GENERIC_PRINT_AND_PASSTHROUGH}, // IDE 0
/*
- {0x3f0, 0x3f2}, // Primary floppy controller (base,statusa/statusb,DOR)
- {0x3f4, 0x3f5}, // Primary floppy controller (mainstat/datarate,data)
- {0x3f7, 0x3f7}, // Primary floppy controller (DIR)
- {0x370, 0x372}, // Secondary floppy controller (base,statusa/statusb,DOR)
- {0x374, 0x375}, // Secondary floppy controller (mainstat/datarate,data)
- {0x377, 0x377}, // Secondary floppy controller (DIR)
- {0x378, 0x400}
+ {0x3f0, 0x3f2, GENERIC_PRINT_AND_PASSTHROUGH}, // Primary floppy controller (base,statusa/statusb,DOR)
+ {0x3f4, 0x3f5, GENERIC_PRINT_AND_PASSTHROUGH}, // Primary floppy controller (mainstat/datarate,data)
+ {0x3f7, 0x3f7, GENERIC_PRINT_AND_PASSTHROUGH}, // Primary floppy controller (DIR)
+ {0x370, 0x372, GENERIC_PRINT_AND_PASSTHROUGH}, // Secondary floppy controller (base,statusa/statusb,DOR)
+ {0x374, 0x375, GENERIC_PRINT_AND_PASSTHROUGH}, // Secondary floppy controller (mainstat/datarate,data)
+ {0x377, 0x377, GENERIC_PRINT_AND_PASSTHROUGH}, // Secondary floppy controller (DIR)
+ {0x378, 0x400, GENERIC_PRINT_AND_PASSTHROUGH}
*/
};
- struct vm_device * generic = create_generic(range,4, // THIS NUMBER IS CRITICAL
+ struct vm_device * generic = create_generic(range,8, // THIS NUMBER IS CRITICAL
NULL,0,NULL,0);
#endif
// no longer needed since we have a keyboard device
//hook_irq(&vm_info, 1);
-#if 0
+#if 1
// give floppy controller to vm
hook_irq(&vm_info, 6);
return -1;
}
+ struct v3_segment *theseg = &(info->segments.es); // default is ES
+
+ addr_t inst_ptr;
+
+ if (guest_va_to_host_pa(info,get_addr_linear(info,info->rip,&(info->segments.cs)),&inst_ptr)==-1) {
+ PrintDebug("Can't access instruction\n");
+ return -1;
+ }
+
+ while (is_prefix_byte(*((char*)inst_ptr))) {
+ switch (*((char*)inst_ptr)) {
+ case PREFIX_CS_OVERRIDE:
+ theseg = &(info->segments.cs);
+ break;
+ case PREFIX_SS_OVERRIDE:
+ theseg = &(info->segments.ss);
+ break;
+ case PREFIX_DS_OVERRIDE:
+ theseg = &(info->segments.ds);
+ break;
+ case PREFIX_ES_OVERRIDE:
+ theseg = &(info->segments.es);
+ break;
+ case PREFIX_FS_OVERRIDE:
+ theseg = &(info->segments.fs);
+ break;
+ case PREFIX_GS_OVERRIDE:
+ theseg = &(info->segments.gs);
+ break;
+ default:
+ break;
+ }
+ inst_ptr++;
+ }
+
+
PrintDebug("INS on port %d (0x%x)\n", io_info->port, io_info->port);
if (io_info->sz8) {
// This value should be set depending on the host register size...
mask = get_gpr_mask(info);
- PrintDebug("INS io_info invalid address size, assuming 32, io_info=0x%x\n",*((uint_t*)(io_info)));
+ PrintDebug("INS io_info invalid address size, mask=0x%x, io_info=0x%x\n",mask,*((uint_t*)(io_info)));
// PrintDebug("INS Aborted... Check implementation\n");
//return -1;
}
while (rep_num > 0) {
addr_t host_addr;
- dst_addr = get_addr_linear(info, info->vm_regs.rdi & mask, &(info->segments.es));
+ dst_addr = get_addr_linear(info, info->vm_regs.rdi & mask, theseg);
+ PrintDebug("Writing 0x%x\n", dst_addr);
+
if (guest_va_to_host_va(info, dst_addr, &host_addr) == -1) {
// either page fault or gpf...
PrintDebug("Could not convert Guest VA to host VA\n");
int handle_svm_io_outs(struct guest_info * info) {
vmcb_ctrl_t * ctrl_area = GET_VMCB_CTRL_AREA((vmcb_t *)(info->vmm_data));
vmcb_saved_state_t * guest_state = GET_VMCB_SAVE_STATE_AREA((vmcb_t*)(info->vmm_data));
+
struct svm_io_info * io_info = (struct svm_io_info *)&(ctrl_area->exit_info1);
// This value should be set depending on the host register size...
mask = get_gpr_mask(info);
- PrintDebug("OUTS io_info invalid address size, assuming 32, io_info=0x%x\n",*((uint_t*)(io_info)));
+ PrintDebug("OUTS io_info invalid address size, mask=0x%, io_info=0x%x\n",mask,*((uint_t*)(io_info)));
// PrintDebug("INS Aborted... Check implementation\n");
//return -1;
// should never happen
rep_num = info->vm_regs.rcx & mask;
}
+ struct v3_segment *theseg = &(info->segments.es); // default is ES
+
+ addr_t inst_ptr;
+
+ if (guest_va_to_host_pa(info,get_addr_linear(info,info->rip,&(info->segments.cs)),&inst_ptr)==-1) {
+ PrintDebug("Can't access instruction\n");
+ return -1;
+ }
+
+ while (is_prefix_byte(*((char*)inst_ptr))) {
+ switch (*((char*)inst_ptr)) {
+ case PREFIX_CS_OVERRIDE:
+ theseg = &(info->segments.cs);
+ break;
+ case PREFIX_SS_OVERRIDE:
+ theseg = &(info->segments.ss);
+ break;
+ case PREFIX_DS_OVERRIDE:
+ theseg = &(info->segments.ds);
+ break;
+ case PREFIX_ES_OVERRIDE:
+ theseg = &(info->segments.es);
+ break;
+ case PREFIX_FS_OVERRIDE:
+ theseg = &(info->segments.fs);
+ break;
+ case PREFIX_GS_OVERRIDE:
+ theseg = &(info->segments.gs);
+ break;
+ default:
+ break;
+ }
+ inst_ptr++;
+ }
+
PrintDebug("OUTS size=%d for %d steps\n", write_size, rep_num);
while (rep_num > 0) {
addr_t host_addr;
- dst_addr = get_addr_linear(info, (info->vm_regs.rsi & mask), &(info->segments.ds));
+
+
+
+ dst_addr = get_addr_linear(info, (info->vm_regs.rsi & mask), theseg);
if (guest_va_to_host_va(info, dst_addr, &host_addr) == -1) {
// either page fault or gpf...
// -*- fundamental -*-
/////////////////////////////////////////////////////////////////////////
-// $Id: rombios.c,v 1.9 2008/07/02 17:58:44 pdinda Exp $
+// $Id: rombios.c,v 1.10 2008/07/07 23:26:58 pdinda Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
#endif // BX_ELTORITO_BOOT
-static char bios_cvs_version_string[] = "$Revision: 1.9 $";
-static char bios_date_string[] = "$Date: 2008/07/02 17:58:44 $";
+static char bios_cvs_version_string[] = "$Revision: 1.10 $";
+static char bios_date_string[] = "$Date: 2008/07/07 23:26:58 $";
-static char CVSID[] = "$Id: rombios.c,v 1.9 2008/07/02 17:58:44 pdinda Exp $";
+static char CVSID[] = "$Id: rombios.c,v 1.10 2008/07/07 23:26:58 pdinda Exp $";
/* Offset to skip the CVS $Id: prefix */
#define bios_version_string (CVSID + 4)
atacmd[3]=(lba & 0x00ff0000) >> 16;
atacmd[4]=(lba & 0x0000ff00) >> 8;
atacmd[5]=(lba & 0x000000ff);
- if((error = ata_cmd_packet(device, 12, get_SS(), atacmd, 0, nbsectors*512L, ATA_DATA_IN, boot_segment,0)) != 0)
+ if((error = ata_cmd_packetdevice, 12, get_SS(), atacmd, 0, nbsectors*512L, ATA_DATA_IN, boot_segment,0)) != 0)
return 12;