xref: /netbsd-src/sys/arch/mvme68k/stand/libbug/bugstart.S (revision 437ea53be7edf09a326c52b6c0a25f79b92031d8)
1*437ea53bSchristos/*	$NetBSD: bugstart.S,v 1.1 2014/11/21 20:10:28 christos Exp $	*/
2*437ea53bSchristos
3*437ea53bSchristos#define _LOCORE
4*437ea53bSchristos#include <machine/prom.h>
5*437ea53bSchristos#undef _LOCORE
6*437ea53bSchristos#include <machine/asm.h>
7*437ea53bSchristos
8*437ea53bSchristos	.data
9*437ea53bSchristos	.even
10*437ea53bSchristos
11*437ea53bSchristosGLOBAL(bugargs)
12*437ea53bSchristos	.space	MVMEPROM_ARGS_MAX*4
13*437ea53bSchristos
14*437ea53bSchristos	.text
15*437ea53bSchristos	.even
16*437ea53bSchristos
17*437ea53bSchristos	.long	_C_LABEL(start) - 0x10
18*437ea53bSchristos	.long	_C_LABEL(start)
19*437ea53bSchristos
20*437ea53bSchristos#define	BUG_ARG(which)	_C_LABEL(bugargs) + (which)
21*437ea53bSchristos
22*437ea53bSchristosENTRY_NOPROFILE(_start)
23*437ea53bSchristosENTRY_NOPROFILE(start)
24*437ea53bSchristos	moveml	%d0/%a0,%sp@-
25*437ea53bSchristos	lea	_C_LABEL(edata),%a0
26*437ea53bSchristos	movl	#_C_LABEL(end) - 4,%d0
27*437ea53bSchristos	subl	%a0,%d0
28*437ea53bSchristos	lsrl	#2,%d0
29*437ea53bSchristos1:	clrl	%a0@+
30*437ea53bSchristos	dbra	%d0,1b
31*437ea53bSchristos	moveml	%sp@+,%d0/%a0
32*437ea53bSchristos	movl	MVMEPROM_REG_DEVLUN, BUG_ARG(MVMEPROM_ARGS_DEVLUN)
33*437ea53bSchristos	movl	MVMEPROM_REG_CTRLLUN, BUG_ARG(MVMEPROM_ARGS_CTRLLUN)
34*437ea53bSchristos	movl	MVMEPROM_REG_FLAGS, BUG_ARG(MVMEPROM_ARGS_FLAGS)
35*437ea53bSchristos	movl	MVMEPROM_REG_CTRLADDR, BUG_ARG(MVMEPROM_ARGS_CTRLADDR)
36*437ea53bSchristos	movl	MVMEPROM_REG_ENTRY, BUG_ARG(MVMEPROM_ARGS_ENTRY)
37*437ea53bSchristos	movl	MVMEPROM_REG_CONFBLK, BUG_ARG(MVMEPROM_ARGS_CONFBLK)
38*437ea53bSchristos	movl	MVMEPROM_REG_NBARGSTART, BUG_ARG(MVMEPROM_ARGS_NBARGSTART)
39*437ea53bSchristos	movl	MVMEPROM_REG_NBARGEND, BUG_ARG(MVMEPROM_ARGS_NBARGEND)
40*437ea53bSchristos	movl	MVMEPROM_REG_ARGSTART, BUG_ARG(MVMEPROM_ARGS_ARGSTART)
41*437ea53bSchristos	movl	MVMEPROM_REG_ARGEND, BUG_ARG(MVMEPROM_ARGS_ARGEND)
42*437ea53bSchristos	jmp	_C_LABEL(_bugstart)
43*437ea53bSchristos
44*437ea53bSchristosENTRY_NOPROFILE(bugexec)
45*437ea53bSchristos	addql	#4,%sp
46*437ea53bSchristos	movl	BUG_ARG(MVMEPROM_ARGS_DEVLUN), MVMEPROM_REG_DEVLUN
47*437ea53bSchristos	movl	BUG_ARG(MVMEPROM_ARGS_CTRLLUN), MVMEPROM_REG_CTRLLUN
48*437ea53bSchristos	movl	BUG_ARG(MVMEPROM_ARGS_FLAGS), MVMEPROM_REG_FLAGS
49*437ea53bSchristos	movl	BUG_ARG(MVMEPROM_ARGS_CTRLADDR), MVMEPROM_REG_CTRLADDR
50*437ea53bSchristos	movl	BUG_ARG(MVMEPROM_ARGS_ENTRY), MVMEPROM_REG_ENTRY
51*437ea53bSchristos	movl	BUG_ARG(MVMEPROM_ARGS_CONFBLK), MVMEPROM_REG_CONFBLK
52*437ea53bSchristos	movl	BUG_ARG(MVMEPROM_ARGS_NBARGSTART), MVMEPROM_REG_NBARGSTART
53*437ea53bSchristos	movl	BUG_ARG(MVMEPROM_ARGS_NBARGEND), MVMEPROM_REG_NBARGEND
54*437ea53bSchristos	movl	BUG_ARG(MVMEPROM_ARGS_ARGSTART), MVMEPROM_REG_ARGSTART
55*437ea53bSchristos	movl	BUG_ARG(MVMEPROM_ARGS_ARGEND), MVMEPROM_REG_ARGEND
56*437ea53bSchristosENTRY_NOPROFILE(__main)
57*437ea53bSchristos	rts
58