* Sync to recent trunk (r52563).
[reactos.git] / boot / freeldr / freeldr / arch / i386 / ntoskrnl.c
1 #include <ntoskrnl.h>
2
3 /* For KeStallExecutionProcessor */
4 #if defined(_M_IX86) || defined(_M_AMD64)
5 #include <arch/pc/pcbios.h>
6 #endif
7
8 VOID
9 NTAPI
10 KeInitializeEvent(
11 IN PRKEVENT Event,
12 IN EVENT_TYPE Type,
13 IN BOOLEAN State)
14 {
15 }
16
17 VOID
18 FASTCALL
19 KiAcquireSpinLock(
20 IN PKSPIN_LOCK SpinLock)
21 {
22 }
23
24 VOID
25 FASTCALL
26 KiReleaseSpinLock(
27 IN PKSPIN_LOCK SpinLock)
28 {
29 }
30
31 VOID
32 NTAPI
33 KeSetTimeIncrement(
34 IN ULONG MaxIncrement,
35 IN ULONG MinIncrement)
36 {
37 }
38
39 NTKERNELAPI
40 VOID
41 FASTCALL
42 IoAssignDriveLetters(
43 IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
44 IN PSTRING NtDeviceName,
45 OUT PUCHAR NtSystemPath,
46 OUT PSTRING NtSystemPathString)
47 {
48 }
49
50 NTKERNELAPI
51 NTSTATUS
52 FASTCALL
53 IoSetPartitionInformation(
54 IN PDEVICE_OBJECT DeviceObject,
55 IN ULONG SectorSize,
56 IN ULONG PartitionNumber,
57 IN ULONG PartitionType)
58 {
59 return STATUS_NOT_IMPLEMENTED;
60 }
61
62 NTKERNELAPI
63 NTSTATUS
64 FASTCALL
65 IoWritePartitionTable(
66 IN PDEVICE_OBJECT DeviceObject,
67 IN ULONG SectorSize,
68 IN ULONG SectorsPerTrack,
69 IN ULONG NumberOfHeads,
70 IN struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer)
71 {
72 return STATUS_NOT_IMPLEMENTED;
73 }
74
75 NTHALAPI
76 VOID
77 NTAPI
78 KeStallExecutionProcessor(
79 IN ULONG MicroSeconds)
80 {
81 #if defined(_M_IX86) || defined(_M_AMD64)
82 REGS Regs;
83 ULONG usec_this;
84
85 // Int 15h AH=86h
86 // BIOS - WAIT (AT,PS)
87 //
88 // AH = 86h
89 // CX:DX = interval in microseconds
90 // Return:
91 // CF clear if successful (wait interval elapsed)
92 // CF set on error or AH=83h wait already in progress
93 // AH = status (see #00496)
94
95 // Note: The resolution of the wait period is 977 microseconds on
96 // many systems because many BIOSes use the 1/1024 second fast
97 // interrupt from the AT real-time clock chip which is available on INT 70;
98 // because newer BIOSes may have much more precise timers available, it is
99 // not possible to use this function accurately for very short delays unless
100 // the precise behavior of the BIOS is known (or found through testing)
101
102 while (MicroSeconds)
103 {
104 usec_this = MicroSeconds;
105
106 if (usec_this > 4000000)
107 {
108 usec_this = 4000000;
109 }
110
111 Regs.b.ah = 0x86;
112 Regs.w.cx = usec_this >> 16;
113 Regs.w.dx = usec_this & 0xffff;
114 Int386(0x15, &Regs, &Regs);
115
116 MicroSeconds -= usec_this;
117 }
118 #else
119 #error unimplemented
120 #endif
121 }