[SOFT386]
[reactos.git] / include / reactos / libs / soft386 / soft386.h
index 70f2971..9c07bc3 100644 (file)
@@ -1,9 +1,22 @@
 /*
- * COPYRIGHT:       GPL - See COPYING in the top level directory
- * PROJECT:         386/486 CPU Emulation Library
- * FILE:            soft386.h
- * PURPOSE:         Header file for Soft386.
- * PROGRAMMERS:     Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
+ * Soft386 386/486 CPU Emulation Library
+ * soft386.h
+ *
+ * Copyright (C) 2013 Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
 #ifndef _SOFT386_H_
@@ -44,7 +57,7 @@
 struct _SOFT386_STATE;
 typedef struct _SOFT386_STATE SOFT386_STATE, *PSOFT386_STATE;
 
-enum _SOFT386_GEN_REGS
+typedef enum _SOFT386_GEN_REGS
 {
     SOFT386_REG_EAX,
     SOFT386_REG_ECX,
@@ -54,9 +67,9 @@ enum _SOFT386_GEN_REGS
     SOFT386_REG_EBP,
     SOFT386_REG_ESI,
     SOFT386_REG_EDI
-};
+} SOFT386_GEN_REGS, *PSOFT386_GEN_REGS;
 
-enum _SOFT386_SEG_REGS
+typedef enum _SOFT386_SEG_REGS
 {
     SOFT386_REG_ES,
     SOFT386_REG_CS,
@@ -64,9 +77,9 @@ enum _SOFT386_SEG_REGS
     SOFT386_REG_DS,
     SOFT386_REG_FS,
     SOFT386_REG_GS
-};
+} SOFT386_SEG_REGS, *PSOFT386_SEG_REGS;
 
-enum _SOFT386_CTRL_REGS
+typedef enum _SOFT386_CTRL_REGS
 {
     SOFT386_REG_CR0,
     SOFT386_REG_CR1,
@@ -76,9 +89,9 @@ enum _SOFT386_CTRL_REGS
     SOFT386_REG_CR5,
     SOFT386_REG_CR6,
     SOFT386_REG_CR7
-};
+} SOFT386_CTRL_REGS, *PSOFT386_CTRL_REGS;
 
-enum _SOFT386_DBG_REGS
+typedef enum _SOFT386_DBG_REGS
 {
     SOFT386_REG_DR0,
     SOFT386_REG_DR1,
@@ -88,9 +101,9 @@ enum _SOFT386_DBG_REGS
     SOFT386_REG_DR5,
     SOFT386_REG_DR6,
     SOFT386_REG_DR7
-};
+} SOFT386_DBG_REGS, *PSOFT386_DBG_REGS;
 
-enum _SOFT386_EXCEPTIONS
+typedef enum _SOFT386_EXCEPTIONS
 {
     SOFT386_EXCEPTION_DE = 0x00,
     SOFT386_EXCEPTION_DB = 0x01,
@@ -108,7 +121,7 @@ enum _SOFT386_EXCEPTIONS
     SOFT386_EXCEPTION_MF = 0x10,
     SOFT386_EXCEPTION_AC = 0x11,
     SOFT386_EXCEPTION_MC = 0x12
-};
+} SOFT386_EXCEPTIONS, *PSOFT386_EXCEPTIONS;
 
 typedef
 BOOLEAN
@@ -157,6 +170,14 @@ VOID
     PSOFT386_STATE State
 );
 
+typedef
+VOID
+(NTAPI *SOFT386_BOP_PROC)
+(
+    PSOFT386_STATE State,
+    USHORT BopCode
+);
+
 typedef union _SOFT386_REG
 {
     union
@@ -227,7 +248,9 @@ typedef struct _SOFT386_TABLE_REG
 
 typedef union _SOFT386_FLAGS_REG
 {
+    USHORT LowWord;
     ULONG Long;
+
     struct
     {
         ULONG Cf        : 1;
@@ -293,6 +316,7 @@ struct _SOFT386_STATE
     SOFT386_IO_READ_PROC IoReadCallback;
     SOFT386_IO_WRITE_PROC IoWriteCallback;
     SOFT386_IDLE_PROC IdleCallback;
+    SOFT386_BOP_PROC BopCallback;
     SOFT386_REG GeneralRegs[SOFT386_NUM_GEN_REGS];
     SOFT386_SEG_REG SegmentRegs[SOFT386_NUM_SEG_REGS];
     SOFT386_REG InstPtr;
@@ -303,7 +327,7 @@ struct _SOFT386_STATE
     ULONG DebugRegisters[SOFT386_NUM_DBG_REGS];
     ULONG ExceptionCount;
     ULONG PrefixFlags;
-    INT SegmentOverride;
+    SOFT386_SEG_REGS SegmentOverride;
     BOOLEAN HardwareInt;
 };
 
@@ -341,6 +365,10 @@ VOID
 NTAPI
 Soft386ExecuteAt(PSOFT386_STATE State, USHORT Segment, ULONG Offset);
 
+VOID
+NTAPI
+Soft386SetStack(PSOFT386_STATE State, USHORT Segment, ULONG Offset);
+
 #endif // _SOFT386_H_
 
 /* EOF */