From patchwork Tue Apr 4 14:51:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13200310 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 580BFC761A6 for ; Tue, 4 Apr 2023 14:51:49 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.517913.803900 (Exim 4.92) (envelope-from ) id 1pji0R-0000QD-Jz; Tue, 04 Apr 2023 14:51:31 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 517913.803900; Tue, 04 Apr 2023 14:51:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pji0R-0000Q6-H0; Tue, 04 Apr 2023 14:51:31 +0000 Received: by outflank-mailman (input) for mailman id 517913; Tue, 04 Apr 2023 14:51:30 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pji0Q-0000Q0-MV for xen-devel@lists.xenproject.org; Tue, 04 Apr 2023 14:51:30 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on061d.outbound.protection.outlook.com [2a01:111:f400:fe0c::61d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 2e687569-d2f8-11ed-85db-49a42c6b2330; Tue, 04 Apr 2023 16:51:29 +0200 (CEST) Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by VI1PR04MB9979.eurprd04.prod.outlook.com (2603:10a6:800:1da::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.35; Tue, 4 Apr 2023 14:51:28 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::154e:166d:ec25:531b]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::154e:166d:ec25:531b%6]) with mapi id 15.20.6254.035; Tue, 4 Apr 2023 14:51:28 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2e687569-d2f8-11ed-85db-49a42c6b2330 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XANcl+4tlrwBoTsvD4ro7L547vtHaE+az1sGOkY/hrFadqxBtXZkvrZCC/jz6BXakZ6cu7AUFEs0i16TgCKVtvMr1mgj7DCLuz2Z/Hty859M0y5ybeqP1dZrj/2BnOvq3XTMHrlkkjenbnzpR9j2Ria5AO2aWKeVIcXAlu0qQQzuUMoi4O75KdVavZKxTK8GnEhAPALDy3i5iH4PqBf0ci1lJXtZxi4U6iTwl2u9ZXgzaYFewQ6x07rjvnAcgGJ9+jmTaHmoPU+4RJcjCbN9dtt1PtjIezmiPrL0C6uqZ54s/T+CuCCeyMNNOsZWIoiN7DVr+tVvAqHle/1lQxA/8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eoN5/J1wcWGoWrTfKMxsXC6epsaN4Cagva4IJnTZ3rI=; b=Kit+0++cgohLU6r5aI7YpsOx4hEl9AOJMOZ7R5o/ex5zt7ZeQpXLvm/zQv0G4v1N51Q7mwZBnwrcB+bx0MGwXhzEqFmlMt+hAYrCGvHy1G4L7CVNYo6Q3JTniVYAQqxMcSUzG0Zt0Z2NaI2hflxuGkYDLn46ynm4B+dRp6sifDyEEXCYEXWf9qfE5JRNBLJcFvbSbz5/QLi31CdiPsIeIgDW6ruoSx/MRZ2cD4dPBNL4TRV7X4zJpREnnu3Uodf7z6lb2srNzXMXMOa8AdhhBzbEUmTVdcum/Iyg5mOa/rniVbbEx3rpE8GqwI1/fITzlphHN9ftYS0CYfxoLadhDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eoN5/J1wcWGoWrTfKMxsXC6epsaN4Cagva4IJnTZ3rI=; b=LQnFx00uCEIVsIM9lGKLXcHwic0V8q1JPW4C9g3tBt7uUwoxzZ33EQnJpWc3fUT23iCBcrGo8WrgZoKbt1e8xUBsEyQs4JS+eTWD6+lrfh7Kk87uZYisugXeXpJy7HqFhNq7eHQlPnthxxLMe8PpcuR7D+PCIAtJql48Wd8pwRxJM7unnS+CfyK6gdjW0s9ofJga1eBVSxskbduvrQhitwQfH8QmBE3YjvgdZdIHkCHxgW0ryxFddy9sJDVrU9DgFvklZGaQY+n6mDe9YORc+aGBucM6AdO0SdeRtn3II/9H4EAV7NYiRYE5JmvqiExY0BkKKZ4TSX0nxVxbvhTH/A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: Date: Tue, 4 Apr 2023 16:51:25 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: [PATCH 3/9] x86emul: drop regs field from emulator state structure Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= References: In-Reply-To: X-ClientProxiedBy: FR2P281CA0144.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:98::18) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|VI1PR04MB9979:EE_ X-MS-Office365-Filtering-Correlation-Id: 2fc72461-e753-4fb9-92a7-08db351c1204 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +i+O0wDRCs1crW0KniaW9fvWic7mfNcpD/5r6FOdWEqHExEkTjPNd+v7NWom4d0yhaawNWpSc/tyTLYN5c52pMSX+MWejYkNXG16t5g+V0eIuwNgA6RS0w3KPTaFX6YT+Ld6+dZ7hleyfJnFydVJKN4nBr5bM6g8oznX31lRfQPwX4ZE0Zl+AOC72aI6v8QXVsE/6eUg6bPre2zWtB+wFtdGWzn93eBXSGt44qKWq1KRnZDvjIgjbV8yYPG3y41OUzBAsiN1AVs/6ux4XV4eAq9+zVqNk5lPjkPmG+xM0B51VYOjwYwX7DG09EZ8xcCtkubXi8/mh72zt62a/Rl9QwnD/0/2jYFoVND6m+wgX+H5xBXr0kfM6u2MXV4S/mP2YOiqHDkMtHWyh2VnsKFtfKIFlcPal8U/9zmzyuRqjNZLUa7ja41GXATlQjescI1Ya65LbJxNPYIr4RLhup8sbXPuyz8IT+EtQnUw2Wbq0838Ri3lhkgK0B76yTbxRLVWblLbw3ZyHbjUBPlga1/ReyRcpdZcghtKfbdMCCN3YG3lVtnZYP6WMMO2l6pg7oWfDQsN4MciuW/yJ1rQgKoiGF7IKqrzCrH4tpFCJB9sm4Pn2ooVRHwssXD1wusmMWlLLphm6CDZ8sTjk5arO6P8wOMzDKpj8zZoE/WeUu85mKj8iJdnXbT5VOq2k8IWCmoe X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6560.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(376002)(396003)(136003)(366004)(39850400004)(451199021)(2616005)(6486002)(6506007)(316002)(6512007)(478600001)(54906003)(2906002)(26005)(6666004)(186003)(5660300002)(38100700002)(66946007)(66556008)(66476007)(41300700001)(86362001)(8676002)(31696002)(8936002)(6916009)(4326008)(36756003)(31686004)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?UpGYI557e7G8chtfws+lwL72bqgS?= =?utf-8?q?Lt/v/nVlVrOsc7M5hbwBWKUCECVPiU+EQvLoE39soP8nn0aMMsxGiYJyRVGyQun/3?= =?utf-8?q?K7j0Y0r28k8pUp393HEX7qfLHN+6Rn7LU8n5NF6FNmZu01/s8/ip4awwTac2LNOKr?= =?utf-8?q?+Gw1rHfQBlOYoF/BfBxCvfA+a4H+SsB9CnUk/6NyP8+nOuNdFCLkp7Tt4k7iWtPoK?= =?utf-8?q?/WiWZrC/3fTJG691jrvkHY/0LdbtCmQpz+OapisK6ZIQs1QYRVWu987aG6GrG5NDB?= =?utf-8?q?xdbwPpoOGeFTDafgnxpyogYwxiI4xVLif7ZG155qjSgSmWAsWItT3/2J8Pd0sLa9r?= =?utf-8?q?cSX2/zMzpFHPiPM8AkMAVyJ9KLQ3GSqhxn1MuAIAD6AUeR7gvGIPeH6X3hsKyIMyS?= =?utf-8?q?tWxjvrrQFuy6/suHGn3mFQPMcGFgzZdzYMMIvF5SGLe0MBKgAlMJULgHTTl2SaKPJ?= =?utf-8?q?byaVXhcvc8M/FIlLYjPOjSLSVQHgPR/MD5fJUetEmhP4ANLGQE80gOTcYUxTjTpNv?= =?utf-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dSH/Coon8qKZvtZA2baRnnuEhVfJtTsx2QS7YK+Y1KfkQ7bF1fwgdqUv?= =?utf-8?q?WINuW7bIq/uoYHpqni5lqIzgmSWyOtksBGiDTZicEq8Ry075jApJgeUtSPpQsDwSs?= =?utf-8?q?OmrbrBJ1d5Zq?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fc72461-e753-4fb9-92a7-08db351c1204 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2023 14:51:28.2371 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: o2LtRZdsAfE8Y0Vt+/qcG366+tWsmoMtZEMrlP2JlydSqXLFpnf9wu4csyY9Y/BJ7h/uIhdZXQUgIvOphrq6hQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9979 For an unclear reason 0552a8cfda43 ("x86emul: track only rIP in emulator state") converted the original struct cpu_user_regs instance to a pointer, rather than dropping the field altogether: The pointer merely aliases the one in the context structure. Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- a/xen/arch/x86/x86_emulate/decode.c +++ b/xen/arch/x86/x86_emulate/decode.c @@ -1013,7 +1013,6 @@ int x86emul_decode(struct x86_emulate_st s->ea.type = OP_NONE; s->ea.mem.seg = x86_seg_ds; s->ea.reg = PTR_POISON; - s->regs = ctxt->regs; s->ip = ctxt->regs->r(ip); s->op_bytes = def_op_bytes = ad_bytes = def_ad_bytes = @@ -1129,7 +1128,7 @@ int x86emul_decode(struct x86_emulate_st default: BUG(); /* Shouldn't be possible. */ case 2: - if ( s->regs->eflags & X86_EFLAGS_VM ) + if ( ctxt->regs->eflags & X86_EFLAGS_VM ) break; /* fall through */ case 4: @@ -1458,33 +1457,33 @@ int x86emul_decode(struct x86_emulate_st switch ( s->modrm_rm ) { case 0: - s->ea.mem.off = s->regs->bx + s->regs->si; + s->ea.mem.off = ctxt->regs->bx + ctxt->regs->si; break; case 1: - s->ea.mem.off = s->regs->bx + s->regs->di; + s->ea.mem.off = ctxt->regs->bx + ctxt->regs->di; break; case 2: s->ea.mem.seg = x86_seg_ss; - s->ea.mem.off = s->regs->bp + s->regs->si; + s->ea.mem.off = ctxt->regs->bp + ctxt->regs->si; break; case 3: s->ea.mem.seg = x86_seg_ss; - s->ea.mem.off = s->regs->bp + s->regs->di; + s->ea.mem.off = ctxt->regs->bp + ctxt->regs->di; break; case 4: - s->ea.mem.off = s->regs->si; + s->ea.mem.off = ctxt->regs->si; break; case 5: - s->ea.mem.off = s->regs->di; + s->ea.mem.off = ctxt->regs->di; break; case 6: if ( s->modrm_mod == 0 ) break; s->ea.mem.seg = x86_seg_ss; - s->ea.mem.off = s->regs->bp; + s->ea.mem.off = ctxt->regs->bp; break; case 7: - s->ea.mem.off = s->regs->bx; + s->ea.mem.off = ctxt->regs->bx; break; } switch ( s->modrm_mod ) @@ -1517,7 +1516,7 @@ int x86emul_decode(struct x86_emulate_st !s->evex.RX) << 4; else if ( s->sib_index != 4 ) { - s->ea.mem.off = *decode_gpr(s->regs, s->sib_index); + s->ea.mem.off = *decode_gpr(ctxt->regs, s->sib_index); s->ea.mem.off <<= s->sib_scale; } if ( (s->modrm_mod == 0) && ((sib_base & 7) == 5) ) @@ -1525,7 +1524,7 @@ int x86emul_decode(struct x86_emulate_st else if ( sib_base == 4 ) { s->ea.mem.seg = x86_seg_ss; - s->ea.mem.off += s->regs->r(sp); + s->ea.mem.off += ctxt->regs->r(sp); if ( !s->ext && (b == 0x8f) ) /* POP computes its EA post increment. */ s->ea.mem.off += ((mode_64bit() && (s->op_bytes == 4)) @@ -1534,16 +1533,16 @@ int x86emul_decode(struct x86_emulate_st else if ( sib_base == 5 ) { s->ea.mem.seg = x86_seg_ss; - s->ea.mem.off += s->regs->r(bp); + s->ea.mem.off += ctxt->regs->r(bp); } else - s->ea.mem.off += *decode_gpr(s->regs, sib_base); + s->ea.mem.off += *decode_gpr(ctxt->regs, sib_base); } else { generate_exception_if(d & vSIB, X86_EXC_UD); s->modrm_rm |= (s->rex_prefix & 1) << 3; - s->ea.mem.off = *decode_gpr(s->regs, s->modrm_rm); + s->ea.mem.off = *decode_gpr(ctxt->regs, s->modrm_rm); if ( (s->modrm_rm == 5) && (s->modrm_mod != 0) ) s->ea.mem.seg = x86_seg_ss; } --- a/xen/arch/x86/x86_emulate/private.h +++ b/xen/arch/x86/x86_emulate/private.h @@ -321,7 +321,6 @@ struct x86_emulate_state { #define imm2 ea.orig_val unsigned long ip; - struct cpu_user_regs *regs; #ifndef NDEBUG /*