1 #ifndef PSPACE_H
2 #define PSPACE_H
3 
4 typedef struct pspace_st {
5     field_t  lastresult;	/* p-space location 0. */
6     field_t *mem;		/* current p-space locations 1..PSPACESIZE-1.
7 				   unit offset array. */
8     field_t *ownmem;		/* private locations 1..PSPACESIZE-1. */
9     u32_t    len;
10 } pspace_t;
11 
12 
13 pspace_t *pspace_alloc(u32_t pspacesize);
14 /* Allocate a p-space. */
15 
16 void pspace_free(pspace_t *p);
17 /* Free a p-space. */
18 
19 
20 
21 /*-- Accessing a p-space. */
22 
23 field_t pspace_get(const pspace_t *p, u32_t paddr);
24 /* Get value at p-space address paddr. */
25 
26 void pspace_set(pspace_t *p, u32_t paddr, field_t val);
27 /* Set p-space cell at paddr to val. */
28 
29 void pspace_clear(pspace_t *p);
30 /* Set all p-space locations to 0. */
31 
32 
33 void pspace_share(const pspace_t *shared, pspace_t *sharer);
34 /* Field accesses to sharer go to shared. */
35 
36 void pspace_privatise(pspace_t *p);
37 /* Reset contents of p to its private ones. */
38 
39 #endif /* PSPACE_H */
40