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

📄 ti.h

📁 这个是LINUX下的GDB调度工具的源码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* TI COFF stores section size as number of bytes (address units, not octets),   so adjust to be number of octets, which is what BFD expects */ #define GET_SCNHDR_SIZE(ABFD, SZP) \  (H_GET_32 (ABFD, SZP) * bfd_octets_per_byte (ABFD))#define PUT_SCNHDR_SIZE(ABFD, SZ, SZP) \  H_PUT_32 (ABFD, (SZ) / bfd_octets_per_byte (ABFD), SZP)#define COFF_ADJUST_SCNHDR_IN_POST(ABFD, EXT, INT) \  do									\    {									\      ((struct internal_scnhdr *)(INT))->s_page =			\	GET_SCNHDR_PAGE (ABFD, ((SCNHDR *)(EXT))->s_page);		\    }									\   while (0)/* The line number and reloc overflow checking in coff_swap_scnhdr_out in   coffswap.h doesn't use PUT_X for s_nlnno and s_nreloc.   Due to different sized v0/v1/v2 section headers, we have to re-write these   fields. */#define COFF_ADJUST_SCNHDR_OUT_POST(ABFD, INT, EXT) \  do									   \    {									   \      PUT_SCNHDR_NLNNO (ABFD, ((struct internal_scnhdr *)(INT))->s_nlnno,  \			((SCNHDR *)(EXT))->s_nlnno);			   \      PUT_SCNHDR_NRELOC (ABFD, ((struct internal_scnhdr *)(INT))->s_nreloc,\			 ((SCNHDR *)(EXT))->s_nreloc);			   \      PUT_SCNHDR_FLAGS (ABFD, ((struct internal_scnhdr *)(INT))->s_flags,  \			((SCNHDR *)(EXT))->s_flags);			   \      PUT_SCNHDR_PAGE (ABFD, ((struct internal_scnhdr *)(INT))->s_page,    \		       ((SCNHDR *)(EXT))->s_page);			   \    }									   \   while (0)/* * names of "special" sections */#define _TEXT	".text"#define _DATA	".data"#define _BSS	".bss"#define _CINIT  ".cinit"            /* initialized C data */#define _SCONST  ".const"           /* constants */#define _SWITCH ".switch"           /* switch tables */#define _STACK  ".stack"            /* C stack */#define _SYSMEM ".sysmem"           /* used for malloc et al. syscalls *//********************** LINE NUMBERS **********************//* 1 line number entry for every "breakpointable" source line in a section. * Line numbers are grouped on a per function basis; first entry in a function * grouping will have l_lnno = 0 and in place of physical address will be the * symbol table index of the function name. */struct external_lineno {  union {    char l_symndx[4];	/* function name symbol index, iff l_lnno == 0*/    char l_paddr[4];	/* (physical) address of line number	*/  } l_addr;  char l_lnno[2];	/* line number		*/};#define	LINENO	struct external_lineno#define	LINESZ	6/********************** SYMBOLS **********************//* NOTE: this is what a local label looks like in assembly source; what it   looks like in COFF output is undefined */#define TICOFF_LOCAL_LABEL_P(NAME) \((NAME[0] == '$' && NAME[1] >= '0' && NAME[1] <= '9' && NAME[2] == '\0') \ || NAME[strlen(NAME)-1] == '?')#define E_SYMNMLEN	8	/* # characters in a symbol name	*/#define E_FILNMLEN	14	/* # characters in a file name		*/#define E_DIMNUM	4	/* # array dimensions in auxiliary entry */struct external_syment {  union {    char e_name[E_SYMNMLEN];    struct {      char e_zeroes[4];      char e_offset[4];    } e;  } e;  char e_value[4];  char e_scnum[2];  char e_type[2];  char e_sclass[1];  char e_numaux[1];};#define N_BTMASK	(017)#define N_TMASK		(060)#define N_BTSHFT	(4)#define N_TSHIFT	(2)  union external_auxent {  struct {	char x_tagndx[4];	/* str, un, or enum tag indx */	union {	  struct {		char  x_lnno[2]; /* declaration line number */		char  x_size[2]; /* str/union/array size */	  } x_lnsz;	  char x_fsize[4];	/* size of function */	} x_misc;	union {	  struct {		/* if ISFCN, tag, or .bb */		char x_lnnoptr[4];	/* ptr to fcn line # */		char x_endndx[4];	/* entry ndx past block end */	  } x_fcn;	  struct {		/* if ISARY, up to 4 dimen. */		char x_dimen[E_DIMNUM][2];	  } x_ary;	} x_fcnary;	char x_tvndx[2];		/* tv index */  } x_sym;    union {	char x_fname[E_FILNMLEN];	struct {	  char x_zeroes[4];	  char x_offset[4];	} x_n;  } x_file;    struct {	char x_scnlen[4];			/* section length */	char x_nreloc[2];	/* # relocation entries */	char x_nlinno[2];	/* # line numbers */  } x_scn;    struct {	char x_tvfill[4];	/* tv fill value */	char x_tvlen[2];	/* length of .tv */	char x_tvran[2][2];	/* tv range */  } x_tv;		/* info about .tv section (in auxent of symbol .tv)) */  };#define	SYMENT	struct external_syment#define	SYMESZ	18	#define	AUXENT	union external_auxent#define	AUXESZ	18/* section lengths are in target bytes (not host bytes) */#define GET_SCN_SCNLEN(ABFD, EXT) \  (H_GET_32 (ABFD, (EXT)->x_scn.x_scnlen) * bfd_octets_per_byte (ABFD))#define PUT_SCN_SCNLEN(ABFD, INT, EXT) \  H_PUT_32 (ABFD, (INT) / bfd_octets_per_byte (ABFD), (EXT)->x_scn.x_scnlen)/* lnsz size is in bits in COFF file, in bytes in BFD */#define GET_LNSZ_SIZE(abfd, ext) \ (H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size) / (class != C_FIELD ? 8 : 1))#define PUT_LNSZ_SIZE(abfd, in, ext) \  H_PUT_16 (abfd, ((class != C_FIELD) ? (in) * 8 : (in)), \	   ext->x_sym.x_misc.x_lnsz.x_size) /* TI COFF stores offsets for MOS and MOU in bits; BFD expects bytes    Also put the load page flag of the section into the symbol value if it's an   address.  */#ifndef NEEDS_PAGE#define NEEDS_PAGE(X) 0#define PAGE_MASK 0#endif#define COFF_ADJUST_SYM_IN_POST(ABFD, EXT, INT) \  do									\    {									\      struct internal_syment *dst = (struct internal_syment *)(INT);	\      if (dst->n_sclass == C_MOS || dst->n_sclass == C_MOU)		\	dst->n_value /= 8;						\      else if (NEEDS_PAGE (dst->n_sclass)) {                            \        asection *scn = coff_section_from_bfd_index (abfd, dst->n_scnum); \        dst->n_value |= (scn->lma & PAGE_MASK);                         \      }									\    }									\   while (0)#define COFF_ADJUST_SYM_OUT_POST(ABFD, INT, EXT) \  do									\    {									\       struct internal_syment *src = (struct internal_syment *)(INT);	\       SYMENT *dst = (SYMENT *)(EXT);					\       if (src->n_sclass == C_MOU || src->n_sclass == C_MOS)		\	 H_PUT_32 (abfd, src->n_value * 8, dst->e_value);		\       else if (NEEDS_PAGE (src->n_sclass)) {                           \         H_PUT_32 (abfd, src->n_value &= ~PAGE_MASK, dst->e_value);     \       }								\    }									\   while (0)/* Detect section-relative absolute symbols so they get flagged with a sym   index of -1.*/#define SECTION_RELATIVE_ABSOLUTE_SYMBOL_P(RELOC, SECT) \  ((*(RELOC)->sym_ptr_ptr)->section->output_section == (SECT) \   && (RELOC)->howto->name[0] == 'A')/********************** RELOCATION DIRECTIVES **********************/struct external_reloc_v0{  char r_vaddr[4];  char r_symndx[2];  char r_reserved[2];  char r_type[2];};struct external_reloc{  char r_vaddr[4];  char r_symndx[4];  char r_reserved[2]; /* extended pmad byte for COFF2 */  char r_type[2];};#define RELOC struct external_reloc#define RELSZ_V0 10                 /* FIXME -- coffcode.h needs fixing */#define RELSZ 12                    /* for COFF1/2 *//* various relocation types.  */#define R_ABS     0x0000            /* no relocation */#define R_REL13   0x002A            /* 13-bit direct reference (???) */#define R_PARTLS7 0x0028            /* 7 LSBs of an address */#define R_PARTMS9 0x0029            /* 9MSBs of an address */#define R_EXTWORD 0x002B            /* 23-bit direct reference */#define R_EXTWORD16 0x002C          /* 16-bit direct reference to 23-bit addr*/#define R_EXTWORDMS7 0x002D         /* upper 7 bits of 23-bit address */#endif /* COFF_TI_H */

⌨️ 快捷键说明

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