Add missing files from last commit.
This commit is contained in:
parent
9312de19ac
commit
f822488656
89 changed files with 18428 additions and 6383 deletions
152
src/x86_ops_ret.h
Normal file
152
src/x86_ops_ret.h
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
#define RETF_a16(stack_offset) \
|
||||
if ((msw&1) && !(eflags&VM_FLAG)) \
|
||||
{ \
|
||||
pmoderetf(0, stack_offset); \
|
||||
return 0; \
|
||||
} \
|
||||
if (ssegs) ss = oldss; \
|
||||
oxpc = pc; \
|
||||
if (stack32) \
|
||||
{ \
|
||||
pc = readmemw(ss, ESP); \
|
||||
loadcs(readmemw(ss, ESP + 2)); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
pc = readmemw(ss, SP); \
|
||||
loadcs(readmemw(ss, SP + 2)); \
|
||||
} \
|
||||
if (abrt) return 0; \
|
||||
if (stack32) ESP += 4 + stack_offset; \
|
||||
else SP += 4 + stack_offset; \
|
||||
cycles -= is486 ? 13 : 18;
|
||||
|
||||
#define RETF_a32(stack_offset) \
|
||||
if ((msw&1) && !(eflags&VM_FLAG)) \
|
||||
{ \
|
||||
pmoderetf(1, stack_offset); \
|
||||
return 0; \
|
||||
} \
|
||||
if (ssegs) ss = oldss; \
|
||||
oxpc = pc; \
|
||||
if (stack32) \
|
||||
{ \
|
||||
pc = readmeml(ss, ESP); \
|
||||
loadcs(readmeml(ss, ESP + 4) & 0xffff); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
pc = readmeml(ss, SP); \
|
||||
loadcs(readmeml(ss, SP + 4) & 0xffff); \
|
||||
} \
|
||||
if (abrt) return 0; \
|
||||
if (stack32) ESP += 8 + stack_offset; \
|
||||
else SP += 8 + stack_offset; \
|
||||
cycles -= is486 ? 13 : 18;
|
||||
|
||||
static int opRETF_a16(uint32_t fetchdat)
|
||||
{
|
||||
RETF_a16(0);
|
||||
return 0;
|
||||
}
|
||||
static int opRETF_a32(uint32_t fetchdat)
|
||||
{
|
||||
RETF_a32(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opRETF_a16_imm(uint32_t fetchdat)
|
||||
{
|
||||
uint16_t offset = getwordf();
|
||||
RETF_a16(offset);
|
||||
return 0;
|
||||
}
|
||||
static int opRETF_a32_imm(uint32_t fetchdat)
|
||||
{
|
||||
uint16_t offset = getwordf();
|
||||
RETF_a32(offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opIRET(uint32_t fetchdat)
|
||||
{
|
||||
if ((cr0 & 1) && (eflags & VM_FLAG) && (IOPL != 3))
|
||||
{
|
||||
x86gpf(NULL,0);
|
||||
return 0;
|
||||
}
|
||||
if (ssegs) ss = oldss;
|
||||
if (msw&1)
|
||||
{
|
||||
optype = IRET;
|
||||
pmodeiret(0);
|
||||
optype = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16_t new_cs;
|
||||
oxpc = pc;
|
||||
if (stack32)
|
||||
{
|
||||
pc = readmemw(ss, ESP);
|
||||
new_cs = readmemw(ss, ESP + 2);
|
||||
flags = (readmemw(ss, ESP + 4) & 0xffd5) | 2;
|
||||
ESP += 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
pc = readmemw(ss, SP);
|
||||
new_cs = readmemw(ss, ((SP + 2) & 0xffff));
|
||||
flags = (readmemw(ss, ((SP + 4) & 0xffff)) & 0xffd5) | 2;
|
||||
SP += 6;
|
||||
}
|
||||
loadcs(new_cs);
|
||||
}
|
||||
flags_extract();
|
||||
cycles -= is486 ? 15 : 22;
|
||||
nmi_enable = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opIRETD(uint32_t fetchdat)
|
||||
{
|
||||
if ((cr0 & 1) && (eflags & VM_FLAG) && (IOPL != 3))
|
||||
{
|
||||
x86gpf(NULL,0);
|
||||
return 0;
|
||||
}
|
||||
if (ssegs) ss = oldss;
|
||||
if (msw & 1)
|
||||
{
|
||||
optype = IRET;
|
||||
pmodeiret(1);
|
||||
optype = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16_t new_cs;
|
||||
oxpc = pc;
|
||||
if (stack32)
|
||||
{
|
||||
pc = readmeml(ss, ESP);
|
||||
new_cs = readmemw(ss, ESP + 4);
|
||||
flags = (readmemw(ss, ESP + 8) & 0xffd5) | 2;
|
||||
eflags = readmemw(ss, ESP + 10);
|
||||
ESP += 12;
|
||||
}
|
||||
else
|
||||
{
|
||||
pc = readmeml(ss, SP);
|
||||
new_cs = readmemw(ss, ((SP + 4) & 0xffff));
|
||||
flags = (readmemw(ss,(SP + 8) & 0xffff) & 0xffd5) | 2;
|
||||
eflags = readmemw(ss, (SP + 10) & 0xffff);
|
||||
SP += 12;
|
||||
}
|
||||
loadcs(new_cs);
|
||||
}
|
||||
flags_extract();
|
||||
cycles -= is486 ? 15 : 22;
|
||||
nmi_enable = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
Reference in a new issue