2014-09-22 20:10:57 +04:00
|
|
|
/* include/g/e.h
|
|
|
|
**
|
|
|
|
** This file is in the public domain.
|
|
|
|
*/
|
2014-11-05 03:29:08 +03:00
|
|
|
/** Data structures.
|
|
|
|
**/
|
|
|
|
/* u3_cs_line: control line.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_cs_line {
|
|
|
|
c3_w pag_w;
|
|
|
|
c3_w mug_w;
|
|
|
|
} u3_cs_line;
|
|
|
|
|
|
|
|
/* u3_cs_control: memory change, control file.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_cs_control {
|
|
|
|
c3_d evt_d; // event number
|
|
|
|
c3_w nor_w; // new page count north
|
|
|
|
c3_w sou_w; // new page count south
|
|
|
|
c3_w pgs_w; // number of changed pages
|
|
|
|
u3_cs_line mem_u[0]; // per page
|
|
|
|
} u3_cs_control;
|
|
|
|
|
|
|
|
/* u3_cs_patch: memory change, top level.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_cs_patch {
|
|
|
|
c3_i ctl_i;
|
|
|
|
c3_i mem_i;
|
|
|
|
u3_cs_control* con_u;
|
|
|
|
} u3_cs_patch;
|
|
|
|
|
|
|
|
/* u3_cs_image: memory segment, open file.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_cs_image {
|
|
|
|
c3_c* nam_c; // segment name
|
|
|
|
c3_i fid_i; // open file, or 0
|
|
|
|
c3_w pgs_w; // length in pages
|
|
|
|
} u3_cs_image;
|
|
|
|
|
|
|
|
/* u3_cs_pool: entire memory system.
|
|
|
|
*/
|
|
|
|
typedef struct _u3_cs_pool {
|
|
|
|
c3_c* cpu_c; // path to
|
|
|
|
c3_d evt_d; // last patch written at event
|
|
|
|
c3_w dit_w[u3_cc_pages >> 5]; // touched since last save
|
|
|
|
u3_cs_image nor_u; // north segment
|
|
|
|
u3_cs_image sou_u; // south segment
|
|
|
|
} u3_cs_pool;
|
|
|
|
|
|
|
|
|
|
|
|
/** Globals.
|
|
|
|
**/
|
|
|
|
/* u3_Pool / u3P: global memory control.
|
|
|
|
*/
|
|
|
|
c3_global u3_cs_pool u3_Pool;
|
|
|
|
# define u3P u3_Pool
|
|
|
|
|
|
|
|
|
2014-09-22 20:10:57 +04:00
|
|
|
/** Functions.
|
|
|
|
**/
|
|
|
|
/* u3_ce_fault(): handle a memory event with libsigsegv protocol.
|
|
|
|
*/
|
2014-09-23 21:11:59 +04:00
|
|
|
c3_i
|
2014-09-22 20:10:57 +04:00
|
|
|
u3_ce_fault(void* adr_v, c3_i ser_i);
|
|
|
|
|
2014-09-23 21:11:59 +04:00
|
|
|
/* u3_ce_save():
|
2014-09-22 20:10:57 +04:00
|
|
|
*/
|
2014-09-23 21:11:59 +04:00
|
|
|
void
|
|
|
|
u3_ce_save(void);
|
2014-09-22 20:10:57 +04:00
|
|
|
|
2014-09-23 21:11:59 +04:00
|
|
|
/* u3_ce_boot(): start the memory system.
|
2014-09-22 20:10:57 +04:00
|
|
|
*/
|
2014-09-23 21:11:59 +04:00
|
|
|
void
|
2014-10-31 00:40:05 +03:00
|
|
|
u3_ce_boot(c3_o nuu_o, c3_o bug_o, c3_c* cpu_c);
|
2014-09-29 01:56:17 +04:00
|
|
|
|
|
|
|
/* u3_ce_init(): start the environment, with/without checkpointing.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_ce_init(c3_o chk_o);
|
2014-10-09 06:20:57 +04:00
|
|
|
|
2014-10-12 10:40:31 +04:00
|
|
|
/* u3_ce_grab(): garbage-collect the world, plus extra roots.
|
2014-10-09 06:20:57 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-10-12 10:40:31 +04:00
|
|
|
u3_ce_grab(c3_c* cap_c, u3_noun som, ...); // terminate with u3_none
|
2014-11-01 01:36:01 +03:00
|
|
|
|
2014-11-02 01:13:18 +03:00
|
|
|
/* u3_ce_dirty(): count dirty pages.
|
|
|
|
*/
|
|
|
|
c3_w
|
|
|
|
u3_ce_dirty(void);
|
2014-11-05 03:29:08 +03:00
|
|
|
|