1 /* DLIFE Copyright (C) 2000 Richard W.M. Jones <rich@annexia.org>
2 * and other authors listed in the ``AUTHORS'' file.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 * $Id: soup.h,v 1.1 2002/04/05 14:40:28 rich Exp $
30 /* How far away can a daughter be from its mother? */
31 #define MAX_SPAWN_DISTANCE 8192
35 addr_t base; /* Base address of this fragment. */
36 int len; /* Length of this fragment. */
38 /* These are kept on a circular doubly-linked list. */
39 struct soup_frag *next, *prev;
43 raddr_to_addr (const struct state *state,
44 const struct soup_frag *frag, reg_t raddr)
46 return (frag->base + raddr) & (state->soup_size - 1);
50 get_soup (const struct state *state,
51 const struct soup_frag *frag, reg_t raddr)
53 addr_t addr = raddr_to_addr (state, frag, raddr);
54 return state->soup[addr];
58 set_soup (struct state *state,
59 const struct soup_frag *frag, int v, reg_t raddr)
61 addr_t addr = raddr_to_addr (state, frag, raddr);
62 state->soup[addr] = v;
65 extern void soup_init (struct state *state, int _soup_size);
67 extern struct soup_frag *soup_frag_malloc (struct state *state,
68 struct soup_frag *, reg_t);
69 extern void soup_frag_free (struct state *state, struct soup_frag *);
71 extern void soup_state_save (struct state *state, FILE *fp);
72 extern void soup_state_load (struct state *state, FILE *fp);
74 extern void soup_check (struct state *state);
76 extern crc_t soup_frag_compute_crc32 (const struct state *state,
77 const struct soup_frag *frag);