1*84d9c625SLionel Sambuc/* $NetBSD: sbrk.S,v 1.6 2013/09/12 15:36:15 joerg Exp $ */ 22fe8fb19SBen Gras 32fe8fb19SBen Gras/* $OpenBSD: sbrk.S,v 1.7 2001/06/04 23:14:04 mickey Exp $ */ 42fe8fb19SBen Gras 52fe8fb19SBen Gras/* 62fe8fb19SBen Gras * Copyright (c) 1999 Michael Shalayeff 72fe8fb19SBen Gras * All rights reserved. 82fe8fb19SBen Gras * 92fe8fb19SBen Gras * Redistribution and use in source and binary forms, with or without 102fe8fb19SBen Gras * modification, are permitted provided that the following conditions 112fe8fb19SBen Gras * are met: 122fe8fb19SBen Gras * 1. Redistributions of source code must retain the above copyright 132fe8fb19SBen Gras * notice, this list of conditions and the following disclaimer. 142fe8fb19SBen Gras * 2. Redistributions in binary form must reproduce the above copyright 152fe8fb19SBen Gras * notice, this list of conditions and the following disclaimer in the 162fe8fb19SBen Gras * documentation and/or other materials provided with the distribution. 172fe8fb19SBen Gras * 182fe8fb19SBen Gras * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 192fe8fb19SBen Gras * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 202fe8fb19SBen Gras * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 212fe8fb19SBen Gras * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, 222fe8fb19SBen Gras * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 232fe8fb19SBen Gras * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 242fe8fb19SBen Gras * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 252fe8fb19SBen Gras * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 262fe8fb19SBen Gras * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 272fe8fb19SBen Gras * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 282fe8fb19SBen Gras * THE POSSIBILITY OF SUCH DAMAGE. 292fe8fb19SBen Gras */ 302fe8fb19SBen Gras 312fe8fb19SBen Gras#include "SYS.h" 322fe8fb19SBen Gras 332fe8fb19SBen Gras#if defined(LIBC_SCCS) && !defined(lint) 34*84d9c625SLionel Sambuc RCSID("$NetBSD: sbrk.S,v 1.6 2013/09/12 15:36:15 joerg Exp $") 352fe8fb19SBen Gras#endif /* LIBC_SCCS and not lint */ 362fe8fb19SBen Gras 37e415d488SLionel Sambuc .global _end 382fe8fb19SBen Gras 392fe8fb19SBen Gras#ifdef WEAK_ALIAS 402fe8fb19SBen Gras WEAK_ALIAS(sbrk, _sbrk) 412fe8fb19SBen Gras#endif 422fe8fb19SBen Gras 432fe8fb19SBen Gras .data 442fe8fb19SBen Gras .export curbrk, data 452fe8fb19SBen Grascurbrk: 46e415d488SLionel Sambuc .long _end 472fe8fb19SBen Gras 482fe8fb19SBen GrasENTRY(_sbrk,0) 49*84d9c625SLionel Sambuc#ifdef __PIC__ 502fe8fb19SBen Gras addil LT%curbrk, %r19 512fe8fb19SBen Gras ldw RT%curbrk(%r1), %r1 522fe8fb19SBen Gras ldw 0(%r1), %t2 53*84d9c625SLionel Sambuc#else /* !__PIC__ */ 542fe8fb19SBen Gras ldil L%curbrk, %t1 552fe8fb19SBen Gras ldw R%curbrk(%t1), %t2 56*84d9c625SLionel Sambuc#endif /* !__PIC__ */ 572fe8fb19SBen Gras add %arg0, %t2, %arg0 582fe8fb19SBen Gras stw %arg0, HPPA_FRAME_ARG(0)(%sp) 592fe8fb19SBen Gras 602fe8fb19SBen Gras SYSCALL(break) 612fe8fb19SBen Gras 62*84d9c625SLionel Sambuc#ifdef __PIC__ 632fe8fb19SBen Gras addil LT%curbrk, %r19 642fe8fb19SBen Gras ldw RT%curbrk(%r1), %r1 65*84d9c625SLionel Sambuc#else /* !__PIC__ */ 662fe8fb19SBen Gras ldil L%curbrk, %t1 672fe8fb19SBen Gras ldo R%curbrk(%t1), %r1 68*84d9c625SLionel Sambuc#endif /* !__PIC__ */ 692fe8fb19SBen Gras ldw 0(%r1), %ret0 702fe8fb19SBen Gras ldw HPPA_FRAME_ARG(0)(%sp), %arg0 712fe8fb19SBen Gras bv %r0(%rp) 722fe8fb19SBen Gras stw %arg0, 0(%r1) 732fe8fb19SBen Gras 742fe8fb19SBen GrasEXIT(sbrk) 752fe8fb19SBen Gras 762fe8fb19SBen Gras .end 77