From: Chris Hanson Date: Wed, 21 Aug 2002 02:21:56 +0000 (+0000) Subject: Add support for running under valgrind. X-Git-Tag: 20090517-FFI~2155 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=181fbc321257cd415830d6db8cd68fa933b56f09;p=mit-scheme.git Add support for running under valgrind. --- diff --git a/v7/src/microcode/cmpauxmd/i386.m4 b/v7/src/microcode/cmpauxmd/i386.m4 index 1f7701df2..df5330001 100644 --- a/v7/src/microcode/cmpauxmd/i386.m4 +++ b/v7/src/microcode/cmpauxmd/i386.m4 @@ -1,6 +1,6 @@ ### -*-Midas-*- ### -### $Id: i386.m4,v 1.58 2002/07/02 18:13:28 cph Exp $ +### $Id: i386.m4,v 1.59 2002/08/21 02:21:56 cph Exp $ ### ### Copyright (c) 1992-2002 Massachusetts Institute of Technology ### @@ -133,6 +133,8 @@ ### what you're doing. ### DISABLE_387 ### If defined, do not generate 387 floating-point instructions. +### VALGRIND_MODE +### If defined, modify code to make it work with valgrind. #### Utility macros and definitions @@ -406,11 +408,13 @@ define_c_label(i386_interface_initialize) IF387(` # OP(mov,l) TW(REG(cr0),REG(ecx)) # Test for 387 presence +ifdef(`VALGRIND_MODE',`',` smsw REG(cx) OP(mov,l) TW(IMM(HEX(12)),REG(edx)) OP(and,l) TW(REG(edx),REG(ecx)) OP(cmp,l) TW(REG(edx),REG(ecx)) jne i386_initialize_no_fp +') OP(inc,l) REG(eax) # 387 available OP(sub,l) TW(IMM(4),REG(esp)) fclex diff --git a/v7/src/microcode/configure.in b/v7/src/microcode/configure.in index 4050bca9f..28306366c 100644 --- a/v7/src/microcode/configure.in +++ b/v7/src/microcode/configure.in @@ -17,7 +17,7 @@ dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA dnl 02111-1307, USA. -AC_REVISION([$Id: configure.in,v 11.16 2002/03/15 04:07:43 cph Exp $]) +AC_REVISION([$Id: configure.in,v 11.17 2002/08/21 02:21:06 cph Exp $]) AC_INIT(boot.c) AC_CONFIG_HEADER(config.h) @@ -26,6 +26,8 @@ AC_ARG_ENABLE(static-libs, [ --enable-static-libs Link some libraries statically [no]]) AC_ARG_ENABLE(dynamic-crypto, [ --enable-dynamic-crypto Link crypto primitives dynamically [yes]]) +AC_ARG_ENABLE(valgrind-mode, +[ --enable-valgrind-mode Support running under valgrind [no]]) AC_ARG_WITH(openssl, [ --with-openssl Use the OpenSSL crypto library if available [yes]]) AC_ARG_WITH(mhash, @@ -561,6 +563,11 @@ else STATIC_LIBS="${STATIC_LIBS}${QUASI_STATIC_LIBS}" fi +if test "${enable_valgrind_mode:-no}" != "no"; then + SCHEME_DEFS="${SCHEME_DEFS} -DVALGRIND_MODE" + M4_FLAGS="${M4_FLAGS} -P VALGRIND_MODE,1" +fi + dnl Add support for X if present. if test "${no_x}" = "yes"; then LIB_X11= diff --git a/v7/src/microcode/ux.c b/v7/src/microcode/ux.c index f526126a7..a59ba79b6 100644 --- a/v7/src/microcode/ux.c +++ b/v7/src/microcode/ux.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: ux.c,v 1.20 2000/12/05 21:23:48 cph Exp $ +$Id: ux.c,v 1.21 2002/08/21 02:21:35 cph Exp $ -Copyright (c) 1990-2000 Massachusetts Institute of Technology +Copyright (c) 1990-2002 Massachusetts Institute of Technology This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. */ #include "ux.h" @@ -639,7 +640,13 @@ linux_heap_malloc (unsigned long requested_length) { unsigned long ps = (getpagesize ()); void * addr - = (mmap (((void *) ps), + = (mmap (((void *) +#ifndef VALGRIND_MODE + ps +#else + 0x10000 +#endif + ), (((requested_length + (ps - 1)) / ps) * ps), (PROT_EXEC | PROT_READ | PROT_WRITE), (MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED),