Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

vdmint21.c File Reference

#include "ki.h"
#include "vdmntos.h"

Go to the source code of this file.

Defines

#define IDT_ACCESS_DPL_USER   0x6000
#define IDT_ACCESS_TYPE_386_TRAP   0xF00
#define IDT_ACCESS_TYPE_286_TRAP   0x700
#define IDT_ACCESS_PRESENT   0x8000
#define LDT_MASK   4
#define KiLoadInt21Entry()   KeGetPcr()->IDT[0x21] = PsGetCurrentProcess()->Pcb.Int21Descriptor

Functions

BOOLEAN Ki386GetSelectorParameters (IN USHORT Selector, OUT PULONG Flags, OUT PULONG Base, OUT PULONG Limit)
VOID Ki386LoadTargetInt21Entry (IN PKIPI_CONTEXT SignalDone, IN PVOID Parameter1, IN PVOID Parameter2, IN PVOID Parameter3)
NTSTATUS Ke386SetVdmInterruptHandler (PKPROCESS Process, ULONG Interrupt, USHORT Selector, ULONG Offset, BOOLEAN Gate32)


Define Documentation

#define IDT_ACCESS_DPL_USER   0x6000
 

Definition at line 30 of file vdmint21.c.

Referenced by Ke386SetVdmInterruptHandler().

#define IDT_ACCESS_PRESENT   0x8000
 

Definition at line 33 of file vdmint21.c.

Referenced by Ke386SetVdmInterruptHandler().

#define IDT_ACCESS_TYPE_286_TRAP   0x700
 

Definition at line 32 of file vdmint21.c.

Referenced by Ke386SetVdmInterruptHandler().

#define IDT_ACCESS_TYPE_386_TRAP   0xF00
 

Definition at line 31 of file vdmint21.c.

Referenced by Ke386SetVdmInterruptHandler().

 
#define KiLoadInt21Entry  )     KeGetPcr()->IDT[0x21] = PsGetCurrentProcess()->Pcb.Int21Descriptor
 

Definition at line 60 of file vdmint21.c.

Referenced by Ke386SetVdmInterruptHandler(), and Ki386LoadTargetInt21Entry().

#define LDT_MASK   4
 

Definition at line 34 of file vdmint21.c.

Referenced by Ke386SetVdmInterruptHandler().


Function Documentation

NTSTATUS Ke386SetVdmInterruptHandler PKPROCESS  Process,
ULONG  Interrupt,
USHORT  Selector,
ULONG  Offset,
BOOLEAN  Gate32
 

Definition at line 64 of file vdmint21.c.

References _KPROCESS::ActiveProcessors, IDT_ACCESS_DPL_USER, IDT_ACCESS_PRESENT, IDT_ACCESS_TYPE_286_TRAP, IDT_ACCESS_TYPE_386_TRAP, KeGetCurrentPrcb, Ki386GetSelectorParameters(), Ki386LoadTargetInt21Entry(), KiIpiSendPacket(), KiIpiStallOnPacketTargets(), KiLoadInt21Entry, KiLockContextSwap, KiUnlockContextSwap, LDT_MASK, NULL, Offset, and USHORT.

Referenced by NtVdmControl().

00074 : 00075 00076 The specified (software) interrupt entry of IDT will be updated to 00077 point to the specified handler. For all threads which belong to the 00078 specified process, their execution processors will be notified to 00079 make the same change. 00080 00081 This function only exists on i386 and i386 compatible processors. 00082 00083 No checking is done on the validity of the interrupt handler. 00084 00085 Arguments: 00086 00087 Process - Pointer to KPROCESS object describing the process for 00088 which the int 21 entry is to be set. 00089 00090 Interrupt - The software interrupt vector which will be updated. 00091 00092 Selector, offset - Specified the address of the new handler. 00093 00094 Gate32 - True if the gate should be 32 bit, false otherwise 00095 00096 Return Value: 00097 00098 NTSTATUS. 00099 00100 --*/ 00101 00102 { 00103 00104 KIRQL OldIrql; 00105 BOOLEAN LocalProcessor; 00106 KAFFINITY TargetProcessors; 00107 PKPRCB Prcb; 00108 KIDTENTRY IdtDescriptor; 00109 ULONG Flags, Base, Limit; 00110 00111 // 00112 // Check the validity of the request 00113 // 1. Currently, we support int21 redirection only 00114 // 2. The specified interrupt handler must be in user space. 00115 // 00116 00117 if (Interrupt != 0x21 || Offset >= (ULONG)MM_HIGHEST_USER_ADDRESS || 00118 !Ki386GetSelectorParameters(Selector, &Flags, &Base, &Limit) ){ 00119 return(STATUS_INVALID_PARAMETER); 00120 } 00121 00122 // 00123 // Initialize the contents of the IDT entry 00124 // 00125 00126 IdtDescriptor.Offset = (USHORT)Offset; 00127 IdtDescriptor.Selector = Selector | RPL_MASK | LDT_MASK; 00128 IdtDescriptor.ExtendedOffset = (USHORT)(Offset >> 16); 00129 IdtDescriptor.Access = IDT_ACCESS_DPL_USER | IDT_ACCESS_PRESENT; 00130 if (Gate32) { 00131 IdtDescriptor.Access |= IDT_ACCESS_TYPE_386_TRAP; 00132 00133 } else { 00134 IdtDescriptor.Access |= IDT_ACCESS_TYPE_286_TRAP; 00135 } 00136 00137 // 00138 // Acquire the context swap lock so a context switch will not occur. 00139 // 00140 00141 KiLockContextSwap(&OldIrql); 00142 00143 // 00144 // Set the Ldt fields in the process object 00145 // 00146 00147 Process->Int21Descriptor = IdtDescriptor; 00148 00149 // 00150 // Tell all processors active for this process to reload their LDTs 00151 // 00152 00153 #if !defined(NT_UP) 00154 00155 Prcb = KeGetCurrentPrcb(); 00156 TargetProcessors = Process->ActiveProcessors & ~Prcb->SetMember; 00157 if (TargetProcessors != 0) { 00158 KiIpiSendPacket(TargetProcessors, 00159 Ki386LoadTargetInt21Entry, 00160 NULL, 00161 NULL, 00162 NULL); 00163 } 00164 00165 #endif 00166 00167 KiLoadInt21Entry(); 00168 00169 #if !defined(NT_UP) 00170 00171 // 00172 // Wait until all of the target processors have finished reloading 00173 // their LDT. 00174 // 00175 00176 if (TargetProcessors != 0) { 00177 KiIpiStallOnPacketTargets(TargetProcessors); 00178 } 00179 00180 #endif 00181 00182 // 00183 // Restore IRQL and unlock the context swap lock. 00184 // 00185 00186 KiUnlockContextSwap(OldIrql); 00187 return STATUS_SUCCESS; 00188 }

BOOLEAN Ki386GetSelectorParameters IN USHORT  Selector,
OUT PULONG  Flags,
OUT PULONG  Base,
OUT PULONG  Limit
 

Referenced by Ke386SetVdmInterruptHandler(), PushPmInterrupt(), and VdmConvertToLinearAddress().

VOID Ki386LoadTargetInt21Entry IN PKIPI_CONTEXT  SignalDone,
IN PVOID  Parameter1,
IN PVOID  Parameter2,
IN PVOID  Parameter3
 

Definition at line 194 of file vdmint21.c.

References KiIpiSignalPacketDone(), and KiLoadInt21Entry.

Referenced by Ke386SetVdmInterruptHandler().

00202 : 00203 00204 Reload local Ldt register and clear signal bit in TargetProcessor mask 00205 00206 Arguments: 00207 00208 Argument - pointer to a ipi packet structure. 00209 ReadyFlag - Pointer to flag to be set once LDTR has been reloaded 00210 00211 Return Value: 00212 00213 none. 00214 00215 --*/ 00216 00217 { 00218 00219 // 00220 // Set the int 21 entry of IDT from currently active process object 00221 // 00222 00223 KiLoadInt21Entry(); 00224 KiIpiSignalPacketDone(PacketContext); 00225 return; 00226 }


Generated on Sat May 15 19:46:07 2004 for test by doxygen 1.3.7