From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2062.outbound.protection.outlook.com [40.107.247.62]) by sourceware.org (Postfix) with ESMTPS id 7EAB53858CD1 for ; Wed, 31 May 2023 08:43:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7EAB53858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=allECOPkIXlmaPYa523du15Rjex7PbDviFmAl2ol0vpei/B4mKoJv6U6iYvGGa9NwHm5WUNLsUtu1K/n0DPDQ4EjW4cT63zO4jmAwWZAge6zkPe9nTvq/3UM/J+re+DtQBlw+JlM6NWH98/+YC5EofbX+cQwzUZbQ5eFHMOQVMQf3Rwqh3ouATChbxeEzZs9Y0FMZQMTSkHzkuJGttrhBVmtkIPFCblfJKUs0Ka6xTiCu7j6dU0gQ7Lcbk8QKN8O1W76FBsoQZCEUgXn14ZF60hMa2pgOC+l70ThJz3sBSb0yvwWyzyhWfqOW8xmgoVZM9hyTjaYpCMnZo1GU9jgTQ== 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=NLA6FkOcL9CcyXTQtY5ywimMmJ+p/MT24doP4+5LNeI=; b=X8jFEXk8otHAraN8osOFRR2C3cQKmRXDfjJTnAYNWuxCHhj9TE/mh9zdNAZ9mqBHN0V4c/HawSDqHQMecikLi+E5dUO8lxGn8nRxK/oGXhVFdiwMiFmtIoy806ZsuEivFJTsn4axcamcOSEVtA0IvM00gy2gLw0V6aD198uzrzZRaZtUb/VhaZEGFx7vs+ifRoFFNuSEbwMxpOxzjGjaNtL6KYFHja20V9yCXm89jCJZenRMdqzucWg65KfLFwX7wdpT6uPRfh8muHb3B4c7XaZU9kMehPYMzpxf6T9SQKcbpxUZpH9sDHHbCDR9OFhe2DFZsIo2d6p00ctdkINOVQ== 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=NLA6FkOcL9CcyXTQtY5ywimMmJ+p/MT24doP4+5LNeI=; b=DhCIMQK0FRbwax9mY9a68pWMlTVlkwqzTqXuwZXtHXMjTA2YVZmGDoHae0udARyqaUpV0VnenkqFJa24S0YpNGABdVB/w75/ibti4OKa2Ml8f+Nh2KNmV09Uz74Dt9YITbvW/AWf3Uu60CRPgKCAIx8F/jsJkast+2//BZJOI3mEln3EkgUCeqmvYAwYWBoE4v1nGp9+wFLwE7nkr3kRZWhIVkwaXwyr7VIAhLn+hT1CBhCs2VtkDCmKKPB5vmvx65Yx8bD39jZcv1/K1eyh1Cig2nxvRpCPV8J+W51ZnfXQ+PNV4a2AohUkoHSyc8DCG89EScuFygt92Hx6RlHSmQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by DB9PR04MB8493.eurprd04.prod.outlook.com (2603:10a6:10:2c5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23; Wed, 31 May 2023 08:43:32 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::e442:306f:7711:e24c]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::e442:306f:7711:e24c%5]) with mapi id 15.20.6433.024; Wed, 31 May 2023 08:43:32 +0000 Message-ID: <3a1ab1f6-c7d4-3e0b-7a6f-7ac2fa1ec90e@suse.com> Date: Wed, 31 May 2023 10:43:30 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] x86: Add Evw to emit w suffix for several instrctions for word ptr Content-Language: en-US To: "Jiang, Haochen" Cc: "Zhang, Jun" , "binutils@sourceware.org" , "hjl.tools@gmail.com" References: <20230526082648.1503574-1-haochen.jiang@intel.com> <24df0b69-1a0e-22f2-c1ef-a986293d2231@suse.com> <37736f27-73d5-6564-e27e-5e7cd5bf27da@suse.com> <31f33bf7-2809-2199-9877-167854324924@suse.com> From: Jan Beulich In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: FR2P281CA0082.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9b::9) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|DB9PR04MB8493:EE_ X-MS-Office365-Filtering-Correlation-Id: a39dfb4b-6f79-473e-0947-08db61b31d16 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z7+Uq03M68eC3YITlyQQieb38kyD4TzB4zfvwc16QWFL1DXv5AxOTLB+MfROauHgZGKXwEzrkNIFC1mzI0osvHQZc2s/K0QsnUAJ9viqTdA+KnUPTEGZ6DJdzwwLu1dF+soS0zhXMgPFfwiwE5iaIw8cxlQr8Nasi4y4CM7Fyp6vTj3aEJWltMZszbuscp+5rbPCqnz32ByRtUJjww1L23L1A2kys8OI0mENJK4u4OQ4ICv2dtOiJ5Lmpm5Oj4FUY8XxHDNJajK1dmLQA+9Vo/3e/ic6Xi+V4n44F0wfnsMnG5ZKwsh5kiHOJqaIp0u4/K9HEe6QlaTe5ed10Yn7AmgU9BMdr+NOSMDc3Ommgn6etcX5eFVyCreSWglCIEE4k9Ych7Xgy6NZFftq9nBNEsfRzXMZFf4Ppg1LeR5vl2DP5nBoXlaqEMuBVW0lwDNfwFh9gjX3IBScsKawhV5y0M5v/DLqtpqyU9mvuXbYpOv8W1jJ56wLEMJ5QI7QDR9ZL+8EaHIVUwi1jqJVrykePkkeH3C9bxDtvgN/GlsvB2QbKrcGa2Vm2tGF7iYXUxBXvZhnNBxzCwEq74RUo4dLbTqEgYJd42pD78cTLeDZx2QonMsZSJsRLCAIUXXEst6Pi8t5EwuBFnBUFqYQ1M3ZGQ== 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)(396003)(346002)(376002)(136003)(366004)(39860400002)(451199021)(2616005)(38100700002)(186003)(41300700001)(31686004)(83380400001)(53546011)(26005)(6506007)(6486002)(6512007)(478600001)(54906003)(4326008)(6916009)(66476007)(66946007)(316002)(5660300002)(66556008)(8676002)(8936002)(31696002)(2906002)(86362001)(36756003)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WG5pZVQ2MzNQUVpzSkRqQm1Id3RGRCtremtPT2x5c0Z6UWtvdmQ1QkFtVkFY?= =?utf-8?B?RjV3aWFlVUFjWFRpWGp1ZnFMWndqWFNHYUw5dHcwc3V4RUVpTVRvUTV4cTdo?= =?utf-8?B?WCtoeUNpeTlyU2xkM1dtVjh5VDhNLzNXS2ZSaFJ3ODYweUd2MWoxVGptdWx2?= =?utf-8?B?eDlDVzMzQXZUZXFpUThlVnNsZWNDYkNEVVEzQkNoRm1Fek8x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3o4WTBCc2J4bjY3NGdlYk02YmlWTExR?= =?utf-8?B?L0Y1eGpROFlMaEVqSTlRRTVmQ0hjREpXNkRvWmplalp0R05tOHg1Q3cydFdo?= =?utf-8?Q?pJXwZHeLYqTX9LJn6ST21k021?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: a39dfb4b-6f79-473e-0947-08db61b31d16 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2023 08:43:31.9628 (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: vklmkQgvP1rF9YDcetvWXeKpQuKcL0z+kk4G0ONy6r2noW6uoY4iRLbv3ITTT1s5VEl/iEVREL8fxKgzBVhffA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8493 X-Spam-Status: No, score=-3027.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 31.05.2023 07:48, Jiang, Haochen wrote: >>>> Maybe I got some wrong understanding on that. It comes from the >>>> current testcase. >>>> Trying to clarify that on disassembler. >>>> >>>> Let's take lldt as example. Will 0f00d2 emit eax register or ax register for >> lldt? >>> >>> One thing to add the current behavior for disassembler or trunk is to >>> emit ax register. Which I mean always is to as always with other instructions. >> >> I'm afraid I don't really get what you concern is. Yes, ... > > I mean, for bytecode 0f00d2, should it emit 'lldt %ax' or 'lldt %eax'? The former in 16-bit code, the latter elsewhere. > Currently, in the testcase, it emits 'lldt %ax'. I suppose it actually fits documentation > and we should not change it. I think we should change it. Expressing operand size by proper GPR selection is better than emitting (bogus imo) prefixes. Plus, as said, before, please see the (in principle similar) move to/from SREG insn handling. > BTW, I read SDM today again, for SLDT/STR, they have the exact explanation for > handling of r32/r64. > > For STR, we have: > "When the destination operand is a 32-bit register, ..." > "In 64-bit mode, operation is the same. The size of the memory operand is fixed at 16 bits. > In register stores, the 2-byte TR is zero extended if stored to a 64-bit register." > > For SLDT, we have: > "Outside IA-32e mode, when the destination operand is a 32-bit register,..." > "In compatibility mode, when the destination operand is a 32-bit register,..." > "In 64-bit mode, using a REX prefix in the form of REX.R permits access to additional > registers (R8-R15). " > > But for LLDT/LTR/VERW/VERR, things are different. The operands at least will be fixed at 16 bits > in 64-bit mode. > For LLDT, we have: > "The operand-size attribute has no effect on this instruction. > The LLDT instruction is provided for use in operating-system software; it should not be used > in application programs. This instruction can only be executed in protected mode or 64-bit mode. > In 64-bit mode, the operand size is fixed at 16 bits." > > For LTR, we have: > "The operand-size attribute has no effect on this instruction. > In 64-bit mode, the operand size is still fixed at 16 bits." > > For VERR/VERW, we have: > "This instruction’s operation is the same in non-64-bit modes and 64-bit mode. The operand size > is fixed at 16 bits." > > Therefore, I suppose for VERR/VERW, the 32/64 bit register should never be allowed under any > circumstances. For LLDT/LTR, in 64-bit mode, it should also the same conclusion. In protected mode > and compatibility mode, it is questionable. The current implementation of assembler might need a > fix. Once again, please compare to other insns where we handle things properly. Moves to/from SREG, as mentioned above, and things like PEXTRW/PINSRW. The way the SDM puts things isn't always best; the main goal ought to be consistency within the disassembler (and, just that it's not relevant here, the assembler as well, of course). Jan