summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c/src/lib/libbsp/i386/pc386/ChangeLog8
-rw-r--r--c/src/lib/libbsp/i386/pc386/console/outch.c5
-rw-r--r--c/src/lib/libbsp/i386/pc386/startup/bspstart.c55
3 files changed, 40 insertions, 28 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/ChangeLog b/c/src/lib/libbsp/i386/pc386/ChangeLog
index b2f7602cb5..61669b25d5 100644
--- a/c/src/lib/libbsp/i386/pc386/ChangeLog
+++ b/c/src/lib/libbsp/i386/pc386/ChangeLog
@@ -1,3 +1,11 @@
+2004-05-21 Till Strauman <strauman@slac.stanford.edu>
+
+ * PR 624/bsps
+ startup/bspstart.c: When probing the memory, make sure not to
+ corrupt the application. Only probe addresses beyond rtemsFreeMemStart.
+ * Let IBMPC_outch() convert LF -> CRLF to avoid printk scrambling
+ the screen.
+
2004-05-21 Joel Sherrill <joel@OARcorp.com>
* ne2000/ne2000.c, wd8003/wd8003.c: Include errno.h as a consequence of
diff --git a/c/src/lib/libbsp/i386/pc386/console/outch.c b/c/src/lib/libbsp/i386/pc386/console/outch.c
index ecf08ae2ca..7c7371b70b 100644
--- a/c/src/lib/libbsp/i386/pc386/console/outch.c
+++ b/c/src/lib/libbsp/i386/pc386/console/outch.c
@@ -266,8 +266,11 @@ _IBMPC_outch(char c)
{
static int escaped = 0;
- if ( ! (escaped = handleEscape(escaped, c)) )
+ if ( ! (escaped = handleEscape(escaped, c)) ) {
+ if ( '\n' == c )
+ videoPutChar('\r');
videoPutChar(c);
+ }
} /* _IBMPC_outch */
/*-------------------------------------------------------------------------+
diff --git a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c
index 1162de1b88..6b3997d638 100644
--- a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c
+++ b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c
@@ -81,39 +81,40 @@ void bsp_postdriver_hook(void);
void bsp_pretasking_hook(void)
{
uint32_t topAddr, val;
- int i;
+ int i, lowest;
if (rtemsFreeMemStart & (CPU_ALIGNMENT - 1)) /* not aligned => align it */
rtemsFreeMemStart = (rtemsFreeMemStart+CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
- if(_heap_size == 0)
- {
- /*
- * We have to dynamically size memory. Memory size can be anything
- * between 2M and 2048M.
- * let us first write
- */
- for(i=2048; i>=2; i--)
- {
- topAddr = i*1024*1024 - 4;
- *(volatile uint32_t*)topAddr = topAddr;
- }
-
- for(i=2; i<=2048; i++)
- {
- topAddr = i*1024*1024 - 4;
- val = *(uint32_t*)topAddr;
- if(val != topAddr)
- {
- break;
- }
- }
-
- topAddr = (i-1)*1024*1024 - 4;
-
- _heap_size = topAddr - rtemsFreeMemStart;
+ /* find the lowest 1M boundary to probe */
+ lowest = ((rtemsFreeMemStart + (1<<20)) >> 20) + 1;
+ if ( lowest < 2 )
+ lowest = 2;
+
+ if (_heap_size == 0) {
+ /*
+ * We have to dynamically size memory. Memory size can be anything
+ * between no less than 2M and 2048M.
+ * let us first write
+ */
+ for (i=2048; i>=lowest; i--) {
+ topAddr = i*1024*1024 - 4;
+ *(volatile uint32_t*)topAddr = topAddr;
}
+ for(i=lowest; i<=2048; i++) {
+ topAddr = i*1024*1024 - 4;
+ val = *(uint32_t*)topAddr;
+ if (val != topAddr) {
+ break;
+ }
+ }
+
+ topAddr = (i-1)*1024*1024 - 4;
+
+ _heap_size = topAddr - rtemsFreeMemStart;
+ }
+
bsp_libc_init((void *)rtemsFreeMemStart, _heap_size, 0);
rtemsFreeMemStart += _heap_size; /* HEAP_SIZE in KBytes */