From owner-freebsd-emulation Wed Sep 6 13:48:47 2000 Delivered-To: freebsd-emulation@freebsd.org Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by hub.freebsd.org (Postfix) with ESMTP id E205037B423 for <freebsd-emulation@FreeBSD.ORG>; Wed, 6 Sep 2000 13:48:42 -0700 (PDT) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.9.3/8.9.3) with ESMTP id QAA21784; Wed, 6 Sep 2000 16:38:58 -0400 (EDT) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.11.0/8.9.1) id e86KcwZ25776; Wed, 6 Sep 2000 16:38:58 -0400 (EDT) (envelope-from gallatin@cs.duke.edu) From: Andrew Gallatin <gallatin@cs.duke.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Wed, 6 Sep 2000 16:38:58 -0400 (EDT) To: Martin Cracauer <cracauer@cons.org> Cc: Nate Williams <nate@yogotech.com>, marcel@cup.hp.com, freebsd-emulation@FreeBSD.ORG Subject: Re: IBM JDK fails due to lack of SA_SIGINFO support In-Reply-To: <20000906083957.A5530@cons.org> References: <14773.43466.744621.411519@grasshopper.cs.duke.edu> <200009060447.WAA23183@nomad.yogotech.com> <20000906083957.A5530@cons.org> X-Mailer: VM 6.43 under 20.4 "Emerald" XEmacs Lucid Message-ID: <14774.42905.390753.70408@grasshopper.cs.duke.edu> Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org I'm getting closer. I'd really appreciate some help from x86 people.... I think its coming down to my lack of knowledge about x86 assembly :-( So far, I've created a linux_rt_sendsig, which pushes out a linux_rt_sigframe, rather than a normal linux_sigframe. I've padded out the linux_sigframe struct by 164 bytes so that the sizes match. I have diffs for what I've done so far at http://www.cs.duke.edu/~gallatin/linux_sa_siginfo/diff This makes the linux sa_siginfo handler "sorta" work. Right now, my toy test program works after a fashion (prints out garbage for the sending uid & pid, but doesn't crash). The IBM jdk _does_ still crash. If I modify my test code (appended) to return from the signal handler, my code crashes too. If I print out the faulting PC from within the kernel, its at 0xbfbfffe3. According to a uprintf, the sigtramp code starts at 0xbfbfffd8. I suppose this means that the current sigtramp code won't work for linux SA_SIGINFO style handlers Can some x86 guru explain the sigtramp code to me? included it for reference: NON_GPROF_ENTRY(linux_sigcode) call *LINUX_SIGF_HANDLER(%esp) leal LINUX_SIGF_SC(%esp),%ebx /* linux scp */ movl LINUX_SC_GS(%ebx),%gs push %eax /* fake ret addr */ movl $LINUX_SYS_linux_sigreturn,%eax /* linux_sigreturn() */ int $0x80 /* enter kernel with args */ 0: jmp 0b ALIGN_TEXT _linux_esigcode: .data .globl _linux_szsigcode _linux_szsigcode: .long _linux_esigcode-_linux_sigcode .text Here's my current test code: #include <signal.h> #include <stdlib.h> #include <ucontext.h> int foo = 0; static void kill_handler(int sig, siginfo_t *sip, void *context) { int siginfo_size; int *p; printf("\n"); printf("&sig = %p\n", &sig); printf("&sip = %p\n", &sip); printf("sip = %p\n", sip); printf("context = %p\n", context); printf("sip->si_signo = %d\n", sip->si_signo); printf("sip->si_uid = %d\n", sip->si_uid); printf("sip->si_pid = %d\n", sip->si_pid); siginfo_size = (unsigned long )context - (unsigned long) sip; printf("sizeof(siginfo_t) = %ld\n", siginfo_size); for (p = (int *)sip; p != (int *)context; p++) printf("%p: 0x%x\n", p, *p); foo = 1; } main(int argc, char *argv[]) { sigset_t sigset; struct sigaction sa; int i, ret; volatile int bar; int *array; bzero((char*)& (sa.sa_mask), sizeof(sigset_t)); sa.sa_flags = SA_SIGINFO; sa.sa_sigaction = kill_handler; sigaction(45, &sa, NULL); sigaction(SIGUSR2, &sa, NULL); printf("installed handler at %p\n", kill_handler); while (!foo); } Cheers, Drew To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message