4 #include <kern/types.h>
7 #include <kern/sched.h>
10 #include <arch/thread.h>
12 #include <util/list.h>
20 // This must be first.
21 Arch::ArchThread arch;
23 // If the thread is currently running, this contains the time of
24 // the context switch when the thread most recently started
29 // This contains the time in ns that the thread has remaining in
30 // its current timeslice.
34 // The current timeslice length in ns. For timeshared tasks, this
35 // is simply the priority scaled linearly.
39 // Real-time and timeshared priorities
41 // Real-time priorities go from 0 to 255, with 0 indicating a
44 // Static timeshared priorities go from 1 to 16; they determine the
45 // timeslice of a task (not including interactivity bonuses). The
46 // default is 8. The dynamic timeshared priority is the priority
47 // associated with time_left as of the last global timeslice
48 // replenishment or wake-up, and ranges from 1 to 31. If the
49 // static priority is x, the dynamic priority is within the range
52 int rt_prio, ts_static_prio, ts_prio, last_replenish;
60 ThreadBlocker *blocked_on;
61 Util::List runqueue_node;
70 void charge(Time::Time &now);
75 Util::List threadlist_node;
76 Mem::ProcAddrSpace *addr_space, *active_addr_space;
85 internal_orbstack_frames = 8
88 ORB::CallStackHeader orbstack;
89 ORB::CallFrame orbstackframes[internal_orbstack_frames];
91 // The header and frame of the method invocation at the top of
92 // the stack. FIXME: add a lock aronud these if other threads
93 // can read these to do a traceback/traceforward.
95 ORB::CallStackHeader *orbstack_top_hdr;
96 int orbstack_top; // Index into orbstack_top_hdr->frames[]
100 void block(ThreadBlocker *blocker);
104 friend class WaitQueue;
106 friend void Arch::switch_thread(Thread *dest, Thread *src);
108 // FIXME: temp hack; use a Process later
110 void set_aspace(Mem::ProcAddrSpace *aspace);
114 thread_size = sizeof(Thread) + 7 / 8
118 #include <arch/current.h>
119 #define curthread (::Arch::get_current_thread())
122 inline bool Lock::held_by_curthread()
124 return lockval == reinterpret_cast<ulong>(curthread);