Moved KeStallExecutionProcessor() into HAL.

Added some security functions.

svn path=/trunk/; revision=1113
This commit is contained in:
Eric Kohl 2000-04-08 19:10:50 +00:00
parent 55c5bbf0be
commit 51db0e6fed
15 changed files with 132 additions and 48 deletions

View file

@ -110,7 +110,7 @@ BOOLEAN KeSetTimerEx(PKTIMER Timer,
LARGE_INTEGER DueTime,
LONG Period,
PKDPC Dpc);
VOID KeStallExecutionProcessor(ULONG MicroSeconds);
VOID STDCALL KeStallExecutionProcessor(ULONG MicroSeconds);
BOOLEAN KeSynchronizeExecution(PKINTERRUPT Interrupt,
PKSYNCHRONIZE_ROUTINE SynchronizeRoutine,
PVOID SynchronizeContext);

View file

@ -234,6 +234,7 @@
/* ACCESS_MASK */
#define MAXIMUM_ALLOWED (0x2000000L)
#define GENERIC_ALL (0x10000000L)
#define GENERIC_EXECUTE (0x20000000L)
#ifndef WIN32_LEAN_AND_MEAN
@ -733,7 +734,6 @@ extern "C" {
#define SERVICE_USER_DEFINED_CONTROL (256)
#define DELETE (0x10000L)
#define READ_CONTROL (0x20000L)
#define GENERIC_EXECUTE (0x20000000L)
#define SERVICE_WIN32_OWN_PROCESS (16)
#define SERVICE_WIN32_SHARE_PROCESS (32)
#define SERVICE_KERNEL_DRIVER (1)

View file

@ -1,4 +1,4 @@
/* $Id: ddk.h,v 1.13 2000/04/05 15:48:12 ekohl Exp $
/* $Id: ddk.h,v 1.14 2000/04/08 19:06:29 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -217,6 +217,12 @@ HalQuerySystemInformation(VOID);
ULONG
HalReadDmaCounter(PADAPTER_OBJECT AdapterObject);
VOID
STDCALL
HalReportResourceUsage (
VOID
);
VOID
STDCALL
HalReturnToFirmware (

View file

@ -91,5 +91,6 @@ HalpGetSystemInterruptVector (
PKAFFINITY Affinity
);
VOID HalpCalibrateStallExecution(VOID);
#endif /* __INTERNAL_HAL_HAL_H */

View file

@ -1,4 +1,4 @@
/* $Id: halinit.c,v 1.9 2000/03/20 17:59:42 ekohl Exp $
/* $Id: halinit.c,v 1.10 2000/04/08 19:08:50 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -31,6 +31,7 @@ HalInitSystem (
if (Phase == 0)
{
HalInitializeDisplay (bp);
HalpCalibrateStallExecution ();
KeInitExceptions();
KeInitIRQ();
KeLowerIrql(DISPATCH_LEVEL);

View file

@ -1,4 +1,4 @@
/* $Id: misc.c,v 1.2 2000/04/05 15:49:52 ekohl Exp $
/* $Id: misc.c,v 1.3 2000/04/08 19:08:50 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -63,4 +63,18 @@ KeFlushWriteBuffer (
return;
}
VOID
STDCALL
HalReportResourceUsage (
VOID
)
{
/*
* FIXME: Report all resources used by hal.
Calls IoReportHalResourceUsage()
*/
return;
}
/* EOF */

View file

@ -5,4 +5,4 @@ HAL_OBJECTS = hal/x86/irq.o hal/x86/isa.o \
hal/x86/sysinfo.o hal/x86/time.o hal/x86/beep.o \
hal/x86/display.o hal/x86/reboot.o hal/x86/kdbg.o \
hal/x86/portio.o hal/x86/misc.o hal/x86/parttab.o \
hal/x86/adapter.o hal/x86/drive.o
hal/x86/adapter.o hal/x86/drive.o hal/x86/udelay.o

View file

@ -1,8 +1,8 @@
/* $Id: udelay.c,v 1.2 1999/11/24 11:51:50 dwelch Exp $
/* $Id: udelay.c,v 1.1 2000/04/08 19:08:50 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/udelay.c
* FILE: ntoskrnl/hal/x86/udelay.c
* PURPOSE: Busy waiting
* PROGRAMMER: David Welch (david.welch@seh.ox.ac.uk)
* UPDATE HISTORY:
@ -11,11 +11,8 @@
/* INCLUDES ***************************************************************/
#include <limits.h>
#include <ddk/ntddk.h>
#include <string.h>
#include <internal/string.h>
#include <stdio.h>
#include <internal/hal.h>
#define NDEBUG
#include <internal/debug.h>
@ -30,23 +27,23 @@
static unsigned int loops_per_microsecond = 100;
extern ULONGLONG KiTimerTicks;
//extern ULONGLONG KiTimerTicks;
/* FUNCTIONS **************************************************************/
VOID KeCalibrateTimerLoop(VOID)
VOID HalpCalibrateStallExecution(VOID)
{
// unsigned int start_tick;
// unsigned int end_tick;
// unsigned int nr_ticks;
// unsigned int i;
// unsigned int microseconds;
#if 0
#if 0
for (i=0;i<20;i++)
{
start_tick = KiTimerTicks;
start_tick = KiTimerTicks;
microseconds = 0;
while (start_tick == KiTimerTicks);
while (KiTimerTicks == (start_tick+TICKS_TO_CALIBRATE))
@ -68,10 +65,13 @@ VOID KeCalibrateTimerLoop(VOID)
// DbgPrint("loops_per_microsecond %d\n",loops_per_microsecond);
}
// for(;;);
#endif
#endif
}
VOID KeStallExecutionProcessor(ULONG MicroSeconds)
VOID
STDCALL
KeStallExecutionProcessor(ULONG MicroSeconds)
{
unsigned int i;
for (i=0; i<(loops_per_microsecond*MicroSeconds) ;i++)
@ -80,3 +80,4 @@ VOID KeStallExecutionProcessor(ULONG MicroSeconds)
}
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: kdebug.c,v 1.9 2000/03/24 22:25:38 dwelch Exp $
/* $Id: kdebug.c,v 1.10 2000/04/08 19:09:30 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -43,7 +43,7 @@ KdDebuggerNotPresent = TRUE; /* EXPORTED */
static BOOLEAN KdpBreakPending = FALSE;
static BOOLEAN KdpBreakRecieved = FALSE;
static ULONG KdpDebugType = ScreenDebug | BochsDebug;
static ULONG KdpDebugType = 0;
/* PRIVATE FUNCTIONS ********************************************************/

View file

@ -29,6 +29,4 @@ VOID KeInit(VOID)
* Allow interrupts
*/
KeLowerIrql(PASSIVE_LEVEL);
KeCalibrateTimerLoop();
}

View file

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.42 2000/03/26 19:38:27 ea Exp $
/* $Id: main.c,v 1.43 2000/04/08 19:10:21 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -30,7 +30,7 @@
/* DATA *********************************************************************/
USHORT EXPORTED NtBuildNumber = KERNEL_VERSION_BUILD;
USHORT EXPORTED NtBuildNumber = KERNEL_VERSION_BUILD;
ULONG EXPORTED NtGlobalFlag = 0;
/* FUNCTIONS ****************************************************************/
@ -208,10 +208,10 @@ asmlinkage void _main(boot_param* _bp)
* Initialize the kernel debugger
*/
KdInitSystem (0, &bp);
// if (KdPollBreakIn ())
// {
// DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C);
// }
if (KdPollBreakIn ())
{
DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C);
}
/*
* Initialization phase 1
@ -239,15 +239,12 @@ asmlinkage void _main(boot_param* _bp)
CmInitializeRegistry();
NtInit();
/* Report all resources used by hal */
HalReportResourceUsage ();
memcpy(old_idt, KiIdt, sizeof(old_idt));
old_idt_valid = 0;
/* Just a test. Exceptions and Interrupts are initialized now */
if (KdPollBreakIn ())
{
DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C);
}
/*
* Initalize services loaded at boot time
*/

View file

@ -1,4 +1,4 @@
# $Id: makefile_rex,v 1.67 2000/04/07 02:23:59 dwelch Exp $
# $Id: makefile_rex,v 1.68 2000/04/08 19:08:05 ekohl Exp $
#
# ReactOS Operating System
#
@ -30,7 +30,7 @@ KE_OBJECTS = ke/head.o ke/main.o ke/timer.o ke/error.o ke/catch.o \
ke/dpc.o ke/wait.o ke/kqueue.o ke/dispatch.o \
ke/sem.o ke/critical.o ke/event.o ke/apc.o ke/bug.o \
ke/mutex.o ke/kernel.o ke/ldt.o ke/spinlock.o\
ke/process.o ke/gdt.o ke/idt.o ke/udelay.o
ke/process.o ke/gdt.o ke/idt.o
KE_I386_OBJECTS = ke/i386/thread.o ke/i386/usercall.o ke/i386/exp.o
@ -66,7 +66,7 @@ FS_OBJECTS = fs/dbcsname.o fs/name.o fs/mcb.o fs/unc.o fs/util.o \
fs/notify.o
SE_OBJECTS = se/semgr.o se/acl.o se/sid.o se/sd.o se/token.o se/luid.o \
se/priv.o
se/priv.o se/access.o
CM_OBJECTS = cm/registry.o

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.66 2000/04/05 15:52:45 ekohl Exp $
; $Id: ntoskrnl.def,v 1.67 2000/04/08 19:08:05 ekohl Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -421,8 +421,8 @@ RtlAppendAsciizToString@8
RtlAppendStringToString@8
RtlAppendUnicodeStringToString@8
RtlAppendUnicodeToString@8
;RtlAreAllAccessesGranted
;RtlAreAnyAccessesGranted
RtlAreAllAccessesGranted@8
RtlAreAnyAccessesGranted@8
RtlAreBitsClear@12
RtlAreBitsSet@12
;RtlAssert
@ -527,7 +527,7 @@ RtlLengthSecurityDescriptor@4
RtlLengthSid@4
;RtlLookupAtomInAtomTable
;RtlLookupElementGenericTable
;RtlMapGenericMask
RtlMapGenericMask@8
RtlMoveMemory@12
RtlMultiByteToUnicodeN@20
RtlMultiByteToUnicodeSize@12
@ -809,7 +809,7 @@ HalProcessorIdle@0
HalQueryDisplayParameters@16
HalQueryRealTimeClock@4
;HalReadDmaCounter
;HalReportResourceUsage
HalReportResourceUsage@0
;HalRequestIpi
;HalRequestSoftwareInterrupt
HalReturnToFirmware@4
@ -850,7 +850,7 @@ KeRaiseIrql@8
;KeRaiseIrqlToDpcLevel
;KeRaiseIrqlToSynchLevel
KeReleaseSpinLock
KeStallExecutionProcessor
KeStallExecutionProcessor@4
;KfAcquireSpinLock
;@KfLowerIrql@4
KfLowerIrql@4

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.53 2000/04/05 15:52:45 ekohl Exp $
; $Id: ntoskrnl.edf,v 1.54 2000/04/08 19:08:05 ekohl Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -417,6 +417,8 @@ RtlAppendAsciizToString=RtlAppendAsciizToString@8
RtlAppendStringToString=RtlAppendStringToString@8
RtlAppendUnicodeStringToString=RtlAppendUnicodeStringToString@8
RtlAppendUnicodeToString=RtlAppendUnicodeToString@8
RtlAreAllAccessesGranted=RtlAreAllAccessesGranted@8
RtlAreAnyAccessesGranted=RtlAreAnyAccessesGranted@8
RtlAreBitsClear=RtlAreBitsClear@12
RtlAreBitsSet=RtlAreBitsSet@12
RtlCharToInteger=RtlCharToInteger@12
@ -480,6 +482,7 @@ RtlLargeIntegerSubtract=RtlLargeIntegerSubtract@16
RtlLengthRequiredSid=RtlLengthRequiredSid@4
RtlLengthSecurityDescriptor=RtlLengthSecurityDescriptor@4
RtlLengthSid=RtlLengthSid@4
RtlMapGenericMask=RtlMapGenericMask@8
RtlMoveMemory=RtlMoveMemory@12
RtlMultiByteToUnicodeN=RtlMultiByteToUnicodeN@20
RtlMultiByteToUnicodeSize=RtlMultiByteToUnicodeSize@12
@ -737,7 +740,7 @@ HalProcessorIdle=HalProcessorIdle@0
HalQueryDisplayParameters=HalQueryDisplayParameters@16
HalQueryRealTimeClock=HalQueryRealTimeClock@4
;HalReadDmaCounter
;HalReportResourceUsage
HalReportResourceUsage=HalReportResourceUsage@0
;HalRequestIpi
;HalRequestSoftwareInterrupt
HalReturnToFirmware=HalReturnToFirmware@4
@ -779,7 +782,7 @@ KeRaiseIrql=KeRaiseIrql@8
;KeRaiseIrqlToDpcLevel
;KeRaiseIrqlToSynchLevel
KeReleaseSpinLock
KeStallExecutionProcessor
KeStallExecutionProcessor=KeStallExecutionProcessor@4
;KfAcquireSpinLock
;KfLowerIrql=@KfLowerIrql@4
KfLowerIrql=KfLowerIrql@4

View file

@ -0,0 +1,63 @@
/* $Id: access.c,v 1.1 2000/04/08 19:10:50 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PURPOSE: Access rights handling functions
* FILE: ntoskrnl/se/access.c
* PROGRAMER: Eric Kohl <ekohl@rz-online.de>
* REVISION HISTORY:
* 07/04/2000: Created
*/
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
/* FUNCTIONS ***************************************************************/
BOOLEAN
STDCALL
RtlAreAllAccessesGranted (
ACCESS_MASK GrantedAccess,
ACCESS_MASK DesiredAccess
)
{
return ((GrantedAccess & DesiredAccess) == DesiredAccess);
}
BOOLEAN
STDCALL
RtlAreAnyAccessesGranted (
ACCESS_MASK GrantedAccess,
ACCESS_MASK DesiredAccess
)
{
return ((GrantedAccess & DesiredAccess) != 0);
}
VOID
STDCALL
RtlMapGenericMask (
PACCESS_MASK AccessMask,
PGENERIC_MAPPING GenericMapping
)
{
if (*AccessMask & GENERIC_READ)
*AccessMask |= GenericMapping->GenericRead;
if (*AccessMask & GENERIC_WRITE)
*AccessMask |= GenericMapping->GenericWrite;
if (*AccessMask & GENERIC_EXECUTE)
*AccessMask |= GenericMapping->GenericExecute;
if (*AccessMask & GENERIC_ALL)
*AccessMask |= GenericMapping->GenericAll;
*AccessMask &= 0x0FFFFFFF;
}
/* EOF */