Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkpoint: allow to provide an all-in-one workload without restorer #395

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/checkpoint/serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void Serializer::serializePMem(uint64_t inst_count) {
const size_t PMEM_SIZE = MEMORY_SIZE;
uint8_t *pmem = get_pmem();

assert(restorer);
if (restorer) {
FILE *restore_fp = fopen(restorer, "rb");
if (!restore_fp) {
xpanic("Cannot open restorer %s\n", restorer);
Expand All @@ -82,6 +82,7 @@ void Serializer::serializePMem(uint64_t inst_count) {
assert(restorer_size == fread(pmem, 1, restorer_size, restore_fp));
fclose(restore_fp);
Log("Put gcpt restorer %s to start of pmem", restorer);
}

string filepath;

Expand Down
21 changes: 12 additions & 9 deletions src/monitor/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,23 +354,26 @@ void init_monitor(int argc, char *argv[]) {
} else if (checkpoint_state != NoCheckpoint) {
// boot: jump to restorer --> restorer jump to bbl
assert(img_file != NULL);
assert(restorer != NULL);

bbl_start = RESET_VECTOR + CONFIG_BBL_OFFSET_WITH_CPT;
bbl_start = RESET_VECTOR;

long restorer_size = load_img(restorer, "Gcpt restorer form cmdline", RESET_VECTOR, 0xf00);
long restorer_size = 0;
if (restorer != NULL) {
restorer_size = load_img(restorer, "Gcpt restorer form cmdline", RESET_VECTOR, 0xf00);
bbl_start += CONFIG_BBL_OFFSET_WITH_CPT;
}
long bbl_size = load_img(img_file, "image (bbl/bare metal app) from cmdline", bbl_start, 0);
img_size = restorer_size + bbl_size;

} else if (profiling_state == SimpointProfiling) {
bbl_start = RESET_VECTOR;
long restorer_size = 0;
if (restorer != NULL) {
Log("You are providing a gcpt restorer when doing simpoing profiling, "
"If you didn't link the program correctly, this will corrupt your memory/program.");
bbl_start = RESET_VECTOR + CONFIG_BBL_OFFSET_WITH_CPT;
long restorer_size = load_img(restorer, "Gcpt restorer form cmdline", RESET_VECTOR, 0xf00);
long bbl_size = load_img(img_file, "image (bbl/bare metal app) from cmdline", bbl_start, 0);
img_size = restorer_size + bbl_size;
restorer_size = load_img(restorer, "Gcpt restorer form cmdline", RESET_VECTOR, 0xf00);
bbl_start += CONFIG_BBL_OFFSET_WITH_CPT;
}
long bbl_size = load_img(img_file, "image (bbl/bare metal app) from cmdline", bbl_start, 0);
img_size = restorer_size + bbl_size;

} else {
if (restorer != NULL) {
Expand Down
Loading