cpuctl.c (da378661c0b3c96c353784df17f6d8d8c791531f) cpuctl.c (6bfa9a2d66dd0e00182017d6741d44e54d0b2cca)
1/*-
2 * Copyright (c) 2006-2008 Stanislav Sedov <stas@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 130 unchanged lines hidden (view full) ---

139 thread_unlock(td);
140}
141
142int
143cpuctl_ioctl(struct cdev *dev, u_long cmd, caddr_t data,
144 int flags, struct thread *td)
145{
146 int ret;
1/*-
2 * Copyright (c) 2006-2008 Stanislav Sedov <stas@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 130 unchanged lines hidden (view full) ---

139 thread_unlock(td);
140}
141
142int
143cpuctl_ioctl(struct cdev *dev, u_long cmd, caddr_t data,
144 int flags, struct thread *td)
145{
146 int ret;
147 int cpu = minor(dev);
147 int cpu = dev2unit(dev);
148
149 if (cpu >= mp_ncpus || !cpu_enabled(cpu)) {
150 DPRINTF("[cpuctl,%d]: bad cpu number %d\n", __LINE__, cpu);
151 return (ENXIO);
152 }
153 /* Require write flag for "write" requests. */
154 if ((cmd == CPUCTL_WRMSR || cmd == CPUCTL_UPDATE) &&
155 ((flags & FWRITE) == 0))

--- 228 unchanged lines hidden (view full) ---

384}
385
386int
387cpuctl_open(struct cdev *dev, int flags, int fmt __unused, struct thread *td)
388{
389 int ret = 0;
390 int cpu;
391
148
149 if (cpu >= mp_ncpus || !cpu_enabled(cpu)) {
150 DPRINTF("[cpuctl,%d]: bad cpu number %d\n", __LINE__, cpu);
151 return (ENXIO);
152 }
153 /* Require write flag for "write" requests. */
154 if ((cmd == CPUCTL_WRMSR || cmd == CPUCTL_UPDATE) &&
155 ((flags & FWRITE) == 0))

--- 228 unchanged lines hidden (view full) ---

384}
385
386int
387cpuctl_open(struct cdev *dev, int flags, int fmt __unused, struct thread *td)
388{
389 int ret = 0;
390 int cpu;
391
392 cpu = minor(dev);
392 cpu = dev2unit(dev);
393 if (cpu >= mp_ncpus || !cpu_enabled(cpu)) {
394 DPRINTF("[cpuctl,%d]: incorrect cpu number %d\n", __LINE__,
395 cpu);
396 return (ENXIO);
397 }
398 if (flags & FWRITE)
399 ret = securelevel_gt(td->td_ucred, 0);
400 return (ret);

--- 45 unchanged lines hidden ---
393 if (cpu >= mp_ncpus || !cpu_enabled(cpu)) {
394 DPRINTF("[cpuctl,%d]: incorrect cpu number %d\n", __LINE__,
395 cpu);
396 return (ENXIO);
397 }
398 if (flags & FWRITE)
399 ret = securelevel_gt(td->td_ucred, 0);
400 return (ret);

--- 45 unchanged lines hidden ---