[FAST486]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Sat, 19 Oct 2013 18:36:04 +0000 (18:36 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Sat, 19 Oct 2013 18:36:04 +0000 (18:36 +0000)
Implement PUSH/POP FS/GS.

svn path=/branches/ntvdm/; revision=60711

lib/fast486/extraops.c
lib/fast486/extraops.h

index 18dc09a..de06eff 100644 (file)
@@ -198,16 +198,16 @@ Fast486ExtendedHandlers[FAST486_NUM_OPCODE_HANDLERS] =
     Fast486ExtOpcodeConditionalSet,
     Fast486ExtOpcodeConditionalSet,
     Fast486ExtOpcodeConditionalSet,
     Fast486ExtOpcodeConditionalSet,
     Fast486ExtOpcodeConditionalSet,
     Fast486ExtOpcodeConditionalSet,
-    NULL, // TODO: OPCODE 0xA0 NOT IMPLEMENTED
-    NULL, // TODO: OPCODE 0xA1 NOT IMPLEMENTED
+    Fast486ExtOpcodePushFs,
+    Fast486ExtOpcodePopFs,
     NULL, // Invalid
     NULL, // TODO: OPCODE 0xA3 NOT IMPLEMENTED
     NULL, // TODO: OPCODE 0xA4 NOT IMPLEMENTED
     NULL, // TODO: OPCODE 0xA5 NOT IMPLEMENTED
     NULL, // Invalid
     NULL, // Invalid
     NULL, // Invalid
     NULL, // TODO: OPCODE 0xA3 NOT IMPLEMENTED
     NULL, // TODO: OPCODE 0xA4 NOT IMPLEMENTED
     NULL, // TODO: OPCODE 0xA5 NOT IMPLEMENTED
     NULL, // Invalid
     NULL, // Invalid
-    NULL, // TODO: OPCODE 0xA8 NOT IMPLEMENTED
-    NULL, // TODO: OPCODE 0xA9 NOT IMPLEMENTED
+    Fast486ExtOpcodePushGs,
+    Fast486ExtOpcodePopGs,
     NULL, // TODO: OPCODE 0xAA NOT IMPLEMENTED
     NULL, // TODO: OPCODE 0xAB NOT IMPLEMENTED
     NULL, // TODO: OPCODE 0xAC NOT IMPLEMENTED
     NULL, // TODO: OPCODE 0xAA NOT IMPLEMENTED
     NULL, // TODO: OPCODE 0xAB NOT IMPLEMENTED
     NULL, // TODO: OPCODE 0xAC NOT IMPLEMENTED
@@ -298,6 +298,46 @@ Fast486ExtendedHandlers[FAST486_NUM_OPCODE_HANDLERS] =
 
 /* PUBLIC FUNCTIONS ***********************************************************/
 
 
 /* PUBLIC FUNCTIONS ***********************************************************/
 
+FAST486_OPCODE_HANDLER(Fast486ExtOpcodePushFs)
+{
+    /* Call the internal API */
+    return Fast486StackPush(State, State->SegmentRegs[FAST486_REG_FS].Selector);
+}
+
+FAST486_OPCODE_HANDLER(Fast486ExtOpcodePopFs)
+{
+    ULONG NewSelector;
+
+    if (!Fast486StackPop(State, &NewSelector))
+    {
+        /* Exception occurred */
+        return FALSE;
+    }
+
+    /* Call the internal API */
+    return Fast486LoadSegment(State, FAST486_REG_FS, LOWORD(NewSelector));
+}
+
+FAST486_OPCODE_HANDLER(Fast486ExtOpcodePushGs)
+{
+    /* Call the internal API */
+    return Fast486StackPush(State, State->SegmentRegs[FAST486_REG_GS].Selector);
+}
+
+FAST486_OPCODE_HANDLER(Fast486ExtOpcodePopGs)
+{
+    ULONG NewSelector;
+
+    if (!Fast486StackPop(State, &NewSelector))
+    {
+        /* Exception occurred */
+        return FALSE;
+    }
+
+    /* Call the internal API */
+    return Fast486LoadSegment(State, FAST486_REG_GS, LOWORD(NewSelector));
+}
+
 FAST486_OPCODE_HANDLER(Fast486ExtOpcodeConditionalJmp)
 {
     BOOLEAN Jump = FALSE;
 FAST486_OPCODE_HANDLER(Fast486ExtOpcodeConditionalJmp)
 {
     BOOLEAN Jump = FALSE;
index 8b3eeef..7010ffc 100644 (file)
 #define _EXTRAOPS_H_
 
 /* DEFINES ********************************************************************/
 #define _EXTRAOPS_H_
 
 /* DEFINES ********************************************************************/
+FAST486_OPCODE_HANDLER(Fast486ExtOpcodePushFs);
+FAST486_OPCODE_HANDLER(Fast486ExtOpcodePopFs);
+FAST486_OPCODE_HANDLER(Fast486ExtOpcodePushGs);
+FAST486_OPCODE_HANDLER(Fast486ExtOpcodePopGs);
 FAST486_OPCODE_HANDLER(Fast486ExtOpcodeConditionalJmp);
 FAST486_OPCODE_HANDLER(Fast486ExtOpcodeConditionalSet);
 FAST486_OPCODE_HANDLER(Fast486OpcodeExtended);
 FAST486_OPCODE_HANDLER(Fast486ExtOpcodeConditionalJmp);
 FAST486_OPCODE_HANDLER(Fast486ExtOpcodeConditionalSet);
 FAST486_OPCODE_HANDLER(Fast486OpcodeExtended);