#
#	This code has been generated by
#	compiling the following C source
#	to assember:
#
# 	void SetupTrapHandler () {
#       	initTraps();
#       	if (setjmp(buf, 1 ) == 0) {
#       	}
# 	}
#
#	The instructions to save and restore
#	r0 and r2 have bee manually inserted.
#	Their values are needed in the
#	Oberon code, to which we will return
#	by 'longjmp' after trap handling.
#
	.file	"ATrapHandler.s"
	.section	.data
Ddata.data:	# asmout
	.section	.bss
Bbss.bss:	# asmout
	.section	.rodata,"a"
Drodata.rodata:	# asmout
	.comm	sbase,4,2
	.comm	raddr,4,2
	.comm	buf,528,2
	.text
	.align  2
	.globl	SetupTrapHandler
SetupTrapHandler:

	mflr	%r0
	stw	%r0,+4(%r1)
	stwu	%r1,-32(%r1)
	addi	%r11,%r1,32

	stw	%r31,+28(%r1)
	stw	%r30,+24(%r1)
	ori	%r30,%r11,0
# -----------------------------------------------
#	save return addr and static base register
#
	addis	%r12,%r0,raddr@ha
	stw	%r0,raddr@l(%r12)
	addis	%r12,%r0,sbase@ha
	stw	%r2,sbase@l(%r12)
#
# -----------------------------------------------

	bl	initTraps

	addis	%r3,%r0,buf@h
	ori	%r3,%r3,buf@l
	addi	%r4,%r0,1
	bl	setjmp

	ori	%r11,%r30,0
	lwz	%r30,+24(%r1)
	lwz	%r31,+28(%r1)
	lwz	%r0,+36(%r1)
# -----------------------------------------------
#	restore return addr and static base register
#
	addis	%r12,%r0,raddr@ha
	lwz	%r0,raddr@l(%r12)
	addis	%r12,%r0,sbase@ha
	lwz	%r2,sbase@l(%r12)
	ori	%r1,%r11,0
	stw	%r2,+20(%r1)
#
# -----------------------------------------------
	mtlr	%r0
	bclr	20,0
	.type SetupTrapHandler, @function
	.size SetupTrapHandler, . - SetupTrapHandler

