mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-06-20 13:27:47 +00:00
turn cpu_context_size() into static function
This commit is contained in:
parent
bfa51bb5dc
commit
8f99d20695
4
uc.c
4
uc.c
|
@ -1156,8 +1156,7 @@ uc_err uc_query(uc_engine *uc, uc_query_type type, size_t *result)
|
||||||
return UC_ERR_OK;
|
return UC_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t cpu_context_size(uc_arch arch, uc_mode mode);
|
static size_t cpu_context_size(uc_arch arch, uc_mode mode)
|
||||||
size_t cpu_context_size(uc_arch arch, uc_mode mode)
|
|
||||||
{
|
{
|
||||||
// each of these constants is defined by offsetof(CPUXYZState, tlb_table)
|
// each of these constants is defined by offsetof(CPUXYZState, tlb_table)
|
||||||
// tbl_table is the first entry in the CPU_COMMON macro, so it marks the end
|
// tbl_table is the first entry in the CPU_COMMON macro, so it marks the end
|
||||||
|
@ -1178,6 +1177,7 @@ uc_err uc_context_alloc(uc_engine *uc, uc_context **context)
|
||||||
{
|
{
|
||||||
struct uc_context **_context = context;
|
struct uc_context **_context = context;
|
||||||
size_t size = cpu_context_size(uc->arch, uc->mode);
|
size_t size = cpu_context_size(uc->arch, uc->mode);
|
||||||
|
|
||||||
*_context = malloc(size + sizeof(uc_context));
|
*_context = malloc(size + sizeof(uc_context));
|
||||||
if (*_context) {
|
if (*_context) {
|
||||||
(*_context)->size = size;
|
(*_context)->size = size;
|
||||||
|
|
Loading…
Reference in a new issue