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

Add save/restore state #18

Closed
copy opened this issue Jul 18, 2014 · 1 comment
Closed

Add save/restore state #18

copy opened this issue Jul 18, 2014 · 1 comment

Comments

@copy
Copy link
Owner

copy commented Jul 18, 2014

Saving and restoring the state of the emulator would be a nice feature to have, it could be used to skip long boot times if the memory size isn't too big.

The state could be captured by saving: The memory, the CPU state, and the state of all devices. Before doing so, all transfers between the emulator and the outside world (such as XHRs) need to have finished.

copy added a commit that referenced this issue Nov 2, 2014
Everything that is valid json plus arraybuffers and arraybuffer-views
can be restored automatically (without making changes to other code).
Properties that should not be part of the state buffer needed to be
annotated using a magic `_state_skip` property. Shared arraybuffer views
are broken during restoration and also need to be annotated. Adapters
are not (and should never be) saved.

Current limitations:
- Before restoring, the cpu needs to be initialised with the original
  settings. This is not a hard requirement and can be fixed later.
- Pending asynchronous operations are lost. It's a good idea to pause
  the cpu before saving the state.
@copy
Copy link
Owner Author

copy commented Jan 13, 2015

This feature is now stable (despite being fragile to code changes) and available, see https://github.com/copy/v86/blob/master/docs/api.md#restore_statearraybuffer-state

@copy copy closed this as completed Jan 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant