File:  [Research Unix] / researchv9 / sys / construct / junk / readcore.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:59 2018 UTC (8 years, 3 months ago) by root
Branches: belllabs, MAIN
CVS tags: researchv9-SUN3_old, researchv9-SUN3, HEAD
researchv9-SUN3(old)

#include <stdio.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/dir.h>
#include <sys/user.h>
#include <machine/reg.h>

char xx[1024 * 8];
struct user *u = (struct user *)xx;

main()
{
	FILE *fp;
	int *r;

	if ((fp = fopen("core", "r")) == NULL) {
		printf("Can't open core file\n");
		exit(1);
	}

	fread(u, sizeof(xx), 1, fp);

	printf("u.u_ar0 = 0x%x\n", u->u_ar0);

	r = (int *)&xx[((int)u->u_ar0) & 0x1fff];
	printf("D0/%x	A0/%x\n", r[R0], r[AR0]);
	printf("D1/%x	A1/%x\n", r[R1], r[AR1]);
	printf("D2/%x	A2/%x\n", r[R2], r[AR2]);
	printf("D3/%x	A3/%x\n", r[R3], r[AR3]);
	printf("D4/%x	A4/%x\n", r[R4], r[AR4]);
	printf("D5/%x	A5/%x\n", r[R5], r[AR5]);
	printf("D6/%x	A6/%x\n", r[R6], r[AR6]);
	printf("D7/%x	SP/%x\n", r[R7], r[SP]);
	printf("PS/%x	PC/%x\n", r[PS], r[PC]);

	fclose(fp);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.