[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b12039ce-99da-41e9-ba2f-dc0e0c62f140@csgroup.eu>
Date: Tue, 28 Jan 2025 17:00:31 +0100
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: "Dmitry V. Levin" <ldv@...ace.io>
Cc: Michael Ellerman <mpe@...erman.id.au>, Alexey Gladkov
<legion@...nel.org>, Eugene Syromyatnikov <evgsyr@...il.com>,
Oleg Nesterov <oleg@...hat.com>, Madhavan Srinivasan <maddy@...ux.ibm.com>,
Nicholas Piggin <npiggin@...il.com>, Naveen N Rao <naveen@...nel.org>,
linuxppc-dev@...ts.ozlabs.org, strace-devel@...ts.strace.io,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] powerpc: properly negate error in
syscall_set_return_value() in sc case
Le 28/01/2025 à 16:52, Dmitry V. Levin a écrit :
> On Tue, Jan 28, 2025 at 03:59:29PM +0100, Christophe Leroy wrote:
>> Le 27/01/2025 à 19:13, Dmitry V. Levin a écrit :
>>> According to the Power Architecture Linux system call ABI documented in
>>> [1], when the syscall is made with the sc instruction, both a value and an
>>> error condition are returned, where r3 register contains the return value,
>>> and cr0.SO bit specifies the error condition. When cr0.SO is clear, the
>>> syscall succeeded and r3 is the return value. When cr0.SO is set, the
>>> syscall failed and r3 is the error value. This syscall return semantics
>>> was implemented from the very beginning of Power Architecture on Linux,
>>> and syscall tracers and debuggers like strace that read or modify syscall
>>> return information also rely on this ABI.
>>
>> I see a quite similar ABI on microblaze, mips, nios2 and sparc. Do they
>> behave all the same ?
>
> Yes, also on alpha. I don't think microblaze should be in this list,
> though.
Microblaze has
static inline void syscall_set_return_value(struct task_struct *task,
struct pt_regs *regs,
int error, long val)
{
if (error)
regs->r3 = -error;
else
regs->r3 = val;
}
So it has a positive error setting allthough it has no flag to tell it
is an error. Wondering how it works at the end.
Alpha I'm not sure, I see nothing obvious in include/asm/ptrace.h or
include/asm/syscall.h
Powered by blists - more mailing lists