#include <pexpert/protos.h>
typedef unsigned long spl_t;
spl_t PE_set_spl(spl_t x);
spl_t splhi() { return PE_set_spl(8); }
spl_t splhigh() { return PE_set_spl(8); }
spl_t splclock() { return PE_set_spl(8); }
spl_t splvm() { return PE_set_spl(8); }
spl_t splsched() { return PE_set_spl(8); }
spl_t splimp() { return PE_set_spl(6); }
void splx(spl_t x) { (void) PE_set_spl(x); }
spl_t splnet() { return PE_set_spl(6); }
void spllo() { (void) PE_set_spl(0); }
spl_t spl1() { return PE_set_spl(1); }
spl_t spl2() { return PE_set_spl(2); }
spl_t spl3() { return PE_set_spl(3); }
spl_t spl4() { return PE_set_spl(4); }
spl_t spl5() { return PE_set_spl(5); }
spl_t spl6() { return PE_set_spl(6); }
spl_t splbio() { return PE_set_spl(5); }
spl_t spltty() { return PE_set_spl(6); }
spl_t sploff() { return PE_set_spl(8); }
void splon(spl_t x) { (void) PE_set_spl(x); }
spl_t PE_set_spl(spl_t lvl)
{
spl_t old_level;
int mycpu;
__asm__ volatile("cli");
mycpu = cpu_number();
old_level = cpu_data[mycpu].spl_level;
cpu_data[mycpu].spl_level = lvl ;
if (!lvl) __asm__ volatile("sti");
return old_level;
}
void PE_set_spl_no_interrupt(spl_t lvl)
{
int mycpu;
__asm__ volatile("cli");
mycpu = cpu_number();
cpu_data[mycpu].spl_level = lvl ;
return;
}