X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/ef7f2ecf428b106013e9abcb9df8c9e4a42e14fe..6ec53610779ef25c81900ddaf0b49eca117cd6ef:/usr/src/lib/libc/gmon/gmon.c?ds=inline diff --git a/usr/src/lib/libc/gmon/gmon.c b/usr/src/lib/libc/gmon/gmon.c index ace54dfae8..1c9f0d6740 100644 --- a/usr/src/lib/libc/gmon/gmon.c +++ b/usr/src/lib/libc/gmon/gmon.c @@ -1,4 +1,4 @@ -static char *sccsid = "@(#)gmon.c 1.8 (Berkeley) %G%"; +static char *sccsid = "@(#)gmon.c 4.4 (Berkeley) %G%"; #ifdef DEBUG #include @@ -48,14 +48,15 @@ start() /* * ALL REGISTER VARIABLES!!! */ - register struct kframe *kfp; /* r11 */ + register int r11; /* init needs r11 */ + register struct kframe *kfp; /* r10 */ register char **targv; register char **argv; #ifdef lint kfp = 0; #else not lint - asm( " movl sp,r11" ); /* catch it quick */ + asm( " movl sp,r10" ); /* catch it quick */ #endif not lint for ( argv = targv = &kfp -> kargv[0] ; *targv++ ; /* void */ ) /* VOID */ ; @@ -89,6 +90,7 @@ static unsigned short tolimit = 0; static char *s_lowpc = 0; static char *s_highpc = 0; static unsigned long s_textsize = 0; +static char *minsbrk = 0; static int ssiz; static int *sbuf; @@ -296,3 +298,23 @@ monitor( lowpc , highpc , buf , bufsiz ) o = 65536; profil( buf , bufsiz , lowpc , o ); } + +/* + * This is a stub for the "brk" system call, which we want to + * catch so that it will not deallocate our data space. + * (of which the program is not aware) + */ +asm("#define _curbrk curbrk"); +extern char *curbrk; + +brk(addr) + char *addr; +{ + + if (addr < minsbrk) + addr = minsbrk; + asm(" chmk $17"); + asm(" jcs cerror"); + curbrk = addr; + return (0); +}