shithub: riscv

ref: a7b06e0fdd02355b2dc9ce2349afbd25bf8287a3
dir: /sys/src/ape/lib/ap/386/main9.s/

View raw version
#define NPRIVATES	16

GLOBL	_tos(SB), $4
GLOBL	_errnoloc(SB), $4
GLOBL	_privates(SB), $4
GLOBL	_nprivates(SB), $4

TEXT	_main(SB), 1, $(16+NPRIVATES*4)

	/* _tos = arg */
	MOVL	AX, _tos(SB)
	LEAL	12(SP), AX
	MOVL	AX, _errnoloc(SB)
	LEAL	16(SP), AX
	MOVL	AX, _privates(SB)
	MOVL	$NPRIVATES, _nprivates(SB)

	CALL	_envsetup(SB)
	MOVL	inargc-4(FP), AX
	MOVL	AX, 0(SP)
	LEAL	inargv+0(FP), AX
	MOVL	AX, 4(SP)
	MOVL	environ(SB), AX
	MOVL	AX, 8(SP)
	CALL	main(SB)
	MOVL	AX, 0(SP)
	CALL	exit(SB)
	RET