code: purgatorio

ref: f5cc6fbe3a7bcf8bdb002c646ddd519014afafd2
dir: /lib/acid/amd64/

View raw version
// amd64

defn acidinit()
{
	bplist = {};
	bpfmt = 'b';

	srcpath = {
		"./",
		"/sys/src/libc/port/",
		"/sys/src/libc/9sys/",
		"/sys/src/libc/amd64/"
	};

	srcfiles = {};		// list of loaded files
	srctext = {};		// the text of the files
}

defn gpr()
{
	print("AX    ", *AX, "\n");
	print("BX    ", *BX, "\n");
	print("CX    ", *CX, "\n");
	print("DX    ", *DX, "\n");
	print("DI    ", *DI, "\n"); 
	print("SI    ", *SI, "\n");
	print("BP    ", *BP, "\n");
	print("R8    ", *R8, "\n");
	print("R9    ", *R9, "\n");
	print("R10   ", *R10, "\n");
	print("R11   ", *R11, "\n");
	print("R12   ", *R12, "\n");
	print("R13   ", *R13, "\n");
	print("R14   ", *R14, "\n");
	print("R15   ", *R15, "\n");
}

defn spr()
{
	print("DS  ", *DS, "  ES  ", *ES, "  FS  ", *FS, "  GS  ", *GS, "\n");
	print("TYPE  ", *TYPE, "\n");
	print("ERROR ", *ERROR, "\n");
	print("PC    ", *PC, "\n");
	print("CS    ", *CS, "\n");
	print("FLAGS ", *FLAGS, "\n");
	print("SP    ", *SP, "\n");
	print("SS    ", *SS, "\n");
}

defn x87r()
{
	print("FCW  ", *FCW, "  FSW  ", *FSW, "  FTW  ", *FTW, "  FOP  ", *FOP, "\n");
	print("RIP  ", *RIP, "   RDP  ", *RDP, "\n");
	print("M0   ", *M0, "\n");
	print("M1   ", *M1, "\n");
	print("M2   ", *M2, "\n");
	print("M3   ", *M3, "\n");
	print("M4   ", *M4, "\n");
	print("M5   ", *M5, "\n");
	print("M6   ", *M6, "\n");
	print("M7   ", *M7, "\n");
}

defn xmmr()
{
	print("MXCSR  ", *MXCSR, "   MXCSRMASK  ", *MXCSRMASK, "\n");
	print("X0   ", *X0, "\n");
	print("X1   ", *X1, "\n");
	print("X2   ", *X2, "\n");
	print("X3   ", *X3, "\n");
	print("X4   ", *X4, "\n");
	print("X5   ", *X5, "\n");
	print("X6   ", *X6, "\n");
	print("X7   ", *X7, "\n");
	print("X8   ", *X8, "\n");
	print("X9   ", *X9, "\n");
	print("X10  ", *X10, "\n");
	print("X11  ", *X11, "\n");
	print("X12  ", *X12, "\n");
	print("X13  ", *X13, "\n");
	print("X14  ", *X14, "\n");
	print("X15  ", *X15, "\n");
}

defn fpr()
{
	xmmr();
}

defn regs()
{
	gpr();
	spr();
}

defn pstop(pid)
{
	local l;
	local pc;

	pc = *PC;

	print(pid,": ", reason(*TRAP), "\t");
	print(fmt(pc, 'a'), "\t", fmt(pc, 'i'), "\n");

	if notes then {
		if notes[0] != "sys: breakpoint" then {
			print("Notes pending:\n");
			l = notes;
			while l do {
				print("\t", head l, "\n");
				l = tail l;
			}
		}
	}
}

defn stk()
{
	_stk(*PC, *SP, 0, 0);
}

print("/sys/lib/acid/amd64");