From c9bf6a6b57e48177a91b3e065f6745a671922e83 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Sun, 3 Oct 2004 19:47:26 +0000 Subject: Merge locore_c_routines.c into machdep.c, and clear as done on mvme88k. is about to die very soon... --- sys/arch/luna88k/conf/files.luna88k | 3 +- sys/arch/luna88k/include/locore.h | 32 +-- sys/arch/luna88k/luna88k/locore_c_routines.c | 260 ------------------------ sys/arch/luna88k/luna88k/machdep.c | 292 +++++++++++++++++++++------ 4 files changed, 234 insertions(+), 353 deletions(-) delete mode 100644 sys/arch/luna88k/luna88k/locore_c_routines.c (limited to 'sys') diff --git a/sys/arch/luna88k/conf/files.luna88k b/sys/arch/luna88k/conf/files.luna88k index 9a8218757fb..bdfaa7e9ad9 100644 --- a/sys/arch/luna88k/conf/files.luna88k +++ b/sys/arch/luna88k/conf/files.luna88k @@ -1,4 +1,4 @@ -# $OpenBSD: files.luna88k,v 1.6 2004/07/25 11:06:39 miod Exp $ +# $OpenBSD: files.luna88k,v 1.7 2004/10/03 19:47:23 miod Exp $ # maxpartitions 16 @@ -79,7 +79,6 @@ file arch/luna88k/luna88k/m8820x.c file arch/luna88k/luna88k/disksubr.c file arch/luna88k/luna88k/eh.S file arch/luna88k/luna88k/isr.c -file arch/luna88k/luna88k/locore_c_routines.c file arch/luna88k/luna88k/machdep.c file arch/luna88k/luna88k/mem.c file arch/luna88k/luna88k/pmap_table.c diff --git a/sys/arch/luna88k/include/locore.h b/sys/arch/luna88k/include/locore.h index d900fa3ab5f..9ec874e4961 100644 --- a/sys/arch/luna88k/include/locore.h +++ b/sys/arch/luna88k/include/locore.h @@ -1,10 +1,8 @@ -/* $OpenBSD: locore.h,v 1.3 2004/08/01 17:18:02 miod Exp $ */ +/* $OpenBSD: locore.h,v 1.4 2004/10/03 19:47:25 miod Exp $ */ #ifndef _MACHINE_LOCORE_H_ #define _MACHINE_LOCORE_H_ -#include - /* * C prototypes for various routines defined in locore_* and friends */ @@ -17,44 +15,16 @@ int badaddr(vaddr_t addr, int size); void set_cpu_number(unsigned number); void doboot(void); -int guarded_access(unsigned char *volatile address, - unsigned len, u_char *vec); - /* locore_c_routines.c */ unsigned getipl(void); -/* machdep.c */ - -void _doboot(void); -vaddr_t get_slave_stack(void); -void slave_pre_main(void); -int slave_main(void); -int intr_findvec(int start, int end); -void bugsyscall(void); -void myetheraddr(u_char *cp); -void dosoftint(void); -void luna88k_bootstrap(void); -void luna88k_ext_int(u_int v, struct trapframe *eframe); -unsigned int safe_level(unsigned mask, unsigned curlevel); - /* eh.S */ -struct proc; -void proc_do_uret(struct proc *); void sigsys(void); void sigtrap(void); void stepbpt(void); void userbpt(void); void syscall_handler(void); -void m88110_sigsys(void); -void m88110_sigtrap(void); -void m88110_stepbpt(void); -void m88110_userbpt(void); -void m88110_syscall_handler(void); - -/* process.S */ -void savectx(struct pcb *); -void switch_exit(struct proc *); #endif /* _MACHINE_LOCORE_H_ */ diff --git a/sys/arch/luna88k/luna88k/locore_c_routines.c b/sys/arch/luna88k/luna88k/locore_c_routines.c deleted file mode 100644 index c2b1e04f792..00000000000 --- a/sys/arch/luna88k/luna88k/locore_c_routines.c +++ /dev/null @@ -1,260 +0,0 @@ -/* $OpenBSD: locore_c_routines.c,v 1.3 2004/08/01 17:18:05 miod Exp $ */ -/* - * Mach Operating System - * Copyright (c) 1993-1991 Carnegie Mellon University - * Copyright (c) 1991 OMRON Corporation - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include -#include - -#include /* m188 bit defines */ -#include /* DMT_VALID */ -#include /* END_OF_VECTOR_LIST, etc. */ -#include /* enable/disable interrupts */ -#include /* cpu_number() */ -#include -#include - -typedef struct { - unsigned word_one, word_two; -} m88k_exception_vector_area; - -extern unsigned int *volatile int_mask_reg[MAX_CPUS]; /* in machdep.c */ -extern unsigned master_cpu; /* in cmmu.c */ - -void setlevel(unsigned int); -void vector_init(m88k_exception_vector_area *, unsigned *); - -#define SIGSYS_MAX 501 -#define SIGTRAP_MAX 510 - -#define EMPTY_BR 0xc0000000 /* empty "br" instruction */ -#define NO_OP 0xf4005800 /* "or r0, r0, r0" */ - -#define BRANCH(FROM, TO) \ - (EMPTY_BR | ((unsigned)(TO) - (unsigned)(FROM)) >> 2) - -#define SET_VECTOR(NUM, VALUE) \ - do { \ - vector[NUM].word_one = NO_OP; \ - vector[NUM].word_two = BRANCH(&vector[NUM].word_two, VALUE); \ - } while (0) - -/* - * vector_init(vector, vector_init_list) - * - * This routine sets up the m88k vector table for the running processor. - * It is called with a very little stack, and interrupts disabled, - * so don't call any other functions! - * XXX clean this - nivas - */ -void -vector_init(m88k_exception_vector_area *vector, unsigned *vector_init_list) -{ - unsigned num; - unsigned vec; - extern void bugtrap(void); - extern void m88110_bugtrap(void); - - for (num = 0; (vec = vector_init_list[num]) != END_OF_VECTOR_LIST; - num++) { - if (vec != UNKNOWN_HANDLER) - SET_VECTOR(num, vec); - } - - for (; num <= SIGSYS_MAX; num++) - SET_VECTOR(num, sigsys); - - for (; num <= SIGTRAP_MAX; num++) - SET_VECTOR(num, sigtrap); - - SET_VECTOR(450, syscall_handler); - SET_VECTOR(504, stepbpt); - SET_VECTOR(511, userbpt); - - /* GCC will by default produce explicit trap 503 for division by zero */ - SET_VECTOR(503, vector_init_list[T_ZERODIV]); -} - -unsigned int luna88k_curspl[MAX_CPUS] = {0, 0, 0, 0}; - -unsigned int int_mask_val[INT_LEVEL] = { - INT_MASK_LV0, - INT_MASK_LV1, - INT_MASK_LV2, - INT_MASK_LV3, - INT_MASK_LV4, - INT_MASK_LV5, - INT_MASK_LV6, - INT_MASK_LV7 -}; - -unsigned int int_set_val[INT_LEVEL] = { - INT_SET_LV0, - INT_SET_LV1, - INT_SET_LV2, - INT_SET_LV3, - INT_SET_LV4, - INT_SET_LV5, - INT_SET_LV6, - INT_SET_LV7 -}; - -/* - * return next safe spl to reenable interrupts. - */ -unsigned int -safe_level(mask, curlevel) - unsigned mask; - unsigned curlevel; -{ - int i; - - for (i = curlevel; i < 8; i++) - if (!(int_mask_val[i] & mask)) - return i; - - panic("safe_level: no safe level for mask 0x%08x level %d found", - mask, curlevel); - /* NOTREACHED */ -} - -void -setlevel(unsigned int level) -{ - unsigned int set_value; - int cpu = cpu_number(); - - set_value = int_set_val[level]; - - if (cpu != master_cpu) - set_value &= INT_SLAVE_MASK; - -#if 0 - set_value &= ISR_SOFTINT_EXCEPT_MASK(cpu); - set_value &= ~blocked_interrupts_mask; -#endif - - *int_mask_reg[cpu] = set_value; -#if 0 - int_mask_shadow[cpu] = set_value; -#endif - luna88k_curspl[cpu] = level; -} - -unsigned -getipl(void) -{ - unsigned curspl; - m88k_psr_type psr; /* processor status register */ - - psr = disable_interrupts_return_psr(); - curspl = luna88k_curspl[cpu_number()]; - set_psr(psr); - return curspl; -} - -unsigned -setipl(unsigned level) -{ - unsigned curspl; - m88k_psr_type psr; /* processor status register */ - -#ifdef DEBUG - if (level > 7) { - printf("setipl: invoked with invalid level %x\n", level); - level &= 0x07; /* and pray it will work */ - } -#endif - - psr = disable_interrupts_return_psr(); - curspl = luna88k_curspl[cpu_number()]; - setlevel(level); - - flush_pipeline(); - - /* The flush pipeline is required to make sure the above write gets - * through the data pipe and to the hardware; otherwise, the next - * bunch of instructions could execute at the wrong spl protection - */ - set_psr(psr); - return curspl; -} - -unsigned -raiseipl(unsigned level) -{ - unsigned curspl; - m88k_psr_type psr; /* processor status register */ - -#ifdef DEBUG - if (level > 7) { - printf("raiseipl: invoked with invalid level %x\n", level); - level &= 0x07; /* and pray it will work */ - } -#endif - - psr = disable_interrupts_return_psr(); - curspl = luna88k_curspl[cpu_number()]; - if (curspl < level) - setlevel(level); - - flush_pipeline(); - - /* The flush pipeline is required to make sure the above write gets - * through the data pipe and to the hardware; otherwise, the next - * bunch of instructions could execute at the wrong spl protection - */ - set_psr(psr); - return curspl; -} - -/* XXX Utterly bogus */ -#if NCPUS > 1 -#include -void -simple_lock_init(lkp) - struct simplelock *volatile lkp; -{ - lkp->lock_data = 0; -} - -int -test_and_set(lock) - int *volatile lock; -{ -#if 0 - int oldlock = *lock; - if (*lock == 0) { - *lock = 1; - return 0; - } -#else - return *lock; - *lock = 1; - return 0; -#endif -} -#endif diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c index 96bb09f61d4..a26b48430f8 100644 --- a/sys/arch/luna88k/luna88k/machdep.c +++ b/sys/arch/luna88k/luna88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.14 2004/10/01 05:49:00 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.15 2004/10/03 19:47:25 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -42,6 +42,19 @@ * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. * + * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND + * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. */ #include @@ -68,7 +81,8 @@ #include -#include /* enable/disable interrupts */ +#include +#include #include #include #include @@ -93,26 +107,31 @@ #include /* db_printf() */ #endif /* DDB */ -#if DDB -#define DEBUG_MSG db_printf -#else -#define DEBUG_MSG printf -#endif /* DDB */ - -vaddr_t interrupt_stack[MAX_CPUS]; - -/* machine dependent function pointers. */ -struct md_p md; +typedef struct { + unsigned word_one, word_two; +} m88k_exception_vector_area; + +caddr_t allocsys(caddr_t); +void bugsyscall(void); +void consinit(void); +void dosoftint(void); +void dumpconf(void); +void dumpsys(void); +int getcpuspeed(void); +vaddr_t get_slave_stack(void); +void identifycpu(void); +void luna88k_bootstrap(void); +u_int safe_level(u_int, u_int); +void savectx(struct pcb *); +void setlevel(unsigned int); +void slave_pre_main(void); +int slave_main(void); +void vector_init(m88k_exception_vector_area *, unsigned *); + +extern void load_u_area(struct proc *); +extern void save_u_area(struct proc *, vaddr_t); -/* prototypes */ -void dumpsys(void); -void consinit(void); vaddr_t size_memory(void); -int getcpuspeed(void); -void identifycpu(void); -void save_u_area(struct proc *, vaddr_t); -void load_u_area(struct proc *); -void dumpconf(void); void luna88k_ext_int(u_int v, struct trapframe *eframe); void powerdown(void); void get_fuse_rom_data(void); @@ -121,6 +140,11 @@ char *nvram_by_symbol(char *); void get_autoboot_device(void); /* in disksubr.c */ int clockintr(void *); /* in clock.c */ +vaddr_t interrupt_stack[MAX_CPUS]; + +/* machine dependent function pointers. */ +struct md_p md; + /* * *int_mask_reg[CPU] * Points to the hardware interrupt status register for each CPU. @@ -132,6 +156,30 @@ unsigned int *volatile int_mask_reg[MAX_CPUS] = { (unsigned int *)INT_ST_MASK3 }; +unsigned int luna88k_curspl[MAX_CPUS] = {0, 0, 0, 0}; + +unsigned int int_mask_val[INT_LEVEL] = { + INT_MASK_LV0, + INT_MASK_LV1, + INT_MASK_LV2, + INT_MASK_LV3, + INT_MASK_LV4, + INT_MASK_LV5, + INT_MASK_LV6, + INT_MASK_LV7 +}; + +unsigned int int_set_val[INT_LEVEL] = { + INT_SET_LV0, + INT_SET_LV1, + INT_SET_LV2, + INT_SET_LV3, + INT_SET_LV4, + INT_SET_LV5, + INT_SET_LV6, + INT_SET_LV7 +}; + /* * *clock_reg[CPU] */ @@ -160,7 +208,7 @@ struct nvram_t { char value[NVVALLEN]; } nvram[NNVSYM]; -volatile vaddr_t obiova; +vaddr_t obiova; int ssir; int want_ast; @@ -187,9 +235,9 @@ struct vm_map *iomap_map; * Declare these as initialized data so we can patch them. */ #ifdef NBUF -int nbuf = NBUF; +int nbuf = NBUF; #else -int nbuf = 0; +int nbuf = 0; #endif #ifndef BUFCACHEPERCENT @@ -197,13 +245,11 @@ int nbuf = 0; #endif #ifdef BUFPAGES -int bufpages = BUFPAGES; +int bufpages = BUFPAGES; #else -int bufpages = 0; +int bufpages = 0; #endif -int bufcachepercent = BUFCACHEPERCENT; - -caddr_t allocsys(caddr_t); +int bufcachepercent = BUFCACHEPERCENT; /* * Info for CTL_HW @@ -226,9 +272,6 @@ int hwplanebits; /* set in locore.S */ int netisr; -extern char *etext; -extern char *edata; -extern char *end; extern struct consdev syscons; /* in dev/siotty.c */ extern void greeting(void); /* in dev/lcd.c */ @@ -236,8 +279,8 @@ extern void syscnattach(int); /* in dev/siotty.c */ extern int omfb_cnattach(void); /* in dev/lunafb.c */ extern void ws_cnattach(void); /* in dev/lunaws.c */ -vaddr_t first_addr = 0; -vaddr_t last_addr = 0; +vaddr_t first_addr; +vaddr_t last_addr; vaddr_t avail_start, avail_end; vaddr_t virtual_avail, virtual_end; @@ -261,7 +304,7 @@ struct consdev romttycons = { romttycnputc, nullcnpollc, NULL, - makedev(14,0), + makedev(14, 0), CN_NORMAL, }; @@ -378,12 +421,12 @@ cpu_startup() * avail_end was pre-decremented in luna88k_bootstrap() to compensate. */ for (i = 0; i < btoc(MSGBUFSIZE); i++) - pmap_kenter_pa((paddr_t)msgbufp + i * NBPG, - avail_end + i * NBPG, VM_PROT_READ | VM_PROT_WRITE); + pmap_kenter_pa((paddr_t)msgbufp + i * PAGE_SIZE, + avail_end + i * PAGE_SIZE, VM_PROT_READ | VM_PROT_WRITE); pmap_update(pmap_kernel()); initmsgbuf((caddr_t)msgbufp, round_page(MSGBUFSIZE)); - /* Determine the machine type from FUSE ROM data */ + /* Determine the machine type from FUSE ROM data. */ get_fuse_rom_data(); if (strncmp(fuse_rom_data, "MNAME=LUNA88K+", 14) == 0) { machtype = LUNA_88K2; @@ -403,7 +446,9 @@ cpu_startup() /* * Check front DIP switch setting */ +#ifdef DEBUG printf("dipsw = 0x%x\n", dipswitch); +#endif /* Check DIP switch 1 - 1 */ if ((0x8000 & dipswitch) == 0) { @@ -875,15 +920,13 @@ get_slave_stack() * Determine CPU number and set it. * * Running on an interrupt stack here; do nothing fancy. - * - * Called from "luna88k/locore.S" */ void slave_pre_main() { - set_cpu_number(cmmu_cpu_number()); /* Determine cpu number by CMMU */ - splhigh(); - enable_interrupt(); + set_cpu_number(cmmu_cpu_number()); /* Determine cpu number by CMMU */ + splhigh(); + enable_interrupt(); } /* dummy main routine for slave processors */ @@ -897,17 +940,8 @@ slave_main() /* * Device interrupt handler for LUNA88K - * - * when we enter, interrupts are disabled; - * when we leave, they should be disabled, - * but they need not be disabled throughout - * the routine. */ -#define GET_MASK(cpu, val) *int_mask_reg[cpu] & (val) -extern unsigned int luna88k_curspl[MAX_CPUS]; /* XXX sould be here? */ -extern unsigned int int_mask_val[INT_LEVEL]; /* XXX sould be here? */ - void luna88k_ext_int(u_int v, struct trapframe *eframe) { @@ -924,7 +958,7 @@ luna88k_ext_int(u_int v, struct trapframe *eframe) if (cur_int == 0) { /* * Spurious interrupts - may be caused by debug output clearing - * DUART interrupts. + * serial port interrupts. */ printf("luna88k_ext_int(): Spurious interrupts?\n"); flush_pipeline(); @@ -961,9 +995,11 @@ luna88k_ext_int(u_int v, struct trapframe *eframe) for(;;) ; } +#ifdef DEBUG if (level > 7 || (char)level < 0) { panic("int level (%x) is not between 0 and 7", level); } +#endif setipl(level); @@ -1059,8 +1095,6 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) /*NOTREACHED*/ } -/* dummys for now */ - void bugsyscall() { @@ -1109,19 +1143,19 @@ spl0() * Called from locore.S during boot, * this is the first C code that's run. */ - void luna88k_bootstrap() { extern int kernelstart; extern struct consdev *cn_tab; extern struct cmmu_p cmmu8820x; + extern char *end; /* * Must initialize p_addr before autoconfig or * the fault handler will get a NULL reference. * Do this early so that we can take a data or - * instruction fault and survive it. XXX smurph + * instruction fault and survive it. */ proc0.p_addr = proc0paddr; curproc = &proc0; @@ -1148,10 +1182,10 @@ luna88k_bootstrap() /* startup fake console driver. It will be replaced by consinit() */ cn_tab = &romttycons; - uvmexp.pagesize = NBPG; + uvmexp.pagesize = PAGE_SIZE; uvm_setpagesize(); - first_addr = round_page((vaddr_t) &end); /* XXX: Is this OK? */ + first_addr = round_page((vaddr_t)&end); /* XXX temp until symbols */ last_addr = size_memory(); physmem = btoc(last_addr); @@ -1178,13 +1212,15 @@ luna88k_bootstrap() avail_start = first_addr; avail_end = last_addr; + /* * Steal MSGBUFSIZE at the top of physical memory for msgbuf */ avail_end -= round_page(MSGBUFSIZE); #ifdef DEBUG - printf("LUNA88K boot: memory from 0x%x to 0x%x\n", avail_start, avail_end); + printf("LUNA88K boot: memory from 0x%x to 0x%x\n", + avail_start, avail_end); #endif pmap_bootstrap((vaddr_t)trunc_page((unsigned)&kernelstart)); @@ -1204,7 +1240,7 @@ luna88k_bootstrap() load_u_area(&proc0); /* Initialize the "u-area" pages. */ - bzero((caddr_t)UADDR, UPAGES*NBPG); + bzero((caddr_t)UADDR, UPAGES * PAGE_SIZE); #ifdef DEBUG printf("leaving luna88k_bootstrap()\n"); #endif @@ -1392,3 +1428,139 @@ nvram_by_symbol(symbol) return value; } + +#define SIGSYS_MAX 501 +#define SIGTRAP_MAX 510 + +#define EMPTY_BR 0xc0000000 /* empty "br" instruction */ +#define NO_OP 0xf4005800 /* "or r0, r0, r0" */ + +#define BRANCH(FROM, TO) \ + (EMPTY_BR | ((unsigned)(TO) - (unsigned)(FROM)) >> 2) + +#define SET_VECTOR(NUM, VALUE) \ + do { \ + vector[NUM].word_one = NO_OP; \ + vector[NUM].word_two = BRANCH(&vector[NUM].word_two, VALUE); \ + } while (0) + +/* + * vector_init(vector, vector_init_list) + * + * This routine sets up the m88k vector table for the running processor. + * It is called with a very little stack, and interrupts disabled, + * so don't call any other functions! + */ +void +vector_init(m88k_exception_vector_area *vector, unsigned *vector_init_list) +{ + unsigned num; + unsigned vec; + extern void bugtrap(void); + + for (num = 0; (vec = vector_init_list[num]) != END_OF_VECTOR_LIST; + num++) { + if (vec != UNKNOWN_HANDLER) + SET_VECTOR(num, vec); + } + + for (; num <= SIGSYS_MAX; num++) + SET_VECTOR(num, sigsys); + + for (; num <= SIGTRAP_MAX; num++) + SET_VECTOR(num, sigtrap); + + SET_VECTOR(450, syscall_handler); + SET_VECTOR(504, stepbpt); + SET_VECTOR(511, userbpt); + + /* GCC will by default produce explicit trap 503 for division by zero */ + SET_VECTOR(503, vector_init_list[T_ZERODIV]); +} + +/* + * return next safe spl to reenable interrupts. + */ +u_int +safe_level(u_int mask, u_int curlevel) +{ + int i; + + for (i = curlevel; i < 8; i++) + if (!(int_mask_val[i] & mask)) + return i; + + panic("safe_level: no safe level for mask 0x%08x level %d found", + mask, curlevel); + /* NOTREACHED */ +} + +void +setlevel(unsigned int level) +{ + unsigned int set_value; + int cpu = cpu_number(); + + set_value = int_set_val[level]; + + if (cpu != master_cpu) + set_value &= INT_SLAVE_MASK; + + *int_mask_reg[cpu] = set_value; + luna88k_curspl[cpu] = level; +} + +unsigned +getipl(void) +{ + unsigned curspl; + m88k_psr_type psr; + + psr = disable_interrupts_return_psr(); + curspl = luna88k_curspl[cpu_number()]; + set_psr(psr); + return curspl; +} + +unsigned +setipl(unsigned level) +{ + unsigned curspl; + m88k_psr_type psr; + + psr = disable_interrupts_return_psr(); + curspl = luna88k_curspl[cpu_number()]; + setlevel(level); + + /* + * The flush pipeline is required to make sure the above write gets + * through the data pipe and to the hardware; otherwise, the next + * bunch of instructions could execute at the wrong spl protection. + */ + flush_pipeline(); + + set_psr(psr); + return curspl; +} + +unsigned +raiseipl(unsigned level) +{ + unsigned curspl; + m88k_psr_type psr; + + psr = disable_interrupts_return_psr(); + curspl = luna88k_curspl[cpu_number()]; + if (curspl < level) + setlevel(level); + + /* + * The flush pipeline is required to make sure the above write gets + * through the data pipe and to the hardware; otherwise, the next + * bunch of instructions could execute at the wrong spl protection. + */ + flush_pipeline(); + + set_psr(psr); + return curspl; +} -- cgit v1.2.3