shithub: riscv

ref: d8d47f14b5ed8f6d3f892761ed86c6ce2075c337
dir: /sys/src/9/alphapc/initcode/

View raw version
#include "/sys/src/libc/9syscall/sys.h"

/*
 *  we pass in the argument of the exec parameters as 0(FP)
 */

TEXT	main(SB),$16

	MOVQ	$setSB(SB), R29
	MOVQ	$boot(SB), R0
	ADDQ	$24, R30, R1	/* get a pointer to 0(FP) */
	MOVL	R0, 8(R30)
	MOVL	R1, 12(R30)
	JSR	exec(SB)

	MOVQ	$(1<<4), R0
	MOVL	R0, 8(R30)
	MOVQ	$RFORK, R0
	CALL_PAL $0x83
	MOVQ	$RFORK, R0
	CALL_PAL $0x83
	MOVQ	$RFORK, R0
	CALL_PAL $0x83
again:
	ADDL	$1, R1
	MOVQ	$0, R0	/* print r1 */
	CALL_PAL $0x83
	MOVQ	$100000000, R2
foo:
	SUBQ	$1, R2
	BNE	R2, foo
	MOVQ	$1000, R0
	MOVL	R0, 8(R30)
	MOVQ	$SLEEP, R0
	CALL_PAL $0x83
	JMP	again

TEXT	exec(SB), $0
	MOVQ	$EXEC, R0
	CALL_PAL $0x83
	RET

DATA	boot+0(SB)/5,$"/boot"
DATA	boot+5(SB)/5,$"/boot"
DATA	bootv+0(SB)/4,$boot+6(SB)
GLOBL	boot+0(SB),$11
GLOBL	bootv+0(SB),$8