Re: Linux powerpc new system call instruction and ABI

2021-05-24 Thread Matheus Castanho
Matheus Castanho writes: > Dmitry V. Levin writes: > >> On Fri, May 21, 2021 at 05:00:36PM -0300, Matheus Castanho wrote: >>> Florian Weimer writes: >>> > * Matheus Castanho via Libc-alpha: >>> >> From: Nicholas Piggin >>> >> Subject: [PATCH 1/1] powerpc: Fix handling of scv return error

Re: Linux powerpc new system call instruction and ABI

2021-05-24 Thread Matheus Castanho
Dmitry V. Levin writes: > On Fri, May 21, 2021 at 05:00:36PM -0300, Matheus Castanho wrote: >> Florian Weimer writes: >> > * Matheus Castanho via Libc-alpha: >> >> From: Nicholas Piggin >> >> Subject: [PATCH 1/1] powerpc: Fix handling of scv return error codes >> >> >> >> When using scv on

Re: Linux powerpc new system call instruction and ABI

2021-05-21 Thread Dmitry V. Levin
On Fri, May 21, 2021 at 05:00:36PM -0300, Matheus Castanho wrote: > Florian Weimer writes: > > * Matheus Castanho via Libc-alpha: > >> From: Nicholas Piggin > >> Subject: [PATCH 1/1] powerpc: Fix handling of scv return error codes > >> > >> When using scv on templated ASM syscalls, current code

Re: Linux powerpc new system call instruction and ABI

2021-05-21 Thread Matheus Castanho
Florian Weimer writes: > * Matheus Castanho via Libc-alpha: > >> From: Nicholas Piggin >> Subject: [PATCH 1/1] powerpc: Fix handling of scv return error codes >> >> When using scv on templated ASM syscalls, current code interprets any >> negative return value as error, but the only valid

Re: Linux powerpc new system call instruction and ABI

2021-05-21 Thread Florian Weimer
* Matheus Castanho via Libc-alpha: > From: Nicholas Piggin > Subject: [PATCH 1/1] powerpc: Fix handling of scv return error codes > > When using scv on templated ASM syscalls, current code interprets any > negative return value as error, but the only valid error codes are in > the range

Re: Linux powerpc new system call instruction and ABI

2021-05-21 Thread Matheus Castanho
Nicholas Piggin writes: > Excerpts from Nicholas Piggin's message of May 19, 2021 12:50 pm: >> Excerpts from Dmitry V. Levin's message of May 19, 2021 9:13 am: >>> Hi, >>> >>> On Thu, Jun 11, 2020 at 06:12:01PM +1000, Nicholas Piggin wrote: >>> [...] - Error handling: The consensus among

Re: Linux powerpc new system call instruction and ABI

2021-05-20 Thread Nicholas Piggin
Excerpts from Dmitry V. Levin's message of May 20, 2021 12:59 pm: > On Thu, May 20, 2021 at 12:45:57PM +1000, Nicholas Piggin wrote: >> Excerpts from Dmitry V. Levin's message of May 20, 2021 11:06 am: >> > On Wed, May 19, 2021 at 07:48:47PM -0400, Rich Felker wrote: >> >> On Wed, May 19, 2021 at

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Nicholas Piggin
Excerpts from Dmitry V. Levin's message of May 20, 2021 1:06 pm: > On Thu, May 20, 2021 at 12:40:36PM +1000, Nicholas Piggin wrote: > [...] >> > Looks like struct pt_regs.trap already contains the information that could >> > be used to tell 'sc' from 'scv': if (pt_regs.trap & ~0xf) == 0x3000, then

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Dmitry V. Levin
On Thu, May 20, 2021 at 12:40:36PM +1000, Nicholas Piggin wrote: [...] > > Looks like struct pt_regs.trap already contains the information that could > > be used to tell 'sc' from 'scv': if (pt_regs.trap & ~0xf) == 0x3000, then > > it's scv. Is my reading of arch/powerpc/include/asm/ptrace.h

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Dmitry V. Levin
On Thu, May 20, 2021 at 12:45:57PM +1000, Nicholas Piggin wrote: > Excerpts from Dmitry V. Levin's message of May 20, 2021 11:06 am: > > On Wed, May 19, 2021 at 07:48:47PM -0400, Rich Felker wrote: > >> On Wed, May 19, 2021 at 06:09:25PM +, Joakim Tjernlund wrote: > > [...] > >> > W.r.t

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Nicholas Piggin
Excerpts from Dmitry V. Levin's message of May 20, 2021 11:06 am: > On Wed, May 19, 2021 at 07:48:47PM -0400, Rich Felker wrote: >> On Wed, May 19, 2021 at 06:09:25PM +, Joakim Tjernlund wrote: > [...] >> > W.r.t breaking ABI, isn't that what PowerPC is trying to do with the new >> > syscall

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Nicholas Piggin
Excerpts from Dmitry V. Levin's message of May 20, 2021 9:27 am: > On Thu, May 20, 2021 at 08:51:53AM +1000, Nicholas Piggin wrote: >> Excerpts from Dmitry V. Levin's message of May 19, 2021 11:26 pm: >> > On Wed, May 19, 2021 at 08:59:05PM +1000, Nicholas Piggin wrote: >> >> Excerpts from Dmitry

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Dmitry V. Levin
On Wed, May 19, 2021 at 07:48:47PM -0400, Rich Felker wrote: > On Wed, May 19, 2021 at 06:09:25PM +, Joakim Tjernlund wrote: [...] > > W.r.t breaking ABI, isn't that what PowerPC is trying to do with the new > > syscall I/F? > > No, it's a new independent interface. Unfortunately, being a

Re: [musl] Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Rich Felker
On Wed, May 19, 2021 at 06:09:25PM +, Joakim Tjernlund wrote: > On Wed, 2021-05-19 at 10:22 -0500, Segher Boessenkool wrote: > > On Wed, May 19, 2021 at 03:06:49PM +, Joakim Tjernlund wrote: > > > On Wed, 2021-05-19 at 09:38 -0500, Segher Boessenkool wrote: > > > > On Wed, May 19, 2021 at

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Dmitry V. Levin
On Thu, May 20, 2021 at 08:51:53AM +1000, Nicholas Piggin wrote: > Excerpts from Dmitry V. Levin's message of May 19, 2021 11:26 pm: > > On Wed, May 19, 2021 at 08:59:05PM +1000, Nicholas Piggin wrote: > >> Excerpts from Dmitry V. Levin's message of May 19, 2021 8:24 pm: > >> > On Wed, May 19,

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Nicholas Piggin
Excerpts from Dmitry V. Levin's message of May 19, 2021 11:26 pm: > On Wed, May 19, 2021 at 08:59:05PM +1000, Nicholas Piggin wrote: >> Excerpts from Dmitry V. Levin's message of May 19, 2021 8:24 pm: >> > On Wed, May 19, 2021 at 12:50:24PM +1000, Nicholas Piggin wrote: >> > [...] >> >> With this

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Joakim Tjernlund
On Wed, 2021-05-19 at 10:22 -0500, Segher Boessenkool wrote: > On Wed, May 19, 2021 at 03:06:49PM +, Joakim Tjernlund wrote: > > On Wed, 2021-05-19 at 09:38 -0500, Segher Boessenkool wrote: > > > On Wed, May 19, 2021 at 06:42:40PM +1000, Nicholas Piggin wrote: > > > > Excerpts from Joakim

Re: [musl] Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Rich Felker
On Wed, May 19, 2021 at 10:22:05AM -0500, Segher Boessenkool wrote: > On Wed, May 19, 2021 at 03:06:49PM +, Joakim Tjernlund wrote: > > On Wed, 2021-05-19 at 09:38 -0500, Segher Boessenkool wrote: > > > On Wed, May 19, 2021 at 06:42:40PM +1000, Nicholas Piggin wrote: > > > > Excerpts from

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Segher Boessenkool
On Wed, May 19, 2021 at 03:06:49PM +, Joakim Tjernlund wrote: > On Wed, 2021-05-19 at 09:38 -0500, Segher Boessenkool wrote: > > On Wed, May 19, 2021 at 06:42:40PM +1000, Nicholas Piggin wrote: > > > Excerpts from Joakim Tjernlund's message of May 19, 2021 6:08 pm: > > > > I always figured the

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Joakim Tjernlund
On Wed, 2021-05-19 at 09:38 -0500, Segher Boessenkool wrote: > On Wed, May 19, 2021 at 06:42:40PM +1000, Nicholas Piggin wrote: > > Excerpts from Joakim Tjernlund's message of May 19, 2021 6:08 pm: > > > I always figured the ppc way was superior. It begs the question if not > > > the other archs

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Segher Boessenkool
On Wed, May 19, 2021 at 06:42:40PM +1000, Nicholas Piggin wrote: > Excerpts from Joakim Tjernlund's message of May 19, 2021 6:08 pm: > > I always figured the ppc way was superior. It begs the question if not the > > other archs should > > change instead? > > It is superior in some ways, not

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Dmitry V. Levin
On Wed, May 19, 2021 at 08:59:05PM +1000, Nicholas Piggin wrote: > Excerpts from Dmitry V. Levin's message of May 19, 2021 8:24 pm: > > On Wed, May 19, 2021 at 12:50:24PM +1000, Nicholas Piggin wrote: > > [...] > >> With this patch, I think the ptrace ABI should mostly be fixed. I think > >> a

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Tulio Magno Quites Machado Filho
Nicholas Piggin via Libc-alpha writes: > As a more hacky thing you could make a syscall with -1 and see how > the error looks, and then assume all syscalls will be the same. I'm not sure this would work. Even in glibc, it's expected that early syscalls will use sc while scv is used later in the

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Nicholas Piggin
Excerpts from Nicholas Piggin's message of May 19, 2021 6:42 pm: > Excerpts from Joakim Tjernlund's message of May 19, 2021 6:08 pm: >> On Wed, 2021-05-19 at 17:55 +1000, Nicholas Piggin wrote: >>> Excerpts from Joakim Tjernlund's message of May 19, 2021 5:33 pm: >>> > On Wed, 2021-05-19 at 02:13

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Nicholas Piggin
Excerpts from Dmitry V. Levin's message of May 19, 2021 8:24 pm: > On Wed, May 19, 2021 at 12:50:24PM +1000, Nicholas Piggin wrote: > [...] >> With this patch, I think the ptrace ABI should mostly be fixed. I think >> a problem remains with applications that look at system call return >>

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Dmitry V. Levin
On Wed, May 19, 2021 at 12:50:24PM +1000, Nicholas Piggin wrote: [...] > With this patch, I think the ptrace ABI should mostly be fixed. I think > a problem remains with applications that look at system call return > registers directly and have powerpc specific error cases. Those probably > will

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Nicholas Piggin
Excerpts from Joakim Tjernlund's message of May 19, 2021 6:08 pm: > On Wed, 2021-05-19 at 17:55 +1000, Nicholas Piggin wrote: >> Excerpts from Joakim Tjernlund's message of May 19, 2021 5:33 pm: >> > On Wed, 2021-05-19 at 02:13 +0300, Dmitry V. Levin wrote: >> > > Hi, >> > > >> > > On Thu, Jun

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Joakim Tjernlund
On Wed, 2021-05-19 at 17:55 +1000, Nicholas Piggin wrote: > Excerpts from Joakim Tjernlund's message of May 19, 2021 5:33 pm: > > On Wed, 2021-05-19 at 02:13 +0300, Dmitry V. Levin wrote: > > > Hi, > > > > > > On Thu, Jun 11, 2020 at 06:12:01PM +1000, Nicholas Piggin wrote: > > > [...] > > > > -

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Nicholas Piggin
Excerpts from Joakim Tjernlund's message of May 19, 2021 5:33 pm: > On Wed, 2021-05-19 at 02:13 +0300, Dmitry V. Levin wrote: >> Hi, >> >> On Thu, Jun 11, 2020 at 06:12:01PM +1000, Nicholas Piggin wrote: >> [...] >> > - Error handling: The consensus among kernel, glibc, and musl is to move to >>

Re: Linux powerpc new system call instruction and ABI

2021-05-19 Thread Joakim Tjernlund
On Wed, 2021-05-19 at 02:13 +0300, Dmitry V. Levin wrote: > Hi, > > On Thu, Jun 11, 2020 at 06:12:01PM +1000, Nicholas Piggin wrote: > [...] > > - Error handling: The consensus among kernel, glibc, and musl is to move to > >   using negative return values in r3 rather than CR0[SO]=1 to indicate

Re: Linux powerpc new system call instruction and ABI

2021-05-18 Thread Nicholas Piggin
Excerpts from Nicholas Piggin's message of May 19, 2021 12:50 pm: > Excerpts from Dmitry V. Levin's message of May 19, 2021 9:13 am: >> Hi, >> >> On Thu, Jun 11, 2020 at 06:12:01PM +1000, Nicholas Piggin wrote: >> [...] >>> - Error handling: The consensus among kernel, glibc, and musl is to move

Re: Linux powerpc new system call instruction and ABI

2021-05-18 Thread Nicholas Piggin
Excerpts from Dmitry V. Levin's message of May 19, 2021 9:13 am: > Hi, > > On Thu, Jun 11, 2020 at 06:12:01PM +1000, Nicholas Piggin wrote: > [...] >> - Error handling: The consensus among kernel, glibc, and musl is to move to >> using negative return values in r3 rather than CR0[SO]=1 to

Re: Linux powerpc new system call instruction and ABI

2021-05-18 Thread Dmitry V. Levin
Hi, On Thu, Jun 11, 2020 at 06:12:01PM +1000, Nicholas Piggin wrote: [...] > - Error handling: The consensus among kernel, glibc, and musl is to move to > using negative return values in r3 rather than CR0[SO]=1 to indicate error, > which matches most other architectures, and is closer to a

Re: Linux powerpc new system call instruction and ABI

2020-06-14 Thread Nicholas Piggin
Excerpts from Segher Boessenkool's message of June 12, 2020 7:02 am: > Hi! > > On Thu, Jun 11, 2020 at 06:12:01PM +1000, Nicholas Piggin wrote: >> Calling convention >> -- >> The proposal is for scv 0 to provide the standard Linux system call ABI >> with the following differences

Re: Linux powerpc new system call instruction and ABI

2020-06-11 Thread Segher Boessenkool
Hi! On Thu, Jun 11, 2020 at 06:12:01PM +1000, Nicholas Piggin wrote: > Calling convention > -- > The proposal is for scv 0 to provide the standard Linux system call ABI > with the following differences from sc convention[1]: > > - lr is to be volatile across scv calls. This is