diff options
Diffstat (limited to 'libgloss/mips/cma101.c')
-rw-r--r-- | libgloss/mips/cma101.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libgloss/mips/cma101.c b/libgloss/mips/cma101.c index 0a70440ab..83fa4d5ac 100644 --- a/libgloss/mips/cma101.c +++ b/libgloss/mips/cma101.c @@ -1,7 +1,7 @@ /* * cma101.c -- lo-level support for Cogent CMA101 development board. * - * Copyright (c) 1996 Cygnus Support + * Copyright (c) 1996, 2001 Cygnus Support * * The authors hereby grant permission to use, copy, modify, distribute, * and license this software and its documentation for any purpose, provided @@ -187,8 +187,14 @@ __sizemem () unsigned int baseorig; unsigned int sr; extern void *end; + char *endptr = (char *)&end; int extra; + /* If we are running in kernel segment 0 (possibly cached), try sizing memory + in kernel segment 1 (uncached) to avoid some problems with monitors. */ + if (endptr >= K0BASE_ADDR && endptr < K1BASE_ADDR) + endptr = (endptr - K0BASE_ADDR) + K1BASE_ADDR; + INTDISABLE(sr,baseorig); /* disable all interrupt masks */ __default_buserr_handler(); @@ -200,8 +206,8 @@ __sizemem () for an int pointer, so we adjust the address to make sure it is safe. We use void * arithmetic to avoid accidentally truncating the pointer. */ - extra = ((int) &end & (sizeof (int) - 1)); - base = ((void *) &end + sizeof (int) - extra); + extra = ((int) endptr & (sizeof (int) - 1)); + base = ((void *) endptr + sizeof (int) - extra); baseorig = *base; *base = SM_PATTERN; |