Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2529659imm; Thu, 7 Jun 2018 12:11:33 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIVeSwKF6hfVc48IQDipqQJyW28Pv+hrWCmaTndNMWY1oJSa2xF9L8B+Iqk2UlUociFu9Sr X-Received: by 2002:a63:9402:: with SMTP id m2-v6mr2571611pge.8.1528398693178; Thu, 07 Jun 2018 12:11:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528398693; cv=none; d=google.com; s=arc-20160816; b=xCO9BRSvpbaaO7gL95t4oi1nr21GHu8DzvI51IdEFc/bi+DiTblbtNMK4Dan24fQPM kFJMSNgHwr4qmI/F+GeDJqaKx3lE6supGzt7FKJ47fSGPE5tVKevb3+h5Xvz4+UL+5zw aZq9L+AvneAN6HW1fpYktx6jKatQU5EMJvj5EzFzw67cY+rn9pjW37RnZ7IY/4Ng/NOn w4ZKblWN2oaAqtMTQd+bPp/Adf+BjR7cLVHWU9NfIC5miraRfDOPQTQkDA8rp8nXV7Oy +WOdPB9Uu3WbHqH5CFh90efHy24ukCUGrCnemLejRL9j/mGlijYWdMD9beeXNiQyk9Js pnqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=yGeT2z0TEJiRxrbez/GsuqB8RgVtytCBVtTQ7JK4sXk=; b=XSDby9Ihq73UdwI5jMcUhrBquy4nGOuB4/6/RhuSNXT94nnyYPtfbnZmhA+UE+meRA ++hCAMxy8w4al1AEqZ7kcGF7G+36ILBe/VBYZJ+5r/e+qXqIYVCEhWHgoZ7PSYY5bPmK Oz4zk1Q9WJw/GOHEsgIopiRlQOmSvHX8Q7iA3bcvmlRCMVBSEMA2Nix2FP6WeFRHPV3l lyfKASGtT7yswqVZTDxw4NFmHutla8JopN0eniD+NSjxxuDXpvdprD7DZmd7NsXpqJ7i H/mywWtu0Ad7Hv8Yw00rA5KQLohDseulrbHZyIuMxr2rM7K0bYh9y4PgxP6q0xdGn8NS Wz1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HEY9qXL0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bc12-v6si9305957plb.373.2018.06.07.12.11.19; Thu, 07 Jun 2018 12:11:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HEY9qXL0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936328AbeFGScp (ORCPT + 99 others); Thu, 7 Jun 2018 14:32:45 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:47025 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936302AbeFGScm (ORCPT ); Thu, 7 Jun 2018 14:32:42 -0400 Received: by mail-pg0-f65.google.com with SMTP id d2-v6so5145500pga.13 for ; Thu, 07 Jun 2018 11:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yGeT2z0TEJiRxrbez/GsuqB8RgVtytCBVtTQ7JK4sXk=; b=HEY9qXL0YcX2J/MicPECY+V3ZoGxJP/xLAozSfgprvI3D92IZpm8v4ObDuMESHGzaZ OjxTgmRCC9Zmem1Llyw95kbepoh7KsvzS6MNlWBfgPk1gcn0MQy3nnC1xqtu74v+l2qU IfOsjUYoY/RR7vT641Im4/kZtTR81HpVoaeEoVEV7zWiWDw7hTPmWFpWJnMZmxleJ4S6 200zJnowE8s2fQ/pcvbjKK0LyIBGS3kXaDSMq7bgvSe7/FHc2AlkWds4Sc0+au6/FVz/ CTee8j0BE4xELO9CeEUBqUnprYHSh+Vhr2+xG5OKV1IqAnydbk67U73nsuV+lod5xp26 JbMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yGeT2z0TEJiRxrbez/GsuqB8RgVtytCBVtTQ7JK4sXk=; b=sb+VoINXdXb68AmUpq1suNSSAyuje2PAI3cIrSxaZqzjoeSuwN1yc5DJEX+L+xDjrN J7Qz/3EfLIIJF6owa8VcLEa896pyiqVkkHeZHZecusx6ElTUeyoPFg+dmXkcR4vHNixN AnGl8lRQejvM8PAhZ2X5DwGjqwvdf+Eyi9ZB5YxmjsvZl3+/Okgb9Z0lK99heES1e3oB /n45TTtpr1P2PXKUobSGibS9WS9ghUHBSI38nLrGKa+tntV47KI1sIxUDI9qglD+x+mh n4DNhx+VbrC1NkCaupqnQIbYXztDudvMlylEvTJmpfvKuFxhPN103I0niAuhvtCAGR90 qUZg== X-Gm-Message-State: APt69E1pRKmIYqQsuQUGD2ZPzJ+PfE3Zk2D+zI/sCo4CzOSXKGQBYdLo gDJ7pwMXcjfZjTXxHh6K5ucFPQ== X-Received: by 2002:a62:418b:: with SMTP id g11-v6mr2801235pfd.51.1528396360716; Thu, 07 Jun 2018 11:32:40 -0700 (PDT) Received: from ndesaulniers0.svl.corp.google.com ([2620:15c:2a3:1:d33:166f:5b79:14b3]) by smtp.gmail.com with ESMTPSA id n76-v6sm6932739pfg.98.2018.06.07.11.32.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 11:32:39 -0700 (PDT) From: Nick Desaulniers To: akpm@linux-foundation.org, hpa@zytor.com, mingo@redhat.com, tglx@linutronix.de Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, virtualization@lists.linux-foundation.org, astrachan@google.com, manojgupta@google.com, ghackmann@google.com, sedat.dilek@gmail.com, tstellar@redhat.com, keescook@google.com, yamada.masahiro@socionext.com, michal.lkml@markovi.net, linux-kbuild@vger.kernel.org, geert@linux-m68k.org, will.deacon@arm.com, mawilcox@microsoft.com, arnd@arndb.de, rientjes@google.com, acme@redhat.com, pombredanne@nexb.com, aryabinin@virtuozzo.com, kstewart@linuxfoundation.org, boris.ostrovsky@oracle.com, jan.kiszka@siemens.com, rostedt@goodmis.org, kirill.shutemov@linux.intel.com, ard.biesheuvel@linaro.org, akataria@vmware.com, brijesh.singh@amd.com, caoj.fnst@cn.fujitsu.com, gregkh@linuxfoundation.org, jarkko.sakkinen@linux.intel.com, jgross@suse.com, jpoimboe@redhat.com, mka@chromium.org, ndesaulniers@google.com, thomas.lendacky@amd.com, tweek@google.com, mjg59@google.com, joe@perches.com, "H. Peter Anvin" Subject: [PATCH v3 2/3] x86/asm: add _ASM_ARG* constants for argument registers to Date: Thu, 7 Jun 2018 11:32:18 -0700 Message-Id: <20180607183219.192973-3-ndesaulniers@google.com> X-Mailer: git-send-email 2.17.1.1185.g55be947832-goog In-Reply-To: <20180607183219.192973-1-ndesaulniers@google.com> References: <20180607183219.192973-1-ndesaulniers@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "H. Peter Anvin" i386 and x86-64 uses different registers for arguments; make them available so we don't have to #ifdef in the actual code. Native size and specified size (q, l, w, b) versions are provided. Suggested-by: Sedat Dilek Signed-off-by: H. Peter Anvin Signed-off-by: Nick Desaulniers --- arch/x86/include/asm/asm.h | 59 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index 219faaec51df..990770f9e76b 100644 --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h @@ -46,6 +46,65 @@ #define _ASM_SI __ASM_REG(si) #define _ASM_DI __ASM_REG(di) +#ifndef __x86_64__ +/* 32 bit */ + +#define _ASM_ARG1 _ASM_AX +#define _ASM_ARG2 _ASM_DX +#define _ASM_ARG3 _ASM_CX + +#define _ASM_ARG1L eax +#define _ASM_ARG2L edx +#define _ASM_ARG3L ecx + +#define _ASM_ARG1W ax +#define _ASM_ARG2W dx +#define _ASM_ARG3W cx + +#define _ASM_ARG1B al +#define _ASM_ARG2B dl +#define _ASM_ARG3B cl + +#else +/* 64 bit */ + +#define _ASM_ARG1 _ASM_DI +#define _ASM_ARG2 _ASM_SI +#define _ASM_ARG3 _ASM_DX +#define _ASM_ARG4 _ASM_CX +#define _ASM_ARG5 r8 +#define _ASM_ARG6 r9 + +#define _ASM_ARG1Q rdi +#define _ASM_ARG2Q rsi +#define _ASM_ARG3Q rdx +#define _ASM_ARG4Q rcx +#define _ASM_ARG5Q r8 +#define _ASM_ARG6Q r9 + +#define _ASM_ARG1L edi +#define _ASM_ARG2L esi +#define _ASM_ARG3L edx +#define _ASM_ARG4L ecx +#define _ASM_ARG5L r8d +#define _ASM_ARG6L r9d + +#define _ASM_ARG1W di +#define _ASM_ARG2W si +#define _ASM_ARG3W dx +#define _ASM_ARG4W cx +#define _ASM_ARG5W r8w +#define _ASM_ARG6W r9w + +#define _ASM_ARG1B dil +#define _ASM_ARG2B sil +#define _ASM_ARG3B dl +#define _ASM_ARG4B cl +#define _ASM_ARG5B r8b +#define _ASM_ARG6B r9b + +#endif + /* * Macros to generate condition code outputs from inline assembly, * The output operand must be type "bool". -- 2.17.1.1185.g55be947832-goog