xref: /openbsd-src/sys/arch/sh/include/psl.h (revision 5a99caff226b7696a75849389909077eda310f45)
1*5a99caffSmiod /*	$OpenBSD: psl.h,v 1.4 2010/04/25 18:11:36 miod Exp $	*/
295c7671fSmiod /*	$NetBSD: psl.h,v 1.8 2005/12/11 12:18:58 christos Exp $	*/
395c7671fSmiod 
495c7671fSmiod /*-
595c7671fSmiod  * Copyright (c) 1990 The Regents of the University of California.
695c7671fSmiod  * All rights reserved.
795c7671fSmiod  *
895c7671fSmiod  * This code is derived from software contributed to Berkeley by
995c7671fSmiod  * William Jolitz.
1095c7671fSmiod  *
1195c7671fSmiod  * Redistribution and use in source and binary forms, with or without
1295c7671fSmiod  * modification, are permitted provided that the following conditions
1395c7671fSmiod  * are met:
1495c7671fSmiod  * 1. Redistributions of source code must retain the above copyright
1595c7671fSmiod  *    notice, this list of conditions and the following disclaimer.
1695c7671fSmiod  * 2. Redistributions in binary form must reproduce the above copyright
1795c7671fSmiod  *    notice, this list of conditions and the following disclaimer in the
1895c7671fSmiod  *    documentation and/or other materials provided with the distribution.
1995c7671fSmiod  * 3. Neither the name of the University nor the names of its contributors
2095c7671fSmiod  *    may be used to endorse or promote products derived from this software
2195c7671fSmiod  *    without specific prior written permission.
2295c7671fSmiod  *
2395c7671fSmiod  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2495c7671fSmiod  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2595c7671fSmiod  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2695c7671fSmiod  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2795c7671fSmiod  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2895c7671fSmiod  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2995c7671fSmiod  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3095c7671fSmiod  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3195c7671fSmiod  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3295c7671fSmiod  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3395c7671fSmiod  * SUCH DAMAGE.
3495c7671fSmiod  *
3595c7671fSmiod  *	@(#)psl.h	5.2 (Berkeley) 1/18/91
3695c7671fSmiod  */
3795c7671fSmiod 
3895c7671fSmiod #ifndef _SH_PSL_H_
3995c7671fSmiod #define	_SH_PSL_H_
4095c7671fSmiod 
4195c7671fSmiod /*
42*5a99caffSmiod  * SuperH Processor Status Register.
4395c7671fSmiod  */
4495c7671fSmiod #define	PSL_TBIT	0x00000001	/* T bit */
4595c7671fSmiod #define	PSL_SBIT	0x00000002	/* S bit */
4695c7671fSmiod #define	PSL_IMASK	0x000000f0	/* Interrupt Mask bit */
4795c7671fSmiod #define	PSL_QBIT	0x00000100	/* Q bit */
4895c7671fSmiod #define	PSL_MBIT	0x00000200	/* M bit */
491a188ff6Sdrahn #define	PSL_FD		0x00008000	/* FPU Disable bit */
5095c7671fSmiod #define	PSL_BL		0x10000000	/* Exception Block bit */
5195c7671fSmiod #define	PSL_RB		0x20000000	/* Register Bank bit */
5295c7671fSmiod #define	PSL_MD		0x40000000	/* Processor Mode bit */
5395c7671fSmiod 
5495c7671fSmiod #define	PSL_MBO		0x00000000	/* must be one bits */
55afee016aSmiod #define	PSL_MBZ		0x8fff7c0c	/* must be zero bits */
5695c7671fSmiod 
5795c7671fSmiod #define	PSL_USERSET	0
58afee016aSmiod #define	PSL_USERSTATIC	(PSL_BL|PSL_RB|PSL_MD|PSL_IMASK|PSL_FD|PSL_MBO|PSL_MBZ)
5995c7671fSmiod 
6095c7671fSmiod #define	KERNELMODE(sr)		((sr) & PSL_MD)
6195c7671fSmiod 
6295c7671fSmiod #ifdef _KERNEL
6395c7671fSmiod #ifndef _LOCORE
6495c7671fSmiod /* SR.IMASK */
6595c7671fSmiod int _cpu_intr_raise(int);
6695c7671fSmiod int _cpu_intr_suspend(void);
6795c7671fSmiod int _cpu_intr_resume(int);
6895c7671fSmiod /* SR.BL */
6995c7671fSmiod int _cpu_exception_suspend(void);
7095c7671fSmiod void _cpu_exception_resume(int);
7195c7671fSmiod #endif /* !_LOCORE */
7295c7671fSmiod #endif /* _KERNEL */
7395c7671fSmiod 
7495c7671fSmiod #endif /* !_SH_PSL_H_ */
75