Deleted Added
full compact
inflate.h (3418) inflate.h (3507)
1/*
2 * Parts of this file are not covered by:
3 * ----------------------------------------------------------------------------
4 * "THE BEER-WARE LICENSE" (Revision 42):
5 * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
6 * can do whatever you want with this stuff. If we meet some day, and you think
7 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
8 * ----------------------------------------------------------------------------
9 *
1/*
2 * Parts of this file are not covered by:
3 * ----------------------------------------------------------------------------
4 * "THE BEER-WARE LICENSE" (Revision 42):
5 * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
6 * can do whatever you want with this stuff. If we meet some day, and you think
7 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
8 * ----------------------------------------------------------------------------
9 *
10 * $Id: imgact_gzip.c,v 1.4 1994/10/04 06:51:42 phk Exp $
10 * $Id: inflate.h,v 1.2 1994/10/07 23:18:18 csgr Exp $
11 *
12 * This module handles execution of a.out files which have been run through
13 * "gzip -9".
14 *
15 * For now you need to use exactly this command to compress the binaries:
16 *
17 * gzip -9 -v < /bin/sh > /tmp/sh
18 *
19 * TODO:
20 * text-segments should be made R/O after being filled
21 * is the vm-stuff safe ?
22 * should handle the entire header of gzip'ed stuff.
23 * inflate isn't quite reentrant yet...
24 * error-handling is a mess...
25 * so is the rest...
26 * tidy up unnecessary includes
27 */
28
29
30#ifndef _SYS_INFLATE_H_
31#define _SYS_INFLATE_H_
32
33#ifdef KERNEL
34
35#include <sys/param.h>
11 *
12 * This module handles execution of a.out files which have been run through
13 * "gzip -9".
14 *
15 * For now you need to use exactly this command to compress the binaries:
16 *
17 * gzip -9 -v < /bin/sh > /tmp/sh
18 *
19 * TODO:
20 * text-segments should be made R/O after being filled
21 * is the vm-stuff safe ?
22 * should handle the entire header of gzip'ed stuff.
23 * inflate isn't quite reentrant yet...
24 * error-handling is a mess...
25 * so is the rest...
26 * tidy up unnecessary includes
27 */
28
29
30#ifndef _SYS_INFLATE_H_
31#define _SYS_INFLATE_H_
32
33#ifdef KERNEL
34
35#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/resourcevar.h>
38#include <sys/exec.h>
39#include <sys/mman.h>
40#include <sys/malloc.h>
41#include <sys/imgact.h>
42#include <sys/imgact_aout.h>
36#include <sys/imgact.h>
37#include <sys/imgact_aout.h>
43#include <sys/kernel.h>
44#include <sys/sysent.h>
45
38
46#include <vm/vm.h>
47#include <vm/vm_kern.h>
48
49/* needed to make inflate() work */
50#define uch u_char
51#define ush u_short
52#define ulg u_long
53
54
55#define WSIZE 0x8000
56
57struct gzip {
58 struct image_params *ip;
59 struct exec a_out;
60 int error;
61 int where;
62 u_char *inbuf;
63 u_long offset;
64 u_long output;
65 u_long len;
66 int idx;
67 u_long virtual_offset, file_offset, file_end, bss_size;
68 unsigned gz_wp;
69 u_char *gz_slide;
70};
71
72/*
73 * Global variables used by inflate and friends.
74 * This structure is used in order to make inflate() reentrant.
75 */
76struct gz_global {
39
40/* needed to make inflate() work */
41#define uch u_char
42#define ush u_short
43#define ulg u_long
44
45
46#define WSIZE 0x8000
47
48struct gzip {
49 struct image_params *ip;
50 struct exec a_out;
51 int error;
52 int where;
53 u_char *inbuf;
54 u_long offset;
55 u_long output;
56 u_long len;
57 int idx;
58 u_long virtual_offset, file_offset, file_end, bss_size;
59 unsigned gz_wp;
60 u_char *gz_slide;
61};
62
63/*
64 * Global variables used by inflate and friends.
65 * This structure is used in order to make inflate() reentrant.
66 */
67struct gz_global {
77 ulg bb; /* bit buffer */
78 unsigned bk; /* bits in bit buffer */
79 unsigned hufts; /* track memory usage */
80 struct huft *fixed_tl; /* must init to NULL !! */
81 struct huft *fixed_td;
82 int fixed_bl;
83 int fixed_bd;
68 ulg gz_bb; /* bit buffer */
69 unsigned gz_bk; /* bits in bit buffer */
70 unsigned gz_hufts; /* track memory usage */
71 struct huft *gz_fixed_tl; /* must init to NULL !! */
72 struct huft *gz_fixed_td;
73 int gz_fixed_bl;
74 int gz_fixed_bd;
84};
85
86int inflate __P((struct gzip *, struct gz_global *));
87int do_aout_hdr __P((struct gzip *));
88
89#define slide (gz->gz_slide)
90#define wp (gz->gz_wp)
91
92#endif /* KERNEL */
93
94#endif /* ! _SYS_INFLATE_H_ */
75};
76
77int inflate __P((struct gzip *, struct gz_global *));
78int do_aout_hdr __P((struct gzip *));
79
80#define slide (gz->gz_slide)
81#define wp (gz->gz_wp)
82
83#endif /* KERNEL */
84
85#endif /* ! _SYS_INFLATE_H_ */