Bring in two bandaids to get the elf trampoline to work again, until I find
a proper solution. - Add a dummy entry point which just calls the C entry points, and try to make sure it's the first code in the binary. - Copy a bit more than func_end to try to copy the whole load_kernel() function. gcc4 puts code behind the func_end symbol. Approved by: re (blanket)
This commit is contained in:
parent
425b5be335
commit
23f9626539
@ -48,6 +48,7 @@ extern char kernel_end[];
|
||||
extern void *_end;
|
||||
|
||||
void __start(void);
|
||||
void __startC(void);
|
||||
|
||||
#define GZ_HEAD 0xa
|
||||
|
||||
@ -66,6 +67,13 @@ void __start(void);
|
||||
defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \
|
||||
defined(CPU_XSCALE_80219)
|
||||
#define cpu_idcache_wbinv_all xscale_cache_purgeID
|
||||
#elif defined(CPU_XSCALE_81342)
|
||||
#define cpu_idcache_wbinv_all xscalec3_cache_purgeID
|
||||
#endif
|
||||
#ifdef CPU_XSCALE_81342
|
||||
#define cpu_l2cache_wbinv_all xscalec3_l2cache_purge
|
||||
#else
|
||||
#define cpu_l2cache_wbinv_all()
|
||||
#endif
|
||||
|
||||
|
||||
@ -138,7 +146,7 @@ bzero(void *addr, int count)
|
||||
static void arm9_setup(void);
|
||||
|
||||
void
|
||||
_start(void)
|
||||
_startC(void)
|
||||
{
|
||||
int physaddr = KERNPHYSADDR;
|
||||
int tmp1;
|
||||
@ -207,6 +215,7 @@ _start(void)
|
||||
arm9_setup();
|
||||
#endif
|
||||
cpu_idcache_wbinv_all();
|
||||
cpu_l2cache_wbinv_all();
|
||||
#endif
|
||||
__start();
|
||||
}
|
||||
@ -520,7 +529,7 @@ load_kernel(unsigned int kstart, unsigned int curaddr,unsigned int func_end,
|
||||
extern char func_end[];
|
||||
|
||||
|
||||
#define PMAP_DOMAIN_KERNEL 15 /*
|
||||
#define PMAP_DOMAIN_KERNEL 0 /*
|
||||
* Just define it instead of including the
|
||||
* whole VM headers set.
|
||||
*/
|
||||
@ -595,10 +604,11 @@ __start(void)
|
||||
kernel = (char *)&_end;
|
||||
altdst = 4 + load_kernel((unsigned int)kernel,
|
||||
(unsigned int)curaddr,
|
||||
(unsigned int)&func_end , 0);
|
||||
(unsigned int)&func_end + 800 , 0);
|
||||
if (altdst > dst)
|
||||
dst = altdst;
|
||||
cpu_idcache_wbinv_all();
|
||||
cpu_l2cache_wbinv_all();
|
||||
__asm __volatile("mrc p15, 0, %0, c1, c0, 0\n"
|
||||
"bic %0, %0, #1\n" /* MMU_ENABLE */
|
||||
"mcr p15, 0, %0, c1, c0, 0\n"
|
||||
@ -616,7 +626,7 @@ __start(void)
|
||||
sp = sp &~3;
|
||||
dst = (void *)(sp + 4);
|
||||
memcpy((void *)dst, (void *)&load_kernel, (unsigned int)&func_end -
|
||||
(unsigned int)&load_kernel);
|
||||
(unsigned int)&load_kernel + 800);
|
||||
do_call(dst, kernel, dst + (unsigned int)(&func_end) -
|
||||
(unsigned int)(&load_kernel), sp);
|
||||
(unsigned int)(&load_kernel) + 800, sp);
|
||||
}
|
||||
|
@ -66,23 +66,27 @@ SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// ldscript.$M\
|
||||
FILES_CPU_FUNC = $S/$M/$M/cpufunc_asm_arm7tdmi.S \
|
||||
$S/$M/$M/cpufunc_asm_arm8.S $S/$M/$M/cpufunc_asm_arm9.S \
|
||||
$S/$M/$M/cpufunc_asm_sa1.S $S/$M/$M/cpufunc_asm_arm10.S \
|
||||
$S/$M/$M/cpufunc_asm_xscale.S $S/$M/$M/cpufunc_asm.S
|
||||
$S/$M/$M/cpufunc_asm_xscale.S $S/$M/$M/cpufunc_asm.S \
|
||||
$S/$M/$M/cpufunc_asm_xscale_c3.S
|
||||
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/" + 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
|
||||
${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. -Xlinker -T -Xlinker ldscript.$M.tramp \
|
||||
$S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S ${FILES_CPU_FUNC} \
|
||||
-o ${KERNEL_KO}.tramp
|
||||
tmphack.S $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \
|
||||
${FILES_CPU_FUNC} -o ${KERNEL_KO}.tramp
|
||||
${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.$M.tramp.noheader \
|
||||
$S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S ${FILES_CPU_FUNC} -o \
|
||||
${KERNEL_KO}.tramp.noheader
|
||||
tmphack.S $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \
|
||||
${FILES_CPU_FUNC} -o ${KERNEL_KO}.tramp.noheader
|
||||
${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \
|
||||
${KERNEL_KO}.tramp.bin
|
||||
${OBJCOPY} ${STRIP_FLAGS} ${KERNEL_KO}.tmp
|
||||
@ -95,15 +99,15 @@ ${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$M/inckern.S $S/$M/$M/elf_trampoline.c
|
||||
echo "#define KERNCOMPSIZE $$st_size" >>opt_kernname.h
|
||||
${CC} -O2 -DKZIP -I. -c $S/kern/inflate.c -o inflate-tramp.o
|
||||
${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.$M.tramp \
|
||||
-DKZIP $S/$M/$M/elf_trampoline.c inflate-tramp.o $S/$M/$M/inckern.S \
|
||||
${FILES_CPU_FUNC} -o ${KERNEL_KO}.gz.tramp
|
||||
-DKZIP tmphack.S $S/$M/$M/elf_trampoline.c inflate-tramp.o \
|
||||
$S/$M/$M/inckern.S ${FILES_CPU_FUNC} -o ${KERNEL_KO}.gz.tramp
|
||||
${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.$M.tramp.noheader \
|
||||
-DKZIP $S/$M/$M/elf_trampoline.c inflate-tramp.o $S/$M/$M/inckern.S \
|
||||
${FILES_CPU_FUNC} -o ${KERNEL_KO}.tramp.noheader
|
||||
-DKZIP tmphack.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
|
||||
rm ${KERNEL_KO}.tmp.gz ${KERNEL_KO}.tramp.noheader opt_kernname.h \
|
||||
inflate-tramp.o
|
||||
inflate-tramp.o tmphack.S
|
||||
|
||||
%BEFORE_DEPEND
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user