16static struct thread *refer_thread(
int thid,
int current);
33 return KE_ILLEGAL_CONTEXT;
36 if (thparam->attr & ~(TH_ASM | TH_C | TH_UMODE | TH_NO_FILLSTACK | TH_CLEAR_STACK)) {
37 return KE_ILLEGAL_ATTR;
40 if (thparam->priority > 126) {
41 return KE_ILLEGAL_PRIORITY;
44 if ((u32)thparam->thread & 3) {
45 return KE_ILLEGAL_ENTRY;
48 if (thparam->stacksize < 0x130) {
49 return KE_ILLEGAL_STACK_SIZE;
60 thparam->stacksize = ALIGN_256(thparam->stacksize);
61 stack = AllocSysMemory(1, thparam->stacksize, 0);
68 thread->tag.id = ++thctx.thread_id;
69 thread->entry = thparam->thread;
70 thread->stack_size = thparam->stacksize;
72 thread->init_priority = thparam->priority;
73 thread->attr = thparam->attr;
74 thread->option = thparam->option;
75 thread->status = THS_DORMANT;
77 asm __volatile__(
"sw $gp, %0\n"
80 list_insert(&thctx.thread_list, &
thread->thread_list);
82 if ((
thread->attr & TH_NO_FILLSTACK) == 0) {
84 memset(
thread->stack_top, 0xff,
thread->stack_size - 0x30);
89 return MAKE_HANDLE(
thread);
92int DeleteThread(
int thid)
98 return KE_ILLEGAL_CONTEXT;
102 return KE_ILLEGAL_THID;
107 thread = HANDLE_PTR(thid);
108 if (!HANDLE_VERIFY(thid, TAG_THREAD) ||
thread == thctx.idle_thread) {
110 return KE_UNKNOWN_THID;
113 if (
thread->status != THS_DORMANT) {
115 return KE_NOT_DORMANT;
118 if (
thread->attr & TH_CLEAR_STACK) {
122 FreeSysMemory(
thread->stack_top);
123 list_remove(&
thread->queue);
124 list_remove(&
thread->thread_list);
132int StartThread(
int thid,
void *arg)
139 return KE_ILLEGAL_CONTEXT;
143 return KE_ILLEGAL_THID;
148 thread = HANDLE_PTR(thid);
149 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
151 return KE_UNKNOWN_THID;
154 if (
thread->status != THS_DORMANT) {
156 return KE_NOT_DORMANT;
160 reg_offset = ALIGN(
thread->stack_size) - RESERVED_REGCTX_SIZE;
162 memset(
thread->saved_regs, 0, RESERVED_REGCTX_SIZE);
164 thread->saved_regs->a0 = (u32)arg;
166 return thread_init_and_start(
thread, state);
169int StartThreadArgs(
int thid,
int args,
void *argp)
172 u32 arg_offset, reg_offset;
176 return KE_ILLEGAL_CONTEXT;
180 return KE_ILLEGAL_THID;
185 thread = HANDLE_PTR(thid);
186 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
188 return KE_UNKNOWN_THID;
191 if (
thread->status != THS_DORMANT) {
193 return KE_NOT_DORMANT;
197 arg_offset = ALIGN(
thread->stack_size) - ALIGN(args);
198 if (args > 0 && argp) {
199 memcpy(
thread->stack_top + arg_offset, argp, args);
206 reg_offset = arg_offset - RESERVED_REGCTX_SIZE;
209 memset(
thread->saved_regs, 0, RESERVED_REGCTX_SIZE);
211 thread->saved_regs->a0 = args;
212 thread->saved_regs->a1 = (u32)
thread->stack_top + arg_offset;
214 return thread_init_and_start(
thread, state);
222 return KE_ILLEGAL_CONTEXT;
226 thctx.current_thread->status = THS_DORMANT;
227 list_insert(&thctx.dormant_queue, &thctx.current_thread->queue);
228 thctx.run_next = NULL;
229 thread_leave(0, 0, state, 1);
231 Kprintf(
"panic ! Thread DORMANT !\n");
237int ExitDeleteThread()
242 return KE_ILLEGAL_CONTEXT;
246 thctx.current_thread->status = THS_DORMANT;
247 list_insert(&thctx.delete_queue, &thctx.current_thread->queue);
248 thctx.run_next = NULL;
249 thread_leave(0, 0, state, 1);
251 Kprintf(
"panic ! Thread ExitDeleted !\n");
257int TerminateThread(
int thid)
263 return KE_ILLEGAL_CONTEXT;
268 thread = HANDLE_PTR(thid);
269 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
271 return KE_UNKNOWN_THID;
274 if (
thread->status == THS_DORMANT) {
279 if (
thread->status == THS_READY) {
282 list_remove(&
thread->queue);
283 if (
thread->wait_type == TSW_DELAY) {
284 CancelAlarm(thread_delay_cb,
thread);
285 }
else if (
thread->wait_type >= TSW_DELAY &&
thread->wait_type <= TSW_FPL) {
286 thread->wait_event->waiter_count--;
290 thread->status = THS_DORMANT;
291 list_insert(&thctx.dormant_queue, &
thread->queue);
297int iTerminateThread(
int thid)
302 return KE_ILLEGAL_CONTEXT;
306 return KE_ILLEGAL_THID;
309 thread = HANDLE_PTR(thid);
310 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
311 return KE_UNKNOWN_THID;
314 if (
thread->status == THS_DORMANT) {
318 if (
thread == thctx.current_thread) {
319 thctx.run_next = NULL;
321 if (
thread->status == THS_READY) {
324 list_remove(&
thread->queue);
326 if (
thread->status == THS_WAIT) {
327 if (
thread->wait_type == TSW_DELAY) {
328 iCancelAlarm(thread_delay_cb,
thread);
330 thread->wait_event->waiter_count--;
336 thread->status = THS_DORMANT;
337 list_insert(&thctx.dormant_queue, &
thread->queue);
342int DisableDispatchThread(
void)
347int EnableDispatchThread(
void)
352int ChangeThreadPriority(
int thid,
int priority)
358 return KE_ILLEGAL_CONTEXT;
364 thread = thctx.current_thread;
366 thread = HANDLE_PTR(thid);
367 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
369 return KE_UNKNOWN_THID;
372 if (
thread->status == THS_DORMANT) {
379 if (priority - 1 >= 126) {
381 return KE_ILLEGAL_PRIORITY;
384 priority = thctx.current_thread->priority;
387 if (
thread == thctx.current_thread) {
388 if (priority >= readyq_highest()) {
389 thread->status = THS_READY;
390 thread->priority = priority;
391 readyq_insert_back(
thread);
392 thctx.run_next = NULL;
394 return thread_leave(KE_OK, 0, state, 0);
397 thread->priority = priority;
399 if (
thread->status == THS_READY) {
401 thread->priority = priority;
403 return thread_start(
thread, state);
411 if (
thread->status == THS_WAIT &&
thread->wait_type != TSW_DELAY) {
412 if (
thread->wait_event->attr & SA_THPRI) {
422int iChangeThreadPriority(
int thid,
int priority)
427 return KE_ILLEGAL_CONTEXT;
431 return KE_ILLEGAL_THID;
434 thread = HANDLE_PTR(thid);
435 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
436 return KE_UNKNOWN_THID;
439 if (
thread->status == THS_DORMANT) {
444 priority = thctx.current_thread->priority;
447 if (priority - 1 >= 126) {
448 return KE_ILLEGAL_PRIORITY;
451 if (
thread == thctx.current_thread) {
452 thread->status = THS_READY;
454 if (
thread->status != THS_READY) {
455 thread->priority = priority;
456 if (
thread->status != THS_WAIT ||
thread->wait_type == TSW_DELAY) {
460 if ((
thread->wait_event->attr & 1) == 0) {
468 thread->priority = priority;
469 readyq_insert_back(
thread);
470 thctx.run_next = NULL;
475int RotateThreadReadyQueue(
int priority)
481 return KE_ILLEGAL_CONTEXT;
484 if (priority >= 127) {
485 return KE_ILLEGAL_PRIORITY;
490 thread = thctx.current_thread;
493 priority =
thread->priority;
496 if (list_empty(&thctx.ready_queue[priority])) {
501 if (priority !=
thread->priority) {
502 thread = list_first_entry(&thctx.ready_queue[priority],
struct thread, queue);
503 list_remove(&
thread->queue);
504 list_insert(&thctx.ready_queue[priority], &
thread->queue);
510 thread->status = THS_READY;
511 readyq_insert_back(
thread);
513 return thread_leave(KE_OK, 0, state, 0);
516int iRotateThreadReadyQueue(
int priority)
521 return KE_ILLEGAL_CONTEXT;
524 thread = thctx.current_thread;
527 if (priority >= 126) {
528 return KE_ILLEGAL_PRIORITY;
531 priority = readyq_highest();
532 if (
thread->priority < priority) {
533 priority =
thread->priority;
537 if (list_empty(&thctx.ready_queue[priority])) {
541 if (priority ==
thread->priority) {
542 thread->status = THS_READY;
543 readyq_insert_back(
thread);
544 thctx.run_next = NULL;
546 thread = list_first_entry(&thctx.ready_queue[priority],
struct thread, queue);
547 list_remove(&
thread->queue);
548 list_insert(&thctx.ready_queue[priority], &
thread->queue);
554int ReleaseWaitThread(
int thid)
560 return KE_ILLEGAL_CONTEXT;
564 return KE_ILLEGAL_THID;
569 thread = HANDLE_PTR(thid);
570 if (
thread == thctx.current_thread) {
572 return KE_ILLEGAL_THID;
575 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
577 return KE_UNKNOWN_THID;
580 if (
thread->status != THS_WAIT) {
585 thread->saved_regs->v0 = KE_RELEASE_WAIT;
586 list_remove(&
thread->queue);
587 thread->status = THS_READY;
589 if (
thread->wait_type == TSW_DELAY) {
590 CancelAlarm(thread_delay_cb,
thread);
592 thread->wait_event->waiter_count--;
595 return thread_start(
thread, state);
598int iReleaseWaitThread(
int thid)
603 return KE_ILLEGAL_CONTEXT;
607 return KE_ILLEGAL_THID;
610 thread = HANDLE_PTR(thid);
612 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
613 return KE_UNKNOWN_THID;
616 if (
thread->status != THS_WAIT) {
620 thread->saved_regs->v0 = KE_RELEASE_WAIT;
621 list_remove(&
thread->queue);
622 thread->status = THS_READY;
624 if (
thread->wait_type == TSW_DELAY) {
625 iCancelAlarm(thread_delay_cb,
thread);
627 thread->wait_event->waiter_count--;
630 readyq_insert_back(
thread);
631 thctx.run_next = NULL;
639 return KE_ILLEGAL_CONTEXT;
642 return MAKE_HANDLE(thctx.current_thread);
645int CheckThreadStack(
void)
651 return check_thread_stack();
660 return KE_ILLEGAL_CONTEXT;
665 thread = refer_thread(thid, 1);
683 return KE_ILLEGAL_THID;
686 thread = HANDLE_PTR(thid);
688 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
689 return KE_UNKNOWN_THID;
703 return KE_ILLEGAL_CONTEXT;
706 if (
CpuSuspendIntr(&state) == KE_CPUDI && (thctx.debug_flags & 8)) {
707 Kprintf(
"WARNING: SleepThread KE_CAN_NOT_WAIT\n");
709 check_thread_stack();
711 thread = thctx.current_thread;
713 if (
thread->wakeup_count != 0) {
719 thread->status = THS_WAIT;
720 thread->wait_type = TSW_SLEEP;
721 thread->wait_event = NULL;
723 thctx.run_next = NULL;
725 list_insert(&thctx.sleep_queue, &
thread->queue);
727 return thread_leave(KE_OK, 0, state, 1);
730int WakeupThread(
int thid)
736 return KE_ILLEGAL_CONTEXT;
740 return KE_ILLEGAL_THID;
745 thread = HANDLE_PTR(thid);
746 if (
thread == thctx.current_thread) {
747 return KE_ILLEGAL_THID;
750 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
751 return KE_UNKNOWN_THID;
754 if (
thread->status == THS_DORMANT) {
759 if (
thread->status == THS_WAIT &&
thread->wait_type == TSW_SLEEP) {
760 list_remove(&
thread->queue);
761 thread->status = THS_READY;
763 return thread_start(
thread, state);
773int iWakeupThread(
int thid)
778 return KE_ILLEGAL_CONTEXT;
782 return KE_ILLEGAL_THID;
785 thread = HANDLE_PTR(thid);
786 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
787 return KE_UNKNOWN_THID;
790 if (
thread->status == THS_DORMANT) {
794 if (
thread->status == THS_WAIT &&
thread->wait_type == TSW_SLEEP) {
795 list_remove(&
thread->queue);
796 thread->status = THS_READY;
797 readyq_insert_back(
thread);
798 thctx.run_next = NULL;
806int CancelWakeupThread(
int thid)
809 int state, wakeup_count;
812 return KE_ILLEGAL_CONTEXT;
817 thread = HANDLE_PTR(thid);
818 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
820 return KE_UNKNOWN_THID;
823 thread = thctx.current_thread;
826 wakeup_count =
thread->wakeup_count;
833int iCancelWakeupThread(
int thid)
839 return KE_ILLEGAL_CONTEXT;
843 return KE_ILLEGAL_THID;
846 thread = HANDLE_PTR(thid);
847 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
848 return KE_UNKNOWN_THID;
851 wakeup_count =
thread->wakeup_count;
857int SuspendThread(
int thid)
862int iSuspendThread(
int thid)
867int ResumeThread(
int thid)
872int iResumeThread(
int thid)
877int DelayThread(
int usec)
884 return KE_ILLEGAL_CONTEXT;
887 USec2SysClock(usec, &clock);
888 if (
CpuSuspendIntr(&state) == KE_CPUDI && (thctx.debug_flags & 8)) {
889 Kprintf(
"WARNING: DelayThread KE_CAN_NOT_WAIT\n");
891 check_thread_stack();
893 thread = thctx.current_thread;
895 ret = SetAlarm(&clock, thread_delay_cb,
thread);
901 thread->status = THS_WAIT;
902 thread->wait_type = TSW_DELAY;
903 thread->wait_usecs = usec;
906 thctx.run_next = NULL;
907 list_insert(&thctx.delay_queue, &
thread->queue);
909 return thread_leave(KE_OK, 0, state, 1);
918int SetAlarm(
iop_sys_clock_t *sys_clock,
unsigned int (*alarm_cb)(
void *),
void *arg)
926 return KE_ILLEGAL_CONTEXT;
931 if (!list_empty(&thctx.alarm)) {
932 list_for_each (
alarm, &thctx.alarm, alarm_list) {
933 if (
alarm->cb == alarm_cb &&
alarm->userptr == arg) {
935 return KE_FOUND_HANDLER;
940 alarm = alarm_alloc();
946 if (sys_clock->hi == 0 && sys_clock->lo < thctx.min_wait) {
947 sys_clock->lo = thctx.min_wait;
950 GetSystemTime(&systime);
953 alarm->target = add64(sys_clock->hi, sys_clock->lo, systime.hi, systime.lo);
954 alarm->cb = alarm_cb;
955 alarm->userptr = arg;
957 alarm_insert(&thctx.alarm,
alarm);
959 GetSystemTime(&systime);
960 time = as_u64(systime.hi, systime.lo);
961 update_timer_compare(thctx.timer_id, time, &thctx.alarm);
968int iSetAlarm(
iop_sys_clock_t *sys_clock,
unsigned int (*alarm_cb)(
void *),
void *arg)
975 return KE_ILLEGAL_CONTEXT;
978 list_for_each (
alarm, &thctx.alarm, alarm_list) {
979 if (
alarm->cb == alarm_cb &&
alarm->userptr == arg) {
980 return KE_FOUND_HANDLER;
984 alarm = alarm_alloc();
989 if (sys_clock->hi == 0 && sys_clock->lo < thctx.min_wait) {
990 sys_clock->lo = thctx.min_wait;
993 read_sys_time(&systime);
995 alarm->target = add64(sys_clock->hi, sys_clock->lo, systime.hi, systime.lo);
996 alarm->cb = alarm_cb;
997 alarm->userptr = arg;
999 alarm_insert(&thctx.alarm,
alarm);
1000 read_sys_time(&systime);
1001 time = as_u64(systime.hi, systime.lo);
1002 update_timer_compare(thctx.timer_id, time, &thctx.alarm);
1007int CancelAlarm(
unsigned int (*alarm_cb)(
void *),
void *arg)
1013 return KE_ILLEGAL_CONTEXT;
1018 if (list_empty(&thctx.alarm)) {
1020 return KE_NOTFOUND_HANDLER;
1023 list_for_each (
alarm, &thctx.alarm, alarm_list) {
1024 if (
alarm->cb == alarm_cb &&
alarm->userptr == arg) {
1025 list_remove(&
alarm->alarm_list);
1027 thctx.alarm_count--;
1036 return KE_NOTFOUND_HANDLER;
1039int iCancelAlarm(
unsigned int (*alarm_cb)(
void *),
void *arg)
1044 return KE_ILLEGAL_CONTEXT;
1047 if (list_empty(&thctx.alarm)) {
1048 return KE_NOTFOUND_HANDLER;
1051 list_for_each (
alarm, &thctx.alarm, alarm_list) {
1052 if (
alarm->cb == alarm_cb &&
alarm->userptr == arg) {
1053 list_remove(&
alarm->alarm_list);
1055 thctx.alarm_count--;
1061 return KE_NOTFOUND_HANDLER;
1067 sys_clock->lo = usec;
1068 clock_mul(sys_clock, sys_clock, thctx.unk_clock_mult);
1069 clock_div(sys_clock, sys_clock, thctx.unk_clock_div, NULL);
1075 clock_mul(&clock, sys_clock, thctx.unk_clock_div);
1076 clock_div(&clock, &clock, thctx.unk_clock_mult, NULL);
1077 clock_div(&clock, &clock, 1000000, usec);
1081int GetSystemStatusFlag()
1083 return thctx.sytem_status_flag;
1086int GetThreadCurrentPriority(
void)
1089 return KE_ILLEGAL_CONTEXT;
1092 return thctx.current_thread->priority;
1095unsigned int GetSystemTimeLow(
void)
1097 return GetTimerCounter(thctx.timer_id);
1103 if (size <
sizeof(*
info)) {
1107 memset(
info, 0, size);
1112 info->status = TSS_NOTHREAD;
1113 }
else if (ret == KE_CPUDI) {
1114 info->status = TSS_DISABLEINTR;
1116 info->status = TSS_THREAD;
1119 info->systemLowTimerWidth = 32;
1120 info->idleClocks.hi = thctx.idle_thread->run_clocks_hi;
1121 info->idleClocks.lo = thctx.idle_thread->run_clocks_lo;
1122 info->threadSwitchCount = thctx.thread_switch_count;
1123 info->comesOutOfIdleCount = thctx.idle_thread->irq_preemption_count;
1136 return KE_ILLEGAL_CONTEXT;
1141 thread = refer_thread(thid, 1);
1147 if (size <
sizeof(*stat)) {
1149 return KE_ILLEGAL_SIZE;
1152 memset(stat, 0, size);
1153 thread_get_run_stats(
thread, stat);
1163int GetThreadStackFreeSize(
int thid)
1171 return KE_ILLEGAL_CONTEXT;
1176 thread = refer_thread(thid, 1);
1182 stack =
thread->stack_top;
1183 stack_size =
thread->stack_size / 4;
1186 for (i = 0; i < stack_size; i++) {
1187 if (stack[i] != -1) {
1196int GetThreadmanIdList(
int type,
int *readbuf,
int readbufsize,
int *objectcount)
1198 int state, write_count, obj_count;
1201 return KE_ILLEGAL_CONTEXT;
1212 list_for_each (
thread, &thctx.thread_list, thread_list) {
1213 if (
thread != thctx.idle_thread) {
1214 if (write_count < readbufsize) {
1215 *readbuf++ = MAKE_HANDLE(
thread);
1222 case TMID_Semaphore: {
1224 list_for_each (sema, &thctx.semaphore, sema_list) {
1225 if (write_count < readbufsize) {
1226 *readbuf++ = MAKE_HANDLE(sema);
1232 case TMID_EventFlag: {
1234 list_for_each (evf, &thctx.event_flag, evf_list) {
1235 if (write_count < readbufsize) {
1236 *readbuf++ = MAKE_HANDLE(evf);
1244 list_for_each (mbx, &thctx.mbox, mbox_list) {
1245 if (write_count < readbufsize) {
1246 *readbuf++ = MAKE_HANDLE(mbx);
1254 list_for_each (vpl, &thctx.vpool, vpl_list) {
1255 if (write_count < readbufsize) {
1256 *readbuf++ = MAKE_HANDLE(vpl);
1264 list_for_each (fpl, &thctx.fpool, fpl_list) {
1265 if (write_count < readbufsize) {
1266 *readbuf++ = MAKE_HANDLE(fpl);
1272 case TMID_SleepThread: {
1274 list_for_each (
thread, &thctx.sleep_queue, queue) {
1275 if (write_count < readbufsize) {
1276 *readbuf++ = MAKE_HANDLE(
thread);
1282 case TMID_DelayThread: {
1284 list_for_each (
thread, &thctx.delay_queue, queue) {
1285 if (write_count < readbufsize) {
1286 *readbuf++ = MAKE_HANDLE(
thread);
1292 case TMID_DormantThread: {
1294 list_for_each (
thread, &thctx.dormant_queue, queue) {
1295 if (write_count < readbufsize) {
1296 *readbuf++ = MAKE_HANDLE(
thread);
1303 struct heaptag *tag = HANDLE_PTR(type);
1307 if (type < 0 || tag->tag < TAG_SEMA || tag->tag > TAG_FPL || tag->id != HANDLE_ID(type)) {
1309 return KE_ILLEGAL_TYPE;
1314 event = &((
struct semaphore *)tag)->event;
1320 event = &((
struct mbox *)tag)->event;
1323 event = &((
struct vpool *)tag)->event;
1326 event = &((
struct fpool *)tag)->event;
1331 if (write_count < readbufsize) {
1332 *readbuf++ = MAKE_HANDLE(
thread);
1343 *objectcount = obj_count;
1352 res = (u64)src->hi << 32 | src->lo;
1355 dst->hi = res >> 32;
1380 for (i = 0; i < 4; ++i) {
1381 v11 = (v8 << 8) | (lo >> 24);
1384 v4 = (v4 << 8) | (v9 >> 24);
1387 v9 = (v9 << 8) + v12;
1399static struct thread *refer_thread(
int thid,
int current)
1403 if (!thid && current) {
1404 return thctx.current_thread;
1407 thread = HANDLE_PTR(thid);
1408 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
1409 return (
struct thread *)KE_UNKNOWN_THID;
1428 if (
thread->status == THS_WAIT) {
1430 if (
thread->wait_type == TSW_DELAY) {
1433 switch (
thread->wait_type) {
1458 info->regContext = 0;
1460 info->regContext = (
long *)
thread->saved_regs;
1466 stat->status =
thread->status;
1467 stat->currentPriority =
thread->priority;
1469 if (
thread->status == THS_WAIT) {
1470 stat->waitType =
thread->wait_type;
1471 if (
thread->wait_type == TSW_DELAY) {
1472 stat->waitId =
thread->wait_usecs;
1474 switch (
thread->wait_type) {
1482 stat->waitId = MAKE_HANDLE(container_of(
thread->wait_event,
struct mbox,
event));
1485 stat->waitId = MAKE_HANDLE(container_of(
thread->wait_event,
struct fpool,
event));
1488 stat->waitId = MAKE_HANDLE(container_of(
thread->wait_event,
struct vpool,
event));
1497 stat->wakeupCount =
thread->wakeup_count;
1499 stat->regContext = (
long *)
thread->saved_regs;
1502 stat->runClocks.hi =
thread->run_clocks_hi;
1503 stat->runClocks.lo =
thread->run_clocks_lo;
1504 stat->intrPreemptCount =
thread->irq_preemption_count;
1505 stat->threadPreemptCount =
thread->thread_preemption_count;
1506 stat->releaseCount =
thread->release_count;
int CpuResumeIntr(int state)
int CpuInvokeInKmode(void *function,...)
int QueryIntrContext(void)
int CpuSuspendIntr(int *state)