Author: tkreuzer
Date: Fri Feb 26 01:07:22 2010
New Revision: 45683
URL:
http://svn.reactos.org/svn/reactos?rev=45683&view=rev
Log:
[HAL]
- 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.
Modified:
trunk/reactos/hal/halx86/generic/bios.c
trunk/reactos/hal/halx86/generic/trap.S
trunk/reactos/hal/halx86/include/halp.h
Modified: trunk/reactos/hal/halx86/generic/bios.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/bios.c?…
==============================================================================
--- trunk/reactos/hal/halx86/generic/bios.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/bios.c [iso-8859-1] Fri Feb 26 01:07:22 2010
@@ -53,24 +53,6 @@
/* 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 @@
V86TrapFrame.Eip = CodeOffset;
/* Exit to V86 mode */
- KiDirectTrapReturn((PKTRAP_FRAME)&V86TrapFrame);
+ HalpExitToV86((PKTRAP_FRAME)&V86TrapFrame);
}
/* FUNCTIONS ******************************************************************/
Modified: trunk/reactos/hal/halx86/generic/trap.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/trap.S?…
==============================================================================
--- trunk/reactos/hal/halx86/generic/trap.S [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/trap.S [iso-8859-1] Fri Feb 26 01:07:22 2010
@@ -20,4 +20,26 @@
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
+
Modified: trunk/reactos/hal/halx86/include/halp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/halp.h?…
==============================================================================
--- trunk/reactos/hal/halx86/include/halp.h [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/include/halp.h [iso-8859-1] Fri Feb 26 01:07:22 2010
@@ -73,44 +73,6 @@
// Video Modes for INT10h AH=00 (in AL)
//
#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 @@
VOID
);
+VOID
+FASTCALL
+HalpExitToV86(
+ PKTRAP_FRAME TrapFrame
+);
+
+VOID
+DECLSPEC_NORETURN
+HalpRealModeStart(
+ VOID
+);
+
//
// Processor Halt Routine
//