4 * Definitions only used in Windows NT 4.0 and earlier versions
6 * This file is part of the w32api package.
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
11 * THIS SOFTWARE IS NOT COPYRIGHTED
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 #pragma GCC system_header
34 typedef struct _ZONE_SEGMENT_HEADER
{
35 SINGLE_LIST_ENTRY SegmentList
;
37 } ZONE_SEGMENT_HEADER
, *PZONE_SEGMENT_HEADER
;
39 typedef struct _ZONE_HEADER
{
40 SINGLE_LIST_ENTRY FreeList
;
41 SINGLE_LIST_ENTRY SegmentList
;
43 ULONG TotalSegmentSize
;
44 } ZONE_HEADER
, *PZONE_HEADER
;
48 /*IN*/ PZONE_HEADER Zone
)
50 if (Zone
->FreeList
.Next
)
51 Zone
->FreeList
.Next
= Zone
->FreeList
.Next
->Next
;
52 return (PVOID
) Zone
->FreeList
.Next
;
59 /*IN*/ PZONE_HEADER Zone
,
61 /*IN*/ ULONG SegmentSize
);
65 /*IN*/ PZONE_HEADER Zone
,
68 ((PSINGLE_LIST_ENTRY
) Block
)->Next
= Zone
->FreeList
.Next
;
69 Zone
->FreeList
.Next
= ((PSINGLE_LIST_ENTRY
) Block
);
70 return ((PSINGLE_LIST_ENTRY
) Block
)->Next
;
77 /*IN*/ PZONE_HEADER Zone
,
78 /*IN*/ ULONG BlockSize
,
79 /*IN*/ PVOID InitialSegment
,
80 /*IN*/ ULONG InitialSegmentSize
);
84 * ExInterlockedAllocateFromZone(
85 * IN PZONE_HEADER Zone,
86 * IN PKSPIN_LOCK Lock)
88 #define ExInterlockedAllocateFromZone(Zone, \
90 ((PVOID) ExInterlockedPopEntryList(&Zone->FreeList, Lock))
95 ExInterlockedExtendZone(
96 /*IN*/ PZONE_HEADER Zone
,
98 /*IN*/ ULONG SegmentSize
,
99 /*IN*/ PKSPIN_LOCK Lock
);
104 ExInterlockedFreeToZone(
105 /*IN*/ PZONE_HEADER Zone
,
107 /*IN*/ PKSPIN_LOCK Lock
);
111 * ExInitializeWorkItem(
112 * IN PWORK_QUEUE_ITEM Item,
113 * IN PWORKER_THREAD_ROUTINE Routine,
116 #define ExInitializeWorkItem(Item, \
120 (Item)->WorkerRoutine = Routine; \
121 (Item)->Parameter = Context; \
122 (Item)->List.Flink = NULL; \
128 * IN PZONE_HEADER Zone)
130 #define ExIsFullZone(Zone) \
131 ((Zone)->FreeList.Next == (PSINGLE_LIST_ENTRY) NULL)
137 /*IN*/ PWORK_QUEUE_ITEM WorkItem
,
138 /*IN*/ WORK_QUEUE_TYPE QueueType
);
143 ExIsObjectInFirstZoneSegment(
144 /*IN*/ PZONE_HEADER Zone
,
145 /*IN*/ PVOID Object
);
151 /*IN*/ PERESOURCE Resource
);
153 #define ExAcquireResourceExclusive ExAcquireResourceExclusiveLite
154 #define ExAcquireResourceShared ExAcquireResourceSharedLite
155 #define ExConvertExclusiveToShared ExConvertExclusiveToSharedLite
156 #define ExDeleteResource ExDeleteResourceLite
157 #define ExInitializeResource ExInitializeResourceLite
158 #define ExIsResourceAcquiredExclusive ExIsResourceAcquiredExclusiveLite
159 #define ExIsResourceAcquiredShared ExIsResourceAcquiredSharedLite
160 #define ExIsResourceAcquired ExIsResourceAcquiredSharedLite
161 #define ExReleaseResourceForThread ExReleaseResourceForThreadLite
166 ExInterlockedDecrementLong(
168 /*IN*/ PKSPIN_LOCK Lock
);
173 ExInterlockedExchangeUlong(
174 /*IN*/ PULONG Target
,
176 /*IN*/ PKSPIN_LOCK Lock
);
181 ExInterlockedIncrementLong(
183 /*IN*/ PKSPIN_LOCK Lock
);
188 HalAllocateCommonBuffer(
189 /*IN*/ PADAPTER_OBJECT AdapterObject
,
191 /*OUT*/ PPHYSICAL_ADDRESS LogicalAddress
,
192 /*IN*/ BOOLEAN CacheEnabled
);
197 HalAssignSlotResources(
198 /*IN*/ PUNICODE_STRING RegistryPath
,
199 /*IN*/ PUNICODE_STRING DriverClassName
,
200 /*IN*/ PDRIVER_OBJECT DriverObject
,
201 /*IN*/ PDEVICE_OBJECT DeviceObject
,
202 /*IN*/ INTERFACE_TYPE BusType
,
203 /*IN*/ ULONG BusNumber
,
204 /*IN*/ ULONG SlotNumber
,
205 /*IN OUT*/ PCM_RESOURCE_LIST
*AllocatedResources
);
211 /*IN*/ PADAPTER_OBJECT AdapterObject
,
213 /*IN*/ PHYSICAL_ADDRESS LogicalAddress
,
214 /*IN*/ PVOID VirtualAddress
,
215 /*IN*/ BOOLEAN CacheEnabled
);
221 /*IN*/ PDEVICE_DESCRIPTION DeviceDescription
,
222 /*IN OUT*/ PULONG NumberOfMapRegisters
);
228 /*IN*/ BUS_DATA_TYPE BusDataType
,
229 /*IN*/ ULONG BusNumber
,
230 /*IN*/ ULONG SlotNumber
,
232 /*IN*/ ULONG Length
);
237 HalGetBusDataByOffset(
238 /*IN*/ BUS_DATA_TYPE BusDataType
,
239 /*IN*/ ULONG BusNumber
,
240 /*IN*/ ULONG SlotNumber
,
243 /*IN*/ ULONG Length
);
248 HalGetDmaAlignmentRequirement(
254 HalGetInterruptVector(
255 /*IN*/ INTERFACE_TYPE InterfaceType
,
256 /*IN*/ ULONG BusNumber
,
257 /*IN*/ ULONG BusInterruptLevel
,
258 /*IN*/ ULONG BusInterruptVector
,
260 /*OUT*/ PKAFFINITY Affinity
);
266 /*IN*/ PADAPTER_OBJECT AdapterObject
);
272 /*IN*/ BUS_DATA_TYPE BusDataType
,
273 /*IN*/ ULONG BusNumber
,
274 /*IN*/ ULONG SlotNumber
,
276 /*IN*/ ULONG Length
);
281 HalSetBusDataByOffset(
282 /*IN*/ BUS_DATA_TYPE BusDataType
,
283 /*IN*/ ULONG BusNumber
,
284 /*IN*/ ULONG SlotNumber
,
287 /*IN*/ ULONG Length
);
292 HalTranslateBusAddress(
293 /*IN*/ INTERFACE_TYPE InterfaceType
,
294 /*IN*/ ULONG BusNumber
,
295 /*IN*/ PHYSICAL_ADDRESS BusAddress
,
296 /*IN OUT*/ PULONG AddressSpace
,
297 /*OUT*/ PPHYSICAL_ADDRESS TranslatedAddress
);
302 IoAllocateAdapterChannel(
303 /*IN*/ PADAPTER_OBJECT AdapterObject
,
304 /*IN*/ PDEVICE_OBJECT DeviceObject
,
305 /*IN*/ ULONG NumberOfMapRegisters
,
306 /*IN*/ PDRIVER_CONTROL ExecutionRoutine
,
307 /*IN*/ PVOID Context
);
313 /*IN*/ PUNICODE_STRING RegistryPath
,
314 /*IN*/ PUNICODE_STRING DriverClassName
/*OPTIONAL*/,
315 /*IN*/ PDRIVER_OBJECT DriverObject
,
316 /*IN*/ PDEVICE_OBJECT DeviceObject
/*OPTIONAL*/,
317 /*IN*/ PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources
,
318 /*IN OUT*/ PCM_RESOURCE_LIST
*AllocatedResources
);
323 IoAttachDeviceByPointer(
324 /*IN*/ PDEVICE_OBJECT SourceDevice
,
325 /*IN*/ PDEVICE_OBJECT TargetDevice
);
330 IoFlushAdapterBuffers(
331 /*IN*/ PADAPTER_OBJECT AdapterObject
,
333 /*IN*/ PVOID MapRegisterBase
,
334 /*IN*/ PVOID CurrentVa
,
336 /*IN*/ BOOLEAN WriteToDevice
);
341 IoFreeAdapterChannel(
342 /*IN*/ PADAPTER_OBJECT AdapterObject
);
348 /*IN*/ PADAPTER_OBJECT AdapterObject
,
349 /*IN*/ PVOID MapRegisterBase
,
350 /*IN*/ ULONG NumberOfMapRegisters
);
356 /*IN*/ PADAPTER_OBJECT AdapterObject
,
358 /*IN*/ PVOID MapRegisterBase
,
359 /*IN*/ PVOID CurrentVa
,
360 /*IN OUT*/ PULONG Length
,
361 /*IN*/ BOOLEAN WriteToDevice
);
367 /*IN*/ PMDL MemoryDescriptorList
/*OPTIONAL*/,
369 /*IN*/ SIZE_T Length
);
374 MmIsNonPagedSystemAddressValid(
375 /*IN*/ PVOID VirtualAddress
);
380 RtlEnlargedIntegerMultiply(
381 /*IN*/ LONG Multiplicand
,
382 /*IN*/ LONG Multiplier
);
387 RtlEnlargedUnsignedDivide(
388 /*IN*/ ULARGE_INTEGER Dividend
,
389 /*IN*/ ULONG Divisor
,
390 /*IN OUT*/ PULONG Remainder
);
395 RtlEnlargedUnsignedMultiply(
396 /*IN*/ ULONG Multiplicand
,
397 /*IN*/ ULONG Multiplier
);
402 RtlExtendedIntegerMultiply(
403 /*IN*/ LARGE_INTEGER Multiplicand
,
404 /*IN*/ LONG Multiplier
);
409 RtlExtendedLargeIntegerDivide(
410 /*IN*/ LARGE_INTEGER Dividend
,
411 /*IN*/ ULONG Divisor
,
412 /*IN OUT*/ PULONG Remainder
);
417 RtlExtendedMagicDivide(
418 /*IN*/ LARGE_INTEGER Dividend
,
419 /*IN*/ LARGE_INTEGER MagicDivisor
,
420 /*IN*/ CCHAR ShiftCount
);
426 /*IN*/ LARGE_INTEGER Addend1
,
427 /*IN*/ LARGE_INTEGER Addend2
);
433 /*IN OUT*/ LARGE_INTEGER Result
,
434 /*IN*/ LARGE_INTEGER Source
,
435 /*IN*/ LARGE_INTEGER Mask
);
440 RtlLargeIntegerArithmeticShift(
441 /*IN*/ LARGE_INTEGER LargeInteger
,
442 /*IN*/ CCHAR ShiftCount
);
447 RtlLargeIntegerDivide(
448 /*IN*/ LARGE_INTEGER Dividend
,
449 /*IN*/ LARGE_INTEGER Divisor
,
450 /*IN OUT*/ PLARGE_INTEGER Remainder
);
455 RtlLargeIntegerEqualTo(
456 /*IN*/ LARGE_INTEGER Operand1
,
457 /*IN*/ LARGE_INTEGER Operand2
);
462 RtlLargeIntegerEqualToZero(
463 /*IN*/ LARGE_INTEGER Operand
);
468 RtlLargeIntegerGreaterOrEqualToZero(
469 /*IN*/ LARGE_INTEGER Operand
);
474 RtlLargeIntegerGreaterThan(
475 /*IN*/ LARGE_INTEGER Operand1
,
476 /*IN*/ LARGE_INTEGER Operand2
);
481 RtlLargeIntegerGreaterThanOrEqualTo(
482 /*IN*/ LARGE_INTEGER Operand1
,
483 /*IN*/ LARGE_INTEGER Operand2
);
488 RtlLargeIntegerGreaterThanZero(
489 /*IN*/ LARGE_INTEGER Operand
);
494 RtlLargeIntegerLessOrEqualToZero(
495 /*IN*/ LARGE_INTEGER Operand
);
500 RtlLargeIntegerLessThan(
501 /*IN*/ LARGE_INTEGER Operand1
,
502 /*IN*/ LARGE_INTEGER Operand2
);
507 RtlLargeIntegerLessThanOrEqualTo(
508 /*IN*/ LARGE_INTEGER Operand1
,
509 /*IN*/ LARGE_INTEGER Operand2
);
514 RtlLargeIntegerLessThanZero(
515 /*IN*/ LARGE_INTEGER Operand
);
520 RtlLargeIntegerNegate(
521 /*IN*/ LARGE_INTEGER Subtrahend
);
526 RtlLargeIntegerNotEqualTo(
527 /*IN*/ LARGE_INTEGER Operand1
,
528 /*IN*/ LARGE_INTEGER Operand2
);
533 RtlLargeIntegerNotEqualToZero(
534 /*IN*/ LARGE_INTEGER Operand
);
539 RtlLargeIntegerShiftLeft(
540 /*IN*/ LARGE_INTEGER LargeInteger
,
541 /*IN*/ CCHAR ShiftCount
);
546 RtlLargeIntegerShiftRight(
547 /*IN*/ LARGE_INTEGER LargeInteger
,
548 /*IN*/ CCHAR ShiftCount
);
553 RtlLargeIntegerSubtract(
554 /*IN*/ LARGE_INTEGER Minuend
,
555 /*IN*/ LARGE_INTEGER Subtrahend
);
560 * COMPUTE_PAGES_SPANNED(
564 #define COMPUTE_PAGES_SPANNED(Va, \
566 (ADDRESS_AND_SIZE_TO_SPAN_PAGES(Va, Size))
570 ** Architecture specific functions
578 Exi386InterlockedIncrementLong(
579 /*IN*/ PLONG Addend
);
584 Exfi386InterlockedIncrementLong(
585 /*IN*/ PLONG Addend
);
590 Exi386InterlockedDecrementLong(
591 /*IN*/ PLONG Addend
);
596 Exfi386InterlockedDecrementLong(
597 /*IN*/ PLONG Addend
);
602 Exi386InterlockedExchangeUlong(
603 /*IN*/ PULONG Target
,
609 Exfi386InterlockedExchangeUlong(
610 /*IN*/ PULONG Target
,
613 #define ExInterlockedIncrementLong(Addend,Lock) Exfi386InterlockedIncrementLong(Addend)
614 #define ExInterlockedDecrementLong(Addend,Lock) Exfi386InterlockedDecrementLong(Addend)
615 #define ExInterlockedExchangeUlong(Target, Value, Lock) Exfi386InterlockedExchangeUlong(Target, Value)
623 #endif /* __WINNT4_H */