2 |
2 |
SPARC translation
|
3 |
3 |
|
4 |
4 |
Copyright (C) 2003 Thomas M. Ogrisegg <tom@fnord.at>
|
|
5 |
Copyright (C) 2003 Fabrice Bellard
|
5 |
6 |
|
6 |
7 |
This library is free software; you can redistribute it and/or
|
7 |
8 |
modify it under the terms of the GNU Lesser General Public
|
... | ... | |
19 |
20 |
*/
|
20 |
21 |
|
21 |
22 |
/*
|
22 |
|
SPARC has two pitfalls: Delay slots and (a)nullification.
|
23 |
|
This is currently solved as follows:
|
24 |
|
|
25 |
|
'call' instructions simply execute the delay slot before the actual
|
26 |
|
control transfer instructions.
|
27 |
|
|
28 |
|
'jmpl' instructions execute calculate the destination, then execute
|
29 |
|
the delay slot and then do the control transfer.
|
30 |
|
|
31 |
|
(conditional) branch instructions are the most difficult ones, as the
|
32 |
|
delay slot may be nullified (ie. not executed). This happens when a
|
33 |
|
conditional branch is not executed (thus no control transfer happens)
|
34 |
|
and the 'anull' bit in the branch instruction opcode is set. This is
|
35 |
|
currently solved by doing a jump after the delay slot instruction.
|
36 |
|
|
37 |
23 |
TODO-list:
|
38 |
24 |
|
39 |
|
Register window overflow/underflow check
|
|
25 |
NPC/PC static optimisations (use JUMP_TB when possible)
|
40 |
26 |
FPU-Instructions
|
41 |
|
Coprocessor-Instructions
|
42 |
|
Check signedness issues
|
43 |
27 |
Privileged instructions
|
|
28 |
Coprocessor-Instructions
|
44 |
29 |
Optimize synthetic instructions
|
45 |
30 |
Optional alignment and privileged instruction check
|
46 |
|
|
47 |
|
-- TMO, 09/03/03
|
48 |
|
*/
|
|
31 |
*/
|
49 |
32 |
|
50 |
33 |
#include <stdarg.h>
|
51 |
34 |
#include <stdlib.h>
|
... | ... | |
87 |
70 |
|
88 |
71 |
static void disas_sparc_insn(DisasContext * dc);
|
89 |
72 |
|
90 |
|
typedef void (GenOpFunc) (void);
|
91 |
|
typedef void (GenOpFunc1) (long);
|
92 |
|
typedef void (GenOpFunc2) (long, long);
|
93 |
|
typedef void (GenOpFunc3) (long, long, long);
|
94 |
|
|
95 |
73 |
static GenOpFunc *gen_op_movl_TN_reg[2][32] = {
|
96 |
74 |
{
|
97 |
75 |
gen_op_movl_g0_T0,
|