mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
added support for shadow syscall table
svn path=/trunk/; revision=997
This commit is contained in:
parent
7cb2e823a0
commit
5db4e55264
1 changed files with 72 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: usercall.c,v 1.6 2000/02/21 22:41:05 ekohl Exp $
|
||||
/* $Id: usercall.c,v 1.7 2000/02/22 07:27:30 rex Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -178,13 +178,70 @@ void interrupt_handler2e(void);
|
|||
/* Users's current stack frame pointer is source */
|
||||
"movl %edx,%esi\n\t"
|
||||
|
||||
/* FIXME: determine system service table to use */
|
||||
/* FIXME: check to see if SS is valid/inrange */
|
||||
/* Determine system service table to use */
|
||||
"cmpl $0x0fff, %eax\n\t"
|
||||
"ja useShadowTable\n\t"
|
||||
|
||||
/* Check to see if SS is valid/inrange */
|
||||
"cmpl _KeServiceDescriptorTable + 8, %eax\n\t"
|
||||
"jbe serviceInRange\n\t"
|
||||
"movl $"STR(STATUS_INVALID_SYSTEM_SERVICE)", %eax\n\t"
|
||||
"jmp done\n\t"
|
||||
|
||||
"serviceInRange:\n\t"
|
||||
|
||||
/* Allocate room for argument list from kernel stack */
|
||||
"movl %es:_MainSSPT(,%eax,4), %ecx\n\t"
|
||||
//"movl %es:__SystemServiceTable(,%eax,8),%ecx\n\t"
|
||||
"subl %ecx,%esp\n\t"
|
||||
"movl %es:_KeServiceDescriptorTable + 12, %ecx\n\t"
|
||||
"movl %es:(%ecx, %eax, 4), %ecx\n\t"
|
||||
"subl %ecx, %esp\n\t"
|
||||
|
||||
/* Copy the arguments from the user stack to the kernel stack */
|
||||
"movl %esp,%edi\n\t"
|
||||
"rep\n\tmovsb\n\t"
|
||||
|
||||
/* DS is now also kernel segment */
|
||||
"movw %bx, %ds\n\t"
|
||||
|
||||
/* Call system call hook */
|
||||
"pushl %eax\n\t"
|
||||
"call _KiSystemCallHook\n\t"
|
||||
"popl %eax\n\t"
|
||||
|
||||
/* Make the system service call */
|
||||
"movl %es:_KeServiceDescriptorTable, %ecx\n\t"
|
||||
"movl %es:(%ecx, %eax, 4), %eax\n\t"
|
||||
"call *%eax\n\t"
|
||||
|
||||
#if CHECKED
|
||||
/* Bump Service Counter */
|
||||
#endif
|
||||
|
||||
/* Deallocate the kernel stack frame */
|
||||
"movl %ebp,%esp\n\t"
|
||||
|
||||
/* Call the post system call hook and deliver any pending APCs */
|
||||
"pushl %eax\n\t"
|
||||
"call _KiAfterSystemCallHook\n\t"
|
||||
"addl $8,%esp\n\t"
|
||||
|
||||
"jmp done\n\t"
|
||||
|
||||
"useShadowTable:\n\t"
|
||||
|
||||
"subl $0x1000, %eax\n\t"
|
||||
|
||||
/* Check to see if SS is valid/inrange */
|
||||
"cmpl _KeServiceDescriptorTableShadow + 8, %eax\n\t"
|
||||
"jbe shadowServiceInRange\n\t"
|
||||
"movl $"STR(STATUS_INVALID_SYSTEM_SERVICE)", %eax\n\t"
|
||||
"jmp done\n\t"
|
||||
|
||||
"shadowServiceInRange:\n\t"
|
||||
|
||||
/* Allocate room for argument list from kernel stack */
|
||||
"movl %es:_KeServiceDescriptorTableShadow + 12, %ecx\n\t"
|
||||
"movl %es:(%ecx, %eax, 4), %ecx\n\t"
|
||||
"subl %ecx, %esp\n\t"
|
||||
|
||||
/* Copy the arguments from the user stack to the kernel stack */
|
||||
"movl %esp,%edi\n\t"
|
||||
|
@ -199,9 +256,13 @@ void interrupt_handler2e(void);
|
|||
"popl %eax\n\t"
|
||||
|
||||
/* Make the system service call */
|
||||
//"movl %ds:__SystemServiceTable+4(,%eax,8),%eax\n\t"
|
||||
"movl %ds:_MainSSDT(,%eax,4),%eax\n\t"
|
||||
"call *%eax\n\t"
|
||||
"movl %es:_KeServiceDescriptorTableShadow, %ecx\n\t"
|
||||
"movl %es:(%ecx, %eax, 4), %eax\n\t"
|
||||
"call *%eax\n\t"
|
||||
|
||||
#if CHECKED
|
||||
/* Bump Service Counter */
|
||||
#endif
|
||||
|
||||
/* Deallocate the kernel stack frame */
|
||||
"movl %ebp,%esp\n\t"
|
||||
|
@ -211,6 +272,8 @@ void interrupt_handler2e(void);
|
|||
"call _KiAfterSystemCallHook\n\t"
|
||||
"addl $8,%esp\n\t"
|
||||
|
||||
"done:\n\t"
|
||||
|
||||
/* Restore the user context */
|
||||
"addl $4,%esp\n\t" /* UserContext */
|
||||
"addl $24,%esp\n\t" /* Dr[0-3,6-7] */
|
||||
|
|
Loading…
Reference in a new issue