scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

myro.h (1574B)


      1 
      2 #define MYROHDR_SIZ    48
      3 #define MYROSECT_SIZ   24
      4 #define MYROSYM_SIZ    26
      5 #define MYROREL_SIZ    20
      6 
      7 #define MYROMAGIC_SIZ   4
      8 #define MYROMAGIC      "uobj"
      9 
     10 struct myrohdr {
     11 	char magic[4];
     12 	unsigned long format;
     13 	unsigned long long entry;
     14 	unsigned long long strsize;
     15 	unsigned long long secsize;
     16 	unsigned long long symsize;
     17 	unsigned long long relsize;
     18 };
     19 
     20 struct myrosect {
     21 	unsigned long name;
     22 	unsigned short flags;
     23 	unsigned char fill;
     24 	unsigned char aligment;
     25 	unsigned long long offset;
     26 	unsigned long long len;
     27 };
     28 
     29 struct myrosym {
     30 	unsigned long name;
     31 	unsigned long type;
     32 	unsigned char section;
     33 	unsigned char flags;
     34 	unsigned long long offset;
     35 	unsigned long long len;
     36 };
     37 
     38 struct myrorel {
     39 	unsigned long id;
     40 	unsigned char flags;
     41 	unsigned char size;
     42 	unsigned char nbits;
     43 	unsigned char shift;
     44 	unsigned long long offset;
     45 };
     46 
     47 enum myrosecflg {
     48 	MYROSEC_READ  = 1 << 0,
     49 	MYROSEC_WRITE = 1 << 1,
     50 	MYROSEC_EXEC  = 1 << 2,
     51 	MYROSEC_LOAD  = 1 << 3,
     52 	MYROSEC_FILE  = 1 << 4,
     53 	MYROSEC_ABS   = 1 << 5,
     54 };
     55 
     56 enum myrosymflg {
     57 	MYROSYM_DEDUP  = 1 << 0,
     58 	MYROSYM_COMMON = 1 << 1,
     59 	MYROSYM_EXTERN = 1 << 2,
     60 	MYROSYM_UNDEF  = 1 << 3,
     61 };
     62 
     63 extern int wrmyrohdr(FILE *fp, struct myrohdr *hdr);
     64 extern int wrmyrosec(FILE *fp, struct myrosect *sect);
     65 extern int wrmyrosym(FILE *fp, struct myrosym *sym);
     66 extern int wrmyrorel(FILE *fp, struct myrorel *rel);
     67 extern int rdmyrohdr(FILE *fp, struct myrohdr *hdr);
     68 extern int rdmyrosec(FILE *fp, struct myrosect *sect);
     69 extern int rdmyrosym(FILE *fp, struct myrosym *sym);
     70 extern int rdmyrorel(FILE *fp, struct myrorel *rel);