- Delete bios.c and usertrap.c

- Add Ke entries to KernelFun!

svn path=/trunk/; revision=23637
This commit is contained in:
Alex Ionescu
2006-08-21 03:49:02 +00:00
parent f038f4a895
commit 0ba60c4b62
6 changed files with 65 additions and 92 deletions
+14
View File
@@ -24,6 +24,20 @@
// - Add Directory Lock.
// - Use Object Type Mutex/Lock.
//
// Ke:
// - Make sure IRQ trap code is synchronized with current trap code.
// - Reimplement the V86 support using a mode that will be compatible with
// VDM and the future and use ABIOS gates.
// - Implement Invalid Opcode and GPD handlers for V86-mode.
// - Implement stack fault and segment fault handlers.
// - Implement kernel-mode GPF handler, possibly fixing below:
// - Figure out why ES/DS gets messed up in VMWare, when doing KiServiceExit only,
// and only when called from user-mode, and returning to user-mode.
// - Figure out what the DEBUGEIP hack is for and how it can be moved away.
// - Add DR macro/save and VM macro/save.
// - Implement KiCallbackReturn, KiGetTickCount, KiRaiseAssertion.
//
//
// Ex:
// - Use pushlocks for handle implementation.
//
-78
View File
@@ -1,78 +0,0 @@
/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/i386/bios.c
* PURPOSE: Support for calling the BIOS in v86 mode
*
* PROGRAMMERS: David Welch ([email protected])
*/
/* INCLUDES *****************************************************************/
#include <ntoskrnl.h>
#define NDEBUG
#include <internal/debug.h>
/* GLOBALS *******************************************************************/
#define TRAMPOLINE_BASE (0x10000)
extern VOID Ki386RetToV86Mode(PKV86M_REGISTERS InRegs,
PKV86M_REGISTERS OutRegs);
/* FUNCTIONS *****************************************************************/
NTSTATUS STDCALL
Ke386CallBios(ULONG Int, PCONTEXT regs)
{
PUCHAR Ip;
KV86M_REGISTERS ORegs;
NTSTATUS Status;
PKV86M_REGISTERS Regs = (PKV86M_REGISTERS)regs;
/*
* Set up a trampoline for executing the BIOS interrupt
*/
Ip = (PUCHAR)TRAMPOLINE_BASE;
Ip[0] = 0xCD; /* int XX */
Ip[1] = Int;
Ip[2] = 0x63; /* arpl ax, ax */
Ip[3] = 0xC0;
Ip[4] = 0x90; /* nop */
Ip[5] = 0x90; /* nop */
/*
* Munge the registers
*/
Regs->Eip = 0;
Regs->Cs = TRAMPOLINE_BASE / 16;
Regs->Esp = 0xFFFF;
Regs->Ss = TRAMPOLINE_BASE / 16;
Regs->Eflags = (1 << 1) | (1 << 17) | (1 << 9); /* VM, IF */
Regs->RecoveryAddress = TRAMPOLINE_BASE + 2;
Regs->RecoveryInstruction[0] = 0x63; /* arpl ax, ax */
Regs->RecoveryInstruction[1] = 0xC0;
Regs->RecoveryInstruction[2] = 0x90; /* nop */
Regs->RecoveryInstruction[3] = 0x90; /* nop */
Regs->Flags = KV86M_EMULATE_CLI_STI | KV86M_ALLOW_IO_PORT_ACCESS;
Regs->Vif = 1;
Regs->PStatus = &Status;
/*
* Execute the BIOS interrupt
*/
Ki386RetToV86Mode(Regs, &ORegs);
/*
* Copy the return values back to the caller
*/
memcpy(Regs, &ORegs, sizeof(KV86M_REGISTERS));
return(Status);
}
-11
View File
@@ -12,17 +12,6 @@
#include <internal/i386/asmmacro.S>
.intel_syntax noprefix
/*
* FIXMEs:
* - Implement kernel-mode GPF handler, possibly fixing below:
* - Figure out why ES/DS gets messed up in VMWare, when doing KiServiceExit only,
* and only when called from user-mode, and returning to user-mode.
* - Implement Invalid Opcode handler.
* - Figure out what the DEBUGEIP hack is for and how it can be moved away.
* - Add DR macro/save and VM macro/save.
* - Implement KiCallbackReturn, KiGetTickCount, KiRaiseAssertion.
*/
/* GLOBALS ******************************************************************/
.globl _KiIdt
-1
View File
@@ -1 +0,0 @@
+51
View File
@@ -23,6 +23,10 @@
#define VALID_FLAGS (0xDFF)
#define TRAMPOLINE_BASE (0x10000)
VOID Ki386RetToV86Mode(KV86M_REGISTERS* InRegs,
KV86M_REGISTERS* OutRegs);
/* FUNCTIONS *****************************************************************/
ULONG
@@ -807,5 +811,52 @@ KeV86Exception(ULONG ExceptionNr, PKTRAP_FRAME Tf, ULONG address)
}
}
NTSTATUS STDCALL
Ke386CallBios(ULONG Int, PCONTEXT regs)
{
PUCHAR Ip;
KV86M_REGISTERS ORegs;
NTSTATUS Status;
PKV86M_REGISTERS Regs = (PKV86M_REGISTERS)regs;
/*
* Set up a trampoline for executing the BIOS interrupt
*/
Ip = (PUCHAR)TRAMPOLINE_BASE;
Ip[0] = 0xCD; /* int XX */
Ip[1] = Int;
Ip[2] = 0x63; /* arpl ax, ax */
Ip[3] = 0xC0;
Ip[4] = 0x90; /* nop */
Ip[5] = 0x90; /* nop */
/*
* Munge the registers
*/
Regs->Eip = 0;
Regs->Cs = TRAMPOLINE_BASE / 16;
Regs->Esp = 0xFFFF;
Regs->Ss = TRAMPOLINE_BASE / 16;
Regs->Eflags = (1 << 1) | (1 << 17) | (1 << 9); /* VM, IF */
Regs->RecoveryAddress = TRAMPOLINE_BASE + 2;
Regs->RecoveryInstruction[0] = 0x63; /* arpl ax, ax */
Regs->RecoveryInstruction[1] = 0xC0;
Regs->RecoveryInstruction[2] = 0x90; /* nop */
Regs->RecoveryInstruction[3] = 0x90; /* nop */
Regs->Flags = KV86M_EMULATE_CLI_STI | KV86M_ALLOW_IO_PORT_ACCESS;
Regs->Vif = 1;
Regs->PStatus = &Status;
/*
* Execute the BIOS interrupt
*/
Ki386RetToV86Mode(Regs, &ORegs);
/*
* Copy the return values back to the caller
*/
memcpy(Regs, &ORegs, sizeof(KV86M_REGISTERS));
return(Status);
}
-2
View File
@@ -27,7 +27,6 @@
<if property="ARCH" value="i386">
<directory name="i386">
<file first="true">main_asm.S</file>
<file>bios.c</file>
<file>cpu.S</file>
<file>ctxswitch.S</file>
<file>exp.c</file>
@@ -41,7 +40,6 @@
<file>trap.s</file>
<file>tss.c</file>
<file>usercall_asm.S</file>
<file>usertrap.c</file>
<file>v86m.c</file>
<file>v86m_sup.S</file>
<file>vdm.c</file>