logo       

My second attempt at a data_xfer instruction optimization: msg#00112

emulators.bochs.devel

Subject: My second attempt at a data_xfer instruction optimization

Hello All,

Now that our company has gotten our mail server hosting company straightened out on our mail server settings I can finaly join the bochs developers list.

To celebrate I have rewritten a patch that I submitted before that boost performance a bit. Hopefully this will not cause troubles for the X86-64 users like my last one did.

Unlike my previous speedups this one will help more platforms than just X86. It cleans up the Data Xfer instructions. Since the Data Xfer instructions are the most often executed instructions it gives a noticable boost in speed (Not a lot but some). The basic optimization technique was to eliminate intermediate variables and pass a pointer to the final destination or original source to the read_virtual_whatever and the write_virtual_whatever functions. This patch was taken from a CVS download on Nov. 21 2003 .

I have tested this patch on a PC running Linux and on A Mac running OSX 10.3 . I have booted the Dlxlinux image on the Mac and booted WinDOS 98 on the PC. I have not done any X86-64 testing and I need someone who knows about it to do it.


PS.
For anybody doing X86-64 testing on this patch, I would like to have you test out my pipelined-asm patch that is already in the patches dirrectory in CVS.

Many Thanks in advance,

Conn Clark ( Aka psychosmurf & Obscene_CNN )


--

*****************************************************************
If you live at home long enough, your parents will move out.
(Warning they may try to sell their house out from under you.)
*****************************************************************

Conn Clark
Engineering Stooge clark@xxxxxxxxxx
Electronic Systems Technology Inc. www.esteem.com

Stock Ticker Symbol ELST

"clark@xxxxxxxxxx" Copyright 2000 By Electronic Systems Technology
This email address may be used to communicate to Conn Clark
provided it is not being used for advertisement purposes, unless
prior written consent is given. This email address may not be
sold under any circumstances. All other rights reserved.
Only in bochs: .bochsrc
Only in bochs: .conf.AIX.4.3.1
Only in bochs: .conf.amigaos
Only in bochs: .conf.beos
Only in bochs: .conf.everything
Only in bochs: .conf.linux
Only in bochs: .conf.macos
Only in bochs: .conf.macosx
Only in bochs: .conf.sparc
Only in bochs: .conf.win32
Only in bochs: .conf.win32-cygwin
Only in bochs: .conf.win32-vcpp
Only in bochs: .cvsignore
diff -ru bochs/cpu/data_xfer16.cc bochs-modified/cpu/data_xfer16.cc
--- bochs/cpu/data_xfer16.cc Thu Nov 13 13:57:12 2003
+++ bochs-modified/cpu/data_xfer16.cc Fri Nov 21 14:02:59 2003
@@ -54,11 +54,7 @@
void
BX_CPU_C::MOV_EEwGw(bxInstruction_c *i)
{
- Bit16u op2_16;
-
- op2_16 = BX_READ_16BIT_REG(i->nnn());
-
- write_virtual_word(i->seg(), RMAddr(i), &op2_16);
+ write_virtual_word(i->seg(), RMAddr(i), &BX_READ_16BIT_REG(i->nnn()));
}

void
@@ -86,10 +82,8 @@
BX_CPU_C::MOV_GwEEw(bxInstruction_c *i)
{
// 2nd modRM operand Ex, is known to be a memory operand, Ew.
- Bit16u op2_16;

- read_virtual_word(i->seg(), RMAddr(i), &op2_16);
- BX_WRITE_16BIT_REG(i->nnn(), op2_16);
+ read_virtual_word(i->seg(), RMAddr(i), &BX_READ_16BIT_REG(i->nnn()));
}

void
@@ -165,7 +159,6 @@
void
BX_CPU_C::MOV_AXOw(bxInstruction_c *i)
{
- Bit16u temp_16;
bx_address addr;

addr = i->Id();
@@ -173,34 +166,27 @@
/* read from memory address */

if (!BX_NULL_SEG_REG(i->seg())) {
- read_virtual_word(i->seg(), addr, &temp_16);
+ read_virtual_word(i->seg(), addr, &AX);
}
else {
- read_virtual_word(BX_SEG_REG_DS, addr, &temp_16);
+ read_virtual_word(BX_SEG_REG_DS, addr, &AX);
}
-
- /* write to register */
- AX = temp_16;
}


void
BX_CPU_C::MOV_OwAX(bxInstruction_c *i)
{
- Bit16u temp_16;
bx_address addr;

addr = i->Id();

- /* read from register */
- temp_16 = AX;
-
/* write to memory address */
if (!BX_NULL_SEG_REG(i->seg())) {
- write_virtual_word(i->seg(), addr, &temp_16);
+ write_virtual_word(i->seg(), addr, &AX);
}
else {
- write_virtual_word(BX_SEG_REG_DS, addr, &temp_16);
+ write_virtual_word(BX_SEG_REG_DS, addr, &AX);
}
}

diff -ru bochs/cpu/data_xfer32.cc bochs-modified/cpu/data_xfer32.cc
--- bochs/cpu/data_xfer32.cc Sat Oct 4 13:48:13 2003
+++ bochs-modified/cpu/data_xfer32.cc Fri Nov 21 14:31:20 2003
@@ -63,11 +63,7 @@
void
BX_CPU_C::MOV_EEdGd(bxInstruction_c *i)
{
- Bit32u op2_32;
-
- op2_32 = BX_READ_32BIT_REG(i->nnn());
-
- write_virtual_dword(i->seg(), RMAddr(i), &op2_32);
+ write_virtual_dword(i->seg(), RMAddr(i), &BX_READ_32BIT_REG(i->nnn()));
}

void
@@ -95,10 +91,14 @@
BX_CPU_C::MOV_GdEEd(bxInstruction_c *i)
{
// 2nd modRM operand Ex, is known to be a memory operand, Ed.
- Bit32u op2_32;
+// Bit32u op2_32;

- read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
- BX_WRITE_32BIT_REGZ(i->nnn(), op2_32);
+// read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
+// BX_WRITE_32BIT_REGZ(i->nnn(), op2_32);
+#if BX_SUPPORT_X86_64
+ BX_CPU_THIS_PTR gen_reg[i->nnn()].hrx = 0;
+#endif
+ read_virtual_dword(i->seg(), RMAddr(i), &BX_READ_32BIT_REG(i->nnn()));
}

void
@@ -118,46 +118,40 @@
void
BX_CPU_C::MOV_EAXOd(bxInstruction_c *i)
{
- Bit32u temp_32;
bx_address addr;

+#if BX_SUPPORT_X86_64
+ BX_CPU_THIS_PTR gen_reg[0].hrx = 0;
+#endif
+
addr = i->Id();

/* read from memory address */

if (!BX_NULL_SEG_REG(i->seg())) {
- read_virtual_dword(i->seg(), addr, &temp_32);
+ read_virtual_dword(i->seg(), addr, &EAX);
}
else {
- read_virtual_dword(BX_SEG_REG_DS, addr, &temp_32);
+ read_virtual_dword(BX_SEG_REG_DS, addr, &EAX);
}

- /* write to register */
-#if BX_SUPPORT_X86_64
- RAX = temp_32;
-#else
- EAX = temp_32;
-#endif
+
}


void
BX_CPU_C::MOV_OdEAX(bxInstruction_c *i)
{
- Bit32u temp_32;
bx_address addr;

addr = i->Id();

- /* read from register */
- temp_32 = EAX;
-
/* write to memory address */
if (!BX_NULL_SEG_REG(i->seg())) {
- write_virtual_dword(i->seg(), addr, &temp_32);
+ write_virtual_dword(i->seg(), addr, &EAX);
}
else {
- write_virtual_dword(BX_SEG_REG_DS, addr, &temp_32);
+ write_virtual_dword(BX_SEG_REG_DS, addr, &EAX);
}
}

diff -ru bochs/cpu/data_xfer8.cc bochs-modified/cpu/data_xfer8.cc
--- bochs/cpu/data_xfer8.cc Thu May 8 10:56:48 2003
+++ bochs-modified/cpu/data_xfer8.cc Fri Nov 21 13:55:18 2003
@@ -50,11 +50,7 @@
void
BX_CPU_C::MOV_EEbGb(bxInstruction_c *i)
{
- Bit8u op2;
-
- op2 = BX_READ_8BIT_REGx(i->nnn(),i->extend8bitL());
-
- write_virtual_byte(i->seg(), RMAddr(i), &op2);
+ write_virtual_byte(i->seg(), RMAddr(i),
&BX_READ_8BIT_REGx(i->nnn(),i->extend8bitL()));
}

void
@@ -71,11 +67,9 @@
void
BX_CPU_C::MOV_GbEEb(bxInstruction_c *i)
{
- Bit8u op2;

- read_virtual_byte(i->seg(), RMAddr(i), &op2);
+ read_virtual_byte(i->seg(), RMAddr(i),
&BX_READ_8BIT_REGx(i->nnn(),i->extend8bitL()));

- BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), op2);
}

void
@@ -93,22 +87,20 @@
void
BX_CPU_C::MOV_ALOb(bxInstruction_c *i)
{
- Bit8u temp_8;
bx_address addr;

addr = i->Id();

/* read from memory address */
if (!BX_NULL_SEG_REG(i->seg())) {
- read_virtual_byte(i->seg(), addr, &temp_8);
+ read_virtual_byte(i->seg(), addr, &AL);
}
else {
- read_virtual_byte(BX_SEG_REG_DS, addr, &temp_8);
+ read_virtual_byte(BX_SEG_REG_DS, addr, &AL);
}


/* write to register */
- AL = temp_8;
}


@@ -120,15 +112,13 @@

addr = i->Id();

- /* read from register */
- temp_8 = AL;

/* write to memory address */
if (!BX_NULL_SEG_REG(i->seg())) {
- write_virtual_byte(i->seg(), addr, &temp_8);
+ write_virtual_byte(i->seg(), addr, &AL);
}
else {
- write_virtual_byte(BX_SEG_REG_DS, addr, &temp_8);
+ write_virtual_byte(BX_SEG_REG_DS, addr, &AL);
}
}

@@ -155,8 +145,6 @@
BX_CPU_C::XLAT(bxInstruction_c *i)
{
Bit32u offset_32;
- Bit8u al;
-

#if BX_CPU_LEVEL >= 3
if (i->as32L()) {
@@ -169,12 +157,11 @@
}

if (!BX_NULL_SEG_REG(i->seg())) {
- read_virtual_byte(i->seg(), offset_32, &al);
+ read_virtual_byte(i->seg(), offset_32, &AL);
}
else {
- read_virtual_byte(BX_SEG_REG_DS, offset_32, &al);
+ read_virtual_byte(BX_SEG_REG_DS, offset_32, &AL);
}
- AL = al;
}

void
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise