sbrk.S revision 1.4
11.1Sragge/*
21.1Sragge * Copyright (c) 1983, 1993
31.1Sragge *	The Regents of the University of California.  All rights reserved.
41.1Sragge *
51.1Sragge * Redistribution and use in source and binary forms, with or without
61.1Sragge * modification, are permitted provided that the following conditions
71.1Sragge * are met:
81.1Sragge * 1. Redistributions of source code must retain the above copyright
91.1Sragge *    notice, this list of conditions and the following disclaimer.
101.1Sragge * 2. Redistributions in binary form must reproduce the above copyright
111.1Sragge *    notice, this list of conditions and the following disclaimer in the
121.1Sragge *    documentation and/or other materials provided with the distribution.
131.1Sragge * 3. All advertising materials mentioning features or use of this software
141.1Sragge *    must display the following acknowledgement:
151.1Sragge *	This product includes software developed by the University of
161.1Sragge *	California, Berkeley and its contributors.
171.1Sragge * 4. Neither the name of the University nor the names of its contributors
181.1Sragge *    may be used to endorse or promote products derived from this software
191.1Sragge *    without specific prior written permission.
201.1Sragge *
211.1Sragge * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
221.1Sragge * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
231.1Sragge * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
241.1Sragge * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
251.1Sragge * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261.1Sragge * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
271.1Sragge * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
281.1Sragge * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
291.1Sragge * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
301.1Sragge * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311.1Sragge * SUCH DAMAGE.
321.1Sragge */
331.1Sragge
341.1Sragge#if defined(SYSLIBC_SCCS) && !defined(lint)
351.1Sragge	/* .asciz "@(#)sbrk.s	8.1 (Berkeley) 6/4/93" */
361.4Skleink	.asciz "$NetBSD: sbrk.S,v 1.4 2000/06/23 15:40:39 kleink Exp $"
371.1Sragge#endif /* SYSLIBC_SCCS and not lint */
381.1Sragge
391.1Sragge#include "SYS.h"
401.1Sragge
411.1Sragge
421.1Sragge	.globl	_end
431.3Skleink	.globl	___minbrk
441.1Sragge	.globl	curbrk
451.1Sragge
461.4Skleink#ifdef WEAK_ALIAS
471.4SkleinkWEAK_ALIAS(sbrk, _sbrk)
481.4Skleink#endif
491.4Skleink
501.1Sragge	.data
511.3Skleink___minbrk:
521.3Skleink	.long	_end
531.1Sraggecurbrk:	.long	_end
541.1Sragge	.text
551.1Sragge
561.4Skleink#ifdef WEAK_ALIAS
571.4SkleinkENTRY(_sbrk, 0)
581.4Skleink#else
591.2SraggeENTRY(sbrk, 0)
601.4Skleink#endif
611.1Sragge	addl3	curbrk,4(ap),-(sp)
621.1Sragge	pushl	$1
631.1Sragge	movl	ap,r3
641.1Sragge	movl	sp,ap
651.1Sragge	chmk	$ SYS_break
661.1Sragge	jcs 	err
671.1Sragge	movl	curbrk,r0
681.1Sragge	addl2	4(r3),curbrk
691.1Sragge	ret
701.1Sraggeerr:
711.1Sragge	jmp	cerror
72