hw/i386/sgx: Have sgx_epc_get_section() return a boolean
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Thu, 7 Oct 2021 17:56:10 +0000 (19:56 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 13 Oct 2021 08:47:49 +0000 (10:47 +0200)
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>
hw/i386/sgx-stub.c
hw/i386/sgx.c
include/hw/i386/sgx-epc.h

index 3be9f5ca32c3e3d69a9b2149da93cbdcfcd7d164..45c473119ef06251419f8a469eb87dabbcdaea85 100644 (file)
@@ -20,7 +20,7 @@ void pc_machine_init_sgx_epc(PCMachineState *pcms)
     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();
 }
index e481e9358f1a687746de92e06393463dc99a99cb..29724ff8f086117452813dbc1b0beb9ae7b4fd6c 100644 (file)
@@ -115,13 +115,13 @@ SGXInfo *sgx_get_info(Error **errp)
     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());
     SGXEPCDevice *epc;
 
     if (pcms->sgx_epc.size == 0 || pcms->sgx_epc.nr_sections <= section_nr) {
-        return 1;
+        return true;
     }
 
     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;
     *size = memory_device_get_region_size(MEMORY_DEVICE(epc), &error_fatal);
 
-    return 0;
+    return false;
 }
 
 void pc_machine_init_sgx_epc(PCMachineState *pcms)
index 65a68ca753afa499e843e39bf4d454c2e6501587..a6a65be854f88db0e0c7b5d565a0d07f722f3d11 100644 (file)
@@ -55,7 +55,7 @@ typedef struct SGXEPCState {
     int nr_sections;
 } 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)
 {