Plan 9 from Bell Labs’s /usr/web/sources/contrib/rsc/86b/dat.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


typedef enum
{
	RAL,
	RCL,
	RDL,
	RBL,
	RAH,
	RCH,
	RDH,
	RBH,
} Reg8;

typedef enum
{
	RAX,
	RCX,
	RDX,
	RBX,
	RSP,
	RBP,
	RSI,
	RDI,
} Reg32;

enum
{
	PrefixCS = 1<<0,
	PrefixSS = 1<<1,
	PrefixDS = 1<<2,
	PrefixES = 1<<3,
	PrefixFS = 1<<4,
	PrefixGS = 1<<5,
};

typedef struct Mem Mem;
struct Mem
{
	/* refers to mem location base+disp+index*scale */
	Reg32 base;
	u32int disp;
	Reg32 index;
	u32int scale;
};

typedef enum
{
	ExReg8,
	ExReg32,
	ExMem,
	ExConst,
} ExType;

typedef struct Expr Expr;
struct Expr
{
	ExType ty;
	union {
		Reg8 r8;
		Reg32 r32;
		Mem m;
		u32int i;
	};
};

typedef struct Inst Inst;
struct Inst
{
	uint prefix;	/* bitfield */
	char *op;		/* name of op */
	int ne;
	Expr e[3];

};

typedef struct Sib Sib;
struct Sib
{
	int index;
	int scale;
};

typedef union Yystype Yystype;
union Yystype
{
	int i;
	uint prefix;
	char *s;
	Reg8 r8;
	Reg32 r32;
	Inst inst;
	Expr expr;
	Mem mem;
	Sib sib;
};
	
typedef struct AsmRule AsmRule;
struct AsmRule
{
	char *op;
	char *arg[4];
	char *byte[4];
};

extern AsmRule *asmrule;
int nasmrule;

extern Yystype yylval;
extern int yylex(void);
extern char *atom(char*);


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.