⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tc-tic54x.c

📁 基于4个mips核的noc设计
💻 C
📖 第 1 页 / 共 5 页
字号:
  ILLEGAL_WITHIN_STRUCT ();  if (*input_line_pointer == '"')    msg = demand_copy_C_string (&len);  else    {      msg = input_line_pointer;      while (!is_end_of_line[(int) *input_line_pointer])	++input_line_pointer;      c = *input_line_pointer;      *input_line_pointer = 0;      msg = strcpy (xmalloc (strlen (msg) + 1), msg);      *input_line_pointer = c;    }  switch (type)    {    case 'm':      as_tsktsk ("%s", msg);      break;    case 'w':      as_warn ("%s", msg);      break;    case 'e':      as_bad ("%s", msg);      break;    }  demand_empty_rest_of_line ();}/* .label <symbol>   Define a special symbol that refers to the loadtime address rather than the   runtime address within the current section.   This symbol gets a special storage class so that when it is resolved, it is   resolved relative to the load address (lma) of the section rather than the   run address (vma).  */static voidtic54x_label (ignored)     int ignored ATTRIBUTE_UNUSED;{  char *name = input_line_pointer;  symbolS *symbolP;  int c;  ILLEGAL_WITHIN_STRUCT ();  c = get_symbol_end ();  symbolP = colon (name);  S_SET_STORAGE_CLASS (symbolP, C_STATLAB);  *input_line_pointer = c;  demand_empty_rest_of_line ();}/* .mmregs   Install all memory-mapped register names into the symbol table as   absolute local symbols.  */static voidtic54x_mmregs (ignored)     int ignored ATTRIBUTE_UNUSED;{  symbol *sym;  ILLEGAL_WITHIN_STRUCT ();  for (sym = (symbol *) mmregs; sym->name; sym++)    {      symbolS *symbolP = symbol_new (sym->name, absolute_section,				     (valueT) sym->value, &zero_address_frag);      SF_SET_LOCAL (symbolP);      symbol_table_insert (symbolP);    }}/* .loop [count]   Count defaults to 1024.  */static voidtic54x_loop (int count){  ILLEGAL_WITHIN_STRUCT ();  SKIP_WHITESPACE ();  if (!is_end_of_line[(int) *input_line_pointer])    count = get_absolute_expression ();  do_repeat (count, "LOOP", "ENDLOOP");}/* Normally, endloop gets eaten by the preceding loop.  */static voidtic54x_endloop (ignore)     int ignore ATTRIBUTE_UNUSED;{  as_bad (_("ENDLOOP without corresponding LOOP"));  ignore_rest_of_line ();}/* .break [condition].  */static voidtic54x_break (ignore)     int ignore ATTRIBUTE_UNUSED;{  int cond = 1;  ILLEGAL_WITHIN_STRUCT ();  SKIP_WHITESPACE ();  if (!is_end_of_line[(int) *input_line_pointer])    cond = get_absolute_expression ();  if (cond)    end_repeat (substitution_line ? 1 : 0);}static voidset_address_mode (mode)     int mode;{  amode = mode;  if (mode == far_mode)    {      symbolS *symbolP = symbol_new ("__allow_far", absolute_section,				     (valueT) 1, &zero_address_frag);      SF_SET_LOCAL (symbolP);      symbol_table_insert (symbolP);    }}static int address_mode_needs_set = 1;static voidtic54x_address_mode (mode)     int mode;{  if (assembly_begun && amode != (unsigned) mode)    {      as_bad (_("Mixing of normal and extended addressing not supported"));      ignore_rest_of_line ();      return;    }  if (mode == far_mode && cpu != VNONE && cpu != V548 && cpu != V549)    {      as_bad (_("Extended addressing not supported on the specified CPU"));      ignore_rest_of_line ();      return;    }  set_address_mode (mode);  demand_empty_rest_of_line ();}/* .sblock "section"|section [,...,"section"|section]   Designate initialized sections for blocking.  */static voidtic54x_sblock (ignore)     int ignore ATTRIBUTE_UNUSED;{  int c = ',';  ILLEGAL_WITHIN_STRUCT ();  while (c == ',')    {      segT seg;      char *name;      if (*input_line_pointer == '"')	{	  int len;	  name = demand_copy_C_string (&len);	}      else	{	  char *section_name = input_line_pointer;	  c = get_symbol_end ();	  name = xmalloc (strlen (section_name) + 1);	  strcpy (name, section_name);	  *input_line_pointer = c;	}      seg = bfd_get_section_by_name (stdoutput, name);      if (seg == NULL)	{	  as_bad (_("Unrecognized section '%s'"), name);	  ignore_rest_of_line ();	  return;	}      else if (!tic54x_initialized_section (seg))	{	  as_bad (_(".sblock may be used for initialized sections only"));	  ignore_rest_of_line ();	  return;	}      seg->flags |= SEC_BLOCK;      c = *input_line_pointer;      if (!is_end_of_line[(int) c])	++input_line_pointer;    }  demand_empty_rest_of_line ();}/* symbol .set value   symbol .equ value   value must be defined externals; no forward-referencing allowed   symbols assigned with .set/.equ may not be redefined.  */static voidtic54x_set (ignore)     int ignore ATTRIBUTE_UNUSED;{  symbolS *symbolP;  char *name;  ILLEGAL_WITHIN_STRUCT ();  if (!line_label)    {      as_bad (_("Symbol missing for .set/.equ"));      ignore_rest_of_line ();      return;    }  name = xstrdup (S_GET_NAME (line_label));  line_label = NULL;  if ((symbolP = symbol_find (name)) == NULL      && (symbolP = md_undefined_symbol (name)) == NULL)    {      symbolP = symbol_new (name, absolute_section, 0, &zero_address_frag);      S_SET_STORAGE_CLASS (symbolP, C_STAT);    }  free (name);  S_SET_DATA_TYPE (symbolP, T_INT);  S_SET_SEGMENT (symbolP, absolute_section);  symbol_table_insert (symbolP);  pseudo_set (symbolP);  demand_empty_rest_of_line ();}/* .fclist   .fcnolist   List false conditional blocks.  */static voidtic54x_fclist (int show){  if (show)    listing &= ~LISTING_NOCOND;  else    listing |= LISTING_NOCOND;  demand_empty_rest_of_line ();}static voidtic54x_sslist (int show){  ILLEGAL_WITHIN_STRUCT ();  listing_sslist = show;}/* .var SYM[,...,SYMN]   Define a substitution string to be local to a macro.  */static voidtic54x_var (ignore)     int ignore ATTRIBUTE_UNUSED;{  static char empty[] = "";  char *name;  int c;  ILLEGAL_WITHIN_STRUCT ();  if (macro_level == 0)    {      as_bad (_(".var may only be used within a macro definition"));      ignore_rest_of_line ();      return;    }  do    {      if (!isalpha (*input_line_pointer))	{	  as_bad (_("Substitution symbols must begin with a letter"));	  ignore_rest_of_line ();	  return;	}      name = input_line_pointer;      c = get_symbol_end ();      /* .var symbols start out with a null string.  */      name = strcpy (xmalloc (strlen (name) + 1), name);      hash_insert (subsym_hash[macro_level], name, empty);      *input_line_pointer = c;      if (c == ',')	{	  ++input_line_pointer;	  if (is_end_of_line[(int) *input_line_pointer])	    c = *input_line_pointer;	}    }  while (c == ',');  demand_empty_rest_of_line ();}/* .mlib <macro library filename>   Macro libraries are archived (standard AR-format) text macro definitions   Expand the file and include it.   FIXME need to try the source file directory as well.  */static voidtic54x_mlib (ignore)     int ignore ATTRIBUTE_UNUSED;{  char *filename;  char *path;  int len, i;  bfd *abfd, *mbfd;  ILLEGAL_WITHIN_STRUCT ();  /* Parse the filename.  */  if (*input_line_pointer == '"')    {      if ((filename = demand_copy_C_string (&len)) == NULL)	return;    }  else    {      SKIP_WHITESPACE ();      len = 0;      while (!is_end_of_line[(int) *input_line_pointer]	     && !isspace (*input_line_pointer))	{	  obstack_1grow (&notes, *input_line_pointer);	  ++input_line_pointer;	  ++len;	}      obstack_1grow (&notes, '\0');      filename = obstack_finish (&notes);    }  demand_empty_rest_of_line ();  tic54x_set_default_include (0);  path = xmalloc ((unsigned long) len + include_dir_maxlen + 5);  for (i = 0; i < include_dir_count; i++)    {      FILE *try;      strcpy (path, include_dirs[i]);      strcat (path, "/");      strcat (path, filename);      if ((try = fopen (path, "r")) != NULL)	{	  fclose (try);	  break;	}    }  if (i >= include_dir_count)    {      free (path);      path = filename;    }  /* FIXME: if path is found, malloc'd storage is not freed.  Of course, this     happens all over the place, and since the assembler doesn't usually keep     running for a very long time, it really doesn't matter.  */  register_dependency (path);  /* Expand all archive entries to temporary files and include them.  */  abfd = bfd_openr (path, NULL);  if (!abfd)    {      as_bad (_("Can't open macro library file '%s' for reading."), path);      as_perror ("%s", path);      ignore_rest_of_line ();      return;    }  if (!bfd_check_format (abfd, bfd_archive))    {      as_bad (_("File '%s' not in macro archive format"), path);      ignore_rest_of_line ();      return;    }  /* Open each BFD as binary (it should be straight ASCII text).  */  for (mbfd = bfd_openr_next_archived_file (abfd, NULL);       mbfd != NULL; mbfd = bfd_openr_next_archived_file (abfd, mbfd))    {      /* Get a size at least as big as the archive member.  */      bfd_size_type size = bfd_get_size (mbfd);      char *buf = xmalloc (size);      char *fname = tmpnam (NULL);      FILE *ftmp;      /* We're not sure how big it is, but it will be smaller than "size".  */      bfd_read (buf, size, 1, mbfd);      /* Write to a temporary file, then use s_include to include it	 a bit of a hack.  */      ftmp = fopen (fname, "w+b");      fwrite ((void *) buf, size, 1, ftmp);      if (buf[size - 1] != '\n')	fwrite ("\n", 1, 1, ftmp);      fclose (ftmp);      free (buf);      input_scrub_insert_file (fname);      unlink (fname);    }}const pseudo_typeS md_pseudo_table[] ={  { "algebraic", s_ignore                 ,          0 },  { "align"    , tic54x_align_words       ,        128 },  { "even"     , tic54x_align_words       ,          2 },  { "asg"      , tic54x_asg               ,          0 },  { "eval"     , tic54x_eval              ,          0 },  { "bss"      , tic54x_bss               ,          0 },  { "byte"     , tic54x_cons              ,        'b' },  { "ubyte"    , tic54x_cons              ,        'B' },  { "char"     , tic54x_cons              ,        'c' },  { "uchar"    , tic54x_cons              ,        'C' },  { "clink"    , tic54x_clink             ,          0 },  { "c_mode"   , tic54x_address_mode      ,     c_mode },  { "copy"     , tic54x_include           ,        'c' },  { "include"  , tic54x_include           ,        'i' },  { "data"     , tic54x_sect              ,        'd' },  { "double"   , tic54x_float_cons        ,        'd' },  { "ldouble"  , tic54x_float_cons        ,        'l' },  { "drlist"   , s_ignore                 ,          0 },  { "drnolist" , s_ignore                 ,          0 },  { "emsg"     , tic54x_message           ,        'e' },  { "mmsg"     , tic54x_message           ,        'm' },  { "wmsg"     , tic54x_message           ,        'w' },#if 0  { "end"      , s_end                    ,          0 },#endif  { "far_mode" , tic54x_address_mode      ,   far_mode },  { "fclist"   , tic54x_fclist            ,          1 },  { "fcnolist" , tic54x_fclist            ,          0 },  { "field"    , tic54x_field             ,         -1 },  { "float"    , tic54x_float_cons        ,        'f' },  { "xfloat"   , tic54x_float_cons        ,        'x' },  { "global"   , tic54x_global            ,        'g' },  { "def"      , tic54x_global            ,        'd' },  { "ref"      , tic54x_global            ,        'r' },  { "half"     , tic54x_cons              ,        'h' },  { "uhalf"    , tic54x_cons              ,        'H' },  { "short"    , tic54x_cons              ,        's' },  { "ushort"   , tic54x_cons              ,        'S' },  { "if"       , s_if                     , (int) O_ne },  { "elseif"   , s_elseif                 , (int) O_ne },  { "else"     , s_else                   ,          0 },  { "endif"    , s_endif                  ,          0 },  { "int"      , tic54x_cons              ,        'i' },  { "uint"     , tic54x_cons              ,        'I' },  { "word"     , tic54x_cons              ,        'w' },  { "uword"    , tic54x_cons              ,        'W' },  { "label"    , tic54x_label             ,          0 }, /* Loadtime                                                             address.  */  { "length"   , s_ignore                 ,          0 },  { "width"    , s_ignore                 ,          0 },#if 0  { "list"     , listing_list             ,          1 },  { "nolist"   , listing_list             ,          0 },#endif  { "long"     , tic54x_cons              ,        'l' },  { "ulong"    , tic54x_cons              ,        'L' },  { "xlong"    , tic54x_cons              ,        'x' },  { "loop"     , tic54x_loop              ,       1024 },  { "break"    , tic54x_break             ,          0 },  { "endloop"  , tic54x_endloop           ,          0 },  { "mlib"     , tic54x_mlib              ,          0 },  { "mlist"    , s_ignore                 ,          0 },  { "mnolist"  , s_ignore                 ,          0 },  { "mmregs"   , tic54x_mmregs            ,          0 },  { "newblock" , tic54x_clear_local_labels,          0 },  { "option"   , s_ignore                 ,          0 },  { "p2align"  , tic54x_p2align           ,          0 },#if 0  { "page"     , listing_eject            ,          0 },#endif  { "sblock"   , tic54x_sblock            ,          0 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -