public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: John David Anglin <danglin@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-9427] Generate illegal instruction fault if LWS syscall returns -EFAULT. Date: Sun, 2 Jan 2022 17:14:12 +0000 (GMT) [thread overview] Message-ID: <20220102171412.2E1F53858C27@sourceware.org> (raw) https://gcc.gnu.org/g:2c8e273ed11c31fc28784ddd0a8263080f43ba7b commit r11-9427-g2c8e273ed11c31fc28784ddd0a8263080f43ba7b Author: John David Anglin <danglin@gcc.gnu.org> Date: Sun Jan 2 17:13:45 2022 +0000 Generate illegal instruction fault if LWS syscall returns -EFAULT. 2022-01-02 John David Anglin <danglin@gcc.gnu.org> libgcc/ChangeLog: * config/pa/linux-atomic.c (_ASM_EFAULT): Define. (__kernel_cmpxchg): Nullify illegal iitlbp instruction if error return is not equal _ASM_EFAULT. (__kernel_cmpxchg2): Likewise. Diff: --- libgcc/config/pa/linux-atomic.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libgcc/config/pa/linux-atomic.c b/libgcc/config/pa/linux-atomic.c index 500a3652499..e4d74b2d598 100644 --- a/libgcc/config/pa/linux-atomic.c +++ b/libgcc/config/pa/linux-atomic.c @@ -28,6 +28,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define EBUSY 16 #define ENOSYS 251 +#define _ASM_EFAULT "-14" + typedef unsigned char u8; typedef short unsigned int u16; #ifdef __LP64__ @@ -58,6 +60,8 @@ __kernel_cmpxchg (volatile void *mem, int oldval, int newval) register long lws_errno asm("r21"); asm volatile ( "ble 0xb0(%%sr2, %%r0) \n\t" "ldi %2, %%r20 \n\t" + "cmpiclr,<> " _ASM_EFAULT ", %%r21, %%r0\n\t" + "iitlbp %%r0,(%%sr0, %%r0) \n\t" : "=r" (lws_ret), "=r" (lws_errno) : "i" (LWS_CAS), "r" (lws_mem), "r" (lws_old), "r" (lws_new) : "r1", "r20", "r22", "r23", "r29", "r31", "memory" @@ -84,6 +88,8 @@ __kernel_cmpxchg2 (volatile void *mem, const void *oldval, const void *newval, register long lws_errno asm("r21"); asm volatile ( "ble 0xb0(%%sr2, %%r0) \n\t" "ldi %6, %%r20 \n\t" + "cmpiclr,<> " _ASM_EFAULT ", %%r21, %%r0\n\t" + "iitlbp %%r0,(%%sr0, %%r0) \n\t" : "=r" (lws_ret), "=r" (lws_errno), "+r" (lws_mem), "+r" (lws_old), "+r" (lws_new), "+r" (lws_size) : "i" (2)
reply other threads:[~2022-01-02 17:14 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220102171412.2E1F53858C27@sourceware.org \ --to=danglin@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).