X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/0a7de7458d150b5d4dffc935ba399be265ef0a1a..94ff46dc2849db4d43eaaf144872decc522aafb4:/bsd/dev/i386/sysctl.c diff --git a/bsd/dev/i386/sysctl.c b/bsd/dev/i386/sysctl.c index 39dd11110..567c5817e 100644 --- a/bsd/dev/i386/sysctl.c +++ b/bsd/dev/i386/sysctl.c @@ -1027,9 +1027,34 @@ SYSCTL_INT(_machdep, OID_AUTO, fpsimd_fault_popc, CTLFLAG_KERN | CTLFLAG_RW | CTLFLAG_LOCKED, &fpsimd_fault_popc, 0, ""); -extern int allow_64bit_proc_LDT_ops; -SYSCTL_INT(_machdep, OID_AUTO, ldt64, +volatile int stop_spinning; +static int +spin_in_the_kernel(__unused struct sysctl_oid *oidp, __unused void *arg1, __unused int arg2, struct sysctl_req *req) +{ + int new = 0, old = 0, changed = 0, error; + + error = sysctl_io_number(req, old, sizeof(int), &new, &changed); + if (error == 0 && changed) { + stop_spinning = FALSE; + while (stop_spinning == FALSE) { + __builtin_ia32_pause(); + } + } else if (error == 0) { + stop_spinning = TRUE; + } + + return error; +} + +SYSCTL_PROC(_machdep_misc, OID_AUTO, spin_forever, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_LOCKED | CTLFLAG_MASKED, + 0, 0, + spin_in_the_kernel, "I", "Spin forever"); + + +extern int traptrace_enabled; +SYSCTL_INT(_machdep_misc, OID_AUTO, traptrace_enabled, CTLFLAG_KERN | CTLFLAG_RW | CTLFLAG_LOCKED, - &allow_64bit_proc_LDT_ops, 0, ""); + &traptrace_enabled, 0, "Enabled/disable trap trace"); #endif /* DEVELOPMENT || DEBUG */