#include <stdint.h>#include <errno.h>#include "emu/emu.h"#include "emu/emu_cpu.h"#include "emu/emu_cpu_data.h"#include "emu/emu_cpu_stack.h"#include "emu/emu_memory.h"
Defines | |
| #define | INSTR_CALC(dbits, bits, cpu, dividend, divisor, quotient, remainder) |
Functions | |
| int32_t | instr_group_3_f6_idiv (struct emu_cpu *c, struct emu_cpu_instruction *i) |
| int32_t | instr_group_3_f7_idiv (struct emu_cpu *c, struct emu_cpu_instruction *i) |
| #define INSTR_CALC | ( | dbits, | |||
| bits, | |||||
| cpu, | |||||
| dividend, | |||||
| divisor, | |||||
| quotient, | |||||
| remainder | ) |
{\
if (divisor == 0) \
{ \
emu_strerror_set(cpu->emu,"div by zero (%i bits)\n",bits); \
emu_errno_set(cpu->emu,EINVAL); \
return -1; \
} \
INTOF(dbits) q_result = (INTOF(dbits))dividend / (INTOF(bits))divisor; \
INTOF(dbits) r_result = (INTOF(dbits))dividend % (INTOF(bits))divisor; \
\
quotient = q_result; \
remainder = r_result; \
if ( q_result < max_inttype_borders[bits/8][0][0] || \
q_result > max_inttype_borders[bits/8][0][1] ) \
{ \
emu_strerror_set(cpu->emu,"div quotient larger than intborder (%i bits)\n",bits); \
emu_errno_set(cpu->emu,EINVAL); \
return -1; \
} \
}
| int32_t instr_group_3_f6_idiv | ( | struct emu_cpu * | c, | |
| struct emu_cpu_instruction * | i | |||
| ) |
References ah, al, ax, emu_cpu_instruction::ea, INSTR_CALC, MEM_BYTE_READ, emu_cpu_instruction::mod, emu_cpu_instruction::modrm, emu_cpu::reg16, emu_cpu::reg8, and emu_cpu_instruction::rm.
Referenced by instr_group_3_f6().
| int32_t instr_group_3_f7_idiv | ( | struct emu_cpu * | c, | |
| struct emu_cpu_instruction * | i | |||
| ) |
References ax, DWORD_FROM_WORDS, dx, emu_cpu_instruction::ea, eax, edx, INSTR_CALC, MEM_DWORD_READ, MEM_WORD_READ, emu_cpu_instruction::mod, emu_cpu_instruction::modrm, PREFIX_OPSIZE, emu_cpu_instruction::prefixes, QWORD_FROM_DWORDS, emu_cpu::reg, emu_cpu::reg16, and emu_cpu_instruction::rm.
Referenced by instr_group_3_f7().
1.6.1