changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: acid: add arm64 support

changeset 7203: b7549703c62f
parent 7202: 140274f6f1c2
child 7204: d41b5fcde5ce
author: cinap_lenrek@felloff.net
date: Sat, 04 May 2019 03:06:10 +0200
files: sys/lib/acid/arm64
description: acid: add arm64 support
     1.1new file mode 100644
     1.2--- /dev/null
     1.3+++ b/sys/lib/acid/arm64
     1.4@@ -0,0 +1,156 @@
     1.5+// ARM64 support
     1.6+
     1.7+defn acidinit()			// Called after all the init modules are loaded
     1.8+{
     1.9+	bplist = {};
    1.10+	bpfmt = 'Y';
    1.11+	wplist = {};
    1.12+	wpflush();
    1.13+
    1.14+	srcpath = {
    1.15+		"./",
    1.16+		"/sys/src/libc/port/",
    1.17+		"/sys/src/libc/9sys/",
    1.18+		"/sys/src/libc/arm64/"
    1.19+	};
    1.20+
    1.21+	srcfiles = {};			// list of loaded files
    1.22+	srctext = {};			// the text of the files
    1.23+}
    1.24+
    1.25+defn linkreg(addr)
    1.26+{
    1.27+	return *R30;
    1.28+}
    1.29+
    1.30+defn stk()				// trace
    1.31+{
    1.32+	_stk(*PC, *SP, linkreg(0), 0);
    1.33+}
    1.34+
    1.35+defn lstk()				// trace with locals
    1.36+{
    1.37+	_stk(*PC, *SP, linkreg(0), 1);
    1.38+}
    1.39+
    1.40+defn gpr()			// print general purpose registers
    1.41+{
    1.42+	print("R0\t", *R0, " R1\t", *R1, " R2\t", *R2, "\n");
    1.43+	print("R3\t", *R3, " R4\t", *R4, " R5\t", *R5, "\n");
    1.44+	print("R6\t", *R6, " R7\t", *R7, " R8\t", *R8, "\n");
    1.45+	print("R9\t", *R9, " R10\t", *R10, " R11\t", *R11, "\n");
    1.46+	print("R12\t", *R12, " R13\t", *R13, " R14\t", *R14, "\n");
    1.47+	print("R15\t", *R15, " R16\t", *R16, " R17\t", *R17, "\n");
    1.48+	print("R18\t", *R18, " R19\t", *R19, " R20\t", *R20, "\n");
    1.49+	print("R21\t", *R21, " R22\t", *R22, " R23\t", *R23, "\n");
    1.50+	print("R24\t", *R24, " R25\t", *R25, " R26\t", *R26, "\n");
    1.51+	print("R27\t", *R27, " R28\t", *R28, " R29\t", *R29, "\n");
    1.52+	print("R30\t", *R30, "\n");
    1.53+}
    1.54+
    1.55+defn regs()				// print all registers
    1.56+{
    1.57+	gpr();
    1.58+}
    1.59+
    1.60+defn pstop(pid)
    1.61+{
    1.62+	local l;
    1.63+	local pc;
    1.64+
    1.65+	pc = *PC;
    1.66+
    1.67+	print(pid,": ", reason(*TYPE), "\t");
    1.68+	print(fmt(pc, 'a'), "\t", fmt(pc, 'i'), "\n");
    1.69+
    1.70+	if notes then {
    1.71+		if notes[0] != "sys: breakpoint" then {
    1.72+			print("Notes pending:\n");
    1.73+			l = notes;
    1.74+			while l do {
    1.75+				print("\t", head l, "\n");
    1.76+				l = tail l;
    1.77+			}
    1.78+		}
    1.79+	}
    1.80+}
    1.81+
    1.82+sizeofUreg = 272;
    1.83+aggr Ureg
    1.84+{
    1.85+	'W' 0 r0;
    1.86+	'W' 8 r1;
    1.87+	'W' 16 r2;
    1.88+	'W' 24 r3;
    1.89+	'W' 32 r4;
    1.90+	'W' 40 r5;
    1.91+	'W' 48 r6;
    1.92+	'W' 56 r7;
    1.93+	'W' 64 r8;
    1.94+	'W' 72 r9;
    1.95+	'W' 80 r10;
    1.96+	'W' 88 r11;
    1.97+	'W' 96 r12;
    1.98+	'W' 104 r13;
    1.99+	'W' 112 r14;
   1.100+	'W' 120 r15;
   1.101+	'W' 128 r16;
   1.102+	'W' 136 r17;
   1.103+	'W' 144 r18;
   1.104+	'W' 152 r19;
   1.105+	'W' 160 r20;
   1.106+	'W' 168 r21;
   1.107+	'W' 176 r22;
   1.108+	'W' 184 r23;
   1.109+	'W' 192 r24;
   1.110+	'W' 200 r25;
   1.111+	'W' 208 r26;
   1.112+	'W' 216 r27;
   1.113+	'W' 224 r28;
   1.114+	'W' 232 r29;
   1.115+	'W' 240 r30;
   1.116+	'W' 248 type;
   1.117+	'W' 256 psr;
   1.118+	'W' 264 pc;
   1.119+};
   1.120+
   1.121+defn
   1.122+Ureg(addr) {
   1.123+	complex Ureg addr;
   1.124+	print("	r0	", addr.r0, "\n");
   1.125+	print("	r1	", addr.r1, "\n");
   1.126+	print("	r2	", addr.r2, "\n");
   1.127+	print("	r3	", addr.r3, "\n");
   1.128+	print("	r4	", addr.r4, "\n");
   1.129+	print("	r5	", addr.r5, "\n");
   1.130+	print("	r6	", addr.r6, "\n");
   1.131+	print("	r7	", addr.r7, "\n");
   1.132+	print("	r8	", addr.r8, "\n");
   1.133+	print("	r9	", addr.r9, "\n");
   1.134+	print("	r10	", addr.r10, "\n");
   1.135+	print("	r11	", addr.r11, "\n");
   1.136+	print("	r12	", addr.r12, "\n");
   1.137+	print("	r13	", addr.r13, "\n");
   1.138+	print("	r14	", addr.r14, "\n");
   1.139+	print("	r15	", addr.r15, "\n");
   1.140+	print("	r16	", addr.r16, "\n");
   1.141+	print("	r17	", addr.r17, "\n");
   1.142+	print("	r18	", addr.r18, "\n");
   1.143+	print("	r19	", addr.r19, "\n");
   1.144+	print("	r20	", addr.r20, "\n");
   1.145+	print("	r21	", addr.r21, "\n");
   1.146+	print("	r22	", addr.r22, "\n");
   1.147+	print("	r23	", addr.r23, "\n");
   1.148+	print("	r24	", addr.r24, "\n");
   1.149+	print("	r25	", addr.r25, "\n");
   1.150+	print("	r26	", addr.r26, "\n");
   1.151+	print("	r27	", addr.r27, "\n");
   1.152+	print("	r28	", addr.r28, "\n");
   1.153+	print("	r29	", addr.r29, "\n");
   1.154+	print("	r30	", addr.r30, "\n");
   1.155+	print("	type	", addr.type, "\n");
   1.156+	print("	psr	", addr.psr, "\n");
   1.157+	print("	pc	", addr.pc, "\n");
   1.158+};
   1.159+
   1.160+print("/sys/lib/acid/arm64");