aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/cpuctl
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2014-06-20 13:13:38 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2014-06-20 13:13:38 +0000
commitcef789cd618d93bc428d17df34ff87f93a9db46e (patch)
treea96da53e534b64bb12c3124eaf81076623891ae1 /sys/dev/cpuctl
parent8c0ddf28da360b43617f9a7130198b61c15b8173 (diff)
downloadsrc-cef789cd618d93bc428d17df34ff87f93a9db46e.tar.gz
src-cef789cd618d93bc428d17df34ff87f93a9db46e.zip
Restore the ABI of the cpuctl(4) ioctl request CPUCTL_CPUID, use
separate argument structure with added level_type field for CPUID_CPUID_COUNT request. Reviewed by: attilio (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=267673
Diffstat (limited to 'sys/dev/cpuctl')
-rw-r--r--sys/dev/cpuctl/cpuctl.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/dev/cpuctl/cpuctl.c b/sys/dev/cpuctl/cpuctl.c
index 63187bdc4b8b..9832933d0c91 100644
--- a/sys/dev/cpuctl/cpuctl.c
+++ b/sys/dev/cpuctl/cpuctl.c
@@ -69,7 +69,7 @@ static int cpuctl_do_msr(int cpu, cpuctl_msr_args_t *data, u_long cmd,
struct thread *td);
static int cpuctl_do_cpuid(int cpu, cpuctl_cpuid_args_t *data,
struct thread *td);
-static int cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_args_t *data,
+static int cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_count_args_t *data,
struct thread *td);
static int cpuctl_do_update(int cpu, cpuctl_update_args_t *data,
struct thread *td);
@@ -180,8 +180,8 @@ cpuctl_ioctl(struct cdev *dev, u_long cmd, caddr_t data,
ret = cpuctl_do_update(cpu, (cpuctl_update_args_t *)data, td);
break;
case CPUCTL_CPUID_COUNT:
- ret = cpuctl_do_cpuid_count(cpu, (cpuctl_cpuid_args_t *)data,
- td);
+ ret = cpuctl_do_cpuid_count(cpu,
+ (cpuctl_cpuid_count_args_t *)data, td);
break;
default:
ret = EINVAL;
@@ -195,7 +195,8 @@ fail:
* Actually perform cpuid operation.
*/
static int
-cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_args_t *data, struct thread *td)
+cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_count_args_t *data,
+ struct thread *td)
{
int is_bound = 0;
int oldcpu;
@@ -218,10 +219,15 @@ cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_args_t *data, struct thread *td)
static int
cpuctl_do_cpuid(int cpu, cpuctl_cpuid_args_t *data, struct thread *td)
{
+ cpuctl_cpuid_count_args_t cdata;
+ int error;
+ cdata.level = data->level;
/* Override the level type. */
- data->level_type = 0;
- return (cpuctl_do_cpuid_count(cpu, data, td));
+ cdata.level_type = 0;
+ error = cpuctl_do_cpuid_count(cpu, &cdata, td);
+ bcopy(cdata.data, data->data, sizeof(data->data)); /* Ignore error */
+ return (error);
}
/*