/******************************************************************************
 *
 *                                    C_def
 *
 * This module contains the definitions of the C global types of CMON.
 *
 * NOTE: It should not contain definition of any variables, since it is 
 *       included by the drivers too! Only global variables which are
 *       defined for the drivers too can be defined here, and their names
 *       must end with "__" .
 *
 * History:
 *   +----------+------------+------------------------------------------------+
 *   |   Date   |     by     |     Description                                |
 *   +----------+------------+------------------------------------------------+
 *   |          | Coby       | Written                                        |
 *   +----------+------------+------------------------------------------------+
 *
 *****************************************************************************/



#include "cc_def.h"
#include "cpu_d.h"
#include "cpu_e.h"
#include "fpu_d.h"
#include "fpu_e.h"



/*
 * Include the global preprocessor definitions which are used by both C and 
 * assembler functions.
 */
#ifndef public
#include "global.h"
#endif




/*
 * Include host dependant functions (for compile time)
 */

#ifndef public

#    include <strings.h>
#    include <setjmp.h>

#ifdef _ns32sf641_
#    include  <asis.h>
#else
#    include <ns32000.h>
#endif

#endif


/*-----------------------------------------------------------------------------
 * 
 *                              Preprocessor definitions
 * 
 *---------------------------------------------------------------------------*/

/*
 * Integer constants
 */

#ifndef public
#define NULL         0
#define	MAX_INT      /*NOSTRICT*/ ((int) 0x7fffffff)
#define	MIN_INT      /*NOSTRICT*/ ((int) 0x80000000)
#define MAX_WORD     /*NOSTRICT*/ ((int) 0x00007fff)
#define MIN_WORD     /*NOSTRICT*/ ((int) 0xffff8000)
#define MAX_BYTE     /*NOSTRICT*/ ((int) 0x0000007f)
#define MIN_BYTE     /*NOSTRICT*/ ((int) 0xffffff80)
#define	MAX_UINT     /*NOSTRICT*/ ((unsigned) 0xffffffff)
#define	MAX_UWORD    /*NOSTRICT*/ ((unsigned) 0x0000ffff)
#define	MAX_UBYTE    /*NOSTRICT*/ ((unsigned) 0x000000ff)

#endif

/*
 * Character constants
 */

#ifndef public

#define CR           '\r'
#define LF           '\n'
#define TAB          '\t'
#define CTRL_L       '\014'
#define CTRL_B       '\002'
#define CTRL_Q       '\021'
#define CTRL_S       '\023'
#define CTRL_H       '\010'

#endif

/*
 * Simple functions
 */

#ifndef public

#define MIN(x,y)	    ((x) < (y) ? (x) : (y))
#define MAX(x,y)	    ((x) > (y) ? (x) : (y))
#define ORD(x)             /*NOSTRICT*/ ((int) (x))
#define BIT_ON(bit, reg)   ((boolean) (((reg) & (unsigned) (1 << (bit))) != 0))
#define BIT_OFF(bit, reg)  ((boolean) (((reg) & (unsigned) (1 << (bit))) == 0))
#define SET_BIT(bit, reg)      ((reg) |= (unsigned)   (1 << (bit)))
#define CLEAR_BIT(bit, reg)    ((reg) &= (unsigned) (~(1 << (bit))))

#define IS_PATERN_SET(patern,   reg)      ((patern) == (reg & (patern)))
#define IS_PATERN_CLEAR(patern,   reg)    ( !(reg & (patern)))
#define PATERN_SET(patern,   reg)      (reg    |= (patern))
#define PATERN_CLEAR(patern,   reg)    (reg    &= ~(patern))

#define STRINGS_EQUAL(s1, s2)  ((boolean) (strcmp((s1), (s2)) == 0))
#define STRINGS_N_EQUAL(s1, s2, n)  ((boolean) (strncmp((s1), (s2), (n)) == 0))
#define CONTENTS_OF(addr)      (* ((unsigned *) (addr)))
#define EMPTY_STRING(str)      ((boolean) (((str) == (char *) NULL) OR \
                                           ((str)[0] == '\0')))
#ifndef DELAY
#define DELAY(m) {volatile int j; for (j = m; j > 0; j-- );}
#endif
#endif


/*
 * The port types available. RS232 ports 0 and 1 don't have to be defined.
 */

#ifndef public

#define CUR_PORT  -1
#define LAN_PORT  99

#endif


#ifndef public
#   if ((CORE_TYPE == SF) AND NOT (defined(SIM_32K)))
#	define BPT_TYPE long
#	define BPT_INST_SIZE 'D'
#	define SVC_INST_SIZE 4
#	define BPT_CMD	0xffefa1e8	/* Opcode of BPT instruction */
#   else 
#	define BPT_TYPE byte
#	define BPT_INST_SIZE 'B'
#	define SVC_INST_SIZE 1
#	define BPT_CMD   0xf2		/* Opcode of BPT instruction */

#   endif
#endif


/*-----------------------------------------------------------------------------
 * 
 *                              Constants 
 * 
 * 
 *---------------------------------------------------------------------------*/

/* The following definition is due to a debugger bug in constant display */
#ifndef public
#   ifdef DEBUG
#	define const 
#   endif
#endif

#ifndef public
typedef const  char   msg[];
#endif


/*
 * CMON messages
 */

public msg reset_message__	= "R GNX "MON_NAME" VERSION "VERSION"."REVISION;
public msg ether_reset_message__	= "R GNX "MON_NAME" VERSION "VERSION"."REVISION" ETHERNET CONNECTION\r";
public msg vr_message__		= " GNX CMON "VERSION"."REVISION" creation time: ";

public msg ready_prompt__       = "*";       /* Ready for next command       */
public msg cont_prompt__        = "%";       /* Not last line in response    */
public msg nmi_message__        = "RN";      /* NMI in monitor time          */
public msg cxp_return__         = "B RET";   /* Return from CX command       */
public msg program_end__        = "B END";   /* End of program reached       */
public msg step_ended__         = "B TRC";   /* Return from a step command   */

/*
 * Error messages
 */

public msg e_syntax__           = "?";       /* Syntax error                 */
public msg e_bpt_undefined__    = "E BND";   /* Breakpoint Not Defined       */
public msg e_busy__             = "E BSY";   /* Working with another LAN node*/
public msg e_bad_trans_mode__   = "E BTM";   /* Bad trans mode for protection*/
public msg e_load_crc__         = "E CRC";   /* Incorrect checksum in load   */
public msg e_multiple_cxp__     = "E CXP";   /* More than one call command   */
public msg e_search_failed__    = "E SRC";   /* Search failed                */
public msg e_verify__           = "E VRF ";  /* Verify error on update       */
public msg e_wpt_undefined__    = "E WND";   /* Watchpoint Not Defined       */
public msg e_abort__            = "E ABT";   /* Abort of unknown origin      */
public msg e_non_cmon_bpt__     = "E BPT";   /* Breakpoint trap, non-cmon    */
public msg e_dbg__              = "E DBG";   /* Debug trap                   */
public msg e_dvz__              = "E DVZ";   /* Division by zero             */
public msg e_flg__              = "E FLG";   /* Flag trap error              */
public msg e_fpu__              = "E FPU";   /* FPU trap error               */
public msg e_ill__              = "E ILL";   /* Illegal instruction for user */
public msg e_nbe__              = "E BER";   /* Non-restartable bus error    */
public msg e_nmi__              = "E NMI";   /* Nonmaskable interrupt        */
public msg e_nvi__              = "E NVI";   /* Nonvectored interrupt        */
public msg e_non_valid_page__   = "E NVL";   /* MMU nonvalid page            */
public msg e_ovf__              = "E OVF";   /* Overflow error               */
public msg e_pending__          = "E PND";   /* Pending interrupt error      */
public msg e_pol_timeout__      = "E POL 1"; /* Protocol err: timeout        */
public msg e_pol_invalid_len__  = "E POL 3"; /* Protocol err: non hexa length*/
public msg e_pol_short_cmd__    = "E POL 4"; /* Protocol err: cmd too short  */
public msg e_pol_invalid_crc__  = "E POL 5"; /* Protocol err: non hexa crc   */
public msg e_pol_crc_error__    = "E POL 6"; /* Protocol err: crc error      */
public msg e_pol_cr_missing__   = "E POL 8"; /* Protocol err: CR missing     */
public msg e_protect__          = "E PRT";   /* MMU protection violation     */
public msg e_rbe__              = "E RBE";   /* Restartable bus error        */
public msg e_rts__              = "E RTS ";  /* Run-time support error n     */
public msg e_unknown_svc__      = "E SVC";   /* SVC error of unknown origin  */
public msg e_non_cmon_trace__   = "E TRC";   /* Trace trap error, non-cmon   */
public msg e_und__              = "E UND";   /* Undefined opcode             */
public msg e_user__             = "E USR";   /* User-defined error           */
public msg e_vio__              = "E VIO";   /* Virtual I/O protocol error   */
public msg e_con__              = "E CON";   /* Lan connection error	     */
public msg e_dspm_err__         = "E DSP ERR";  /* DSPM error		     */


/*-----------------------------------------------------------------------------
 * 
 *                              Enumeration types
 * 
 *---------------------------------------------------------------------------*/


/*
 * The boolean type
 */

#ifndef public

#define boolean unsigned char

# ifndef FALSE
#  define FALSE 0
#  define TRUE 1
# endif

#endif

/* 
 * The address translation modes available.
 * PTB0 and 1 are prefixed with T_ so they won't collide with the register
 * enumeration type.
 */

#ifndef public

typedef enum {
        AUTOMATIC,
        T_PTB0,
        T_PTB1,
        PHYSICAL
} trans_mode_type;

#endif

/* 
 * The operation modes available. Note that actually there is no difference 
 * between stand-alone and stand-aside and they are considered as one.
 */

#ifndef public

typedef enum {
        TRANSP,
        STAND_ASIDE,
        STAND_ALONE
} op_mode_type;

#endif

/*
 * The types of abort traps which can be caused by the MMU. Unknown is 
 * signalled if no mmu is present.
 */

#ifndef public

typedef enum {
        UNKNOWN_ABT,
        INVALID_PTE_ABT,
        PROT_VIOLATION_ABT,
	HW_BPT_ABT
} abort_type;

#endif


/*-----------------------------------------------------------------------------
 * 
 *                              Structure types
 * 
 *---------------------------------------------------------------------------*/

/*
 * The information needed on a flag of a multi-flag command (protection create,
 * breakpoint create, etc.). The information includes the flag string, the flag
 * value in the enumeration type (index to arrays etc.), a signal if it is 
 * simple or not (has a =value or not), and the value to be given if it is a 
 * simple flag and was specified.
 */

#ifndef public

typedef struct {
        char     flag_str[3];
        unsigned flag;
        boolean  simple;
        unsigned value;
} flag_info_type;

typedef flag_info_type   flag_struct_type[];

typedef struct {
        boolean   specified;
        int       value;
} flag_entry_type;

typedef flag_entry_type    flag_array_type[];

/*
 * Uart divisor table entry
 */
typedef struct {
    unsigned short baud, divisor;
} uart_table_entry;

#endif



/*-----------------------------------------------------------------------------
 * 				
 *                            General type definitions
 * 
 *---------------------------------------------------------------------------*/
#ifndef public

typedef char s_str[S_SIZE];
typedef char l_str[L_SIZE];
typedef char vl_str[VL_SIZE];
typedef char *str;
typedef unsigned char  byte;
typedef unsigned short word;
typedef unsigned  double_word;
typedef unsigned  quad_word[2];
typedef byte	       *address;
typedef union { char b; short w; int d; int q[2]; } binval;

#endif



/*--------------------------------------------------------------------------
 * 				
 *                            Global variables
 *
 * Global variables which are defined for use in the drivers too.
 * Do NOT define any other global variables here. The variable names MUST
 * end with "__" .
 * 
 *------------------------------------------------------------------------*/
 
/*
 * Allocations for Cmon stack & the User interrupt stack
 */
public	byte end_cmon_stack__[C_IS_SIZE];
public	byte end_interrupt_stack__[IS_SIZE];

/*
 * The initial values for the CPU and MMU registers in monitor time
 * This variable should not be staticly initialized since some of them are
 * initialized in run time perior to init_data call
 */

public unsigned    cmon_sp__, cmon_fp__, cmon_sb__, cmon_mod__;
public unsigned    cmon_normal_intbase__, cmon_de_intbase__;

/*
 * The current address translation mode
 */

public trans_mode_type  trans_mode__;

/*
 * Uart divisor table
 */
#ifndef public
extern const uart_table_entry uart_table[];
#endif

/*
 * Power Up condition identifier.
 */
public pu_pattern__;

 /*--------------------------------------------------------------------------
  *
  *                     Longjmp Setjmp mechanism definitions
  *
  *-------------------------------------------------------------------------*/
  
  
public l_str  response__;
public jmp_buf  return_env__;

#ifndef public

#   define ERROR(str)   strcpy(response__, str); \
                        longjmp(return_env__, 1);
#endif


 /*--------------------------------------------------------------------------
  *
  *                     Register table & register save variables
  *
  *-------------------------------------------------------------------------*/


/* 
 * Following are register descriptor. Each register descriptor consists of:
 * 
 * 1. Register name string (as it appears in the monitor commands).
 * 2. Register size in bytes.
 * 3. Register save address. This is a pointer to where the register value
      is saved or NULL if the register value is not saved by CMON.
 * 4. Register read function. This function may be called to return the
      register value. If NULL the register save address should be used.
 * 5. Register write function. This function may be called to modify the
      register value. If NULL the register save address should be used.
 */

#ifndef public

typedef struct {
        char        name[6];
	char	    size;
	unsigned    *save_addr;
        void        (*read_func)();
        void        (*write_func)();
} reg_desc;

#endif


    /* CPU General Purpose Registers */
public reg_desc R0__ = {"R0", 'D', &save_R0__, NULL, NULL}; 
public unsigned int save_R0__;
public reg_desc R1__ = {"R1", 'D', &save_R1__, NULL, NULL}; 
public unsigned int save_R1__;
public reg_desc R2__ = {"R2", 'D', &save_R2__, NULL, NULL}; 
public unsigned int save_R2__;
public reg_desc R3__ = {"R3", 'D', &save_R3__, NULL, NULL}; 
public unsigned int save_R3__;
public reg_desc R4__ = {"R4", 'D', &save_R4__, NULL, NULL}; 
public unsigned int save_R4__;
public reg_desc R5__ = {"R5", 'D', &save_R5__, NULL, NULL}; 
public unsigned int save_R5__;
public reg_desc R6__ = {"R6", 'D', &save_R6__, NULL, NULL}; 
public unsigned int save_R6__;
public reg_desc R7__ = {"R7", 'D', &save_R7__, NULL, NULL}; 
public unsigned int save_R7__;

# if (CPU_TYPE == NS32SF641)

public reg_desc R8__ = {"R8", 'D', &save_R8__, NULL, NULL}; 
public unsigned int save_R8__;
public reg_desc R9__ = {"R9", 'D', &save_R9__, NULL, NULL}; 
public unsigned int save_R9__;
public reg_desc R10__ = {"R10", 'D', &save_R10__, NULL, NULL}; 
public unsigned int save_R10__;
public reg_desc R11__ = {"R11", 'D', &save_R11__, NULL, NULL}; 
public unsigned int save_R11__;
public reg_desc R12__ = {"R12", 'D', &save_R12__, NULL, NULL}; 
public unsigned int save_R12__;
public reg_desc R13__ = {"R13", 'D', &save_R13__, NULL, NULL}; 
public unsigned int save_R13__;
public reg_desc R14__ = {"R14", 'D', &save_R14__, NULL, NULL}; 
public unsigned int save_R14__;
public reg_desc R15__ = {"R15", 'D', &save_R15__, NULL, NULL}; 
public unsigned int save_R15__;
public reg_desc R16__ = {"R16", 'D', &save_R16__, NULL, NULL}; 
public unsigned int save_R16__;
public reg_desc R17__ = {"R17", 'D', &save_R17__, NULL, NULL}; 
public unsigned int save_R17__;
public reg_desc R18__ = {"R18", 'D', &save_R18__, NULL, NULL}; 
public unsigned int save_R18__;
public reg_desc R19__ = {"R19", 'D', &save_R19__, NULL, NULL}; 
public unsigned int save_R19__;
public reg_desc R20__ = {"R20", 'D', &save_R20__, NULL, NULL}; 
public unsigned int save_R20__;
public reg_desc R21__ = {"R21", 'D', &save_R21__, NULL, NULL}; 
public unsigned int save_R21__;
public reg_desc R22__ = {"R22", 'D', &save_R22__, NULL, NULL}; 
public unsigned int save_R22__;
public reg_desc R23__ = {"R23", 'D', &save_R23__, NULL, NULL}; 
public unsigned int save_R23__;
public reg_desc R24__ = {"R24", 'D', &save_R24__, NULL, NULL}; 
public unsigned int save_R24__;
public reg_desc R25__ = {"R25", 'D', &save_R25__, NULL, NULL}; 
public unsigned int save_R25__;
public reg_desc R26__ = {"R26", 'D', &save_R26__, NULL, NULL}; 
public unsigned int save_R26__;
public reg_desc R27__ = {"R27", 'D', &save_R27__, NULL, NULL}; 
public unsigned int save_R27__;
public reg_desc R28__ = {"R28", 'D', &save_R28__, NULL, NULL}; 
public unsigned int save_R28__;
public reg_desc R29__ = {"R29", 'D', &save_R29__, NULL, NULL}; 
public unsigned int save_R29__;
public reg_desc R30__ = {"R30", 'D', &save_R30__, NULL, NULL}; 
public unsigned int save_R30__;

# endif

    /* CPU Special Purpose Registers         */
public reg_desc PC__ = {"PC", 'D', &save_PC__, NULL, NULL};
public unsigned int save_PC__;
public reg_desc IN__ = {"IN", 'D', NULL, get_in__, mod_in__ }; 

# if (CPU_TYPE == NS32SF641)

public reg_desc SP__ = {"SP", 'D', &save_R30__, NULL, NULL};
public unsigned int save_SP__;
public reg_desc PSR__ = {"PS", 'D', &save_PSR__, NULL, NULL};
public unsigned int save_PSR__;
public reg_desc IS__ = {"IS", 'D', &save_IS__, NULL, NULL};
public unsigned int save_IS__;

# else

public reg_desc SP__ = {"SP", 'D', NULL, get_sp__, mod_sp__};
public reg_desc PSR__ = {"PS", 'W', &save_PSR__, NULL, NULL};
public unsigned int save_PSR__;
public reg_desc US__ = {"US", 'D', &save_US__, NULL, NULL};
public unsigned int save_US__;
public reg_desc SB__ = {"SB", 'D', &save_SB__, NULL, mod_sb__}; 
public unsigned int save_SB__;
public reg_desc FP__ = {"FP", 'D', &save_FP__, NULL, NULL}; 
public unsigned int save_FP__;
public reg_desc IS__ = {"IS", 'D', &save_IS__, NULL, NULL};
public unsigned int save_IS__;
public reg_desc MO__ = {"MO", 'W', &save_MO__, NULL, NULL};
public unsigned int save_MO__;
						    
# endif

# if (CORE_TYPE == CG)

	/*
	 * In CG core U can't read the CFG just modify it with 'setcfg'
	 */

#   if ((CPU_TYPE != NS32CG160) && (CPU_TYPE != NS32FX164))

public reg_desc CFG__ = {"CF", 'B', &save_CFG__, NULL, mod_cfg__};
public unsigned int save_CFG__;

#   else

public reg_desc CFG__ = {"CF", 'D', &save_CFG__, NULL, mod_cfg__};
public unsigned int save_CFG__;

#   endif

# else

public reg_desc CFG__ = {"CF", 'D', &save_CFG__, get_cfg__, mod_cfg__};
public unsigned int save_CFG__;

# endif

# if (CORE_TYPE == GX)

    /* NS32532 debug registers */
public reg_desc DC__ = {"DC", 'D', NULL, get_dcr__, mod_dcr__};
public reg_desc DS__ = {"DS", 'D', NULL, get_dsr__, mod_dsr__};
public reg_desc CA__ = {"CA", 'D', NULL, get_car__, mod_car__};
public reg_desc BR__ = {"BR", 'D', NULL, get_bpc__, mod_bpc__};

						    
# endif

# if (CPU_TYPE == NS32SF641)
#   ifndef SIM_32K
    /* NS32SF641 debug registers */
public reg_desc DC__ = {"DC", 'D', NULL,  get_dcr__, mod_dcr__}; 
public reg_desc DS__ = {"DS", 'D', NULL,  get_dsr__, mod_dsr__}; 
public reg_desc CA__ = {"CA", 'D', NULL,  get_car__, mod_car__}; 
public reg_desc AM__ = {"AM", 'D', NULL,  get_amr__, mod_amr__}; 
public reg_desc BPC0__ = {"BPC0", 'D', NULL, get_bpc0__, mod_bpc0__}; 
public reg_desc BPC1__ = {"BPC1", 'D', NULL, get_bpc1__, mod_bpc1__}; 
public reg_desc DES__ = {"DES", 'D', NULL, get_desr__, mod_desr__}; 
public reg_desc DD__ = {"DD", 'D', NULL,  get_ddr__, mod_ddr__}; 

#   else
private unsigned dummy;
public reg_desc DC__ = {"DC", 'D', &dummy,  NULL, NULL}; 
public reg_desc DS__ = {"DS", 'D', &dummy,  NULL, NULL}; 
public reg_desc CA__ = {"CA", 'D', &dummy,  NULL, NULL}; 
public reg_desc AM__ = {"AM", 'D', &dummy,  NULL, NULL}; 
public reg_desc BPC0__ = {"BPC0", 'D', &dummy, NULL, NULL}; 
public reg_desc BPC1__ = {"BPC1", 'D', &dummy, NULL, NULL}; 
public reg_desc DES__ = {"DES", 'D', &dummy, NULL, NULL}; 
public reg_desc DD__ = {"DD", 'D', &dummy,  NULL, NULL}; 


#   endif
# endif
 

# if (FPU_TYPE != NOFPU)
    /* FPU registers */

# if (CPU_TYPE == NS32SF641)

public reg_desc F0__ = {"F0", 'D', &save_F0__, NULL, NULL}; 
public unsigned int save_F0__ = 0;
public reg_desc F1__ = {"F1", 'D', &save_F1__, NULL, NULL}; 
public unsigned int save_F1__ = 0;
public reg_desc F2__ = {"F2", 'D', &save_F2__, NULL, NULL}; 
public unsigned int save_F2__ = 0;
public reg_desc F3__ = {"F3", 'D', &save_F3__, NULL, NULL}; 
public unsigned int save_F3__ = 0;
public reg_desc F4__ = {"F4", 'D', &save_F4__, NULL, NULL}; 
public unsigned int save_F4__ = 0;
public reg_desc F5__ = {"F5", 'D', &save_F5__, NULL, NULL}; 
public unsigned int save_F5__ = 0;
public reg_desc F6__ = {"F6", 'D', &save_F6__, NULL, NULL}; 
public unsigned int save_F6__ = 0;
public reg_desc F7__ = {"F7", 'D', &save_F7__, NULL, NULL}; 
public unsigned int save_F7__ = 0;
public reg_desc F8__ = {"F8", 'D', &save_F8__, NULL, NULL}; 
public unsigned int save_F8__ = 0;
public reg_desc F9__ = {"F9", 'D', &save_F9__, NULL, NULL}; 
public unsigned int save_F9__ = 0;
public reg_desc F10__ = {"F10", 'D', &save_F10__, NULL, NULL}; 
public unsigned int save_F10__ = 0;
public reg_desc F11__ = {"F11", 'D', &save_F11__, NULL, NULL}; 
public unsigned int save_F11__ = 0;
public reg_desc F12__ = {"F12", 'D', &save_F12__, NULL, NULL}; 
public unsigned int save_F12__ = 0;
public reg_desc F13__ = {"F13", 'D', &save_F13__, NULL, NULL}; 
public unsigned int save_F13__ = 0;
public reg_desc F14__ = {"F14", 'D', &save_F14__, NULL, NULL}; 
public unsigned int save_F14__ = 0;
public reg_desc F15__ = {"F15", 'D', &save_F15__, NULL, NULL}; 
public unsigned int save_F15__ = 0;
public reg_desc F16__ = {"F16", 'D', &save_F16__, NULL, NULL}; 
public unsigned int save_F16__ = 0;
public reg_desc F17__ = {"F17", 'D', &save_F17__, NULL, NULL}; 
public unsigned int save_F17__ = 0;
public reg_desc F18__ = {"F18", 'D', &save_F18__, NULL, NULL}; 
public unsigned int save_F18__ = 0;
public reg_desc F19__ = {"F19", 'D', &save_F19__, NULL, NULL}; 
public unsigned int save_F19__ = 0;
public reg_desc F20__ = {"F20", 'D', &save_F20__, NULL, NULL}; 
public unsigned int save_F20__ = 0;
public reg_desc F21__ = {"F21", 'D', &save_F21__, NULL, NULL}; 
public unsigned int save_F21__ = 0;
public reg_desc F22__ = {"F22", 'D', &save_F22__, NULL, NULL}; 
public unsigned int save_F22__ = 0;
public reg_desc F23__ = {"F23", 'D', &save_F23__, NULL, NULL}; 
public unsigned int save_F23__ = 0;
public reg_desc F24__ = {"F24", 'D', &save_F24__, NULL, NULL}; 
public unsigned int save_F24__ = 0;
public reg_desc F25__ = {"F25", 'D', &save_F25__, NULL, NULL}; 
public unsigned int save_F25__ = 0;
public reg_desc F26__ = {"F26", 'D', &save_F26__, NULL, NULL}; 
public unsigned int save_F26__ = 0;
public reg_desc F27__ = {"F27", 'D', &save_F27__, NULL, NULL}; 
public unsigned int save_F27__ = 0;
public reg_desc F28__ = {"F28", 'D', &save_F28__, NULL, NULL}; 
public unsigned int save_F28__ = 0;
public reg_desc F29__ = {"F29", 'D', &save_F29__, NULL, NULL}; 
public unsigned int save_F29__ = 0;
public reg_desc F30__ = {"F30", 'D', &save_F30__, NULL, NULL}; 
public unsigned int save_F30__ = 0;
public reg_desc F31__ = {"F31", 'D', &save_F31__, NULL, NULL}; 
public unsigned int save_F31__ = 0;

public reg_desc L0__ = {"L0", 'Q', NULL, get_L0__, mod_L0__}; 
public reg_desc L2__ = {"L2", 'Q', NULL, get_L2__, mod_L2__}; 
public reg_desc L4__ = {"L4", 'Q', NULL, get_L4__, mod_L4__}; 
public reg_desc L6__ = {"L6", 'Q', NULL, get_L6__, mod_L6__}; 
public reg_desc L8__ = {"L8", 'Q', NULL, get_L8__, mod_L8__}; 
public reg_desc L10__ = {"L10", 'Q', NULL, get_L10__, mod_L10__}; 
public reg_desc L12__ = {"L12", 'Q', NULL, get_L12__, mod_L12__}; 
public reg_desc L14__ = {"L14", 'Q', NULL, get_L14__, mod_L14__}; 
public reg_desc L16__ = {"L16", 'Q', NULL, get_L16__, mod_L16__}; 
public reg_desc L18__ = {"L18", 'Q', NULL, get_L18__, mod_L18__}; 
public reg_desc L20__ = {"L20", 'Q', NULL, get_L20__, mod_L20__}; 
public reg_desc L22__ = {"L22", 'Q', NULL, get_L22__, mod_L22__}; 
public reg_desc L24__ = {"L24", 'Q', NULL, get_L24__, mod_L24__}; 
public reg_desc L26__ = {"L26", 'Q', NULL, get_L26__, mod_L26__}; 
public reg_desc L28__ = {"L28", 'Q', NULL, get_L28__, mod_L28__}; 
public reg_desc L30__ = {"L30", 'Q', NULL, get_L30__, mod_L30__};
 
public reg_desc FS__ = {"FS", 'D', &save_FS__, NULL, NULL};
public unsigned int save_FS__ = 0;

public reg_desc FTRL__ = {"FTRL", 'D', &save_FTRL__, NULL, NULL};
public unsigned int save_FTRL__ = 0;

public reg_desc FTRH__ = {"FTRH", 'D', &save_FTRH__, NULL, NULL};
public unsigned int save_FTRH__ = 0;
#else

public reg_desc F0__ = {"F0", 'D', NULL, get_F0__, mod_F0__};
public reg_desc F1__ = {"F1", 'D', NULL, get_F1__, mod_F1__}; 
public reg_desc F2__ = {"F2", 'D', NULL, get_F2__, mod_F2__}; 
public reg_desc F3__ = {"F3", 'D', NULL, get_F3__, mod_F3__}; 
public reg_desc F4__ = {"F4", 'D', NULL, get_F4__, mod_F4__}; 
public reg_desc F5__ = {"F5", 'D', NULL, get_F5__, mod_F5__}; 
public reg_desc F6__ = {"F6", 'D', NULL, get_F6__, mod_F6__}; 
public reg_desc F7__ = {"F7", 'D', NULL, get_F7__, mod_F7__};
 
public reg_desc L0__ = {"L0", 'Q', NULL, get_L0__, mod_L0__}; 
public reg_desc L1__ = {"L1", 'Q', NULL, get_L1__, mod_L1__}; 
public reg_desc L2__ = {"L2", 'Q', NULL, get_L2__, mod_L2__}; 
public reg_desc L3__ = {"L3", 'Q', NULL, get_L3__, mod_L3__}; 
public reg_desc L4__ = {"L4", 'Q', NULL, get_L4__, mod_L4__}; 
public reg_desc L5__ = {"L5", 'Q', NULL, get_L5__, mod_L5__}; 
public reg_desc L6__ = {"L6", 'Q', NULL, get_L6__, mod_L6__}; 
public reg_desc L7__ = {"L7", 'Q', NULL, get_L7__, mod_L7__}; 
public reg_desc FS__ = {"FS", 'D', NULL, get_fsr__, mod_fsr__};

# endif
# endif /* NOFPU */

						    
/* Following is a global register table. Each entry in the table is
   a pointer to a register descriptor.
*/

public const reg_desc *reg_tab__[] = {
    /* General Purpose Registers */
        &R0__,
	&R1__,
	&R2__,
	&R3__,
	&R4__,
	&R5__,
	&R6__,
	&R7__,
# if (CPU_TYPE == NS32SF641)
	&R8__,
	&R9__,
	&R10__,
	&R11__,
	&R12__,
	&R13__,
	&R14__,
	&R15__,
	&R16__,
	&R17__,
	&R18__,
	&R19__,
	&R20__,
	&R21__,
	&R22__,
	&R23__,
	&R24__,
	&R25__,
	&R26__,
	&R27__,
	&R28__,
	&R29__,
	&R30__,
# endif

    /* CPU Special Purpose Registers         */
	&PC__,
	&SP__,
	&IN__,
	&CFG__,
	&IS__,
# if (CPU_TYPE == NS32SF641)
	&PSR__,
# else
	&PSR__,
	&US__,
	&SB__,
	&FP__,
	&MO__,
# endif
# if (CORE_TYPE == GX)
    /* NS32532 debug registers */
        &DC__,
	&DS__,
	&CA__,
	&BR__,
# endif
# if (CPU_TYPE == NS32SF641)
	&DC__,
	&DS__,
	&CA__,
	&AM__,
	&BPC0__,
	&BPC1__,
	&DES__,
	&DD__,
# endif
# if (FPU_TYPE != NOFPU)
        &F0__,
	&F1__,
	&F2__,
	&F3__,
	&F4__,
	&F5__,
	&F6__,
	&F7__,
# if (CPU_TYPE == NS32SF641)
	&F8__,
	&F9__,
	&F10__,
	&F11__,
	&F12__,
	&F13__,
	&F14__,
	&F15__,
	&F16__,
	&F17__,
	&F18__,
	&F19__,
	&F20__,
	&F21__,
	&F22__,
	&F23__,
	&F24__,
	&F25__,
	&F26__,
	&F27__,
	&F28__,
	&F29__,
	&F30__,
	&F31__,
# endif
# if (CPU_TYPE == NS32SF641)
	&L0__,
	&L2__,
	&L4__,
	&L6__,
	&L8__,
	&L10__,
	&L12__,
	&L14__,
	&L16__,
	&L18__,
	&L20__,
	&L22__,
	&L24__,
	&L26__,
	&L28__,
	&L30__,
# else
	&L0__,
	&L1__,
	&L2__,
	&L3__,
        &L4__,
	&L5__,
	&L6__,
	&L7__,
# endif
        &FS__,
#if (CPU_TYPE == NS32SF641)
        &FTRL__,
        &FTRH__,
#endif

#endif /* NOFPU */
        NULL
};

