Back to index

cell-binutils  2.17cvs20070401
Classes | Defines | Enumerations | Functions
arc-ext.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ExtInstruction
struct  ExtAuxRegister
struct  arcExtMap

Defines

#define IGNORE_FIRST_OPD   1

Enumerations

enum  { EXT_INSTRUCTION = 0, EXT_CORE_REGISTER = 1, EXT_AUX_REGISTER = 2, EXT_COND_CODE = 3 }
enum  { NUM_EXT_INST = (0x1f-0x10+1) + (0x3f-0x09+1) }
enum  { NUM_EXT_CORE = 59-32+1 }
enum  { NUM_EXT_COND = 0x1f-0x10+1 }

Functions

int arcExtMap_add (void *, unsigned long)
const char * arcExtMap_coreRegName (int)
const char * arcExtMap_auxRegName (long)
const char * arcExtMap_condCodeName (int)
const char * arcExtMap_instName (int, int, int *)
void build_ARC_extmap (bfd *)

Class Documentation

struct ExtInstruction

Definition at line 32 of file arc-ext.h.

Class Members
char flags
char * name
struct ExtAuxRegister

Definition at line 38 of file arc-ext.h.

Collaboration diagram for ExtAuxRegister:
Class Members
long address
char * name
struct ExtAuxRegister * next
struct arcExtMap

Definition at line 45 of file arc-ext.h.

Collaboration diagram for arcExtMap:
Class Members
struct ExtAuxRegister * auxRegisters
char * condCodes
char * coreRegisters
struct ExtInstruction * instructions

Define Documentation

#define IGNORE_FIRST_OPD   1

Definition at line 60 of file arc-ext.h.


Enumeration Type Documentation

anonymous enum
Enumerator:
EXT_INSTRUCTION 
EXT_CORE_REGISTER 
EXT_AUX_REGISTER 
EXT_COND_CODE 

Definition at line 23 of file arc-ext.h.

anonymous enum
Enumerator:
NUM_EXT_INST 

Definition at line 28 of file arc-ext.h.

{NUM_EXT_INST = (0x1f-0x10+1) + (0x3f-0x09+1)};
anonymous enum
Enumerator:
NUM_EXT_CORE 

Definition at line 29 of file arc-ext.h.

{NUM_EXT_CORE = 59-32+1};
anonymous enum
Enumerator:
NUM_EXT_COND 

Definition at line 30 of file arc-ext.h.

{NUM_EXT_COND = 0x1f-0x10+1};

Function Documentation

int arcExtMap_add ( void *  ,
unsigned  long 
)

Definition at line 148 of file arc-ext.c.

{
  unsigned char *block = base;
  unsigned char *p = block;

  /* Clean up and reset everything if needed.  */
  cleanup_ext_map();

  while (p && p < (block + length))
    {
      /* p[0] == length of record
        p[1] == type of record
        For instructions:
          p[2]  = opcode
          p[3]  = minor opcode (if opcode == 3)
          p[4]  = flags
          p[5]+ = name
        For core regs and condition codes:
          p[2]  = value
          p[3]+ = name
        For aux regs:
          p[2..5] = value
          p[6]+   = name
        (value is p[2]<<24|p[3]<<16|p[4]<<8|p[5])  */

      if (p[0] == 0)
       return -1;

      switch (p[1])
       {
       case EXT_INSTRUCTION:
         {
           char opcode = p[2];
           char minor  = p[3];
           char * insn_name = (char *) xmalloc(( (int)*p-5) * sizeof(char));
           struct ExtInstruction * insn =
             (struct ExtInstruction *) xmalloc(sizeof(struct ExtInstruction));

           if (opcode==3)
             opcode = 0x1f - 0x10 + minor - 0x09 + 1;
           else
             opcode -= 0x10;
           insn -> flags = (char) *(p+4);
           strcpy (insn_name, (char *) (p+5));
           insn -> name = insn_name;
           arc_extension_map.instructions[(int) opcode] = insn;
         }
         break;

       case EXT_CORE_REGISTER:
         {
           char * core_name = (char *) xmalloc(((int)*p-3) * sizeof(char));

           strcpy(core_name, (char *) (p+3));
           arc_extension_map.coreRegisters[p[2]-32] = core_name;
         }
         break;

       case EXT_COND_CODE:
         {
           char * cc_name = (char *) xmalloc( ((int)*p-3) * sizeof(char));
           strcpy(cc_name, (char *) (p+3));
           arc_extension_map.condCodes[p[2]-16] = cc_name;
         }
         break;

       case EXT_AUX_REGISTER:
         {
           /* trickier -- need to store linked list to these  */
           struct ExtAuxRegister *newAuxRegister =
             (struct ExtAuxRegister *)malloc(sizeof(struct ExtAuxRegister));
           char * aux_name = (char *) xmalloc ( ((int)*p-6) * sizeof(char));

           strcpy (aux_name, (char *) (p+6));
           newAuxRegister->name = aux_name;
           newAuxRegister->address = p[2]<<24 | p[3]<<16 | p[4]<<8  | p[5];
           newAuxRegister->next = arc_extension_map.auxRegisters;
           arc_extension_map.auxRegisters = newAuxRegister;
         }
         break;

       default:
         return -1;

       }
      p += p[0]; /* move to next record  */
    }

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 78 of file arc-ext.c.

{
  /* walk the list of aux reg names and find the name  */
  struct ExtAuxRegister *r;

  for (r = arc_extension_map.auxRegisters; r; r = r->next) {
    if (r->address == address)
      return (const char *) r->name;
  }
  return 0;
}

Here is the caller graph for this function:

Definition at line 68 of file arc-ext.c.

{
  if (value < 16)
    return 0;
  return arc_extension_map.condCodes[value-16];
}

Here is the caller graph for this function:

Definition at line 58 of file arc-ext.c.

{
  if (value < 32)
    return 0;
  return arc_extension_map.coreRegisters[value-32];
}

Here is the caller graph for this function:

const char* arcExtMap_instName ( int  ,
int  ,
int  
)

Definition at line 34 of file arc-ext.c.

{
    if (opcode == 3)
      {
       /* FIXME: ??? need to also check 0/1/2 in bit0 for (3f) brk/sleep/swi  */
       if (minor < 0x09 || minor == 0x3f)
         return 0;
       else
         opcode = 0x1f - 0x10 + minor - 0x09 + 1;
      }
    else
      if (opcode < 0x10)
       return 0;
    else
      opcode -= 0x10;
    if (!arc_extension_map.instructions[opcode])
      return 0;
    *flags = arc_extension_map.instructions[opcode]->flags;
    return arc_extension_map.instructions[opcode]->name;
}

Here is the caller graph for this function:

void build_ARC_extmap ( bfd )

Definition at line 242 of file arc-ext.c.

{
  char *arcExtMap;
  bfd_size_type count;
  asection *p;

  for (p = text_bfd->sections; p != NULL; p = p->next)
    if (!strcmp (p->name, ".arcextmap"))
      {
        count = bfd_get_section_size (p);
        arcExtMap = (char *) xmalloc (count);
        if (bfd_get_section_contents (text_bfd, p, (PTR) arcExtMap, 0, count))
          {
            arcExtMap_add ((PTR) arcExtMap, count);
            break;
          }
        free ((PTR) arcExtMap);
      }
}

Here is the call graph for this function:

Here is the caller graph for this function: