root / target-alpha / op.c @ f18cd223
History | View | Annotate | Download (2.5 kB)
1 |
/*
|
---|---|
2 |
* Alpha emulation cpu micro-operations for qemu.
|
3 |
*
|
4 |
* Copyright (c) 2007 Jocelyn Mayer
|
5 |
*
|
6 |
* This library is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU Lesser General Public
|
8 |
* License as published by the Free Software Foundation; either
|
9 |
* version 2 of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This library is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 |
* Lesser General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU Lesser General Public
|
17 |
* License along with this library; if not, write to the Free Software
|
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19 |
*/
|
20 |
|
21 |
#define DEBUG_OP
|
22 |
|
23 |
#include "config.h" |
24 |
#include "exec.h" |
25 |
#include "host-utils.h" |
26 |
#include "op_helper.h" |
27 |
|
28 |
/* Debug stuff */
|
29 |
void OPPROTO op_no_op (void) |
30 |
{ |
31 |
#if !defined (DEBUG_OP)
|
32 |
__asm__ __volatile__("nop" : : : "memory"); |
33 |
#endif
|
34 |
RETURN(); |
35 |
} |
36 |
|
37 |
/* Load and stores */
|
38 |
#define MEMSUFFIX _raw
|
39 |
#include "op_mem.h" |
40 |
#if !defined(CONFIG_USER_ONLY)
|
41 |
#define MEMSUFFIX _kernel
|
42 |
#include "op_mem.h" |
43 |
#define MEMSUFFIX _executive
|
44 |
#include "op_mem.h" |
45 |
#define MEMSUFFIX _supervisor
|
46 |
#include "op_mem.h" |
47 |
#define MEMSUFFIX _user
|
48 |
#include "op_mem.h" |
49 |
/* This is used for pal modes */
|
50 |
#define MEMSUFFIX _data
|
51 |
#include "op_mem.h" |
52 |
#endif
|
53 |
|
54 |
/* PALcode support special instructions */
|
55 |
#if !defined (CONFIG_USER_ONLY)
|
56 |
void OPPROTO op_hw_rei (void) |
57 |
{ |
58 |
env->pc = env->ipr[IPR_EXC_ADDR] & ~3;
|
59 |
env->ipr[IPR_EXC_ADDR] = env->ipr[IPR_EXC_ADDR] & 1;
|
60 |
/* XXX: re-enable interrupts and memory mapping */
|
61 |
RETURN(); |
62 |
} |
63 |
|
64 |
void OPPROTO op_hw_ret (void) |
65 |
{ |
66 |
env->pc = T0 & ~3;
|
67 |
env->ipr[IPR_EXC_ADDR] = T0 & 1;
|
68 |
/* XXX: re-enable interrupts and memory mapping */
|
69 |
RETURN(); |
70 |
} |
71 |
|
72 |
void OPPROTO op_mfpr (void) |
73 |
{ |
74 |
helper_mfpr(PARAM(1));
|
75 |
RETURN(); |
76 |
} |
77 |
|
78 |
void OPPROTO op_mtpr (void) |
79 |
{ |
80 |
helper_mtpr(PARAM(1));
|
81 |
RETURN(); |
82 |
} |
83 |
|
84 |
void OPPROTO op_set_alt_mode (void) |
85 |
{ |
86 |
env->saved_mode = env->ps & 0xC;
|
87 |
env->ps = (env->ps & ~0xC) | (env->ipr[IPR_ALT_MODE] & 0xC); |
88 |
RETURN(); |
89 |
} |
90 |
|
91 |
void OPPROTO op_restore_mode (void) |
92 |
{ |
93 |
env->ps = (env->ps & ~0xC) | env->saved_mode;
|
94 |
RETURN(); |
95 |
} |
96 |
|
97 |
void OPPROTO op_ld_phys_to_virt (void) |
98 |
{ |
99 |
helper_ld_phys_to_virt(); |
100 |
RETURN(); |
101 |
} |
102 |
|
103 |
void OPPROTO op_st_phys_to_virt (void) |
104 |
{ |
105 |
helper_st_phys_to_virt(); |
106 |
RETURN(); |
107 |
} |
108 |
#endif /* !defined (CONFIG_USER_ONLY) */ |