From owner-p4-projects@FreeBSD.ORG Wed Jun 4 12:10:01 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CD8BA1065673; Wed, 4 Jun 2008 12:10:00 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B7F91065671 for ; Wed, 4 Jun 2008 12:10:00 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 746648FC19 for ; Wed, 4 Jun 2008 12:10:00 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m54CA0fQ060805 for ; Wed, 4 Jun 2008 12:10:00 GMT (envelope-from weongyo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m54CA06E060803 for perforce@freebsd.org; Wed, 4 Jun 2008 12:10:00 GMT (envelope-from weongyo@FreeBSD.org) Date: Wed, 4 Jun 2008 12:10:00 GMT Message-Id: <200806041210.m54CA06E060803@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to weongyo@FreeBSD.org using -f From: Weongyo Jeong To: Perforce Change Reviews Cc: Subject: PERFORCE change 142883 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jun 2008 12:10:01 -0000 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