machdep.c (217886) | machdep.c (218327) |
---|---|
1/*- 2 * Copyright (c) 1992 Terrence R. Lambert. 3 * Copyright (c) 1982, 1987, 1990 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * William Jolitz. 8 * --- 24 unchanged lines hidden (view full) --- 33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * SUCH DAMAGE. 36 * 37 * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 38 */ 39 40#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1992 Terrence R. Lambert. 3 * Copyright (c) 1982, 1987, 1990 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * William Jolitz. 8 * --- 24 unchanged lines hidden (view full) --- 33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * SUCH DAMAGE. 36 * 37 * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 38 */ 39 40#include <sys/cdefs.h> |
41__FBSDID("$FreeBSD: head/sys/i386/i386/machdep.c 217886 2011-01-26 17:06:13Z mdf $"); | 41__FBSDID("$FreeBSD: head/sys/i386/i386/machdep.c 218327 2011-02-05 15:10:27Z kib $"); |
42 43#include "opt_atalk.h" 44#include "opt_compat.h" 45#include "opt_cpu.h" 46#include "opt_ddb.h" 47#include "opt_inet.h" 48#include "opt_ipx.h" 49#include "opt_isa.h" --- 321 unchanged lines hidden (view full) --- 371 372 /* Translate the signal if appropriate. */ 373 if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize) 374 sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)]; 375 376 /* Build the argument list for the signal handler. */ 377 sf.sf_signum = sig; 378 sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc; | 42 43#include "opt_atalk.h" 44#include "opt_compat.h" 45#include "opt_cpu.h" 46#include "opt_ddb.h" 47#include "opt_inet.h" 48#include "opt_ipx.h" 49#include "opt_isa.h" --- 321 unchanged lines hidden (view full) --- 371 372 /* Translate the signal if appropriate. */ 373 if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize) 374 sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)]; 375 376 /* Build the argument list for the signal handler. */ 377 sf.sf_signum = sig; 378 sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc; |
379 bzero(&sf.sf_siginfo, sizeof(sf.sf_siginfo)); |
|
379 if (SIGISMEMBER(psp->ps_siginfo, sig)) { 380 /* Signal handler installed with SA_SIGINFO. */ 381 sf.sf_arg2 = (register_t)&fp->sf_siginfo; 382 sf.sf_siginfo.si_signo = sig; 383 sf.sf_siginfo.si_code = ksi->ksi_code; 384 sf.sf_ahu.sf_action = (__osiginfohandler_t *)catcher; | 380 if (SIGISMEMBER(psp->ps_siginfo, sig)) { 381 /* Signal handler installed with SA_SIGINFO. */ 382 sf.sf_arg2 = (register_t)&fp->sf_siginfo; 383 sf.sf_siginfo.si_signo = sig; 384 sf.sf_siginfo.si_code = ksi->ksi_code; 385 sf.sf_ahu.sf_action = (__osiginfohandler_t *)catcher; |
386 sf.sf_addr = 0; |
|
385 } else { 386 /* Old FreeBSD-style arguments. */ 387 sf.sf_arg2 = ksi->ksi_code; 388 sf.sf_addr = (register_t)ksi->ksi_addr; 389 sf.sf_ahu.sf_handler = catcher; 390 } 391 mtx_unlock(&psp->ps_mtx); 392 PROC_UNLOCK(p); --- 97 unchanged lines hidden (view full) --- 490 bzero(&sf, sizeof(sf)); 491 sf.sf_uc.uc_sigmask = *mask; 492 sf.sf_uc.uc_stack = td->td_sigstk; 493 sf.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) 494 ? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE; 495 sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; 496 sf.sf_uc.uc_mcontext.mc_gs = rgs(); 497 bcopy(regs, &sf.sf_uc.uc_mcontext.mc_fs, sizeof(*regs)); | 387 } else { 388 /* Old FreeBSD-style arguments. */ 389 sf.sf_arg2 = ksi->ksi_code; 390 sf.sf_addr = (register_t)ksi->ksi_addr; 391 sf.sf_ahu.sf_handler = catcher; 392 } 393 mtx_unlock(&psp->ps_mtx); 394 PROC_UNLOCK(p); --- 97 unchanged lines hidden (view full) --- 492 bzero(&sf, sizeof(sf)); 493 sf.sf_uc.uc_sigmask = *mask; 494 sf.sf_uc.uc_stack = td->td_sigstk; 495 sf.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) 496 ? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE; 497 sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; 498 sf.sf_uc.uc_mcontext.mc_gs = rgs(); 499 bcopy(regs, &sf.sf_uc.uc_mcontext.mc_fs, sizeof(*regs)); |
500 bzero(sf.sf_uc.uc_mcontext.mc_fpregs, 501 sizeof(sf.sf_uc.uc_mcontext.mc_fpregs)); 502 bzero(sf.sf_uc.uc_mcontext.__spare__, 503 sizeof(sf.sf_uc.uc_mcontext.__spare__)); 504 bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__)); |
|
498 499 /* Allocate space for the signal handler context. */ 500 if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && 501 SIGISMEMBER(psp->ps_sigonstack, sig)) { 502 sfp = (struct sigframe4 *)(td->td_sigstk.ss_sp + 503 td->td_sigstk.ss_size - sizeof(struct sigframe4)); 504#if defined(COMPAT_43) 505 td->td_sigstk.ss_flags |= SS_ONSTACK; 506#endif 507 } else 508 sfp = (struct sigframe4 *)regs->tf_esp - 1; 509 510 /* Translate the signal if appropriate. */ 511 if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize) 512 sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)]; 513 514 /* Build the argument list for the signal handler. */ 515 sf.sf_signum = sig; 516 sf.sf_ucontext = (register_t)&sfp->sf_uc; | 505 506 /* Allocate space for the signal handler context. */ 507 if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && 508 SIGISMEMBER(psp->ps_sigonstack, sig)) { 509 sfp = (struct sigframe4 *)(td->td_sigstk.ss_sp + 510 td->td_sigstk.ss_size - sizeof(struct sigframe4)); 511#if defined(COMPAT_43) 512 td->td_sigstk.ss_flags |= SS_ONSTACK; 513#endif 514 } else 515 sfp = (struct sigframe4 *)regs->tf_esp - 1; 516 517 /* Translate the signal if appropriate. */ 518 if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize) 519 sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)]; 520 521 /* Build the argument list for the signal handler. */ 522 sf.sf_signum = sig; 523 sf.sf_ucontext = (register_t)&sfp->sf_uc; |
524 bzero(&sf.sf_si, sizeof(sf.sf_si)); |
|
517 if (SIGISMEMBER(psp->ps_siginfo, sig)) { 518 /* Signal handler installed with SA_SIGINFO. */ 519 sf.sf_siginfo = (register_t)&sfp->sf_si; 520 sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher; 521 522 /* Fill in POSIX parts */ 523 sf.sf_si.si_signo = sig; 524 sf.sf_si.si_code = ksi->ksi_code; --- 110 unchanged lines hidden (view full) --- 635 * Unconditionally fill the fsbase and gsbase into the mcontext. 636 */ 637 sdp = &td->td_pcb->pcb_fsd; 638 sf.sf_uc.uc_mcontext.mc_fsbase = sdp->sd_hibase << 24 | 639 sdp->sd_lobase; 640 sdp = &td->td_pcb->pcb_gsd; 641 sf.sf_uc.uc_mcontext.mc_gsbase = sdp->sd_hibase << 24 | 642 sdp->sd_lobase; | 525 if (SIGISMEMBER(psp->ps_siginfo, sig)) { 526 /* Signal handler installed with SA_SIGINFO. */ 527 sf.sf_siginfo = (register_t)&sfp->sf_si; 528 sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher; 529 530 /* Fill in POSIX parts */ 531 sf.sf_si.si_signo = sig; 532 sf.sf_si.si_code = ksi->ksi_code; --- 110 unchanged lines hidden (view full) --- 643 * Unconditionally fill the fsbase and gsbase into the mcontext. 644 */ 645 sdp = &td->td_pcb->pcb_fsd; 646 sf.sf_uc.uc_mcontext.mc_fsbase = sdp->sd_hibase << 24 | 647 sdp->sd_lobase; 648 sdp = &td->td_pcb->pcb_gsd; 649 sf.sf_uc.uc_mcontext.mc_gsbase = sdp->sd_hibase << 24 | 650 sdp->sd_lobase; |
651 bzero(sf.sf_uc.uc_mcontext.mc_spare1, 652 sizeof(sf.sf_uc.uc_mcontext.mc_spare1)); 653 bzero(sf.sf_uc.uc_mcontext.mc_spare2, 654 sizeof(sf.sf_uc.uc_mcontext.mc_spare2)); 655 bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__)); |
|
643 644 /* Allocate space for the signal handler context. */ 645 if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && 646 SIGISMEMBER(psp->ps_sigonstack, sig)) { 647 sp = td->td_sigstk.ss_sp + 648 td->td_sigstk.ss_size - sizeof(struct sigframe); 649#if defined(COMPAT_43) 650 td->td_sigstk.ss_flags |= SS_ONSTACK; --- 5 unchanged lines hidden (view full) --- 656 657 /* Translate the signal if appropriate. */ 658 if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize) 659 sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)]; 660 661 /* Build the argument list for the signal handler. */ 662 sf.sf_signum = sig; 663 sf.sf_ucontext = (register_t)&sfp->sf_uc; | 656 657 /* Allocate space for the signal handler context. */ 658 if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && 659 SIGISMEMBER(psp->ps_sigonstack, sig)) { 660 sp = td->td_sigstk.ss_sp + 661 td->td_sigstk.ss_size - sizeof(struct sigframe); 662#if defined(COMPAT_43) 663 td->td_sigstk.ss_flags |= SS_ONSTACK; --- 5 unchanged lines hidden (view full) --- 669 670 /* Translate the signal if appropriate. */ 671 if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize) 672 sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)]; 673 674 /* Build the argument list for the signal handler. */ 675 sf.sf_signum = sig; 676 sf.sf_ucontext = (register_t)&sfp->sf_uc; |
677 bzero(&sf.sf_si, sizeof(sf.sf_si)); |
|
664 if (SIGISMEMBER(psp->ps_siginfo, sig)) { 665 /* Signal handler installed with SA_SIGINFO. */ 666 sf.sf_siginfo = (register_t)&sfp->sf_si; 667 sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher; 668 669 /* Fill in POSIX parts */ 670 sf.sf_si = ksi->ksi_info; 671 sf.sf_si.si_signo = sig; /* maybe a translated signal */ --- 2609 unchanged lines hidden (view full) --- 3281 mcp->mc_esp = tp->tf_esp; 3282 mcp->mc_ss = tp->tf_ss; 3283 mcp->mc_len = sizeof(*mcp); 3284 get_fpcontext(td, mcp); 3285 sdp = &td->td_pcb->pcb_fsd; 3286 mcp->mc_fsbase = sdp->sd_hibase << 24 | sdp->sd_lobase; 3287 sdp = &td->td_pcb->pcb_gsd; 3288 mcp->mc_gsbase = sdp->sd_hibase << 24 | sdp->sd_lobase; | 678 if (SIGISMEMBER(psp->ps_siginfo, sig)) { 679 /* Signal handler installed with SA_SIGINFO. */ 680 sf.sf_siginfo = (register_t)&sfp->sf_si; 681 sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher; 682 683 /* Fill in POSIX parts */ 684 sf.sf_si = ksi->ksi_info; 685 sf.sf_si.si_signo = sig; /* maybe a translated signal */ --- 2609 unchanged lines hidden (view full) --- 3295 mcp->mc_esp = tp->tf_esp; 3296 mcp->mc_ss = tp->tf_ss; 3297 mcp->mc_len = sizeof(*mcp); 3298 get_fpcontext(td, mcp); 3299 sdp = &td->td_pcb->pcb_fsd; 3300 mcp->mc_fsbase = sdp->sd_hibase << 24 | sdp->sd_lobase; 3301 sdp = &td->td_pcb->pcb_gsd; 3302 mcp->mc_gsbase = sdp->sd_hibase << 24 | sdp->sd_lobase; |
3289 | 3303 bzero(mcp->mc_spare1, sizeof(mcp->mc_spare1)); 3304 bzero(mcp->mc_spare2, sizeof(mcp->mc_spare2)); |
3290 return (0); 3291} 3292 3293/* 3294 * Set machine context. 3295 * 3296 * However, we don't set any but the user modifiable flags, and we won't 3297 * touch the cs selector. --- 32 unchanged lines hidden (view full) --- 3330 3331static void 3332get_fpcontext(struct thread *td, mcontext_t *mcp) 3333{ 3334 3335#ifndef DEV_NPX 3336 mcp->mc_fpformat = _MC_FPFMT_NODEV; 3337 mcp->mc_ownedfp = _MC_FPOWNED_NONE; | 3305 return (0); 3306} 3307 3308/* 3309 * Set machine context. 3310 * 3311 * However, we don't set any but the user modifiable flags, and we won't 3312 * touch the cs selector. --- 32 unchanged lines hidden (view full) --- 3345 3346static void 3347get_fpcontext(struct thread *td, mcontext_t *mcp) 3348{ 3349 3350#ifndef DEV_NPX 3351 mcp->mc_fpformat = _MC_FPFMT_NODEV; 3352 mcp->mc_ownedfp = _MC_FPOWNED_NONE; |
3353 bzero(mcp->mc_fpstate, sizeof(mcp->mc_fpstate)); |
|
3338#else 3339 mcp->mc_ownedfp = npxgetregs(td); 3340 bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate, 3341 sizeof(mcp->mc_fpstate)); 3342 mcp->mc_fpformat = npxformat(); 3343#endif 3344} 3345 --- 254 unchanged lines hidden --- | 3354#else 3355 mcp->mc_ownedfp = npxgetregs(td); 3356 bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate, 3357 sizeof(mcp->mc_fpstate)); 3358 mcp->mc_fpformat = npxformat(); 3359#endif 3360} 3361 --- 254 unchanged lines hidden --- |