mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-05 13:56:09 +00:00
remove safety checks, for some reason
This commit is contained in:
parent
ea54204952
commit
80f35d3b2b
|
@ -247,10 +247,7 @@ struct uc_struct {
|
||||||
|
|
||||||
// Metadata stub for the variable-size cpu context used with uc_context_*()
|
// Metadata stub for the variable-size cpu context used with uc_context_*()
|
||||||
struct uc_context {
|
struct uc_context {
|
||||||
uc_arch arch;
|
|
||||||
uc_mode mode;
|
|
||||||
size_t size;
|
size_t size;
|
||||||
bool used;
|
|
||||||
char data[0];
|
char data[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
12
uc.c
12
uc.c
|
@ -1181,9 +1181,6 @@ uc_err uc_context_alloc(uc_engine *uc, uc_context **context)
|
||||||
*_context = malloc(size + sizeof(uc_context));
|
*_context = malloc(size + sizeof(uc_context));
|
||||||
if (*_context) {
|
if (*_context) {
|
||||||
(*_context)->size = size;
|
(*_context)->size = size;
|
||||||
(*_context)->arch = uc->arch;
|
|
||||||
(*_context)->mode = uc->mode;
|
|
||||||
(*_context)->used = false;
|
|
||||||
return UC_ERR_OK;
|
return UC_ERR_OK;
|
||||||
} else {
|
} else {
|
||||||
return UC_ERR_NOMEM;
|
return UC_ERR_NOMEM;
|
||||||
|
@ -1201,23 +1198,14 @@ UNICORN_EXPORT
|
||||||
uc_err uc_context_save(uc_engine *uc, uc_context *context)
|
uc_err uc_context_save(uc_engine *uc, uc_context *context)
|
||||||
{
|
{
|
||||||
struct uc_context *_context = context;
|
struct uc_context *_context = context;
|
||||||
if (_context->arch != uc->arch || _context->mode != uc->mode) {
|
|
||||||
return UC_ERR_ARG;
|
|
||||||
} else {
|
|
||||||
memcpy(_context->data, uc->cpu->env_ptr, _context->size);
|
memcpy(_context->data, uc->cpu->env_ptr, _context->size);
|
||||||
_context->used = true;
|
|
||||||
return UC_ERR_OK;
|
return UC_ERR_OK;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNICORN_EXPORT
|
UNICORN_EXPORT
|
||||||
uc_err uc_context_restore(uc_engine *uc, uc_context *context)
|
uc_err uc_context_restore(uc_engine *uc, uc_context *context)
|
||||||
{
|
{
|
||||||
struct uc_context *_context = context;
|
struct uc_context *_context = context;
|
||||||
if (_context->arch != uc->arch || _context->mode != uc->mode || !_context->used) {
|
|
||||||
return UC_ERR_ARG;
|
|
||||||
} else {
|
|
||||||
memcpy(uc->cpu->env_ptr, _context->data, _context->size);
|
memcpy(uc->cpu->env_ptr, _context->data, _context->size);
|
||||||
return UC_ERR_OK;
|
return UC_ERR_OK;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue