Warning, cross-references for /kernel/include/sched/sched.h need to be fixed.
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef _SCHED_H_
0019 #define _SCHED_H_
0020
0021 #include "kernel.h"
0022 #include "arch/i386-percpu.h"
0023 #include "sched/sched-defs.h"
0024
0025 extern void runqueue_append (uint32 prio, uint16 selector);
0026 extern void queue_append (uint16 * queue, uint16 selector);
0027 extern uint16 queue_remove_head (uint16 * queue);
0028 extern void (*schedule) (void);
0029 extern void (*wakeup) (uint16);
0030 extern void wakeup_queue (uint16 *);
0031
0032 extern void sched_usleep (uint32);
0033 extern void process_sleepqueue (void);
0034
0035 extern DEF_PER_CPU (task_id, current_task);
0036 static inline task_id
0037 str (void)
0038 {
0039 return percpu_read (current_task);
0040 }
0041 static inline void
0042 ltr (task_id id)
0043 {
0044 percpu_write (current_task, id);
0045 }
0046
0047 static inline void
0048 software_context_switch (task_id next)
0049 {
0050 u16 tr = percpu_read (current_task);
0051 tss *cur_TSS = (tr == 0 ? NULL : (tss *) lookup_TSS (tr));
0052 tss *nxt_TSS = (tss *) lookup_TSS (next);
0053
0054 percpu_write (current_task, next);
0055
0056 asm volatile ("call _sw_jmp_task":
0057 :"S" (cur_TSS), "D" (nxt_TSS)
0058 :"eax", "ebx", "ecx", "edx");
0059 }
0060
0061
0062 #endif
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073