socsvn commit: r270073 - in soc2014/estaszuk/microblaze-head/head/sys: conf microblaze/microblaze
estaszuk at FreeBSD.org
estaszuk at FreeBSD.org
Thu Jun 26 12:26:11 UTC 2014
Author: estaszuk
Date: Thu Jun 26 12:26:09 2014
New Revision: 270073
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=270073
Log:
Combining kernel into image
Added:
soc2014/estaszuk/microblaze-head/head/sys/microblaze/microblaze/cpufunc_asm_microblaze.S
Modified:
soc2014/estaszuk/microblaze-head/head/sys/conf/Makefile.microblaze
soc2014/estaszuk/microblaze-head/head/sys/conf/ldscript.microblaze
soc2014/estaszuk/microblaze-head/head/sys/microblaze/microblaze/elf_trampoline.c
soc2014/estaszuk/microblaze-head/head/sys/microblaze/microblaze/locore.S
Modified: soc2014/estaszuk/microblaze-head/head/sys/conf/Makefile.microblaze
==============================================================================
--- soc2014/estaszuk/microblaze-head/head/sys/conf/Makefile.microblaze Thu Jun 26 11:02:51 2014 (r270072)
+++ soc2014/estaszuk/microblaze-head/head/sys/conf/Makefile.microblaze Thu Jun 26 12:26:09 2014 (r270073)
@@ -78,18 +78,18 @@
trampoline: ${KERNEL_KO}.tramp
${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$M/inckern.S $S/$M/$M/elf_trampoline.c
echo "#define KERNNAME \"${KERNEL_KO}.tmp\"" >opt_kernname.h
- sed s/${KERNVIRTADDR}/${KERNPHYSADDR}/ ldscript.$M > ldscript.$M.tramp
+ sed s/0x00000000/0x0000c000/ ldscript.$M > ldscript.$M.tramp
sed s/" + SIZEOF_HEADERS"// ldscript.$M.tramp > \
ldscript.$M.tramp.noheader
echo "#include <machine/asm.h>" >tmphack.S
- echo "ENTRY(_start)" >>tmphack.S
- echo "bl _startC" >>tmphack.S
+ echo "ENTRY(__start)" >>tmphack.S
+ echo "bri _startC" >>tmphack.S
${OBJCOPY} --strip-symbol '$$d' --strip-symbol '$$a' \
-g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp
eval $$(stat -s ${KERNEL_KO}.tmp) && \
echo "#define KERNSIZE $$st_size" >>opt_kernname.h
${CC} -O -nostdlib -I. -I$S -Xlinker -T -Xlinker ldscript.$M.tramp \
- tmphack.S $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \
+ tmphack.S $S/libkern/$M/mulsi3.S $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \
${FILES_CPU_FUNC} -o ${KERNEL_KO}.tramp
${CC} -O -nostdlib -I. -I$S -Xlinker -T -Xlinker \
ldscript.$M.tramp.noheader \
@@ -111,7 +111,7 @@
$S/$M/$M/inckern.S ${FILES_CPU_FUNC} -o ${KERNEL_KO}.gz.tramp
${CC} -O -nostdlib -I. -I$S -Xlinker -T -Xlinker \
ldscript.$M.tramp.noheader \
- -DKZIP tmphack.S $S/$M/$M/elf_trampoline.c inflate-tramp.o \
+ -DKZIP tmphack.S $S/libkern/$M/mulsi3.S $S/$M/$M/elf_trampoline.c inflate-tramp.o \
$S/$M/$M/inckern.S ${FILES_CPU_FUNC} -o ${KERNEL_KO}.tramp.noheader
${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \
${KERNEL_KO}.gz.tramp.bin
Modified: soc2014/estaszuk/microblaze-head/head/sys/conf/ldscript.microblaze
==============================================================================
--- soc2014/estaszuk/microblaze-head/head/sys/conf/ldscript.microblaze Thu Jun 26 11:02:51 2014 (r270072)
+++ soc2014/estaszuk/microblaze-head/head/sys/conf/ldscript.microblaze Thu Jun 26 12:26:09 2014 (r270073)
@@ -2,14 +2,14 @@
OUTPUT_FORMAT("elf32-microblaze", "elf32-microblaze", "elf32-microblaze")
OUTPUT_ARCH(microblaze)
-ENTRY(__start)
+ENTRY(_start)
SEARCH_DIR(/usr/lib);
PROVIDE (__stack = 0);
SECTIONS
{
/* Read-only sections, merged into text segment: */
- . = kernbase + SIZEOF_HEADERS;
+/* TODO . = kernbase + SIZEOF_HEADERS;*/
.text :
{
@@ -112,31 +112,5 @@
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
- /* 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 . */
}
Added: soc2014/estaszuk/microblaze-head/head/sys/microblaze/microblaze/cpufunc_asm_microblaze.S
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ soc2014/estaszuk/microblaze-head/head/sys/microblaze/microblaze/cpufunc_asm_microblaze.S Thu Jun 26 12:26:09 2014 (r270073)
@@ -0,0 +1,81 @@
+/* $NetBSD: cpufunc_asm_armv4.S,v 1.1 2001/11/10 23:14:09 thorpej Exp $ */
+
+// TODO stub
+
+/*-
+ * Copyright (c) 2001 ARM Limited
+ * Copyright (c) 1997,1998 Mark Brinicombe.
+ * Copyright (c) 1997 Causality Limited
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Causality Limited.
+ * 4. The name of Causality Limited may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CAUSALITY LIMITED ``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 CAUSALITY LIMITED 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.
+ *
+ * ARM9 assembly functions for CPU / MMU / TLB specific operations
+ *
+ */
+
+#include <machine/asm.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * TLB functions
+ */
+ENTRY(armv4_tlb_flushID)
+// mcr p15, 0, r0, c8, c7, 0 /* flush I+D tlb */
+// RET
+END(armv4_tlb_flushID)
+
+ENTRY(armv4_tlb_flushI)
+// mcr p15, 0, r0, c8, c5, 0 /* flush I tlb */
+// RET
+END(armv4_tlb_flushI)
+
+ENTRY(armv4_tlb_flushD)
+// mcr p15, 0, r0, c8, c6, 0 /* flush D tlb */
+// RET
+END(armv4_tlb_flushD)
+
+ENTRY(armv4_tlb_flushD_SE)
+// mcr p15, 0, r0, c8, c6, 1 /* flush D tlb single entry */
+// RET
+END(armv4_tlb_flushD_SE)
+
+/*
+ * Other functions
+ */
+ENTRY(armv4_drain_writebuf)
+// mcr p15, 0, r0, c7, c10, 4 /* drain write buffer */
+// RET
+END(armv4_drain_writebuf)
+
+ENTRY(armv4_idcache_inv_all)
+// mov r0, #0
+// mcr p15, 0, r0, c7, c7, 0 /* invalidate all I+D cache */
+// RET
+END(armv4_drain_writebuf)
+
Modified: soc2014/estaszuk/microblaze-head/head/sys/microblaze/microblaze/elf_trampoline.c
==============================================================================
--- soc2014/estaszuk/microblaze-head/head/sys/microblaze/microblaze/elf_trampoline.c Thu Jun 26 11:02:51 2014 (r270072)
+++ soc2014/estaszuk/microblaze-head/head/sys/microblaze/microblaze/elf_trampoline.c Thu Jun 26 12:26:09 2014 (r270073)
@@ -40,6 +40,9 @@
#include <machine/cpufunc.h>
#include <machine/armreg.h>
+// TODO v---------- Make it right
+#define KERNVIRTADDR 0x0000c000
+
extern char kernel_start[];
extern char kernel_end[];
@@ -475,9 +478,11 @@
load_kernel(unsigned int kstart, unsigned int curaddr,unsigned int func_end,
int d)
{
+// TODO add __mulsi3 (here? inside Makefile?)
+/*
Elf32_Ehdr *eh;
- Elf32_Phdr phdr[64] /* XXX */, *php;
- Elf32_Shdr shdr[64] /* XXX */;
+ Elf32_Phdr phdr[64] /* XXX * /, *php;
+ Elf32_Shdr shdr[64] /* XXX * /;
int i,j;
void *entry_point;
int symtabindex = -1;
@@ -492,7 +497,7 @@
memcpy(phdr, (void *)(kstart + eh->e_phoff ),
eh->e_phnum * sizeof(phdr[0]));
- /* Determine lastaddr. */
+ /* Determine lastaddr. * /
for (i = 0; i < eh->e_phnum; i++) {
if (lastaddr < (phdr[i].p_vaddr - KERNVIRTADDR + curaddr
+ phdr[i].p_memsz))
@@ -500,7 +505,7 @@
curaddr + phdr[i].p_memsz;
}
- /* Save the symbol tables, as there're about to be scratched. */
+ /* Save the symbol tables, as there're about to be scratched. * /
memcpy(shdr, (void *)(kstart + eh->e_shoff),
sizeof(*shdr) * eh->e_shnum);
if (eh->e_shnum * eh->e_shentsize != 0 &&
@@ -561,13 +566,13 @@
continue;
// TODO memcpy((void *)(phdr[i].p_vaddr - KERNVIRTADDR + curaddr),
// TODO (void*)(kstart + phdr[i].p_offset), phdr[i].p_filesz);
- /* Clean space from oversized segments, eg: bss. */
+ /* Clean space from oversized segments, eg: bss. * /
if (phdr[i].p_filesz < phdr[i].p_memsz)
bzero((void *)(phdr[i].p_vaddr - KERNVIRTADDR +
curaddr + phdr[i].p_filesz), phdr[i].p_memsz -
phdr[i].p_filesz);
}
- /* Now grab the symbol tables. */
+ /* Now grab the symbol tables. * /
if (symtabindex >= 0 && symstrindex >= 0) {
*(Elf_Size *)lastaddr =
shdr[symtabindex].sh_size;
@@ -593,6 +598,7 @@
*((Elf_Addr *)curaddr + 2) = lastaddr - curaddr + KERNVIRTADDR;
} else
*(Elf_Addr *)curaddr = 0;
+ */
/* Invalidate the instruction cache. */
// TODO __asm __volatile("mcr p15, 0, %0, c7, c5, 0\n"
// TODO "mcr p15, 0, %0, c7, c10, 4\n"
@@ -603,14 +609,14 @@
// TODO : "=r" (ssym));
/* Jump to the entry point. */
// TODO ((void(*)(void))(entry_point - KERNVIRTADDR + curaddr))();
- __asm __volatile(".globl func_end\n"
- "func_end:");
+// TODO was already definied __asm __volatile(".globl func_end\n"
+// TODO "func_end:");
/* NOTREACHED */
return NULL;
}
-extern char func_end[];
+// TODO extern char func_end[];
#define PMAP_DOMAIN_KERNEL 0 /*
@@ -659,8 +665,9 @@
__hack = *(volatile int *)0xfffff21c;
}
+// TODO
void
-__start(void)
+__start_TODOdisable(void)
{
void *curaddr;
void *dst, *altdst;
@@ -686,9 +693,10 @@
/* Gzipped kernel */
dst = inflate_kernel(kernel, &_end);
kernel = (char *)&_end;
- altdst = 4 + load_kernel((unsigned int)kernel,
+/* TODO altdst = 4 + load_kernel((unsigned int)kernel,
(unsigned int)curaddr,
(unsigned int)&func_end + 800 , 0);
+*/
if (altdst > dst)
dst = altdst;
@@ -705,9 +713,10 @@
*/
} else
#endif
- dst = 4 + load_kernel((unsigned int)&kernel_start,
+/* TODO dst = 4 + load_kernel((unsigned int)&kernel_start,
(unsigned int)curaddr,
(unsigned int)&func_end, 0);
+*/
dst = (void *)(((vm_offset_t)dst & ~3));
pt_addr = ((unsigned int)dst &~(L1_TABLE_SIZE - 1)) + L1_TABLE_SIZE;
setup_pagetables(pt_addr, (vm_paddr_t)curaddr,
@@ -715,10 +724,14 @@
sp = pt_addr + L1_TABLE_SIZE + 8192;
sp = sp &~3;
dst = (void *)(sp + 4);
- memcpy((void *)dst, (void *)&load_kernel, (unsigned int)&func_end -
+/* TODO memcpy((void *)dst, (void *)&load_kernel, (unsigned int)&func_end -
(unsigned int)&load_kernel + 800);
- do_call(dst, kernel, dst + (unsigned int)(&func_end) -
+relocating kernel after load_kernel
+*/
+/* TODO do_call(dst, kernel, dst + (unsigned int)(&func_end) -
(unsigned int)(&load_kernel) + 800, sp);
+calling kernel
+*/
}
#ifdef __ARM_EABI__
Modified: soc2014/estaszuk/microblaze-head/head/sys/microblaze/microblaze/locore.S
==============================================================================
--- soc2014/estaszuk/microblaze-head/head/sys/microblaze/microblaze/locore.S Thu Jun 26 11:02:51 2014 (r270072)
+++ soc2014/estaszuk/microblaze-head/head/sys/microblaze/microblaze/locore.S Thu Jun 26 12:26:09 2014 (r270073)
@@ -70,14 +70,14 @@
* structure and pass that to initarm.
*/
ENTRY_NP(btext)
-ASENTRY_NP(__start)
+ENTRY_NP(_start)
infiniteLoop:
nop
bri infiniteLoop
END(btext)
-END(__start)
+END(_start)
ASENTRY_NP(mpentry)
@@ -116,5 +116,16 @@
.global szsigcode
szsigcode:
.long esigcode-sigcode
-//R END(sigcode)
+//END(sigcode)
+
+/*
+ * This is for kvm_mkdb, and should be the address of the beginning
+ * of the kernel text segment (not necessarily the same as kernbase).
+ */
+ .text
+ .align 0
+.globl kernbase
+.set kernbase,0x0000c000// TODO KERNBASE
+.globl physaddr
+.set physaddr,0x00000000 // TODO PHYSADDR
/* End of locore.S */
More information about the svn-soc-all
mailing list