- Replace the inline assembly for entering V86 and the actual V86 stub with real assembly. This is neccesary for compiler portability. Also creating 16 bit V86 assembly using 32 bit inline assembly is rather hackish.

svn path=/trunk/; revision=45683
This commit is contained in:
Timo Kreuzer
2010-02-26 00:07:22 +00:00
parent d58b589596
commit b69e24713a
3 changed files with 35 additions and 57 deletions
+1 -19
View File
@@ -53,24 +53,6 @@ extern PVOID HalpRealModeEnd;
/* Context saved for return from v86 mode */
jmp_buf HalpSavedContext;
/* REAL MODE CODE AND STACK START HERE ****************************************/
VOID
DECLSPEC_NORETURN
HalpRealModeStart(VOID)
{
/* Do the video BIOS interrupt */
HalpCallBiosInterrupt(VIDEO_SERVICES, (SET_VIDEO_MODE << 8) | (GRAPHICS_MODE_12));
/* Issue the BOP */
KiIssueBop();
/* We want the stack to be inside this function so we can map real mode */
HalpRealModeStack(sizeof(ULONG), PAGE_SIZE / 2);
UNREACHABLE;
}
/* REAL MODE CODE AND STACK END HERE ******************************************/
/* V86 OPCODE HANDLERS ********************************************************/
@@ -292,7 +274,7 @@ HalpBiosCall()
V86TrapFrame.Eip = CodeOffset;
/* Exit to V86 mode */
KiDirectTrapReturn((PKTRAP_FRAME)&V86TrapFrame);
HalpExitToV86((PKTRAP_FRAME)&V86TrapFrame);
}
/* FUNCTIONS ******************************************************************/
+22
View File
@@ -20,4 +20,26 @@ TRAP_ENTRY HalpApcInterrupt, KI_SOFTWARE_TRAP
TRAP_ENTRY HalpClockInterrupt, KI_PUSH_FAKE_ERROR_CODE
TRAP_ENTRY HalpProfileInterrupt, KI_PUSH_FAKE_ERROR_CODE
PUBLIC @HalpExitToV86@4
@HalpExitToV86@4:
/* Point esp to the iret frame and return */
lea esp, [ecx + KTRAP_FRAME_EIP]
iret
/* Here starts the real mode code */
.code16
PUBLIC _HalpRealModeStart
_HalpRealModeStart:
/* INT 0x10: AH = 0 (Set video Mode), AL = 0x12 (Mode 12) */
mov eax, HEX(12)
int HEX(10)
/* BOP */
.byte HEX(C4), HEX(C4)
/* The real mode stack */
.align 4
.space 2048
_HalpRealModeEnd:
PUBLIC _HalpRealModeEnd
+12 -38
View File
@@ -74,44 +74,6 @@ DECLSPEC_NORETURN
//
#define GRAPHICS_MODE_12 0x12 /* 80x30 8x16 640x480 16/256K */
//
// Generates a 16-bit (real-mode or Virtual 8086) BIOS interrupt with a given AX */
//
VOID
FORCEINLINE
HalpCallBiosInterrupt(IN ULONG Interrupt,
IN ULONG Ax)
{
__asm__ __volatile__
(
".byte 0x66\n"
"movl $%c[v], %%eax\n"
"int $%c[i]\n"
:
: [v] "i"(Ax),
[i] "i"(Interrupt)
);
}
//
// Constructs a stack of the given size and alignment in the real-mode .text region */
//
VOID
FORCEINLINE
HalpRealModeStack(IN ULONG Alignment,
IN ULONG Size)
{
__asm__ __volatile__
(
".align %c[v]\n"
".space %c[i]\n"
".globl _HalpRealModeEnd\n_HalpRealModeEnd:\n"
:
: [v] "i"(Alignment),
[i] "i"(Size)
);
}
//
// Commonly stated as being 1.19318MHz
//
@@ -675,6 +637,18 @@ HalpBiosDisplayReset(
VOID
);
VOID
FASTCALL
HalpExitToV86(
PKTRAP_FRAME TrapFrame
);
VOID
DECLSPEC_NORETURN
HalpRealModeStart(
VOID
);
//
// Processor Halt Routine
//