public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][RESEND] kvm: testsuite: Consolidate mov r, imm testing in one function
@ 2008-08-27 14:57 Mohammed Gamal
  2008-08-28 16:05 ` Avi Kivity
  0 siblings, 1 reply; 5+ messages in thread
From: Mohammed Gamal @ 2008-08-27 14:57 UTC (permalink / raw)
  To: kvm; +Cc: avi, riel

Consolidate mov r, imm testing in one function

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
---
 user/test/x86/realmode.c |   51 +++++++++++++++++++++++++--------------------
 1 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/user/test/x86/realmode.c b/user/test/x86/realmode.c
index 6002909..c2f88c8 100644
--- a/user/test/x86/realmode.c
+++ b/user/test/x86/realmode.c
@@ -129,49 +129,54 @@ int regs_equal(const struct regs *r1, const struct regs *r2, int ignore)
 		);				   \
 	extern u8 insn_##name[], insn_##name##_end[]
 
-MK_INSN(mov_r32_imm_1, "mov $1234567890, %eax");
-MK_INSN(mov_r16_imm_1, "mov $1234, %ax");
-MK_INSN(mov_r8_imm_1, "mov $0x12, %ah");
-MK_INSN(mov_r8_imm_2, "mov $0x34, %al");
-MK_INSN(mov_r8_imm_3, "mov $0x12, %ah\n\t" "mov $0x34, %al\n\t");
-
-void start(void)
+void test_mov_imm(const struct regs *inregs, struct regs *outregs)
 {
-	struct regs inregs = { 0 }, outregs;
+	MK_INSN(mov_r32_imm_1, "mov $1234567890, %eax");
+	MK_INSN(mov_r16_imm_1, "mov $1234, %ax");
+	MK_INSN(mov_r8_imm_1, "mov $0x12, %ah");
+	MK_INSN(mov_r8_imm_2, "mov $0x34, %al");
+	MK_INSN(mov_r8_imm_3, "mov $0x12, %ah\n\t" "mov $0x34, %al\n\t");
 
-	print_serial("abc\n");
-	exec_in_big_real_mode(&inregs, &outregs, 0, 0);
-	if (!regs_equal(&inregs, &outregs, 0))
-		print_serial("null test: FAIL\n");
-	exec_in_big_real_mode(&inregs, &outregs,
+	exec_in_big_real_mode(inregs, outregs,
 			      insn_mov_r16_imm_1,
 			      insn_mov_r16_imm_1_end - insn_mov_r16_imm_1);
-	if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 1234)
+	if (!regs_equal(inregs, outregs, R_AX) || outregs->eax != 1234)
 		print_serial("mov test 1: FAIL\n");
 	
 	/* test mov $imm, %eax */
-	exec_in_big_real_mode(&inregs, &outregs,
+	exec_in_big_real_mode(inregs, outregs,
 			      insn_mov_r32_imm_1,
 			      insn_mov_r32_imm_1_end - insn_mov_r32_imm_1);
-	if(!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 1234567890)
+	if(!regs_equal(inregs, outregs, R_AX) || outregs->eax != 1234567890)
 		print_serial("mov test 2: FAIL\n");
 	
 	/* test mov $imm, %al/%ah */
-	exec_in_big_real_mode(&inregs, &outregs,
+	exec_in_big_real_mode(inregs, outregs,
 			      insn_mov_r8_imm_1,
 			      insn_mov_r8_imm_1_end - insn_mov_r8_imm_1);
-	if(!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 0x1200)
+	if(!regs_equal(inregs, outregs, R_AX) || outregs->eax != 0x1200)
 		print_serial("mov test 3: FAIL\n");
-	exec_in_big_real_mode(&inregs, &outregs,
+	exec_in_big_real_mode(inregs, outregs,
 			      insn_mov_r8_imm_2,
 			      insn_mov_r8_imm_2_end - insn_mov_r8_imm_2);
-	if(!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 0x34)
+	if(!regs_equal(inregs, outregs, R_AX) || outregs->eax != 0x34)
 		print_serial("mov test 4: FAIL\n");
-	exec_in_big_real_mode(&inregs, &outregs,
+	exec_in_big_real_mode(inregs, outregs,
 			      insn_mov_r8_imm_3,
 			      insn_mov_r8_imm_3_end - insn_mov_r8_imm_3);
-	if(!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 0x1234)
-		print_serial("mov test 5: FAIL\n"); 
+	if(!regs_equal(inregs, outregs, R_AX) || outregs->eax != 0x1234)
+		print_serial("mov test 5: FAIL\n");
+}
+
+void start(void)
+{
+	struct regs inregs = { 0 }, outregs;
+
+	print_serial("abc\n");
+	exec_in_big_real_mode(&inregs, &outregs, 0, 0);
+	if (!regs_equal(&inregs, &outregs, 0))
+		print_serial("null test: FAIL\n");
+	test_mov_imm(&inregs, &outregs);
 	exit(0);
 }
 
-- 
1.5.4.3



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH][RESEND] kvm: testsuite: Consolidate mov r, imm testing in one function
  2008-08-27 14:57 [PATCH][RESEND] kvm: testsuite: Consolidate mov r, imm testing in one function Mohammed Gamal
@ 2008-08-28 16:05 ` Avi Kivity
  2008-08-28 16:40   ` Mohammed Gamal
  0 siblings, 1 reply; 5+ messages in thread
From: Avi Kivity @ 2008-08-28 16:05 UTC (permalink / raw)
  To: Mohammed Gamal; +Cc: kvm, riel

Mohammed Gamal wrote:
> Consolidate mov r, imm testing in one function
>
>   

Doesn't apply, likely due to coding style fixes I made to the previous
patch.

> -	if(!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 1234567890)
> +	if(!regs_equal(inregs, outregs, R_AX) || outregs->eax != 1234567890)
>   

"if _nospace_ (" hurts my eyes.  I find it really confusing.  Please
avoid it.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][RESEND] kvm: testsuite: Consolidate mov r, imm testing in one function
  2008-08-28 16:05 ` Avi Kivity
@ 2008-08-28 16:40   ` Mohammed Gamal
  2008-08-28 17:02     ` Mohammed Gamal
  0 siblings, 1 reply; 5+ messages in thread
From: Mohammed Gamal @ 2008-08-28 16:40 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm, riel

On Thu, Aug 28, 2008 at 7:05 PM, Avi Kivity <avi@qumranet.com> wrote:
> Mohammed Gamal wrote:
>> Consolidate mov r, imm testing in one function
>>
>>
>
> Doesn't apply, likely due to coding style fixes I made to the previous
> patch.
>
>> -     if(!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 1234567890)
>> +     if(!regs_equal(inregs, outregs, R_AX) || outregs->eax != 1234567890)
>>
>
> "if _nospace_ (" hurts my eyes.  I find it really confusing.  Please
> avoid it.
>
Grrr... why do I keep forgetting that! Sorry. Will fix and resend.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][RESEND] kvm: testsuite: Consolidate mov r, imm testing in one function
  2008-08-28 16:40   ` Mohammed Gamal
@ 2008-08-28 17:02     ` Mohammed Gamal
  2008-08-29 11:33       ` Avi Kivity
  0 siblings, 1 reply; 5+ messages in thread
From: Mohammed Gamal @ 2008-08-28 17:02 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm, riel

[Fixed coding style]

Consolidate mov r, imm testing in one function

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
---
 user/test/x86/realmode.c |   49 +++++++++++++++++++++++++--------------------
 1 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/user/test/x86/realmode.c b/user/test/x86/realmode.c
index dd8f3ef..79df0f5 100644
--- a/user/test/x86/realmode.c
+++ b/user/test/x86/realmode.c
@@ -129,49 +129,54 @@ int regs_equal(const struct regs *r1, const struct regs *r2, int ignore)
 		);				   \
 	extern u8 insn_##name[], insn_##name##_end[]
 
-MK_INSN(mov_r32_imm_1, "mov $1234567890, %eax");
-MK_INSN(mov_r16_imm_1, "mov $1234, %ax");
-MK_INSN(mov_r8_imm_1, "mov $0x12, %ah");
-MK_INSN(mov_r8_imm_2, "mov $0x34, %al");
-MK_INSN(mov_r8_imm_3, "mov $0x12, %ah\n\t" "mov $0x34, %al\n\t");
-
-void start(void)
+void test_mov_imm(const struct regs *inregs, struct regs *outregs)
 {
-	struct regs inregs = { 0 }, outregs;
+	MK_INSN(mov_r32_imm_1, "mov $1234567890, %eax");
+	MK_INSN(mov_r16_imm_1, "mov $1234, %ax");
+	MK_INSN(mov_r8_imm_1, "mov $0x12, %ah");
+	MK_INSN(mov_r8_imm_2, "mov $0x34, %al");
+	MK_INSN(mov_r8_imm_3, "mov $0x12, %ah\n\t" "mov $0x34, %al\n\t");
 
-	print_serial("abc\n");
-	exec_in_big_real_mode(&inregs, &outregs, 0, 0);
-	if (!regs_equal(&inregs, &outregs, 0))
-		print_serial("null test: FAIL\n");
-	exec_in_big_real_mode(&inregs, &outregs,
+	exec_in_big_real_mode(inregs, outregs,
 			      insn_mov_r16_imm_1,
 			      insn_mov_r16_imm_1_end - insn_mov_r16_imm_1);
-	if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 1234)
+	if (!regs_equal(inregs, outregs, R_AX) || outregs->eax != 1234)
 		print_serial("mov test 1: FAIL\n");
 
 	/* test mov $imm, %eax */
-	exec_in_big_real_mode(&inregs, &outregs,
+	exec_in_big_real_mode(inregs, outregs,
 			      insn_mov_r32_imm_1,
 			      insn_mov_r32_imm_1_end - insn_mov_r32_imm_1);
-	if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 1234567890)
+	if (!regs_equal(inregs, outregs, R_AX) || outregs->eax != 1234567890)
 		print_serial("mov test 2: FAIL\n");
 
 	/* test mov $imm, %al/%ah */
-	exec_in_big_real_mode(&inregs, &outregs,
+	exec_in_big_real_mode(inregs, outregs,
 			      insn_mov_r8_imm_1,
 			      insn_mov_r8_imm_1_end - insn_mov_r8_imm_1);
-	if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 0x1200)
+	if (!regs_equal(inregs, outregs, R_AX) || outregs->eax != 0x1200)
 		print_serial("mov test 3: FAIL\n");
-	exec_in_big_real_mode(&inregs, &outregs,
+	exec_in_big_real_mode(inregs, outregs,
 			      insn_mov_r8_imm_2,
 			      insn_mov_r8_imm_2_end - insn_mov_r8_imm_2);
-	if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 0x34)
+	if (!regs_equal(inregs, outregs, R_AX) || outregs->eax != 0x34)
 		print_serial("mov test 4: FAIL\n");
-	exec_in_big_real_mode(&inregs, &outregs,
+	exec_in_big_real_mode(inregs, outregs,
 			      insn_mov_r8_imm_3,
 			      insn_mov_r8_imm_3_end - insn_mov_r8_imm_3);
-	if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 0x1234)
+	if (!regs_equal(inregs, outregs, R_AX) || outregs->eax != 0x1234)
 		print_serial("mov test 5: FAIL\n");
+}
+
+void start(void)
+{
+	struct regs inregs = { 0 }, outregs;
+
+	print_serial("abc\n");
+	exec_in_big_real_mode(&inregs, &outregs, 0, 0);
+	if (!regs_equal(&inregs, &outregs, 0))
+		print_serial("null test: FAIL\n");
+	test_mov_imm(&inregs, &outregs);
 	exit(0);
 }
 
-- 
1.5.4.3



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH][RESEND] kvm: testsuite: Consolidate mov r, imm testing in one function
  2008-08-28 17:02     ` Mohammed Gamal
@ 2008-08-29 11:33       ` Avi Kivity
  0 siblings, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2008-08-29 11:33 UTC (permalink / raw)
  To: Mohammed Gamal; +Cc: kvm, riel

Mohammed Gamal wrote:
> [Fixed coding style]
>
> Consolidate mov r, imm testing in one function
>   

Applied, thanks.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-08-29 11:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-27 14:57 [PATCH][RESEND] kvm: testsuite: Consolidate mov r, imm testing in one function Mohammed Gamal
2008-08-28 16:05 ` Avi Kivity
2008-08-28 16:40   ` Mohammed Gamal
2008-08-28 17:02     ` Mohammed Gamal
2008-08-29 11:33       ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox