summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2002-07-12 18:34:22 +0000
committerjhb <jhb@FreeBSD.org>2002-07-12 18:34:22 +0000
commit91bb8201eeae731e6d8b345d9d056ebc17c2d781 (patch)
tree33a8ab6acd4539515cf2c39bfebdda1839199e8a /sys
parented7e4d6c5b6f82c819d9cda7df9eb9e3406f43a5 (diff)
downloadFreeBSD-src-91bb8201eeae731e6d8b345d9d056ebc17c2d781.zip
FreeBSD-src-91bb8201eeae731e6d8b345d9d056ebc17c2d781.tar.gz
Set the thread state of the newly chosen to run thread to TDS_RUNNING in
choosethread() in MI C code instead of doing it in in assembly in all the various cpu_switch() functions. This fixes problems on ia64 and sparc64. Reviewed by: julian, peter, benno Tested on: i386, alpha, sparc64
Diffstat (limited to 'sys')
-rw-r--r--sys/alpha/alpha/genassym.c2
-rw-r--r--sys/alpha/alpha/swtch.s3
-rw-r--r--sys/amd64/amd64/cpu_switch.S14
-rw-r--r--sys/amd64/amd64/genassym.c4
-rw-r--r--sys/amd64/amd64/swtch.s14
-rw-r--r--sys/i386/i386/genassym.c4
-rw-r--r--sys/i386/i386/swtch.s14
-rw-r--r--sys/ia64/ia64/genassym.c2
-rw-r--r--sys/ia64/ia64/swtch.s6
-rw-r--r--sys/kern/kern_switch.c3
-rw-r--r--sys/powerpc/aim/swtch.S2
-rw-r--r--sys/powerpc/powerpc/genassym.c2
-rw-r--r--sys/powerpc/powerpc/swtch.S2
-rw-r--r--sys/powerpc/powerpc/swtch.s2
-rw-r--r--sys/sparc64/sparc64/genassym.c2
-rw-r--r--sys/sparc64/sparc64/swtch.S3
-rw-r--r--sys/sparc64/sparc64/swtch.s3
17 files changed, 1 insertions, 81 deletions
diff --git a/sys/alpha/alpha/genassym.c b/sys/alpha/alpha/genassym.c
index 96092da..62ff3a4 100644
--- a/sys/alpha/alpha/genassym.c
+++ b/sys/alpha/alpha/genassym.c
@@ -80,8 +80,6 @@ ASSYM(MTX_UNOWNED, MTX_UNOWNED);
ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
ASSYM(TD_KSE, offsetof(struct thread, td_kse));
ASSYM(TD_PROC, offsetof(struct thread, td_proc));
-ASSYM(TD_STATE, offsetof(struct thread, td_state));
-ASSYM(TDS_RUNNING, TDS_RUNNING);
ASSYM(KE_FLAGS, offsetof(struct kse, ke_flags));
diff --git a/sys/alpha/alpha/swtch.s b/sys/alpha/alpha/swtch.s
index bae5227..34f3453 100644
--- a/sys/alpha/alpha/swtch.s
+++ b/sys/alpha/alpha/swtch.s
@@ -127,9 +127,6 @@ Lcs1: LDGP(pv)
mov v0, s2 /* s2 = new thread */
ldq s3, TD_MD_PCBPADDR(s2) /* s3 = new pcbpaddr */
- ldiq t0, TDS_RUNNING
- stl t0, TD_STATE(s2)
-
/*
* Check to see if we're switching to ourself. If we are,
* don't bother loading the new context.
diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S
index 80db485..a984623 100644
--- a/sys/amd64/amd64/cpu_switch.S
+++ b/sys/amd64/amd64/cpu_switch.S
@@ -171,13 +171,6 @@ sw1:
sw1b:
movl %eax,%ecx
-
-#ifdef INVARIANTS
- cmpb $TDS_RUNQ,TD_STATE(%ecx)
- jne badsw2
-#endif
-
- movl $TDS_RUNNING,TD_STATE(%ecx)
movl TD_PCB(%ecx),%edx
#if defined(SWTCH_OPTIM_STATS)
@@ -316,13 +309,6 @@ cpu_switch_load_gs:
ret
#ifdef INVARIANTS
-badsw2:
- pushal
- pushl $sw0_2
- call panic
-
-sw0_2: .asciz "cpu_switch: not TDS_RUNQ"
-
badsw3:
pushal
pushl $sw0_3
diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c
index a26b5dc..ee890db 100644
--- a/sys/amd64/amd64/genassym.c
+++ b/sys/amd64/amd64/genassym.c
@@ -82,7 +82,6 @@ ASSYM(P_SFLAG, offsetof(struct proc, p_sflag));
ASSYM(P_STATE, offsetof(struct proc, p_state));
ASSYM(P_UAREA, offsetof(struct proc, p_uarea));
-ASSYM(TD_STATE, offsetof(struct thread, td_state));
ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
ASSYM(TD_WCHAN, offsetof(struct thread, td_wchan));
ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
@@ -100,9 +99,6 @@ ASSYM(KE_FLAGS, offsetof(struct kse, ke_flags));
ASSYM(KEF_ASTPENDING, KEF_ASTPENDING);
ASSYM(KEF_NEEDRESCHED, KEF_NEEDRESCHED);
-ASSYM(TDS_SLP, TDS_SLP);
-ASSYM(TDS_RUNQ, TDS_RUNQ);
-ASSYM(TDS_RUNNING, TDS_RUNNING);
ASSYM(V_TRAP, offsetof(struct vmmeter, v_trap));
ASSYM(V_SYSCALL, offsetof(struct vmmeter, v_syscall));
ASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
diff --git a/sys/amd64/amd64/swtch.s b/sys/amd64/amd64/swtch.s
index 80db485..a984623 100644
--- a/sys/amd64/amd64/swtch.s
+++ b/sys/amd64/amd64/swtch.s
@@ -171,13 +171,6 @@ sw1:
sw1b:
movl %eax,%ecx
-
-#ifdef INVARIANTS
- cmpb $TDS_RUNQ,TD_STATE(%ecx)
- jne badsw2
-#endif
-
- movl $TDS_RUNNING,TD_STATE(%ecx)
movl TD_PCB(%ecx),%edx
#if defined(SWTCH_OPTIM_STATS)
@@ -316,13 +309,6 @@ cpu_switch_load_gs:
ret
#ifdef INVARIANTS
-badsw2:
- pushal
- pushl $sw0_2
- call panic
-
-sw0_2: .asciz "cpu_switch: not TDS_RUNQ"
-
badsw3:
pushal
pushl $sw0_3
diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c
index a26b5dc..ee890db 100644
--- a/sys/i386/i386/genassym.c
+++ b/sys/i386/i386/genassym.c
@@ -82,7 +82,6 @@ ASSYM(P_SFLAG, offsetof(struct proc, p_sflag));
ASSYM(P_STATE, offsetof(struct proc, p_state));
ASSYM(P_UAREA, offsetof(struct proc, p_uarea));
-ASSYM(TD_STATE, offsetof(struct thread, td_state));
ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
ASSYM(TD_WCHAN, offsetof(struct thread, td_wchan));
ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
@@ -100,9 +99,6 @@ ASSYM(KE_FLAGS, offsetof(struct kse, ke_flags));
ASSYM(KEF_ASTPENDING, KEF_ASTPENDING);
ASSYM(KEF_NEEDRESCHED, KEF_NEEDRESCHED);
-ASSYM(TDS_SLP, TDS_SLP);
-ASSYM(TDS_RUNQ, TDS_RUNQ);
-ASSYM(TDS_RUNNING, TDS_RUNNING);
ASSYM(V_TRAP, offsetof(struct vmmeter, v_trap));
ASSYM(V_SYSCALL, offsetof(struct vmmeter, v_syscall));
ASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s
index 80db485..a984623 100644
--- a/sys/i386/i386/swtch.s
+++ b/sys/i386/i386/swtch.s
@@ -171,13 +171,6 @@ sw1:
sw1b:
movl %eax,%ecx
-
-#ifdef INVARIANTS
- cmpb $TDS_RUNQ,TD_STATE(%ecx)
- jne badsw2
-#endif
-
- movl $TDS_RUNNING,TD_STATE(%ecx)
movl TD_PCB(%ecx),%edx
#if defined(SWTCH_OPTIM_STATS)
@@ -316,13 +309,6 @@ cpu_switch_load_gs:
ret
#ifdef INVARIANTS
-badsw2:
- pushal
- pushl $sw0_2
- call panic
-
-sw0_2: .asciz "cpu_switch: not TDS_RUNQ"
-
badsw3:
pushal
pushl $sw0_3
diff --git a/sys/ia64/ia64/genassym.c b/sys/ia64/ia64/genassym.c
index 5e348fb..8dbc394 100644
--- a/sys/ia64/ia64/genassym.c
+++ b/sys/ia64/ia64/genassym.c
@@ -76,11 +76,9 @@ ASSYM(MTX_UNOWNED, MTX_UNOWNED);
ASSYM(TD_PROC, offsetof(struct thread, td_proc));
ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
-ASSYM(TD_STATE, offsetof(struct thread, td_state));
ASSYM(TD_KSE, offsetof(struct thread, td_kse));
ASSYM(TD_KSTACK, offsetof(struct thread, td_kstack));
ASSYM(TD_MD_FLAGS, offsetof(struct thread, td_md.md_flags));
-ASSYM(TDS_RUNNING, TDS_RUNNING);
ASSYM(KE_FLAGS, offsetof(struct kse, ke_flags));
diff --git a/sys/ia64/ia64/swtch.s b/sys/ia64/ia64/swtch.s
index 18ebedc..da1e270 100644
--- a/sys/ia64/ia64/swtch.s
+++ b/sys/ia64/ia64/swtch.s
@@ -283,12 +283,6 @@ ENTRY(cpu_switch, 0)
st8 [r14]=r4 // set r13->pc_curthread
mov ar.k7=r4
;;
-// Julian's guess at settinghte thread state
- add r15=TD_STATE,r4
- ;;
- mov [r15]=TDS_RUNNING
- ;;
-// end of julian's guess
add r15=TD_PCB,r4
;;
ld8 r15=[r15]
diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c
index b6ae79d..348a521b8 100644
--- a/sys/kern/kern_switch.c
+++ b/sys/kern/kern_switch.c
@@ -155,11 +155,10 @@ choosethread(void)
} else {
/* Pretend the idle thread was on the run queue. */
td = PCPU_GET(idlethread);
- /* Simulate that it was on the run queue */
- td->td_state = TDS_RUNQ;
td->td_kse->ke_state = KES_UNQUEUED;
CTR1(KTR_RUNQ, "choosethread: td=%p (idle)", td);
}
+ td->td_state = TDS_RUNNING;
return (td);
}
diff --git a/sys/powerpc/aim/swtch.S b/sys/powerpc/aim/swtch.S
index cf82169..e02367a 100644
--- a/sys/powerpc/aim/swtch.S
+++ b/sys/powerpc/aim/swtch.S
@@ -121,8 +121,6 @@ ENTRY(cpu_switch)
/* thread to restore is in r3 */
.L2:
- li %r15,TDS_RUNNING
- stw %r15,TD_STATE(%r3) /* Set KSE state */
lwz %r3, TD_PCB(%r3)
lmw %r12,PCB_CONTEXT(%r3) /* Load the non-volatile GP regs */
mr %r2,%r12
diff --git a/sys/powerpc/powerpc/genassym.c b/sys/powerpc/powerpc/genassym.c
index e9dabba..81720fc 100644
--- a/sys/powerpc/powerpc/genassym.c
+++ b/sys/powerpc/powerpc/genassym.c
@@ -140,8 +140,6 @@ ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));
ASSYM(TD_PROC, offsetof(struct thread, td_proc));
ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
ASSYM(TD_KSE, offsetof(struct thread, td_kse));
-ASSYM(TD_STATE, offsetof(struct thread, td_state));
-ASSYM(TDS_RUNNING, TDS_RUNNING);
ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
diff --git a/sys/powerpc/powerpc/swtch.S b/sys/powerpc/powerpc/swtch.S
index cf82169..e02367a 100644
--- a/sys/powerpc/powerpc/swtch.S
+++ b/sys/powerpc/powerpc/swtch.S
@@ -121,8 +121,6 @@ ENTRY(cpu_switch)
/* thread to restore is in r3 */
.L2:
- li %r15,TDS_RUNNING
- stw %r15,TD_STATE(%r3) /* Set KSE state */
lwz %r3, TD_PCB(%r3)
lmw %r12,PCB_CONTEXT(%r3) /* Load the non-volatile GP regs */
mr %r2,%r12
diff --git a/sys/powerpc/powerpc/swtch.s b/sys/powerpc/powerpc/swtch.s
index cf82169..e02367a 100644
--- a/sys/powerpc/powerpc/swtch.s
+++ b/sys/powerpc/powerpc/swtch.s
@@ -121,8 +121,6 @@ ENTRY(cpu_switch)
/* thread to restore is in r3 */
.L2:
- li %r15,TDS_RUNNING
- stw %r15,TD_STATE(%r3) /* Set KSE state */
lwz %r3, TD_PCB(%r3)
lmw %r12,PCB_CONTEXT(%r3) /* Load the non-volatile GP regs */
mr %r2,%r12
diff --git a/sys/sparc64/sparc64/genassym.c b/sys/sparc64/sparc64/genassym.c
index eee4abc..4f47a75 100644
--- a/sys/sparc64/sparc64/genassym.c
+++ b/sys/sparc64/sparc64/genassym.c
@@ -232,8 +232,6 @@ ASSYM(TD_KSE, offsetof(struct thread, td_kse));
ASSYM(TD_KSTACK, offsetof(struct thread, td_kstack));
ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
ASSYM(TD_PROC, offsetof(struct thread, td_proc));
-ASSYM(TD_STATE, offsetof(struct thread, td_state));
-ASSYM(TDS_RUNNING, TDS_RUNNING);
ASSYM(PCB_SIZEOF, sizeof(struct pcb));
ASSYM(PCB_FPSTATE, offsetof(struct pcb, pcb_fpstate));
diff --git a/sys/sparc64/sparc64/swtch.S b/sys/sparc64/sparc64/swtch.S
index a8a753a..429e961 100644
--- a/sys/sparc64/sparc64/swtch.S
+++ b/sys/sparc64/sparc64/swtch.S
@@ -109,9 +109,6 @@ ENTRY(cpu_switch)
stx %o0, [PCPU(CURTHREAD)]
stx %o1, [PCPU(CURPCB)]
- mov TDS_RUNNING, %o2
- stw %o2, [%o0 + TD_STATE]
-
SET(sched_lock, %o3, %o2)
stx %o0, [%o2 + MTX_LOCK]
diff --git a/sys/sparc64/sparc64/swtch.s b/sys/sparc64/sparc64/swtch.s
index a8a753a..429e961 100644
--- a/sys/sparc64/sparc64/swtch.s
+++ b/sys/sparc64/sparc64/swtch.s
@@ -109,9 +109,6 @@ ENTRY(cpu_switch)
stx %o0, [PCPU(CURTHREAD)]
stx %o1, [PCPU(CURPCB)]
- mov TDS_RUNNING, %o2
- stw %o2, [%o0 + TD_STATE]
-
SET(sched_lock, %o3, %o2)
stx %o0, [%o2 + MTX_LOCK]
OpenPOWER on IntegriCloud