From 871da2aa80687142bec00ef7c1112253c76c32bb Mon Sep 17 00:00:00 2001 From: Ot ten Thije Date: Mon, 20 Sep 2010 10:29:22 +0100 Subject: Added state snapshot support for QemuD. With this patch, both modem and sensor functionality are correctly restored when a state snapshot is loaded. This was not the case previously because communication with either of these services is done using the qemud daemon, which did not support snapshots. The boot-properties and charpipe services have no specific save/load functionality yet, since the framework itself should be reviewed first. Adding support for bootproperties should not be difficult though, and charpipe may not need it. For a description of the high-level process for saving and loading, consult section IV "State snapshots" in docs/ANDROID-QEMUD.TXT. Change-Id: I5b06d88b911ca096e78060163174904c48a01c66 --- savevm.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'savevm.c') diff --git a/savevm.c b/savevm.c index 458e31d..8f0d8f1 100644 --- a/savevm.c +++ b/savevm.c @@ -724,6 +724,22 @@ int qemu_get_struct(QEMUFile* f, const QField* fields, void* s) return 0; } +/* write a float to file */ +void qemu_put_float(QEMUFile *f, float v) +{ + uint8_t *bytes = (uint8_t*) &v; + qemu_put_buffer(f, bytes, sizeof(float)); +} + +/* read a float from file */ +float qemu_get_float(QEMUFile *f) +{ + uint8_t bytes[sizeof(float)]; + qemu_get_buffer(f, bytes, sizeof(float)); + + return *((float*) bytes); +} + typedef struct SaveStateEntry { char idstr[256]; int instance_id; -- cgit v1.1