From nobody Wed Mar 22 15:30:32 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PhXVJ6jKwz40yL6; Wed, 22 Mar 2023 15:30:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PhXVJ2dhZz3F2x; Wed, 22 Mar 2023 15:30:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679499032; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/3k1OEjtlWhQSBh+5Z/KJtfhpdQxWwRcykpt09wgZeo=; b=WbSH3CBcaR/lzguHUyB/7gb2GKDXzXgVrHd7FJv0WbWVm6TmjGK3QYJ9GZo0povIcIO9G5 ykp+t9HXTzIQE6Ir9BxQmEQPP+T/e+N4mrUWzNcnhiqxcjWKfJtSDnHcbUg19ducucyVkP W/8iyYHJBxi6EJAkgcOSf/HFW6NV/9mEDlt0E/HQKMPaCa6bOAEUCtvDnt1Dnl5BH3SiDE PEW869HXIwvaNrTlbjCAzf+kKab/R9gHHeIcLlfi1YoUXrovgFHa737dhToyx8IvalSdEU G37arpknH8LnQCPRKLU6FGvwM9hdVIpR7s4Fwg3AWJY63ShvonAhGNXRNqWtig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679499032; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/3k1OEjtlWhQSBh+5Z/KJtfhpdQxWwRcykpt09wgZeo=; b=t4drtZYMX2su8gdQWHU5b78KP1dnqZUdMeVTBjPqOweAa4FheNrvA/dP7Sa5IiAeMbzhRL 3Js5q95hwiVw5Nd57oSOtGqBYWeFtuVuFGhZNN+L32H0qvbTKQoEZK2bb5CUkl8csssqnL Y4TdO3Nip3QmGsUdqPdz4ukVT0IEy0R45qi+N3/x6hIh41eLJMUZTIbM0Ynpvdamx6Qubl B64aVtiVP7EWlje/0280YLMixRYwQnKVePLCyPtAmlT2B3LZ0ROpqA/26q+HP4iBxUHSeJ 98DfzeqR7onVFmkno58OIJlQPRvYdlI6SJAVKqgneVDJAnktW+l4XktVwbKz2Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679499032; a=rsa-sha256; cv=none; b=SqG78ZixCv/sfh196Q9Ni+Aq2zZ/9+LDIi2bPiirbH01I5ERClbRse9x/y88Na10zsSTls WzUemoX5CiE/xqReD8fXsjnqjjsX/0BzN1gAUqdEHfgZ6RJsPze0PG+f1bMhWI2qhB3B29 Hn0MUL9qo4NaLWZSuYApTp+xvVnjcG72CUa3jCNdd85lrCL3AzAnXtvLYTqH1a2BmRN8/5 KN07JTjAZ+Z+0UnyjVPb6lUFABlnnkIcJic265nHN/V4iO4vJPNenIcv+KHvB6yIUW2Mde Ylq+QKJGjuhdS8TADnN4PgjMGkQ3yAcHZ+596ajpzl50mnJ7I13oMKZEIsbSjw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PhXVJ1ZHxzymy; Wed, 22 Mar 2023 15:30:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32MFUW8U018074; Wed, 22 Mar 2023 15:30:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32MFUWk7018073; Wed, 22 Mar 2023 15:30:32 GMT (envelope-from git) Date: Wed, 22 Mar 2023 15:30:32 GMT Message-Id: <202303221530.32MFUWk7018073@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 787bf3bcd6ee - main - arm64: Use the new PCB macros in swtch.S List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 787bf3bcd6ee0fe36b331b9342a0dd14e915a270 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=787bf3bcd6ee0fe36b331b9342a0dd14e915a270 commit 787bf3bcd6ee0fe36b331b9342a0dd14e915a270 Author: Andrew Turner AuthorDate: 2023-03-22 13:42:00 +0000 Commit: Andrew Turner CommitDate: 2023-03-22 15:08:03 +0000 arm64: Use the new PCB macros in swtch.S Rather than hard coding the location of these registers in the array use the new macros to find the correct offset. Sponsored by: Arm Ltd --- sys/arm64/arm64/genassym.c | 1 + sys/arm64/arm64/swtch.S | 48 +++++++++++++++++++++++----------------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/sys/arm64/arm64/genassym.c b/sys/arm64/arm64/genassym.c index e444d0166360..3d88835c0f8e 100644 --- a/sys/arm64/arm64/genassym.c +++ b/sys/arm64/arm64/genassym.c @@ -56,6 +56,7 @@ ASSYM(PC_SSBD, offsetof(struct pcpu, pc_ssbd)); ASSYM(PCB_SIZE, roundup2(sizeof(struct pcb), STACKALIGNBYTES + 1)); ASSYM(PCB_SINGLE_STEP_SHIFT, PCB_SINGLE_STEP_SHIFT); ASSYM(PCB_REGS, offsetof(struct pcb, pcb_x)); +ASSYM(PCB_X19, PCB_X19); ASSYM(PCB_LR, offsetof(struct pcb, pcb_lr)); ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); ASSYM(PCB_TPIDRRO, offsetof(struct pcb, pcb_tpidrro_el0)); diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S index e7114746f03b..538235d7b3e8 100644 --- a/sys/arm64/arm64/swtch.S +++ b/sys/arm64/arm64/swtch.S @@ -102,12 +102,12 @@ ENTRY(cpu_throw) msr tpidr_el0, x6 ldr x6, [x4, #PCB_TPIDRRO] msr tpidrro_el0, x6 - ldp x19, x20, [x4, #PCB_REGS + 19 * 8] - ldp x21, x22, [x4, #PCB_REGS + 21 * 8] - ldp x23, x24, [x4, #PCB_REGS + 23 * 8] - ldp x25, x26, [x4, #PCB_REGS + 25 * 8] - ldp x27, x28, [x4, #PCB_REGS + 27 * 8] - ldp x29, lr, [x4, #PCB_REGS + 29 * 8] + ldp x19, x20, [x4, #PCB_REGS + (PCB_X19 + 0) * 8] + ldp x21, x22, [x4, #PCB_REGS + (PCB_X19 + 2) * 8] + ldp x23, x24, [x4, #PCB_REGS + (PCB_X19 + 4) * 8] + ldp x25, x26, [x4, #PCB_REGS + (PCB_X19 + 6) * 8] + ldp x27, x28, [x4, #PCB_REGS + (PCB_X19 + 8) * 8] + ldp x29, lr, [x4, #PCB_REGS + (PCB_X19 + 10) * 8] ret END(cpu_throw) @@ -127,12 +127,12 @@ ENTRY(cpu_switch) ldr x4, [x0, #TD_PCB] /* Store the callee-saved registers */ - stp x19, x20, [x4, #PCB_REGS + 19 * 8] - stp x21, x22, [x4, #PCB_REGS + 21 * 8] - stp x23, x24, [x4, #PCB_REGS + 23 * 8] - stp x25, x26, [x4, #PCB_REGS + 25 * 8] - stp x27, x28, [x4, #PCB_REGS + 27 * 8] - stp x29, lr, [x4, #PCB_REGS + 29 * 8] + stp x19, x20, [x4, #PCB_REGS + (PCB_X19 + 0) * 8] + stp x21, x22, [x4, #PCB_REGS + (PCB_X19 + 2) * 8] + stp x23, x24, [x4, #PCB_REGS + (PCB_X19 + 4) * 8] + stp x25, x26, [x4, #PCB_REGS + (PCB_X19 + 6) * 8] + stp x27, x28, [x4, #PCB_REGS + (PCB_X19 + 8) * 8] + stp x29, lr, [x4, #PCB_REGS + (PCB_X19 + 10) * 8] /* And the old stack pointer */ mov x5, sp mrs x6, tpidrro_el0 @@ -196,12 +196,12 @@ ENTRY(cpu_switch) msr tpidr_el0, x6 ldr x6, [x4, #PCB_TPIDRRO] msr tpidrro_el0, x6 - ldp x19, x20, [x4, #PCB_REGS + 19 * 8] - ldp x21, x22, [x4, #PCB_REGS + 21 * 8] - ldp x23, x24, [x4, #PCB_REGS + 23 * 8] - ldp x25, x26, [x4, #PCB_REGS + 25 * 8] - ldp x27, x28, [x4, #PCB_REGS + 27 * 8] - ldp x29, lr, [x4, #PCB_REGS + 29 * 8] + ldp x19, x20, [x4, #PCB_REGS + (PCB_X19 + 0) * 8] + ldp x21, x22, [x4, #PCB_REGS + (PCB_X19 + 2) * 8] + ldp x23, x24, [x4, #PCB_REGS + (PCB_X19 + 4) * 8] + ldp x25, x26, [x4, #PCB_REGS + (PCB_X19 + 6) * 8] + ldp x27, x28, [x4, #PCB_REGS + (PCB_X19 + 8) * 8] + ldp x29, lr, [x4, #PCB_REGS + (PCB_X19 + 10) * 8] str xzr, [x4, #PCB_REGS + 18 * 8] ret @@ -258,12 +258,12 @@ END(fork_trampoline) ENTRY(savectx) /* Store the callee-saved registers */ - stp x19, x20, [x0, #PCB_REGS + 19 * 8] - stp x21, x22, [x0, #PCB_REGS + 21 * 8] - stp x23, x24, [x0, #PCB_REGS + 23 * 8] - stp x25, x26, [x0, #PCB_REGS + 25 * 8] - stp x27, x28, [x0, #PCB_REGS + 27 * 8] - stp x29, lr, [x0, #PCB_REGS + 29 * 8] + stp x19, x20, [x0, #PCB_REGS + (PCB_X19 + 0) * 8] + stp x21, x22, [x0, #PCB_REGS + (PCB_X19 + 2) * 8] + stp x23, x24, [x0, #PCB_REGS + (PCB_X19 + 4) * 8] + stp x25, x26, [x0, #PCB_REGS + (PCB_X19 + 6) * 8] + stp x27, x28, [x0, #PCB_REGS + (PCB_X19 + 8) * 8] + stp x29, lr, [x0, #PCB_REGS + (PCB_X19 + 10) * 8] /* And the old stack pointer */ mov x5, sp mrs x6, tpidrro_el0