POK(kernelpart)
|
00001 /* 00002 * POK header 00003 * 00004 * The following file is a part of the POK project. Any modification should 00005 * made according to the POK licence. You CANNOT use this file or a part of 00006 * this file is this part of a file for your own project 00007 * 00008 * For more information on the POK licence, please see our LICENCE FILE 00009 * 00010 * Please follow the coding guidelines described in doc/CODING_GUIDELINES 00011 * 00012 * Copyright (c) 2007-2009 POK team 00013 * 00014 * Created by julien on Thu Jan 15 23:34:13 2009 00015 */ 00016 00023 #ifndef __POK_SPARC_PSR_H__ 00024 #define __POK_SPARC_PSR_H__ 00025 00026 #define PSR_ET 0x20 00027 #define PSR_PS 0x40 00028 #define PSR_S 0x80 00029 #define PSR_CWP_MASK 0x1F 00030 #define PSR_PIL(pil) (((pil) & 0xF) << 8) 00032 static inline unsigned int psr_get(void) 00033 { 00034 unsigned int psr; 00035 asm volatile ("rd %%psr, %0\n" 00036 : "=r" (psr) 00037 : /* no inputs */ 00038 : "memory"); 00039 00040 return psr; 00041 } 00042 00043 static inline void psr_set(unsigned int new_psr) 00044 { 00045 asm volatile ("wr %0, 0x0, %%psr\n" 00046 "nop\n" 00047 "nop\n" 00048 "nop\n" 00049 : /* no outputs */ 00050 : "r" (new_psr) 00051 : "memory", "cc"); 00052 } 00053 00054 static inline void psr_enable_traps(void) 00055 { 00056 unsigned int psr = psr_get(); 00057 psr |= PSR_ET; 00058 psr_set(psr); 00059 } 00060 00061 static inline void psr_disable_traps(void) 00062 { 00063 unsigned int psr = psr_get(); 00064 psr &= ~PSR_ET; 00065 psr_set(psr); 00066 } 00067 00068 static inline void psr_disable_interupt(void) 00069 { 00070 unsigned int psr = psr_get(); 00071 00072 psr &= ~(0xF << 8); 00073 psr_set(psr | PSR_PIL(0xF)); 00074 } 00075 00076 static inline void psr_enable_interupt(void) 00077 { 00078 unsigned int psr = psr_get(); 00079 00080 psr &= ~(0xF << 8); 00081 psr_set(psr | PSR_PIL(0x0)); 00082 } 00083 00084 #endif