1 /* $NetBSD: prom_swpal.S,v 1.1 1997/01/24 01:52:58 cgd Exp $ */
4 * Copyright (c) 1994, 1995 Carnegie-Mellon University.
9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation.
15 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 * Carnegie Mellon requests users of this software to return to
21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
30 #include "../../include/asm.h"
31 #include "../../include/prom.h"
32 #include "../../include/rpb.h"
34 /* Offsets from base of HWRPB. */
35 #define RPB_SELFREF 0x00
36 #define RPB_SLOTSIZE 0x98
37 #define RPB_PERCPU_OFF 0xA0
39 /* Offsets in a boot PCB. */
46 #define PAL_RESERVED 0 /* Reserved to Digital. */
47 #define PAL_VMS 1 /* VMS */
48 #define PAL_OSF 2 /* OSF */
51 * PAL code switch routine.
60 #define PALSW_FRAME_SIZE (14*8)
61 #define PALSW_REGS IM_RA|IM_S0|IM_S1|IM_S2|IM_S3|IM_S4|IM_S5
68 NESTED(switch_palcode, 0, PALSW_FRAME_SIZE, ra, PALSW_REGS, 0)
72 lda sp, -PALSW_FRAME_SIZE(sp)
84 ldiq s0, HWRPB_ADDR /* s0 HWRPB_ADDR */
85 ldq s1, RPB_SLOTSIZE(s0)
86 call_pal PAL_VMS_mfpr_whami
87 mulq s1, v0, s1 /* s1 per_cpu offset from base */
88 ldq s2, RPB_PERCPU_OFF(s0)
90 addq s2, s1, s2 /* s2 PCB (virtual) */
92 call_pal PAL_VMS_mfpr_ptbr
94 stq v0, ptbr_save /* save PTBR for the kernel */
99 ldq t0, RPB_SELFREF(s0) /* HWRBP base (physical) */
100 ldq t1, RPB_PERCPU_OFF(s0)
102 addq t0, s1, t0 /* PCB base (phys) */
105 call_pal PAL_VMS_mfpr_vptb
111 call_pal PAL_swppal /* a0, a1, a2, a3 */
113 contin: ldq pv, 0(sp)
123 lda sp, PALSW_FRAME_SIZE(sp)
134 #undef PALSW_FRAME_SIZE