PERFORCE change 118354 for review

Oleksandr Tymoshenko gonzo at FreeBSD.org
Wed Apr 18 11:02:30 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=118354

Change 118354 by gonzo at gonzo_jeeves on 2007/04/18 11:02:28

	o Rollback latest change and add comment why this is
	    the right thing (tm).

Affected files ...

.. //depot/projects/mips2/src/lib/libc/mips/sys/sbrk.S#6 edit

Differences ...

==== //depot/projects/mips2/src/lib/libc/mips/sys/sbrk.S#6 (text+ko) ====

@@ -55,15 +55,29 @@
 	.cpload	t9
 	.set	reorder
 #endif
-	lw	v1, _C_LABEL(__curbrk)
+	addu	sp, sp, -4
+	sw	s0, 0(sp)		# Preserve s0 value in stack
+					# it should be the same on return
+					# We can't use v1 as temporary
+					# register since syscall uses it
+					# to return 64-bit values
+	lw	s0, _C_LABEL(__curbrk)
 	li	v0, SYS_break
-	addu	a0, a0, v1		# compute current break
+	addu	a0, a0, s0		# compute current break
+
 	syscall
+
 	bne	a3, zero, 1f
-	move	v0, v1			# return old val of curbrk from above
+	nop
+	move	v0, s0			# return old val of curbrk from above
+	lw	s0, 0(sp)
+	addu	sp, sp, 4
 	sw	a0, _C_LABEL(__curbrk)	# save current val of curbrk from above
 	j	ra
+
 1:
+	lw	s0, 0(sp)
+	addu	sp, sp, 4
 	la	t9, _C_LABEL(__cerror)
 	jr	t9
 END(__sys_sbrk)


More information about the p4-projects mailing list