Fix netbsd32 emulation for clockctl_ntp_adjtime.
The ioctl args reference a timex structure that needs to be transformed to 64bit layout and back. The 32bit ioctl definition was wrong for mips, as register_t is 64bit for N32 abi.
This commit is contained in:
parent
1445630bb9
commit
ac0b03959b
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: netbsd32_ioctl.c,v 1.84 2016/07/13 11:11:53 jmcneill Exp $ */
|
||||
/* $NetBSD: netbsd32_ioctl.c,v 1.85 2016/11/12 16:06:04 mlelstv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 2001 Matthew R. Green
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.84 2016/07/13 11:11:53 jmcneill Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.85 2016/11/12 16:06:04 mlelstv Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -83,6 +83,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.84 2016/07/13 11:11:53 jmcneill
|
||||
#include <compat/netbsd32/netbsd32.h>
|
||||
#include <compat/netbsd32/netbsd32_ioctl.h>
|
||||
#include <compat/netbsd32/netbsd32_syscallargs.h>
|
||||
#include <compat/netbsd32/netbsd32_conv.h>
|
||||
|
||||
#include <dev/vndvar.h>
|
||||
|
||||
@ -921,6 +922,29 @@ netbsd32_from_devrescanargs(
|
||||
NETBSD32PTR32(s32p->locators, p->locators);
|
||||
}
|
||||
|
||||
static int
|
||||
netbsd32_do_clockctl_ntp_adjtime(struct clockctl_ntp_adjtime *args)
|
||||
{
|
||||
|
||||
struct netbsd32_timex ntv32;
|
||||
struct timex ntv;
|
||||
int error;
|
||||
|
||||
error = copyin(args->tp, &ntv32, sizeof(ntv32));
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
netbsd32_to_timex(&ntv32, &ntv);
|
||||
ntp_adjtime1(&ntv);
|
||||
netbsd32_from_timex(&ntv, &ntv32);
|
||||
|
||||
error = copyout(&ntv32, args->tp, sizeof(ntv));
|
||||
if (error == 0)
|
||||
args->retval = ntp_timestatus();
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
* main ioctl syscall.
|
||||
*
|
||||
@ -1291,8 +1315,26 @@ netbsd32_ioctl(struct lwp *l, const struct netbsd32_ioctl_args *uap, register_t
|
||||
IOCTL_STRUCT_CONV_TO(CLOCKCTL_CLOCK_SETTIME,
|
||||
clockctl_clock_settime);
|
||||
case CLOCKCTL_NTP_ADJTIME32:
|
||||
IOCTL_STRUCT_CONV_TO(CLOCKCTL_NTP_ADJTIME,
|
||||
clockctl_ntp_adjtime);
|
||||
{
|
||||
size = IOCPARM_LEN(CLOCKCTL_NTP_ADJTIME);
|
||||
if (size > sizeof(stkbuf))
|
||||
data = memp = kmem_alloc(size, KM_SLEEP);
|
||||
else
|
||||
data = (void *)stkbuf;
|
||||
|
||||
netbsd32_to_clockctl_ntp_adjtime(
|
||||
(const struct netbsd32_clockctl_ntp_adjtime *)data32,
|
||||
(struct clockctl_ntp_adjtime *)data,
|
||||
CLOCKCTL_NTP_ADJTIME);
|
||||
error = netbsd32_do_clockctl_ntp_adjtime(
|
||||
(struct clockctl_ntp_adjtime *)data);
|
||||
netbsd32_from_clockctl_ntp_adjtime(
|
||||
(const struct clockctl_ntp_adjtime *)data,
|
||||
(struct netbsd32_clockctl_ntp_adjtime *)data32,
|
||||
CLOCKCTL_NTP_ADJTIME);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case KIOCGSYMBOL32:
|
||||
IOCTL_STRUCT_CONV_TO(KIOCGSYMBOL, ksyms_gsymbol);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: netbsd32_ioctl.h,v 1.54 2016/07/13 11:11:53 jmcneill Exp $ */
|
||||
/* $NetBSD: netbsd32_ioctl.h,v 1.55 2016/11/12 16:06:04 mlelstv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 2001 Matthew R. Green
|
||||
@ -552,7 +552,7 @@ struct netbsd32_clockctl_clock_settime {
|
||||
|
||||
struct netbsd32_clockctl_ntp_adjtime {
|
||||
netbsd32_timexp_t tp;
|
||||
/* register_t */ int32_t retval;
|
||||
register32_t retval;
|
||||
};
|
||||
|
||||
#define CLOCKCTL_NTP_ADJTIME32 _IOWR('C', 0x8, \
|
||||
|
Loading…
Reference in New Issue
Block a user