2 * Alpha emulation cpu micro-operations for qemu.
4 * Copyright (c) 2007 Jocelyn Mayer
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.
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.
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
25 #include "host-utils.h"
27 #include "op_helper.h"
30 #include "op_template.h"
33 #include "op_template.h"
36 #include "op_template.h"
39 #include "op_template.h"
42 #include "op_template.h"
45 #include "op_template.h"
48 #include "op_template.h"
51 #include "op_template.h"
54 #include "op_template.h"
57 #include "op_template.h"
60 #include "op_template.h"
63 #include "op_template.h"
66 #include "op_template.h"
69 #include "op_template.h"
72 #include "op_template.h"
75 #include "op_template.h"
78 #include "op_template.h"
81 #include "op_template.h"
84 #include "op_template.h"
87 #include "op_template.h"
90 #include "op_template.h"
93 #include "op_template.h"
96 #include "op_template.h"
99 #include "op_template.h"
102 #include "op_template.h"
105 #include "op_template.h"
108 #include "op_template.h"
111 #include "op_template.h"
114 #include "op_template.h"
117 #include "op_template.h"
120 #include "op_template.h"
123 #include "op_template.h"
126 void OPPROTO op_no_op (void)
128 #if !defined (DEBUG_OP)
129 __asm__ __volatile__("nop" : : : "memory");
134 /* Load and stores */
135 #define MEMSUFFIX _raw
137 #if !defined(CONFIG_USER_ONLY)
138 #define MEMSUFFIX _kernel
140 #define MEMSUFFIX _executive
142 #define MEMSUFFIX _supervisor
144 #define MEMSUFFIX _user
146 /* This is used for pal modes */
147 #define MEMSUFFIX _data
152 void OPPROTO op_load_fpcr (void)
158 void OPPROTO op_store_fpcr (void)
165 #if 0 // Qemu does not know how to do this...
166 void OPPROTO op_bcond (void)
175 void OPPROTO op_bcond (void)
180 env->pc = ((uint64_t)PARAM(1) << 32) | (uint64_t)PARAM(2);
185 /* IEEE floating point arithmetic */
186 /* S floating (single) */
187 void OPPROTO op_adds (void)
189 FT0 = float32_add(FT0, FT1, &FP_STATUS);
193 void OPPROTO op_subs (void)
195 FT0 = float32_sub(FT0, FT1, &FP_STATUS);
199 void OPPROTO op_muls (void)
201 FT0 = float32_mul(FT0, FT1, &FP_STATUS);
205 void OPPROTO op_divs (void)
207 FT0 = float32_div(FT0, FT1, &FP_STATUS);
211 void OPPROTO op_sqrts (void)
217 void OPPROTO op_cpys (void)
223 void OPPROTO op_cpysn (void)
229 void OPPROTO op_cpyse (void)
235 void OPPROTO op_itofs (void)
241 void OPPROTO op_ftois (void)
247 /* T floating (double) */
248 void OPPROTO op_addt (void)
250 FT0 = float64_add(FT0, FT1, &FP_STATUS);
254 void OPPROTO op_subt (void)
256 FT0 = float64_sub(FT0, FT1, &FP_STATUS);
260 void OPPROTO op_mult (void)
262 FT0 = float64_mul(FT0, FT1, &FP_STATUS);
266 void OPPROTO op_divt (void)
268 FT0 = float64_div(FT0, FT1, &FP_STATUS);
272 void OPPROTO op_sqrtt (void)
278 void OPPROTO op_cmptun (void)
284 void OPPROTO op_cmpteq (void)
290 void OPPROTO op_cmptle (void)
296 void OPPROTO op_cmptlt (void)
302 void OPPROTO op_itoft (void)
308 void OPPROTO op_ftoit (void)
314 /* VAX floating point arithmetic */
316 void OPPROTO op_addf (void)
322 void OPPROTO op_subf (void)
328 void OPPROTO op_mulf (void)
334 void OPPROTO op_divf (void)
340 void OPPROTO op_sqrtf (void)
346 void OPPROTO op_cmpfeq (void)
352 void OPPROTO op_cmpfne (void)
358 void OPPROTO op_cmpflt (void)
364 void OPPROTO op_cmpfle (void)
370 void OPPROTO op_cmpfgt (void)
376 void OPPROTO op_cmpfge (void)
382 void OPPROTO op_itoff (void)
389 void OPPROTO op_addg (void)
395 void OPPROTO op_subg (void)
401 void OPPROTO op_mulg (void)
407 void OPPROTO op_divg (void)
413 void OPPROTO op_sqrtg (void)
419 void OPPROTO op_cmpgeq (void)
425 void OPPROTO op_cmpglt (void)
431 void OPPROTO op_cmpgle (void)
437 /* Floating point format conversion */
438 void OPPROTO op_cvtst (void)
444 void OPPROTO op_cvtqs (void)
450 void OPPROTO op_cvtts (void)
456 void OPPROTO op_cvttq (void)
462 void OPPROTO op_cvtqt (void)
468 void OPPROTO op_cvtqf (void)
474 void OPPROTO op_cvtgf (void)
480 void OPPROTO op_cvtgd (void)
486 void OPPROTO op_cvtgq (void)
492 void OPPROTO op_cvtqg (void)
498 void OPPROTO op_cvtdg (void)
504 void OPPROTO op_cvtlq (void)
510 void OPPROTO op_cvtql (void)
516 void OPPROTO op_cvtqlv (void)
522 void OPPROTO op_cvtqlsv (void)
528 /* PALcode support special instructions */
529 #if !defined (CONFIG_USER_ONLY)
530 void OPPROTO op_hw_rei (void)
532 env->pc = env->ipr[IPR_EXC_ADDR] & ~3;
533 env->ipr[IPR_EXC_ADDR] = env->ipr[IPR_EXC_ADDR] & 1;
534 /* XXX: re-enable interrupts and memory mapping */
538 void OPPROTO op_hw_ret (void)
541 env->ipr[IPR_EXC_ADDR] = T0 & 1;
542 /* XXX: re-enable interrupts and memory mapping */
546 void OPPROTO op_mfpr (void)
548 helper_mfpr(PARAM(1));
552 void OPPROTO op_mtpr (void)
554 helper_mtpr(PARAM(1));
558 void OPPROTO op_set_alt_mode (void)
560 env->saved_mode = env->ps & 0xC;
561 env->ps = (env->ps & ~0xC) | (env->ipr[IPR_ALT_MODE] & 0xC);
565 void OPPROTO op_restore_mode (void)
567 env->ps = (env->ps & ~0xC) | env->saved_mode;
571 void OPPROTO op_ld_phys_to_virt (void)
573 helper_ld_phys_to_virt();
577 void OPPROTO op_st_phys_to_virt (void)
579 helper_st_phys_to_virt();
582 #endif /* !defined (CONFIG_USER_ONLY) */