[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: |
Sergey Bugaev |
Subject: |
Re: [PATCH 5/5] x86_64: add 64-bit syscall entry point |
Date: |
Tue, 28 Feb 2023 17:14:05 +0300 |
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]) -- unlike on Linux?
Or in other words: do I understand it right that the ABI here is:
- syscall number in rax
- arguments are passed just as per x86_64 calling convention, except
the 4th arg is in r10 and not rcx
- return value is in rax
- rcx and r11 are additionally clobbered -- or not?
- nothing else is clobbered, in particular not rflags (or is the
"reserved" half of rflags clobbered?) and not the registers that
contain args
Sergey
- [PATCH 3/5] fix port name copyin, (continued)
- [PATCH 3/5] fix port name copyin, Luca Dariz, 2023/02/27
- [PATCH 1/5] x86_64: allow compilation if ! USER32, Luca Dariz, 2023/02/27
- [PATCH 2/5] fix copyin/outmsg header for ! USER32, Luca Dariz, 2023/02/27
- [PATCH 5/5] x86_64: add 64-bit syscall entry point, Luca Dariz, 2023/02/27
- Re: [PATCH 5/5] x86_64: add 64-bit syscall entry point, Samuel Thibault, 2023/02/27
- Re: [PATCH 5/5] x86_64: add 64-bit syscall entry point, Luca Dariz, 2023/02/28
- Re: [PATCH 5/5] x86_64: add 64-bit syscall entry point, Samuel Thibault, 2023/02/28
- Re: [PATCH 5/5] x86_64: add 64-bit syscall entry point,
Sergey Bugaev <=
- Re: [PATCH 5/5] x86_64: add 64-bit syscall entry point, Samuel Thibault, 2023/02/28
- Re: [PATCH 5/5] x86_64: add 64-bit syscall entry point, Sergey Bugaev, 2023/02/28
- Re: [PATCH 5/5] x86_64: add 64-bit syscall entry point, Samuel Thibault, 2023/02/28
- Re: [PATCH 5/5] x86_64: add 64-bit syscall entry point, Sergey Bugaev, 2023/02/28
Re: [PATCH 5/5] x86_64: add 64-bit syscall entry point, Sergey Bugaev, 2023/02/28
Re: [PATCH 0/5] basic syscall support on x86_64, Samuel Thibault, 2023/02/27