Date: Tue, 23 Apr 2002 18:30:58 -0400 (EDT) From: Kenneth Culver <culverk@alpha.yumyumyum.org> To: Andrew Gallatin <gallatin@cs.duke.edu> Cc: freebsd-hackers@freebsd.org, <freebsd-current@freebsd.org> Subject: Re: implementing linux mmap2 syscall Message-ID: <20020423181748.W31638-100000@alpha.yumyumyum.org> In-Reply-To: <15557.27747.802212.659760@grasshopper.cs.duke.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
> Kenneth Culver writes:
> > OK, I found another problem, here it is:
> >
> > static void
> > linux_prepsyscall(struct trapframe *tf, int *args, u_int *code, caddr_t
> > *params)
> > {
> > args[0] = tf->tf_ebx;
> > args[1] = tf->tf_ecx;
> > args[2] = tf->tf_edx;
> > args[3] = tf->tf_esi;
> > args[4] = tf->tf_edi;
> > *params = NULL; /* no copyin */
> > }
> >
> > Basically, linux_mmap2 takes 6 args, and this looks here like only 5 args are
> > making it in... I checked this because the sixth argument to linux_mmap2() in
> > truss was showing 0x6, but when I printed out that arg from the kernel, it
> > was showing 0x0. Am I correct here?
> >
> > Ken
>
> Yes. According to http://john.fremlin.de/linux/asm/, linux used to
> parse only 5 args but now it parses six. Try adding:
> args[5] = tf->tf_ebp;
>
> Drew
>
>
OK, I THINK I found what calls the actual kernel syscall handler, and
sets it's args first, but I'm not sure:
from linux_locore.s
NON_GPROF_ENTRY(linux_sigcode)
call *LINUX_SIGF_HANDLER(%esp)
leal LINUX_SIGF_SC(%esp),%ebx /* linux scp */
movl LINUX_SC_GS(%ebx),%gs
movl %esp, %ebx /* pass sigframe */
push %eax /* fake ret addr */
movl $LINUX_SYS_linux_sigreturn,%eax /* linux_sigreturn() */
int $0x80 /* enter kernel with args
*/
0: jmp 0b
ALIGN_TEXT
I think the stuff above copies the args, and whatnot, but I'm not really
sure where it does this exactly...
It calls LINUX_SIGF_HANDLER, which then calls %esp's sf_handler function.
That is where I draw a blank, I don't know which function this is calling,
and can't find where it's being set. I think this might be what I want to
change though. :-P
Does anyone who actually knows assembly have any ideas?
Ken
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020423181748.W31638-100000>
