summaryrefslogtreecommitdiff
path: root/src/devices
diff options
context:
space:
mode:
authorarch import user (historical) <svn@openbios.org>2005-07-06 17:15:54 +0000
committerarch import user (historical) <svn@openbios.org>2005-07-06 17:15:54 +0000
commit1c8cd59f3c9248f0954a5cf215dc3652ccfc8da5 (patch)
tree7c19d8a922e2d0613a494c5949b2b6f45c388e13 /src/devices
parent7e5fbd6fc03df87c9276b08219ca15ad17c43dac (diff)
downloadcoreboot-1c8cd59f3c9248f0954a5cf215dc3652ccfc8da5.tar.xz
Revision: linuxbios@linuxbios.org--devel/freebios--devel--2.0--patch-38
Creator: Li-Ta Lo <ollie@lanl.gov> emulator update x96emu update from Paulo git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1954 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/device.c10
-rw-r--r--src/devices/emulator/biosemu.c4
-rw-r--r--src/devices/emulator/x86emu/debug.c4
-rw-r--r--src/devices/emulator/x86emu/decode.c2
-rw-r--r--src/devices/emulator/x86emu/ops.c51
-rw-r--r--src/devices/emulator/x86emu/ops2.c2
-rw-r--r--src/devices/emulator/x86emu/prim_ops.c2
-rw-r--r--src/devices/pci_rom.c6
8 files changed, 42 insertions, 39 deletions
diff --git a/src/devices/device.c b/src/devices/device.c
index d2c435fb72..ba4a2f4901 100644
--- a/src/devices/device.c
+++ b/src/devices/device.c
@@ -363,7 +363,6 @@ void compute_allocate_resource(
}
-
#if CONFIG_CONSOLE_VGA == 1
device_t vga_pri = 0;
static void allocate_vga_resource(void)
@@ -378,13 +377,14 @@ static void allocate_vga_resource(void)
vga = 0;
vga_onboard = 0;
for (dev = all_devices; dev; dev = dev->next) {
- if (!dev->enabled) continue;
+ if ( !dev->enabled ) continue;
if (((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) &&
((dev->class >> 8) != PCI_CLASS_DISPLAY_OTHER)) {
if (!vga) {
if (dev->on_mainboard) {
vga_onboard = dev;
- } else {
+ }
+ else {
vga = dev;
}
}
@@ -397,8 +397,7 @@ static void allocate_vga_resource(void)
vga = vga_onboard;
}
- if (vga) {
- // vga is first add on card or the only onboard vga
+ if (vga) { // vga is first add on card or the only onboard vga
printk_debug("Allocating VGA resource %s\n", dev_path(vga));
vga->command |= (PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
vga_pri = vga;
@@ -412,6 +411,7 @@ static void allocate_vga_resource(void)
bus = (bus == bus->dev->bus)? 0 : bus->dev->bus;
}
}
+
#endif
diff --git a/src/devices/emulator/biosemu.c b/src/devices/emulator/biosemu.c
index b007ec41be..85f10c648f 100644
--- a/src/devices/emulator/biosemu.c
+++ b/src/devices/emulator/biosemu.c
@@ -161,7 +161,6 @@ void do_int(int num)
* BIOS. Most of this information was pulled from
* dosemu.
*/
-#if 0
void setup_int_vect(void)
{
int i;
@@ -223,7 +222,6 @@ int setup_system_bios(void *base_addr)
return 1;
}
-#endif
void reset_int_vect(void)
{
@@ -327,8 +325,6 @@ void run_bios(struct device * dev, unsigned long addr)
// X86EMU_trace_on();
- printk_info("entering emulator\n");
-
X86EMU_exec();
#endif
}
diff --git a/src/devices/emulator/x86emu/debug.c b/src/devices/emulator/x86emu/debug.c
index e25229a689..dd47e3d3a5 100644
--- a/src/devices/emulator/x86emu/debug.c
+++ b/src/devices/emulator/x86emu/debug.c
@@ -225,7 +225,6 @@ void X86EMU_dump_memory (u16 seg, u16 off, u32 amt)
void x86emu_single_step (void)
{
-#if 0
char s[1024];
int ps[10];
int ntok;
@@ -314,7 +313,6 @@ void x86emu_single_step (void)
break;
}
}
-#endif
}
int X86EMU_trace_on(void)
@@ -329,7 +327,6 @@ int X86EMU_trace_off(void)
static int parse_line (char *s, int *ps, int *n)
{
-#if 0
int cmd;
*n = 0;
@@ -355,7 +352,6 @@ static int parse_line (char *s, int *ps, int *n)
sscanf(s,"%x",&ps[*n]);
*n += 1;
}
-#endif
}
#endif /* DEBUG */
diff --git a/src/devices/emulator/x86emu/decode.c b/src/devices/emulator/x86emu/decode.c
index e7010fe579..1badb2db7c 100644
--- a/src/devices/emulator/x86emu/decode.c
+++ b/src/devices/emulator/x86emu/decode.c
@@ -77,8 +77,6 @@ next instruction.
void x86emu_intr_raise(
u8 intrnum)
{
- printk("%s, rasing execption %x\n", __func__, intrnum);
- x86emu_dump_regs();
M.x86.intno = intrnum;
M.x86.intr |= INTR_SYNCH;
}
diff --git a/src/devices/emulator/x86emu/ops.c b/src/devices/emulator/x86emu/ops.c
index 4666e93ff4..2534b65863 100644
--- a/src/devices/emulator/x86emu/ops.c
+++ b/src/devices/emulator/x86emu/ops.c
@@ -70,7 +70,7 @@
*
****************************************************************************/
-#include "x86emu/x86emui.h"
+#include "x86emui.h"
/*----------------------------- Implementation ----------------------------*/
@@ -219,8 +219,7 @@ void x86emuOp_genop_byte_RM_R(u8 op1)
DECODE_PRINTF("\n");
TRACE_AND_STEP();
destval = genop_byte_operation[op1](destval, *srcreg);
- if (op1 != 7)
- store_data_byte(destoffset, destval);
+ store_data_byte(destoffset, destval);
}
else
{ /* register to register */
@@ -263,8 +262,7 @@ void x86emuOp_genop_word_RM_R(u8 op1)
DECODE_PRINTF("\n");
TRACE_AND_STEP();
destval = genop_long_operation[op1](destval, *srcreg);
- if (op1 != 7)
- store_data_long(destoffset, destval);
+ store_data_long(destoffset, destval);
} else {
u16 destval;
u16 *srcreg;
@@ -275,12 +273,11 @@ void x86emuOp_genop_word_RM_R(u8 op1)
DECODE_PRINTF("\n");
TRACE_AND_STEP();
destval = genop_word_operation[op1](destval, *srcreg);
- if (op1 != 7)
- store_data_word(destoffset, destval);
+ store_data_word(destoffset, destval);
}
} else { /* register to register */
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg, *srcreg;
+ u32 *destreg,*srcreg;
destreg = DECODE_RM_LONG_REGISTER(rl);
DECODE_PRINTF(",");
@@ -289,7 +286,7 @@ void x86emuOp_genop_word_RM_R(u8 op1)
TRACE_AND_STEP();
*destreg = genop_long_operation[op1](*destreg, *srcreg);
} else {
- u16 *destreg, *srcreg;
+ u16 *destreg,*srcreg;
destreg = DECODE_RM_WORD_REGISTER(rl);
DECODE_PRINTF(",");
@@ -1335,7 +1332,9 @@ void x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
imm = fetch_byte_imm();
DECODE_PRINTF2("%x\n", imm);
TRACE_AND_STEP();
- *destreg = (*genop_byte_operation[rh]) (*destreg, imm);
+ destval = (*genop_byte_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1424,23 +1423,29 @@ void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
}
} else { /* register to register */
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg, imm;
+ u32 *destreg;
+ u32 destval,imm;
destreg = DECODE_RM_LONG_REGISTER(rl);
DECODE_PRINTF(",");
imm = fetch_long_imm();
DECODE_PRINTF2("%x\n", imm);
TRACE_AND_STEP();
- *destreg = (*genop_long_operation[rh]) (*destreg, imm);
+ destval = (*genop_long_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
} else {
- u16 *destreg, imm;
+ u16 *destreg;
+ u16 destval,imm;
destreg = DECODE_RM_WORD_REGISTER(rl);
DECODE_PRINTF(",");
imm = fetch_word_imm();
DECODE_PRINTF2("%x\n", imm);
TRACE_AND_STEP();
- *destreg = (*genop_word_operation[rh]) (*destreg, imm);
+ destval = (*genop_word_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
}
}
DECODE_CLEAR_SEGOVR();
@@ -1518,7 +1523,9 @@ void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
imm = fetch_byte_imm();
DECODE_PRINTF2(",%x\n", imm);
TRACE_AND_STEP();
- *destreg = (*genop_byte_operation[rh]) (*destreg, imm);
+ destval = (*genop_byte_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -1604,21 +1611,27 @@ void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
}
} else { /* register to register */
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg, imm;
+ u32 *destreg;
+ u32 destval,imm;
destreg = DECODE_RM_LONG_REGISTER(rl);
imm = (s8) fetch_byte_imm();
DECODE_PRINTF2(",%x\n", imm);
TRACE_AND_STEP();
- *destreg = (*genop_long_operation[rh]) (*destreg, imm);
+ destval = (*genop_long_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
} else {
- u16 *destreg, imm;
+ u16 *destreg;
+ u16 destval,imm;
destreg = DECODE_RM_WORD_REGISTER(rl);
imm = (s8) fetch_byte_imm();
DECODE_PRINTF2(",%x\n", imm);
TRACE_AND_STEP();
- *destreg = (*genop_word_operation[rh]) (*destreg, imm);
+ destval = (*genop_word_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
}
}
DECODE_CLEAR_SEGOVR();
diff --git a/src/devices/emulator/x86emu/ops2.c b/src/devices/emulator/x86emu/ops2.c
index 448d968570..6afd36e2e9 100644
--- a/src/devices/emulator/x86emu/ops2.c
+++ b/src/devices/emulator/x86emu/ops2.c
@@ -61,7 +61,7 @@ void x86emuOp2_illegal_op(
END_OF_INSTR();
}
-#define xorl(a,b) (((a) && !(b)) || (!(a) && (b)))
+#define xorl(a,b) ((a) && !(b)) || (!(a) && (b))
/****************************************************************************
REMARKS:
diff --git a/src/devices/emulator/x86emu/prim_ops.c b/src/devices/emulator/x86emu/prim_ops.c
index fa19cb4844..a707521d49 100644
--- a/src/devices/emulator/x86emu/prim_ops.c
+++ b/src/devices/emulator/x86emu/prim_ops.c
@@ -1921,7 +1921,7 @@ Implements the IMUL instruction and side effects.
void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s)
{
#ifdef __HAS_LONG_LONG__
- s64 res = (s64)d * (s64)s;
+ s64 res = (s32)d * (s32)s;
*res_lo = (u32)res;
*res_hi = (u32)(res >> 32);
diff --git a/src/devices/pci_rom.c b/src/devices/pci_rom.c
index ac2e413cc0..e0a7138464 100644
--- a/src/devices/pci_rom.c
+++ b/src/devices/pci_rom.c
@@ -53,7 +53,7 @@ struct rom_header * pci_rom_probe(struct device *dev)
if (dev->class != ((rom_data->class_hi << 8) | rom_data->class_lo)) {
printk_err("Class Code mismatch ROM %08x, dev %08x\n",
(rom_data->class_hi << 8) | rom_data->class_lo, dev->class);
- //return NULL;
+// return NULL;
}
return rom_header;
@@ -62,8 +62,8 @@ struct rom_header * pci_rom_probe(struct device *dev)
static void *pci_ram_image_start = PCI_RAM_IMAGE_START;
#if CONFIG_CONSOLE_VGA == 1
-int vga_inited = 0; // used by vga_console.c
-extern device_t vga_pri; // the primary vga device, defined in device.c
+int vga_inited = 0; // it will be used by vga_console
+extern device_t vga_pri; // The only VGA
#endif
struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_header)