summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i386/pc386/startup
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1998-04-27 18:42:04 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1998-04-27 18:42:04 +0000
commit96d56b36902a1043c5834776411261c26872f4b8 (patch)
treeeda21ba0f0d9dc283c0d152b1eacc21150615d28 /c/src/lib/libbsp/i386/pc386/startup
parentAdded I386_HAS_BSWAP cpu model feature flag so swap u32 could take (diff)
downloadrtems-96d56b36902a1043c5834776411261c26872f4b8.tar.bz2
Update from Pedro Romano <pmcnr@camoes.rnl.ist.utl.pt>.
Diffstat (limited to 'c/src/lib/libbsp/i386/pc386/startup')
-rw-r--r--c/src/lib/libbsp/i386/pc386/startup/bspstart.c21
-rw-r--r--c/src/lib/libbsp/i386/pc386/startup/ldsegs.s37
2 files changed, 14 insertions, 44 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c
index 305545dee0..370b7487d7 100644
--- a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c
+++ b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c
@@ -41,16 +41,13 @@
/*-------------------------------------------------------------------------+
| Global Variables
+--------------------------------------------------------------------------*/
-#ifdef RTEMS_SMALL_MEMORY
extern rtems_unsigned32 _end; /* End of BSS. Defined in 'linkcmds'. */
+extern rtems_unsigned32 _heap_size; /* Size of stack. Defined in 'start.s'. */
+extern rtems_unsigned32 _stack_size; /* Size of heap. Defined in 'start.s'. */
-rtems_unsigned32 rtemsFreeMemStart = (rtems_unsigned32)&_end;
+rtems_unsigned32 rtemsFreeMemStart;
/* Address of start of free memory - should be updated
after creating new partitions or regions. */
-#else
-rtems_unsigned32 rtemsFreeMemStart = RAM_START;
- /* RAM_START defined in 'bsp.h'. */
-#endif /* RTEMS_SMALL_MEMORY */
/* The original BSP configuration table from the application and our copy of it
with some changes. */
@@ -105,6 +102,9 @@ void bsp_pretasking_hook(void)
+--------------------------------------------------------------------------*/
void bsp_start( void )
{
+ rtemsFreeMemStart = (rtems_unsigned32)&_end + _heap_size + _stack_size;
+ /* set the value of start of free memory. */
+
/* If we don't have command line arguments set default program name. */
Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
@@ -118,8 +118,11 @@ void bsp_start( void )
Cpu_table.interrupt_stack_size = 4096;
Cpu_table.extra_mpci_receive_server_stack = 0;
- /* Place RTEMS workspace at top of physical RAM (RAM_END defined in 'bsp.h' */
+ /* Place RTEMS workspace at beginning of free memory. */
+
+ if (rtemsFreeMemStart & (CPU_ALIGNMENT - 1)) /* not aligned => align it */
+ rtemsFreeMemStart = (rtemsFreeMemStart+CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
- BSP_Configuration.work_space_start =
- (void *)(RAM_END - BSP_Configuration.work_space_size);
+ BSP_Configuration.work_space_start = (void *)rtemsFreeMemStart;
+ rtemsFreeMemStart += BSP_Configuration.work_space_size;
} /* bsp_start */
diff --git a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.s b/c/src/lib/libbsp/i386/pc386/startup/ldsegs.s
index 2aba236d21..16f791830a 100644
--- a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.s
+++ b/c/src/lib/libbsp/i386/pc386/startup/ldsegs.s
@@ -69,27 +69,6 @@ BEGIN_CODE
EXTERN (establish_stack)
/*----------------------------------------------------------------------------+
-| empty_8042
-+------------------------------------------------------------------------------
-| This routine checks that the keyboard command queue is empty (after emptying
-| the output buffers).
-| No timeout is used - if this hangs there is something wrong with the machine,
-| and we probably couldn't proceed anyway.
-+----------------------------------------------------------------------------*/
-SYM(empty_8042):
- call delay
- inb $0x64, al # 8042 status port
- testb $0x01, al # output buffer?
- jz SYM(no_output)
- call SYM(delay)
- in $0x60, al # read it
- jmp SYM(empty_8042)
-SYM(no_output):
- test $0x02, al # is input buffer full?
- jnz SYM(empty_8042) # yes - loop
- ret
-
-/*----------------------------------------------------------------------------+
| delay
+------------------------------------------------------------------------------
| Delay is needed after doing I/O. We do it by writing to a non-existent port.
@@ -100,8 +79,8 @@ SYM(delay):
/*-------------------------------------------------------------------------+
| Function: _load_segments
-| Description: Load board segment registers with apropriate values + enable
- A20 line + reprogram PIC.
+| Description: Load board segment registers with apropriate values +
+| reprogram PIC.
| Global Variables: None.
| Arguments: None.
| Returns: Nothing.
@@ -116,18 +95,6 @@ SYM (_load_segments):
LOAD_SEGMENTS(RESET_GS, gs)
/*---------------------------------------------------------------------+
- | we have to enable A20 in order to access memory above 1MByte
- +---------------------------------------------------------------------*/
-
- call SYM(empty_8042)
- movb $0xD1, al # command write
- outb al, $0x64
- call SYM(empty_8042)
- movb $0xDF, al # A20 on
- outb al, $0x60
- call SYM(empty_8042)
-
- /*---------------------------------------------------------------------+
| Now we have to reprogram the interrupts :-(. We put them right after
| the intel-reserved hardware interrupts, at int 0x20-0x2F. There they
| won't mess up anything. Sadly IBM really messed this up with the