Annotation of sys/arch/m88k/include/asm_macro.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: asm_macro.h,v 1.3 2005/12/03 16:52:16 miod Exp $ */
! 2: /*
! 3: * Mach Operating System
! 4: * Copyright (c) 1993-1991 Carnegie Mellon University
! 5: * Copyright (c) 1991 OMRON Corporation
! 6: * All Rights Reserved.
! 7: *
! 8: * Permission to use, copy, modify and distribute this software and its
! 9: * documentation is hereby granted, provided that both the copyright
! 10: * notice and this permission notice appear in all copies of the
! 11: * software, derivative works or modified versions, and any portions
! 12: * thereof, and that both notices appear in supporting documentation.
! 13: *
! 14: * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
! 15: * CONDITION. CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND
! 16: * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
! 17: *
! 18: * Carnegie Mellon requests users of this software to return to
! 19: *
! 20: * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
! 21: * School of Computer Science
! 22: * Carnegie Mellon University
! 23: * Pittsburgh PA 15213-3890
! 24: *
! 25: * any improvements or extensions that they make and grant Carnegie the
! 26: * rights to redistribute these changes.
! 27: */
! 28:
! 29: #ifndef __M88K_ASM_MACRO_H__
! 30: #define __M88K_ASM_MACRO_H__
! 31:
! 32: /*
! 33: * Various compiler macros used for speed and efficiency.
! 34: * Anyone can include.
! 35: */
! 36:
! 37: #include <machine/asm.h>
! 38:
! 39: /*
! 40: * Flushes the data pipeline.
! 41: */
! 42: #define flush_pipeline() \
! 43: __asm__ __volatile__ (FLUSH_PIPELINE_STRING)
! 44:
! 45: /*
! 46: * Sets the PSR.
! 47: */
! 48: static __inline__ void set_psr(u_int psr)
! 49: {
! 50: __asm__ __volatile__ ("stcr %0, cr1" :: "r" (psr));
! 51: __asm__ __volatile__ (FLUSH_PIPELINE_STRING);
! 52: }
! 53:
! 54: /*
! 55: * Gets the PSR.
! 56: */
! 57: static __inline__ u_int get_psr(void)
! 58: {
! 59: u_int psr;
! 60: __asm__ __volatile__ ("ldcr %0, cr1" : "=r" (psr));
! 61: return (psr);
! 62: }
! 63:
! 64: #define disable_interrupt(psr) set_psr(((psr) = get_psr()) | PSR_IND)
! 65:
! 66: /*
! 67: * Provide access from C code to the assembly instruction ff1
! 68: */
! 69: static __inline__ unsigned ff1(unsigned val)
! 70: {
! 71: __asm__ __volatile__ ("ff1 %0, %0" : "=r" (val) : "0" (val));
! 72: return (val);
! 73: }
! 74:
! 75: static __inline__ u_int get_cpu_pid(void)
! 76: {
! 77: u_int pid;
! 78: __asm__ __volatile__ ("ldcr %0, cr0" : "=r" (pid));
! 79: return (pid);
! 80: }
! 81:
! 82: #endif /* __M88K_ASM_MACRO_H__ */
CVSweb