summaryrefslogtreecommitdiff
path: root/sys/arch/mvme68k/stand/prtvid/prtvid.c
blob: d6c775875bc0537fe2c5d904eeca0a31982fbf67 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*	$OpenBSD: prtvid.c,v 1.2 1996/04/28 10:49:29 deraadt Exp $ */

#include <stdio.h>
#define __DBINTERFACE_PRIVATE
#include <db.h>
#include "vid.h"

main(argc, argv)
	int argc;
	char *argv[];
{
	struct vid *pvid;
	struct cfg *pcfg;

	pvid = (struct vid *) malloc(sizeof (struct vid));

	fread(pvid, sizeof(struct vid), 1, stdin);

	if (BYTE_ORDER != BIG_ENDIAN)
		swabvid(pvid);

	printf("vid_id		%s	%x\n", pvid->vid_id,
	    (char *)&(pvid->vid_id[4]) - (char *)pvid);
	printf("vid_oss		%x	%x\n", pvid->vid_oss,
	    (char *)&(pvid->vid_oss) - (char *)pvid);
	printf("vid_osl		%x	%x\n", pvid->vid_osl,
	    (char *)&(pvid->vid_osl) - (char *)pvid);
	printf("vid_osa_u	%x	%x\n", pvid->vid_osa_u,
	    (char *)&(pvid->vid_osa_u) - (char *)pvid);
	printf("vid_osa_l	%x	%x\n", pvid->vid_osa_l,
	    (char *)&(pvid->vid_osa_l) - (char *)pvid);
	printf("vid_vd %x\n",
	    (char *)&(pvid->vid_vd) - (char *)pvid);
	printf("vid_cas		%x	%x\n", pvid->vid_cas,
	    (char *)&(pvid->vid_cas) - (char *)pvid);
	printf("vid_cal		%x	%x\n", pvid->vid_cal,
	    (char *)&(pvid->vid_cal) - (char *)pvid);
	printf("vid_moto	%s	%x\n", pvid->vid_mot,
	    (char *)&(pvid->vid_mot[0]) - (char *)pvid);

	free(pvid);

	pcfg = (struct cfg *) malloc(sizeof(struct cfg));

	fread(pcfg, sizeof(struct cfg), 1, stdin);

	if (BYTE_ORDER != BIG_ENDIAN)
		swabcfg(pcfg);

	printf("cfg_atm		%x	%x\n", pcfg->cfg_atm,
	    (char *)&(pcfg->cfg_atm) - (char *)(pcfg));
	printf("cfg_prm		%x	%x\n", pcfg->cfg_prm,
	    (char *)&(pcfg->cfg_prm) - (char *)(pcfg));
	printf("cfg_atw		%x	%x\n", pcfg->cfg_atw,
	    (char *)&(pcfg->cfg_atw) - (char *)(pcfg));
	printf("cfg_rec		%x	%x\n",(long)pcfg->cfg_rec,
	    (char *)&(pcfg->cfg_rec) - (char *)(pcfg));
	printf("cfg_spt		%x	%x\n", pcfg->cfg_spt,
	    (char *)&(pcfg->cfg_spt) - (char *)(pcfg));
	printf("cfg_hds		%x	%x\n", pcfg->cfg_hds,
	    (char *)&(pcfg->cfg_hds) - (char *)(pcfg));
	printf("cfg_trk		%x	%x\n", pcfg->cfg_trk,
	    (char *)&(pcfg->cfg_trk) - (char *)(pcfg));
	printf("cfg_ilv		%x	%x\n", pcfg->cfg_ilv,
	    (char *)&(pcfg->cfg_ilv) - (char *)(pcfg));
	printf("cfg_sof		%x	%x\n", pcfg->cfg_sof,
	    (char *)&(pcfg->cfg_sof) - (char *)(pcfg));
	printf("cfg_psm		%x	%x\n", pcfg->cfg_psm,
	    (char *)&(pcfg->cfg_psm) - (char *)(pcfg));
	printf("cfg_shd		%x	%x\n", pcfg->cfg_shd,
	    (char *)&(pcfg->cfg_shd) - (char *)(pcfg));
	printf("cfg_pcom	%x	%x\n", pcfg->cfg_pcom,
	    (char *)&(pcfg->cfg_pcom) - (char *)(pcfg));
	printf("cfg_ssr 	%x	%x\n", pcfg->cfg_ssr,
	    (char *)&(pcfg->cfg_ssr) - (char *)(pcfg));
	printf("cfg_rwcc	%x	%x\n", pcfg->cfg_rwcc,
	    (char *)&(pcfg->cfg_rwcc) - (char *)(pcfg));
	printf("cfg_ecc 	%x	%x\n", pcfg->cfg_ecc,
	    (char *)&(pcfg->cfg_ecc) - (char *)(pcfg));
	printf("cfg_eatm	%x	%x\n", pcfg->cfg_eatm,
	    (char *)&(pcfg->cfg_eatm) - (char *)(pcfg));
	printf("cfg_eprm	%x	%x\n", pcfg->cfg_eprm,
	    (char *)&(pcfg->cfg_eprm) - (char *)(pcfg));
	printf("cfg_eatw	%x	%x\n", pcfg->cfg_eatw,
	    (char *)&(pcfg->cfg_eatw) - (char *)(pcfg));
	printf("cfg_gpb1	%x	%x\n", pcfg->cfg_gpb1,
	    (char *)&(pcfg->cfg_gpb1) - (char *)(pcfg));
	printf("cfg_gpb2	%x	%x\n", pcfg->cfg_gpb2,
	    (char *)&(pcfg->cfg_gpb2) - (char *)(pcfg));
	printf("cfg_gpb3	%x	%x\n", pcfg->cfg_gpb3,
	    (char *)&(pcfg->cfg_gpb3) - (char *)(pcfg));
	printf("cfg_gpb4	%x	%x\n", pcfg->cfg_gpb4,
	    (char *)&(pcfg->cfg_gpb4) - (char *)(pcfg));
	printf("cfg_ssc		%x	%x\n", pcfg->cfg_ssc,
	    (char *)&(pcfg->cfg_ssc) - (char *)(pcfg));
	printf("cfg_runit	%x	%x\n", pcfg->cfg_runit,
	    (char *)&(pcfg->cfg_runit) - (char *)(pcfg));
	printf("cfg_rsvc1	%x	%x\n", pcfg->cfg_rsvc1,
	    (char *)&(pcfg->cfg_rsvc1) - (char *)(pcfg));
	printf("cfg_rsvc2	%x	%x\n", pcfg->cfg_rsvc2,
	    (char *)&(pcfg->cfg_rsvc2) - (char *)(pcfg));
}

swabvid(pvid)
	struct vid *pvid;
{
	M_32_SWAP(pvid->vid_oss);
	M_16_SWAP(pvid->vid_osl);
	M_16_SWAP(pvid->vid_osa_u);
	M_16_SWAP(pvid->vid_osa_l);
	M_32_SWAP(pvid->vid_cas);
}

swabcfg(pcfg)
	struct cfg *pcfg;
{
	printf("swapping cfg\n");

	M_16_SWAP(pcfg->cfg_atm);
	M_16_SWAP(pcfg->cfg_prm);
	M_16_SWAP(pcfg->cfg_atm);
	M_16_SWAP(pcfg->cfg_rec);
	M_16_SWAP(pcfg->cfg_trk);
	M_16_SWAP(pcfg->cfg_psm);
	M_16_SWAP(pcfg->cfg_shd);
	M_16_SWAP(pcfg->cfg_pcom);
	M_16_SWAP(pcfg->cfg_rwcc);
	M_16_SWAP(pcfg->cfg_ecc);
	M_16_SWAP(pcfg->cfg_eatm);
	M_16_SWAP(pcfg->cfg_eprm);
	M_16_SWAP(pcfg->cfg_eatw);
	M_16_SWAP(pcfg->cfg_rsvc1);
	M_16_SWAP(pcfg->cfg_rsvc2);
}