mirror of
https://github.com/reactos/reactos.git
synced 2025-04-19 12:08:55 +00:00
[SOFT386]
Halfplement Soft386ExecutionControl. svn path=/branches/ntvdm/; revision=59795
This commit is contained in:
parent
8e37700e5c
commit
675c38e1b9
4 changed files with 77 additions and 2 deletions
|
@ -2,6 +2,7 @@ include_directories(${REACTOS_SOURCE_DIR}/include/reactos/libs/soft386)
|
|||
|
||||
list(APPEND SOURCE
|
||||
soft386.c
|
||||
opcodes.c
|
||||
common.c)
|
||||
|
||||
add_library(soft386 ${SOURCE})
|
||||
|
|
28
lib/soft386/opcodes.c
Normal file
28
lib/soft386/opcodes.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* COPYRIGHT: GPL - See COPYING in the top level directory
|
||||
* PROJECT: 386/486 CPU Emulation Library
|
||||
* FILE: opcodes.c
|
||||
* PURPOSE: Opcode handlers.
|
||||
* PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
|
||||
*/
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
// #define WIN32_NO_STATUS
|
||||
// #define _INC_WINDOWS
|
||||
#include <windef.h>
|
||||
|
||||
#include <soft386.h>
|
||||
#include "opcodes.h"
|
||||
#include "common.h"
|
||||
|
||||
// #define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* PUBLIC VARIABLES ***********************************************************/
|
||||
|
||||
SOFT386_OPCODE_HANDLER_PROC
|
||||
Soft386OpcodeHandlers[SOFT386_NUM_OPCODE_HANDLERS] =
|
||||
{
|
||||
NULL
|
||||
};
|
22
lib/soft386/opcodes.h
Normal file
22
lib/soft386/opcodes.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* COPYRIGHT: GPL - See COPYING in the top level directory
|
||||
* PROJECT: 386/486 CPU Emulation Library
|
||||
* FILE: opcodes.h
|
||||
* PURPOSE: Opcode handlers. (header file)
|
||||
* PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
|
||||
*/
|
||||
|
||||
#ifndef _OPCODES_H_
|
||||
#define _OPCODES_H_
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
||||
#define SOFT386_NUM_OPCODE_HANDLERS 256
|
||||
|
||||
typedef BOOLEAN (__fastcall *SOFT386_OPCODE_HANDLER_PROC)(PSOFT386_STATE);
|
||||
|
||||
extern
|
||||
SOFT386_OPCODE_HANDLER_PROC
|
||||
Soft386OpcodeHandlers[SOFT386_NUM_OPCODE_HANDLERS];
|
||||
|
||||
#endif // _OPCODES_H_
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <soft386.h>
|
||||
#include "common.h"
|
||||
#include "opcodes.h"
|
||||
|
||||
// #define NDEBUG
|
||||
#include <debug.h>
|
||||
|
@ -36,8 +37,31 @@ VOID
|
|||
NTAPI
|
||||
Soft386ExecutionControl(PSOFT386_STATE State, INT Command)
|
||||
{
|
||||
// TODO: NOT IMPLEMENTED!!!
|
||||
UNIMPLEMENTED;
|
||||
BYTE Opcode;
|
||||
INT ProcedureCallCount = 0;
|
||||
|
||||
/* Main execution loop */
|
||||
do
|
||||
{
|
||||
/* Perform an instruction fetch */
|
||||
if (!Soft386FetchByte(State, &Opcode)) continue;
|
||||
|
||||
// TODO: Check for CALL/RET to update ProcedureCallCount.
|
||||
|
||||
if (Soft386OpcodeHandlers[Opcode] != NULL)
|
||||
{
|
||||
/* Call the opcode handler */
|
||||
Soft386OpcodeHandlers[Opcode](State);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is not a valid opcode */
|
||||
Soft386Exception(State, SOFT386_EXCEPTION_UD);
|
||||
}
|
||||
}
|
||||
while ((Command == SOFT386_CONTINUE)
|
||||
|| (Command == SOFT386_STEP_OVER && ProcedureCallCount > 0)
|
||||
|| (Command == SOFT386_STEP_OUT && ProcedureCallCount >= 0));
|
||||
}
|
||||
|
||||
/* PUBLIC FUNCTIONS ***********************************************************/
|
||||
|
|
Loading…
Reference in a new issue