scc

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

arch_i286.c (723B)


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