1/* 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This software was developed by the Computer Systems Engineering group 6 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 7 * contributed to Berkeley. 8 * 9 * %sccs.include.redist.c% 10 * 11 * from: $Header: brk.s,v 1.3 92/06/25 12:56:05 mccanne Exp $ 12 */ 13 14#if defined(LIBC_SCCS) && !defined(lint) 15 .asciz "@(#)brk.s 8.1 (Berkeley) 06/04/93" 16#endif /* LIBC_SCCS and not lint */ 17 18#include "SYS.h" 19 20 .globl curbrk 21 .globl minbrk 22 23 .data 24minbrk: .long _end ! lower brk limit; also for gmon code 25 .text 26 27ENTRY(brk) 28 sethi %hi(minbrk), %o1 ! %o1 = minbrk 29 ld [%o1 + %lo(minbrk)], %o1 30 cmp %o1, %o0 ! if (minbrk > %o0) 31 bg,a 0f 32 mov %o1, %o0 ! %o0 = minbrk 330: 34 mov %o0, %o2 ! save argument to syscall 35 mov SYS_break, %g1 36 t ST_SYSCALL 37 bcc,a 1f 38 sethi %hi(curbrk), %g1 39 ERROR() 401: 41 retl ! success, return 0 & record new break 42 st %o2, [%g1 + %lo(curbrk)] 43