diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2015-01-19 17:58:01 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2015-01-19 17:58:01 +0000 |
commit | fb73b4e2f2ff339821cf787fb9bd4ed7f0d638a1 (patch) | |
tree | 3d5cbfed6bd49b37d9cae752e6ee3cebf9df6718 /sys/powerpc/aim/locore64.S | |
parent | f748dc7ade0eee53b5b866b6a9adc48ecf24b098 (diff) | |
download | FreeBSD-src-fb73b4e2f2ff339821cf787fb9bd4ed7f0d638a1.zip FreeBSD-src-fb73b4e2f2ff339821cf787fb9bd4ed7f0d638a1.tar.gz |
Add some initial infrastructure for relocating the kernel in place.
MFC after: 2 months
Differential revision: D1554
Diffstat (limited to 'sys/powerpc/aim/locore64.S')
-rw-r--r-- | sys/powerpc/aim/locore64.S | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/sys/powerpc/aim/locore64.S b/sys/powerpc/aim/locore64.S index 30ee3a9..abce9d8 100644 --- a/sys/powerpc/aim/locore64.S +++ b/sys/powerpc/aim/locore64.S @@ -121,13 +121,33 @@ ASENTRY_NOPROF(__start) .align 3 0: nop bl 1f - .llong __tocbase + 0x8000 + .llong __tocbase + 0x8000 - . 1: mflr %r2 - ld %r2,0(%r2) + ld %r1,0(%r2) + add %r2,%r1,%r2 /* Set up the stack pointer */ ld %r1,TOC_REF(tmpstk)(%r2) - addi %r1,%r1,TMPSTKSZ-48 + addi %r1,%r1,TMPSTKSZ-96 + + /* Relocate kernel */ + std %r3,48(%r1) + std %r4,56(%r1) + std %r5,64(%r1) + std %r6,72(%r1) + bl 1f + .llong _DYNAMIC-. +1: mflr %r3 + ld %r4,0(%r3) + add %r3,%r4,%r3 + ld %r4,-0x8000(%r2) /* First TOC entry is TOC base */ + subf %r4,%r4,%r2 /* Subtract from real TOC base to get base */ + bl elf_reloc_self + nop + ld %r3,48(%r1) + ld %r4,56(%r1) + ld %r5,64(%r1) + ld %r6,72(%r1) /* Switch to 64-bit mode */ mfmsr %r9 |