Author: aandrejevic
Date: Sat Sep 21 00:18:59 2013
New Revision: 60256
URL:
http://svn.reactos.org/svn/reactos?rev=60256&view=rev
Log:
[SOFT386]
Implement the INT, INT3 and INTO instructions (all 3 in Soft386OpcodeInt).
Modified:
branches/ntvdm/lib/soft386/opcodes.c
branches/ntvdm/lib/soft386/opcodes.h
Modified: branches/ntvdm/lib/soft386/opcodes.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/soft386/opcodes.c?rev…
==============================================================================
--- branches/ntvdm/lib/soft386/opcodes.c [iso-8859-1] (original)
+++ branches/ntvdm/lib/soft386/opcodes.c [iso-8859-1] Sat Sep 21 00:18:59 2013
@@ -228,9 +228,9 @@
Soft386OpcodeLeave,
Soft386OpcodeRetFarImm,
Soft386OpcodeRetFar,
- Soft386OpcodeInt3,
Soft386OpcodeInt,
- Soft386OpcodeIntOverflow,
+ Soft386OpcodeInt,
+ Soft386OpcodeInt,
Soft386OpcodeIret,
NULL, // TODO: OPCODE 0xD0 NOT SUPPORTED
NULL, // TODO: OPCODE 0xD1 NOT SUPPORTED
@@ -4297,28 +4297,68 @@
return FALSE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeInt3)
-{
- // TODO: NOT IMPLEMENTED
- UNIMPLEMENTED;
-
- return FALSE;
-}
-
SOFT386_OPCODE_HANDLER(Soft386OpcodeInt)
{
- // TODO: NOT IMPLEMENTED
- UNIMPLEMENTED;
-
- return FALSE;
-}
-
-SOFT386_OPCODE_HANDLER(Soft386OpcodeIntOverflow)
-{
- // TODO: NOT IMPLEMENTED
- UNIMPLEMENTED;
-
- return FALSE;
+ UCHAR IntNum;
+ SOFT386_IDT_ENTRY IdtEntry;
+
+ switch (Opcode)
+ {
+ case 0xCC:
+ {
+ /* This is the INT3 instruction */
+ IntNum = 3;
+ break;
+ }
+
+ case 0xCD:
+ {
+ /* Fetch the interrupt number */
+ if (!Soft386FetchByte(State, &IntNum))
+ {
+ /* Exception occurred */
+ return FALSE;
+ }
+
+ break;
+ }
+
+ case 0xCE:
+ {
+ /* Don't do anything if OF is cleared */
+ if (!State->Flags.Of) return TRUE;
+
+ /* Exception #OF */
+ IntNum = SOFT386_EXCEPTION_OF;
+
+ break;
+ }
+
+ default:
+ {
+ /* Should not happen */
+ ASSERT(FALSE);
+ }
+ }
+
+ /* Get the interrupt vector */
+ if (!Soft386GetIntVector(State, IntNum, &IdtEntry))
+ {
+ /* Exception occurred */
+ return FALSE;
+ }
+
+ /* Perform the interrupt */
+ if (!Soft386InterruptInternal(State,
+ IdtEntry.Selector,
+ MAKELONG(IdtEntry.Offset, IdtEntry.OffsetHigh),
+ IdtEntry.Type))
+ {
+ /* Exception occurred */
+ return FALSE;
+ }
+
+ return TRUE;
}
SOFT386_OPCODE_HANDLER(Soft386OpcodeIret)
Modified: branches/ntvdm/lib/soft386/opcodes.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/soft386/opcodes.h?rev…
==============================================================================
--- branches/ntvdm/lib/soft386/opcodes.h [iso-8859-1] (original)
+++ branches/ntvdm/lib/soft386/opcodes.h [iso-8859-1] Sat Sep 21 00:18:59 2013
@@ -122,9 +122,7 @@
SOFT386_OPCODE_HANDLER(Soft386OpcodeLeave);
SOFT386_OPCODE_HANDLER(Soft386OpcodeRetFarImm);
SOFT386_OPCODE_HANDLER(Soft386OpcodeRetFar);
-SOFT386_OPCODE_HANDLER(Soft386OpcodeInt3);
SOFT386_OPCODE_HANDLER(Soft386OpcodeInt);
-SOFT386_OPCODE_HANDLER(Soft386OpcodeIntOverflow);
SOFT386_OPCODE_HANDLER(Soft386OpcodeIret);
SOFT386_OPCODE_HANDLER(Soft386OpcodeAam);
SOFT386_OPCODE_HANDLER(Soft386OpcodeAad);