xref: /openbsd/sys/arch/alpha/stand/start.S (revision 5af055cd)
1/*	$OpenBSD: start.S,v 1.6 2011/06/05 21:49:36 miod Exp $	*/
2/*	$NetBSD: start.S,v 1.4 1996/10/17 02:50:40 cgd Exp $	*/
3
4/*
5 * Mach Operating System
6 * Copyright (c) 1992 Carnegie Mellon University
7 * All Rights Reserved.
8 *
9 * Permission to use, copy, modify and distribute this software and its
10 * 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.
14 *
15 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
17 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 *
19 * Carnegie Mellon requests users of this software to return to
20 *
21 *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
22 *  School of Computer Science
23 *  Carnegie Mellon University
24 *  Pittsburgh PA 15213-3890
25 *
26 * any improvements or extensions that they make and grant Carnegie Mellon
27 * the rights to redistribute these changes.
28 */
29
30#include "include/asm.h"
31
32/*
33 * start --
34 *	Entry point for boot/standalone programs.
35 *
36 * Arguments:
37 *	a0				long (first free physical page)
38 *
39 * This is where the prom comes to.  Leaves all exception and interrupts
40 * to prom, runs off prom's stack too.  No return values.
41 */
42	.text
43	.set	noreorder		/* don't reorder instructions */
44
45#define ENTRY_FRAME	32
46
47NESTED(start, 1, ENTRY_FRAME, ra, 0, 0)
48	br	pv,Lstartgp
49Lstartgp:
50	LDGP(pv)
51
52	lda	sp,start
53#ifdef PRIMARY_BOOTBLOCK
54	lda	sp,0x30000-ENTRY_FRAME(sp)
55#else
56	lda	sp,-ENTRY_FRAME(sp)	/* start stack below text */
57#endif
58
59	or	a0,zero,s0
60	lda	a0,_edata
61	lda	a1,_end
62	subq	a1,a0,a1
63	CALL(bzero)
64	or	s0,zero,a0
65
66	CALL(main)			/* transfer to C */
67
68XLEAF(_rtt, 0)
69XLEAF(halt, 0)
70	call_pal PAL_halt		/* halt if we ever return */
71END(start)
72
73/*
74 * Dummy routine for GCC2.
75 */
76LEAF(__main,0)
77	RET
78END(__main)
79
80/*
81 * cpu_number
82 *	Return the cpu number, using the whami instruction.
83 */
84LEAF(cpu_number, 0)
85	call_pal PAL_VMS_mfpr_whami
86	RET
87END(cpu_number)
88