Deleted Added
full compact
linux_sysvec.c (71497) linux_sysvec.c (72543)
1/*-
2 * Copyright (c) 1994-1996 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
1/*-
2 * Copyright (c) 1994-1996 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/i386/linux/linux_sysvec.c 71497 2001-01-24 00:27:28Z jhb $
28 * $FreeBSD: head/sys/i386/linux/linux_sysvec.c 72543 2001-02-16 16:40:43Z jlemon $
29 */
30
31/* XXX we use functions that might not exist. */
32#include "opt_compat.h"
33
34#ifndef COMPAT_43
35#error "Unable to compile Linux-emulator due to missing COMPAT_43 option!"
36#endif

--- 171 unchanged lines hidden (view full) ---

208 register struct trapframe *regs;
209 struct linux_rt_sigframe *fp, frame;
210 int oonstack;
211
212 regs = p->p_md.md_regs;
213 oonstack = sigonstack(regs->tf_esp);
214
215#ifdef DEBUG
29 */
30
31/* XXX we use functions that might not exist. */
32#include "opt_compat.h"
33
34#ifndef COMPAT_43
35#error "Unable to compile Linux-emulator due to missing COMPAT_43 option!"
36#endif

--- 171 unchanged lines hidden (view full) ---

208 register struct trapframe *regs;
209 struct linux_rt_sigframe *fp, frame;
210 int oonstack;
211
212 regs = p->p_md.md_regs;
213 oonstack = sigonstack(regs->tf_esp);
214
215#ifdef DEBUG
216 printf("Linux-emul(%ld): linux_rt_sendsig(%p, %d, %p, %lu)\n",
217 (long)p->p_pid, catcher, sig, (void*)mask, code);
216 if (ldebug(sigreturn))
217 printf(ARGS(rt_sendsig, "%p, %d, %p, %lu"),
218 catcher, sig, (void*)mask, code);
218#endif
219 /*
220 * Allocate space for the signal handler context.
221 */
222 PROC_LOCK(p);
223 if ((p->p_flag & P_ALTSTACK) && !oonstack &&
224 SIGISMEMBER(p->p_sigacts->ps_sigonstack, sig)) {
225 fp = (struct linux_rt_sigframe *)(p->p_sigstk.ss_sp +

--- 16 unchanged lines hidden (view full) ---

242 */
243 PROC_LOCK(p);
244 SIGACTION(p, SIGILL) = SIG_DFL;
245 SIGDELSET(p->p_sigignore, SIGILL);
246 SIGDELSET(p->p_sigcatch, SIGILL);
247 SIGDELSET(p->p_sigmask, SIGILL);
248 PROC_UNLOCK(p);
249#ifdef DEBUG
219#endif
220 /*
221 * Allocate space for the signal handler context.
222 */
223 PROC_LOCK(p);
224 if ((p->p_flag & P_ALTSTACK) && !oonstack &&
225 SIGISMEMBER(p->p_sigacts->ps_sigonstack, sig)) {
226 fp = (struct linux_rt_sigframe *)(p->p_sigstk.ss_sp +

--- 16 unchanged lines hidden (view full) ---

243 */
244 PROC_LOCK(p);
245 SIGACTION(p, SIGILL) = SIG_DFL;
246 SIGDELSET(p->p_sigignore, SIGILL);
247 SIGDELSET(p->p_sigcatch, SIGILL);
248 SIGDELSET(p->p_sigmask, SIGILL);
249 PROC_UNLOCK(p);
250#ifdef DEBUG
250 printf("Linux-emul(%ld): linux_rt_sendsig -- bad stack %p, "
251 "oonstack=%x\n", (long)p->p_pid, fp, oonstack);
251 if (ldebug(sigreturn))
252 printf(LMSG("rt_sendsig: bad stack %p, oonstack=%x"),
253 fp, oonstack);
252#endif
253 psignal(p, SIGILL);
254 return;
255 }
256
257 /*
258 * Build the argument list for the signal handler.
259 */

--- 42 unchanged lines hidden (view full) ---

302 frame.sf_sc.uc_mcontext.sc_cs = regs->tf_cs;
303 frame.sf_sc.uc_mcontext.sc_eflags = regs->tf_eflags;
304 frame.sf_sc.uc_mcontext.sc_esp_at_signal = regs->tf_esp;
305 frame.sf_sc.uc_mcontext.sc_ss = regs->tf_ss;
306 frame.sf_sc.uc_mcontext.sc_err = regs->tf_err;
307 frame.sf_sc.uc_mcontext.sc_trapno = code; /* XXX ???? */
308
309#ifdef DEBUG
254#endif
255 psignal(p, SIGILL);
256 return;
257 }
258
259 /*
260 * Build the argument list for the signal handler.
261 */

--- 42 unchanged lines hidden (view full) ---

304 frame.sf_sc.uc_mcontext.sc_cs = regs->tf_cs;
305 frame.sf_sc.uc_mcontext.sc_eflags = regs->tf_eflags;
306 frame.sf_sc.uc_mcontext.sc_esp_at_signal = regs->tf_esp;
307 frame.sf_sc.uc_mcontext.sc_ss = regs->tf_ss;
308 frame.sf_sc.uc_mcontext.sc_err = regs->tf_err;
309 frame.sf_sc.uc_mcontext.sc_trapno = code; /* XXX ???? */
310
311#ifdef DEBUG
310 printf("Linux-emul(%ld): rt_sendsig flags: 0x%x, sp: %p, ss: 0x%x, "
311 "mask: 0x%x\n", (long)p->p_pid, frame.sf_sc.uc_stack.ss_flags,
312 p->p_sigstk.ss_sp, p->p_sigstk.ss_size,
313 frame.sf_sc.uc_mcontext.sc_mask);
312 if (ldebug(sigreturn))
313 printf(LMSG("rt_sendsig flags: 0x%x, sp: %p, ss: 0x%x, mask: 0x%x"),
314 frame.sf_sc.uc_stack.ss_flags, p->p_sigstk.ss_sp,
315 p->p_sigstk.ss_size, frame.sf_sc.uc_mcontext.sc_mask);
314#endif
315
316 if (copyout(&frame, fp, sizeof(frame)) != 0) {
317 /*
318 * Process has trashed its stack; give it an illegal
319 * instruction to halt it in its tracks.
320 */
321 sigexit(p, SIGILL);

--- 41 unchanged lines hidden (view full) ---

363 linux_rt_sendsig(catcher, sig, mask, code);
364 return;
365 }
366
367 regs = p->p_md.md_regs;
368 oonstack = sigonstack(regs->tf_esp);
369
370#ifdef DEBUG
316#endif
317
318 if (copyout(&frame, fp, sizeof(frame)) != 0) {
319 /*
320 * Process has trashed its stack; give it an illegal
321 * instruction to halt it in its tracks.
322 */
323 sigexit(p, SIGILL);

--- 41 unchanged lines hidden (view full) ---

365 linux_rt_sendsig(catcher, sig, mask, code);
366 return;
367 }
368
369 regs = p->p_md.md_regs;
370 oonstack = sigonstack(regs->tf_esp);
371
372#ifdef DEBUG
371 printf("Linux-emul(%ld): linux_sendsig(%p, %d, %p, %lu)\n",
372 (long)p->p_pid, catcher, sig, (void*)mask, code);
373 if (ldebug(sigreturn))
374 printf(ARGS(sendsig, "%p, %d, %p, %lu"),
375 catcher, sig, (void*)mask, code);
373#endif
374
375 /*
376 * Allocate space for the signal handler context.
377 */
378 PROC_LOCK(p);
379 if ((p->p_flag & P_ALTSTACK) && !oonstack &&
380 SIGISMEMBER(p->p_sigacts->ps_sigonstack, sig)) {

--- 106 unchanged lines hidden (view full) ---

487 struct linux_sigframe frame;
488 register struct trapframe *regs;
489 linux_sigset_t lmask;
490 int eflags, i;
491
492 regs = p->p_md.md_regs;
493
494#ifdef DEBUG
376#endif
377
378 /*
379 * Allocate space for the signal handler context.
380 */
381 PROC_LOCK(p);
382 if ((p->p_flag & P_ALTSTACK) && !oonstack &&
383 SIGISMEMBER(p->p_sigacts->ps_sigonstack, sig)) {

--- 106 unchanged lines hidden (view full) ---

490 struct linux_sigframe frame;
491 register struct trapframe *regs;
492 linux_sigset_t lmask;
493 int eflags, i;
494
495 regs = p->p_md.md_regs;
496
497#ifdef DEBUG
495 printf("Linux-emul(%ld): linux_sigreturn(%p)\n",
496 (long)p->p_pid, (void *)args->sfp);
498 if (ldebug(sigreturn))
499 printf(ARGS(sigreturn, "%p"), (void *)args->sfp);
497#endif
498 /*
499 * The trampoline code hands us the sigframe.
500 * It is unsafe to keep track of it ourselves, in the event that a
501 * program jumps out of a signal handler.
502 */
503 if (copyin((caddr_t)args->sfp, &frame, sizeof(frame)) != 0)
504 return (EFAULT);

--- 81 unchanged lines hidden (view full) ---

586 stack_t *ss;
587 register struct trapframe *regs;
588 int eflags;
589 caddr_t sg = stackgap_init();
590
591 regs = p->p_md.md_regs;
592
593#ifdef DEBUG
500#endif
501 /*
502 * The trampoline code hands us the sigframe.
503 * It is unsafe to keep track of it ourselves, in the event that a
504 * program jumps out of a signal handler.
505 */
506 if (copyin((caddr_t)args->sfp, &frame, sizeof(frame)) != 0)
507 return (EFAULT);

--- 81 unchanged lines hidden (view full) ---

589 stack_t *ss;
590 register struct trapframe *regs;
591 int eflags;
592 caddr_t sg = stackgap_init();
593
594 regs = p->p_md.md_regs;
595
596#ifdef DEBUG
594 printf("Linux-emul(%ld): linux_rt_sigreturn(%p)\n",
595 (long)p->p_pid, (void *)args->ucp);
597 if (ldebug(rt_sigreturn))
598 printf(ARGS(rt_sigreturn, "%p"), (void *)args->ucp);
596#endif
597 /*
598 * The trampoline code hands us the ucontext.
599 * It is unsafe to keep track of it ourselves, in the event that a
600 * program jumps out of a signal handler.
601 */
602 if (copyin((caddr_t)args->ucp, &uc, sizeof(uc)) != 0)
603 return (EFAULT);

--- 60 unchanged lines hidden (view full) ---

664 */
665 ss = stackgap_alloc(&sg, sizeof(stack_t));
666 lss = &uc.uc_stack;
667 ss->ss_sp = lss->ss_sp;
668 ss->ss_size = lss->ss_size;
669 ss->ss_flags = linux_to_bsd_sigaltstack(lss->ss_flags);
670
671#ifdef DEBUG
599#endif
600 /*
601 * The trampoline code hands us the ucontext.
602 * It is unsafe to keep track of it ourselves, in the event that a
603 * program jumps out of a signal handler.
604 */
605 if (copyin((caddr_t)args->ucp, &uc, sizeof(uc)) != 0)
606 return (EFAULT);

--- 60 unchanged lines hidden (view full) ---

667 */
668 ss = stackgap_alloc(&sg, sizeof(stack_t));
669 lss = &uc.uc_stack;
670 ss->ss_sp = lss->ss_sp;
671 ss->ss_size = lss->ss_size;
672 ss->ss_flags = linux_to_bsd_sigaltstack(lss->ss_flags);
673
674#ifdef DEBUG
672 printf("Linux-emul(%ld): rt_sigret flags: 0x%x, sp: %p, ss: 0x%x, mask: 0x%x\n",
673 (long)p->p_pid, ss->ss_flags, ss->ss_sp, ss->ss_size, context->sc_mask);
675 if (ldebug(rt_sigreturn))
676 printf(LMSG("rt_sigret flags: 0x%x, sp: %p, ss: 0x%x, mask: 0x%x"),
677 ss->ss_flags, ss->ss_sp, ss->ss_size, context->sc_mask);
674#endif
675 sasargs.ss = ss;
676 sasargs.oss = NULL;
677 (void) sigaltstack(p, &sasargs);
678
679 return (EJUSTRETURN);
680}
681

--- 169 unchanged lines hidden ---
678#endif
679 sasargs.ss = ss;
680 sasargs.oss = NULL;
681 (void) sigaltstack(p, &sasargs);
682
683 return (EJUSTRETURN);
684}
685

--- 169 unchanged lines hidden ---