xref: /netbsd-src/sys/arch/pmax/stand/common/printf.S (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1/*	$NetBSD: printf.S,v 1.6 2009/12/14 00:46:11 matt Exp $	*/
2
3/*-
4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jonathan Stone, Michael Hitch and Simon Burge.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#include <mips/asm.h>
33#include <mips/cpuregs.h>
34#include <machine/dec_prom.h>
35
36LEAF(printf)
37	lw	v0, _C_LABEL(callv)	# get pointer to call back vectors
38	lw	t9, 0x30(v0)	# offset for callv->_printf
39	nop
40#ifdef __mips_n32
41	/*
42	 * If someone calls printf with more than 4 args on n32,
43	 * we need to synthesize a o32 call.  For now we assume no more than
44	 * 8 arguments and no 64bit values.
45	 */
46	subu	sp, sp,	48
47	sw	a4, 16(sp)
48	sw	a5, 20(sp)
49	sw	a6, 24(sp)
50	sw	a7, 28(sp)
51	sw	ra, 44(sp)
52	jalr	t9		# call PROM printf
53	 nop
54	lw	ra, 44(sp)
55	j	ra
56	 addu	sp, sp, 48
57#else
58	j	t9		# call PROM printf
59	nop
60#endif
61END(printf)
62