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 <l...@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