Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp61762imm; Thu, 7 Jun 2018 13:51:13 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJcTqCM/l89Z3ImjJyvEeH77hWLgwmvQLot77sxaU64OLJNb9C7lAeftSITHZ6D6CnLig8o X-Received: by 2002:a62:6e01:: with SMTP id j1-v6mr3135769pfc.93.1528404673493; Thu, 07 Jun 2018 13:51:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528404673; cv=none; d=google.com; s=arc-20160816; b=q+dGW8uSyh3MHZyQMERPN0gtbd4W2UYobyi01+Mg0gHbwYsat7blcHDftVPmwec2BE Zto3VxHRwxsfJgx5GTaJtMOLv/drOZBO5YLOQhdTFlrb7bbdmGb95ZHR7tmjF+H0e6Hn khncOKp9MaIZovkfNhddPYbeXDHI9GtKko7JL9qIpsrgNs3ADv9Vu66rQtgh4VweNxjx kjONhhRmpBBbUWSAN3Ij/+gDnefbuhWxyj/I8tTsiyvn6zBTU+gSMcibxBJ3KyoOwQOe JkJ27y3zoifZxIkzyq5fzd5MIzhnG9k4++k7es+gwMxHFScoV7qZk3HbcxZ5K0TxQ5IE XVdA== 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=0QOO7FavaAytWSAS7rwoKosy5QDN0IX+EqKWlBzIWInsz5qnhgfqm4leSFAHph59JB GylWUsmERBN3wSugOQJ3UKCMOybDxpNO3fRbrYg8b045n9kmgukFTkeRTpTM2k47B7Jd 2r0BNDK93DIhvxB0h5a9PRWAV+eGe+NYb2KA5p8uy2RQot71lqp1QnYd98/1Z9yzo3Sq nlH4zSriPWbLgXPpqiJgwyqLWIaZTXyYT18Mu25edR1x5xC8HBsm2JSZQZk9Zs5Vqdkn rgPEsTFTlzwXWAJBf1OwJKzA1JAp1DZQWAGGW1msaoclH2+WwZduBOXEBSXMJCApoDYj vieA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=q0yLiq4U; 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 c6-v6si12828732plr.398.2018.06.07.13.50.59; Thu, 07 Jun 2018 13:51:13 -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=q0yLiq4U; 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 S932682AbeFGUuR (ORCPT + 99 others); Thu, 7 Jun 2018 16:50:17 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:33519 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932634AbeFGUuO (ORCPT ); Thu, 7 Jun 2018 16:50:14 -0400 Received: by mail-pg0-f68.google.com with SMTP id e11-v6so5321182pgq.0 for ; Thu, 07 Jun 2018 13:50:13 -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=q0yLiq4UUXYjLhkgo6Khtd2rSzXGgII69YbUgaORklAWxE1ORMmkM+/cNn/mvyOJB2 SZtG10NYmCRUow/xNTFu+uZwPnN/MEXeFkdc4Zwi6lrAONCqHbm0+KuVpblvfhPXw76r za6oR1DMVmnPFkiLHT+RD6+ksZkcBOy98ZfVo8RlzsTzrv0/fF78qBWlDgK7ooWL5zf8 QEo36NWOTXEPEoeslLoEjGbdtKgE4p95fceNfuw5zunvWgDmYNHi72HXRRrUJ3jHnywC VZgc2ZlNpxsSVbwcEa43FmNnui6vyW/RnTch2QENEn0LWtrgoudGWNaE31AE7MoIYEjE yKDw== 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=XrQkq1RR8vW7nOvR073jzFFL583nBKpEwXvtvuimYX1xzccIs+8OUUHvHRAXFMY7RB DiiKMCSO2W47IXRw3ZEW0RcGYP7f4c+NtEDDrzRTu6C87Ata2on1c4+iNaDmBL11sCvn VYL+Nn2QEDoSbiQkCPJQMcNN95+UfFqa50VJFI6zmpqrfmnGMo7Rd3SBP2nEXHgo8dNU YY/blP8+x61XBRLYB9RyoxaC8zm5zngLBwGZ+kvbdEiwlgpkRiSacWAGW3wnLNqRKiuC BD/Jgcp3zEZKBtaicIX2jHS5BzjkJ2t5FS1lhlrfJRd2eKL8uxr135HNbwHgkGJbBgh+ SbOg== X-Gm-Message-State: APt69E22rU/abODdNEFnxPcb+Z/7zvXINAXW7s3m+/4E28gaWvJS1S7G YSZ1zINvsZzvSjWJESFON8QIoQ== X-Received: by 2002:a62:32c6:: with SMTP id y189-v6mr3123267pfy.241.1528404612809; Thu, 07 Jun 2018 13:50:12 -0700 (PDT) Received: from ndesaulniers0.svl.corp.google.com ([2620:15c:2a3:1:d33:166f:5b79:14b3]) by smtp.gmail.com with ESMTPSA id w18-v6sm3780460pgq.1.2018.06.07.13.50.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 13:50:12 -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 v4 2/3] x86/asm: add _ASM_ARG* constants for argument registers to Date: Thu, 7 Jun 2018 13:49:26 -0700 Message-Id: <20180607204927.219329-3-ndesaulniers@google.com> X-Mailer: git-send-email 2.17.1.1185.g55be947832-goog In-Reply-To: <20180607204927.219329-1-ndesaulniers@google.com> References: <20180607204927.219329-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