root / target-m68k / cpu.h @ 36bb244b
History | View | Annotate | Download (4.1 kB)
1 | e6e5906b | pbrook | /*
|
---|---|---|---|
2 | e6e5906b | pbrook | * m68k virtual CPU header
|
3 | e6e5906b | pbrook | *
|
4 | e6e5906b | pbrook | * Copyright (c) 2005-2006 CodeSourcery
|
5 | e6e5906b | pbrook | * Written by Paul Brook
|
6 | e6e5906b | pbrook | *
|
7 | e6e5906b | pbrook | * This library is free software; you can redistribute it and/or
|
8 | e6e5906b | pbrook | * modify it under the terms of the GNU Lesser General Public
|
9 | e6e5906b | pbrook | * License as published by the Free Software Foundation; either
|
10 | e6e5906b | pbrook | * version 2 of the License, or (at your option) any later version.
|
11 | e6e5906b | pbrook | *
|
12 | e6e5906b | pbrook | * This library is distributed in the hope that it will be useful,
|
13 | e6e5906b | pbrook | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 | e6e5906b | pbrook | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15 | e6e5906b | pbrook | * General Public License for more details.
|
16 | e6e5906b | pbrook | *
|
17 | e6e5906b | pbrook | * You should have received a copy of the GNU Lesser General Public
|
18 | e6e5906b | pbrook | * License along with this library; if not, write to the Free Software
|
19 | e6e5906b | pbrook | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
20 | e6e5906b | pbrook | */
|
21 | e6e5906b | pbrook | #ifndef CPU_M68K_H
|
22 | e6e5906b | pbrook | #define CPU_M68K_H
|
23 | e6e5906b | pbrook | |
24 | e6e5906b | pbrook | #define TARGET_LONG_BITS 32 |
25 | e6e5906b | pbrook | |
26 | e6e5906b | pbrook | #include "cpu-defs.h" |
27 | e6e5906b | pbrook | |
28 | e6e5906b | pbrook | #include "softfloat.h" |
29 | e6e5906b | pbrook | |
30 | e6e5906b | pbrook | #define MAX_QREGS 32 |
31 | e6e5906b | pbrook | |
32 | e6e5906b | pbrook | #define TARGET_HAS_ICE 1 |
33 | e6e5906b | pbrook | |
34 | 9042c0e2 | ths | #define ELF_MACHINE EM_68K
|
35 | 9042c0e2 | ths | |
36 | e6e5906b | pbrook | #define EXCP_ACCESS 2 /* Access (MMU) error. */ |
37 | e6e5906b | pbrook | #define EXCP_ADDRESS 3 /* Address error. */ |
38 | e6e5906b | pbrook | #define EXCP_ILLEGAL 4 /* Illegal instruction. */ |
39 | e6e5906b | pbrook | #define EXCP_DIV0 5 /* Divide by zero */ |
40 | e6e5906b | pbrook | #define EXCP_PRIVILEGE 8 /* Privilege violation. */ |
41 | e6e5906b | pbrook | #define EXCP_TRACE 9 |
42 | e6e5906b | pbrook | #define EXCP_LINEA 10 /* Unimplemented line-A (MAC) opcode. */ |
43 | e6e5906b | pbrook | #define EXCP_LINEF 11 /* Unimplemented line-F (FPU) opcode. */ |
44 | e6e5906b | pbrook | #define EXCP_DEBUGNBP 12 /* Non-breakpoint debug interrupt. */ |
45 | e6e5906b | pbrook | #define EXCP_DEBEGBP 13 /* Breakpoint debug interrupt. */ |
46 | e6e5906b | pbrook | #define EXCP_FORMAT 14 /* RTE format error. */ |
47 | e6e5906b | pbrook | #define EXCP_UNINITIALIZED 15 |
48 | e6e5906b | pbrook | #define EXCP_TRAP0 32 /* User trap #0. */ |
49 | e6e5906b | pbrook | #define EXCP_TRAP15 47 /* User trap #15. */ |
50 | e6e5906b | pbrook | #define EXCP_UNSUPPORTED 61 |
51 | e6e5906b | pbrook | #define EXCP_ICE 13 |
52 | e6e5906b | pbrook | |
53 | e6e5906b | pbrook | typedef struct CPUM68KState { |
54 | e6e5906b | pbrook | uint32_t dregs[8];
|
55 | e6e5906b | pbrook | uint32_t aregs[8];
|
56 | e6e5906b | pbrook | uint32_t pc; |
57 | e6e5906b | pbrook | uint32_t sr; |
58 | e6e5906b | pbrook | |
59 | e6e5906b | pbrook | /* Condition flags. */
|
60 | e6e5906b | pbrook | uint32_t cc_op; |
61 | e6e5906b | pbrook | uint32_t cc_dest; |
62 | e6e5906b | pbrook | uint32_t cc_src; |
63 | e6e5906b | pbrook | uint32_t cc_x; |
64 | e6e5906b | pbrook | |
65 | e6e5906b | pbrook | float64 fregs[8];
|
66 | e6e5906b | pbrook | float64 fp_result; |
67 | e6e5906b | pbrook | uint32_t fpcr; |
68 | e6e5906b | pbrook | uint32_t fpsr; |
69 | e6e5906b | pbrook | float_status fp_status; |
70 | e6e5906b | pbrook | |
71 | e6e5906b | pbrook | /* Temporary storage for DIV helpers. */
|
72 | e6e5906b | pbrook | uint32_t div1; |
73 | e6e5906b | pbrook | uint32_t div2; |
74 | e6e5906b | pbrook | |
75 | e6e5906b | pbrook | /* MMU status. */
|
76 | e6e5906b | pbrook | struct {
|
77 | e6e5906b | pbrook | uint32_t ar; |
78 | e6e5906b | pbrook | } mmu; |
79 | e6e5906b | pbrook | /* ??? remove this. */
|
80 | e6e5906b | pbrook | uint32_t t1; |
81 | e6e5906b | pbrook | |
82 | e6e5906b | pbrook | /* exception/interrupt handling */
|
83 | e6e5906b | pbrook | jmp_buf jmp_env; |
84 | e6e5906b | pbrook | int exception_index;
|
85 | e6e5906b | pbrook | int interrupt_request;
|
86 | e6e5906b | pbrook | int user_mode_only;
|
87 | e6e5906b | pbrook | uint32_t address; |
88 | e6e5906b | pbrook | |
89 | e6e5906b | pbrook | uint32_t qregs[MAX_QREGS]; |
90 | e6e5906b | pbrook | |
91 | e6e5906b | pbrook | CPU_COMMON |
92 | e6e5906b | pbrook | } CPUM68KState; |
93 | e6e5906b | pbrook | |
94 | e6e5906b | pbrook | CPUM68KState *cpu_m68k_init(void);
|
95 | e6e5906b | pbrook | int cpu_m68k_exec(CPUM68KState *s);
|
96 | e6e5906b | pbrook | void cpu_m68k_close(CPUM68KState *s);
|
97 | e6e5906b | pbrook | /* you can call this signal handler from your SIGBUS and SIGSEGV
|
98 | e6e5906b | pbrook | signal handlers to inform the virtual CPU of exceptions. non zero
|
99 | e6e5906b | pbrook | is returned if the signal was handled by the virtual CPU. */
|
100 | 5a7b542b | ths | int cpu_m68k_signal_handler(int host_signum, void *pinfo, |
101 | e6e5906b | pbrook | void *puc);
|
102 | e6e5906b | pbrook | void cpu_m68k_flush_flags(CPUM68KState *, int); |
103 | e6e5906b | pbrook | |
104 | e6e5906b | pbrook | enum {
|
105 | e6e5906b | pbrook | CC_OP_DYNAMIC, /* Use env->cc_op */
|
106 | e6e5906b | pbrook | CC_OP_FLAGS, /* CC_DEST = CVZN, CC_SRC = unused */
|
107 | e6e5906b | pbrook | CC_OP_LOGIC, /* CC_DEST = result, CC_SRC = unused */
|
108 | e6e5906b | pbrook | CC_OP_ADD, /* CC_DEST = result, CC_SRC = source */
|
109 | e6e5906b | pbrook | CC_OP_SUB, /* CC_DEST = result, CC_SRC = source */
|
110 | e6e5906b | pbrook | CC_OP_CMPB, /* CC_DEST = result, CC_SRC = source */
|
111 | e6e5906b | pbrook | CC_OP_CMPW, /* CC_DEST = result, CC_SRC = source */
|
112 | e6e5906b | pbrook | CC_OP_ADDX, /* CC_DEST = result, CC_SRC = source */
|
113 | e6e5906b | pbrook | CC_OP_SUBX, /* CC_DEST = result, CC_SRC = source */
|
114 | e6e5906b | pbrook | CC_OP_SHL, /* CC_DEST = source, CC_SRC = shift */
|
115 | e6e5906b | pbrook | CC_OP_SHR, /* CC_DEST = source, CC_SRC = shift */
|
116 | e6e5906b | pbrook | CC_OP_SAR, /* CC_DEST = source, CC_SRC = shift */
|
117 | e6e5906b | pbrook | }; |
118 | e6e5906b | pbrook | |
119 | e6e5906b | pbrook | #define CCF_C 0x01 |
120 | e6e5906b | pbrook | #define CCF_V 0x02 |
121 | e6e5906b | pbrook | #define CCF_Z 0x04 |
122 | e6e5906b | pbrook | #define CCF_N 0x08 |
123 | e6e5906b | pbrook | #define CCF_X 0x01 |
124 | e6e5906b | pbrook | |
125 | e6e5906b | pbrook | typedef struct m68k_def_t m68k_def_t; |
126 | e6e5906b | pbrook | |
127 | e6e5906b | pbrook | m68k_def_t *m68k_find_by_name(const char *); |
128 | e6e5906b | pbrook | void cpu_m68k_register(CPUM68KState *, m68k_def_t *);
|
129 | e6e5906b | pbrook | |
130 | e6e5906b | pbrook | #define M68K_FPCR_PREC (1 << 6) |
131 | e6e5906b | pbrook | |
132 | e6e5906b | pbrook | #ifdef CONFIG_USER_ONLY
|
133 | e6e5906b | pbrook | /* Linux uses 8k pages. */
|
134 | e6e5906b | pbrook | #define TARGET_PAGE_BITS 13 |
135 | e6e5906b | pbrook | #else
|
136 | e6e5906b | pbrook | /* Smallest TLB entry size is 1k. */
|
137 | e6e5906b | pbrook | #define TARGET_PAGE_BITS 10 |
138 | e6e5906b | pbrook | #endif
|
139 | e6e5906b | pbrook | #include "cpu-all.h" |
140 | e6e5906b | pbrook | |
141 | e6e5906b | pbrook | #endif |