From patchwork Tue Sep 1 22:47:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 45111 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n81MlnKr023129 for ; Tue, 1 Sep 2009 22:47:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755316AbZIAWro (ORCPT ); Tue, 1 Sep 2009 18:47:44 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755315AbZIAWrn (ORCPT ); Tue, 1 Sep 2009 18:47:43 -0400 Received: from mail-fx0-f217.google.com ([209.85.220.217]:58520 "EHLO mail-fx0-f217.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755249AbZIAWrn (ORCPT ); Tue, 1 Sep 2009 18:47:43 -0400 Received: by fxm17 with SMTP id 17so407706fxm.37 for ; Tue, 01 Sep 2009 15:47:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=ukT55YEjzbqG2jQZKaPgd0n2EISAyRswklxht7A3TbU=; b=KrIvO9ZG/5BrO5XQv6l1/Dd/+phdZYHqFb1IBzGADs4e8RhNPJM+AZzrrul28O+Cma 9CEJaAGXlZhrIUmOIr3FS22nOlhbFEYu/aA4EpNgax99ayQ5aITXxnJHUqEbDGIzBPQC m+yqvPXvsuBoGXz/iQZ0ZBEaWUDfVZzMwsJ60= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=BtOKY/JmYxgef98iLJe43h15BokuyqSYNC2czS/PyQh6PW5N8fWG5cMARBTxodgasq HnIecnM8slXmeAvXgUjYXGJWZrEuRbyBI5tu5ox+2+BR6cDyDBo+sEow1bgoqVND8EOg eq12b+avHpBrAaVK1L5wAK7tygiR6tajJ7RQI= Received: by 10.204.16.86 with SMTP id n22mr6075304bka.100.1251845264464; Tue, 01 Sep 2009 15:47:44 -0700 (PDT) Received: from localhost ([41.238.115.147]) by mx.google.com with ESMTPS id 21sm10389824fkx.14.2009.09.01.15.47.43 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 01 Sep 2009 15:47:43 -0700 (PDT) From: Mohammed Gamal To: mtosatti@redhat.com Cc: avi@redhat.com, kvm@vger.kernel.org, Mohammed Gamal Subject: [PATCH] Add pusha/popa instructions to the realmode test harness Date: Wed, 2 Sep 2009 00:47:41 +0200 Message-Id: <1251845261-12551-1-git-send-email-m.gamal005@gmail.com> X-Mailer: git-send-email 1.6.0.4 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org This adds tests for pusha/popa to the test harness. Added some new typedefs as well. Signed-off-by: Mohammed Gamal --- kvm/user/test/x86/realmode.c | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) diff --git a/kvm/user/test/x86/realmode.c b/kvm/user/test/x86/realmode.c index 0db09b8..20d038e 100644 --- a/kvm/user/test/x86/realmode.c +++ b/kvm/user/test/x86/realmode.c @@ -4,6 +4,10 @@ typedef unsigned char u8; typedef unsigned short u16; typedef unsigned u32; typedef unsigned long long u64; +typedef signed char s8; +typedef signed short s16; +typedef signed s32; +typedef signed long long s64; void test_function(void); @@ -470,6 +474,7 @@ void test_long_jmp() void test_push_pop() { struct regs inregs = { 0 }, outregs; + MK_INSN(push32, "mov $0x12345678, %eax\n\t" "push %eax\n\t" "pop %ebx\n\t"); @@ -499,6 +504,10 @@ void test_push_pop() "mov %fs, %ebx\n\t" "pop %fs\n\t" ); + MK_INSN(pusha, "pushaw\n\t"); + MK_INSN(pushad, "pushal\n\t"); + MK_INSN(popa, "popaw\n\t"); + MK_INSN(popad, "popal\n\t"); exec_in_big_real_mode(&inregs, &outregs, insn_push32, @@ -539,6 +548,34 @@ void test_push_pop() if (!regs_equal(&inregs, &outregs, R_AX|R_BX) || outregs.ebx != outregs.eax) print_serial("Push/Pop Test 6: FAIL\n"); + + exec_in_big_real_mode(&inregs, &outregs, + insn_pusha, + insn_pusha_end - insn_pusha); + if (!regs_equal(&inregs, &outregs, R_SP) + || (s16)outregs.esp != (s16)(inregs.esp - 16)) + print_serial("Push/Pop Test 7: FAIL\n"); + + exec_in_big_real_mode(&inregs, &outregs, + insn_popa, + insn_popa_end - insn_popa); + if (outregs.esp != (inregs.esp + 16)) + print_serial("Push/Pop Test 8: FAIL\n"); + + exec_in_big_real_mode(&inregs, &outregs, + insn_pushad, + insn_pushad_end - insn_pushad); + + if (!regs_equal(&inregs, &outregs, R_SP) + || (s16)outregs.esp != (s16)(inregs.esp - 32)) + print_serial("Push/Pop Test 9: FAIL\n"); + + exec_in_big_real_mode(&inregs, &outregs, + insn_popad, + insn_popad_end - insn_popad); + + if (outregs.esp != (inregs.esp + 32)) + print_serial("Push/Pop Test 10: FAIL\n"); } void test_null(void)