int sys_sysarch(struct proc *p, void *v, register_t *retval) { struct sys_sysarch_args /* { syscallarg(int) op; syscallarg(void *) parms; } */ *uap = v; int error = 0; switch(SCARG(uap, op)) { #if defined(USER_LDT) && 0 case AMD64_GET_LDT: error = amd64_get_ldt(p, SCARG(uap, parms), retval); break; case AMD64_SET_LDT: error = amd64_set_ldt(p, SCARG(uap, parms), retval); break; #endif case AMD64_IOPL: error = amd64_iopl(p, SCARG(uap, parms), retval); break; #if 0 case AMD64_GET_IOPERM: error = amd64_get_ioperm(p, SCARG(uap, parms), retval); break; case AMD64_SET_IOPERM: error = amd64_set_ioperm(p, SCARG(uap, parms), retval); break; #endif #ifdef MTRR case AMD64_GET_MTRR: error = amd64_get_mtrr(p, SCARG(uap, parms), retval); break; case AMD64_SET_MTRR: error = amd64_set_mtrr(p, SCARG(uap, parms), retval); break; #endif #if defined(PERFCTRS) && 0 case AMD64_PMC_INFO: error = pmc_info(p, SCARG(uap, parms), retval); break; case AMD64_PMC_STARTSTOP: error = pmc_startstop(p, SCARG(uap, parms), retval); break; case AMD64_PMC_READ: error = pmc_read(p, SCARG(uap, parms), retval); break; #endif default: error = EINVAL; break; } return (error); }
void xf86DisableIO() { if (!ExtendedEnabled) return; if (amd64_iopl(FALSE) == 0) { ExtendedEnabled = FALSE; } /* Otherwise, the X server has revoqued its root uid, and thus cannot give up IO privileges any more */ return; }
void xf86EnableIO() { if (ExtendedEnabled) return; if (amd64_iopl(TRUE) < 0) { #ifndef __OpenBSD__ FatalError("%s: Failed to set IOPL for extended I/O", "xf86EnableIO"); #else FatalError("%s: Failed to set IOPL for extended I/O\n%s", "xf86EnableIO", SYSCTL_MSG); #endif } ExtendedEnabled = TRUE; return; }
Bool xf86EnableIO() { if (ExtendedEnabled) return TRUE; if (amd64_iopl(TRUE) < 0) { #ifndef __OpenBSD__ xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O", "xf86EnableIO"); #else xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O\n%s", "xf86EnableIO", SYSCTL_MSG); #endif return FALSE; } ExtendedEnabled = TRUE; return TRUE; }