fix a libco issue that was breaking xorstate consistency
This commit is contained in:
parent
ba7543c19a
commit
dde953d612
|
@ -756,6 +756,19 @@ namespace BizHawk.Emulation.Cores.Waterbox
|
||||||
{
|
{
|
||||||
using (this.EnterExit())
|
using (this.EnterExit())
|
||||||
{
|
{
|
||||||
|
// if libco is used, the jmp_buf for the main cothread can have stack stuff in it.
|
||||||
|
// this isn't a problem, since we only savestate when the core is not running, and
|
||||||
|
// the next time it's run, that buf will be overridden again.
|
||||||
|
// but it breaks xor state verification, so when we seal, nuke it.
|
||||||
|
|
||||||
|
// this could be the responsibility of something else other than the PeRunner; I am not sure yet...
|
||||||
|
IImportResolver libco;
|
||||||
|
if (_exports.TryGetValue("libco.so", out libco))
|
||||||
|
{
|
||||||
|
Console.WriteLine("Calling co_clean()...");
|
||||||
|
Marshal.GetDelegateForFunctionPointer<Action>(libco.SafeResolve("co_clean"))();
|
||||||
|
}
|
||||||
|
|
||||||
_sealedheap.Seal();
|
_sealedheap.Seal();
|
||||||
foreach (var h in _heaps)
|
foreach (var h in _heaps)
|
||||||
{
|
{
|
||||||
|
|
Binary file not shown.
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -23,6 +24,10 @@ static void crash() {
|
||||||
assert(0); /* called only if cothread_t entrypoint returns */
|
assert(0); /* called only if cothread_t entrypoint returns */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void co_clean() {
|
||||||
|
memset(co_active_buffer, 0, sizeof(co_active_buffer));
|
||||||
|
}
|
||||||
|
|
||||||
cothread_t co_active() {
|
cothread_t co_active() {
|
||||||
if(!co_active_handle) co_active_handle = &co_active_buffer;
|
if(!co_active_handle) co_active_handle = &co_active_buffer;
|
||||||
return co_active_handle;
|
return co_active_handle;
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue