Index: ChangeLog =================================================================== RCS file: /cvs/ecos/ecos/packages/hal/i386/pc/current/ChangeLog,v retrieving revision 1.17 diff -u -5 -r1.17 ChangeLog --- ChangeLog 23 May 2002 23:03:10 -0000 1.17 +++ ChangeLog 1 Dec 2002 15:42:38 -0000 @@ -1,5 +1,37 @@ +2002-11-28 Nick Garnett + + * src/plf_stub.c: Removed redundant reinitialization of VSR table + in hal_pc_stubs_init(). This has already been done in + hal_platform_init() and reinitializing here destroys the FPU + switch VSR. + + * src/plf_misc.c (hal_platform_init): + Added configuration and test to avoid overwriting the FPU switch + VSR with the default VSR. This caused problems with stand-alone + application that use lazy FPU switching. + Moved call to hal_ctrlc_isr_init() to after call to + hal_if_init(). Previously, stand-alone applications had problems + with ctrl-c handling because the CALL_HACK stuff didn't work. + + * cdl/hal_i386_pc.cdl: + Added GRUB startup option. This enables support for booting from + the GRUB bootloader. + Added CYGDBG_HAL_DEBUG_GDB_INITIAL_BREAK option to force a + breakpoint just before calling cyg_start(). This is insinuated + into the CYGPKG_HAL_DEBUG part of the tree, and conditioned to + only work for stand-alone apps with the stubs included. + + * include/platform.inc: Added GRUB startup support. + + * include/pkgconf/mlt_i386_pc_grub.mlt: + * include/pkgconf/mlt_i386_pc_grub.ldi: + * include/pkgconf/mlt_i386_pc_grub.h: + Added these MLT files to support the new GRUB startup option. + + * misc/menu.lst: Added this example GRUB menu configuration file. + 2002-05-07 Gary Thomas * cdl/hal_i386_pc.cdl: Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. Index: cdl/hal_i386_pc.cdl =================================================================== RCS file: /cvs/ecos/ecos/packages/hal/i386/pc/current/cdl/hal_i386_pc.cdl,v retrieving revision 1.9 diff -u -5 -r1.9 hal_i386_pc.cdl --- cdl/hal_i386_pc.cdl 23 May 2002 23:03:10 -0000 1.9 +++ cdl/hal_i386_pc.cdl 1 Dec 2002 15:42:40 -0000 @@ -77,24 +77,37 @@ } cdl_component CYG_HAL_STARTUP { display "Startup type" flavor data - legal_values {"RAM" "FLOPPY" "ROM"} + legal_values {"RAM" "FLOPPY" "ROM" "GRUB"} default_value {"RAM"} no_define define -file system.h CYG_HAL_STARTUP description " - It is possible to configure eCos for the PC target to build for + It is possible to configure eCos for the PC target to build for: RAM startup (generally when being run under an existing - Monitor program like RedBoot), FLOPPY startup (for writing + Monitor program like RedBoot); FLOPPY startup (for writing to a floppy disk, which can then be used for booting - on PCs with a standard BIOS), or ROM startup (for writing + on PCs with a standard BIOS), GRUB startup (for being booted + by the GRUB bootloader) ROM startup (for writing straight to a boot ROM/Flash). ROM startup is experimental at this time." } - + + cdl_option CYGDBG_HAL_DEBUG_GDB_INITIAL_BREAK { + display "Enable initial breakpoint" + parent CYGPKG_HAL_DEBUG + active_if CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + default_value { !CYGPKG_REDBOOT } + description " + This option causes an application that has GDB stubs built in + to take a breakpoint immediately before calling cyg_start(). + This gives the developer a chance to set any breakpoints or + inspect the system state before it proceeds." + } + cdl_option CYGBLD_BUILD_I386_ROMBOOT { display "Build ROM bootstrap code" calculated { CYG_HAL_STARTUP == "ROM" } make { @@ -255,32 +268,35 @@ cdl_component CYGHWR_MEMORY_LAYOUT { display "Memory layout" flavor data no_define - calculated { CYG_HAL_STARTUP == "RAM" ? "i386_pc_ram" : \ - CYG_HAL_STARTUP == "ROM" ? "i386_pc_rom" : \ - "i386_pc_floppy" } + calculated { CYG_HAL_STARTUP == "RAM" ? "i386_pc_ram" : \ + CYG_HAL_STARTUP == "ROM" ? "i386_pc_rom" : \ + CYG_HAL_STARTUP == "GRUB" ? "i386_pc_grub" : \ + "i386_pc_floppy" } cdl_option CYGHWR_MEMORY_LAYOUT_LDI { display "Memory layout linker script fragment" flavor data no_define define -file system.h CYGHWR_MEMORY_LAYOUT_LDI - calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ - CYG_HAL_STARTUP == "ROM" ? "" : \ - "" } + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : \ + CYG_HAL_STARTUP == "GRUB" ? "" : \ + "" } } cdl_option CYGHWR_MEMORY_LAYOUT_H { display "Memory layout header file" flavor data no_define define -file system.h CYGHWR_MEMORY_LAYOUT_H - calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ - CYG_HAL_STARTUP == "ROM" ? "" : \ - "" } + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : \ + CYG_HAL_STARTUP == "GRUB" ? "" : \ + "" } } } cdl_option CYGSEM_HAL_ROM_MONITOR { display "Behave as a ROM monitor" Index: include/platform.inc =================================================================== RCS file: /cvs/ecos/ecos/packages/hal/i386/pc/current/include/platform.inc,v retrieving revision 1.7 diff -u -5 -r1.7 platform.inc --- include/platform.inc 23 May 2002 23:03:12 -0000 1.7 +++ include/platform.inc 1 Dec 2002 15:42:40 -0000 @@ -64,13 +64,19 @@ #ifndef CYGPKG_HAL_I386_CPU_INIT_DEFINED #define CYGPKG_HAL_I386_CPU_INIT_DEFINED ##============================================================================= -## ROM startup +## ROM and GRUB startup +## +## Although these two startup types are, on the face of it, very different, +## the actual work that needs to be done here for them both is much the same. +## In both cases the system has been initialized in real mode and the transition +## to 32 bit protected mode has been done. Here all we need to do is set up +## our own GDT and IDT, reload the segment registers and proceed. -#ifdef CYG_HAL_STARTUP_ROM +#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_GRUB) .macro hal_cpu_init hal_cpu_init_start: @@ -139,27 +145,51 @@ .byte 0x00 .align 4, 0xFF gdtEnd: +#if defined(CYG_HAL_STARTUP_GRUB) + # Multiboot header -- this must be in the first 8k + # of the image file. + +#define GRUB_MAGIC 0x1BADB002 /* Magic number */ +#define GRUB_FLAGS 0x00000000 /* Flags */ + + .align 4, 0xFF + .long GRUB_MAGIC + .long GRUB_FLAGS + .long 0-GRUB_MAGIC-GRUB_FLAGS /* Checksum */ +#endif + 3: # Set up data selectors movw $0x10, %ax movw %ax, %ds movw %ax, %es movw %ax, %fs movw %ax, %gs movw %ax, %ss - - # Set up SP + + # Set up SP movl $__interrupt_stack,%esp /* Reset the flags register. */ push $0 popf +#if defined(CYG_HAL_STARTUP_GRUB) + # Save the multiboot info passed in %EBX away into a + # global variable for later use. + .data + .global hal_multiboot_info +hal_multiboot_info: + .long 0 + .text + movl %ebx,hal_multiboot_info +#endif + hal_cpu_init_end: nop .endm #endif Index: include/pkgconf/mlt_i386_pc_grub.h =================================================================== RCS file: include/pkgconf/mlt_i386_pc_grub.h diff -N include/pkgconf/mlt_i386_pc_grub.h --- include/pkgconf/mlt_i386_pc_grub.h 1 Jan 1970 00:00:00 -0000 +++ include/pkgconf/mlt_i386_pc_grub.h 1 Dec 2002 15:42:40 -0000 @@ -0,0 +1,22 @@ +// eCos memory layout - Fri Oct 20 08:15:20 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0x00100000) +#define CYGMEM_REGION_ram_SIZE (0x01000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x01000000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif +#define CYGMEM_SECTION_pci_window (CYG_LABEL_NAME (__pci_window)) +#define CYGMEM_SECTION_pci_window_SIZE (0x64000) Index: include/pkgconf/mlt_i386_pc_grub.ldi =================================================================== RCS file: include/pkgconf/mlt_i386_pc_grub.ldi diff -N include/pkgconf/mlt_i386_pc_grub.ldi --- include/pkgconf/mlt_i386_pc_grub.ldi 1 Jan 1970 00:00:00 -0000 +++ include/pkgconf/mlt_i386_pc_grub.ldi 1 Dec 2002 15:42:40 -0000 @@ -0,0 +1,29 @@ +// eCos memory layout - Fri Oct 20 08:15:20 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0x0, LENGTH = 0x1000000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_vectors (ram, 0x108000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rel__got (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_sbss (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA) + CYG_LABEL_DEFN(__pci_window) = ALIGN(0x10); . = CYG_LABEL_DEFN(__pci_window) + 0x64000; + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} Index: include/pkgconf/mlt_i386_pc_grub.mlt =================================================================== RCS file: include/pkgconf/mlt_i386_pc_grub.mlt diff -N include/pkgconf/mlt_i386_pc_grub.mlt --- include/pkgconf/mlt_i386_pc_grub.mlt 1 Jan 1970 00:00:00 -0000 +++ include/pkgconf/mlt_i386_pc_grub.mlt 1 Dec 2002 15:42:40 -0000 @@ -0,0 +1,15 @@ +version 0 +region ram 0 1000000 0 ! +section vectors 0 1 0 1 1 1 1 1 108000 10000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 8 0 1 0 1 0 1 rodata rodata ! +section rodata 0 8 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 1 0 1 rel.got rel.got ! +section rel.got 0 1 0 1 0 1 0 1 data data ! +section data 0 8 0 1 0 1 0 1 sbss sbss ! +section sbss 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 10 0 1 0 1 0 1 pci_window pci_window ! +section pci_window 64000 10 0 0 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! Index: misc/menu.lst =================================================================== RCS file: misc/menu.lst diff -N misc/menu.lst --- misc/menu.lst 1 Jan 1970 00:00:00 -0000 +++ misc/menu.lst 1 Dec 2002 15:42:40 -0000 @@ -0,0 +1,38 @@ +# Example GRUB boot menu configuration file for eCos + +default 0 +timeout 30 + +# eCos tm_basic test from dd0 +title eCos - tm_basic fd0 +root (fd0) +kernel /boot/tm_basic + +# eCos tm_basic test from hd0 +title eCos - tm_basic hd0 +root (hd0,0) +kernel /boot/tm_basic + +# eCos tcp_echo test from fd0 +title eCos - tcp_echo fd0 +root (fd0) +kernel /boot/tcp_echo + +# eCos tcp_echo test from hd0 +title eCos - tcp_echo hd0 +root (hd0) +kernel /boot/tcp_echo + +# eCos nc_test_slave test from fd0 +title eCos - nc_test_slave fd0 +root (fd0) +kernel /boot/nc_test_slave + +# eCos nc_test_slave test from hd0 +title eCos - nc_test_slave hd0 +root (hd0) +kernel /boot/nc_test_slave + +#end + + Index: src/plf_misc.c =================================================================== RCS file: /cvs/ecos/ecos/packages/hal/i386/pc/current/src/plf_misc.c,v retrieving revision 1.6 diff -u -5 -r1.6 plf_misc.c --- src/plf_misc.c 23 May 2002 23:03:13 -0000 1.6 +++ src/plf_misc.c 1 Dec 2002 15:42:40 -0000 @@ -133,22 +133,21 @@ #if !defined(CYG_HAL_STARTUP_RAM) for (vector = CYGNUM_HAL_EXCEPTION_MIN; vector <= CYGNUM_HAL_EXCEPTION_MAX; vector++) { - HAL_VSR_SET( vector, &__default_exception_vsr, NULL ); - } +#if defined(CYGHWR_HAL_I386_FPU_SWITCH_LAZY) + // If we are doing lazy FPU switching, the FPU switch VSR has + // already been installed, so avoid overwriting it. + if( vector != CYGNUM_HAL_VECTOR_NO_DEVICE ) #endif - -#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) - { - void hal_ctrlc_isr_init(void); - hal_ctrlc_isr_init(); + { + HAL_VSR_SET( vector, &__default_exception_vsr, NULL ); + } } - #endif - + #ifdef CYGPKG_REDBOOT // Start the timer device running if we are in a RedBoot // configuration. @@ -156,10 +155,19 @@ #endif hal_if_init(); +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) || \ + defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT) + { + void hal_ctrlc_isr_init(void); + hal_ctrlc_isr_init(); + } + +#endif + #ifdef CYGPKG_HAL_SMP_SUPPORT cyg_hal_smp_init(); #endif Index: src/plf_stub.c =================================================================== RCS file: /cvs/ecos/ecos/packages/hal/i386/pc/current/src/plf_stub.c,v retrieving revision 1.5 diff -u -5 -r1.5 plf_stub.c --- src/plf_stub.c 23 May 2002 23:03:14 -0000 1.5 +++ src/plf_stub.c 1 Dec 2002 15:42:40 -0000 @@ -79,14 +79,10 @@ #endif // CYGSEM_REDBOOT_BSP_SYSCALLS void hal_pc_stubs_init(void) { - int i ; - for(i=0; i<=31; i++) - HAL_VSR_SET(i,&__default_exception_vsr,NULL); - #if defined(CYGSEM_REDBOOT_BSP_SYSCALLS) cyg_hal_pc_set_idt_entry((CYG_ADDRESS)__syscall_tramp, (short *)(idtStart + (0x80 * 8))); #endif // CYGSEM_REDBOOT_BSP_SYSCALLS }