xref: /inferno-os/lib/acid/amd64 (revision 773d7fd206e9623edfb12cd182dc5a115ec86950)
1// amd64
2
3defn acidinit()
4{
5	bplist = {};
6	bpfmt = 'b';
7
8	srcpath = {
9		"./",
10		"/sys/src/libc/port/",
11		"/sys/src/libc/9sys/",
12		"/sys/src/libc/amd64/"
13	};
14
15	srcfiles = {};		// list of loaded files
16	srctext = {};		// the text of the files
17}
18
19defn gpr()
20{
21	print("AX    ", *AX, "\n");
22	print("BX    ", *BX, "\n");
23	print("CX    ", *CX, "\n");
24	print("DX    ", *DX, "\n");
25	print("DI    ", *DI, "\n");
26	print("SI    ", *SI, "\n");
27	print("BP    ", *BP, "\n");
28	print("R8    ", *R8, "\n");
29	print("R9    ", *R9, "\n");
30	print("R10   ", *R10, "\n");
31	print("R11   ", *R11, "\n");
32	print("R12   ", *R12, "\n");
33	print("R13   ", *R13, "\n");
34	print("R14   ", *R14, "\n");
35	print("R15   ", *R15, "\n");
36}
37
38defn spr()
39{
40	print("DS  ", *DS, "  ES  ", *ES, "  FS  ", *FS, "  GS  ", *GS, "\n");
41	print("TYPE  ", *TYPE, "\n");
42	print("ERROR ", *ERROR, "\n");
43	print("PC    ", *PC, "\n");
44	print("CS    ", *CS, "\n");
45	print("FLAGS ", *FLAGS, "\n");
46	print("SP    ", *SP, "\n");
47	print("SS    ", *SS, "\n");
48}
49
50defn x87r()
51{
52	print("FCW  ", *FCW, "  FSW  ", *FSW, "  FTW  ", *FTW, "  FOP  ", *FOP, "\n");
53	print("RIP  ", *RIP, "   RDP  ", *RDP, "\n");
54	print("M0   ", *M0, "\n");
55	print("M1   ", *M1, "\n");
56	print("M2   ", *M2, "\n");
57	print("M3   ", *M3, "\n");
58	print("M4   ", *M4, "\n");
59	print("M5   ", *M5, "\n");
60	print("M6   ", *M6, "\n");
61	print("M7   ", *M7, "\n");
62}
63
64defn xmmr()
65{
66	print("MXCSR  ", *MXCSR, "   MXCSRMASK  ", *MXCSRMASK, "\n");
67	print("X0   ", *X0, "\n");
68	print("X1   ", *X1, "\n");
69	print("X2   ", *X2, "\n");
70	print("X3   ", *X3, "\n");
71	print("X4   ", *X4, "\n");
72	print("X5   ", *X5, "\n");
73	print("X6   ", *X6, "\n");
74	print("X7   ", *X7, "\n");
75	print("X8   ", *X8, "\n");
76	print("X9   ", *X9, "\n");
77	print("X10  ", *X10, "\n");
78	print("X11  ", *X11, "\n");
79	print("X12  ", *X12, "\n");
80	print("X13  ", *X13, "\n");
81	print("X14  ", *X14, "\n");
82	print("X15  ", *X15, "\n");
83}
84
85defn fpr()
86{
87	xmmr();
88}
89
90defn regs()
91{
92	gpr();
93	spr();
94}
95
96defn pstop(pid)
97{
98	local l;
99	local pc;
100
101	pc = *PC;
102
103	print(pid,": ", reason(*TRAP), "\t");
104	print(fmt(pc, 'a'), "\t", fmt(pc, 'i'), "\n");
105
106	if notes then {
107		if notes[0] != "sys: breakpoint" then {
108			print("Notes pending:\n");
109			l = notes;
110			while l do {
111				print("\t", head l, "\n");
112				l = tail l;
113			}
114		}
115	}
116}
117
118defn stk()
119{
120	_stk(*PC, *SP, 0, 0);
121}
122
123print("/sys/lib/acid/amd64");
124