Add ddb-kseg0.ld and switch to kseg1 if sizing memory from kseg0

This commit is contained in:
Michael Meissner
2001-10-18 02:24:30 +00:00
parent bd71a776e8
commit b5b5b0d4de
6 changed files with 212 additions and 22 deletions

View File

@ -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;