From fc779d75d9d9ec800809dab71c848e76e8c28ed3 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Tue, 18 Jan 2005 04:02:49 +0000 Subject: [PATCH] MSVC compatibility for NCITool, fix more svn:ignore stuff..., enable interrupts during APC delivery and syscall calling, because the functions are probably expecting them to be enabled at that time. svn path=/trunk/; revision=13110 --- reactos/ntoskrnl/ke/i386/syscall.S | 5 ++++- reactos/tools/nci/ncitool.c | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/ke/i386/syscall.S b/reactos/ntoskrnl/ke/i386/syscall.S index 7a8d833c6a1..737f2f86d08 100644 --- a/reactos/ntoskrnl/ke/i386/syscall.S +++ b/reactos/ntoskrnl/ke/i386/syscall.S @@ -105,10 +105,10 @@ _KiSystemService: #endif /* Load the segment registers */ + sti movw $KERNEL_DS, %bx movw %bx, %ds movw %bx, %es - movw %bx, %gs /* Save the old trap frame pointer where EDX would be saved */ movl KTHREAD_TRAP_FRAME(%esi), %ebx @@ -192,6 +192,7 @@ KeReturnFromSystemCall: _KiServiceExit: /* Get the Current Thread */ + cli movl %fs:KPCR_CURRENT_THREAD, %esi /* Deliver APCs only if we were called from user mode */ @@ -213,10 +214,12 @@ _KiServiceExit: pushl %eax /* Deliver APCs */ + sti pushl %ebx pushl $0 pushl $UserMode call _KiDeliverApc@12 + cli /* Return to old IRQL */ popl %ecx diff --git a/reactos/tools/nci/ncitool.c b/reactos/tools/nci/ncitool.c index 8904e4396e2..c979d2650d1 100644 --- a/reactos/tools/nci/ncitool.c +++ b/reactos/tools/nci/ncitool.c @@ -46,21 +46,45 @@ * This stubs calls into KUSER_SHARED_DATA where either a * sysenter or interrupt is performed, depending on CPU support. */ +#if defined(__GNUC__) #define UserModeStub_x86 " movl $0x%x, %%eax\n" \ " movl $KUSER_SHARED_SYSCALL, %%ecx\n" \ " call *%%ecx\n" \ " ret $0x%x\n\n" +#elif defined(_MSC_VER) +#define UserModeStub_x86 " asm { \n" \ + " mov eax, %xh\n" \ + " mov ecx, KUSER_SHARED_SYSCALL\n" \ + " call [ecx]\n" \ + " ret %xh\n" \ + " }\n" +#else +#error Unknown compiler for inline assembler +#endif /* * This stub calls KiSystemService directly with a fake INT2E stack. * Because EIP is pushed during the call, the handler will return here. */ +#if defined(__GNUC__) #define KernelModeStub_x86 " movl $0x%x, %%eax\n" \ " leal 4(%%esp), %%edx\n" \ " pushfl\n" \ " pushl $KERNEL_CS\n" \ " call _KiSystemService\n" \ " ret $0x%x\n\n" +#elif defined(_MSC_VER) +#define KernelModeStub_x86 " asm { \n" \ + " mov eax, %xh\n" \ + " lea edx, [esp+4]\n" \ + " pushf\n" \ + " push KERNEL_CS\n" \ + " call _KiSystemService\n" \ + " ret %xh\n" \ + " }\n" +#else +#error Unknown compiler for inline assembler +#endif /***** Arch Dependent Stuff ******/ //#ifdef _M_IX86