mirror of https://github.com/xemu-project/xemu.git
hw/i386/sgx: Have sgx_epc_get_section() return a boolean
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20211007175612.496366-3-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
a821186ec0
commit
05fc8db720
|
@ -20,7 +20,7 @@ void pc_machine_init_sgx_epc(PCMachineState *pcms)
|
||||||
memset(&pcms->sgx_epc, 0, sizeof(SGXEPCState));
|
memset(&pcms->sgx_epc, 0, sizeof(SGXEPCState));
|
||||||
}
|
}
|
||||||
|
|
||||||
int sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size)
|
bool sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size)
|
||||||
{
|
{
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,13 +115,13 @@ SGXInfo *sgx_get_info(Error **errp)
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size)
|
bool sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size)
|
||||||
{
|
{
|
||||||
PCMachineState *pcms = PC_MACHINE(qdev_get_machine());
|
PCMachineState *pcms = PC_MACHINE(qdev_get_machine());
|
||||||
SGXEPCDevice *epc;
|
SGXEPCDevice *epc;
|
||||||
|
|
||||||
if (pcms->sgx_epc.size == 0 || pcms->sgx_epc.nr_sections <= section_nr) {
|
if (pcms->sgx_epc.size == 0 || pcms->sgx_epc.nr_sections <= section_nr) {
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
epc = pcms->sgx_epc.sections[section_nr];
|
epc = pcms->sgx_epc.sections[section_nr];
|
||||||
|
@ -129,7 +129,7 @@ int sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size)
|
||||||
*addr = epc->addr;
|
*addr = epc->addr;
|
||||||
*size = memory_device_get_region_size(MEMORY_DEVICE(epc), &error_fatal);
|
*size = memory_device_get_region_size(MEMORY_DEVICE(epc), &error_fatal);
|
||||||
|
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pc_machine_init_sgx_epc(PCMachineState *pcms)
|
void pc_machine_init_sgx_epc(PCMachineState *pcms)
|
||||||
|
|
|
@ -55,7 +55,7 @@ typedef struct SGXEPCState {
|
||||||
int nr_sections;
|
int nr_sections;
|
||||||
} SGXEPCState;
|
} SGXEPCState;
|
||||||
|
|
||||||
int sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size);
|
bool sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size);
|
||||||
|
|
||||||
static inline uint64_t sgx_epc_above_4g_end(SGXEPCState *sgx_epc)
|
static inline uint64_t sgx_epc_above_4g_end(SGXEPCState *sgx_epc)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue