psl.h revision 1.1 1 1.1 cgd /* $NetBSD: psl.h,v 1.1 1995/02/13 23:07:49 cgd Exp $ */
2 1.1 cgd
3 1.1 cgd /*
4 1.1 cgd * Copyright (c) 1994, 1995 Carnegie-Mellon University.
5 1.1 cgd * All rights reserved.
6 1.1 cgd *
7 1.1 cgd * Author: Chris G. Demetriou
8 1.1 cgd *
9 1.1 cgd * Permission to use, copy, modify and distribute this software and
10 1.1 cgd * its documentation is hereby granted, provided that both the copyright
11 1.1 cgd * notice and this permission notice appear in all copies of the
12 1.1 cgd * software, derivative works or modified versions, and any portions
13 1.1 cgd * thereof, and that both notices appear in supporting documentation.
14 1.1 cgd *
15 1.1 cgd * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 1.1 cgd * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 1.1 cgd * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 1.1 cgd *
19 1.1 cgd * Carnegie Mellon requests users of this software to return to
20 1.1 cgd *
21 1.1 cgd * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
22 1.1 cgd * School of Computer Science
23 1.1 cgd * Carnegie Mellon University
24 1.1 cgd * Pittsburgh PA 15213-3890
25 1.1 cgd *
26 1.1 cgd * any improvements or extensions that they make and grant Carnegie the
27 1.1 cgd * rights to redistribute these changes.
28 1.1 cgd */
29 1.1 cgd
30 1.1 cgd /*
31 1.1 cgd * Processor Status register definitions.
32 1.1 cgd */
33 1.1 cgd #define PSL_U 0x08 /* PS<3> == 1 -> User mode */
34 1.1 cgd #define PSL_IPL 0x07 /* PS<2:0> -> Interrupt mask */
35 1.1 cgd
36 1.1 cgd /*
37 1.1 cgd * The interrupt priority levels.
38 1.1 cgd * Other IPL's are configured in software, and are listed below.
39 1.1 cgd */
40 1.1 cgd #define PSL_IPL_0 0 /* all interrupts enabled */
41 1.1 cgd #define PSL_IPL_SOFT 1 /* block software interrupts */
42 1.1 cgd #define PSL_IPL_IO 4 /* block I/O device interrupts */
43 1.1 cgd #define PSL_IPL_CLOCK 5 /* block clock interrupts */
44 1.1 cgd #define PSL_IPL_HIGH 6 /* block everything except mchecks */
45 1.1 cgd
46 1.1 cgd /*
47 1.1 cgd * Miscellaneous PSL definitions
48 1.1 cgd */
49 1.1 cgd #define PSL_MBZ (0xfffffffffffffff0) /* Must be always zero */
50 1.1 cgd #define PSL_USERSET (PSL_U) /* Must be set for user-mode */
51 1.1 cgd #define PSL_USERCLR (PSL_MBZ|PSL_IPL) /* Must be clr for user-mode */
52 1.1 cgd #define USERMODE(ps) ((ps & PSL_U) != 0) /* Is it user-mode? */
53 1.1 cgd
54 1.1 cgd #ifdef KERNEL
55 1.1 cgd /*
56 1.1 cgd * Translation buffer invalidation macro definitions.
57 1.1 cgd */
58 1.1 cgd #define TBI_A -2 /* Flush all TB entries */
59 1.1 cgd #define TBI_AP -1 /* Flush all per-process TB entries */
60 1.1 cgd #define TBI_SI 1 /* Invalidate ITB entry for va */
61 1.1 cgd #define TBI_SD 2 /* Invalidate DTB entry for va */
62 1.1 cgd #define TBI_S 3 /* Invalidate all entries for va */
63 1.1 cgd
64 1.1 cgd #define TBIA() pal_tbi(TBI_A, NULL)
65 1.1 cgd #define TBIAP() pal_tbi(TBI_AP, NULL)
66 1.1 cgd #define TBISI(va) pal_tbi(TBI_SI, va)
67 1.1 cgd #define TBISD(va) pal_tbi(TBI_SD, va)
68 1.1 cgd #define TBIS(va) pal_tbi(TBI_S, va)
69 1.1 cgd
70 1.1 cgd /*
71 1.1 cgd * Cache invalidation/flush routines.
72 1.1 cgd */
73 1.1 cgd #define MB() alpha_mb() /* Flush all write buffers */
74 1.1 cgd #define IMB() pal_imb() /* Sync instruction cache w/data */
75 1.1 cgd
76 1.1 cgd void alpha_mb __P((void)); /* Flush all write buffers */
77 1.1 cgd void pal_imb __P((void)); /* Sync instruction cache */
78 1.1 cgd u_int64_t pal_swpipl __P((u_int64_t)); /* write new IPL, return old */
79 1.1 cgd void pal_tbi __P((u_int64_t, void *)); /* Invalidate TLB entries */
80 1.1 cgd #endif /* KERNEL */
81