From patchwork Thu May 9 08:53:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 2543571 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id EE8B33FC5A for ; Thu, 9 May 2013 08:53:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752807Ab3EIIxp (ORCPT ); Thu, 9 May 2013 04:53:45 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:49743 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752628Ab3EIIxn (ORCPT ); Thu, 9 May 2013 04:53:43 -0400 Received: by mail-wg0-f44.google.com with SMTP id z12so2686833wgg.11 for ; Thu, 09 May 2013 01:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer; bh=W15huHoL7vpi5D+LC/zdzPq5+3zKb/yWd831PMniABE=; b=VkGVKyl05h4f4Jb6le53aL2xhgcI6fZNf2rZKalQqJRaX4ID/BMebTToFoJDse40g9 5kavljLOYnGL9MMegMawZoSKAt0VdUmTOYTlt/KC1NC32UKP/Bhmmd25VxAJSWMaR1Sx DLoGERMr+v2MzeRc36AqJiEB6OlKLW5zMosWNV3UI8XopSLknxFlsOqhum75CDlunZ6V gm9BKuQLABPDrRmid0ulrwulsicfcEemS97EBvLYw9ycOOAMDWv5/8rhUx1ugy5FIWA+ 1C5suQSdbjYZM+tzVjlI8n3aWNAAMvdoUaI+BXa+fpuLa8BX83HQ61RiYSYJjVupWedI n3RQ== X-Received: by 10.180.210.207 with SMTP id mw15mr6156826wic.10.1368089622171; Thu, 09 May 2013 01:53:42 -0700 (PDT) Received: from playground.lan (93-34-176-20.ip50.fastwebnet.it. [93.34.176.20]) by mx.google.com with ESMTPSA id bs20sm14050196wib.0.2013.05.09.01.53.40 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 09 May 2013 01:53:41 -0700 (PDT) From: Paolo Bonzini To: kvm@vger.kernel.org Cc: gnatapov@redhat.com Subject: [PATCH kvm-unit-tests] realmode: test AAM, XLAT, SALC Date: Thu, 9 May 2013 10:53:37 +0200 Message-Id: <1368089617-11098-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1.4 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Signed-off-by: Paolo Bonzini --- x86/realmode.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/x86/realmode.c b/x86/realmode.c index 91c93a9..35ace08 100644 --- a/x86/realmode.c +++ b/x86/realmode.c @@ -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);