reactos/drivers/network/ndis/include/ndissys.h
Eugen Podrug 8e01dee251 [NTOS:EX] Fix swapped values in ExGetCurrentProcessorCounts() (#4565)
The function should return the kernel time for the idle thread in the
first argument, and kernel time + user time for the current thread in
the second argument.

Also retrieve the processor number from the cached PRCB instead of
calling KeGetCurrentProcessorNumber() which retrieves the PRCB again
since the processor could switch in-between those calls.

NdisGetCurrentProcessorCounts() function follows the same prototype
which is the correct one.
2023-07-02 16:10:36 +03:00

64 lines
1.4 KiB
C

/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS NDIS library
* FILE: ndissys.h
* PURPOSE: NDIS library definitions
* NOTES: Spin lock acquire order:
* - Miniport list lock
* - Adapter list lock
*/
#ifndef __NDISSYS_H
#define __NDISSYS_H
#include <ndis.h>
#include "debug.h"
#include "miniport.h"
#include "protocol.h"
#include "efilter.h"
#include "buffer.h"
/* Exported functions */
#ifndef EXPORT
#define EXPORT NTAPI
#endif
/* the version of NDIS we claim to be */
#define NDIS_VERSION 0x00050001
#define NDIS_TAG 0x4e4d4953
#define MIN(value1, value2) \
((value1 < value2)? value1 : value2)
#define MAX(value1, value2) \
((value1 > value2)? value1 : value2)
#define ExInterlockedRemoveEntryList(_List,_Lock) \
{ KIRQL OldIrql; \
KeAcquireSpinLock(_Lock, &OldIrql); \
RemoveEntryList(_List); \
KeReleaseSpinLock(_Lock, OldIrql); \
}
/* missing protypes */
VOID
NTAPI
ExGetCurrentProcessorCounts(
PULONG IdleTime,
PULONG KernelAndUserTime,
PULONG ProcessorNumber);
VOID
NTAPI
ExGetCurrentProcessorCpuUsage(
PULONG CpuUsage);
/* portability fixes */
#ifdef _M_AMD64
#define KfReleaseSpinLock KeReleaseSpinLock
#define KefAcquireSpinLockAtDpcLevel KeAcquireSpinLockAtDpcLevel
#define KefReleaseSpinLockFromDpcLevel KeReleaseSpinLockFromDpcLevel
#endif
#endif /* __NDISSYS_H */