On 11/08/2013 09:12 AM, Steve Capper wrote:> + > +/* > + * x19-x28 are callee saved, also save fp, lr, sp. > + * d8-d15 are also callee saved. > + */ > + > +struct __jmp_buf { > + uint64_t __gregs[13]; > + uint64_t __fpregs[8]; > +}; > +Since the index of these arrays have no connection with what is stored in them, they should be named fields in the structure, not an array. Do we need the fpregs saved even though klibc doesn't do fp?> diff --git a/usr/klibc/arch/arm64/pipe.c b/usr/klibc/arch/arm64/pipe.c > new file mode 100644 > index 0000000..f10a69e > --- /dev/null > +++ b/usr/klibc/arch/arm64/pipe.c > @@ -0,0 +1,10 @@ > +#include <unistd.h> > + > +#ifndef __NR_pipe > + > +int pipe(int pipefd[2]) > +{ > + return pipe2(pipefd, 0); > +} > + > +#endif /* __NR_pipe */This is a generic routine, right? It should be part of the generic ersatz functions, no? -hpa
On Fri, Nov 08, 2013 at 09:24:06AM -0800, H. Peter Anvin wrote:> On 11/08/2013 09:12 AM, Steve Capper wrote: > > + > > +/* > > + * x19-x28 are callee saved, also save fp, lr, sp. > > + * d8-d15 are also callee saved. > > + */ > > + > > +struct __jmp_buf { > > + uint64_t __gregs[13]; > > + uint64_t __fpregs[8]; > > +}; > > + > > Since the index of these arrays have no connection with what is stored > in them, they should be named fields in the structure, not an array. > > Do we need the fpregs saved even though klibc doesn't do fp? >I agree about the named struct, it looks a lot nicer, thanks. For gcc targetting Aarch64, We can only guarantee that d8-d15 are left alone when -mgeneral-regs-only is supplied for building klibc and any software linked against klibc. I would much prefer to save/restore d8-d15 to avoid potential future headaches.> > diff --git a/usr/klibc/arch/arm64/pipe.c b/usr/klibc/arch/arm64/pipe.c > > new file mode 100644 > > index 0000000..f10a69e > > --- /dev/null > > +++ b/usr/klibc/arch/arm64/pipe.c > > @@ -0,0 +1,10 @@ > > +#include <unistd.h> > > + > > +#ifndef __NR_pipe > > + > > +int pipe(int pipefd[2]) > > +{ > > + return pipe2(pipefd, 0); > > +} > > + > > +#endif /* __NR_pipe */ > > This is a generic routine, right? It should be part of the generic > ersatz functions, no?Thanks, I've moved pipe to the generic set. Cheers, -- Steve
Steve Capper dixit:>> Do we need the fpregs saved even though klibc doesn't do fp?>For gcc targetting Aarch64, We can only guarantee that d8-d15 are >left alone when -mgeneral-regs-only is supplied for building klibc >and any software linked against klibc. I would much prefer toWe can enforce this in klcc, just like -mregparm=3 is used by the i386 target. bye, //mirabilos -- ?Cool, /usr/share/doc/mksh/examples/uhr.gz ist ja ein Grund, mksh auf jedem System zu installieren.? -- XTaran auf der OpenRheinRuhr, ganz begeistert (EN: ?[?]uhr.gz is a reason to install mksh on every system.?)