mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
[FREELDR]
Reimplement Int386 based on realmode callback mechanism. svn path=/trunk/; revision=52227
This commit is contained in:
parent
cdd784fd19
commit
5d9b09f212
4 changed files with 73 additions and 32 deletions
|
@ -19,7 +19,6 @@ if(ARCH MATCHES i386)
|
|||
arch/i386/i386pnp.S
|
||||
arch/i386/i386pxe.S
|
||||
arch/i386/i386trap.S
|
||||
arch/i386/int386.S
|
||||
arch/i386/linux.S
|
||||
arch/i386/mb.S
|
||||
arch/i386/i386bug.c)
|
||||
|
|
|
@ -63,8 +63,6 @@ _FrldrStartup:
|
|||
mov eax, dword ptr ds:[BSS_RealModeEntry]
|
||||
mov dword ptr ds:[SwitchToReal16Address], eax
|
||||
|
||||
call _Int386_ // test
|
||||
|
||||
/* GO! */
|
||||
xor eax, eax
|
||||
push eax
|
||||
|
@ -222,8 +220,25 @@ PUBLIC _EnableA20
|
|||
_EnableA20:
|
||||
ret
|
||||
|
||||
PUBLIC _Int386_
|
||||
_Int386_:
|
||||
Int386_regsin:
|
||||
.long 0
|
||||
Int386_regsout:
|
||||
.long 0
|
||||
|
||||
/*
|
||||
* int Int386(int ivec, REGS* in, REGS* out);
|
||||
*/
|
||||
PUBLIC _Int386
|
||||
_Int386:
|
||||
|
||||
/* Get the function parameters */
|
||||
mov eax, dword ptr [esp + 4]
|
||||
mov dword ptr ds:[BSS_IntVector], eax
|
||||
mov eax, dword ptr [esp + 8]
|
||||
mov dword ptr [Int386_regsin], eax
|
||||
mov eax, dword ptr [esp + 12]
|
||||
mov dword ptr [Int386_regsout], eax
|
||||
|
||||
/* Save all registers + segment registers */
|
||||
push ds
|
||||
push es
|
||||
|
@ -231,8 +246,14 @@ _Int386_:
|
|||
push gs
|
||||
pusha
|
||||
|
||||
/* Copy input registers */
|
||||
mov esi, dword ptr [Int386_regsin]
|
||||
mov edi, BSS_RegisterSet
|
||||
mov ecx, 9
|
||||
rep movsd
|
||||
|
||||
/* Set the callback index */
|
||||
mov cx, 1234
|
||||
mov bx, 0
|
||||
|
||||
/* Set continue address and switch to real mode */
|
||||
mov dword ptr [ContinueAddress], offset Int386_return
|
||||
|
@ -240,6 +261,12 @@ _Int386_:
|
|||
|
||||
Int386_return:
|
||||
|
||||
/* Copy output registers */
|
||||
mov esi, BSS_RegisterSet
|
||||
mov edi, dword ptr [Int386_regsout]
|
||||
mov ecx, 9
|
||||
rep movsd
|
||||
|
||||
popa
|
||||
pop gs
|
||||
pop fs
|
||||
|
|
|
@ -91,10 +91,10 @@ inrmode:
|
|||
|
||||
sti /* These are ok now */
|
||||
|
||||
/* Do the callback, specified by cx */
|
||||
// call word ptr CallbackTable[cx * 4]
|
||||
mov ax, cx
|
||||
call writehex4
|
||||
/* Do the callback, specified by bx */
|
||||
shl bx, 1
|
||||
call word ptr ds:[callback_table + bx]
|
||||
|
||||
|
||||
/*
|
||||
* Switches the processor to protected mode
|
||||
|
@ -123,6 +123,8 @@ pm_offset:
|
|||
nop
|
||||
|
||||
|
||||
callback_table:
|
||||
.word Int386
|
||||
|
||||
|
||||
/* 16-bit stack pointer */
|
||||
|
|
|
@ -1,26 +1,33 @@
|
|||
|
||||
|
||||
Int386:
|
||||
/* Save all registers + segment registers */
|
||||
push ds
|
||||
push es
|
||||
push fs
|
||||
push gs
|
||||
pushad
|
||||
|
||||
/* Get the interupt vector and patch the opcode */
|
||||
mov al, byte ptr ds:[BSS_IntVector]
|
||||
mov byte ptr ds:[Int386_vector_opcode], al
|
||||
|
||||
/* Setup the registers */
|
||||
mov ax, word ptr cs:[BSS_RegisterSet + REGS_DS]
|
||||
mov ds, ax /* DS register */
|
||||
mov ds, ax
|
||||
mov ax, word ptr cs:[BSS_RegisterSet + REGS_ES]
|
||||
mov es, ax /* ES register */
|
||||
mov es, ax
|
||||
mov ax, word ptr cs:[BSS_RegisterSet + REGS_FS]
|
||||
mov fs, ax /* FS register */
|
||||
mov fs, ax
|
||||
mov ax, word ptr cs:[BSS_RegisterSet + REGS_GS]
|
||||
mov gs, ax /* GS register */
|
||||
mov gs, ax
|
||||
|
||||
mov eax, dword ptr cs:[BSS_RegisterSet + REGS_EAX] /* EAX register */
|
||||
mov ebx, dword ptr cs:[BSS_RegisterSet + REGS_EBX] /* EBX register */
|
||||
mov ecx, dword ptr cs:[BSS_RegisterSet + REGS_ECX] /* ECX register */
|
||||
mov edx, dword ptr cs:[BSS_RegisterSet + REGS_EDX] /* EDX register */
|
||||
mov esi, dword ptr cs:[BSS_RegisterSet + REGS_ESI] /* ESI register */
|
||||
mov edi, dword ptr cs:[BSS_RegisterSet + REGS_EDI] /* EDI register */
|
||||
mov eax, dword ptr cs:[BSS_RegisterSet + REGS_EAX]
|
||||
mov ebx, dword ptr cs:[BSS_RegisterSet + REGS_EBX]
|
||||
mov ecx, dword ptr cs:[BSS_RegisterSet + REGS_ECX]
|
||||
mov edx, dword ptr cs:[BSS_RegisterSet + REGS_EDX]
|
||||
mov esi, dword ptr cs:[BSS_RegisterSet + REGS_ESI]
|
||||
mov edi, dword ptr cs:[BSS_RegisterSet + REGS_EDI]
|
||||
|
||||
/* Do not set the flags register */
|
||||
/* only return its value in regsout */
|
||||
|
@ -32,24 +39,30 @@ Int386_vector_opcode:
|
|||
.byte 0x00
|
||||
|
||||
/* Save the registers */
|
||||
mov dword ptr cs:[BSS_RegisterSet + REGS_EAX], eax /* EAX register */
|
||||
mov dword ptr cs:[BSS_RegisterSet + REGS_EBX], ebx /* EBX register */
|
||||
mov dword ptr cs:[BSS_RegisterSet + REGS_ECX], ecx /* ECX register */
|
||||
mov dword ptr cs:[BSS_RegisterSet + REGS_EDX], edx /* EDX register */
|
||||
mov dword ptr cs:[BSS_RegisterSet + REGS_ESI], esi /* ESI register */
|
||||
mov dword ptr cs:[BSS_RegisterSet + REGS_EDI], edi /* EDI register */
|
||||
mov dword ptr cs:[BSS_RegisterSet + REGS_EAX], eax
|
||||
mov dword ptr cs:[BSS_RegisterSet + REGS_EBX], ebx
|
||||
mov dword ptr cs:[BSS_RegisterSet + REGS_ECX], ecx
|
||||
mov dword ptr cs:[BSS_RegisterSet + REGS_EDX], edx
|
||||
mov dword ptr cs:[BSS_RegisterSet + REGS_ESI], esi
|
||||
mov dword ptr cs:[BSS_RegisterSet + REGS_EDI], edi
|
||||
|
||||
mov ax, ds /* DS register */
|
||||
mov ax, ds
|
||||
mov word ptr cs:[BSS_RegisterSet + REGS_DS], ax
|
||||
mov ax, es /* ES register */
|
||||
mov ax, es
|
||||
mov word ptr cs:[BSS_RegisterSet + REGS_ES], ax
|
||||
mov ax, fs /* FS register */
|
||||
mov ax, fs
|
||||
mov word ptr cs:[BSS_RegisterSet + REGS_FS], ax
|
||||
mov ax, gs /* GS register */
|
||||
mov ax, gs
|
||||
mov word ptr cs:[BSS_RegisterSet + REGS_GS], ax
|
||||
|
||||
pushf
|
||||
pop dword ptr cs:[BSS_RegisterSet + REGS_EFLAGS] /* EFLAGS register */
|
||||
pushfd
|
||||
pop dword ptr cs:[BSS_RegisterSet + REGS_EFLAGS]
|
||||
|
||||
popad
|
||||
pop gs
|
||||
pop fs
|
||||
pop es
|
||||
pop ds
|
||||
|
||||
ret
|
||||
|
||||
|
|
Loading…
Reference in a new issue