Skip to contentSkip to conversation

realmode: test AAM, XLAT, SALC

PATCH Applied Paolo Bonzini 2 participants 5 messages May 9, 2013 KVM

lore
Share & tools
lore

Paolo Bonzini

author maintainer
#0 lore raw

PATCH 1/1 realmode: test AAM, XLAT, SALC

---
 x86/realmode.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
x86/realmode.c +40 -0
index 91c93a9..35ace08 100644
@@ -1391,6 +1391,43 @@ static void test_aad(void)
     report("aad", R_AX, outregs.eax == 0x123400d4);
 }
 
+static void test_aam(void)
+{
+    MK_INSN(aam, "aam");
+
+    inregs.eax = 0x76543210;
+    exec_in_big_real_mode(&insn_aam);
+    report("aam", R_AX, outregs.eax == 0x76540106);
+}
+
+static void test_xlat(void)
+{
+    MK_INSN(xlat, "xlat");
+    u8 table[256];
+    int i;
+
+    for (i = 0; i < 256; i++) {
+        table[i] = i + 1;
+    }
+
+    inregs.eax = 0x89abcdef;
+    inregs.ebx = (u32)table;
+    exec_in_big_real_mode(&insn_xlat);
+    report("xlat", R_AX, outregs.eax == 0x89abcdf0);
+}
+
+static void test_salc(void)
+{
+    MK_INSN(clc_salc, "clc; .byte 0xd6");
+    MK_INSN(stc_salc, "stc; .byte 0xd6");
+
+    inregs.eax = 0x12345678;
+    exec_in_big_real_mode(&insn_clc_salc);
+    report("salc (1)", R_AX, outregs.eax == 0x12345600);
+    exec_in_big_real_mode(&insn_stc_salc);
+    report("salc (2)", R_AX, outregs.eax == 0x123456ff);
+}
+
 static void test_fninit(void)
 {
 	u16 fcw = -1, fsw = -1;
@@ -1443,6 +1480,9 @@ void realmode_start(void)
 	test_movzx_movsx();
 	test_bswap();
 	test_aad();
+	test_aam();
+	test_xlat();
+	test_salc();
 	test_fninit();
 
 	exit(0);
Signature · 1 line
1.8.1.4
#1 lore raw
Quoted 32 lines · Paolo Bonzini
---
 x86/realmode.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
x86/realmode.c +19 -0
index 91c93a9..35ace08 100644
@@ -1391,6 +1391,43 @@ static void test_aad(void)
     report("aad", R_AX, outregs.eax == 0x123400d4);
 }
 
+static void test_aam(void)
+{
+    MK_INSN(aam, "aam");
+
+    inregs.eax = 0x76543210;
+    exec_in_big_real_mode(&insn_aam);
+    report("aam", R_AX, outregs.eax == 0x76540106);
+}
+
+static void test_xlat(void)
+{
+    MK_INSN(xlat, "xlat");
+    u8 table[256];
+    int i;
+
+    for (i = 0; i < 256; i++) {
+        table[i] = i + 1;
+    }
+

x86/realmode.c static void test_aad(void) · line 1422

Quoted 10 lines
x86/realmode.c +10 -0
+    inregs.eax = 0x89abcdef;
+    inregs.ebx = (u32)table;
+    exec_in_big_real_mode(&insn_xlat);
+    report("xlat", R_AX, outregs.eax == 0x89abcdf0);
+}
+
+static void test_salc(void)
+{
+    MK_INSN(clc_salc, "clc; .byte 0xd6");
+    MK_INSN(stc_salc, "stc; .byte 0xd6");

Heh, who uses that?

Quoted 23 lines
x86/realmode.c +11 -0
+
+    inregs.eax = 0x12345678;
+    exec_in_big_real_mode(&insn_clc_salc);
+    report("salc (1)", R_AX, outregs.eax == 0x12345600);
+    exec_in_big_real_mode(&insn_stc_salc);
+    report("salc (2)", R_AX, outregs.eax == 0x123456ff);
+}
+
 static void test_fninit(void)
 {
 	u16 fcw = -1, fsw = -1;
@@ -1443,6 +1480,9 @@ void realmode_start(void)
 	test_movzx_movsx();
 	test_bswap();
 	test_aad();
+	test_aam();
+	test_xlat();
+	test_salc();
 	test_fninit();
 
 	exit(0);
Signature · 1 line
1.8.1.4

--
Gleb.

author maintainer
#2 lore raw

Il 09/05/2013 11:13, Gleb Natapov ha scritto:

Quoted 36 lines · Paolo Bonzini
Quoted 35 lines
---
 x86/realmode.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
x86/realmode.c +22 -0
index 91c93a9..35ace08 100644
@@ -1391,6 +1391,43 @@ static void test_aad(void)
     report("aad", R_AX, outregs.eax == 0x123400d4);
 }
 
+static void test_aam(void)
+{
+    MK_INSN(aam, "aam");
+
+    inregs.eax = 0x76543210;
+    exec_in_big_real_mode(&insn_aam);
+    report("aam", R_AX, outregs.eax == 0x76540106);
+}
+
+static void test_xlat(void)
+{
+    MK_INSN(xlat, "xlat");
+    u8 table[256];
+    int i;
+
+    for (i = 0; i < 256; i++) {
+        table[i] = i + 1;
+    }
+
+    inregs.eax = 0x89abcdef;
+    inregs.ebx = (u32)table;
+    exec_in_big_real_mode(&insn_xlat);
Quoted 8 lines

x86/realmode.c static void test_aad(void) · line 1422

Quoted 7 lines
x86/realmode.c +7 -0
+    report("xlat", R_AX, outregs.eax == 0x89abcdf0);
+}
+
+static void test_salc(void)
+{
+    MK_INSN(clc_salc, "clc; .byte 0xd6");
+    MK_INSN(stc_salc, "stc; .byte 0xd6");

Heh, who uses that?

Some real-mode programs do. Plus, the "N" in the opcode table looked really bad. :)

Paolo

Quoted 31 lines
Quoted 23 lines
x86/realmode.c +11 -0
+
+    inregs.eax = 0x12345678;
+    exec_in_big_real_mode(&insn_clc_salc);
+    report("salc (1)", R_AX, outregs.eax == 0x12345600);
+    exec_in_big_real_mode(&insn_stc_salc);
+    report("salc (2)", R_AX, outregs.eax == 0x123456ff);
+}
+
 static void test_fninit(void)
 {
 	u16 fcw = -1, fsw = -1;
@@ -1443,6 +1480,9 @@ void realmode_start(void)
 	test_movzx_movsx();
 	test_bswap();
 	test_aad();
+	test_aam();
+	test_xlat();
+	test_salc();
 	test_fninit();
 
 	exit(0);
Signature · 1 line
1.8.1.4

--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 46 lines · Paolo Bonzini

Il 09/05/2013 11:13, Gleb Natapov ha scritto:

Quoted 36 lines · Paolo Bonzini
Quoted 35 lines
---
 x86/realmode.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
x86/realmode.c +22 -0
index 91c93a9..35ace08 100644
@@ -1391,6 +1391,43 @@ static void test_aad(void)
     report("aad", R_AX, outregs.eax == 0x123400d4);
 }
 
+static void test_aam(void)
+{
+    MK_INSN(aam, "aam");
+
+    inregs.eax = 0x76543210;
+    exec_in_big_real_mode(&insn_aam);
+    report("aam", R_AX, outregs.eax == 0x76540106);
+}
+
+static void test_xlat(void)
+{
+    MK_INSN(xlat, "xlat");
+    u8 table[256];
+    int i;
+
+    for (i = 0; i < 256; i++) {
+        table[i] = i + 1;
+    }
+
+    inregs.eax = 0x89abcdef;
+    inregs.ebx = (u32)table;
+    exec_in_big_real_mode(&insn_xlat);
Quoted 8 lines

x86/realmode.c static void test_aad(void) · line 1422

Quoted 7 lines
x86/realmode.c +7 -0
+    report("xlat", R_AX, outregs.eax == 0x89abcdf0);
+}
+
+static void test_salc(void)
+{
+    MK_INSN(clc_salc, "clc; .byte 0xd6");
+    MK_INSN(stc_salc, "stc; .byte 0xd6");

Heh, who uses that?

Quoted 3 lines

Some real-mode programs do. Plus, the "N" in the opcode table looked really bad. :)

Ah, I thought sgabios use that one too.

--
Gleb.

Applied
#4 lore raw
In reply to Paolo Bonzini
Quoted 1 line · Paolo Bonzini

Applied, thanks.

Quoted 64 lines
---
 x86/realmode.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
x86/realmode.c +40 -0
index 91c93a9..35ace08 100644
@@ -1391,6 +1391,43 @@ static void test_aad(void)
     report("aad", R_AX, outregs.eax == 0x123400d4);
 }
 
+static void test_aam(void)
+{
+    MK_INSN(aam, "aam");
+
+    inregs.eax = 0x76543210;
+    exec_in_big_real_mode(&insn_aam);
+    report("aam", R_AX, outregs.eax == 0x76540106);
+}
+
+static void test_xlat(void)
+{
+    MK_INSN(xlat, "xlat");
+    u8 table[256];
+    int i;
+
+    for (i = 0; i < 256; i++) {
+        table[i] = i + 1;
+    }
+
+    inregs.eax = 0x89abcdef;
+    inregs.ebx = (u32)table;
+    exec_in_big_real_mode(&insn_xlat);
+    report("xlat", R_AX, outregs.eax == 0x89abcdf0);
+}
+
+static void test_salc(void)
+{
+    MK_INSN(clc_salc, "clc; .byte 0xd6");
+    MK_INSN(stc_salc, "stc; .byte 0xd6");
+
+    inregs.eax = 0x12345678;
+    exec_in_big_real_mode(&insn_clc_salc);
+    report("salc (1)", R_AX, outregs.eax == 0x12345600);
+    exec_in_big_real_mode(&insn_stc_salc);
+    report("salc (2)", R_AX, outregs.eax == 0x123456ff);
+}
+
 static void test_fninit(void)
 {
 	u16 fcw = -1, fsw = -1;
@@ -1443,6 +1480,9 @@ void realmode_start(void)
 	test_movzx_movsx();
 	test_bswap();
 	test_aad();
+	test_aam();
+	test_xlat();
+	test_salc();
 	test_fninit();
 
 	exit(0);
Signature · 1 line
1.8.1.4

--
Gleb.