Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/amd64/machdep.c
Show First 20 Lines • Show All 2,591 Lines • ▼ Show 20 Lines | |||||
clear_pcb_flags(struct pcb *pcb, const u_int flags) | clear_pcb_flags(struct pcb *pcb, const u_int flags) | ||||
{ | { | ||||
__asm __volatile("andl %1,%0" | __asm __volatile("andl %1,%0" | ||||
: "=m" (pcb->pcb_flags) : "ir" (~flags), "m" (pcb->pcb_flags) | : "=m" (pcb->pcb_flags) : "ir" (~flags), "m" (pcb->pcb_flags) | ||||
: "cc", "memory"); | : "cc", "memory"); | ||||
} | } | ||||
/* | |||||
* Enable and restore kernel text write permissions. | |||||
* Callers must ensure that disable_wp()/restore_wp() are executed | |||||
* without rescheduling on the same core. | |||||
*/ | |||||
bool | |||||
disable_wp(void) | |||||
{ | |||||
u_int cr0; | |||||
cr0 = rcr0(); | |||||
if ((cr0 & CR0_WP) == 0) | |||||
return (false); | |||||
load_cr0(cr0 & ~CR0_WP); | |||||
return (true); | |||||
} | |||||
void | |||||
restore_wp(bool old_wp) | |||||
{ | |||||
if (old_wp) | |||||
load_cr0(rcr0() | CR0_WP); | |||||
} | |||||
#ifdef KDB | #ifdef KDB | ||||
/* | /* | ||||
* Provide inb() and outb() as functions. They are normally only available as | * Provide inb() and outb() as functions. They are normally only available as | ||||
* inline functions, thus cannot be called from the debugger. | * inline functions, thus cannot be called from the debugger. | ||||
*/ | */ | ||||
/* silence compiler warnings */ | /* silence compiler warnings */ | ||||
Show All 16 Lines |