target-alpha: convert locked load/store to TCG
[qemu] / target-alpha / op.c
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 /* Load and stores */
29 #define MEMSUFFIX _raw
30 #include "op_mem.h"
31 #if !defined(CONFIG_USER_ONLY)
32 #define MEMSUFFIX _kernel
33 #include "op_mem.h"
34 #define MEMSUFFIX _executive
35 #include "op_mem.h"
36 #define MEMSUFFIX _supervisor
37 #include "op_mem.h"
38 #define MEMSUFFIX _user
39 #include "op_mem.h"
40 /* This is used for pal modes */
41 #define MEMSUFFIX _data
42 #include "op_mem.h"
43 #endif
44
45 /* PALcode support special instructions */
46 #if !defined (CONFIG_USER_ONLY)
47 void OPPROTO op_hw_rei (void)
48 {
49     env->pc = env->ipr[IPR_EXC_ADDR] & ~3;
50     env->ipr[IPR_EXC_ADDR] = env->ipr[IPR_EXC_ADDR] & 1;
51     /* XXX: re-enable interrupts and memory mapping */
52     RETURN();
53 }
54
55 void OPPROTO op_hw_ret (void)
56 {
57     env->pc = T0 & ~3;
58     env->ipr[IPR_EXC_ADDR] = T0 & 1;
59     /* XXX: re-enable interrupts and memory mapping */
60     RETURN();
61 }
62
63 void OPPROTO op_mfpr (void)
64 {
65     helper_mfpr(PARAM(1));
66     RETURN();
67 }
68
69 void OPPROTO op_mtpr (void)
70 {
71     helper_mtpr(PARAM(1));
72     RETURN();
73 }
74
75 void OPPROTO op_set_alt_mode (void)
76 {
77     env->saved_mode = env->ps & 0xC;
78     env->ps = (env->ps & ~0xC) | (env->ipr[IPR_ALT_MODE] & 0xC);
79     RETURN();
80 }
81
82 void OPPROTO op_restore_mode (void)
83 {
84     env->ps = (env->ps & ~0xC) | env->saved_mode;
85     RETURN();
86 }
87
88 void OPPROTO op_ld_phys_to_virt (void)
89 {
90     helper_ld_phys_to_virt();
91     RETURN();
92 }
93
94 void OPPROTO op_st_phys_to_virt (void)
95 {
96     helper_st_phys_to_virt();
97     RETURN();
98 }
99 #endif /* !defined (CONFIG_USER_ONLY) */