[BRANCHES]
[reactos.git] / reactos / lib / fast486 / fpu.h
1 /*
2 * Fast486 386/486 CPU Emulation Library
3 * fpu.h
4 *
5 * Copyright (C) 2013 Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21
22 #ifndef _FPU_H_
23 #define _FPU_H_
24
25 #pragma once
26
27 /* DEFINES ********************************************************************/
28
29 #define FPU_CHECK() if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_EM) \
30 { \
31 Fast486Exception(State, FAST486_EXCEPTION_NM); \
32 return FALSE; \
33 }
34 #define FPU_ST(i) State->FpuRegisters[(State->FpuStatus.Top + (i)) % FAST486_NUM_FPU_REGS]
35
36 enum
37 {
38 FPU_SINGLE_PRECISION = 0,
39 FPU_DOUBLE_PRECISION = 2,
40 FPU_DOUBLE_EXT_PRECISION = 3
41 };
42
43 enum
44 {
45 FPU_TAG_VALID = 0,
46 FPU_TAG_ZERO = 1,
47 FPU_TAG_SPECIAL = 2,
48 FPU_TAG_EMPTY = 3
49 };
50
51 FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD8);
52 FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD9);
53 FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDA);
54 FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDB);
55 FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDC);
56 FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDD);
57 FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDE);
58 FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDF);
59
60 #endif // _FPU_H_
61
62 /* EOF */