コード例 #1
0
ファイル: 8.c プロジェクト: JamesLinus/LiteBSD-Ports
#include "ureg8.h"
#include "mach.h"

#define	REGOFF(x)	(ulong)(&((struct Ureg *) 0)->x)

#define PC		REGOFF(pc)
#define SP		REGOFF(u0.sp)
#define	AX		REGOFF(ax)

#define	REGSIZE		sizeof(struct Ureg)
#define FP_CTL(x)	(REGSIZE+4*(x))
#define FP_REG(x)	(FP_CTL(7)+10*(x))
#define	FPREGSIZE	(7*4+8*10)

Reglist i386reglist[] = {
	{"DI",		REGOFF(di),	RINT, 'X'},
	{"SI",		REGOFF(si),	RINT, 'X'},
	{"BP",		REGOFF(bp),	RINT, 'X'},
	{"BX",		REGOFF(bx),	RINT, 'X'},
	{"DX",		REGOFF(dx),	RINT, 'X'},
	{"CX",		REGOFF(cx),	RINT, 'X'},
	{"AX",		REGOFF(ax),	RINT, 'X'},
	{"GS",		REGOFF(gs),	RINT, 'X'},
	{"FS",		REGOFF(fs),	RINT, 'X'},
	{"ES",		REGOFF(es),	RINT, 'X'},
	{"DS",		REGOFF(ds),	RINT, 'X'},
	{"TRAP",	REGOFF(trap), 	RINT, 'X'},
	{"ECODE",	REGOFF(ecode),	RINT, 'X'},
	{"PC",		PC,		RINT, 'X'},
	{"CS",		REGOFF(cs),	RINT, 'X'},
	{"EFLAGS",	REGOFF(flags),	RINT, 'X'},
コード例 #2
0
ファイル: 4.c プロジェクト: 0intro/plan9-mips
#include "/mips64/include/ureg.h"
#include <mach.h>

#define	REGOFF(x)	(ulong)(&((struct Ureg *) 0)->x)

#define SP		REGOFF(sp)
#define PC		REGOFF(pc)
#define	R1		REGOFF(r1)
#define	R31		REGOFF(r31)
#define	FP_REG(x)	(R1+8+4*(x))

#define	REGSIZE		sizeof(struct Ureg)
#define	FPREGSIZE	(4*33)

Reglist mips64reglist[] = {
	{"STATUS",	REGOFF(status),		RINT|RRDONLY, 'X'},
	{"CAUSE",	REGOFF(cause),		RINT|RRDONLY, 'X'},
	{"BADVADDR",	REGOFF(badvaddr),	RINT|RRDONLY, 'Y'},
	{"TLBVIRT",	REGOFF(tlbvirt),	RINT|RRDONLY, 'Y'},
	{"HI",		REGOFF(hi),		RINT|RRDONLY, 'Y'},
	{"LO",		REGOFF(lo),		RINT|RRDONLY, 'Y'},
	{"PC",		PC,		RINT, 'Y'},
	{"SP",		SP,		RINT, 'Y'},
	{"R31",		R31,		RINT, 'Y'},
	{"R30",		REGOFF(r30),	RINT, 'Y'},
	{"R28",		REGOFF(r28),	RINT, 'Y'},
	{"R27",		REGOFF(r27),	RINT, 'Y'},
	{"R26",		REGOFF(r26),	RINT, 'Y'},
	{"R25",		REGOFF(r25),	RINT, 'Y'},
	{"R24",		REGOFF(r24),	RINT, 'Y'},
	{"R23",		REGOFF(r23),	RINT, 'Y'},
コード例 #3
0
    U_32  edi;
    uint16  ds;
    uint16  es;
    uint16  fs;
    uint16  gs;
    uint16  ss;
    uint16  cs;
    U_32  eip;
    U_32  eflags;
};

#define REGSIZE(_field_) ((jint)sizeof(((NcaiRegisters*)0)->_field_))
#define REGOFF(_field_) ((POINTER_SIZE_INT)&(((NcaiRegisters*)0)->_field_))

NcaiRegisterTableItem g_ncai_reg_table[] = {
    {"eax",     REGSIZE(eax),   REGOFF(eax)   },
    {"ebx",     REGSIZE(ebx),   REGOFF(ebx)   },
    {"ecx",     REGSIZE(ecx),   REGOFF(ecx)   },
    {"edx",     REGSIZE(edx),   REGOFF(edx)   },
    {"esp",     REGSIZE(esp),   REGOFF(esp)   },
    {"ebp",     REGSIZE(ebp),   REGOFF(ebp)   },
    {"esi",     REGSIZE(esi),   REGOFF(esi)   },
    {"edi",     REGSIZE(edi),   REGOFF(edi)   },
    {"ds",      REGSIZE(ds),    REGOFF(ds)    },
    {"es",      REGSIZE(es),    REGOFF(es)    },
    {"fs",      REGSIZE(fs),    REGOFF(fs)    },
    {"gs",      REGSIZE(gs),    REGOFF(gs)    },
    {"ss",      REGSIZE(ss),    REGOFF(ss)    },
    {"cs",      REGSIZE(cs),    REGOFF(cs)    },
    {"eip",     REGSIZE(eip),   REGOFF(eip)   },
    {"eflags",  REGSIZE(eflags),REGOFF(eflags)},
コード例 #4
0
ファイル: t.c プロジェクト: JehanneOS/devtools-kencc
#include <lib9.h>
#include <bio.h>
#include "uregt.h"
#include "mach.h"


#define	REGOFF(x)	(ulong) (&((struct Ureg *) 0)->x)

#define SP		REGOFF(r13)
#define PC		REGOFF(pc)

#define	REGSIZE		sizeof(struct Ureg)

Reglist thumbreglist[] =
{
	{"LINK",	REGOFF(link),		RINT|RRDONLY, 'X'},
	{"TYPE",	REGOFF(type),		RINT|RRDONLY, 'X'},
	{"PSR",		REGOFF(psr),		RINT|RRDONLY, 'X'},
	{"PC",		PC,			RINT, 'X'},
	{"SP",		SP,			RINT, 'X'},
	{"R15",		PC,			RINT, 'X'},
	{"R14",		REGOFF(r14),		RINT, 'X'},
	{"R13",		REGOFF(r13),		RINT, 'X'},
	{"R12",		REGOFF(r12),		RINT, 'X'},
	{"R11",		REGOFF(r11),		RINT, 'X'},
	{"R10",		REGOFF(r10),		RINT, 'X'},
	{"R9",		REGOFF(r9),		RINT, 'X'},
	{"R8",		REGOFF(r8),		RINT, 'X'},
	{"R7",		REGOFF(r7),		RINT, 'X'},
	{"R6",		REGOFF(r6),		RINT, 'X'},
	{"R5",		REGOFF(r5),		RINT, 'X'},
コード例 #5
0
ファイル: k.c プロジェクト: grobe0ba/plan9front
#include "/sparc/include/ureg.h"
#pragma pack off

#define	REGOFF(x)	(uintptr)(&((struct Ureg *) 0)->x)

#define R1		REGOFF(r1)
#define R7		REGOFF(r7)
#define PC		REGOFF(pc)
#define	R15		REGOFF(r15)

#define	REGSIZE		sizeof(struct Ureg)
#define	FP_REG(x)	(REGSIZE+4*(x))
#define	FPREGSIZE	(33*4)

Reglist sparcreglist[] = {
	{"Y",		REGOFF(y),	RINT|RRDONLY, 'X'},
	{"TBR",		REGOFF(tbr),	RINT|RRDONLY, 'X'},
	{"PSR",		REGOFF(psr),	RINT|RRDONLY, 'X'},
	{"PC",		REGOFF(pc),	RINT, 'X'},
	{"R1",		REGOFF(r1),	RINT, 'X'},
	{"R2",		REGOFF(r2),	RINT, 'X'},
	{"R3",		REGOFF(r3),	RINT, 'X'},
	{"R4",		REGOFF(r4),	RINT, 'X'},
	{"R5",		REGOFF(r5),	RINT, 'X'},
	{"R6",		REGOFF(r6),	RINT, 'X'},
	{"R7",		REGOFF(r7),	RINT, 'X'},
	{"R8",		REGOFF(r8),	RINT, 'X'},
	{"R9",		REGOFF(r9),	RINT, 'X'},
	{"R10",		REGOFF(r10),	RINT, 'X'},
	{"R11",		REGOFF(r11),	RINT, 'X'},
	{"R12",		REGOFF(r12),	RINT, 'X'},
コード例 #6
0
ファイル: 9.c プロジェクト: JamesLinus/LiteBSD-Ports
#include <lib9.h>
#include <bio.h>
#include "ureg9.h"
#include "mach.h"


#define	REGOFF(x)	offsetof(struct Ureg, x)

#define R31		REGOFF(r31)
#define FP_REG(x)	(R31+4+8*(x))

#define	REGSIZE		sizeof(struct Ureg)
#define	FPREGSIZE	(8*33)	

Reglist power64reglist[] = {
	{"CAUSE",	REGOFF(cause),	RINT|RRDONLY,	'Y'},
	{"TRAP",	REGOFF(cause),	RINT|RRDONLY,	'Y'},	/* alias for acid */
	{"MSR",	REGOFF(msr),	RINT|RRDONLY,	'Y'},
	{"PC",		REGOFF(pc),	RINT,		'Y'},
	{"LR",		REGOFF(lr),	RINT,		'Y'},
	{"CR",		REGOFF(cr),	RINT,		'X'},
	{"XER",		REGOFF(xer),	RINT,		'Y'},
	{"CTR",		REGOFF(ctr),	RINT,		'Y'},
	{"PC",		REGOFF(pc),		RINT,		'Y'},
	{"SP",		REGOFF(sp),		RINT,		'Y'},
	{"R0",		REGOFF(r0),	RINT,		'Y'},
	/* R1 is SP */
	{"R2",		REGOFF(r2),	RINT,		'Y'},
	{"R3",		REGOFF(r3),	RINT,		'Y'},
	{"R4",		REGOFF(r4),	RINT,		'Y'},
	{"R5",		REGOFF(r5),	RINT,		'Y'},
コード例 #7
0
ファイル: sparc64.c プロジェクト: bbarker/plan9
#include "sparc64/ureg.h"
#include <mach.h>

#define	REGOFF(x)	(ulong)(&((struct Ureg *) 0)->x)

#define R1		REGOFF(r1)
#define R7		REGOFF(r7)
#define PC		REGOFF(pc)
#define	R15		REGOFF(r15)

#define	REGSIZE		sizeof(struct Ureg)
#define	FP_REG(x)	(REGSIZE+4*(x))
#define	FPREGSIZE	(33*4)

Reglist sparc64reglist[] = {
	{"Y",		REGOFF(y),	RINT|RRDONLY, 'X'},
	{"TT",		REGOFF(tt),	RINT|RRDONLY, 'X'},
	{"PSTATE",	REGOFF(pstate),	RINT|RRDONLY, 'X'},
	{"PC",		REGOFF(pc),	RINT, 'X'},
	{"SP",		REGOFF(sp),	RINT, 'X'},	/* also R1 */
	{"R2",		REGOFF(r2),	RINT, 'X'},
	{"R3",		REGOFF(r3),	RINT, 'X'},
	{"R4",		REGOFF(r4),	RINT, 'X'},
	{"R5",		REGOFF(r5),	RINT, 'X'},
	{"R6",		REGOFF(r6),	RINT, 'X'},
	{"R7",		REGOFF(r7),	RINT, 'X'},
	{"R8",		REGOFF(r8),	RINT, 'X'},
	{"R9",		REGOFF(r9),	RINT, 'X'},
	{"R10",		REGOFF(r10),	RINT, 'X'},
	{"R11",		REGOFF(r11),	RINT, 'X'},
	{"R12",		REGOFF(r12),	RINT, 'X'},
コード例 #8
0
ファイル: 2.c プロジェクト: JehanneOS/devtools-kencc
#define	REGSIZE		(R0+4)
#define	FCTL(x)		(REGSIZE+(x)*4)
#define	FREG(x)		(FCTL(3)+(x)*12)
#define	FPREGSIZE	(11*12)

/*
 *	68020 register set
 */
Reglist m68020reglist[] = {
    {"VO",		VO,		RINT,	'x'},
    {"SR",		SR,		RINT,	'x'},
    {"MAGIC",	DBMAGIC,	RINT,	'X'},
    {"PC",		PC,		RINT,	'X'},
    {"A7",		SP,		RINT,	'X'},
    {"KSP",		REGOFF(sp),	RINT,	'X'},
    {"A6",		REGOFF(a6),	RINT,	'X'},
    {"A5",		REGOFF(a5),	RINT,	'X'},
    {"A4",		REGOFF(a4),	RINT,	'X'},
    {"A3",		REGOFF(a3),	RINT,	'X'},
    {"A2",		REGOFF(a2),	RINT,	'X'},
    {"A1",		REGOFF(a1),	RINT,	'X'},
    {"A0",		REGOFF(a0),	RINT,	'X'},
    {"R7",		REGOFF(r7),	RINT,	'X'},
    {"R6",		REGOFF(r6),	RINT,	'X'},
    {"R5",		REGOFF(r5),	RINT,	'X'},
    {"R4",		REGOFF(r4),	RINT,	'X'},
    {"R3",		REGOFF(r3),	RINT,	'X'},
    {"R2",		REGOFF(r2),	RINT,	'X'},
    {"R1",		REGOFF(r1),	RINT,	'X'},
    {"R0",		REGOFF(r0),	RINT,	'X'},
コード例 #9
0
ファイル: 6.c プロジェクト: 99years/plan9
#include <bio.h>
#include "/amd64/include/ureg.h"
#include <mach.h>

#define	REGOFF(x)	offsetof(struct Ureg, x)

#define	REGSIZE		sizeof(struct Ureg)
#define FP_CTLS(x)	(REGSIZE+2*(x))
#define FP_CTL(x)	(REGSIZE+4*(x))
#define FP_REG(x)	(FP_CTL(8)+16*(x))
#define XM_REG(x)	(FP_CTL(8)+8*16+16*(x))

#define	FPREGSIZE	512	/* TO DO? currently only 0x1A0 used */

Reglist amd64reglist[] = {
	{"AX",		REGOFF(ax),	RINT, 'Y'},
	{"BX",		REGOFF(bx),	RINT, 'Y'},
	{"CX",		REGOFF(cx),	RINT, 'Y'},
	{"DX",		REGOFF(dx),	RINT, 'Y'},
	{"SI",		REGOFF(si),	RINT, 'Y'},
	{"DI",		REGOFF(di),	RINT, 'Y'},
	{"BP",		REGOFF(bp),	RINT, 'Y'},
	{"R8",		REGOFF(r8),	RINT, 'Y'},
	{"R9",		REGOFF(r9),	RINT, 'Y'},
	{"R10",		REGOFF(r10),	RINT, 'Y'},
	{"R11",		REGOFF(r11),	RINT, 'Y'},
	{"R12",		REGOFF(r12),	RINT, 'Y'},
	{"R13",		REGOFF(r13),	RINT, 'Y'},
	{"R14",		REGOFF(r14),	RINT, 'Y'},
	{"R15",		REGOFF(r15),	RINT, 'Y'},
	{"DS",		REGOFF(ds),	RINT, 'x'},
コード例 #10
0
ファイル: qi.c プロジェクト: 99years/plan9
void
procinit(int pid)
{
	char *p;
	Segment *s;
	int n, m, sg, i;
	ulong vastart, vaend;
	char mfile[128], tfile[128], sfile[1024];

	sprint(mfile, "/proc/%d/mem", pid);
	sprint(tfile, "/proc/%d/text", pid);
	sprint(sfile, "/proc/%d/segment", pid);

	text = open(tfile, OREAD);
	if(text < 0)
		fatal(1, "open text %s", tfile);
	inithdr(text);

	sg = open(sfile, OREAD);
	if(sg < 0)
		fatal(1, "open text %s", sfile);

	n = read(sg, sfile, sizeof(sfile));
	if(n >= sizeof(sfile))
		fatal(0, "segment file buffer too small");
	close(sg);

	m = open(mfile, OREAD);
	if(m < 0)
		fatal(1, "open %s", mfile);

	initmap();

	p = strstr(sfile, "Data");
	if(p == 0)
		fatal(0, "no data");

	vastart = strtoul(p+9, 0, 16);
	vaend = strtoul(p+18, 0, 16);
	s = &memory.seg[Data];
	if(s->base != vastart || s->end != vaend) {
		s->base = vastart;
		s->end = vaend;
		free(s->table);
		s->table = malloc(((s->end-s->base)/BY2PG)*sizeof(uchar*));
	}
	seginit(m, s, 0, vastart, vaend);
	
	p = strstr(sfile, "Bss");
	if(p == 0)
		fatal(0, "no bss");

	vastart = strtoul(p+9, 0, 16);
	vaend = strtoul(p+18, 0, 16);
	s = &memory.seg[Bss];
	if(s->base != vastart || s->end != vaend) {
		s->base = vastart;
		s->end = vaend;
		free(s->table);
		s->table = malloc(((s->end-s->base)/BY2PG)*sizeof(uchar*));
	}
	seginit(m, s, 0, vastart, vaend);

	reg.pc = greg(m, REGOFF(pc));
	reg.r[1] = greg(m, REGOFF(sp));
	reg.r[2] = greg(m, REGOFF(r2));
	reg.r[30] = greg(m, REGOFF(r30));
	reg.r[31] = greg(m, REGOFF(r31));

	for(i = 0; i < 32; i++)
		reg.r[i] = greg(m, roff[i-1]);

	s = &memory.seg[Stack];
	vastart = reg.r[1] & ~(BY2PG-1);
	seginit(m, s, (vastart-s->base)/BY2PG, vastart, STACKTOP);
	close(m);
	Bprint(bioout, "qi\n"); 
}
コード例 #11
0
ファイル: qi.c プロジェクト: 99years/plan9
	
	seek(f, off, 0);
	n = read(f, wd, BY2WD);
	if(n != BY2WD)
		fatal(1, "read register");

	l  = wd[0]<<24;
	l |= wd[1]<<16;
	l |= wd[2]<<8;
	l |= wd[3];
	return l;
}

ulong
roff[] = {
	REGOFF(r0),
	REGOFF(r1),	REGOFF(r2),	REGOFF(r3),
	REGOFF(r4),	REGOFF(r5),	REGOFF(r6),
	REGOFF(r7),	REGOFF(r8),	REGOFF(r9),
	REGOFF(r10),	REGOFF(r11),	REGOFF(r12),
	REGOFF(r13),	REGOFF(r14),	REGOFF(r15),
	REGOFF(r16),	REGOFF(r17),	REGOFF(r18),
	REGOFF(r19),	REGOFF(r20),	REGOFF(r21),
	REGOFF(r22),	REGOFF(r23),	REGOFF(r24),
	REGOFF(r25),	REGOFF(r26),	REGOFF(r27),
	REGOFF(r28),	REGOFF(r29),	REGOFF(r30),
	REGOFF(r31),
};

void
seginit(int fd, Segment *s, int idx, ulong vastart, ulong vaend)