From owner-p4-projects Tue Jul 9 13:37: 0 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7779E37B401; Tue, 9 Jul 2002 13:36:39 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 13E4A37B400 for ; Tue, 9 Jul 2002 13:36:39 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A9FD843E3B for ; Tue, 9 Jul 2002 13:36:38 -0700 (PDT) (envelope-from jhb@freebsd.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g69KacJU082038 for ; Tue, 9 Jul 2002 13:36:38 -0700 (PDT) (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g69KacId082034 for perforce@freebsd.org; Tue, 9 Jul 2002 13:36:38 -0700 (PDT) Date: Tue, 9 Jul 2002 13:36:38 -0700 (PDT) Message-Id: <200207092036.g69KacId082034@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 13992 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=13992 Change 13992 by jhb@jhb_laptop on 2002/07/09 13:36:07 Clean up alpha MD thread flags. Move uac settings to mdproc since they are process wide. Rename remaining per-thread flags to MDTD_FOO instead of MDP_FOO. Affected files ... .. //depot/projects/smpng/sys/alpha/alpha/exception.s#6 edit .. //depot/projects/smpng/sys/alpha/alpha/genassym.c#11 edit .. //depot/projects/smpng/sys/alpha/alpha/machdep.c#44 edit .. //depot/projects/smpng/sys/alpha/alpha/sys_machdep.c#10 edit .. //depot/projects/smpng/sys/alpha/alpha/trap.c#35 edit .. //depot/projects/smpng/sys/alpha/alpha/vm_machdep.c#12 edit .. //depot/projects/smpng/sys/alpha/include/proc.h#5 edit .. //depot/projects/smpng/sys/alpha/osf1/osf1_signal.c#10 edit Differences ... ==== //depot/projects/smpng/sys/alpha/alpha/exception.s#6 (text+ko) ==== @@ -151,7 +151,7 @@ /* set the hae register if this process has specified a value */ ldq t1, TD_MD_FLAGS(s0) - and t1, MDP_HAEUSED + and t1, MDTD_HAEUSED beq t1, 3f ldq a0, TD_MD_HAE(s0) ldq pv, chipset + CHIPSET_WRITE_HAE @@ -302,7 +302,7 @@ Lrestoreregs: /* set the hae register if this process has specified a value */ ldq t1, TD_MD_FLAGS(s0) - and t1, MDP_HAEUSED + and t1, MDTD_HAEUSED beq t1, Lnohae ldq a0, TD_MD_HAE(t0) ldq pv, chipset + CHIPSET_WRITE_HAE ==== //depot/projects/smpng/sys/alpha/alpha/genassym.c#11 (text+ko) ==== @@ -92,7 +92,7 @@ #ifdef SMP ASSYM(TD_MD_KERNNEST, offsetof(struct thread, td_md.md_kernnest)); #endif -ASSYM(MDP_HAEUSED, MDP_HAEUSED); +ASSYM(MDTD_HAEUSED, MDTD_HAEUSED); ASSYM(CHIPSET_WRITE_HAE, offsetof(struct alpha_chipset, write_hae)); ==== //depot/projects/smpng/sys/alpha/alpha/machdep.c#44 (text+ko) ==== @@ -1209,7 +1209,7 @@ /* save the floating-point state, if necessary, then copy it. */ alpha_fpstate_save(td, 1); /* XXX maybe write=0 */ - ksi.si_sc.sc_ownedfp = td->td_md.md_flags & MDP_FPUSED; + ksi.si_sc.sc_ownedfp = td->td_md.md_flags & MDTD_FPUSED; bcopy(&td->td_pcb->pcb_fp, (struct fpreg *)ksi.si_sc.sc_fpregs, sizeof(struct fpreg)); ksi.si_sc.sc_fp_control = td->td_pcb->pcb_fp_control; @@ -1332,7 +1332,7 @@ #endif /* save the floating-point state, if necessary, then copy it. */ alpha_fpstate_save(td, 1); - sf.sf_uc.uc_mcontext.mc_ownedfp = td->td_md.md_flags & MDP_FPUSED; + sf.sf_uc.uc_mcontext.mc_ownedfp = td->td_md.md_flags & MDTD_FPUSED; bcopy(&td->td_pcb->pcb_fp, (struct fpreg *)sf.sf_uc.uc_mcontext.mc_fpregs, sizeof(struct fpreg)); @@ -1606,7 +1606,7 @@ tfp->tf_regs[FRAME_T12] = tfp->tf_regs[FRAME_PC]; /* a.k.a. PV */ tfp->tf_regs[FRAME_FLAGS] = 0; /* full restore */ - td->td_md.md_flags &= ~MDP_FPUSED; + td->td_md.md_flags &= ~MDTD_FPUSED; alpha_fpstate_drop(td); } @@ -1720,13 +1720,13 @@ int ptrace_clear_single_step(struct thread *td) { - if (td->td_md.md_flags & MDP_STEP2) { + if (td->td_md.md_flags & MDTD_STEP2) { ptrace_clear_bpt(td, &td->td_md.md_sstep[1]); ptrace_clear_bpt(td, &td->td_md.md_sstep[0]); - td->td_md.md_flags &= ~MDP_STEP2; - } else if (td->td_md.md_flags & MDP_STEP1) { + td->td_md.md_flags &= ~MDTD_STEP2; + } else if (td->td_md.md_flags & MDTD_STEP1) { ptrace_clear_bpt(td, &td->td_md.md_sstep[0]); - td->td_md.md_flags &= ~MDP_STEP1; + td->td_md.md_flags &= ~MDTD_STEP1; } return 0; } @@ -1740,7 +1740,7 @@ vm_offset_t addr[2]; /* places to set breakpoints */ int count = 0; /* count of breakpoints */ - if (td->td_md.md_flags & (MDP_STEP1|MDP_STEP2)) + if (td->td_md.md_flags & (MDTD_STEP1|MDTD_STEP2)) panic("ptrace_single_step: step breakpoints not removed"); error = ptrace_read_int(td, pc, &ins.bits); @@ -1793,9 +1793,9 @@ ptrace_clear_bpt(td, &td->td_md.md_sstep[0]); return error; } - td->td_md.md_flags |= MDP_STEP2; + td->td_md.md_flags |= MDTD_STEP2; } else - td->td_md.md_flags |= MDP_STEP1; + td->td_md.md_flags |= MDTD_STEP1; return 0; } @@ -2132,7 +2132,7 @@ SET_FEN(td); } - td->td_md.md_flags |= MDP_FPUSED; + td->td_md.md_flags |= MDTD_FPUSED; intr_restore(s); } ==== //depot/projects/smpng/sys/alpha/alpha/sys_machdep.c#10 (text+ko) ==== @@ -122,7 +122,7 @@ if (error) return (error); - td->td_md.md_flags |= MDP_HAEUSED; + td->td_md.md_flags |= MDTD_HAEUSED; td->td_md.md_hae = ua.hae; return (0); @@ -169,8 +169,7 @@ { int error; unsigned long uac; - struct proc *p; - struct thread *td2; + struct proc *p, *pp; error = copyin(args, &uac, sizeof(uac)); if (error) @@ -178,13 +177,11 @@ p = td->td_proc; PROC_LOCK(p); - if (p->p_pptr) { - PROC_LOCK(p->p_pptr); - /* XXXKSE which threads? */ - td2 = FIRST_THREAD_IN_PROC(p->p_pptr); - td2->td_md.md_flags &= ~MDP_UAC_MASK; - td2->td_md.md_flags |= uac & MDP_UAC_MASK; - PROC_UNLOCK(p->p_pptr); + pp = p->p_pptr; + if (pp != NULL) { + PROC_LOCK(pp); + pp->p_md.md_uac = uac & MDP_UAC_MASK; + PROC_UNLOCK(pp); } PROC_UNLOCK(p); return 0; @@ -193,20 +190,18 @@ static int alpha_get_uac(struct thread *td, char *args) { - struct proc *p; - struct thread *td2; + struct proc *p, *pp; int error; unsigned long uac; p = td->td_proc; error = ESRCH; PROC_LOCK(p); - if (p->p_pptr) { - PROC_LOCK(p->p_pptr); - /* XXXKSE which threads? */ - td2 = FIRST_THREAD_IN_PROC(p->p_pptr); - uac = td2->td_md.md_flags & MDP_UAC_MASK; - PROC_UNLOCK(p->p_pptr); + pp = p->p_pptr; + if (pp != NULL) { + PROC_LOCK(pp); + uac = p->p_md.md_uac; + PROC_UNLOCK(pp); PROC_UNLOCK(p); error = copyout(&uac, args, sizeof(uac)); } else ==== //depot/projects/smpng/sys/alpha/alpha/trap.c#35 (text+ko) ==== @@ -400,7 +400,7 @@ /* FALLTHROUTH */ case ALPHA_IF_CODE_BPT: case ALPHA_IF_CODE_BUGCHK: - if (td->td_md.md_flags & (MDP_STEP1|MDP_STEP2)) { + if (td->td_md.md_flags & (MDTD_STEP1|MDTD_STEP2)) { mtx_lock(&Giant); ptrace_clear_single_step(td); td->td_frame->tf_regs[FRAME_PC] -= 4; @@ -1009,8 +1009,8 @@ */ if (td) { - uac = td->td_md.md_flags & MDP_UAC_MASK; p = td->td_proc; + uac = p->p_md.md_uac; } else { uac = 0; p = NULL; ==== //depot/projects/smpng/sys/alpha/alpha/vm_machdep.c#12 (text+ko) ==== @@ -133,7 +133,8 @@ p1 = td1->td_proc; td2->td_pcb = (struct pcb *) (td2->td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; - td2->td_md.md_flags = td1->td_md.md_flags & (MDP_FPUSED | MDP_UAC_MASK); + td2->td_md.md_flags = td1->td_md.md_flags & MDTD_FPUSED; + p2->p_md.md_uac = p1->p_md.md_uac; /* * Cache the physical address of the pcb, so we can ==== //depot/projects/smpng/sys/alpha/include/proc.h#5 (text+ko) ==== @@ -40,6 +40,11 @@ u_int32_t contents; }; +#define MDTD_FPUSED 0x0001 /* Process used the FPU */ +#define MDTD_STEP1 0x0002 /* Single step normal instruction */ +#define MDTD_STEP2 0x0004 /* Single step branch instruction */ +#define MDTD_HAEUSED 0x0008 /* Process used the HAE */ + struct mdthread { u_long md_flags; struct pcb *md_pcbpaddr; /* phys addr of the pcb */ @@ -50,17 +55,14 @@ register_t md_savecrit; /* save PSL for critical section */ }; -#define MDP_FPUSED 0x0001 /* Process used the FPU */ -#define MDP_STEP1 0x0002 /* Single step normal instruction */ -#define MDP_STEP2 0x0004 /* Single step branch instruction */ -#define MDP_HAEUSED 0x0008 /* Process used the HAE */ -#define MDP_UAC_NOPRINT 0x0010 /* Don't print unaligned traps */ -#define MDP_UAC_NOFIX 0x0020 /* Don't fixup unaligned traps */ -#define MDP_UAC_SIGBUS 0x0040 /* Deliver SIGBUS upon +#define MDP_UAC_NOPRINT 0x0010 /* Don't print unaligned traps */ +#define MDP_UAC_NOFIX 0x0020 /* Don't fixup unaligned traps */ +#define MDP_UAC_SIGBUS 0x0040 /* Deliver SIGBUS upon unaligned access */ -#define MDP_UAC_MASK (MDP_UAC_NOPRINT | MDP_UAC_NOFIX | MDP_UAC_SIGBUS) +#define MDP_UAC_MASK (MDP_UAC_NOPRINT | MDP_UAC_NOFIX | MDP_UAC_SIGBUS) struct mdproc { + u_int md_uac; /* Unaligned Access Check flags. */ }; #endif /* !_MACHINE_PROC_H_ */ ==== //depot/projects/smpng/sys/alpha/osf1/osf1_signal.c#10 (text+ko) ==== @@ -631,7 +631,7 @@ /* save the floating-point state, if necessary, then copy it. */ alpha_fpstate_save(td, 1); /* XXX maybe write=0 */ - ksi.si_sc.sc_ownedfp = td->td_md.md_flags & MDP_FPUSED; + ksi.si_sc.sc_ownedfp = td->td_md.md_flags & MDTD_FPUSED; bcopy(&td->td_pcb->pcb_fp, (struct fpreg *)ksi.si_sc.sc_fpregs, sizeof(struct fpreg)); ksi.si_sc.sc_fp_control = td->td_pcb->pcb_fp_control; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message