PERFORCE change 55899 for review
David Xu
davidxu at FreeBSD.org
Sun Jun 27 05:02:50 GMT 2004
http://perforce.freebsd.org/chv.cgi?CH=55899
Change 55899 by davidxu at davidxu_alona on 2004/06/27 05:01:23
Hand off lwpid to thread at context switching time.
Affected files ...
.. //depot/projects/davidxu_ksedbg/src/lib/libpthread/arch/amd64/include/pthread_md.h#2 edit
.. //depot/projects/davidxu_ksedbg/src/lib/libpthread/arch/i386/include/pthread_md.h#2 edit
.. //depot/projects/davidxu_ksedbg/src/lib/libpthread/arch/ia64/include/pthread_md.h#2 edit
Differences ...
==== //depot/projects/davidxu_ksedbg/src/lib/libpthread/arch/amd64/include/pthread_md.h#2 (text+ko) ====
@@ -235,17 +235,31 @@
static __inline int
_thread_switch(struct kcb *kcb, struct tcb *tcb, int setmbox)
{
+ extern int _libkse_debug;
+ mcontext_t *mc;
+
if ((kcb == NULL) || (tcb == NULL))
return (-1);
kcb->kcb_curtcb = tcb;
- if (setmbox != 0)
- _amd64_restore_context(&tcb->tcb_tmbx.tm_context.uc_mcontext,
- (intptr_t)&tcb->tcb_tmbx,
- (intptr_t *)&kcb->kcb_kmbx.km_curthread);
- else
- _amd64_restore_context(&tcb->tcb_tmbx.tm_context.uc_mcontext,
- 0, NULL);
- /* We should not reach here. */
+ mc = &tcb->tcb_tmbx.tm_context.uc_mcontext;
+
+ if (_libkse_debug == 0) {
+ tcb->tcb_tmbx.tm_lwp = kcb->kcb_kmbx.km_lwp;
+ if (setmbox != 0)
+ _amd64_restore_context(&tcb->tcb_tmbx.tm_context.uc_mcontext,
+ (intptr_t)&tcb->tcb_tmbx,
+ (intptr_t *)&kcb->kcb_kmbx.km_curthread);
+ else
+ _amd64_restore_context(&tcb->tcb_tmbx.tm_context.uc_mcontext,
+ 0, NULL);
+ /* We should not reach here. */
+ } else {
+ if (setmbox)
+ kse_switchin(&tcb->tcb_tmbx, KSE_SWITCHIN_SETTMBX);
+ else
+ kse_switchin(&tcb->tcb_tmbx, 0);
+ }
+
return (-1);
}
#endif
==== //depot/projects/davidxu_ksedbg/src/lib/libpthread/arch/i386/include/pthread_md.h#2 (text+ko) ====
@@ -237,16 +237,30 @@
static __inline int
_thread_switch(struct kcb *kcb, struct tcb *tcb, int setmbox)
{
+ extern int _libkse_debug;
+ mcontext_t *mc;
+
if ((kcb == NULL) || (tcb == NULL))
return (-1);
kcb->kcb_curtcb = tcb;
- if (setmbox != 0)
- _thr_setcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext,
- (intptr_t)&tcb->tcb_tmbx,
- (intptr_t *)&kcb->kcb_kmbx.km_curthread);
- else
- _thr_setcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext, 0, NULL);
- /* We should not reach here. */
+ mc = &tcb->tcb_tmbx.tm_context.uc_mcontext;
+ if (_libkse_debug == 0) {
+ tcb->tcb_tmbx.tm_lwp = kcb->kcb_kmbx.km_lwp;
+ if (setmbox != 0)
+ _thr_setcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext,
+ (intptr_t)&tcb->tcb_tmbx,
+ (intptr_t *)&kcb->kcb_kmbx.km_curthread);
+ else
+ _thr_setcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext,
+ 0, NULL);
+ /* We should not reach here. */
+ } else {
+ if (setmbox)
+ kse_switchin(&tcb->tcb_tmbx, KSE_SWITCHIN_SETTMBX);
+ else
+ kse_switchin(&tcb->tcb_tmbx, 0);
+ }
+
return (-1);
}
==== //depot/projects/davidxu_ksedbg/src/lib/libpthread/arch/ia64/include/pthread_md.h#2 (text+ko) ====
@@ -234,10 +234,9 @@
_ia64_break_setcontext(mc);
} else if (mc->mc_flags & _MC_FLAGS_SYSCALL_CONTEXT) {
if (setmbox)
- kse_switchin(mc, (long)&tcb->tcb_tmbx,
- (long *)&kcb->kcb_kmbx.km_curthread);
+ kse_switchin(&tcb->tcb_tmbx, KSE_SWITCHIN_SETTMBX);
else
- kse_switchin(mc, 0L, NULL);
+ kse_switchin(&tcb->tcb_tmbx, 0);
} else {
if (setmbox)
_ia64_restore_context(mc, (intptr_t)&tcb->tcb_tmbx,
More information about the p4-projects
mailing list