ReactOS  0.4.14-dev-41-g31d7680
ntoskrnl.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Kernel
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: boot/freeldr/freeldr/arch/i386/ntoskrnl.c
5  * PURPOSE: NTOS glue routines for the MINIHAL library
6  * PROGRAMMERS: Hervé Poussineau <hpoussin@reactos.org>
7  */
8 
9 /* INCLUDES ******************************************************************/
10 
11 #include <ntoskrnl.h>
12 
13 /* For KeStallExecutionProcessor */
14 #if defined(_M_IX86) || defined(_M_AMD64)
15 #include <arch/pc/pcbios.h>
16 #endif
17 
18 /* FUNCTIONS *****************************************************************/
19 
20 VOID
21 NTAPI
26 {
27  memset(Event, 0, sizeof(*Event));
28 }
29 
30 VOID
34 {
35 }
36 
37 VOID
41 {
42 }
43 
44 VOID
45 NTAPI
47  IN ULONG MaxIncrement,
48  IN ULONG MinIncrement)
49 {
50 }
51 
52 VOID
55  IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
56  IN PSTRING NtDeviceName,
57  OUT PUCHAR NtSystemPath,
58  OUT PSTRING NtSystemPathString)
59 {
60 }
61 
69 {
71 }
72 
73 /*
74  * NTSTATUS
75  * FASTCALL
76  * IoReadPartitionTable(
77  * IN PDEVICE_OBJECT DeviceObject,
78  * IN ULONG SectorSize,
79  * IN BOOLEAN ReturnRecognizedPartitions,
80  * OUT PDRIVE_LAYOUT_INFORMATION *PartitionBuffer);
81  *
82  * See boot/freeldr/freeldr/disk/partition.c
83  */
84 
93 {
95 }
96 
97 VOID
98 NTAPI
100  IN ULONG MicroSeconds)
101 {
102 #if defined(_M_IX86) || defined(_M_AMD64)
103  REGS Regs;
104  ULONG usec_this;
105 
106  // Int 15h AH=86h
107  // BIOS - WAIT (AT,PS)
108  //
109  // AH = 86h
110  // CX:DX = interval in microseconds
111  // Return:
112  // CF clear if successful (wait interval elapsed)
113  // CF set on error or AH=83h wait already in progress
114  // AH = status (see #00496)
115 
116  // Note: The resolution of the wait period is 977 microseconds on
117  // many systems because many BIOSes use the 1/1024 second fast
118  // interrupt from the AT real-time clock chip which is available on INT 70;
119  // because newer BIOSes may have much more precise timers available, it is
120  // not possible to use this function accurately for very short delays unless
121  // the precise behavior of the BIOS is known (or found through testing)
122 
123  while (MicroSeconds)
124  {
125  usec_this = MicroSeconds;
126 
127  if (usec_this > 4000000)
128  {
129  usec_this = 4000000;
130  }
131 
132  Regs.b.ah = 0x86;
133  Regs.w.cx = usec_this >> 16;
134  Regs.w.dx = usec_this & 0xffff;
135  Int386(0x15, &Regs, &Regs);
136 
137  MicroSeconds -= usec_this;
138  }
139 #else
140  #error unimplemented
141 #endif
142 }
#define IN
Definition: typedefs.h:38
unsigned short dx
Definition: pcbios.h:102
Type
Definition: Type.h:6
VOID FASTCALL IoAssignDriveLetters(IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock, IN PSTRING NtDeviceName, OUT PUCHAR NtSystemPath, OUT PSTRING NtSystemPathString)
Definition: ntoskrnl.c:54
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
VOID NTAPI KeSetTimeIncrement(IN ULONG MaxIncrement, IN ULONG MinIncrement)
Definition: ntoskrnl.c:46
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
unsigned short cx
Definition: pcbios.h:101
unsigned char ah
Definition: pcbios.h:120
KSPIN_LOCK * PKSPIN_LOCK
Definition: env_spec_w32.h:73
_In_ ULONG _In_ ULONG _In_ ULONG NumberOfHeads
Definition: iofuncs.h:2066
_In_ ULONG _In_ ULONG PartitionNumber
Definition: iofuncs.h:2056
#define FASTCALL
Definition: nt_native.h:50
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
int __cdecl Int386(int ivec, REGS *in, REGS *out)
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
_In_ ULONG _In_ ULONG SectorsPerTrack
Definition: iofuncs.h:2066
VOID FASTCALL KiReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: ntoskrnl.c:39
_In_ ULONG _In_ BOOLEAN _Out_ struct _DRIVE_LAYOUT_INFORMATION ** PartitionBuffer
Definition: iofuncs.h:2048
unsigned char BOOLEAN
enum _EVENT_TYPE EVENT_TYPE
BYTEREGS b
Definition: pcbios.h:151
VOID NTAPI KeInitializeEvent(IN PRKEVENT Event, IN EVENT_TYPE Type, IN BOOLEAN State)
Definition: ntoskrnl.c:22
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
VOID FASTCALL KiAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: ntoskrnl.c:32
#define OUT
Definition: typedefs.h:39
NTSTATUS FASTCALL IoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG PartitionNumber, IN ULONG PartitionType)
Definition: ntoskrnl.c:64
CHAR PartitionType
Definition: part_xbox.c:33
unsigned int ULONG
Definition: retypes.h:1
Definition: pcbios.h:146
NTSTATUS FASTCALL IoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG SectorsPerTrack, IN ULONG NumberOfHeads, IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer)
Definition: ntoskrnl.c:87
_In_ ULONG SectorSize
Definition: halfuncs.h:291
#define memset(x, y, z)
Definition: compat.h:39
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:99
WORDREGS w
Definition: pcbios.h:150