aboutsummaryrefslogtreecommitdiff
path: root/unix/as.macosx/zsvjmp.s.OLD
blob: 7d631357782635f801223ea676237e2f33d0c4ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# ZSVJMP.S -- LinuxPPC version, September 2001.

.file	 "zsvjmp.s"

	# ZSVJMP -- SPP callable SETJMP.
.text
	.align	2
	.globl	_zsvjmp_
_zsvjmp_:
	# R3 = buf, R4 = &status
	li	r11,0			; r11 = 0
	stw	r11,0(r4)		; set *status to zero
	stw	r4,0(r3)		; store &status in buf[0]
	addi	r3,r3,4			; reference buf[1] for setjmp
	b	L_setjmp$stub
L2:
	lwz	r1,0(r1)
	lwz	r0,8(r1)
	mtlr	r0
	lmw	r30,-8(r1)
	blr

	# The setjmp code is only available in a dynamic library on 10.1.
.picsymbol_stub
L_setjmp$stub:
        .indirect_symbol _setjmp
        mflr	r0
        bcl	20,31,L1$pb
L1$pb:
        mflr	r11
        addis	r11,r11,ha16(L1$lz-L1$pb)
        mtlr	r0
        lwz	r12,lo16(L1$lz-L1$pb)(r11)
        mtctr	r12
        addi	r11,r11,lo16(L1$lz-L1$pb)
        bctr
.lazy_symbol_pointer
L1$lz:
        .indirect_symbol _setjmp
        .long dyld_stub_binding_helper
.text
.Lfe1:

	# Set the address of the MEM common to zero.
	.globl   mem_
	mem_ = 0


	# GFPUCW -- Get the FPU control register.
	.globl	_gfpucw_
_gfpucw_:
	stwu	r1, -32(r1)
	stw	r31, 28(r1)
	mr	r31, r1
	stw	r3, 8(r31)
	mffs	f0
	stfd	f0, 16(r31)
	lwz	r0, 20(r31)
	mr	r9, r0
	lwz	r9, 8(r31)
	stw	r0, 0(r9)
.L3:
	lwz	r11, 0(r1)
	lwz	r31, -4(r11)
	mr	r1, r11
	blr
.Lfe2:


	# SFPUCW -- Set the FPU control register.

	.globl	_sfpucw_
_sfpucw_:
	stwu	r1, -32(r1)
	stw	r31, 28(r1)
	mr	r31, r1
	stw	r3, 8(r31)
	lis	r0, 0xfff8
	stw	r0, 16(r31)
	lwz	r9, 8(r31)
	lwz	r0, 0(r9)
	stw	r0, 20(r31)
	lfd	f0, 16(r31)
	mtfsf	255, f0
.L4:
	lwz	r11, 0(r1)
	lwz	r31, -4(r11)
	mr	r1, r11
	blr
.Lfe3:


	# CFPUCW -- Clear the exception flags in the FPU control register.
	# So far I have not been able to find a way to make this work, at
	# least with the current version of LinuxPPC.  All of the instructions
	# below fail, raising another SIGFPE if an exception condition is
	# already present.  ANY instruction involving the FPU will raise
	# SIGFPE once the exception condition exists.  Also, LinuxPPC
	# sigaction does not block SIGFPE in the called exception handler,
	# contrary to the manpage.  It appears that the exception handling
	# in the kernel needs to clear the exception condition but is not
	# doing so.  Supervisor level instructions appear to be required to
	# clear the exception condition, so this has to be done in the kernel
	# before the user level signal handler is called.

	.globl	_cfpucw_
_cfpucw_:
	stwu	r1, -32(r1)
	stw	r31, 28(r1)
	mr	r31, r1
	#mcrfs	r0, 0
	#mtfsfi	r0, 0
	#mtfsfi	r3, 0
	#mtfsfi	r3, 0
	#mtfsfi	r5, 0
	#mtfsfb0	r3
	#mtfsfb0	r5
	#mtfsfb0	r7
.L5:
	lwz	r11, 0(r1)
	lwz	r31, -4(r11)
	mr	r1, r11
	blr
.Lfe4: