makethreadasm.c 5.57 KB
#include <os.h>

OSThread t;

main(int argc, char **argv)
{
	printf("#define T_NEXT			%d\n",
		(unsigned long)&t.next - (unsigned long)&t);
	printf("#define T_PRIORITY		%d\n",
		(unsigned long)&t.priority - (unsigned long)&t);
	printf("#define T_ID			%d\n",
		(unsigned long)&t.id - (unsigned long)&t);
	printf("#define T_FP			%d\n",
		(unsigned long)&t.fp - (unsigned long)&t);
	printf("#define T_THPROF		%d\n",
		(unsigned long)&t.thprof - (unsigned long)&t);
	printf("#define T_CONTEXT_AT		%d\n",
		(unsigned long)&t.context.at - (unsigned long)&t);
	printf("#define T_CONTEXT_V0		%d\n",
		(unsigned long)&t.context.v0 - (unsigned long)&t);
	printf("#define T_CONTEXT_V1		%d\n",
		(unsigned long)&t.context.v1 - (unsigned long)&t);
	printf("#define T_CONTEXT_A0		%d\n",
		(unsigned long)&t.context.a0 - (unsigned long)&t);
	printf("#define T_CONTEXT_A1		%d\n",
		(unsigned long)&t.context.a1 - (unsigned long)&t);
	printf("#define T_CONTEXT_A2		%d\n",
		(unsigned long)&t.context.a2 - (unsigned long)&t);
	printf("#define T_CONTEXT_A3		%d\n",
		(unsigned long)&t.context.a3 - (unsigned long)&t);
	printf("#define T_CONTEXT_T0		%d\n",
		(unsigned long)&t.context.t0 - (unsigned long)&t);
	printf("#define T_CONTEXT_T1		%d\n",
		(unsigned long)&t.context.t1 - (unsigned long)&t);
	printf("#define T_CONTEXT_T2		%d\n",
		(unsigned long)&t.context.t2 - (unsigned long)&t);
	printf("#define T_CONTEXT_T3		%d\n",
		(unsigned long)&t.context.t3 - (unsigned long)&t);
	printf("#define T_CONTEXT_T4		%d\n",
		(unsigned long)&t.context.t4 - (unsigned long)&t);
	printf("#define T_CONTEXT_T5		%d\n",
		(unsigned long)&t.context.t5 - (unsigned long)&t);
	printf("#define T_CONTEXT_T6		%d\n",
		(unsigned long)&t.context.t6 - (unsigned long)&t);
	printf("#define T_CONTEXT_T7		%d\n",
		(unsigned long)&t.context.t7 - (unsigned long)&t);
	printf("#define T_CONTEXT_S0		%d\n",
		(unsigned long)&t.context.s0 - (unsigned long)&t);
	printf("#define T_CONTEXT_S1		%d\n",
		(unsigned long)&t.context.s1 - (unsigned long)&t);
	printf("#define T_CONTEXT_S2		%d\n",
		(unsigned long)&t.context.s2 - (unsigned long)&t);
	printf("#define T_CONTEXT_S3		%d\n",
		(unsigned long)&t.context.s3 - (unsigned long)&t);
	printf("#define T_CONTEXT_S4		%d\n",
		(unsigned long)&t.context.s4 - (unsigned long)&t);
	printf("#define T_CONTEXT_S5		%d\n",
		(unsigned long)&t.context.s5 - (unsigned long)&t);
	printf("#define T_CONTEXT_S6		%d\n",
		(unsigned long)&t.context.s6 - (unsigned long)&t);
	printf("#define T_CONTEXT_S7		%d\n",
		(unsigned long)&t.context.s7 - (unsigned long)&t);
	printf("#define T_CONTEXT_T8		%d\n",
		(unsigned long)&t.context.t8 - (unsigned long)&t);
	printf("#define T_CONTEXT_T9		%d\n",
		(unsigned long)&t.context.t9 - (unsigned long)&t);
	printf("#define T_CONTEXT_GP		%d\n",
		(unsigned long)&t.context.gp - (unsigned long)&t);
	printf("#define T_CONTEXT_SP		%d\n",
		(unsigned long)&t.context.sp - (unsigned long)&t);
	printf("#define T_CONTEXT_S8		%d\n",
		(unsigned long)&t.context.s8 - (unsigned long)&t);
	printf("#define T_CONTEXT_RA		%d\n",
		(unsigned long)&t.context.ra - (unsigned long)&t);
	printf("#define T_CONTEXT_LO		%d\n",
		(unsigned long)&t.context.lo - (unsigned long)&t);
	printf("#define T_CONTEXT_HI		%d\n",
		(unsigned long)&t.context.hi - (unsigned long)&t);
	printf("#define T_CONTEXT_SR		%d\n",
		(unsigned long)&t.context.sr - (unsigned long)&t);
	printf("#define T_CONTEXT_PC		%d\n",
		(unsigned long)&t.context.pc - (unsigned long)&t);
	printf("#define T_CONTEXT_CAUSE		%d\n",
		(unsigned long)&t.context.cause - (unsigned long)&t);
	printf("#define T_CONTEXT_BADVADDR	%d\n",
		(unsigned long)&t.context.badvaddr - (unsigned long)&t);
	printf("#define T_CONTEXT_RCP		%d\n",
		(unsigned long)&t.context.rcp - (unsigned long)&t);
	printf("#define T_CONTEXT_FPCSR		%d\n",
		(unsigned long)&t.context.fpcsr - (unsigned long)&t);
	printf("#define T_CONTEXT_FP0		%d\n",
		(unsigned long)&t.context.fp0 - (unsigned long)&t);
	printf("#define T_CONTEXT_FP2		%d\n",
		(unsigned long)&t.context.fp2 - (unsigned long)&t);
	printf("#define T_CONTEXT_FP4		%d\n",
		(unsigned long)&t.context.fp4 - (unsigned long)&t);
	printf("#define T_CONTEXT_FP6		%d\n",
		(unsigned long)&t.context.fp6 - (unsigned long)&t);
	printf("#define T_CONTEXT_FP8		%d\n",
		(unsigned long)&t.context.fp8 - (unsigned long)&t);
	printf("#define T_CONTEXT_FP10		%d\n",
		(unsigned long)&t.context.fp10 - (unsigned long)&t);
	printf("#define T_CONTEXT_FP12		%d\n",
		(unsigned long)&t.context.fp12 - (unsigned long)&t);
	printf("#define T_CONTEXT_FP14		%d\n",
		(unsigned long)&t.context.fp14 - (unsigned long)&t);
	printf("#define T_CONTEXT_FP16		%d\n",
		(unsigned long)&t.context.fp16 - (unsigned long)&t);
	printf("#define T_CONTEXT_FP18		%d\n",
		(unsigned long)&t.context.fp18 - (unsigned long)&t);
	printf("#define T_CONTEXT_FP20		%d\n",
		(unsigned long)&t.context.fp20 - (unsigned long)&t);
	printf("#define T_CONTEXT_FP22		%d\n",
		(unsigned long)&t.context.fp22 - (unsigned long)&t);
	printf("#define T_CONTEXT_FP24		%d\n",
		(unsigned long)&t.context.fp24 - (unsigned long)&t);
	printf("#define T_CONTEXT_FP26		%d\n",
		(unsigned long)&t.context.fp26 - (unsigned long)&t);
	printf("#define T_CONTEXT_FP28		%d\n",
		(unsigned long)&t.context.fp28 - (unsigned long)&t);
	printf("#define T_CONTEXT_FP30		%d\n",
		(unsigned long)&t.context.fp30 - (unsigned long)&t);
	printf("#define T_STATE			%d\n",
		(unsigned long)&t.state - (unsigned long)&t);
	printf("#define T_FLAGS			%d\n",
		(unsigned long)&t.flags - (unsigned long)&t);
	printf("#define T_TLNEXT		%d\n",
		(unsigned long)&t.tlnext - (unsigned long)&t);
	printf("#define T_QUEUE			%d\n",
		(unsigned long)&t.queue - (unsigned long)&t);
	return 0;
}