svn commit: r216474 - in head/sys: conf mips/mips
Jayachandran C.
jchandra at FreeBSD.org
Thu Dec 16 04:56:04 UTC 2010
Author: jchandra
Date: Thu Dec 16 04:56:03 2010
New Revision: 216474
URL: http://svn.freebsd.org/changeset/base/216474
Log:
Make the ELF trampoline binary ELF executable (and do some cleanup).
- Remove the -shared flag for the trampoline binary, generate an
ELF executable instead of a shared object.
- No need to generate tmphack.S, move the code to sys/mips/mips/inckern.S
- No need generate opt_kernname.h, KERNNAME can be passed with -D
Reviewed by: gonzo, imp
Modified:
head/sys/conf/Makefile.mips
head/sys/mips/mips/elf_trampoline.c
head/sys/mips/mips/inckern.S
Modified: head/sys/conf/Makefile.mips
==============================================================================
--- head/sys/conf/Makefile.mips Thu Dec 16 00:36:10 2010 (r216473)
+++ head/sys/conf/Makefile.mips Thu Dec 16 04:56:03 2010 (r216474)
@@ -50,6 +50,7 @@ HACK_EXTRA_FLAGS=-shared
# is extremely poor, as well as -mno-abicalls to force no ABI usage.
CFLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS)
HACK_EXTRA_FLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS)
+TRAMP_EXTRA_FLAGS=${EXTRA_FLAGS} $(ARCH_FLAGS)
# XXX hardcoded kernel entry point
ASM_CFLAGS+=${CFLAGS} -D_LOCORE -DLOCORE
@@ -62,21 +63,10 @@ ${KERNEL_KO}.tramp.bin: ${KERNEL_KO} $S/
-g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp
sed s/${KERNLOADADDR}/${TRAMPLOADADDR}/ ${LDSCRIPT_NAME} | \
sed s/" + SIZEOF_HEADERS"// > ${LDSCRIPT_NAME}.tramp.noheader
- # Generate .S file that setups stack and jumps to trampoline
- echo "#include <machine/asm.h>" >tmphack.S
- echo "ENTRY(_start)" >>tmphack.S
- echo "PTR_LA t0, kernel_end" >>tmphack.S
- echo "move sp, t0" >>tmphack.S
- echo "add sp, 0x2000" >>tmphack.S
- echo "and sp, ~0x7" >>tmphack.S
- echo "PTR_LA t0, _startC" >>tmphack.S
- echo "j t0" >>tmphack.S
- echo "END(_start)" >>tmphack.S
- echo "#define KERNNAME \"${KERNEL_KO}.tmp\"" >opt_kernname.h
- ${CC} -O -nostdlib -I. -I$S ${HACK_EXTRA_FLAGS} ${TRAMP_LDFLAGS} -Xlinker \
- -T -Xlinker ${LDSCRIPT_NAME}.tramp.noheader tmphack.S \
- $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \
- -o ${KERNEL_KO}.tramp.noheader
+ ${CC} -O -nostdlib -I. -I$S ${TRAMP_EXTRA_FLAGS} ${TRAMP_LDFLAGS} -Xlinker \
+ -T -Xlinker ${LDSCRIPT_NAME}.tramp.noheader \
+ -DKERNNAME="\"${KERNEL_KO}.tmp\"" $S/$M/$M/elf_trampoline.c \
+ $S/$M/$M/inckern.S -o ${KERNEL_KO}.tramp.noheader
${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \
${KERNEL_KO}.tramp.bin \
Modified: head/sys/mips/mips/elf_trampoline.c
==============================================================================
--- head/sys/mips/mips/elf_trampoline.c Thu Dec 16 00:36:10 2010 (r216473)
+++ head/sys/mips/mips/elf_trampoline.c Thu Dec 16 04:56:03 2010 (r216474)
@@ -42,7 +42,10 @@ __FBSDID("$FreeBSD$");
* need to include opt_global.h manually.
*/
#include "opt_global.h"
-#include "opt_kernname.h"
+
+#ifndef KERNNAME
+#error Kernel name not provided
+#endif
extern char kernel_start[];
extern char kernel_end[];
Modified: head/sys/mips/mips/inckern.S
==============================================================================
--- head/sys/mips/mips/inckern.S Thu Dec 16 00:36:10 2010 (r216473)
+++ head/sys/mips/mips/inckern.S Thu Dec 16 04:56:03 2010 (r216474)
@@ -22,10 +22,23 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opt_kernname.h"
-
#include <machine/asm.h>
__FBSDID("$FreeBSD$")
+
+ENTRY(_start)
+ PTR_LA t0, kernel_end
+ move sp, t0
+ add sp, 0x2000
+ and sp, ~0x7
+ PTR_LA t0, _startC
+ j t0
+ nop
+END(_start)
+
+#ifndef KERNNAME
+#error Need a kernel name here
+#endif
+
.section ".real_kernel","aw"
.globl kernel_start;
kernel_start:
More information about the svn-src-all
mailing list