thread stage 6: Move thread stack management from the proc structure to
[dragonfly.git] / sys / sys / thread.h
1 /*
2  * SYS/THREAD.H
3  *
4  *      Implements the architecture independant portion of the LWKT 
5  *      subsystem.
6  * 
7  * $DragonFly: src/sys/sys/thread.h,v 1.2 2003/06/19 06:26:10 dillon Exp $
8  */
9
10 #ifndef _SYS_THREAD_H_
11 #define _SYS_THREAD_H_
12
13 struct proc;
14 struct thread;
15
16 typedef TAILQ_HEAD(, thread) thread_list_t;
17
18 struct thread {
19     TAILQ_ENTRY(thread) td_threadq;
20     struct proc *td_proc;       /* (optional) associated process */
21     struct pcb  *td_pcb;        /* points to pcb and top of kstack */
22     int         td_pri;         /* 0-31, 0=highest priority */
23     char        *td_kstack;     /* kernel stack */
24 #if 0
25     int         td_flags;       /* THF flags */
26     int         td_pri;         /* semi-static LWKT priority 0-31 */
27     int         td_bglcount;    /* big giant lock count */
28 #endif
29 };
30
31 typedef struct thread *thread_t;
32
33 /*
34  * Thread priorities.  Typically only one thread from any given
35  * user process scheduling queue is on the LWKT run queue at a time.
36  * Remember that there is one LWKT run queue per cpu.
37  */
38
39 #define THPRI_INT_HIGH          2       /* high priority interrupt */
40 #define THPRI_INT_MED           4       /* medium priority interrupt */
41 #define THPRI_INT_LOW           6       /* low priority interrupt */
42 #define THPRI_INT_SUPPORT       10      /* kernel / high priority support */
43 #define THPRI_SOFT_TIMER        12      /* kernel / timer */
44 #define THPRI_SOFT_NORM         15      /* kernel / normal */
45 #define THPRI_KERN_USER         20      /* kernel / block in syscall */
46 #define THPRI_USER_REAL         25      /* user scheduler real time */
47 #define THPRI_USER_NORM         27      /* user scheduler normal */
48 #define THPRI_USER_IDLE         29      /* user scheduler idle */
49 #define THPRI_IDLE_THREAD       31      /* the idle thread */
50
51 #define CACHE_NTHREADS          4
52
53 #ifdef _KERNEL
54
55 extern struct vm_zone   *thread_zone;
56
57 #endif
58
59 #endif
60