From owner-freebsd-current Tue Apr 23 15:31:48 2002 Delivered-To: freebsd-current@freebsd.org Received: from mailhub.yumyumyum.org (dsl092-171-091.wdc1.dsl.speakeasy.net [66.92.171.91]) by hub.freebsd.org (Postfix) with SMTP id 9D29537B4AE for ; Tue, 23 Apr 2002 15:31:20 -0700 (PDT) Received: (qmail 31726 invoked from network); 23 Apr 2002 22:30:58 -0000 Received: from dsl092-171-091.wdc1.dsl.speakeasy.net (66.92.171.91) by dsl092-171-091.wdc1.dsl.speakeasy.net with SMTP; 23 Apr 2002 22:30:58 -0000 Date: Tue, 23 Apr 2002 18:30:58 -0400 (EDT) From: Kenneth Culver To: Andrew Gallatin Cc: freebsd-hackers@freebsd.org, Subject: Re: implementing linux mmap2 syscall In-Reply-To: <15557.27747.802212.659760@grasshopper.cs.duke.edu> Message-ID: <20020423181748.W31638-100000@alpha.yumyumyum.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > 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