proc_p.h
Go to the documentation of this file.00001
00040 #ifndef KERN_PROC_P_H
00041 #define KERN_PROC_P_H
00042
00043 #include "cfg/cfg_kern.h"
00044 #include <cfg/compiler.h>
00045
00046 #include <cpu/types.h>
00047
00048 #include <struct/list.h>
00049
00050 #if CONFIG_KERN_PREEMPT
00051 #include <ucontext.h>
00052 #endif
00053
00054 typedef struct Process
00055 {
00056 #if CONFIG_KERN_PRI
00057 PriNode link;
00058 #else
00059 Node link;
00060 #endif
00061 cpu_stack_t *stack;
00062 iptr_t user_data;
00064 #if CONFIG_KERN_SIGNALS
00065 sigmask_t sig_wait;
00066 sigmask_t sig_recv;
00067 #endif
00068
00069 #if CONFIG_KERN_HEAP
00070 uint16_t flags;
00071 #endif
00072
00073 #if CONFIG_KERN_HEAP | CONFIG_KERN_MONITOR | (ARCH & ARCH_EMUL)
00074 cpu_stack_t *stack_base;
00075 size_t stack_size;
00076 #endif
00077
00078 #if CONFIG_KERN_PREEMPT
00079 ucontext_t context;
00080 #endif
00081
00082 #if CONFIG_KERN_MONITOR
00083 struct ProcMonitor
00084 {
00085 Node link;
00086 const char *name;
00087 } monitor;
00088 #endif
00089
00090 } Process;
00091
00092
00097 #define PF_FREESTACK BV(0)
00098
00099
00100
00102 extern REGISTER Process *CurrentProcess;
00103
00109 extern REGISTER List ProcReadyList;
00110
00111 #if CONFIG_KERN_PRI
00112 #define SCHED_ENQUEUE_INTERNAL(proc) LIST_ENQUEUE(&ProcReadyList, &(proc)->link)
00113 #else
00114 #define SCHED_ENQUEUE_INTERNAL(proc) ADDTAIL(&ProcReadyList, &(proc)->link)
00115 #endif
00116
00126 #define SCHED_ENQUEUE(proc) do { \
00127 IRQ_ASSERT_DISABLED(); \
00128 LIST_ASSERT_VALID(&ProcReadyList); \
00129 SCHED_ENQUEUE_INTERNAL(proc); \
00130 } while (0)
00131
00132
00134 void proc_switch(void);
00135
00136 #if CONFIG_KERN_PREEMPT
00137 void proc_entry(void (*user_entry)(void));
00138 void preempt_init(void);
00139 #endif
00140
00141 #if CONFIG_KERN_MONITOR
00142
00143 void monitor_init(void);
00144
00146 void monitor_add(Process *proc, const char *name);
00147
00149 void monitor_remove(Process *proc);
00150
00152 void monitor_rename(Process *proc, const char *name);
00153 #endif
00154
00155 #endif