Date: Wed, 4 Jun 2008 12:10:00 GMT From: Weongyo Jeong <weongyo@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 142883 for review Message-ID: <200806041210.m54CA06E060803@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=142883 Change 142883 by weongyo@weongyo_ws on 2008/06/04 12:09:43 Implement KeGetCurrentThread() and KeSetPriorityThread(). Affected files ... .. //depot/projects/ndisusb/sys/compat/ndis/ntoskrnl_var.h#3 edit .. //depot/projects/ndisusb/sys/compat/ndis/subr_ntoskrnl.c#3 edit Differences ... ==== //depot/projects/ndisusb/sys/compat/ndis/ntoskrnl_var.h#3 (text+ko) ==== @@ -534,6 +534,11 @@ #define WAITKEY_VALID 0x8000 +/* kthread priority */ +#define LOW_PRIORITY 0 +#define LOW_REALTIME_PRIORITY 16 +#define HIGH_PRIORITY 31 + struct thread_context { void *tc_thrctx; void *tc_thrfunc; ==== //depot/projects/ndisusb/sys/compat/ndis/subr_ntoskrnl.c#3 (text+ko) ==== @@ -249,6 +249,7 @@ static void DbgBreakPoint(void); static void KeBugCheckEx(uint32_t, u_long, u_long, u_long, u_long); static int32_t KeDelayExecutionThread(uint8_t, uint8_t, int64_t *); +static int32_t KeSetPriorityThread(struct thread *, int32_t); static void dummy(void); static struct mtx ntoskrnl_dispatchlock; @@ -4284,6 +4285,40 @@ return ticks * ((10000000 + hz - 1) / hz); } +static struct thread * +KeGetCurrentThread(void) +{ + + return curthread; +} + +static int32_t +KeSetPriorityThread(td, pri) + struct thread *td; + int32_t pri; +{ + int32_t old; + + if (td == NULL) + return LOW_REALTIME_PRIORITY; + + if (td->td_priority <= PRI_MIN_KERN) + old = HIGH_PRIORITY; + else if (td->td_priority >= PRI_MAX_KERN) + old = LOW_PRIORITY; + else + old = LOW_REALTIME_PRIORITY; + + if (pri == HIGH_PRIORITY) + sched_prio(td, PRI_MIN_KERN); + if (pri == LOW_REALTIME_PRIORITY) + sched_prio(td, PRI_MIN_KERN + (PRI_MAX_KERN - PRI_MIN_KERN) / 2); + if (pri == LOW_PRIORITY) + sched_prio(td, PRI_MAX_KERN); + + return old; +} + static void dummy() { @@ -4468,6 +4503,8 @@ IMPORT_CFUNC(KeTickCount, 0), IMPORT_SFUNC(KeDelayExecutionThread, 3), IMPORT_SFUNC(KeQueryInterruptTime, 0), + IMPORT_SFUNC(KeGetCurrentThread, 0), + IMPORT_SFUNC(KeSetPriorityThread, 2), /* * This last entry is a catch-all for any function we haven't
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200806041210.m54CA06E060803>