scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

i286.c (704B)


      1 #include <scc/scc.h>
      2 
      3 #include "../../as.h"
      4 #include "../x86/proc.h"
      5 
      6 TUINT maxaddr = 0xFFFF;
      7 int endian = LITTLE_ENDIAN;
      8 int left2right = 0;
      9 
     10 void
     11 iarch(void)
     12 {
     13 	static struct {
     14 		char *name;
     15 		char type;
     16 	} regs[] = {
     17 		"CS", AREG_CS,
     18 		"DS", AREG_DS,
     19 		"SS", AREG_SS,
     20 		"ES", AREG_ES,
     21 
     22 		"AX", AREG_AX,
     23 		"AL", AREG_AL,
     24 		"AH", AREG_AH,
     25 
     26 		"BX", AREG_BX,
     27 		"BL", AREG_BL,
     28 		"BH", AREG_BH,
     29 
     30 		"CX", AREG_CX,
     31 		"CL", AREG_CL,
     32 		"CH", AREG_CH,
     33 
     34 		"DX", AREG_DX,
     35 		"DL", AREG_DL,
     36 		"DH", AREG_DH,
     37 
     38 		"SI", AREG_SI,
     39 		"DI", AREG_DI,
     40 
     41 		"SP", AREG_SP,
     42 		"BP", AREG_BP,
     43 
     44 		NULL
     45 	}, *bp;
     46 
     47 	for (bp = regs; bp->name; ++bp) {
     48 		Symbol *sym = lookup(bp->name);
     49 		sym->flags = FREG;
     50 		sym->value = bp->type;
     51 	}
     52 }