xref: /inferno-os/os/boot/rpcg/squeeze.h (revision 74a4d8c26dd3c1e9febcb717cfd6cb6512991a7a)
1 
2 /*
3  * squeezed file format:
4  *	Sqhdr
5  *	original Exec header
6  *	two Squeeze tables
7  *	squeezed segment
8  *	unsqueezed segment, if any
9  */
10 #define	SQMAGIC	(ulong)0xFEEF0F1E
11 
12 typedef struct Sqhdr Sqhdr;
13 struct Sqhdr {
14 	uchar	magic[4];	/* SQMAGIC */
15 	uchar	text[4];	/* squeezed length of text (excluding tables) */
16 	uchar	data[4];	/* squeezed length of data (excluding tables) */
17 	uchar	asis[4];	/* length of unsqueezed segment */
18 	uchar	toptxt[4];	/* value for 0 encoding in text */
19 	uchar	topdat[4];	/* value for 0 encoding in data */
20 	uchar	sum[4];	/* simple checksum of unsqueezed data */
21 	uchar	flags[4];
22 };
23 #define	SQHDRLEN	(8*4)
24 
25 /*
26  * certain power instruction types are rearranged by sqz
27  * so as to move the variable part of the instruction word to the
28  * low order bits.  note that the mapping is its own inverse.
29  */
30 #define	QREMAP(X)\
31 	switch((X)>>26){\
32 	case 19: case 31: case 59: case 63:\
33 		(X) = (((X) & 0xFC00F801) | (((X)>>15)&0x7FE) | (((X)&0x7FE)<<15));\
34 	}
35