From 99648958668d3a33ee57974479b36201fe303f34 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 20 Apr 2018 10:35:35 +0200 Subject: bsps: Move startup files to bsps Adjust build support files to new directory layout. This patch is a part of the BSP source reorganization. Update #3285. --- c/src/lib/libbsp/i386/pc386/Makefile.am | 18 +- .../lib/libbsp/i386/pc386/startup/bsp_fatal_halt.c | 24 -- c/src/lib/libbsp/i386/pc386/startup/bsp_specs | 9 - c/src/lib/libbsp/i386/pc386/startup/bspcmdline.c | 60 ----- .../lib/libbsp/i386/pc386/startup/bspgetworkarea.c | 135 ----------- c/src/lib/libbsp/i386/pc386/startup/bspidle.S | 19 -- c/src/lib/libbsp/i386/pc386/startup/bspreset.c | 18 -- c/src/lib/libbsp/i386/pc386/startup/bspstart.c | 141 ------------ c/src/lib/libbsp/i386/pc386/startup/ldsegs.S | 238 ------------------- c/src/lib/libbsp/i386/pc386/startup/linkcmds | 253 --------------------- 10 files changed, 9 insertions(+), 906 deletions(-) delete mode 100644 c/src/lib/libbsp/i386/pc386/startup/bsp_fatal_halt.c delete mode 100644 c/src/lib/libbsp/i386/pc386/startup/bsp_specs delete mode 100644 c/src/lib/libbsp/i386/pc386/startup/bspcmdline.c delete mode 100644 c/src/lib/libbsp/i386/pc386/startup/bspgetworkarea.c delete mode 100644 c/src/lib/libbsp/i386/pc386/startup/bspidle.S delete mode 100644 c/src/lib/libbsp/i386/pc386/startup/bspreset.c delete mode 100644 c/src/lib/libbsp/i386/pc386/startup/bspstart.c delete mode 100644 c/src/lib/libbsp/i386/pc386/startup/ldsegs.S delete mode 100644 c/src/lib/libbsp/i386/pc386/startup/linkcmds (limited to 'c/src/lib/libbsp/i386/pc386') diff --git a/c/src/lib/libbsp/i386/pc386/Makefile.am b/c/src/lib/libbsp/i386/pc386/Makefile.am index 2b3ee03a2a..094697ed57 100644 --- a/c/src/lib/libbsp/i386/pc386/Makefile.am +++ b/c/src/lib/libbsp/i386/pc386/Makefile.am @@ -11,7 +11,7 @@ CLEANFILES = include $(top_srcdir)/../../../../automake/compile.am include $(top_srcdir)/../../bsp.am -dist_project_lib_DATA = startup/bsp_specs +dist_project_lib_DATA = ../../../../../../bsps/i386/pc386/start/bsp_specs noinst_PROGRAMS = @@ -104,20 +104,20 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/pci/pci_bus_count.c librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/pci/pci_find_device.c # startup -librtemsbsp_a_SOURCES += startup/bsp_fatal_halt.c -librtemsbsp_a_SOURCES += startup/bspgetworkarea.c -librtemsbsp_a_SOURCES += startup/bspidle.S -librtemsbsp_a_SOURCES += startup/bspstart.c -librtemsbsp_a_SOURCES += startup/bspcmdline.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/i386/pc386/start/bsp_fatal_halt.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/i386/pc386/start/bspgetworkarea.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/i386/pc386/start/bspidle.S +librtemsbsp_a_SOURCES += ../../../../../../bsps/i386/pc386/start/bspstart.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/i386/pc386/start/bspcmdline.c librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c -librtemsbsp_a_SOURCES += startup/bspreset.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/i386/pc386/start/bspreset.c librtemsbsp_a_SOURCES += ../shared/irq/idt.c librtemsbsp_a_SOURCES += ../shared/irq/irq.c librtemsbsp_a_SOURCES += ../shared/irq/irq_init.c librtemsbsp_a_SOURCES += ../shared/irq/elcr.c librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c -librtemsbsp_a_SOURCES += startup/ldsegs.S +librtemsbsp_a_SOURCES += ../../../../../../bsps/i386/pc386/start/ldsegs.S librtemsbsp_a_SOURCES += ../shared/irq/irq_asm.S librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-default-handler.c @@ -140,7 +140,7 @@ appcpustart.$(OBJEXT): ../../../../../../bsps/i386/pc386/start/start16.S $(CPPASCOMPILE) $(AM_CPPFLAGS) -DSMP_SECONDARY_CORE -o $@ -c $< appstart.$(OBJEXT): appcpustart.$(OBJEXT) - $(LD) -r -N -T $(top_srcdir)/startup/linkcmds \ + $(LD) -r -N -T $(top_srcdir)/../../../../../../bsps/i386/pc386/start/linkcmds \ -Ttext 0x70000 -e app_processor_start -nostdlib \ -o appstart_tmp.exe $< $(OBJCOPY) -O binary appstart_tmp.exe appstart.bin diff --git a/c/src/lib/libbsp/i386/pc386/startup/bsp_fatal_halt.c b/c/src/lib/libbsp/i386/pc386/startup/bsp_fatal_halt.c deleted file mode 100644 index 07bbd793e0..0000000000 --- a/c/src/lib/libbsp/i386/pc386/startup/bsp_fatal_halt.c +++ /dev/null @@ -1,24 +0,0 @@ -/** - * COPYRIGHT (c) 2016. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#include - -void _CPU_Fatal_halt(uint32_t source, uint32_t error) -{ - __asm__ volatile ( - "cli\n\t" - "movl %0,%%eax\n\t" - "hlt\n\t" - : "=r" ((error)) - : "0" ((error)) - ); - #ifdef __GNUC__ - __builtin_unreachable(); - #endif -} diff --git a/c/src/lib/libbsp/i386/pc386/startup/bsp_specs b/c/src/lib/libbsp/i386/pc386/startup/bsp_specs deleted file mode 100644 index 87638cc027..0000000000 --- a/c/src/lib/libbsp/i386/pc386/startup/bsp_specs +++ /dev/null @@ -1,9 +0,0 @@ -%rename endfile old_endfile -%rename startfile old_startfile - -*startfile: -%{!qrtems: %(old_startfile)} \ -%{!nostdlib: %{qrtems: crti.o%s crtbegin.o%s}} - -*endfile: -%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s crtn.o%s} diff --git a/c/src/lib/libbsp/i386/pc386/startup/bspcmdline.c b/c/src/lib/libbsp/i386/pc386/startup/bspcmdline.c deleted file mode 100644 index d617863198..0000000000 --- a/c/src/lib/libbsp/i386/pc386/startup/bspcmdline.c +++ /dev/null @@ -1,60 +0,0 @@ -/*-------------------------------------------------------------------------+ -| This file contains the PC386 BSP startup package. It includes application, -| board, and monitor specific initialization and configuration. The generic CPU -| dependent initialization has been performed before this routine is invoked. -+--------------------------------------------------------------------------+ -| (C) Copyright 2009 RTEMS Project -| Chris Johns (chrisj@rtems.org) -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is based on: -| common sense -| With the following copyright notice: -| ************************************************************************** -| * COPYRIGHT (c) 1989-2008. -| * On-Line Applications Research Corporation (OAR). -| * -| * The license and distribution terms for this file may be -| * found in the file LICENSE in this distribution or at -| * http://www.rtems.org/license/LICENSE. -| ************************************************************************** -+--------------------------------------------------------------------------*/ - -#include -#include -#include - -/* - * External data - */ -extern uint32_t _boot_multiboot_flags; -extern uint32_t _boot_multiboot_memory[2]; -extern const char _boot_multiboot_cmdline[256]; - -/*-------------------------------------------------------------------------+ -| Function: bsp_cmdline -| Description: Call when you want the command line. -| Global Variables: The multiboot values copied from the loader. -| Arguments: None. -| Returns: The whole command line. -+--------------------------------------------------------------------------*/ -const char* bsp_cmdline( void ) -{ - return _boot_multiboot_cmdline; -} - -/*-------------------------------------------------------------------------+ -| Function: bsp_cmdline_arg -| Description: Call to search for an argument. -| Global Variables: The multiboot values copied from the loader. -| Arguments: The option start. -| Returns: The option if found or nothing. -+--------------------------------------------------------------------------*/ -const char* bsp_cmdline_arg( const char* arg ) -{ - return strstr (bsp_cmdline (), arg); -} diff --git a/c/src/lib/libbsp/i386/pc386/startup/bspgetworkarea.c b/c/src/lib/libbsp/i386/pc386/startup/bspgetworkarea.c deleted file mode 100644 index 21cb472607..0000000000 --- a/c/src/lib/libbsp/i386/pc386/startup/bspgetworkarea.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * This routine is an implementation of the bsp_work_area_initialize() - * that can be used by all m68k BSPs following linkcmds conventions - * regarding heap, stack, and workspace allocation. - * - * COPYRIGHT (c) 1989-2008. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -/* #define BSP_GET_WORK_AREA_DEBUG */ -#include -#include - -#ifdef BSP_GET_WORK_AREA_DEBUG - #include -#endif - -/* - * These are provided by the linkcmds. - */ -extern char WorkAreaBase[]; -extern char HeapSize[]; -extern char RamSize[]; - -/* rudimentary multiboot info */ -struct multiboot_info { - uint32_t flags; /* start.S only raises flags for items actually */ - /* saved; this allows us to check for the size */ - /* of the data structure. */ - uint32_t mem_lower; /* avail kB in lower memory */ - uint32_t mem_upper; /* avail kB in lower memory */ - /* ... (unimplemented) */ -}; - -extern struct multiboot_info _boot_multiboot_info; - -/* - * This is the first address of the memory we can use for the RTEMS - * Work Area. - */ -static uintptr_t rtemsWorkAreaStart; - -/* - * Board's memory size easily be overridden by application. - */ -uint32_t bsp_mem_size = 0; - -/* Size of stack used during initialization. Defined in 'start.s'. */ -extern uint32_t _stack_size; - -static void bsp_size_memory(void) -{ - uintptr_t topAddr; - - /* Set the value of start of free memory. */ - rtemsWorkAreaStart = (uint32_t)WorkAreaBase + _stack_size; - - /* Align the RTEMS Work Area at beginning of free memory. */ - if (rtemsWorkAreaStart & (CPU_ALIGNMENT - 1)) /* not aligned => align it */ - rtemsWorkAreaStart = (rtemsWorkAreaStart+CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - /* The memory detection algorithm is very crude; try - * to use multiboot info, if possible (set from start.S) - */ - if ( ((uintptr_t)RamSize == (uintptr_t) 0xFFFFFFFF) && - (_boot_multiboot_info.flags & 1) && - _boot_multiboot_info.mem_upper ) { - topAddr = _boot_multiboot_info.mem_upper * 1024; - #ifdef BSP_GET_WORK_AREA_DEBUG - printk( "Multiboot info says we have 0x%08x\n", topAddr ); - #endif - } else if ( (uintptr_t) RamSize == (uintptr_t) 0xFFFFFFFF ) { - uintptr_t lowest; - uint32_t val; - int i; - - /* - * We have to dynamically size memory. Memory size can be anything - * between no less than 2M and 2048M. If we can write a value to - * an address and read the same value back, then the memory is there. - * - * WARNING: This can detect memory which should be reserved for - * graphics controllers which share the CPU's RAM. - */ - - /* find the lowest 1M boundary to probe */ - lowest = ((rtemsWorkAreaStart + (1<<20)) >> 20) + 1; - if ( lowest < 2 ) - lowest = 2; - - 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 = *(volatile uint32_t*)topAddr; - if (val != topAddr) { - break; - } - } - - topAddr = (i-1)*1024*1024; - #ifdef BSP_GET_WORK_AREA_DEBUG - printk( "Dynamically sized to 0x%08x\n", topAddr ); - #endif - } else { - topAddr = (uintptr_t) RamSize; - #ifdef BSP_GET_WORK_AREA_DEBUG - printk( "hardcoded to 0x%08x\n", topAddr ); - #endif - } - - bsp_mem_size = topAddr; -} - -void bsp_work_area_initialize(void) -{ - void *area_start; - uintptr_t area_size; - - /* - * We need to determine how much memory there is in the system. - */ - bsp_size_memory(); - - area_start = (void *) rtemsWorkAreaStart; - area_size = (uintptr_t) bsp_mem_size - (uintptr_t) rtemsWorkAreaStart; - bsp_work_area_initialize_default( area_start, area_size ); -} diff --git a/c/src/lib/libbsp/i386/pc386/startup/bspidle.S b/c/src/lib/libbsp/i386/pc386/startup/bspidle.S deleted file mode 100644 index 740671afc1..0000000000 --- a/c/src/lib/libbsp/i386/pc386/startup/bspidle.S +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Idle Thread Body - * - * COPYRIGHT (c) 2016. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#include - -.p2align 4 - -PUBLIC(bsp_idle_thread) -SYM(bsp_idle_thread): -hltloop: hlt - jmp hltloop diff --git a/c/src/lib/libbsp/i386/pc386/startup/bspreset.c b/c/src/lib/libbsp/i386/pc386/startup/bspreset.c deleted file mode 100644 index 0fbcd0f201..0000000000 --- a/c/src/lib/libbsp/i386/pc386/startup/bspreset.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * COPYRIGHT (c) 1989-2017. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#include -#include -#include - -void bsp_reset(void) -{ - /* shutdown and reboot */ - outport_byte(0x64, 0xFE); /* use keyboard controller */ -} diff --git a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c deleted file mode 100644 index db1ca90cf4..0000000000 --- a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c +++ /dev/null @@ -1,141 +0,0 @@ -/** - * @file - * - * This file contains the PC386 BSP startup package. It includes application, - * board, and monitor specific initialization and configuration. - */ - -/* - * This file was initially written by Joel Sherrill as part of the go32 BSP. - * It was subsequently adapted as part of the pc386 BSP by developers from - * the NavIST Group in 1997. - * - * Copyright (c) 2016. - * Chris Johns - * - * COPYRIGHT (c) 1989-2008, 2016. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - * - * (C) Copyright 1997 - - * - NavIST Group - Real-Time Distributed Systems and Industrial Automation - * Instituto Superior Tecnico * Lisboa * PORTUGAL (http://pandora.ist.utl.pt) - * - * NavISY Disclaimer: - * This file is provided "AS IS" without warranty of any kind, either - * expressed or implied. - */ - -#include -#include -#include -#include -#include - -/* - * PCI Bus Configuration - */ -rtems_pci_config_t BSP_pci_configuration = { - (volatile unsigned char*)0, - (volatile unsigned char*)0, - NULL -}; - -/* - * Helper to initialize the PCI Bus - */ -static void bsp_pci_initialize_helper(void) -{ - const pci_config_access_functions *pci_accessors; - - pci_accessors = pci_bios_initialize(); - if (pci_accessors != NULL) { - printk("PCI bus: using PCI BIOS interface\n"); - BSP_pci_configuration.pci_functions = pci_accessors; - return; - } - - pci_accessors = pci_io_initialize(); - if (pci_accessors != NULL) { - printk("PCI bus: using PCI I/O interface\n"); - BSP_pci_configuration.pci_functions = pci_accessors; - return; - } - - printk("PCI bus: could not initialize PCI BIOS interface\n"); -} - -/*-------------------------------------------------------------------------+ -| Function: bsp_start -| Description: Called before main is invoked. -| Global Variables: None. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -static void bsp_start_default( void ) -{ - /* - * Turn off watchdog - */ - /* - * Calibrate variable for 1ms-loop (see timer.c) - */ - Calibrate_loop_1ms(); - - /* - * Init rtems interrupt management - */ - rtems_irq_mngt_init(); - - /* - * Init rtems exceptions management - */ - rtems_exception_init_mngt(); - - /* - * init PCI Bios interface... - */ - bsp_pci_initialize_helper(); - - /* - * Probe for legacy UARTs. - */ - legacy_uart_probe(); - - /* - * Probe for UARTs on PCI. - */ - pci_uart_probe(); - - /* - * Parse the GDB arguments and flag a serial port as not valid. This stops - * the console from claming the port. - */ -#if BSP_GDB_STUB - pc386_parse_gdb_arguments(); -#endif - - /* - * Figure out where printk() and console IO is to be directed. Do this after - * the legacy and PCI bus probes so we have a chance for those devices to be - * added to the set in the console driver. In general, do it as early as - * possible so printk() has a chance to work early on devices found via PCI - * probe. - */ - pc386_parse_console_arguments(); - - Clock_driver_install_handler(); - -#if BSP_ENABLE_IDE - bsp_ide_cmdline_init(); -#endif -} /* bsp_start_default */ - -/* - * By making this a weak alias for bsp_start_default, a brave soul - * can override the actual bsp_start routine used. - */ -void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default"))); diff --git a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S b/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S deleted file mode 100644 index b56bf836f0..0000000000 --- a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S +++ /dev/null @@ -1,238 +0,0 @@ -/*-------------------------------------------------------------------------+ -| ldsegs.s v1.1 - PC386 BSP - 1997/08/07 -+--------------------------------------------------------------------------+ -| This file assists the board independent startup code by loading the proper -| segment register values. The values loaded are board dependent. In addition -| it contains code to enable the A20 line and to reprogram the PIC to relocate -| the IRQ interrupt vectors to 0x20 -> 0x2f. -| NOTE: No stack has been established when this routine is invoked. -| It returns by jumping back to bspentry. -+--------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is base on: -| ldsegs.s,v 1.4 1996/04/20 16:48:30 joel Exp - go32 BSP -| With the following copyright notice: -| ************************************************************************** -| * COPYRIGHT (c) 1989-1999. -| * On-Line Applications Research Corporation (OAR). -| * -| * The license and distribution terms for this file may be -| * found in the file LICENSE in this distribution or at -| * http://www.rtems.org/license/LICENSE. -| ************************************************************************** -+--------------------------------------------------------------------------*/ - -#include -#include /* contains sizes of GDT and IDT */ -#include - -/*----------------------------------------------------------------------------+ -| CODE section -+----------------------------------------------------------------------------*/ -EXTERN (rtems_i8259_masks) - -BEGIN_CODE - - EXTERN (_establish_stack) - EXTERN (Timer_exit) - EXTERN (clockOff) - -/*----------------------------------------------------------------------------+ -| pc386_delay -+------------------------------------------------------------------------------ -| Delay is needed after doing I/O. -| -| The outb version is OK on most machines BUT the loop version ... -| -| will delay for 1us on 1Gz machine, it will take a little bit -| longer on slower machines, however, it does not matter because we -| are going to call this function only a few times - -+----------------------------------------------------------------------------*/ -#define DELAY_USE_OUTB - - .p2align 4 - .globl _pc386_delay - .globl pc386_delay -pc386_delay: -_pc386_delay: -#ifdef DELAY_USE_OUTB - outb al, $0x80 # about 1uS delay on most machines -#else - movl $0x200, eax -pc386_delay1: - dec eax - jnz pc386_delay1 -#endif - ret - -/*-------------------------------------------------------------------------+ -| Function: _load_segments -| Description: Current environment is standard PC booted by grub. -| So, there is no value in saving current GDT and IDT -| settings we have to set it up ourseves. (Naturally -| it will be not so in case we are booted by some -| boot monitor, however, then it will be different -| BSP). After that we have to load board segment registers -| with apropriate values + reprogram PIC. -| Global Variables: None. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ - .p2align 4 - - PUBLIC (_load_segments) -SYM (_load_segments): - - lgdt SYM(gdtdesc) - lidt SYM(IDT_Descriptor) - - /* Load CS, flush prefetched queue */ - ljmp $0x8, $next_step - -next_step: - /* Load segment registers */ - movw $0x10, ax - movw ax, ss - movw ax, ds - movw ax, es - movw ax, fs - movw ax, gs - -/*---------------------------------------------------------------------+ -| 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 -| original PC, and they haven't been able to rectify it afterwards. Thus -| the bios puts interrupts at 0x08-0x0f, which is used for the internal -| hardware interrupts as well. We just have to reprogram the 8259's, and -| it isn't fun. -+---------------------------------------------------------------------*/ - - movb $0x11, al /* initialization sequence */ - outb al, $0x20 /* send it to 8259A-1 */ - call SYM(pc386_delay) - outb al, $0xA0 /* and to 8259A-2 */ - call SYM(pc386_delay) - - movb $0x20, al /* start of hardware int's (0x20) */ - outb al, $0x21 - call SYM(pc386_delay) - movb $0x28, al /* start of hardware int's 2 (0x28) */ - outb al, $0xA1 - call SYM(pc386_delay) - - movb $0x04, al /* 8259-1 is master */ - outb al, $0x21 - call SYM(pc386_delay) - movb $0x02, al /* 8259-2 is slave */ - outb al, $0xA1 - call SYM(pc386_delay) - - movb $0x01, al /* 8086 mode for both */ - outb al, $0x21 - call SYM(pc386_delay) - outb al, $0xA1 - call SYM(pc386_delay) - - /* - * The IMR values must correspond to the initial value of i8259s_cache. - */ - movb $0xFF, al /* mask off all interrupts for now */ - outb al, $0xA1 - call SYM(pc386_delay) - movb $0xFB, al /* mask all irq's but irq2 which */ - outb al, $0x21 /* is cascaded */ - call SYM(pc386_delay) - jmp SYM (_establish_stack) # return to the bsp entry code - -/*-------------------------------------------------------------------------+ -| Function: _default_int_handler -| Description: default interrupt handler -| Global Variables: None. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ - .p2align 4 - -/*---------------------------------------------------------------------------+ -| GDT itself -+--------------------------------------------------------------------------*/ -#if GDT_SIZE < NUM_SYSTEM_GDT_DESCRIPTORS -#error "GDT_SIZE must be at least NUM_SYSTEM_GDT_DESCRIPTORS" -#endif - -BEGIN_DATA - .p2align 4 - - PUBLIC (_Global_descriptor_table) -SYM (_Global_descriptor_table): - - /* NULL segment */ - .word 0, 0 - .byte 0, 0, 0, 0 - - /* code segment */ - .word 0xffff, 0 - .byte 0, 0x9e, 0xcf, 0 - - /* data segment */ - .word 0xffff, 0 - .byte 0, 0x92, 0xcf, 0 - - /* gs segment */ - .word 0xffff, 0 - .byte 0, 0x92, 0xcf, 0 - - /* allocated space for user segments */ - .rept (GDT_SIZE - NUM_SYSTEM_GDT_DESCRIPTORS) - .word 0,0,0,0 - .endr - -/*---------------------------------------------------------------------------+ -| Descriptor of GDT -+--------------------------------------------------------------------------*/ - PUBLIC(gdtdesc) -SYM(gdtdesc): - .word (GDT_SIZE*8 - 1) - .long SYM (_Global_descriptor_table) - -/*---------------------------------------------------------------------------+ -| IDT itself -+---------------------------------------------------------------------------*/ - .p2align 4 - - PUBLIC(Interrupt_descriptor_table) -SYM(Interrupt_descriptor_table): - .rept IDT_SIZE - .word 0,0,0,0 - .endr - -/*---------------------------------------------------------------------------+ -| Descriptor of IDT -+--------------------------------------------------------------------------*/ - - .p2align 4 - PUBLIC(IDT_Descriptor) -SYM(IDT_Descriptor): - .word (IDT_SIZE*8 - 1) - .long SYM (Interrupt_descriptor_table) - -END_DATA - - .section .m_hdr - .long 0x1BADB002 - .long 0 - .long 0xE4524FFE -END diff --git a/c/src/lib/libbsp/i386/pc386/startup/linkcmds b/c/src/lib/libbsp/i386/pc386/startup/linkcmds deleted file mode 100644 index 5fc3444c9e..0000000000 --- a/c/src/lib/libbsp/i386/pc386/startup/linkcmds +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copy of default "default linker script, for normal executables" - * provided with binutils 2.18 with minor modifications for use - * as pc386 linkcmds. These changes include: - * - * + sections commented out marked with "XXX commented out --joel" - * + addition of m_hdr section - * + addition of FreeBSD sysctl sections - */ - -/* - * XXX commented out --joel -OUTPUT_FORMAT("elf32-i386", "elf32-i386", - "elf32-i386") -OUTPUT_ARCH(i386) -*/ -STARTUP(start.o) -ENTRY(start) -HeapSize = DEFINED(HeapSize) ? HeapSize : - DEFINED(_HeapSize) ? _HeapSize : 0x0; -RamSize = DEFINED(RamSize) ? RamSize : - DEFINED(_RamSize) ? _RamSize : 0xFFFFFFFF; - -SECTIONS -{ - /* Read-only sections, merged into text segment: */ -/* - * XXX commented out --joel - PROVIDE (__executable_start = 0x08048000); . = 0x08048000 + SIZEOF_HEADERS; -*/ - .interp : { *(.interp) } - .note.gnu.build-id : { *(.note.gnu.build-id) } - .hash : { *(.hash) } - .gnu.hash : { *(.gnu.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - .rel.init : { *(.rel.init) } - .rela.init : { *(.rela.init) } - .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } - .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } - .rel.fini : { *(.rel.fini) } - .rela.fini : { *(.rela.fini) } - .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } - .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } - .rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) } - .rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) } - .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } - .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } - .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } - .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } - .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } - .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } - .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .plt : { *(.plt) } - .text : - { - *(.m_hdr) - *(.text .stub .text.* .gnu.linkonce.t.*) - KEEP (*(.text.*personality*)) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - - } =0x90909090 - - .rtemsroset : { - /* for pre rtems-libbsd FreeBSD code */ - __start_set_sysctl_set = .; - *(set_sysctl_*); - __stop_set_sysctl_set = .; - *(set_domain_*); - *(set_pseudo_*); - - KEEP (*(SORT(.rtemsroset.*))) - } =0x90909090 - - .init : - { - KEEP (*(.init)) - } =0x90909090 - .fini : - { - KEEP (*(.fini)) - } =0x90909090 - PROVIDE (__etext = .); - PROVIDE (_etext = .); - PROVIDE (etext = .); - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } - .rodata1 : { *(.rodata1) } - .tdata : { - _TLS_Data_begin = .; - *(.tdata .tdata.* .gnu.linkonce.td.*) - _TLS_Data_end = .; - } - .tbss : { - _TLS_BSS_begin = .; - *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) - _TLS_BSS_end = .; - } - _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin; - _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin; - _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin; - _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin; - _TLS_Size = _TLS_BSS_end - _TLS_Data_begin; - _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss)); - .eh_frame_hdr : { *(.eh_frame_hdr) } - .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } - .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. */ - . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); - /* Exception handling */ - .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } - .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } - /* Thread Local Storage sections */ - .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } - .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } - .preinit_array : - { - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP (*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - } - .init_array : - { - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - } - .fini_array : - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(.fini_array)) - KEEP (*(SORT(.fini_array.*))) - PROVIDE_HIDDEN (__fini_array_end = .); - } - .ctors : - { - /* gcc uses crtbegin.o to find the start of - the constructors, so we make sure it is - first. Because this is a wildcard, it - doesn't matter if the user does not - actually link against crtbegin.o; the - linker won't look for a file to match a - wildcard. The wildcard also means that it - doesn't matter which directory crtbegin.o - is in. */ - KEEP (*crtbegin.o(.ctors)) - KEEP (*crtbegin?.o(.ctors)) - /* We don't want to include the .ctor section from - the crtend.o file until after the sorted ctors. - The .ctor section from the crtend file contains the - end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - } - .dtors : - { - KEEP (*crtbegin.o(.dtors)) - KEEP (*crtbegin?.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - } - .jcr : { KEEP (*(.jcr)) } - .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } - .dynamic : { *(.dynamic) } - .got : { *(.got) } - . = DATA_SEGMENT_RELRO_END (12, .); - .got.plt : { *(.got.plt) } - .data : - { - *(.data .data.* .gnu.linkonce.d.*) - KEEP (*(.gnu.linkonce.d.*personality*)) - SORT(CONSTRUCTORS) - } - .data1 : { *(.data1) } - .rtemsrwset : { KEEP (*(SORT(.rtemsrwset.*))) } - _edata = .; PROVIDE (edata = .); - __bss_start = .; - .bss : - { - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - *(COMMON) - /* Align here to ensure that the .bss section occupies space up to - _end. Align after .bss to ensure correct alignment even if the - .bss section disappears because there are no input sections. - FIXME: Why do we need it? When there is no .bss section, we don't - pad the .data section. */ - . = ALIGN(. != 0 ? 32 / 8 : 1); - } - . = ALIGN(32 / 8); - . = ALIGN(32 / 8); - _end = .; PROVIDE (end = .); - . = ALIGN(0x10); - WorkAreaBase = .; - . = DATA_SEGMENT_END (.); - - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - /* DWARF 3 */ - .debug_pubtypes 0 : { *(.debug_pubtypes) } - .debug_ranges 0 : { *(.debug_ranges) } - /* DWARF extension */ - .debug_macro 0 : { *(.debug_macro) } - .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } - /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) } -} -- cgit v1.2.3