aboutsummaryrefslogtreecommitdiff
path: root/device
diff options
context:
space:
mode:
authorLuca Dariz <luca@orpolo.org>2023-01-16 11:58:54 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-01-18 02:24:59 +0100
commit194318d21f8ce386a186d90544d8a1d81aa222c2 (patch)
treec6d065446345e39ecd0d500cc5f5502c3dd4457f /device
parentc2886e18c39182084c11d85f18fff5f9f81360ef (diff)
downloadgnumach-194318d21f8ce386a186d90544d8a1d81aa222c2.tar.gz
gnumach-194318d21f8ce386a186d90544d8a1d81aa222c2.tar.bz2
gnumach-194318d21f8ce386a186d90544d8a1d81aa222c2.zip
update writev syscall signature with rpc types
* device/device_emul.h: write/writev: update trap argument types * device/ds_routines.c: update argument types and adjust copyin * device/ds_routines.h: write/writev: update trap argument type * include/device/device_types.h: add rpc_io_buf_vec_t type * kern/ipc_mig.c: write/writev: update trap argument type * kern/ipc_mig.h: Likewise Message-Id: <20230116105857.240210-5-luca@orpolo.org>
Diffstat (limited to 'device')
-rw-r--r--device/device_emul.h4
-rw-r--r--device/ds_routines.c22
-rw-r--r--device/ds_routines.h12
3 files changed, 21 insertions, 17 deletions
diff --git a/device/device_emul.h b/device/device_emul.h
index 957bd505..683fc802 100644
--- a/device/device_emul.h
+++ b/device/device_emul.h
@@ -56,9 +56,9 @@ struct device_emulation_ops
vm_size_t, ipc_port_t *, boolean_t);
void (*no_senders) (mach_no_senders_notification_t *);
io_return_t (*write_trap) (void *, dev_mode_t,
- recnum_t, vm_offset_t, vm_size_t);
+ rpc_recnum_t, rpc_vm_offset_t, rpc_vm_size_t);
io_return_t (*writev_trap) (void *, dev_mode_t,
- recnum_t, io_buf_vec_t *, vm_size_t);
+ rpc_recnum_t, rpc_io_buf_vec_t *, rpc_vm_size_t);
};
#endif /* _I386AT_DEVICE_EMUL_H_ */
diff --git a/device/ds_routines.c b/device/ds_routines.c
index 11589d63..07cfd85b 100644
--- a/device/ds_routines.c
+++ b/device/ds_routines.c
@@ -412,7 +412,7 @@ ds_notify (mach_msg_header_t *msg)
io_return_t
ds_device_write_trap (device_t dev, dev_mode_t mode,
- recnum_t recnum, vm_offset_t data, vm_size_t count)
+ rpc_recnum_t recnum, rpc_vm_offset_t data, rpc_vm_size_t count)
{
/* Refuse if device is dead or not completely open. */
if (dev == DEVICE_NULL)
@@ -427,7 +427,7 @@ ds_device_write_trap (device_t dev, dev_mode_t mode,
io_return_t
ds_device_writev_trap (device_t dev, dev_mode_t mode,
- recnum_t recnum, io_buf_vec_t *iovec, vm_size_t count)
+ rpc_recnum_t recnum, rpc_io_buf_vec_t *iovec, rpc_vm_size_t count)
{
/* Refuse if device is dead or not completely open. */
if (dev == DEVICE_NULL)
@@ -1713,7 +1713,7 @@ ds_trap_write_done(const io_req_t ior)
*/
static io_return_t
device_write_trap (mach_device_t device, dev_mode_t mode,
- recnum_t recnum, vm_offset_t data, vm_size_t data_count)
+ rpc_recnum_t recnum, rpc_vm_offset_t data, rpc_vm_size_t data_count)
{
io_req_t ior;
io_return_t result;
@@ -1752,7 +1752,7 @@ device_write_trap (mach_device_t device, dev_mode_t mode,
* Copy the data from user space.
*/
if (data_count > 0)
- copyin((void *)data, ior->io_data, data_count);
+ copyin((void*)(vm_offset_t)data, ior->io_data, data_count);
/*
* The ior keeps an extra reference for the device.
@@ -1781,7 +1781,7 @@ device_write_trap (mach_device_t device, dev_mode_t mode,
static io_return_t
device_writev_trap (mach_device_t device, dev_mode_t mode,
- recnum_t recnum, io_buf_vec_t *iovec, vm_size_t iocount)
+ rpc_recnum_t recnum, rpc_io_buf_vec_t *iovec, rpc_vm_size_t iocount)
{
io_req_t ior;
io_return_t result;
@@ -1799,11 +1799,15 @@ device_writev_trap (mach_device_t device, dev_mode_t mode,
*/
if (iocount > 16)
return KERN_INVALID_VALUE; /* lame */
- copyin(iovec,
- stack_iovec,
- iocount * sizeof(io_buf_vec_t));
- for (data_count = 0, i = 0; i < iocount; i++)
+
+ for (data_count = 0, i=0; i<iocount; i++) {
+ rpc_io_buf_vec_t riov;
+ if (copyin(iovec + i, &riov, sizeof(riov)))
+ return KERN_INVALID_ARGUMENT;
+ stack_iovec[i].data = riov.data;
+ stack_iovec[i].count = riov.count;
data_count += stack_iovec[i].count;
+ }
/*
* Get a buffer to hold the ioreq.
diff --git a/device/ds_routines.h b/device/ds_routines.h
index c0543cbc..48d85dd0 100644
--- a/device/ds_routines.h
+++ b/device/ds_routines.h
@@ -72,15 +72,15 @@ extern void io_done_thread(void) __attribute__ ((noreturn));
io_return_t ds_device_write_trap(
device_t dev,
dev_mode_t mode,
- recnum_t recnum,
- vm_offset_t data,
- vm_size_t count);
+ rpc_recnum_t recnum,
+ rpc_vm_offset_t data,
+ rpc_vm_size_t count);
io_return_t ds_device_writev_trap(
device_t dev,
dev_mode_t mode,
- recnum_t recnum,
- io_buf_vec_t *iovec,
- vm_size_t count);
+ rpc_recnum_t recnum,
+ rpc_io_buf_vec_t *iovec,
+ rpc_vm_size_t count);
#endif /* DS_ROUTINES_H */