Hi, I suggest the following changes to the current implementation:
1.) Replace the PUSHA in the trap entry code, by a series of MOVs to the correct stack positions. The same for the trap exit code. KiTrapFrameFromPushaStack can be removed then. This would result in more clear, less complex and faster code, with only a few additional assembly instructions in the trap entry macro. The exit could be done either by normal call/return or by a jmp to an exit handler. 2.) Segements should be fixed up before entering C code, as not doing so may introduce possible compiler dependend breakages. It's also much cleaner and there's no reason to do the same stuff later in inline assembly instead of direcly in the asm entry point. The resulting code might looks something like this: /* Allocate KTRAP_FRAME */ sub esp, KTRAP_FRAME_LENGTH - 10 * 4 /* Save integer registers */ mov [esp + KTRAP_FRAME_EBP], ebp mov [esp + KTRAP_FRAME_EBX], ebx mov [esp + KTRAP_FRAME_ESI], esi mov [esp + KTRAP_FRAME_EDI], edi mov [esp + KTRAP_FRAME_EAX], eax mov [esp + KTRAP_FRAME_ECX], ecx mov [esp + KTRAP_FRAME_EDX], edx mov [esp + KTRAP_FRAME_EBX], ebx /* Save segment regs */ mov [esp + KTRAP_FRAME_SEGDS], ds mov [esp + KTRAP_FRAME_SEGES], es /* Fixup segment regs */ mov ax, KGDT_R3_DATA | RPL_MASK mov ds, ax mov es, ax Timo _______________________________________________ Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev