diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/boot/ia64/ski/Makefile | 2 | ||||
-rw-r--r-- | sys/boot/ia64/ski/ldscript.ia64 | 172 | ||||
-rw-r--r-- | sys/boot/ia64/ski/main.c | 8 | ||||
-rw-r--r-- | sys/boot/ia64/ski/start.S | 64 | ||||
-rw-r--r-- | sys/boot/ia64/skiload/Makefile | 2 | ||||
-rw-r--r-- | sys/boot/ia64/skiload/ldscript.ia64 | 172 | ||||
-rw-r--r-- | sys/boot/ia64/skiload/main.c | 8 | ||||
-rw-r--r-- | sys/boot/ia64/skiload/start.S | 64 |
8 files changed, 230 insertions, 262 deletions
diff --git a/sys/boot/ia64/ski/Makefile b/sys/boot/ia64/ski/Makefile index 8a374a1..8ba596a 100644 --- a/sys/boot/ia64/ski/Makefile +++ b/sys/boot/ia64/ski/Makefile @@ -7,7 +7,7 @@ NOMAN= NEWVERSWHAT= "ia64 SKI boot" ${MACHINE_ARCH} BINDIR?= /boot -SRCS+= main.c conf.c +SRCS+= conf.c main.c start.S CFLAGS+= -ffreestanding diff --git a/sys/boot/ia64/ski/ldscript.ia64 b/sys/boot/ia64/ski/ldscript.ia64 index cb35a4b..e4e1dad 100644 --- a/sys/boot/ia64/ski/ldscript.ia64 +++ b/sys/boot/ia64/ski/ldscript.ia64 @@ -1,135 +1,61 @@ /* $FreeBSD$ */ OUTPUT_FORMAT("elf64-ia64-little", "elf64-ia64-little", "elf64-ia64-little") OUTPUT_ARCH(ia64) -ENTRY(__start) +ENTRY(_start) SECTIONS { /* Read-only sections, merged into text segment: */ . = 0x100000; - - .text : - { - *(.text.ivt) - . += 8192; - *(.text) - *(.stub) - /* .gnu.warning sections are handled specially by elf32.em. */ + .text : { + *(.text .stub .text.* .gnu.linkonce.t.*) + /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) - *(.gnu.linkonce.t*) - } =0x47ff041f - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - .rel.text : - { *(.rel.text) *(.rel.gnu.linkonce.t*) } - .rela.text : - { *(.rela.text) *(.rela.gnu.linkonce.t*) } - .rel.data : - { *(.rel.data) *(.rel.gnu.linkonce.d*) } - .rela.data : - { *(.rela.data) *(.rela.gnu.linkonce.d*) } - .rel.rodata : - { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } - .rela.rodata : - { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.init : { *(.rel.init) } - .rela.init : { *(.rela.init) } - .rel.fini : { *(.rel.fini) } - .rela.fini : { *(.rela.fini) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } =0x47ff041f - _etext = .; - PROVIDE (etext = .); - .fini : { *(.fini) } =0x47ff041f - .rodata : { *(.rodata) *(.gnu.linkonce.r*) } - .rodata1 : { *(.rodata1) } - .reginfo : { *(.reginfo) } - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. */ - . = .; - .data : - { - *(.data) - *(.gnu.linkonce.d*) - CONSTRUCTORS + *(.plt) + } =0x00300000010070000002000001000400 + .data : { + *(.rodata .rodata.* .gnu.linkonce.r.*) + *(.rodata1) + *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) + *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) + *(.opd) + *(.IA_64.unwind_info* .gnu.linkonce.ia64unwi.*) + *(.IA_64.unwind* .gnu.linkonce.ia64unw.*) + __start_set_Xcommand_set = .; + *(set_Xcommand_set) + __stop_set_Xcommand_set = .; + *(.data .data.* .gnu.linkonce.d.*) + *(.data1) + *(.plabel) + *(.dynbss) + *(.bss .bss.* .gnu.linkonce.b.*) + *(COMMON) } - .data1 : { *(.data1) } - .ctors : - { - *(.ctors) + __gp = .; + .sdata : { + *(.got.plt .got) + *(.IA_64.pltoff) + *(.sdata .sdata.* .gnu.linkonce.s.*) + *(dynsbss) + *(.sbss .sbss.* .gnu.linkonce.sb.*) + *(.scommon) } - .dtors : - { - *(.dtors) + .dynamic : { *(.dynamic) } + .rela : { + *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) + *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) + *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) + *(.rela.got) + *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) + *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) + *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) + *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) + *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) + *(.rela.plt) + *(.rela.IA_64.pltoff) + *(.relaset_*) + *(.rela.dyn .rela.dyn.*) } - .plt : { *(.plt) } - /* gp points at .got+(1<<21) */ - __gp = ALIGN(8) + 0x200000; - .got : { *(.got.plt) *(.got) } - .dynamic : { *(.dynamic) } - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata : { *(.sdata) } - _edata = .; - PROVIDE (edata = .); - __bss_start = .; - .sbss : { *(.sbss) *(.scommon) } - .bss : - { - *(.dynbss) - *(.bss) - *(COMMON) - } - . = ALIGN(64 / 8); - _end = . ; - PROVIDE (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) } - .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) } - /* These must appear regardless of . */ + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } } - diff --git a/sys/boot/ia64/ski/main.c b/sys/boot/ia64/ski/main.c index c4b2225..f336d17 100644 --- a/sys/boot/ia64/ski/main.c +++ b/sys/boot/ia64/ski/main.c @@ -45,17 +45,11 @@ struct ski_devdesc currdev; /* our current device */ struct arch_switch archsw; /* MI/MD interface boundary */ void -__start(void) +ski_main(void) { - static char stack[16384] __aligned(16); static char malloc[512*1024]; int i; - __asm __volatile("movl gp=__gp;;"); - __asm __volatile("mov sp=%0" :: "r"(&stack[16384])); - __asm __volatile("bsw.1;;"); - __asm __volatile("mov ar.fpsr=%0" :: "r"(IA64_FPSR_DEFAULT)); - /* * initialise the heap as early as possible. Once this is done, * alloc() is usable. The stack is buried inside us, so this is diff --git a/sys/boot/ia64/ski/start.S b/sys/boot/ia64/ski/start.S new file mode 100644 index 0000000..bb0266f --- /dev/null +++ b/sys/boot/ia64/ski/start.S @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2003 Marcel Moolenaar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include <machine/fpu.h> + +#define STACKSIZE 16384 +#define FPSR_DEFAULT 0x0009804c0270033f + + .text + .global _start + .proc _start +_start: +{ .mlx + mov ar.rsc=0 + movl gp=__gp + ;; +} +{ .mlx + add r2=@gprel(stack),gp + movl r14=FPSR_DEFAULT + ;; +} +{ .mib + mov ar.bspstore=r2 + add r12=STACKSIZE-16,r2 + bsw.1 + ;; +} +{ .mmb + mov ar.rsc=3 + mov ar.fpsr=r14 + br.sptk ski_main + ;; +} + .endp _start + + .data + .align 16 +stack: .skip STACKSIZE diff --git a/sys/boot/ia64/skiload/Makefile b/sys/boot/ia64/skiload/Makefile index 8a374a1..8ba596a 100644 --- a/sys/boot/ia64/skiload/Makefile +++ b/sys/boot/ia64/skiload/Makefile @@ -7,7 +7,7 @@ NOMAN= NEWVERSWHAT= "ia64 SKI boot" ${MACHINE_ARCH} BINDIR?= /boot -SRCS+= main.c conf.c +SRCS+= conf.c main.c start.S CFLAGS+= -ffreestanding diff --git a/sys/boot/ia64/skiload/ldscript.ia64 b/sys/boot/ia64/skiload/ldscript.ia64 index cb35a4b..e4e1dad 100644 --- a/sys/boot/ia64/skiload/ldscript.ia64 +++ b/sys/boot/ia64/skiload/ldscript.ia64 @@ -1,135 +1,61 @@ /* $FreeBSD$ */ OUTPUT_FORMAT("elf64-ia64-little", "elf64-ia64-little", "elf64-ia64-little") OUTPUT_ARCH(ia64) -ENTRY(__start) +ENTRY(_start) SECTIONS { /* Read-only sections, merged into text segment: */ . = 0x100000; - - .text : - { - *(.text.ivt) - . += 8192; - *(.text) - *(.stub) - /* .gnu.warning sections are handled specially by elf32.em. */ + .text : { + *(.text .stub .text.* .gnu.linkonce.t.*) + /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) - *(.gnu.linkonce.t*) - } =0x47ff041f - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - .rel.text : - { *(.rel.text) *(.rel.gnu.linkonce.t*) } - .rela.text : - { *(.rela.text) *(.rela.gnu.linkonce.t*) } - .rel.data : - { *(.rel.data) *(.rel.gnu.linkonce.d*) } - .rela.data : - { *(.rela.data) *(.rela.gnu.linkonce.d*) } - .rel.rodata : - { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } - .rela.rodata : - { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.init : { *(.rel.init) } - .rela.init : { *(.rela.init) } - .rel.fini : { *(.rel.fini) } - .rela.fini : { *(.rela.fini) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } =0x47ff041f - _etext = .; - PROVIDE (etext = .); - .fini : { *(.fini) } =0x47ff041f - .rodata : { *(.rodata) *(.gnu.linkonce.r*) } - .rodata1 : { *(.rodata1) } - .reginfo : { *(.reginfo) } - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. */ - . = .; - .data : - { - *(.data) - *(.gnu.linkonce.d*) - CONSTRUCTORS + *(.plt) + } =0x00300000010070000002000001000400 + .data : { + *(.rodata .rodata.* .gnu.linkonce.r.*) + *(.rodata1) + *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) + *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) + *(.opd) + *(.IA_64.unwind_info* .gnu.linkonce.ia64unwi.*) + *(.IA_64.unwind* .gnu.linkonce.ia64unw.*) + __start_set_Xcommand_set = .; + *(set_Xcommand_set) + __stop_set_Xcommand_set = .; + *(.data .data.* .gnu.linkonce.d.*) + *(.data1) + *(.plabel) + *(.dynbss) + *(.bss .bss.* .gnu.linkonce.b.*) + *(COMMON) } - .data1 : { *(.data1) } - .ctors : - { - *(.ctors) + __gp = .; + .sdata : { + *(.got.plt .got) + *(.IA_64.pltoff) + *(.sdata .sdata.* .gnu.linkonce.s.*) + *(dynsbss) + *(.sbss .sbss.* .gnu.linkonce.sb.*) + *(.scommon) } - .dtors : - { - *(.dtors) + .dynamic : { *(.dynamic) } + .rela : { + *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) + *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) + *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) + *(.rela.got) + *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) + *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) + *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) + *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) + *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) + *(.rela.plt) + *(.rela.IA_64.pltoff) + *(.relaset_*) + *(.rela.dyn .rela.dyn.*) } - .plt : { *(.plt) } - /* gp points at .got+(1<<21) */ - __gp = ALIGN(8) + 0x200000; - .got : { *(.got.plt) *(.got) } - .dynamic : { *(.dynamic) } - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata : { *(.sdata) } - _edata = .; - PROVIDE (edata = .); - __bss_start = .; - .sbss : { *(.sbss) *(.scommon) } - .bss : - { - *(.dynbss) - *(.bss) - *(COMMON) - } - . = ALIGN(64 / 8); - _end = . ; - PROVIDE (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) } - .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) } - /* These must appear regardless of . */ + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } } - diff --git a/sys/boot/ia64/skiload/main.c b/sys/boot/ia64/skiload/main.c index c4b2225..f336d17 100644 --- a/sys/boot/ia64/skiload/main.c +++ b/sys/boot/ia64/skiload/main.c @@ -45,17 +45,11 @@ struct ski_devdesc currdev; /* our current device */ struct arch_switch archsw; /* MI/MD interface boundary */ void -__start(void) +ski_main(void) { - static char stack[16384] __aligned(16); static char malloc[512*1024]; int i; - __asm __volatile("movl gp=__gp;;"); - __asm __volatile("mov sp=%0" :: "r"(&stack[16384])); - __asm __volatile("bsw.1;;"); - __asm __volatile("mov ar.fpsr=%0" :: "r"(IA64_FPSR_DEFAULT)); - /* * initialise the heap as early as possible. Once this is done, * alloc() is usable. The stack is buried inside us, so this is diff --git a/sys/boot/ia64/skiload/start.S b/sys/boot/ia64/skiload/start.S new file mode 100644 index 0000000..bb0266f --- /dev/null +++ b/sys/boot/ia64/skiload/start.S @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2003 Marcel Moolenaar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include <machine/fpu.h> + +#define STACKSIZE 16384 +#define FPSR_DEFAULT 0x0009804c0270033f + + .text + .global _start + .proc _start +_start: +{ .mlx + mov ar.rsc=0 + movl gp=__gp + ;; +} +{ .mlx + add r2=@gprel(stack),gp + movl r14=FPSR_DEFAULT + ;; +} +{ .mib + mov ar.bspstore=r2 + add r12=STACKSIZE-16,r2 + bsw.1 + ;; +} +{ .mmb + mov ar.rsc=3 + mov ar.fpsr=r14 + br.sptk ski_main + ;; +} + .endp _start + + .data + .align 16 +stack: .skip STACKSIZE |