diff options
author | Jonathan Mini <mini@FreeBSD.org> | 2002-09-16 19:28:01 +0000 |
---|---|---|
committer | Jonathan Mini <mini@FreeBSD.org> | 2002-09-16 19:28:01 +0000 |
commit | a3ad85e51b8dbb685ea451e3129cd39a84e9dcf7 (patch) | |
tree | cc10e1243ba2d04a18c1c1d27702a8b1d595ee08 /sys/sys/kse.h | |
parent | c76e33b68184b098311dd5841fff2e20df049249 (diff) | |
download | src-a3ad85e51b8dbb685ea451e3129cd39a84e9dcf7.tar.gz src-a3ad85e51b8dbb685ea451e3129cd39a84e9dcf7.zip |
Add kernel support needed for the KSE-aware libpthread:
- Use ucontext_t's to store KSE thread state.
- Synthesize state for the UTS upon each upcall, rather than
saving and copying a trapframe.
- Save and restore FPU state properly in ucontext_t's.
- Deliver signals to KSE-aware processes via upcall.
- Rename kse mailbox structure fields to be more BSD-like.
- Store the UTS's stack in struct proc in a stack_t.
Reviewed by: bde, deischen, julian
Approved by: -arch
Notes
Notes:
svn path=/head/; revision=103411
Diffstat (limited to 'sys/sys/kse.h')
-rw-r--r-- | sys/sys/kse.h | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/sys/sys/kse.h b/sys/sys/kse.h index ac58a6c3b63f..9b225bd3dba3 100644 --- a/sys/sys/kse.h +++ b/sys/sys/kse.h @@ -32,8 +32,11 @@ #ifndef SYS_KSE_H #define SYS_KSE_H + #include <machine/kse.h> -/* +#include <sys/ucontext.h> + +/* * This file defines the structures needed for communication between * the userland and the kernel when running a KSE-based threading system. * The only programs that should see this file are the UTS and the kernel. @@ -41,38 +44,41 @@ struct kse_mailbox; typedef void kse_fn_t(struct kse_mailbox *mbx); -/* - * Each userland thread has one of these buried in it's - * Thread control structure somewhere. +/* + * Thread mailbox. + * + * This describes a user thread to the kernel scheduler. */ -struct thread_mailbox -{ - struct thread_mailbox *next_completed; - unsigned int flags; - void *UTS_handle; /* The UTS can use this for anything */ - union kse_td_ctx ctx; /* thread's saved context goes here. */ +struct thread_mailbox { + ucontext_t tm_context; /* User and machine context */ + unsigned int tm_flags; /* Thread flags */ + struct thread_mailbox *tm_next; /* Next thread in list */ + void *tm_udata; /* For use by the UTS */ + int tm_spare[8]; }; -/* - * You need to supply one of these as the argument to the - * kse_new() system call. +/* + * KSE mailbox. + * + * Cummunication path between the UTS and the kernel scheduler specific to + * a single KSE. */ -struct kse_mailbox -{ - kse_fn_t *kmbx_upcall; - char *kmbx_stackbase; - unsigned long int kmbx_stacksize; - struct thread_mailbox *kmbx_current_thread; - struct thread_mailbox *kmbx_completed_threads; - unsigned int kmbx_flags; - void *kmbx_UTS_handle; /* UTS can use this for anything */ +struct kse_mailbox { + struct thread_mailbox *km_curthread; /* Currently running thread */ + struct thread_mailbox *km_completed; /* Threads back from kernel */ + sigset_t km_sigscaught; /* Caught signals */ + unsigned int km_flags; /* KSE flags */ + void *km_func; /* UTS function */ + stack_t km_stack; /* UTS context */ + void *km_udata; /* For use by the UTS */ + int tm_spare[8]; }; -#define KEMBXF_CRITICAL 0x00000001 -struct kse_global_mailbox -{ - unsigned int flags; -}; -#define GMBXF_CRITICAL 0x00000001 +#ifndef _KERNEL +int kse_exit(void); +int kse_wakeup(void); +int kse_new(struct kse_mailbox *, int); +int kse_yield(void); +#endif #endif |