X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_chkpt_stores.h;h=505ef8cb9fedcac60df35759c739643e43e89eba;hb=33bf43b34feba36dcbfa47f8f559e5862f531393;hp=3e8fe1d8dcd86947ca565fb65232881f46a1309d;hpb=6ee36e0a7e4585bd0e4235eeb60644fffe230af3;p=palacios-OLD.git diff --git a/palacios/src/palacios/vmm_chkpt_stores.h b/palacios/src/palacios/vmm_chkpt_stores.h index 3e8fe1d..505ef8c 100644 --- a/palacios/src/palacios/vmm_chkpt_stores.h +++ b/palacios/src/palacios/vmm_chkpt_stores.h @@ -20,6 +20,7 @@ #ifndef __VMM_CHKPT_STORES_H__ #define __VMM_CHKPT_STORES_H__ +//#include /* * This is a place holder to ensure that the _v3_extensions section gets created by gcc @@ -30,20 +31,97 @@ static struct {} null_store __attribute__((__used__)) \ #define register_chkpt_store(store) \ - static struct v3_chkpt_interface * _v3_store_#store \ + static struct chkpt_interface * _v3_store_##store \ __attribute__((used)) \ __attribute__((unused, __section__("_v3_chkpt_stores"), \ aligned(sizeof(addr_t)))) \ - = store; + = &store; + + + + + +#include + + +static void * debug_open_chkpt(char * url, chkpt_mode_t mode) { + + if (mode == LOAD) { + V3_Print("Cannot load from debug store\n"); + return NULL; + } + + V3_Print("Opening Checkpoint: %s\n", url); + + return (void *)1; +} + + + +static int debug_close_chkpt(void * store_data) { + V3_Print("Closing Checkpoint\n"); + return 0; +} + +static void * debug_open_ctx(void * store_data, + void * parent_ctx, + char * name) { + V3_Print("[%s]\n", name); + return (void *)1; +} + +static int debug_close_ctx(void * store_data, void * ctx) { + V3_Print("[CLOSE]\n"); + return 0; +} + +static int debug_save(void * store_data, void * ctx, + char * tag, uint64_t len, void * buf) { + V3_Print("%s:\n", tag); + + if (len > 100) { + len = 100; + } + + v3_dump_mem(buf, len); + + return 0; +} + +static int debug_load(void * store_data, void * ctx, + char * tag, uint64_t len, void * buf) { + V3_Print("Loading not supported !!!\n"); + return 0; +} + + +static struct chkpt_interface debug_store = { + .name = "DEBUG", + .open_chkpt = debug_open_chkpt, + .close_chkpt = debug_close_chkpt, + .open_ctx = debug_open_ctx, + .close_ctx = debug_close_ctx, + .save = debug_save, + .load = debug_load +}; + +register_chkpt_store(debug_store); #ifdef V3_CONFIG_KEYED_STREAMS -#include +#include -static void * keyed_stream_open_chkpt(char * url) { - return v3_keyed_stream_open(url, V3_KS_WR_ONLY_CREATE); +static void * keyed_stream_open_chkpt(char * url, chkpt_mode_t mode) { + if (mode == SAVE) { + return v3_keyed_stream_open(url, V3_KS_WR_ONLY_CREATE); + } else if (mode == LOAD) { + return v3_keyed_stream_open(url, V3_KS_RD_ONLY); + } + + // Shouldn't get here + return NULL; } @@ -72,12 +150,12 @@ static int keyed_stream_close_ctx(void * store_data, void * ctx) { return 0; } -static uint64_t keyed_stream_save(void * store_data, void * ctx, +static int keyed_stream_save(void * store_data, void * ctx, char * tag, uint64_t len, void * buf) { return v3_keyed_stream_write_key(store_data, ctx, buf, len); } -static uint64_t keyed_stream_load(void * store_data, void * ctx, +static int keyed_stream_load(void * store_data, void * ctx, char * tag, uint64_t len, void * buf) { return v3_keyed_stream_read_key(store_data, ctx, buf, len); } @@ -93,7 +171,7 @@ static struct chkpt_interface keyed_stream_store = { .load = keyed_stream_load }; -register_chkpt_store(&keyed_stream_store); +register_chkpt_store(keyed_stream_store); @@ -104,4 +182,5 @@ register_chkpt_store(&keyed_stream_store); + #endif