From patchwork Wed May 23 14:54:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 10421713 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9EFE66053B for ; Wed, 23 May 2018 14:55:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C87F28868 for ; Wed, 23 May 2018 14:55:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F73D2888A; Wed, 23 May 2018 14:55:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0287528868 for ; Wed, 23 May 2018 14:55:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6996C6E514; Wed, 23 May 2018 14:55:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0063.outbound.protection.outlook.com [104.47.41.63]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5CF906E514 for ; Wed, 23 May 2018 14:55:01 +0000 (UTC) Received: from fedoratest.localdomain (155.4.205.56) by DM6PR05MB4588.namprd05.prod.outlook.com (2603:10b6:5:9f::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.797.5; Wed, 23 May 2018 14:54:57 +0000 From: Thomas Hellstrom To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/3] drm/vmwgfx: Fix 32-bit VMW_PORT_HB_[IN|OUT] macros Date: Wed, 23 May 2018 16:54:19 +0200 Message-Id: <20180523145421.2501-1-thellstrom@vmware.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 X-Originating-IP: [155.4.205.56] X-ClientProxiedBy: HE1PR09CA0082.eurprd09.prod.outlook.com (2603:10a6:7:3d::26) To DM6PR05MB4588.namprd05.prod.outlook.com (2603:10b6:5:9f::25) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM6PR05MB4588; X-Microsoft-Exchange-Diagnostics: 1; DM6PR05MB4588; 3:YMEigIIk8W4gh2+HVbr3AvnJ3JfGv7UAV0UDUP4vGET72gaYNYKZ90KXvoG1CeskogUkRe1Sv8PUzl6ewWJkjFjFY+Q/UCEgphwjLlDhNFsd+5p9ib4rSA928lw3XyBgT40v7TnyyjinwrOQFLONcPSWE5ztRysNzqwP1rgddpfQcRYNQcsdMY3ifS0vR4EMkJ96Ou+35Xm9xLH2jyChd0QS2/kdFFjsBtYJZ8Q7uROgbLbl8+UTsxuv9vUMedZm; 25:VSBHw6hXw1/8mYKQLzoxBIfRKoz3qrf5SA6MO5IbvnBlJMJdUnfMcadjxsbhwT/O+49l2O9RWdF/aKZ5THxz342/7A7O60Ux6G/fkdYq6LOGv1G7YACBqazTSJyJOKJDlHIlNKlpy3b9J2sSsXdYiDsU9xaazNZ1Own7ybQrxh+eG96NqeDALsusdiFy8AzMPnmTOVR9f767o6UduloDYYqLQuCIkX3BA9QlrRUkOOs4nRlU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VkGHuV7lSoLB2IDWIR1XXNSdVC+cjB8vX9GrONBtswfVwg++j4B0vYjjttW1u5u9HLGFPXoX4VlrIiMHDC8kXnk/9eMi83zMzczr7uMMcYTHqr3AZ48LygU63G7RZ+mAD1bxthjX+IAZmJPkslBo/6j5idF18NoPNio9sSVroCBQlP7HkdA5fvlM4Or7tL48XHWS+P4drAhacNtXaNF94QFBF9+ZysgjY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150)(9452136761055); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231254)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:DM6PR05MB4588; BCL:0; PCL:0; RULEID:; SRVR:DM6PR05MB4588; X-Forefront-PRVS: 06818431B9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(39380400002)(376002)(346002)(366004)(189003)(199004)(478600001)(7736002)(305945005)(48376002)(50466002)(68736007)(4326008)(25786009)(36756003)(5660300001)(6486002)(53936002)(6116002)(3846002)(6512007)(1076002)(106356001)(8936002)(105586002)(2351001)(50226002)(2361001)(81166006)(81156014)(8676002)(6666003)(6916009)(2906002)(97736004)(59450400001)(386003)(6506007)(186003)(16526019)(956004)(2616005)(316002)(26005)(47776003)(575784001)(86362001)(66066001)(16586007)(51416003)(52116002)(486006)(476003)(83133001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR05MB4588; H:fedoratest.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM6PR05MB4588; 23:jlkR4SHusONC49cPka+9MYGXaJlIDSCQKO8lDS/T/?= =?us-ascii?Q?xeEAvptntY26otKc3hhB0roJdfjccaCXB6yHt9Pq6lVwYA+vTn7a64ZvqExq?= =?us-ascii?Q?E2UyMJuASCxYxkGEdqopi3dmh4sCPEF79V+nP6H1A2Q/qRmKTdDkowKdv1KB?= =?us-ascii?Q?3jKN20EozMXVJSWfZIuqnrK1yUkYnFR6ESR8s7tTlUXgx3NfxKLRB57JKrhj?= =?us-ascii?Q?QWhiBOpCKbGTWrm1JM16Ca2gTLUkMA5ygBwTxc3ctKNANYfiMUwNWeZghpH1?= =?us-ascii?Q?gjhLqe+1c5splfz8lDAj6n7oM7lNiJHw+w7Tro0BpREa0RIifK34pJhESgew?= =?us-ascii?Q?xU1lrseYyHpJumv1qbaqakVEq9ITM7gx1fUb+RHMQTKX/28TxnTFakurrxTg?= =?us-ascii?Q?GKovW7u8QWsnM1JcCriMMsAiOJx+fcb3rh1eb+9eg9upgKe1ZxeiUrscU415?= =?us-ascii?Q?avA3tW0QDwJ86YyF0Ivxus3euGruXPmPEcHlggnZ1Cdg7AYEAckobHs+Gn59?= =?us-ascii?Q?nkFjapJDl9xXfEIHBx18TMvzXOg2XG2z7voRJU/KRP0dT6debiY3edOMo6pj?= =?us-ascii?Q?zyWuApM2v6Qe4UQZbCFzjLDPEF4z2JV4haI5x1mh2nVXpzauDtGmhkDiIpf2?= =?us-ascii?Q?swrSOUm0MeOx94brKGKe+IYqsigc72C5n1k9u1T0M9p+V4qYCd4+4/jBufhJ?= =?us-ascii?Q?Si0Idpk8lo6kEl80ue+BCHObYopbXBxTKoGX616ne9A4SnCcbryq/6yutt7z?= =?us-ascii?Q?uQXvhT/dRRDdhDIX3yzC0yqwwyNNELulQryQ7LKvDvDBwnNhcCdDid5Ahs3c?= =?us-ascii?Q?u/3EIxFG7N2Bti7uLRd18GaAY5tKu+JS0dQLH2oFqxIE7tBTCb4HYXLVhWH/?= =?us-ascii?Q?8GJ6eA1vDMmvSrySe+zySvPI607FPWw+jCd14KNXzvPDQSqBfQA7zCRhCTQ8?= =?us-ascii?Q?FMrdvMBMoYumgjJnailVCwf1nwzpdbd0FzfQQ2cFBQeg9dROVPSTeSUyEHS2?= =?us-ascii?Q?U6N+dUnoNsJ+aSKuLpsmNnopU784trbef3wam/+ifGkv/S4QYHktS79FWHIg?= =?us-ascii?Q?tg4guRGFadrAVC+TMXLTuMphpijuMxR7hZ0EbshrkReyfDGarMl+30lyEnYk?= =?us-ascii?Q?dzUZBwHY1vSoTxI6ejvDsNJe7AZn2D/JWnIM/MlA4i3B3D9e/zQCOwItjPRe?= =?us-ascii?Q?zhaxE2iLRRG2AjTDdn52hbgdDqPgNmVTeSru2QGvbuT0kxRay2SicD2nfflX?= =?us-ascii?Q?bd9EJdxspp5IGjSXxI=3D?= X-Microsoft-Antispam-Message-Info: JfrXHIYr8MCzCAaEawrSfQuUxFihg2UNA4EKk69bWXBLZZjibgB+LehlcL3oXtF2JICIshj4/TyubG2II46hzLCWkUsnG8tfQTuLieCNLfYLLm5cpOgIg0iTmbTwuthX2qobvMaZdtRrgbiNm/nAK3bTRB8fgUwwjuzTFv/mZc7O8exW5TEd9kTrgfyl3Sfe X-Microsoft-Exchange-Diagnostics: 1; DM6PR05MB4588; 6:tGtAyVS28DE6u5StE754rUCGR0Iu0qcDiHdZ+u3HX/G+1QIWgchxmnje1TELScixM0KVSVCl5rWd/BZY6op8Ji56OQWrhszqc/AITaCSSlHQPa2Q83vdNxF8A7/K/63ZvUKKB3Aokziq5XVWVxxk0bT2Ix24Z2JcUZzCpqPOKTFjClBU2mDNc+ShNy3LpICNgzAyC9mP4gugtTGb/QbU+LdxYO4Pcb/OLvV1oLgllYYRBdV7dXovGxD9FQzn3PELiRf0AwoGm/OcF8Sv21D4HVvpxBqjAEFXc96O0aRsC+oZMP/vgIyZZ0jhuRTq29kz2XbJqgoysN8Vo7o16HDUv7zqyoIP+t+h7ZvF3Qu84MIICi/7EEX0xUMd/21wJ6MvAwOrN+U5wYGmztrQpZOzgOWl4ET0MejOiB8exhT6vj6WTs/eM8R14JDulhIRiXFPz5UxDMZyRyK/eub1VSYqZQ==; 5:nWj8VDcldPq3SM/iutlmAFUoUpOC+esj6Xtm8uIvk/TM7Ph3HulsDW5daLixcHe5GUs/XgdweXI2hWrJvYwyr/wcsh0YVYjuz+UAEDElOfxdrgMQf0ohJrMnIAvhR59MZTcxmdPk8tmgWVBSZzVYtH3L5TW5dQEQRq/JOwUMAY8=; 24:KYig/Y4A3VsYQb1yjCVDY5hpaNFZ4FAi/M8HcDbE72ma9OqIMkwEJK+wKqKbSXZpue4DssrM1ukg/6toqH+i+AJL/mhT1TKKfshdOtLS70Y= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM6PR05MB4588; 7:V+ZKgQHku9rJxRe0sOsZCCDDpHWXt//AOd/nY2YDX40Hbm+JZnUMIUZvy/gNKxlxenYnyXs+00Xqrwgsv8bQy1uGthb1iZ4NLDkKFHBZfmnCnzKb9APmSqGUGrxdNCpw8joX6aYJ6yVSjdESTIkmxvbVKWF4GhFr50AZkH0pRd+Q59hn8VMrd7HhcPsU5vQq9WvtvBcQ0dXO2YRCateXQE0I25DIRxvfxyvij57fq2RcuQkcdaZpbM3kIyCdLr8E; 20:3WFVG6tM6AVj7yLbHtbvrX8ipvQKmeMBNOQzpov6pJJFTfrShsjAbcsg+LLJWCZCfQneEvshSOVLN4U91FBRd7zeciuTgrbCzJEBvun+d4kZEsUfKaKdUhZhtgqOXE81lHqfvkYlYZhxVhygEvTboe0HAPzgm3Onzq30K5H73ZE= X-MS-Office365-Filtering-Correlation-Id: 6e396f22-67af-417f-7e6a-08d5c0bd2773 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2018 14:54:57.7431 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e396f22-67af-417f-7e6a-08d5c0bd2773 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR05MB4588 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Hellstrom , stable@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Depending on whether the kernel is compiled with frame-pointer or not, the temporary memory location used for the bp parameter in these macros is referenced relative to the stack pointer or the frame pointer. Hence we can never reference that parameter when we've modified either the stack pointer or the frame pointer, because then the compiler would generate an incorrect stack reference. Fix this by pushing the temporary memory parameter on a known location on the stack before modifying the stack- and frame pointers. Cc: Signed-off-by: Thomas Hellstrom Reviewed-by: Brian Paul Reviewed-by: Sinclair Yeh --- drivers/gpu/drm/vmwgfx/vmwgfx_msg.h | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.h b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.h index 557a033fb610..8545488aa0cf 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.h @@ -135,17 +135,24 @@ #else -/* In the 32-bit version of this macro, we use "m" because there is no - * more register left for bp +/* + * In the 32-bit version of this macro, we store bp in a memory location + * because we've ran out of registers. + * Now we can't reference that memory location while we've modified + * %esp or %ebp, so we first push it on the stack, just before we push + * %ebp, and then when we need it we read it from the stack where we + * just pushed it. */ #define VMW_PORT_HB_OUT(cmd, in_ecx, in_si, in_di, \ port_num, magic, bp, \ eax, ebx, ecx, edx, si, di) \ ({ \ - asm volatile ("push %%ebp;" \ - "mov %12, %%ebp;" \ + asm volatile ("push %12;" \ + "push %%ebp;" \ + "mov 0x04(%%esp), %%ebp;" \ "rep outsb;" \ - "pop %%ebp;" : \ + "pop %%ebp;" \ + "add $0x04, %%esp;" : \ "=a"(eax), \ "=b"(ebx), \ "=c"(ecx), \ @@ -167,10 +174,12 @@ port_num, magic, bp, \ eax, ebx, ecx, edx, si, di) \ ({ \ - asm volatile ("push %%ebp;" \ - "mov %12, %%ebp;" \ + asm volatile ("push %12;" \ + "push %%ebp;" \ + "mov 0x04(%%esp), %%ebp;" \ "rep insb;" \ - "pop %%ebp" : \ + "pop %%ebp;" \ + "add $0x04, %%esp;" : \ "=a"(eax), \ "=b"(ebx), \ "=c"(ecx), \