"I am a person who works hard and plays hard."

Yuan Wei
Second Year Graduate Student Department of Computer Science
University of Virginia Charlottesville, VA 22903
Email: yw3f@cs.virginia.edu


Source Code Analysis

Main Page   Compound List   File List   Compound Members   File Members  

alpha.h File Reference

#include <stdio.h>
#include "host.h"
#include "misc.h"
#include "config.h"
#include "endian.h"
#include "machine.def"

Include dependency graph for alpha.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

Defines

Typedefs

Enumerations

Functions

Variables


Define Documentation

#define ARITH_OVFL RESULT,
OP1,
OP2       ((RESULT) < (OP1) || (RESULT) < (OP2))
 

Definition at line 365 of file alpha.h.

#define CONNECT OP   
 

#define DEFINST OP,
MSK,
NAME,
OPFORM,
RES,
FLAGS,
O1,
O2,
I1,
I2,
I3       OP,
 

#define DEFLINK OP,
MSK,
NAME,
MASK,
SHIFT       OP,
 

#define F_CALL   0x00008000
 

Definition at line 331 of file alpha.h.

#define F_COND   0x00000010
 

Definition at line 320 of file alpha.h.

#define F_CTRL   0x00000004
 

Definition at line 318 of file alpha.h.

#define F_DIRECT   0x00000400
 

Definition at line 326 of file alpha.h.

#define F_DIRJMP   0x00002000
 

Definition at line 329 of file alpha.h.

#define F_DISP   0x00000100
 

Definition at line 324 of file alpha.h.

#define F_FCOMP   0x00000002
 

Definition at line 317 of file alpha.h.

#define F_FPCOND   0x00010000
 

Definition at line 332 of file alpha.h.

#define F_ICOMP   0x00000001
 

Definition at line 316 of file alpha.h.

#define F_IMM   0x00020000
 

Definition at line 333 of file alpha.h.

#define F_INDIRJMP   0x00004000
 

Definition at line 330 of file alpha.h.

#define F_LOAD   0x00000040
 

Definition at line 322 of file alpha.h.

#define F_LONGLAT   0x00001000
 

Definition at line 328 of file alpha.h.

#define F_MEM   0x00000020
 

Definition at line 321 of file alpha.h.

#define F_RR   0x00000200
 

Definition at line 325 of file alpha.h.

#define F_STORE   0x00000080
 

Definition at line 323 of file alpha.h.

#define F_TRAP   0x00000800
 

Definition at line 327 of file alpha.h.

#define F_UNCOND   0x00000008
 

Definition at line 319 of file alpha.h.

#define for_counter   for_sqword
 

Definition at line 532 of file alpha.h.

#define IEEEFP_DBL_EXPONENT      (((Q) >> 52) & 0x7ff)
 

Definition at line 369 of file alpha.h.

#define IEEEFP_DBL_FRACTION      ((Q) & ULL(0xfffffffffffff))
 

Definition at line 370 of file alpha.h.

#define IEEEFP_DBL_SIGN      ((Q) >> 63)
 

Definition at line 368 of file alpha.h.

#define IMM   ((qword_t)((inst >> 13) & 0xff))
 

Definition at line 346 of file alpha.h.

#define IS_IEEEFP_DBL_NAN      ((IEEEFP_DBL_EXPONENT(Q) == 0x7ff) && (IEEEFP_DBL_FRACTION(Q)))
 

Definition at line 371 of file alpha.h.

#define MD_AGEN_OP   ADDQ
 

Definition at line 598 of file alpha.h.

#define MD_AMODE_POSTPROBE FSM   
 

Definition at line 445 of file alpha.h.

#define MD_AMODE_PREPROBE OP,
FSM       { (FSM) = 0; }
 

Definition at line 422 of file alpha.h.

#define MD_AMODE_PROBE AM,
OP,
FSM   
 

Value:

{                                                                       \
    if (MD_OP_FLAGS(OP) & F_DISP)                                       \
      {                                                                 \
        if ((RB) == MD_REG_GP)                                          \
          (AM) = md_amode_gp;                                           \
        else if ((RB) == MD_REG_SP)                                     \
          (AM) = md_amode_sp;                                           \
        else if ((RB) == MD_REG_FP)  \
          (AM) = md_amode_fp;                                           \
        else                                                            \
          (AM) = md_amode_disp;                                         \
      }                                                                 \
    else if (MD_OP_FLAGS(OP) & F_RR)                                    \
      (AM) = md_amode_rr;                                               \
    else                                                                \
      panic("cannot decode addressing mode");                           \
  }

Definition at line 425 of file alpha.h.

#define MD_BR_SHIFT   2
 

Definition at line 616 of file alpha.h.

#define MD_EIO_FILE_FORMAT   EIO_ALPHA_FORMAT
 

Definition at line 453 of file alpha.h.

#define MD_EXIT_SYSCALL REGS       ((REGS)->regs_R[MD_REG_V0] == OSF_SYS_exit)
 

Definition at line 386 of file alpha.h.

#define MD_EXO_CMP_IREG EXO,
REGS,
IDX       ((REGS)->regs_R[IDX] != (qword_t)(EXO)->as_integer.val)
 

Definition at line 501 of file alpha.h.

#define MD_EXO_TO_FREG EXO,
REGS,
IDX       ((REGS)->regs_F.q[IDX] = (qword_t)(EXO)->as_integer.val)
 

Definition at line 498 of file alpha.h.

#define MD_EXO_TO_IREG EXO,
REGS,
IDX       ((REGS)->regs_R[IDX] = (qword_t)(EXO)->as_integer.val)
 

Definition at line 495 of file alpha.h.

#define MD_EXO_TO_MISC_REGS EXO,
ICNT,
REGS   
 

Value:

\
  if (!exo                                                              \
      || exo->ec != ec_list                                             \
      || !exo->as_list.head                                             \
      || exo->as_list.head->ec != ec_integer                            \
      || !exo->as_list.head->next                                       \
      || exo->as_list.head->next->ec != ec_address                      \
      || !exo->as_list.head->next->next                                 \
      || exo->as_list.head->next->next->ec != ec_address                \
      || !exo->as_list.head->next->next->next                           \
      || exo->as_list.head->next->next->next->ec != ec_integer          \
      || !exo->as_list.head->next->next->next->next                     \
      || exo->as_list.head->next->next->next->next->ec != ec_integer    \
      || exo->as_list.head->next->next->next->next->next != NULL)       \
    fatal("could not read EIO misc regs");                              \
  (ICNT) = (counter_t)exo->as_list.head->as_integer.val;                \
  (REGS)->regs_PC = (md_addr_t)exo->as_list.head->next->as_integer.val; \
  (REGS)->regs_NPC =                                                    \
    (md_addr_t)exo->as_list.head->next->next->as_integer.val;           \
  (REGS)->regs_C.fpcr =                                                 \
    (qword_t)exo->as_list.head->next->next->next->as_integer.val;       \
  (REGS)->regs_C.uniq =                                                 \
    (qword_t)exo->as_list.head->next->next->next->next->as_integer.val;

Definition at line 470 of file alpha.h.

#define MD_FETCH_INST INST,
MEM,
PC       { (INST) = MEM_READ_WORD((MEM), (PC)); }
 

Definition at line 239 of file alpha.h.

#define MD_FIRST_IN_REG   0
 

Definition at line 504 of file alpha.h.

#define MD_FIRST_OUT_REG   0
 

Definition at line 507 of file alpha.h.

#define MD_FREG_TO_EXO REGS,
IDX       exo_new(ec_address, (exo_integer_t)(REGS)->regs_F.q[IDX])
 

Definition at line 467 of file alpha.h.

#define MD_FU_NAME FU       (md_fu2name[FU])
 

Definition at line 312 of file alpha.h.

#define MD_IREG_TO_EXO REGS,
IDX       exo_new(ec_address, (exo_integer_t)(REGS)->regs_R[IDX])
 

Definition at line 464 of file alpha.h.

#define MD_IS_CALL OP       ((OP) == JSR || (OP) == BSR)
 

Definition at line 400 of file alpha.h.

#define MD_IS_INDIR OP       ((OP) == JMP || (OP) == JSR || (OP) == RETN || (OP) == JSR_COROUTINE)
 

Definition at line 406 of file alpha.h.

#define MD_IS_RETURN OP       ((OP) == RETN)
 

Definition at line 403 of file alpha.h.

#define MD_LAST_IN_REG   21
 

Definition at line 505 of file alpha.h.

#define MD_LAST_OUT_REG   21
 

Definition at line 508 of file alpha.h.

#define MD_LOG_PAGE_SIZE   13
 

Definition at line 139 of file alpha.h.

#define MD_MAX_ENVIRON   16384
 

Definition at line 247 of file alpha.h.

#define MD_MAX_MASK   2048
 

Definition at line 264 of file alpha.h.

#define MD_MISC_REGS_TO_EXO REGS   
 

Value:

exo_new(ec_list,                                                        \
           exo_new(ec_integer, (exo_integer_t)sim_num_insn),    \
           exo_new(ec_address, (exo_integer_t)(REGS)->regs_PC), \
           exo_new(ec_address, (exo_integer_t)(REGS)->regs_NPC),        \
           exo_new(ec_integer, (exo_integer_t)(REGS)->regs_C.fpcr),\
           exo_new(ec_integer, (exo_integer_t)(REGS)->regs_C.uniq),\
          NULL)

Definition at line 455 of file alpha.h.

#define MD_NOP_OP   OP_NA
 

Definition at line 601 of file alpha.h.

#define MD_NUM_CREGS   2
 

Definition at line 171 of file alpha.h.

#define MD_NUM_FREGS   32
 

Definition at line 168 of file alpha.h.

#define MD_NUM_IREGS   32
 

Definition at line 165 of file alpha.h.

#define MD_OP_FLAGS OP       (md_op2flags[OP])
 

Definition at line 336 of file alpha.h.

#define MD_OP_FORMAT OP       (md_op2format[OP])
 

Definition at line 287 of file alpha.h.

#define MD_OP_FUCLASS OP       (md_op2fu[OP])
 

Definition at line 308 of file alpha.h.

#define MD_OP_NAME OP       (md_op2name[OP])
 

Definition at line 283 of file alpha.h.

#define MD_OUTPUT_SYSCALL REGS   
 

Value:

((REGS)->regs_R[MD_REG_V0] == OSF_SYS_write                             \
   && ((REGS)->regs_R[MD_REG_A0] ==  1                  \
       || (REGS)->regs_R[MD_REG_A0] ==  2))

Definition at line 391 of file alpha.h.

#define MD_PAGE_SIZE   8192
 

Definition at line 138 of file alpha.h.

#define MD_QWORD_ADDRS
 

Definition at line 127 of file alpha.h.

#define MD_SET_OPCODE OP,
INST   
 

Value:

{ OP = md_mask2op[MD_TOP_OP(INST)];                                     \
    while (md_opmask[OP])                                               \
      OP = md_mask2op[((INST >> md_opshift[OP]) & md_opmask[OP])        \
                      + md_opoffset[OP]]; }

Definition at line 256 of file alpha.h.

#define MD_STREAM_FILENO REGS       ((REGS)->regs_R[MD_REG_A0])
 

Definition at line 397 of file alpha.h.

#define MD_SWAPD      (X)
 

Definition at line 233 of file alpha.h.

#define MD_SWAPH      (X)
 

Definition at line 230 of file alpha.h.

#define MD_SWAPI      (X)
 

Definition at line 234 of file alpha.h.

#define MD_SWAPQ      (X)
 

Definition at line 232 of file alpha.h.

#define MD_SWAPW      (X)
 

Definition at line 231 of file alpha.h.

#define MD_TOP_OP INST       (((INST) >> 26) & 0x3f)
 

Definition at line 255 of file alpha.h.

#define MD_TOTAL_REGS   ( 32 + 32 + 2 + 1 + 1 + 1)
 

Definition at line 174 of file alpha.h.

#define MD_VALID_ADDR ADDR   
 

Value:

(((ADDR) >= ld_text_base && (ADDR) < (ld_text_base + ld_text_size))     \
   || ((ADDR) >= ld_data_base && (ADDR) < ld_brk_point)                 \
   || ((ADDR) >= (ld_stack_base - 16*1024*1024) && (ADDR) < ld_stack_base))

Definition at line 605 of file alpha.h.

#define NA   0
 

Definition at line 120 of file alpha.h.

#define OFS   (inst & 0xffff)
 

Definition at line 352 of file alpha.h.

#define OSF_SYS_exit   1
 

Definition at line 385 of file alpha.h.

#define OSF_SYS_write   4
 

Definition at line 390 of file alpha.h.

#define RA   ((inst >> 21) & 0x1f)
 

Definition at line 341 of file alpha.h.

#define RB   ((inst >> 16) & 0x1f)
 

Definition at line 342 of file alpha.h.

#define RC   (inst & 0x1f)
 

Definition at line 343 of file alpha.h.

#define sc_counter   sc_sqword
 

Definition at line 531 of file alpha.h.

#define SET_TPC PC       (void)0
 

Definition at line 376 of file alpha.h.

#define SEXT      (((X) & 0x8000) ? ((sqword_t)(X) | LL(0xffffffffffff0000)) : (sqword_t)(X))
 

Definition at line 355 of file alpha.h.

#define SEXT21      (((X) & 0x100000) ? ((sqword_t)(X) | LL(0xffffffffffe00000)) : (sqword_t)(X))
 

Definition at line 358 of file alpha.h.

#define SEXT32      (((X) & 0x80000000) ? ((sqword_t)(X)|LL(0xffffffff00000000)) : (sqword_t)(X))
 

Definition at line 361 of file alpha.h.

#define stat_reg_addr   stat_reg_qword
 

Definition at line 535 of file alpha.h.

#define stat_reg_counter   stat_reg_sqword
 

Definition at line 530 of file alpha.h.

#define TARG   (inst & 0x1fffff)
 

Definition at line 349 of file alpha.h.

#define TARGET_ALPHA
 

Definition at line 112 of file alpha.h.


Typedef Documentation

typedef qword_t exo_address_t
 

Definition at line 516 of file alpha.h.

typedef double exo_float_t
 

Definition at line 522 of file alpha.h.

typedef qword_t exo_integer_t
 

Definition at line 519 of file alpha.h.

typedef qword_t md_addr_t
 

Definition at line 130 of file alpha.h.

typedef qword_t md_gpr_t[MD_NUM_IREGS]
 

Definition at line 178 of file alpha.h.

typedef word_t md_inst_t
 

Definition at line 215 of file alpha.h.


Enumeration Type Documentation

enum md_amode_type
 

Enumeration values:
md_amode_imm 
md_amode_gp 
md_amode_sp 
md_amode_fp 
md_amode_disp 
md_amode_rr 
md_amode_NUM 

Definition at line 410 of file alpha.h.

00410                    {
00411   md_amode_imm,         /* immediate addressing mode */
00412   md_amode_gp,          /* global data access through global pointer */
00413   md_amode_sp,          /* stack access through stack pointer */
00414   md_amode_fp,          /* stack access through frame pointer */
00415   md_amode_disp,        /* (reg + const) addressing */
00416   md_amode_rr,          /* (reg + reg) addressing */
00417   md_amode_NUM
00418 };

enum md_fault_type
 

Enumeration values:
md_fault_none 
md_fault_access 
md_fault_alignment 
md_fault_overflow 
md_fault_div0 
md_fault_invalid 
md_fault_break 
md_fault_unimpl 
md_fault_internal 

Definition at line 146 of file alpha.h.

00146                    {
00147   md_fault_none = 0,            /* no fault */
00148   md_fault_access,              /* storage access fault */
00149   md_fault_alignment,           /* storage alignment fault */
00150   md_fault_overflow,            /* signed arithmetic overflow fault */
00151   md_fault_div0,                /* division by zero fault */
00152   md_fault_invalid,             /* invalid arithmetic operation */ 
00153                                 /* added to allow SQRT{S,T} in FIX exts */
00154   md_fault_break,               /* BREAK instruction fault */
00155   md_fault_unimpl,              /* unimplemented instruction fault */
00156   md_fault_internal             /* internal S/W fault */
00157 };

enum md_fu_class
 

Enumeration values:
FUClamd_NA 
IntALU 
IntMULT 
IntDIV 
FloatADD 
FloatCMP 
FloatCVT 
FloatMULT 
FloatDIV 
FloatSQRT 
RdPort 
WrPort 
NUM_FU_CLASSES 

Definition at line 291 of file alpha.h.

00291                  {
00292   FUClamd_NA = 0,       /* inst does not use a functional unit */
00293   IntALU,               /* integer ALU */
00294   IntMULT,              /* integer multiplier */
00295   IntDIV,               /* integer divider */
00296   FloatADD,             /* floating point adder/subtractor */
00297   FloatCMP,             /* floating point comparator */
00298   FloatCVT,             /* floating point<->integer converter */
00299   FloatMULT,            /* floating point multiplier */
00300   FloatDIV,             /* floating point divider */
00301   FloatSQRT,            /* floating point square root */
00302   RdPort,               /* memory read port */
00303   WrPort,               /* memory write port */
00304   NUM_FU_CLASSES        /* total functional unit classes */
00305 };

enum md_opcode
 

Enumeration values:
OP_NA 
OP 
MSK 
NAME 
OPFORM 
RES 
FLAGS 
O1 
O2 
I1 
I2 
OP 
MSK 
NAME 
MASK 
OP_MAX 

Definition at line 273 of file alpha.h.

00273                {
00274   OP_NA = 0,    /* NA */
00275 #define DEFINST(OP,MSK,NAME,OPFORM,RES,FLAGS,O1,O2,I1,I2,I3) OP,
00276 #define DEFLINK(OP,MSK,NAME,MASK,SHIFT) OP,
00277 #define CONNECT(OP)
00278 #include "machine.def"
00279   OP_MAX        /* number of opcodes + NA */
00280 };

enum md_reg_names
 

Enumeration values:
MD_REG_V0 
MD_REG_ERR 
MD_REG_FP 
MD_REG_A0 
MD_REG_A1 
MD_REG_A2 
MD_REG_A3 
MD_REG_A4 
MD_REG_A5 
MD_REG_RA 
MD_REG_GP 
MD_REG_SP 
MD_REG_ZERO 

Definition at line 193 of file alpha.h.

00193                   {
00194   MD_REG_V0 = 0,        /* return value reg */
00195   MD_REG_ERR = 7,
00196   MD_REG_FP = 15,       /* frame pointer */
00197   MD_REG_A0 = 16,       /* argument regs */
00198   MD_REG_A1 = 17,
00199   MD_REG_A2 = 18,
00200   MD_REG_A3 = 19,
00201   MD_REG_A4 = 20,
00202   MD_REG_A5 = 21,
00203   MD_REG_RA = 26,       /* return address reg */
00204   MD_REG_GP = 29,       /* global data section pointer */
00205   MD_REG_SP = 30,       /* stack pointer */
00206   MD_REG_ZERO = 31      /* zero register */
00207 };

enum md_reg_type
 

Enumeration values:
rt_gpr 
rt_lpr 
rt_fpr 
rt_dpr 
rt_ctrl 
rt_PC 
rt_NPC 
rt_NUM 

Definition at line 543 of file alpha.h.

00543                  {
00544   rt_gpr,               /* general purpose register */
00545   rt_lpr,               /* integer-precision floating pointer register */
00546   rt_fpr,               /* single-precision floating pointer register */
00547   rt_dpr,               /* double-precision floating pointer register */
00548   rt_ctrl,              /* control register */
00549   rt_PC,                /* program counter */
00550   rt_NPC,               /* next program counter */
00551   rt_NUM
00552 };


Function Documentation

void md_init_decoder void   
 

Definition at line 588 of file pisa.c.

00589 {
00590   /* FIXME: CONNECT defined? */
00591 #define DEFINST(OP,MSK,NAME,OPFORM,RES,FLAGS,O1,O2,I1,I2,I3)            \
00592   if (md_mask2op[(MSK)]) fatal("doubly defined mask value");            \
00593   if ((MSK) >= MD_MAX_MASK) fatal("mask value is too large");           \
00594   md_mask2op[(MSK)]=(OP);
00595 
00596 #include "machine.def"
00597 }

void md_print_creg md_ctrl_t    regs,
int    reg,
FILE *    stream
 

Definition at line 509 of file pisa.c.

00510 {
00511   /* index is only used to iterate over these registers, hence no enums... */
00512   switch (reg)
00513     {
00514     case 0:
00515       fprintf(stream, "HI: 0x%08x", regs.hi);
00516       break;
00517 
00518     case 1:
00519       fprintf(stream, "LO: 0x%08x", regs.lo);
00520       break;
00521 
00522     case 2:
00523       fprintf(stream, "FCC: 0x%08x", regs.fcc);
00524       break;
00525 
00526     default:
00527       panic("bogus control register index");
00528     }
00529 }

void md_print_cregs md_ctrl_t    regs,
FILE *    stream
 

Definition at line 532 of file pisa.c.

00533 {
00534   md_print_creg(regs, 0, stream);
00535   fprintf(stream, "  ");
00536   md_print_creg(regs, 1, stream);
00537   fprintf(stream, "  ");
00538   md_print_creg(regs, 2, stream);
00539   fprintf(stream, "\n");
00540 }

void md_print_fpreg md_fpr_t    regs,
int    reg,
FILE *    stream
 

Definition at line 481 of file pisa.c.

00482 {
00483   fprintf(stream, "%4s: %12d/0x%08x/%f",
00484           md_reg_name(rt_fpr, reg), regs.l[reg], regs.l[reg], regs.f[reg]);
00485   if (/* even? */!(reg & 1))
00486     {
00487       fprintf(stream, " (%4s as double: %f)",
00488               md_reg_name(rt_dpr, reg/2), regs.d[reg/2]);
00489     }
00490 }

void md_print_fpregs md_fpr_t    regs,
FILE *    stream
 

Definition at line 493 of file pisa.c.

00494 {
00495   int i;
00496 
00497   /* floating point registers */
00498   for (i=0; i < MD_NUM_FREGS; i += 2)
00499     {
00500       md_print_fpreg(regs, i, stream);
00501       fprintf(stream, "\n");
00502 
00503       md_print_fpreg(regs, i+1, stream);
00504       fprintf(stream, "\n");
00505     }
00506 }

void md_print_insn md_inst_t    inst,
md_addr_t    pc,
FILE *    stream
 

Definition at line 601 of file pisa.c.

00604 {
00605   enum md_opcode op;
00606 
00607   /* use stderr as default output stream */
00608   if (!stream)
00609     stream = stderr;
00610 
00611   /* decode the instruction, assumes predecoded text segment */
00612   MD_SET_OPCODE(op, inst);
00613 
00614   /* disassemble the instruction */
00615   if (op == OP_NA || op >= OP_MAX)
00616     {
00617       /* bogus instruction */
00618       fprintf(stream, "<invalid inst: 0x%08x:%08x>", inst.a, inst.b);
00619     }
00620   else
00621     {
00622       char *s;
00623 
00624       fprintf(stream, "%-10s", MD_OP_NAME(op));
00625 
00626       s = MD_OP_FORMAT(op);
00627       while (*s) {
00628         switch (*s) {
00629         case 'd':
00630           fprintf(stream, "r%d", RD);
00631           break;
00632         case 's':
00633           fprintf(stream, "r%d", RS);
00634           break;
00635         case 't':
00636           fprintf(stream, "r%d", RT);
00637           break;
00638         case 'b':
00639           fprintf(stream, "r%d", BS);
00640           break;
00641         case 'D':
00642           fprintf(stream, "f%d", FD);
00643           break;
00644         case 'S':
00645           fprintf(stream, "f%d", FS);
00646           break;
00647         case 'T':
00648           fprintf(stream, "f%d", FT);
00649           break;
00650         case 'j':
00651           fprintf(stream, "0x%x", (pc + 8 + (OFS << 2)));
00652           break;
00653         case 'o':
00654         case 'i':
00655           fprintf(stream, "%d", IMM);
00656           break;
00657         case 'H':
00658           fprintf(stream, "%d", SHAMT);
00659           break;
00660         case 'u':
00661           fprintf(stream, "%u", UIMM);
00662           break;
00663         case 'U':
00664           fprintf(stream, "0x%x", UIMM);
00665           break;
00666         case 'J':
00667           fprintf(stream, "0x%x", ((pc & 036000000000) | (TARG << 2)));
00668           break;
00669         case 'B':
00670           fprintf(stream, "0x%x", BCODE);
00671           break;
00672 #if 0 /* FIXME: obsolete... */
00673         case ')':
00674           /* handle pre- or post-inc/dec */
00675           if (SS_COMP_OP == SS_COMP_NOP)
00676             fprintf(stream, ")");
00677           else if (SS_COMP_OP == SS_COMP_POST_INC)
00678             fprintf(stream, ")+");
00679           else if (SS_COMP_OP == SS_COMP_POST_DEC)
00680             fprintf(stream, ")-");
00681           else if (SS_COMP_OP == SS_COMP_PRE_INC)
00682             fprintf(stream, ")^+");
00683           else if (SS_COMP_OP == SS_COMP_PRE_DEC)
00684             fprintf(stream, ")^-");
00685           else if (SS_COMP_OP == SS_COMP_POST_DBL_INC)
00686             fprintf(stream, ")++");
00687           else if (SS_COMP_OP == SS_COMP_POST_DBL_DEC)
00688             fprintf(stream, ")--");
00689           else if (SS_COMP_OP == SS_COMP_PRE_DBL_INC)
00690             fprintf(stream, ")^++");
00691           else if (SS_COMP_OP == SS_COMP_PRE_DBL_DEC)
00692             fprintf(stream, ")^--");
00693           else
00694             panic("bogus SS_COMP_OP");
00695           break;
00696 #endif
00697         default:
00698           /* anything unrecognized, e.g., '.' is just passed through */
00699           fputc(*s, stream);
00700         }
00701         s++;
00702       }
00703     }
00704 }

void md_print_ireg md_gpr_t    regs,
int    reg,
FILE *    stream
 

Definition at line 459 of file pisa.c.

00460 {
00461   fprintf(stream, "%4s: %12d/0x%08x",
00462           md_reg_name(rt_gpr, reg), regs[reg], regs[reg]);
00463 }

void md_print_iregs md_gpr_t    regs,
FILE *    stream
 

Definition at line 466 of file pisa.c.

00467 {
00468   int i;
00469 
00470   for (i=0; i < MD_NUM_IREGS; i += 2)
00471     {
00472       md_print_ireg(regs, i, stream);
00473       fprintf(stream, "  ");
00474       md_print_ireg(regs, i+1, stream);
00475       fprintf(stream, "\n");
00476     }
00477 }

char* md_reg_name enum md_reg_type    rt,
int    reg
 

Definition at line 316 of file pisa.c.

00317 {
00318   int i;
00319 
00320   for (i=0; md_reg_names[i].str != NULL; i++)
00321     {
00322       if (md_reg_names[i].file == rt && md_reg_names[i].reg == reg)
00323         return md_reg_names[i].str;
00324     }
00325 
00326   /* no found... */
00327   return NULL;
00328 }

char* md_reg_obj struct regs_t   regs,
int    is_write,
enum md_reg_type    rt,
int    reg,
struct eval_value_t   val
 

Definition at line 331 of file pisa.c.

00336 {
00337   switch (rt)
00338     {
00339     case rt_gpr:
00340       if (reg < 0 || reg >= MD_NUM_IREGS)
00341         return "register number out of range";
00342 
00343       if (!is_write)
00344         {
00345           val->type = et_uint;
00346           val->value.as_uint = regs->regs_R[reg];
00347         }
00348       else
00349         regs->regs_R[reg] = eval_as_uint(*val);
00350       break;
00351 
00352     case rt_lpr:
00353       if (reg < 0 || reg >= MD_NUM_FREGS)
00354         return "register number out of range";
00355 
00356       if (!is_write)
00357         {
00358           val->type = et_uint;
00359           val->value.as_uint = regs->regs_F.l[reg];
00360         }
00361       else
00362         regs->regs_F.l[reg] = eval_as_uint(*val);
00363       break;
00364 
00365     case rt_fpr:
00366       if (reg < 0 || reg >= MD_NUM_FREGS)
00367         return "register number out of range";
00368 
00369       if (!is_write)
00370         {
00371           val->type = et_float;
00372           val->value.as_float = regs->regs_F.f[reg];
00373         }
00374       else
00375         regs->regs_F.f[reg] = eval_as_float(*val);
00376       break;
00377 
00378     case rt_dpr:
00379       if (reg < 0 || reg >= MD_NUM_FREGS/2)
00380         return "register number out of range";
00381 
00382       if (!is_write)
00383         {
00384           val->type = et_double;
00385           val->value.as_double = regs->regs_F.d[reg];
00386         }
00387       else
00388         regs->regs_F.d[reg] = eval_as_double(*val);
00389       break;
00390 
00391     case rt_ctrl:
00392       switch (reg)
00393         {
00394         case /* HI */0:
00395           if (!is_write)
00396             {
00397               val->type = et_uint;
00398               val->value.as_uint = regs->regs_C.hi;
00399             }
00400           else
00401             regs->regs_C.hi = eval_as_uint(*val);
00402           break;
00403 
00404         case /* LO */1:
00405           if (!is_write)
00406             {
00407               val->type = et_uint;
00408               val->value.as_uint = regs->regs_C.lo;
00409             }
00410           else
00411             regs->regs_C.lo = eval_as_uint(*val);
00412           break;
00413 
00414         case /* FCC */2:
00415           if (!is_write)
00416             {
00417               val->type = et_int;
00418               val->value.as_int = regs->regs_C.fcc;
00419             }
00420           else
00421             regs->regs_C.fcc = eval_as_uint(*val);
00422           break;
00423 
00424         default:
00425           return "register number out of range";
00426         }
00427       break;
00428 
00429     case rt_PC:
00430       if (!is_write)
00431         {
00432           val->type = et_addr;
00433           val->value.as_addr = regs->regs_PC;
00434         }
00435       else
00436         regs->regs_PC = eval_as_addr(*val);
00437       break;
00438 
00439     case rt_NPC:
00440       if (!is_write)
00441         {
00442           val->type = et_addr;
00443           val->value.as_addr = regs->regs_NPC;
00444         }
00445       else
00446         regs->regs_NPC = eval_as_addr(*val);
00447       break;
00448 
00449     default:
00450       panic("bogus register bank");
00451     }
00452 
00453   /* no error */
00454   return NULL;
00455 }

word_t md_xor_regs struct regs_t   regs
 

Definition at line 566 of file pisa.c.

00567 {
00568   int i;
00569   word_t checksum = 0;
00570 
00571   for (i=0; i < MD_NUM_IREGS; i++)
00572     checksum ^= regs->regs_R[i];
00573 
00574   for (i=0; i < MD_NUM_FREGS; i++)
00575     checksum ^= regs->regs_F.l[i];
00576 
00577   checksum ^= regs->regs_C.hi;
00578   checksum ^= regs->regs_C.lo;
00579   checksum ^= regs->regs_C.fcc;
00580   checksum ^= regs->regs_PC;
00581   checksum ^= regs->regs_NPC;
00582 
00583   return checksum;
00584 }


Variable Documentation

char* md_amode_str[md_amode_NUM]
 

Definition at line 419 of file alpha.h.

char* md_fu2name[]
 

Definition at line 313 of file alpha.h.

enum md_opcode md_mask2op[]
 

Definition at line 267 of file alpha.h.

md_inst_t MD_NOP_INST
 

Definition at line 218 of file alpha.h.

unsigned int md_op2flags[]
 

Definition at line 337 of file alpha.h.

char* md_op2format[]
 

Definition at line 288 of file alpha.h.

enum md_fu_class md_op2fu[]
 

Definition at line 309 of file alpha.h.

char* md_op2name[]
 

Definition at line 284 of file alpha.h.

unsigned int md_opmask[]
 

Definition at line 269 of file alpha.h.

unsigned int md_opoffset[]
 

Definition at line 268 of file alpha.h.

unsigned int md_opshift[]
 

Definition at line 270 of file alpha.h.

struct md_reg_names_t md_reg_names[]
 

Definition at line 562 of file alpha.h.



UVa CS Department of Computer Science
School of Engineering, University of Virginia
151 Engineer's Way, P.O. Box 400740
Charlottesville, Virginia 22904-4740

(434) 982-2200  Fax: (434) 982-2214