Change kse_switchin to accept kse_thr_mailbox pointer, the syscall
will be used heavily in debugging KSE threads. This breaks libpthread on IA64, but because libpthread was not in 5.2.1 release, I would like to change it so we needn't to introduce another syscall.
This commit is contained in:
parent
e5996857ad
commit
507b03186a
@ -126,25 +126,36 @@ upcall_remove(struct thread *td)
|
||||
|
||||
#ifndef _SYS_SYSPROTO_H_
|
||||
struct kse_switchin_args {
|
||||
const struct __mcontext *mcp;
|
||||
long val;
|
||||
long *loc;
|
||||
struct kse_thr_mailbox *tmbx;
|
||||
int flags;
|
||||
};
|
||||
#endif
|
||||
|
||||
int
|
||||
kse_switchin(struct thread *td, struct kse_switchin_args *uap)
|
||||
{
|
||||
mcontext_t mc;
|
||||
struct kse_thr_mailbox tmbx;
|
||||
struct kse_upcall *ku;
|
||||
int error;
|
||||
|
||||
error = (uap->mcp == NULL) ? EINVAL : 0;
|
||||
if ((ku = td->td_upcall) == NULL || TD_CAN_UNBIND(td))
|
||||
return (EINVAL);
|
||||
error = (uap->tmbx == NULL) ? EINVAL : 0;
|
||||
if (!error)
|
||||
error = copyin(uap->mcp, &mc, sizeof(mc));
|
||||
if (!error && uap->loc != NULL)
|
||||
error = (suword(uap->loc, uap->val) != 0) ? EINVAL : 0;
|
||||
error = copyin(uap->tmbx, &tmbx, sizeof(tmbx));
|
||||
if (!error && (uap->flags & KSE_SWITCHIN_SETTMBX))
|
||||
error = (suword(&ku->ku_mailbox->km_curthread,
|
||||
(long)uap->tmbx) != 0 ? EINVAL : 0);
|
||||
if (!error)
|
||||
error = set_mcontext(td, &mc);
|
||||
error = set_mcontext(td, &tmbx.tm_context.uc_mcontext);
|
||||
if (!error) {
|
||||
if (uap->flags & KSE_SWITCHIN_SETTMBX) {
|
||||
td->td_mailbox = uap->tmbx;
|
||||
mtx_lock_spin(&sched_lock);
|
||||
td->td_flags |= TDF_CAN_UNBIND;
|
||||
mtx_unlock_spin(&sched_lock);
|
||||
}
|
||||
}
|
||||
return ((error == 0) ? EJUSTRETURN : error);
|
||||
}
|
||||
|
||||
|
@ -626,8 +626,8 @@
|
||||
int attrnamespace, void *data, size_t nbytes); }
|
||||
439 STD { ssize_t extattr_list_link(const char *path, \
|
||||
int attrnamespace, void *data, size_t nbytes); }
|
||||
440 MSTD { int kse_switchin(const struct __mcontext *mcp, \
|
||||
long val, long *loc); }
|
||||
440 MSTD { int kse_switchin(struct kse_thr_mailbox *tmbx, \
|
||||
int flags); }
|
||||
441 MNOSTD { int ksem_timedwait(semid_t id, struct timespec *abstime); }
|
||||
442 MSTD { int thr_suspend(const struct timespec *timeout); }
|
||||
443 MSTD { int thr_wake(long id); }
|
||||
|
@ -96,6 +96,9 @@ struct kse_mailbox {
|
||||
/* These flags are kept in tm_flags */
|
||||
#define TMF_NOUPCALL 0x01
|
||||
|
||||
/* Flags for kse_switchin */
|
||||
#define KSE_SWITCHIN_SETTMBX 0x01
|
||||
|
||||
/* Commands for kse_thr_interrupt */
|
||||
#define KSE_INTR_INTERRUPT 0x01
|
||||
#define KSE_INTR_RESTART 0x02
|
||||
@ -108,7 +111,7 @@ int kse_exit(void);
|
||||
int kse_release(struct timespec *);
|
||||
int kse_thr_interrupt(struct kse_thr_mailbox *, int, long);
|
||||
int kse_wakeup(struct kse_mailbox *);
|
||||
int kse_switchin(mcontext_t *, long, long *);
|
||||
int kse_switchin(struct kse_thr_mailbox *, int flags);
|
||||
#endif /* !_KERNEL */
|
||||
|
||||
#endif /* !_SYS_KSE_H_ */
|
||||
|
@ -1289,9 +1289,8 @@ struct extattr_list_link_args {
|
||||
char nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];
|
||||
};
|
||||
struct kse_switchin_args {
|
||||
char mcp_l_[PADL_(const struct __mcontext *)]; const struct __mcontext * mcp; char mcp_r_[PADR_(const struct __mcontext *)];
|
||||
char val_l_[PADL_(long)]; long val; char val_r_[PADR_(long)];
|
||||
char loc_l_[PADL_(long *)]; long * loc; char loc_r_[PADR_(long *)];
|
||||
char tmbx_l_[PADL_(struct kse_thr_mailbox *)]; struct kse_thr_mailbox * tmbx; char tmbx_r_[PADR_(struct kse_thr_mailbox *)];
|
||||
char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
|
||||
};
|
||||
struct ksem_timedwait_args {
|
||||
char id_l_[PADL_(semid_t)]; semid_t id; char id_r_[PADR_(semid_t)];
|
||||
|
Loading…
Reference in New Issue
Block a user