mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-24 14:18:08 +00:00
remove safety checks, for some reason
This commit is contained in:
parent
ea54204952
commit
80f35d3b2b
2 changed files with 4 additions and 19 deletions
|
@ -247,10 +247,7 @@ struct uc_struct {
|
|||
|
||||
// Metadata stub for the variable-size cpu context used with uc_context_*()
|
||||
struct uc_context {
|
||||
uc_arch arch;
|
||||
uc_mode mode;
|
||||
size_t size;
|
||||
bool used;
|
||||
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));
|
||||
if (*_context) {
|
||||
(*_context)->size = size;
|
||||
(*_context)->arch = uc->arch;
|
||||
(*_context)->mode = uc->mode;
|
||||
(*_context)->used = false;
|
||||
return UC_ERR_OK;
|
||||
} else {
|
||||
return UC_ERR_NOMEM;
|
||||
|
@ -1201,23 +1198,14 @@ UNICORN_EXPORT
|
|||
uc_err uc_context_save(uc_engine *uc, uc_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);
|
||||
_context->used = true;
|
||||
return UC_ERR_OK;
|
||||
}
|
||||
}
|
||||
|
||||
UNICORN_EXPORT
|
||||
uc_err uc_context_restore(uc_engine *uc, uc_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);
|
||||
return UC_ERR_OK;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue