ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

psctx.c
Go to the documentation of this file.
00001 /*
00002  * PROJECT:         ReactOS Kernel
00003  * LICENSE:         GPL - See COPYING in the top level directory
00004  * FILE:            ntoskrnl/ps/amd64/pxctx.c
00005  * PURPOSE:         Process Manager: Set/Get Context for i386
00006  * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
00007  *                  Timo Kreuzer (timo.kreuzer@reactos.org)
00008  */
00009 
00010 /* INCLUDES *******************************************************************/
00011 
00012 #include <ntoskrnl.h>
00013 #define NDEBUG
00014 #include <debug.h>
00015 
00016 /* FUNCTIONS ******************************************************************/
00017 
00018 VOID
00019 NTAPI
00020 PspGetContext(IN PKTRAP_FRAME TrapFrame,
00021               IN PVOID NonVolatileContext,
00022               IN OUT PCONTEXT Context)
00023 {   
00024     PAGED_CODE();
00025  
00026     /* Convert the trap frame to a context */
00027     KeTrapFrameToContext(TrapFrame, NULL, Context);
00028 }
00029 
00030 VOID
00031 NTAPI
00032 PspSetContext(OUT PKTRAP_FRAME TrapFrame,
00033               OUT PVOID NonVolatileContext,
00034               IN PCONTEXT Context,
00035               IN KPROCESSOR_MODE Mode)
00036 {   
00037     PAGED_CODE();
00038     
00039     /* Convert the context to a trap frame structure */
00040     KeContextToTrapFrame(Context, NULL, TrapFrame, Context->ContextFlags, Mode);
00041 }
00042 
00043 VOID
00044 NTAPI
00045 PspGetOrSetContextKernelRoutine(IN PKAPC Apc,
00046                                 IN OUT PKNORMAL_ROUTINE* NormalRoutine,
00047                                 IN OUT PVOID* NormalContext,
00048                                 IN OUT PVOID* SystemArgument1,
00049                                 IN OUT PVOID* SystemArgument2)
00050 {
00051     PGET_SET_CTX_CONTEXT GetSetContext;
00052     PKEVENT Event;
00053     PCONTEXT Context;
00054     PKTHREAD Thread;
00055     KPROCESSOR_MODE Mode;
00056     PKTRAP_FRAME TrapFrame = NULL;
00057     PAGED_CODE();
00058 
00059     /* Get the Context Structure */
00060     GetSetContext = CONTAINING_RECORD(Apc, GET_SET_CTX_CONTEXT, Apc);
00061     Context = &GetSetContext->Context;
00062     Event = &GetSetContext->Event;
00063     Mode = GetSetContext->Mode;
00064     Thread = Apc->SystemArgument2;
00065     
00066     /* If this is a kernel-mode request, grab the saved trap frame */
00067     if (Mode == KernelMode) TrapFrame = Thread->TrapFrame;
00068     
00069     /* If we don't have one, grab it from the stack */
00070     if (!TrapFrame)
00071     {
00072         DPRINT1("FIXME!!!!\n");
00073         /* Trap frame is right under our initial stack */
00074 //        TrapFrame = (PKTRAP_FRAME)((ULONG_PTR)Thread->InitialStack -
00075 //                                   ROUND_UP(sizeof(KTRAP_FRAME), KTRAP_FRAME_ALIGN) -
00076 //                                   sizeof(FX_SAVE_AREA));
00077     }
00078 
00079     /* Check if it's a set or get */
00080     if (Apc->SystemArgument1)
00081     {
00082         /* Get the Context */
00083         PspSetContext(TrapFrame, NULL, Context, Mode);
00084     }
00085     else
00086     {
00087         /* Set the Context */
00088         PspGetContext(TrapFrame, NULL, Context);
00089     }
00090 
00091     /* Notify the Native API that we are done */
00092     KeSetEvent(Event, IO_NO_INCREMENT, FALSE);
00093 }
00094 
00095 /* EOF */

Generated on Sat May 26 2012 04:36:32 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.