aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/db/regs.c
blob: 4a9a4426df8c04832e8a8b0576e4189672cbdd40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
 * code to keep track of registers
 */

#include "defs.h"
#include "fns.h"

/*
 * print the registers
 */
void
printregs(int c)
{
	Regdesc *rp;
	int i;
	ulong u;

	if(correg == nil){
		dprint("registers not mapped\n");
		return;
	}

	for (i = 1, rp = mach->reglist; rp->name; rp++, i++) {
		if ((rp->flags & RFLT)) {
			if (c != 'R')
				continue;
			if (rp->format == '8' || rp->format == '3')
				continue;
		}
		rget(correg, rp->name, &u);
		if(rp->format == 'Y')
			dprint("%-8s %-20#llux", rp->name, (uvlong)u);
		else
			dprint("%-8s %-12#lux", rp->name, (ulong)u);
		if ((i % 3) == 0) {
			dprint("\n");
			i = 0;
		}
	}
	if (i != 1)
		dprint("\n");
	dprint ("%s\n", mach->exc(cormap, correg));
	printpc();
}