📄 a.out.h
字号:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/a.out.h
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
01400 /* The <a.out> header file describes the format of executable files. */
01401
01402 #ifndef _AOUT_H
01403 #define _AOUT_H
01404
01405 struct exec { /* a.out header */
01406 unsigned char a_magic[2]; /* magic number */
01407 unsigned char a_flags; /* flags, see below */
01408 unsigned char a_cpu; /* cpu id */
01409 unsigned char a_hdrlen; /* length of header */
01410 unsigned char a_unused; /* reserved for future use */
01411 unsigned short a_version; /* version stamp (not used at present) */
01412 long a_text; /* size of text segement in bytes */
01413 long a_data; /* size of data segment in bytes */
01414 long a_bss; /* size of bss segment in bytes */
01415 long a_entry; /* entry point */
01416 long a_total; /* total memory allocated */
01417 long a_syms; /* size of symbol table */
01418
01419 /* SHORT FORM ENDS HERE */
01420 long a_trsize; /* text relocation size */
01421 long a_drsize; /* data relocation size */
01422 long a_tbase; /* text relocation base */
01423 long a_dbase; /* data relocation base */
01424 };
01425
01426 #define A_MAGIC0 (unsigned char) 0x01
01427 #define A_MAGIC1 (unsigned char) 0x03
01428 #define BADMAG(X) ((X).a_magic[0] != A_MAGIC0 ||(X).a_magic[1] != A_MAGIC1)
01429
01430 /* CPU Id of TARGET machine (byte order coded in low order two bits) */
01431 #define A_NONE 0x00 /* unknown */
01432 #define A_I8086 0x04 /* intel i8086/8088 */
01433 #define A_M68K 0x0B /* motorola m68000 */
01434 #define A_NS16K 0x0C /* national semiconductor 16032 */
01435 #define A_I80386 0x10 /* intel i80386 */
01436 #define A_SPARC 0x17 /* Sun SPARC */
01437
01438 #define A_BLR(cputype) ((cputype&0x01)!=0) /* TRUE if bytes left-to-right */
01439 #define A_WLR(cputype) ((cputype&0x02)!=0) /* TRUE if words left-to-right */
01440
01441 /* Flags. */
01442 #define A_UZP 0x01 /* unmapped zero page (pages) */
01443 #define A_PAL 0x02 /* page aligned executable */
01444 #define A_NSYM 0x04 /* new style symbol table */
01445 #define A_EXEC 0x10 /* executable */
01446 #define A_SEP 0x20 /* separate I/D */
01447 #define A_PURE 0x40 /* pure text */ /* not used */
01448 #define A_TOVLY 0x80 /* text overlay */ /* not used */
01449
01450 /* Offsets of various things. */
01451 #define A_MINHDR 32
01452 #define A_TEXTPOS(X) ((long)(X).a_hdrlen)
01453 #define A_DATAPOS(X) (A_TEXTPOS(X) + (X).a_text)
01454 #define A_HASRELS(X) ((X).a_hdrlen > (unsigned char) A_MINHDR)
01455 #define A_HASEXT(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 8))
01456 #define A_HASLNS(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 16))
01457 #define A_HASTOFF(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 24))
01458 #define A_TRELPOS(X) (A_DATAPOS(X) + (X).a_data)
01459 #define A_DRELPOS(X) (A_TRELPOS(X) + (X).a_trsize)
01460 #define A_SYMPOS(X) (A_TRELPOS(X) + (A_HASRELS(X) ? \
01461 ((X).a_trsize + (X).a_drsize) : 0))
01462
01463 struct reloc {
01464 long r_vaddr; /* virtual address of reference */
01465 unsigned short r_symndx; /* internal segnum or extern symbol num */
01466 unsigned short r_type; /* relocation type */
01467 };
01468
01469 /* r_tyep values: */
01470 #define R_ABBS 0
01471 #define R_RELLBYTE 2
01472 #define R_PCRBYTE 3
01473 #define R_RELWORD 4
01474 #define R_PCRWORD 5
01475 #define R_RELLONG 6
01476 #define R_PCRLONG 7
01477 #define R_REL3BYTE 8
01478 #define R_KBRANCHE 9
01479
01480 /* r_symndx for internal segments */
01481 #define S_ABS ((unsigned short)-1)
01482 #define S_TEXT ((unsigned short)-2)
01483 #define S_DATA ((unsigned short)-3)
01484 #define S_BSS ((unsigned short)-4)
01485
01486 struct nlist { /* symbol table entry */
01487 char n_name[8]; /* symbol name */
01488 long n_value; /* value */
01489 unsigned char n_sclass; /* storage class */
01490 unsigned char n_numaux; /* number of auxiliary entries (not used) */
01491 unsigned short n_type; /* language base and derived type (not used) */
01492 };
01493
01494 /* Low bits of storage class (section). */
01495 #define N_SECT 07 /* section mask */
01496 #define N_UNDF 00 /* undefined */
01497 #define N_ABS 01 /* absolute */
01498 #define N_TEXT 02 /* text */
01499 #define N_DATA 03 /* data */
01500 #define N_BSS 04 /* bss */
01501 #define N_COMM 05 /* (common) */
01502
01503 /* High bits of storage class. */
01504 #define N_CLASS 0370 /* storage class mask */
01505 #define C_NULL
01506 #define C_EXT 0020 /* external symbol */
01507 #define C_STAT 0030 /* static */
01508
01509 /* Function prototypes. */
01510 #ifndef _ANSI_H
01511 #include <ansi.h>
01512 #endif
01513
01514 _PROTOTYPE( int nlist, (char *_file, struct nlist *_nl) );
01515
01516 #endif /* _AOUT_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -