diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-04-27 18:42:04 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-04-27 18:42:04 +0000 |
commit | 96d56b36902a1043c5834776411261c26872f4b8 (patch) | |
tree | eda21ba0f0d9dc283c0d152b1eacc21150615d28 /c/src/lib/libbsp/i386/pc386/start | |
parent | Added I386_HAS_BSWAP cpu model feature flag so swap u32 could take (diff) | |
download | rtems-96d56b36902a1043c5834776411261c26872f4b8.tar.bz2 |
Update from Pedro Romano <pmcnr@camoes.rnl.ist.utl.pt>.
Diffstat (limited to 'c/src/lib/libbsp/i386/pc386/start')
-rw-r--r-- | c/src/lib/libbsp/i386/pc386/start/Makefile.in | 19 | ||||
-rw-r--r-- | c/src/lib/libbsp/i386/pc386/start/start.s | 135 |
2 files changed, 33 insertions, 121 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/start/Makefile.in b/c/src/lib/libbsp/i386/pc386/start/Makefile.in index 388e25b482..fc1cb6e136 100644 --- a/c/src/lib/libbsp/i386/pc386/start/Makefile.in +++ b/c/src/lib/libbsp/i386/pc386/start/Makefile.in @@ -8,7 +8,7 @@ VPATH = @srcdir@ RTEMS_ROOT = @top_srcdir@ PROJECT_ROOT = @PROJECT_ROOT@ -PGMS=${ARCH}/start.o +PGMS=${ARCH}/start.o ${ARCH}/start16.bin # C source names, if any, go here -- minus the .c C_PIECES= @@ -18,7 +18,7 @@ C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) H_FILES= # Assembly source names, if any, go here -- minus the .s -S_PIECES=start +S_PIECES=start16 start S_FILES=$(S_PIECES:%=%.s) S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) @@ -50,8 +50,21 @@ LDFLAGS += CLEAN_ADDITIONS += CLOBBER_ADDITIONS += -all: ${ARCH} $(SRCS) $(OBJS) $(PGM) +all: ${ARCH} $(SRCS) $(OBJS) $(PGMS) $(INSTALL_VARIANT) -m 555 ${PGMS} ${PROJECT_RELEASE}/lib # Install the program(s), appending _g or _p as appropriate. # for include files, just use $(INSTALL) + +LINKCMDS=$(srcdir)/../startup/linkcmds + +${ARCH}/start16.o: start16.s + sed -e 's/\/\/.*$$//' < $< | $(CPP) $(ASMFLAGS) -I. -I$(srcdir) \ + -DASM -DSTART32ADDR=$(RELOCADDR) - > $*.i + $(AS) $(ASFLAGS) -o $@ $*.i + +${ARCH}/start16.bin: ${ARCH}/start16.o + $(LD) -N -T $(LINKCMDS) -Ttext $(START16ADDR) -e start16 -nostdlib \ + --oformat=elf32-i386 -o $(basename $@).obj $(basename $@).o + $(OBJCOPY) -O binary $(basename $@).obj $@ + diff --git a/c/src/lib/libbsp/i386/pc386/start/start.s b/c/src/lib/libbsp/i386/pc386/start/start.s index 03ded48d45..9501af12b8 100644 --- a/c/src/lib/libbsp/i386/pc386/start/start.s +++ b/c/src/lib/libbsp/i386/pc386/start/start.s @@ -30,9 +30,6 @@ | * http://www.OARcorp.com/rtems/license.html. | ************************************************************************** | -| Also based on (from the Linux source tree): -| video.S - Copyright (C) 1995, 1996 Martin Mares <mj@k332.feld.cvut.cz> -| | $Id$ +--------------------------------------------------------------------------*/ @@ -40,17 +37,6 @@ #include "asm.h" /*----------------------------------------------------------------------------+ -| Constants -+----------------------------------------------------------------------------*/ - -#ifdef pc386 - -.set PROT_CODE_SEG, 0x08 # offset of code segment descriptor into GDT -.set CR0_PE, 1 # protected mode flag on CR0 register - -#endif /* pc386 */ - -/*----------------------------------------------------------------------------+ | A Descriptor table register has the following format: +----------------------------------------------------------------------------*/ @@ -59,6 +45,13 @@ .set DTR_SIZE, 6 # size of DTR register /*----------------------------------------------------------------------------+ +| Size of heap and stack: ++----------------------------------------------------------------------------*/ + +.set HEAP_SIZE, 0x2000 +.set STACK_SIZE, 0x1000 + +/*----------------------------------------------------------------------------+ | CODE section +----------------------------------------------------------------------------*/ @@ -72,66 +65,10 @@ BEGIN_CODE SYM (start): -/*----------------------------------------------------------------------------+ -| Switch VGA video to 80 lines x 50 columns mode. Has to be done before turning -| protected mode on since it uses BIOS int 10h (video) services. -+----------------------------------------------------------------------------*/ - -#if defined(pc386) && defined(RTEMS_VIDEO_80x50) - -.code16 - - movw $0x0003, ax # forced set - int $0x10 - movw $0x1112, ax # use 8x8 font - xorb %bl, %bl - int $0x10 - movw $0x1201, ax # turn off cursor emulation - movb $0x34, %bl - int $0x10 - movb $0x01, ah # define cursor (scan lines 0 to 7) - movw $0x0007, cx - int $0x10 - -.code32 - -#endif /* pc386 && RTEMS_VIDEO_80x50 */ - nop cli # DISABLE INTERRUPTS!!! /*----------------------------------------------------------------------------+ -| Bare PC machines boot in real mode! We have to turn protected mode on. -+----------------------------------------------------------------------------*/ - -#ifdef pc386 - - data16 - movl $ SYM(gdtptr), eax - data16 - andl $0x0000ffff, eax # get offset into segment - addr16 - lgdt cs:(eax) # load Global Descriptor Table - data16 - movl $ SYM(idtptr), eax - data16 - andl $0x0000ffff, eax # get offset into segment - addr16 - lidt cs:(eax) # load Interrupt Descriptor Table - - movl %cr0, eax - data16 - orl $CR0_PE, eax - movl eax, %cr0 # turn on protected mode - - data16 - ljmp $PROT_CODE_SEG, $ SYM(next) # flush prefetch queue - -SYM(next): - -#endif /* pc386 */ - -/*----------------------------------------------------------------------------+ | Load the segment registers (this is done by the board's BSP) and perform any | other board specific initialization procedures. | @@ -149,9 +86,9 @@ SYM(next): SYM (_establish_stack): movl $_end, eax # eax = end of bss/start of heap - addl $heap_size, eax # eax = end of heap + addl $HEAP_SIZE, eax # eax = end of heap movl eax, stack_start # Save for brk() routine - addl $stack_size, eax # make room for stack + addl $STACK_SIZE, eax # make room for stack andl $0xffffffc0, eax # align it on 16 byte boundary movl eax, esp # set stack pointer movl eax, ebp # set base pointer @@ -262,6 +199,7 @@ SYM (no_gdt_load): cmpb $0, SYM (_Do_Load_IDT) # Should the new IDT be loaded? je SYM (no_idt_load) # NO, then branch lidt SYM (_New_IDTR) # load the new IDT + SYM (no_idt_load): /*---------------------------------------------------------------------+ @@ -315,41 +253,6 @@ END_CODE BEGIN_DATA -#ifdef pc386 - -/************************** -* GLOBAL DESCRIPTOR TABLE * -**************************/ - - .align 4 -SYM(gdtptr): - /* we use the NULL descriptor to store the GDT pointer - a trick quite - nifty due to: Robert Collins (rcollins@x86.org) */ - .word gdtlen - 1 - .long gdtptr - .word 0x0000 - - /* code segment */ - .word 0xffff, 0 - .byte 0, 0x9f, 0xcf, 0 - - /* data segment */ - .word 0xffff, 0 - .byte 0, 0x93, 0xcf, 0 - - .set gdtlen, . - gdtptr # length of GDT - -/************************************* -* INTERRUPT DESCRIPTOR TABLE POINTER * -*************************************/ - - .align 4 -SYM(idtptr): - .word 0x07ff # limit at maximum (allows all 256 interrupts) - .word 0, 0 # base at 0 - -#endif /* pc386 */ - EXTERN (Do_Load_IDT) # defined in the BSP EXTERN (Do_Load_GDT) # defined in the BSP @@ -370,11 +273,13 @@ END_DATA BEGIN_BSS - PUBLIC (heap_size) - .set heap_size, 0x2000 + PUBLIC (_heap_size) +SYM (_heap_size): + .long HEAP_SIZE - PUBLIC (stack_size) - .set stack_size, 0x1000 + PUBLIC (_stack_size) +SYM (_stack_size): + .long STACK_SIZE PUBLIC (Interrupt_descriptor_table) SYM (Interrupt_descriptor_table): @@ -390,14 +295,8 @@ SYM (_New_IDTR): PUBLIC (_Global_descriptor_table) SYM (_Global_descriptor_table): -#ifdef pc386 - .space (3 * 8) # the PC386 bsp only needs 3 segment descriptors: -#else # NULL, CODE and DATA - .space (8192 * 8) - -#endif /* pc386 */ - + # NULL, CODE and DATA PUBLIC (_Original_GDTR) SYM (_Original_GDTR): .space DTR_SIZE |