Skip to content

Commit e08c491

Browse files
committed
ref(core/remio): replaced remio_create_request ret val by an out arg
Since the size of struct remio_request is not just a couple of argumetns and might surpasse the number of return registers in a given ABI, ideally the return value would be an output argument. Signed-off-by: João Peixoto <[email protected]>
1 parent 0d56eac commit e08c491

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/core/remio.c

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -151,26 +151,23 @@ OBJPOOL_ALLOC(remio_request_event_pool, struct remio_request_event,
151151
/**
152152
* @brief Creates a new Remote I/O request based on the MMIO access information
153153
* @param acc Pointer to the emul_access structure containing the MMIO access information
154-
* @return Returns the Remote I/O request
154+
* @param request Pointer to the Remote I/O request
155155
*/
156-
static struct remio_request remio_create_request(struct emul_access* acc)
156+
static void remio_create_request(struct emul_access* acc, struct remio_request* request)
157157
{
158-
struct remio_request request;
159-
request.addr = acc->addr;
160-
request.reg = acc->reg;
161-
request.access_width = acc->width;
162-
request.state = REMIO_STATE_PENDING;
158+
request->addr = acc->addr;
159+
request->reg = acc->reg;
160+
request->access_width = acc->width;
161+
request->state = REMIO_STATE_PENDING;
163162

164163
if (acc->write) {
165164
long unsigned int value = vcpu_readreg(cpu()->vcpu, acc->reg);
166-
request.op = REMIO_HYP_WRITE;
167-
request.value = value;
165+
request->op = REMIO_HYP_WRITE;
166+
request->value = value;
168167
} else {
169-
request.op = REMIO_HYP_READ;
170-
request.value = 0;
168+
request->op = REMIO_HYP_READ;
169+
request->value = 0;
171170
}
172-
173-
return request;
174171
}
175172

176173
/**
@@ -659,6 +656,7 @@ long int remio_hypercall(unsigned long arg0, unsigned long arg1, unsigned long a
659656
bool remio_mmio_emul_handler(struct emul_access* acc)
660657
{
661658
struct remio_device* device = NULL;
659+
struct remio_request request = { 0 };
662660

663661
/** Find the Remote I/O device based on the MMIO access address */
664662
device = remio_find_vm_dev_by_addr(cpu()->vcpu->vm, acc->addr);
@@ -667,7 +665,7 @@ bool remio_mmio_emul_handler(struct emul_access* acc)
667665
}
668666

669667
/** Create a new Remote I/O request based on the MMIO access information */
670-
struct remio_request request = remio_create_request(acc);
668+
remio_create_request(acc, &request);
671669

672670
/** Create a new Remote I/O request event */
673671
struct remio_request_event* event = remio_create_event();

0 commit comments

Comments
 (0)