h49779
s 00050/00000/00000
d D 1.1 82/08/03 08:49:02 cecily 1 0
e
u
U
t
T
I 1
brk	title	unix c svc library -- sbrk, brk

.break	equ	17

	entry	sbrk,brk
	extrn	end
r0	equ	0
r1	equ	1
sp	equ	7
rf	equ	15
	impur
svcbrk	svc	0,.break
newtop	dc	a(*-*)
top	dc	a(end)
	pure
brk	equ	*
	l	r1,0(sp)	new top
	st	r1,newtop
	svc	0,0
	dc	a(svcbrk)
	bc	error
	l	r1,newtop
	st	r1,top
	xar	r0,r0
	br	rf
*
sbrk	equ	*
	l	r0,top		previous top
	l	r1,0(sp)	increment
	bzr	rf
	ar	r1,r0		+ old top ==> new top
	st	r1,newtop		new top
	svc	0,0
	dc	a(svcbrk)	* set new break *
	bc	error		no core ?
	l	r0,top
	lr	r1,r0
	a	r1,0(sp)
	st	r1,top
	br	rf

error	equ	*
	st	r0,errno	error
	lcs	r0,1
	br	rf

errno	comn
	das	1
	ends
	end
E 1
