xref: /netbsd-src/lib/libc/arch/m68k/sys/sbrk.S (revision 10392817ffbdbbe9952cba6b51fa3524649baf0e)
1*10392817Smatt/*	$NetBSD: sbrk.S,v 1.17 2013/07/24 15:38:07 matt Exp $	*/
26cdbd4c2Sthorpej
375d4ac97Spaulus/*-
475d4ac97Spaulus * Copyright (c) 1990 The Regents of the University of California.
575d4ac97Spaulus * All rights reserved.
675d4ac97Spaulus *
775d4ac97Spaulus * This code is derived from software contributed to Berkeley by
875d4ac97Spaulus * the Systems Programming Group of the University of Utah Computer
975d4ac97Spaulus * Science Department.
1075d4ac97Spaulus *
1175d4ac97Spaulus * Redistribution and use in source and binary forms, with or without
1275d4ac97Spaulus * modification, are permitted provided that the following conditions
1375d4ac97Spaulus * are met:
1475d4ac97Spaulus * 1. Redistributions of source code must retain the above copyright
1575d4ac97Spaulus *    notice, this list of conditions and the following disclaimer.
1675d4ac97Spaulus * 2. Redistributions in binary form must reproduce the above copyright
1775d4ac97Spaulus *    notice, this list of conditions and the following disclaimer in the
1875d4ac97Spaulus *    documentation and/or other materials provided with the distribution.
19eb7c1594Sagc * 3. Neither the name of the University nor the names of its contributors
2075d4ac97Spaulus *    may be used to endorse or promote products derived from this software
2175d4ac97Spaulus *    without specific prior written permission.
2275d4ac97Spaulus *
2375d4ac97Spaulus * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2475d4ac97Spaulus * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2575d4ac97Spaulus * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2675d4ac97Spaulus * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2775d4ac97Spaulus * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2875d4ac97Spaulus * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2975d4ac97Spaulus * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3075d4ac97Spaulus * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3175d4ac97Spaulus * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3275d4ac97Spaulus * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3375d4ac97Spaulus * SUCH DAMAGE.
3475d4ac97Spaulus */
3575d4ac97Spaulus
3675d4ac97Spaulus#include "SYS.h"
3775d4ac97Spaulus
386cdbd4c2Sthorpej#if defined(LIBC_SCCS) && !defined(lint)
396cdbd4c2Sthorpej#if 0
406cdbd4c2Sthorpej	RCSID("from: @(#)sbrk.s	5.1 (Berkeley) 5/12/90")
416cdbd4c2Sthorpej#else
42*10392817Smatt	RCSID("$NetBSD: sbrk.S,v 1.17 2013/07/24 15:38:07 matt Exp $")
436cdbd4c2Sthorpej#endif
446cdbd4c2Sthorpej#endif /* LIBC_SCCS and not lint */
456cdbd4c2Sthorpej
46f56935acSkleink	.globl	_end
4707a0a325Smatt	.globl	_C_LABEL(__curbrk)
482d913a7cSmatt	.hidden	_C_LABEL(__curbrk)
4975d4ac97Spaulus
5003f996bdSkleink#ifdef WEAK_ALIAS
5103f996bdSkleinkWEAK_ALIAS(sbrk, _sbrk)
5203f996bdSkleink#endif
5303f996bdSkleink
5415bc7ed3Skleink	.data
5507a0a325Smatt_C_LABEL(__curbrk):
5607a0a325Smatt	.long	_end
5715bc7ed3Skleink
5875d4ac97Spaulus	.text
5975d4ac97Spaulus
6003f996bdSkleinkENTRY(_sbrk)
612d913a7cSmatt	LEA_LCL(_C_LABEL(__curbrk),%a1)
6207a0a325Smatt	movl	(%a1),%d0
6307a0a325Smatt	addl	%d0,4(%sp)
642d913a7cSmatt	SYSTRAP(break)
65*10392817Smatt	jcs 	CERROR
6607a0a325Smatt	movl	(%a1),%d0
6707a0a325Smatt	movl	4(%sp),(%a1)
681d0a4330Sitohy#ifdef	__SVR4_ABI__
693b435a73Sthorpej	movl	%d0,%a0
701d0a4330Sitohy#endif
7175d4ac97Spaulus	rts
722d913a7cSmattEND(_sbrk)
73