* sparc-desc.c: New file.
[external/binutils.git] / sim / sparc / regs64.h
1 /* sparc64 register definitions
2    Copyright (C) 1999 Cygnus Solutions.  */
3
4 #ifndef REG64_H
5 #define REG64_H
6
7 /* The PSR is a hodge-podge of various things.
8    ??? The final organization of this is wip.  */
9
10 extern USI sparc32_get_h_psr_handler (SIM_CPU *);
11 extern void sparc32_set_h_psr_handler (SIM_CPU *, USI);
12 #define GET_H_PSR()    sparc32_get_h_psr_handler (current_cpu)
13 #define SET_H_PSR(val) sparc32_set_h_psr_handler (current_cpu, (val))
14
15 /* The y reg is a virtual reg as it's actually one of the asr regs.
16    ??? To be replaced in time with get/set specs.  */
17 #if 0
18 #define sparc32_h_y_get(cpu)     (CPU_CGEN_HW (cpu)->h_asr[0])
19 #define sparc32_h_y_set(cpu,val) (CPU_CGEN_HW (cpu)->h_asr[0] = (val))
20 #endif
21 #define GET_H_Y()       (CPU (h_asr) [0])
22 #define SET_H_Y(newval) do { CPU (h_asr) [0] = (newval); } while (0)
23
24 /* The Trap Base Register.  */
25 #define GET_H_TBR() CPU (h_tbr)
26 #define SET_H_TBR(newval) \
27   do { \
28     CPU (h_tbr) = (CPU (h_tbr) & 0xff0) | ((newval) & 0xfffff000); \
29   } while (0)
30 \f
31 /* sparc32 register window stuff.  */
32
33 /* Handle gets/sets of h-cwp.
34    This handles swapping out the current set of window registers
35    and swapping in the new.  How the "swapping" is done depends on the
36    register window implementation of the day.  */
37 void sparc32_set_h_cwp_handler (SIM_CPU *, int);
38 #define GET_H_CWP() CPU (h_cwp)
39 #define SET_H_CWP(newval) sparc32_set_h_cwp_handler (current_cpu, (newval))
40
41 /* WIM accessors.  */
42 /* ??? Yes, mask computation assumes nwindows < 32.  */
43 #define GET_H_WIM()       (CPU (h_wim) & ((1 << GET_NWINDOWS ()) - 1))
44 #define SET_H_WIM(newval) (CPU (h_wim) = (newval))
45
46 /* Return non-zero if window WIN is valid in WIM.  */
47 #define WINDOW_VALID_P(win, wim) (((wim) & (1 << (win))) == 0)
48
49 void sparc32_alloc_regwins (SIM_CPU *, int);
50 void sparc32_free_regwins (SIM_CPU *);
51 void sparc32_swapout_regwin (SIM_CPU *, int);
52 void sparc32_swapin_regwin (SIM_CPU *, int);
53
54 void sparc32_load_regwin (SIM_CPU *, IADDR pc_, int win_);
55 void sparc32_flush_regwin (SIM_CPU *, IADDR pc_, int win_, int no_errors_p_);
56 void sparc32_flush_regwins (SIM_CPU *, IADDR pc_, int no_errors_p_);
57
58 void sparc32_save_regwin (SIM_CPU *);
59 void sparc32_restore_regwin (SIM_CPU *);
60 \f
61 /* Integer register access macros.
62    Provides an interface between the cpu description and the register window
63    implementation of the day.  To be solidified in time.  */
64 #define GET_H_GR(r) (current_cpu->current_regs[r])
65
66 /* ??? The r != 0 test may not be necessary as sufficient numbers of dni
67    entries can prevent this from occuring (I think).  Even then though doing
68    this makes things more robust, and a lot of dni's would be needed.
69    ??? The other way to handle %g0 is to always reset it for each insn
70    [perhaps optimized to only do so when necessary].  */
71 #define SET_H_GR(r, val) \
72   ((r) != 0 ? (current_cpu->current_regs[r] = (val)) : 0)
73
74 #endif /* REG64_H */