bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 5/5] x86_64: add 64-bit syscall entry point


From: Samuel Thibault
Subject: Re: [PATCH 5/5] x86_64: add 64-bit syscall entry point
Date: Tue, 28 Feb 2023 15:38:43 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Sergey Bugaev, le mar. 28 févr. 2023 17:14:05 +0300, a ecrit:
> On Tue, Feb 28, 2023 at 4:26 PM Luca Dariz <luca@orpolo.org> wrote:
> > >> +    /* check if we need to place some arguments on the stack */
> > >> +_syscall64_args_stack:
> > >> +    mov     EXT(mach_trap_table)(%rax),%r10 /* get number of arguments 
> > >> */
> > >> +    subq    $6,%r10                 /* the first 6 args are already in 
> > >> place */
> > >> +    jl      _syscall64_call         /* skip argument copy if >6 args */
> > >
> > > jle?
> >
> > Right, I didn't test a 6-args syscall.
> >
> > >> +
> > >> +    movq    R_UESP(%rbx),%r11       /* get user stack pointer */
> > >> +    addq    $8,%r11                 /* Skip user return address */
> > >> +
> > >> +    mov     $USER_DS,%r12           /* use user data segment for 
> > >> accesses */
> > >> +    mov     %r12,%fs
> > >> +
> > >> +    lea     (%r11,%r10,8),%r11      /* point past last argument */
> 
> Do I understand it right that for the most interesting syscall (which
> takes 7 args!), I *am* supposed to pass the 7th arg on the stack (in
> mem[rsp + 8])

That's the x86_64 ABI, yes.

> -- unlike on Linux?

? Linux does put only 6 args in registers, too.

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]