summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1998-06-03 19:00:57 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1998-06-03 19:00:57 +0000
commit3c7916f21c71c878e087c5b4f9b36882c0edd141 (patch)
tree3185c882b5bf443db5e30d7ee5020b2ca842939a /c/src/lib/libbsp
parentAdded CPU_ISR_PASSES_FRAME_POINTER so some ports could pass just the (diff)
downloadrtems-3c7916f21c71c878e087c5b4f9b36882c0edd141.tar.bz2
Update from Pedro Romano <pmcnr@camoes.rnl.ist.utl.pt> with an attempt
to fix start16.s. It does not work locally.
Diffstat (limited to 'c/src/lib/libbsp')
-rw-r--r--c/src/lib/libbsp/i386/pc386/start/Makefile.in2
-rw-r--r--c/src/lib/libbsp/i386/pc386/start/start16.s52
2 files changed, 39 insertions, 15 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/start/Makefile.in b/c/src/lib/libbsp/i386/pc386/start/Makefile.in
index fc1cb6e136..10e4b70448 100644
--- a/c/src/lib/libbsp/i386/pc386/start/Makefile.in
+++ b/c/src/lib/libbsp/i386/pc386/start/Makefile.in
@@ -60,7 +60,7 @@ LINKCMDS=$(srcdir)/../startup/linkcmds
${ARCH}/start16.o: start16.s
sed -e 's/\/\/.*$$//' < $< | $(CPP) $(ASMFLAGS) -I. -I$(srcdir) \
- -DASM -DSTART32ADDR=$(RELOCADDR) - > $*.i
+ -DASM -DHEADERADDR=$(HEADERADDR) - > $*.i
$(AS) $(ASFLAGS) -o $@ $*.i
${ARCH}/start16.bin: ${ARCH}/start16.o
diff --git a/c/src/lib/libbsp/i386/pc386/start/start16.s b/c/src/lib/libbsp/i386/pc386/start/start16.s
index 0e715368ba..c5febfda92 100644
--- a/c/src/lib/libbsp/i386/pc386/start/start16.s
+++ b/c/src/lib/libbsp/i386/pc386/start/start16.s
@@ -1,5 +1,5 @@
/*-------------------------------------------------------------------------+
-| start16hi.s v1.0 - PC386 BSP - 1998/04/13
+| start16.s v1.0 - PC386 BSP - 1998/04/13
+--------------------------------------------------------------------------+
| This file contains the entry point for the application.
| The name of this entry point is compiler dependent.
@@ -27,8 +27,11 @@
+----------------------------------------------------------------------------*/
.set PROT_CODE_SEG, 0x08 # offset of code segment descriptor into GDT
+.set PROT_DATA_SEG, 0x10 # offset of code segment descriptor into GDT
.set CR0_PE, 1 # protected mode flag on CR0 register
-.set START32, START32ADDR # address of protected mode code
+.set HDRSTART, HEADERADDR # address of start of bin2boot header
+.set HDROFF, 0x24 # offset into bin2boot header of start32 addr
+.set STACKOFF, 0x200-0x10 # offset to load into %esp, from start of image
/*----------------------------------------------------------------------------+
| A Descriptor table register has the following format:
@@ -51,6 +54,20 @@ _start16:
.code16
+ cli # DISABLE INTERRUPTS!!!
+
+ movw %cs, %ax #
+ movw %ax, %ds # set the rest of real mode registers
+ movw %ax, %es #
+ movw %ax, %ss #
+
+.code32
+
+ movl $STACKOFF, %esp # set stack pointer
+ movl $STACKOFF, %ebp #
+
+.code16
+
#if defined(RTEMS_VIDEO_80x50)
/*---------------------------------------------------------------------+
@@ -72,29 +89,34 @@ _start16:
#endif /* RTEMS_VIDEO_80x50 */
- cli # DISABLE INTERRUPTS!!!
-
/*---------------------------------------------------------------------+
| Bare PC machines boot in real mode! We have to turn protected mode on.
+---------------------------------------------------------------------*/
- movl $gdtptr, %eax
- andl $0x0000ffff, %eax # get offset into segment
- lgdt %cs:(%eax) # load Global Descriptor Table
- movl $idtptr, %eax
- andl $0x0000ffff, %eax # get offset into segment
- lidt %cs:(%eax) # load Interrupt Descriptor Table
+ lgdt gdtptr - start16 # load Global Descriptor Table
+ lidt idtptr - start16 # load Interrupt Descriptor Table
movl %cr0, %eax
orl $CR0_PE, %eax
movl %eax, %cr0 # turn on protected mode
-
- ljmp $PROT_CODE_SEG, $1f # flush prefetch queue
+
+ ljmp $PROT_CODE_SEG, $1f # flush prefetch queue, and reload %cs
1:
.code32
- /*---------------------------------------------------------------------+ | we have to enable A20 in order to access memory above 1MByte
+ /*---------------------------------------------------------------------+
+ | load the other segment registers
+ +---------------------------------------------------------------------*/
+ movl $PROT_DATA_SEG, %eax
+ movl %ax, %ds
+ movl %ax, %es
+ movl %ax, %ss
+ addl $start16, %esp # fix up stack pointer
+ addl $start16, %ebp # fix up stack pointer
+
+ /*---------------------------------------------------------------------+
+ | we have to enable A20 in order to access memory above 1MByte
+---------------------------------------------------------------------*/
call empty_8042
movb $0xD1, %al # command write
@@ -104,7 +126,9 @@ _start16:
outb %al, $0x60
call empty_8042
- ljmp $PROT_CODE_SEG, $START32 # jump to start of 32 bit code
+ movl %cs:HDRSTART + HDROFF, %eax #
+ pushl %eax # jump to start of 32 bit code
+ ret #
/*----------------------------------------------------------------------------+
| delay