Home | History | Annotate | Line # | Download | only in common
prom_disp.S revision 1.1.2.1
      1  1.1.2.1  cgd /* $NetBSD: prom_disp.S,v 1.1.2.1 1997/06/01 04:14:14 cgd Exp $ */
      2      1.1  cgd 
      3      1.1  cgd /*
      4      1.1  cgd  * Copyright (c) 1994, 1995, 1996 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 #ifndef _LOCORE
     31      1.1  cgd #include "include/asm.h"
     32      1.1  cgd #include "include/prom.h"
     33      1.1  cgd #include "include/rpb.h"
     34      1.1  cgd #endif
     35      1.1  cgd 
     36      1.1  cgd 	.globl	prom_dispatch_v
     37      1.1  cgd 	.comm	prom_dispatch_v,16
     38      1.1  cgd 
     39      1.1  cgd 	.text
     40      1.1  cgd 	.align	4
     41      1.1  cgd 
     42      1.1  cgd /*
     43      1.1  cgd  * Dispatcher routine.  Implements prom's calling machinery, saves our
     44      1.1  cgd  * callee-saved registers as required by C.
     45      1.1  cgd  */
     46      1.1  cgd #define	D_RA			 (7*8)
     47      1.1  cgd #define	D_S0			 (8*8)
     48      1.1  cgd #define	D_S1			 (9*8)
     49      1.1  cgd #define	D_S2			(10*8)
     50      1.1  cgd #define	D_S3			(11*8)
     51      1.1  cgd #define	D_S4			(12*8)
     52      1.1  cgd #define	D_S5			(13*8)
     53      1.1  cgd #define	D_S6			(14*8)
     54      1.1  cgd #define	DISPATCH_FRAME_SIZE	(15*8)
     55      1.1  cgd #define	DISPATCH_REGS		IM_RA|IM_S0|IM_S1|IM_S2|IM_S3|IM_S4|IM_S5|IM_S6
     56      1.1  cgd 
     57      1.1  cgd NESTED(prom_dispatch, 5, DISPATCH_FRAME_SIZE, ra, DISPATCH_REGS, 0)
     58      1.1  cgd 	LDGP(pv)
     59      1.1  cgd 
     60      1.1  cgd 	lda	sp, -DISPATCH_FRAME_SIZE(sp)
     61      1.1  cgd 	stq	ra, D_RA(sp)
     62      1.1  cgd 	stq	s0, D_S0(sp)
     63      1.1  cgd 	stq	s1, D_S1(sp)
     64      1.1  cgd 	stq	s2, D_S2(sp)
     65      1.1  cgd 	stq	s3, D_S3(sp)
     66      1.1  cgd 	stq	s4, D_S4(sp)
     67      1.1  cgd 	stq	s5, D_S5(sp)
     68      1.1  cgd 	stq	s6, D_S6(sp)
     69      1.1  cgd 
     70      1.1  cgd 	/* Lord have mercy because.. I would not. */
     71      1.1  cgd /* #define	STUPID_PROM_IS_32_BITS */
     72      1.1  cgd #ifdef	STUPID_PROM_IS_32_BITS
     73      1.1  cgd 	ldah	s0, 0x2000(zero)	/* hack for hack */
     74      1.1  cgd 	lda	s0, (0x2000-8)(s0)
     75      1.1  cgd 
     76      1.1  cgd 	stq	sp, 0(s0)
     77      1.1  cgd 	or	s0, zero, sp
     78      1.1  cgd #endif	/* STUPID_PROM_IS_32_BITS */
     79      1.1  cgd 
     80      1.1  cgd 	lda	pv, prom_dispatch_v
     81      1.1  cgd 	ldq	v0, 0(pv)		/* routine */
     82      1.1  cgd 	ldq	pv, 8(pv)		/* routine_arg */
     83      1.1  cgd 
     84      1.1  cgd 	jsr	ra, (v0)
     85      1.1  cgd 
     86      1.1  cgd #ifdef	STUPID_PROM_IS_32_BITS
     87      1.1  cgd 	ldah	s0, 0x2000(zero)	/* hack for hack */
     88      1.1  cgd 	lda	s0, (0x2000-8)(s0)
     89      1.1  cgd 
     90      1.1  cgd 	ldq	sp, 0(s0)
     91      1.1  cgd #endif	/* STUPID_PROM_IS_32_BITS */
     92      1.1  cgd 
     93      1.1  cgd 	ldq	ra, D_RA(sp)
     94      1.1  cgd 	ldq	s0, D_S0(sp)
     95      1.1  cgd 	ldq	s1, D_S1(sp)
     96      1.1  cgd 	ldq	s2, D_S2(sp)
     97      1.1  cgd 	ldq	s3, D_S3(sp)
     98      1.1  cgd 	ldq	s4, D_S4(sp)
     99      1.1  cgd 	ldq	s5, D_S5(sp)
    100      1.1  cgd 	ldq	s6, D_S6(sp)
    101      1.1  cgd 	lda	sp, DISPATCH_FRAME_SIZE(sp)
    102      1.1  cgd 	RET
    103      1.1  cgd END(prom_dispatch)
    104      1.1  cgd 
    105      1.1  cgd #undef	D_RA
    106      1.1  cgd #undef	D_S0
    107      1.1  cgd #undef	D_S1
    108      1.1  cgd #undef	D_S2
    109      1.1  cgd #undef	D_S3
    110      1.1  cgd #undef	D_S4
    111      1.1  cgd #undef	D_S5
    112      1.1  cgd #undef	D_S6
    113      1.1  cgd #undef	DISPATCH_FRAME_SIZE
    114      1.1  cgd #undef	DISPATCH_REGS
    115