On 8/4/25 3:56 PM, Philippe Mathieu-Daudé wrote:
On 4/8/25 16:23, Mohamed Mediouni wrote:
This allows edk2 to work, although u-boot is still not functional.

Signed-off-by: Mohamed Mediouni <moha...@unpredictable.fr>
---
   accel/whpx/whpx-common.c | 201 ++++++++++++++++++++++++++++-----------
   1 file changed, 147 insertions(+), 54 deletions(-)

diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c
index 86750c304d..752a57170e 100644
--- a/accel/whpx/whpx-common.c
+++ b/accel/whpx/whpx-common.c
@@ -258,89 +258,174 @@ void whpx_vcpu_kick(CPUState *cpu)
    * Memory support.
    */
-static void whpx_update_mapping(hwaddr start_pa, ram_addr_t size,
-                                void *host_va, int add, int rom,
-                                const char *name)
+ /* whpx_slot flags */
+#define WHPX_SLOT_LOG (1 << 0)
+typedef struct whpx_slot {
+    uint64_t start;
+    uint64_t size;
+    uint8_t *mem;
+    int slot_id;
+    uint32_t flags;
+    MemoryRegion *region;
+} whpx_slot;
+
+typedef struct WHPXState {
+    whpx_slot slots[32];

Please add a #define for this magic 32 value.


hvf code does not.
And the size is never used out of
whpx_state->num_slots = ARRAY_SIZE(whpx_state->slots), so there is no risk to have anything out of sync, thus no benefit to define this.

+    int num_slots;
+} WHPXState;
+
+ WHPXState *whpx_state;
+
+ struct mac_slot {
+    int present;
+    uint64_t size;
+    uint64_t gpa_start;
+    uint64_t gva;
+};
+
+struct mac_slot mac_slots[32];
Ditto.



Reply via email to