2010-02-26 11:43:19 +00:00
|
|
|
#pragma once
|
2000-05-13 13:51:08 +00:00
|
|
|
|
1998-09-05 17:33:57 +00:00
|
|
|
/*
|
|
|
|
* Use these to place a function in a specific section of the executable
|
|
|
|
*/
|
2003-10-12 17:05:50 +00:00
|
|
|
#define PLACE_IN_SECTION(s) __attribute__((section (s)))
|
2006-09-07 13:47:14 +00:00
|
|
|
#ifdef __GNUC__
|
[NTOSKRNL]
Previously, in ReactOS' stories:
ReactOS was broken since more a hundred of commits when two devs decided it was enough. One (we will name him Timo) fixed the context switch. The second, with the help of a third dev (Pierre & Hervé) decided to run tests by disabling some stuff (ie INIT_FUNCTION). This magically made testbot going back to life.
But, some complains came from the ML, so trying to appease world, Pierre decided to revert half of his changes, thinking this would be OK.
~~
Now, after a night. It appears that half revert was a pretty bad idea. Testbot keeps being broken.
So, this commit reverts r49665 (which was half reverting r49662). That way, testbot should be back, able to run tests. BUT, due to a NPFS issue, some tests are broken. Eric has been nicely mailed about that issue, with an idea of fix (thanks go here to Aleksey).
~~
For those who like that, drama to follow on ML.
I turn into being S/M...
svn path=/trunk/; revision=49691
2010-11-21 16:04:52 +00:00
|
|
|
#define INIT_FUNCTION
|
2003-10-12 17:05:50 +00:00
|
|
|
#define PAGE_LOCKED_FUNCTION PLACE_IN_SECTION("pagelk")
|
|
|
|
#define PAGE_UNLOCKED_FUNCTION PLACE_IN_SECTION("pagepo")
|
2006-09-06 12:19:00 +00:00
|
|
|
#else
|
|
|
|
#define INIT_FUNCTION
|
2007-10-19 23:21:45 +00:00
|
|
|
#define PAGE_LOCKED_FUNCTION
|
|
|
|
#define PAGE_UNLOCKED_FUNCTION
|
2006-09-06 12:19:00 +00:00
|
|
|
#endif
|
1998-09-05 17:33:57 +00:00
|
|
|
|
2005-06-25 14:04:56 +00:00
|
|
|
#ifdef _NTOSKRNL_
|
|
|
|
|
2008-06-23 03:57:50 +00:00
|
|
|
#ifndef _ARM_
|
2006-10-23 22:07:45 +00:00
|
|
|
#define KeGetCurrentThread _KeGetCurrentThread
|
|
|
|
#define KeGetPreviousMode _KeGetPreviousMode
|
2008-06-23 03:57:50 +00:00
|
|
|
#endif
|
2006-10-23 22:07:45 +00:00
|
|
|
#undef PsGetCurrentProcess
|
|
|
|
#define PsGetCurrentProcess _PsGetCurrentProcess
|
2006-10-23 22:01:25 +00:00
|
|
|
|
2009-01-25 16:13:16 +00:00
|
|
|
#define RVA(m, b) ((PVOID)((ULONG_PTR)(b) + (ULONG_PTR)(m)))
|
|
|
|
|
2008-03-11 04:42:54 +00:00
|
|
|
//
|
|
|
|
// We are very lazy on ARM -- we just import intrinsics
|
|
|
|
// Question: Why wasn't this done for x86 too? (see fastintrlck.asm)
|
|
|
|
//
|
2008-08-06 10:52:33 +00:00
|
|
|
#define InterlockedDecrement _InterlockedDecrement
|
|
|
|
#define InterlockedDecrement16 _InterlockedDecrement16
|
|
|
|
#define InterlockedIncrement _InterlockedIncrement
|
|
|
|
#define InterlockedIncrement16 _InterlockedIncrement16
|
|
|
|
#define InterlockedCompareExchange _InterlockedCompareExchange
|
|
|
|
#define InterlockedCompareExchange16 _InterlockedCompareExchange16
|
|
|
|
#define InterlockedCompareExchange64 _InterlockedCompareExchange64
|
|
|
|
#define InterlockedExchange _InterlockedExchange
|
|
|
|
#define InterlockedExchangeAdd _InterlockedExchangeAdd
|
2008-08-14 19:30:32 +00:00
|
|
|
#define InterlockedOr _InterlockedOr
|
|
|
|
#define InterlockedAnd _InterlockedAnd
|
2008-03-11 04:42:54 +00:00
|
|
|
|
2009-01-30 16:45:17 +00:00
|
|
|
//
|
|
|
|
// Use inlined versions of fast/guarded mutex routines
|
|
|
|
//
|
|
|
|
#define ExEnterCriticalRegionAndAcquireFastMutexUnsafe _ExEnterCriticalRegionAndAcquireFastMutexUnsafe
|
|
|
|
#define ExReleaseFastMutexUnsafeAndLeaveCriticalRegion _ExReleaseFastMutexUnsafeAndLeaveCriticalRegion
|
|
|
|
#define ExAcquireFastMutex _ExAcquireFastMutex
|
|
|
|
#define ExReleaseFastMutex _ExReleaseFastMutex
|
|
|
|
#define ExAcquireFastMutexUnsafe _ExAcquireFastMutexUnsafe
|
|
|
|
#define ExReleaseFastMutexUnsafe _ExReleaseFastMutexUnsafe
|
|
|
|
#define ExTryToAcquireFastMutex _ExTryToAcquireFastMutex
|
|
|
|
|
|
|
|
#define KeInitializeGuardedMutex _KeInitializeGuardedMutex
|
|
|
|
#define KeAcquireGuardedMutex _KeAcquireGuardedMutex
|
|
|
|
#define KeReleaseGuardedMutex _KeReleaseGuardedMutex
|
|
|
|
#define KeAcquireGuardedMutexUnsafe _KeAcquireGuardedMutexUnsafe
|
|
|
|
#define KeReleaseGuardedMutexUnsafe _KeReleaseGuardedMutexUnsafe
|
|
|
|
#define KeTryToAcquireGuardedMutex _KeTryToAcquireGuardedMutex
|
|
|
|
|
2011-06-01 13:39:36 +00:00
|
|
|
#include "tag.h"
|
2005-06-25 14:04:56 +00:00
|
|
|
#include "ke.h"
|
|
|
|
#include "ob.h"
|
|
|
|
#include "mm.h"
|
2006-09-07 09:06:47 +00:00
|
|
|
#include "ex.h"
|
2007-12-15 18:14:41 +00:00
|
|
|
#include "cm.h"
|
2005-06-25 14:04:56 +00:00
|
|
|
#include "ps.h"
|
|
|
|
#include "cc.h"
|
|
|
|
#include "io.h"
|
|
|
|
#include "po.h"
|
|
|
|
#include "se.h"
|
|
|
|
#include "ldr.h"
|
2007-03-04 19:54:39 +00:00
|
|
|
#ifndef _WINKD_
|
2005-06-25 14:04:56 +00:00
|
|
|
#include "kd.h"
|
2007-03-04 19:54:39 +00:00
|
|
|
#else
|
|
|
|
#include "kd64.h"
|
|
|
|
#endif
|
2005-09-14 01:44:19 +00:00
|
|
|
#include "fsrtl.h"
|
|
|
|
#include "lpc.h"
|
2005-09-14 01:05:50 +00:00
|
|
|
#include "rtl.h"
|
2005-06-25 14:04:56 +00:00
|
|
|
#ifdef KDBG
|
2005-06-26 19:29:12 +00:00
|
|
|
#include "../kdbg/kdb.h"
|
2005-06-25 14:04:56 +00:00
|
|
|
#endif
|
|
|
|
#include "dbgk.h"
|
2010-01-02 19:41:03 +00:00
|
|
|
#include "spinlock.h"
|
2005-06-25 14:04:56 +00:00
|
|
|
#include "test.h"
|
|
|
|
#include "inbv.h"
|
2006-08-28 23:56:35 +00:00
|
|
|
#include "vdm.h"
|
2006-11-12 22:51:06 +00:00
|
|
|
#include "hal.h"
|
2010-09-15 07:46:28 +00:00
|
|
|
#include "hdl.h"
|
2008-02-12 04:15:53 +00:00
|
|
|
#include "arch/intrin_i.h"
|
2005-06-25 14:04:56 +00:00
|
|
|
|
2005-10-10 13:03:55 +00:00
|
|
|
/*
|
|
|
|
* generic information class probing code
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define ICIF_QUERY 0x1
|
|
|
|
#define ICIF_SET 0x2
|
|
|
|
#define ICIF_QUERY_SIZE_VARIABLE 0x4
|
|
|
|
#define ICIF_SET_SIZE_VARIABLE 0x8
|
|
|
|
#define ICIF_SIZE_VARIABLE (ICIF_QUERY_SIZE_VARIABLE | ICIF_SET_SIZE_VARIABLE)
|
|
|
|
|
|
|
|
typedef struct _INFORMATION_CLASS_INFO
|
|
|
|
{
|
|
|
|
ULONG RequiredSizeQUERY;
|
|
|
|
ULONG RequiredSizeSET;
|
|
|
|
ULONG AlignmentSET;
|
|
|
|
ULONG AlignmentQUERY;
|
|
|
|
ULONG Flags;
|
|
|
|
} INFORMATION_CLASS_INFO, *PINFORMATION_CLASS_INFO;
|
|
|
|
|
2006-07-19 23:21:19 +00:00
|
|
|
#define ICI_SQ_SAME(Type, Alignment, Flags) \
|
|
|
|
{ Type, Type, Alignment, Alignment, Flags }
|
2005-10-10 13:03:55 +00:00
|
|
|
|
2006-07-19 23:21:19 +00:00
|
|
|
#define ICI_SQ(TypeQuery, TypeSet, AlignmentQuery, AlignmentSet, Flags) \
|
|
|
|
{ TypeQuery, TypeSet, AlignmentQuery, AlignmentSet, Flags }
|
|
|
|
|
|
|
|
//
|
|
|
|
// TEMPORARY
|
|
|
|
//
|
|
|
|
#define IQS_SAME(Type, Alignment, Flags) \
|
|
|
|
{ sizeof(Type), sizeof(Type), sizeof(Alignment), sizeof(Alignment), Flags }
|
|
|
|
|
|
|
|
#define IQS(TypeQuery, TypeSet, AlignmentQuery, AlignmentSet, Flags) \
|
|
|
|
{ sizeof(TypeQuery), sizeof(TypeSet), sizeof(AlignmentQuery), sizeof(AlignmentSet), Flags }
|
2005-10-10 13:03:55 +00:00
|
|
|
|
2005-08-22 13:38:30 +00:00
|
|
|
/*
|
2005-08-22 15:20:49 +00:00
|
|
|
* Use IsPointerOffset to test whether a pointer should be interpreted as an offset
|
|
|
|
* or as a pointer
|
2005-08-22 13:38:30 +00:00
|
|
|
*/
|
2008-02-07 06:40:42 +00:00
|
|
|
#if defined(_X86_) || defined(_M_AMD64) || defined(_MIPS_) || defined(_PPC_) || defined(_ARM_)
|
2005-08-22 13:38:30 +00:00
|
|
|
|
|
|
|
/* for x86 and x86-64 the MSB is 1 so we can simply test on that */
|
2005-08-22 15:20:49 +00:00
|
|
|
#define IsPointerOffset(Ptr) ((LONG_PTR)(Ptr) >= 0)
|
2005-08-22 13:38:30 +00:00
|
|
|
|
|
|
|
#elif defined(_IA64_)
|
|
|
|
|
|
|
|
/* on Itanium if the 24 most significant bits are set, we're not dealing with
|
2005-08-22 15:20:49 +00:00
|
|
|
offsets anymore. */
|
|
|
|
#define IsPointerOffset(Ptr) (((ULONG_PTR)(Ptr) & 0xFFFFFF0000000000ULL) == 0)
|
2005-08-22 13:38:30 +00:00
|
|
|
|
|
|
|
#else
|
2005-08-22 15:20:49 +00:00
|
|
|
#error IsPointerOffset() needs to be defined for this architecture
|
2005-08-22 13:38:30 +00:00
|
|
|
#endif
|
2005-08-21 15:14:36 +00:00
|
|
|
|
|
|
|
#endif
|
2000-05-13 13:51:08 +00:00
|
|
|
|
2010-07-23 23:30:00 +00:00
|
|
|
#ifdef _M_IX86
|
2006-10-01 15:52:10 +00:00
|
|
|
C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, SystemCall) == 0x300);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KTHREAD, InitialStack) == KTHREAD_INITIAL_STACK);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KTHREAD, Teb) == KTHREAD_TEB);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KTHREAD, KernelStack) == KTHREAD_KERNEL_STACK);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KTHREAD, NpxState) == KTHREAD_NPX_STATE);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KTHREAD, ServiceTable) == KTHREAD_SERVICE_TABLE);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KTHREAD, PreviousMode) == KTHREAD_PREVIOUS_MODE);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KTHREAD, TrapFrame) == KTHREAD_TRAP_FRAME);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KTHREAD, CallbackStack) == KTHREAD_CALLBACK_STACK);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KTHREAD, ApcState.Process) == KTHREAD_APCSTATE_PROCESS);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KPROCESS, DirectoryTableBase) == KPROCESS_DIRECTORY_TABLE_BASE);
|
2009-12-16 22:06:25 +00:00
|
|
|
#endif
|
2008-11-30 05:49:18 +00:00
|
|
|
|
2008-02-07 06:40:42 +00:00
|
|
|
#ifdef _M_IX86
|
2010-03-12 16:28:04 +00:00
|
|
|
C_ASSERT(FIELD_OFFSET(KPCR, NtTib.ExceptionList) == KPCR_EXCEPTION_LIST);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KPCR, SelfPcr) == KPCR_SELF);
|
2006-10-01 15:52:10 +00:00
|
|
|
C_ASSERT(FIELD_OFFSET(KPCR, IRR) == KPCR_IRR);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KPCR, IDR) == KPCR_IDR);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KPCR, Irql) == KPCR_IRQL);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, CurrentThread) == KPCR_CURRENT_THREAD);
|
2007-04-01 19:35:05 +00:00
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, NextThread) == KPCR_PRCB_NEXT_THREAD);
|
2006-10-01 15:52:10 +00:00
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, NpxThread) == KPCR_NPX_THREAD);
|
2007-04-01 19:35:05 +00:00
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) == KPCR_PRCB_DATA);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, KeSystemCalls) == KPCR_SYSTEM_CALLS);
|
2008-08-14 19:30:32 +00:00
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, DpcData) + FIELD_OFFSET(KDPC_DATA, DpcQueueDepth) == KPCR_PRCB_DPC_QUEUE_DEPTH);
|
2007-04-01 19:35:05 +00:00
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, DpcData) + 16 == KPCR_PRCB_DPC_COUNT);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, DpcStack) == KPCR_PRCB_DPC_STACK);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, TimerRequest) == KPCR_PRCB_TIMER_REQUEST);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, MaximumDpcQueueDepth) == KPCR_PRCB_MAXIMUM_DPC_QUEUE_DEPTH);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, DpcRequestRate) == KPCR_PRCB_DPC_REQUEST_RATE);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, DpcInterruptRequested) == KPCR_PRCB_DPC_INTERRUPT_REQUESTED);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, DpcRoutineActive) == KPCR_PRCB_DPC_ROUTINE_ACTIVE);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, DpcLastCount) == KPCR_PRCB_DPC_LAST_COUNT);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, TimerRequest) == KPCR_PRCB_TIMER_REQUEST);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, QuantumEnd) == KPCR_PRCB_QUANTUM_END);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, DeferredReadyListHead) == KPCR_PRCB_DEFERRED_READY_LIST_HEAD);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, PowerState) == KPCR_PRCB_POWER_STATE_IDLE_FUNCTION);
|
2008-08-14 19:30:32 +00:00
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, PrcbLock) == KPCR_PRCB_PRCB_LOCK);
|
2006-10-04 05:29:30 +00:00
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, DpcStack) == KPCR_PRCB_DPC_STACK);
|
2008-10-21 15:32:49 +00:00
|
|
|
C_ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, IdleSchedule) == KPCR_PRCB_IDLE_SCHEDULE);
|
2006-10-01 15:52:10 +00:00
|
|
|
C_ASSERT(sizeof(FX_SAVE_AREA) == SIZEOF_FX_SAVE_AREA);
|
|
|
|
|
2007-03-26 20:28:13 +00:00
|
|
|
/* Platform specific checks */
|
|
|
|
C_ASSERT(FIELD_OFFSET(KPROCESS, IopmOffset) == KPROCESS_IOPM_OFFSET);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KPROCESS, LdtDescriptor) == KPROCESS_LDT_DESCRIPTOR0);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KTSS, Esp0) == KTSS_ESP0);
|
|
|
|
C_ASSERT(FIELD_OFFSET(KTSS, IoMapBase) == KTSS_IOMAPBASE);
|
|
|
|
#endif
|