ReactOS 0.4.15-dev-7924-g5949c20
psctx.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for psctx.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

 _IRQL_requires_ (APC_LEVEL)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file psctx.c.

Function Documentation

◆ _IRQL_requires_()

_IRQL_requires_ ( APC_LEVEL  )

Definition at line 19 of file psctx.c.

28{
29 PGET_SET_CTX_CONTEXT GetSetContext;
31 PKTRAP_FRAME TrapFrame = NULL;
32
33 PAGED_CODE();
34
35 /* Get the Context Structure */
36 GetSetContext = CONTAINING_RECORD(Apc, GET_SET_CTX_CONTEXT, Apc);
37 Thread = Apc->SystemArgument2;
39
40 /* If this is a kernel-mode request, grab the saved trap frame */
41 if (GetSetContext->Mode == KernelMode)
42 {
43 TrapFrame = Thread->TrapFrame;
44 }
45
46 /* If we don't have one, grab it from the stack */
47 if (TrapFrame == NULL)
48 {
49 /* Get the thread's base trap frame */
51 }
52
53 /* Check if it's a set or get */
54 if (Apc->SystemArgument1 != 0)
55 {
56 /* Set the nonvolatiles on the stack, target frame is the trap frame */
57 KiSetTrapContext(TrapFrame, &GetSetContext->Context, GetSetContext->Mode);
58 }
59 else
60 {
61 /* Convert the trap frame to a context */
62 KeTrapFrameToContext(TrapFrame,
63 NULL,
64 &GetSetContext->Context);
65 }
66
67 /* Notify the Native API that we are done */
68 KeSetEvent(&GetSetContext->Event, IO_NO_INCREMENT, FALSE);
69}
#define PAGED_CODE()
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define KeGetCurrentThread
Definition: hal.h:55
#define KernelMode
Definition: asm.h:34
VOID KiSetTrapContext(_Out_ PKTRAP_FRAME TrapFrame, _In_ PCONTEXT Context, _In_ KPROCESSOR_MODE RequestorMode)
#define KeGetTrapFrame(Thread)
Definition: ke.h:208
VOID NTAPI KeTrapFrameToContext(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN OUT PCONTEXT Context)
Definition: context.c:169
CONTEXT Context
Definition: ps.h:87
KEVENT Event
Definition: ps.h:85
KPROCESSOR_MODE Mode
Definition: ps.h:86
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define NT_ASSERT
Definition: rtlfuncs.h:3310