checkpoint.h
3.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
* Copyright (C) 1996-1998 by the Board of Trustees
* of Leland Stanford Junior University.
*
* This file is part of the SimOS distribution.
* See LICENSE file for terms of the license.
*
*/
#ifndef SIMCPT_H
#define SIMCPT_H
#include <stdio.h>
#include "simtypes.h"
typedef enum cptmode {CPT_SAVE = 0, CPT_RESTORE} CptMode;
typedef enum cptcompression {NO_COMPRESSION = 0, GZIP, COMPRESS, NUM_COMPRESS_TYPES} CptCompression;
typedef enum cptcompressmode {BIN_FILE_ONLY, CPT_FILE_ONLY, BOTH_FILES} CptCompressMode;
struct cptgroup;
typedef struct cptdescriptor {
CptMode mode;
struct cptgroup *group;
} CptDescriptor;
typedef struct cptversion {
int ver; /* Current version */
int sub; /* Current sub-version */
int saveVer; /* Desired save version */
int saveSub; /* Desired save sub-version */
} CptVersion;
/* Default checkpoint save version numbers */
#define CPT_VERSION 4
#define CPT_SUB_VERSION 0
typedef int (CptCallback)(CptDescriptor *);
#define NO_INDEX -1
#define MAX_PATH_LENGTH 100
void Simcpt_Init(void);
void Simcpt_Register(char *tag, CptCallback callback, CPUType cputype);
void Simcpt_UseCompression(char *tag, CptCompression compress, CptCompressMode mode);
bool Simcpt_IsRemote(void);
void Simcpt_Checkpoint(CptMode mode, char *name);
int Simcpt_Restore(char *tag);
void Simcpt_Begin(CptDescriptor *cptd);
void Simcpt_End(CptDescriptor *cptd);
int Simcpt_GetMemoryCptFile(void);
int Simcpt_CptComment(CptDescriptor *cptd, char *comment);
int Simcpt_CptInt(CptDescriptor *cptd, char *name, int i1, int i2, int *val);
int Simcpt_CptChar(CptDescriptor *cptd, char *name, int i1, int i2, char *val);
int Simcpt_CptLong(CptDescriptor *cptd, char *name, int i1, int i2, long *val);
int Simcpt_CptULL(CptDescriptor *cptd, char *name, int i1, int i2, uint64 *val);
int Simcpt_CptUint(CptDescriptor *cptd, char *name, int i1, int i2, uint *val);
int Simcpt_CptUlong(CptDescriptor *cptd, char *name, int i1, int i2, unsigned long *val);
int Simcpt_CptUchar(CptDescriptor *cptd, char *name, int i1, int i2, unsigned char *val);
int Simcpt_CptHex(CptDescriptor *cptd, char *name, int i1, int i2, uint *val);
int Simcpt_CptString(CptDescriptor *cptd, char *name, int i1, int i2, char **val);
int Simcpt_CptBlock(CptDescriptor *cptd, char *name, int i1, int i2, void *val, int size, int outputFD);
int Simcpt_CptParamInt(CptDescriptor *cptd, char *name, int i1, int i2, int *paramAddr);
int Simcpt_OptionalInteger(CptDescriptor *cptd, char *name, int i1, int i2, int64 val);
int Simcpt_OptionalString(CptDescriptor *cptd, char *name, int i1, int i2, char *val);
void Simcpt_Preread_Numcells(void);
void Simcpt_Preread_Numether(void);
#define Simcpt_OptionalInt(CPTD,NAME,I1,I2,VAL) \
Simcpt_OptionalInteger(CPTD,NAME,I1,I2,(int64)VAL)
#define Simcpt_OptionalChar(CPTD,NAME,I1,I2,VAL) \
Simcpt_OptionalInteger(CPTD,NAME,I1,I2,(int64)VAL)
#define Simcpt_OptionalLong(CPTD,NAME,I1,I2,VAL) \
Simcpt_OptionalInteger(CPTD,NAME,I1,I2,(int64)VAL)
#define Simcpt_OptionalULL(CPTD,NAME,I1,I2,VAL) \
Simcpt_OptionalInteger(CPTD,NAME,I1,I2,(int64)VAL)
#define Simcpt_OptionalUint(CPTD,NAME,I1,I2,VAL) \
Simcpt_OptionalInteger(CPTD,NAME,I1,I2,(int64)VAL)
#define Simcpt_OptionalUchar(CPTD,NAME,I1,I2,VAL) \
Simcpt_OptionalInteger(CPTD,NAME,I1,I2,(int64)VAL)
#define Simcpt_OptionalHex(CPTD,NAME,I1,I2,VAL) \
Simcpt_OptionalInteger(CPTD,NAME,I1,I2,(int64)VAL)
int Simcpt_GetMemoryCptFile( void );
int Simcpt_CanMmapMemoryCheckpoint( void );
extern char *CheckpointID;
extern int CheckpointCompress;
extern char *cptSaveDir;
extern char cptName[MAX_PATH_LENGTH];
extern CptVersion cptVersion;
#endif /* SIMCPT_H */