mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-13 10:02:38 +00:00
Add support for 64-bit PowerPC kernels to be directly loaded by kexec, which
is used as the bootloader on a number of PPC64 platforms. This involves the following pieces: - Making the first instruction a valid kernel entry point, since kexec ignores the ELF entry value. This requires a separate section and linker magic to prevent the linker from filling the beginning of the section with stubs. - Adding an entry point at 0x60 past the first instruction for systems lacking firmware CPU shutdown support (notably PS3). - Linker script changes to support the above. MFC after: 1 month
This commit is contained in:
parent
8469e0fe35
commit
70f654991a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=327358
@ -8,8 +8,12 @@ SEARCH_DIR(/usr/lib);
|
||||
PROVIDE (__stack = 0);
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
|
||||
/* Low-address wrapper for bootloaders (kexec/kboot) that can't parse ELF */
|
||||
. = kernbase - 0x100;
|
||||
.kboot : { *(.text.kboot) }
|
||||
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = kernbase;
|
||||
PROVIDE (begin = .);
|
||||
|
||||
@ -28,6 +32,9 @@ SECTIONS
|
||||
.interpX : { *(.interp) } : NONE
|
||||
/DISCARD/ : { *(.interp) }
|
||||
|
||||
/* Also delete notes */
|
||||
/DISCARD/ : { *(.note.*) }
|
||||
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
|
@ -61,6 +61,47 @@ GLOBAL(tmpstk)
|
||||
|
||||
TOC_ENTRY(tmpstk)
|
||||
|
||||
/*
|
||||
* Entry point for bootloaders that do not fully implement ELF and start
|
||||
* at the beginning of the image (kexec, notably). In its own section so
|
||||
* that it ends up before any linker-generated call stubs and actually at
|
||||
* the beginning of the image. kexec on some systems also enters at
|
||||
* (start of image) + 0x60, so put a spin loop there.
|
||||
*/
|
||||
.section ".text.kboot", "x", @progbits
|
||||
kbootentry:
|
||||
b __start
|
||||
. = kbootentry + 0x40 /* Magic address used in platform layer */
|
||||
.global smp_spin_sem
|
||||
ap_kexec_spin_sem:
|
||||
.long -1
|
||||
. = kbootentry + 0x60 /* Entry point for kexec APs */
|
||||
ap_kexec_start: /* At 0x60 past start, copied to 0x60 by kexec */
|
||||
/* r3 set to CPU ID by kexec */
|
||||
|
||||
/* Invalidate icache for low-memory copy and jump there */
|
||||
li %r0,0x80
|
||||
dcbst 0,%r0
|
||||
sync
|
||||
icbi 0,%r0
|
||||
isync
|
||||
ba 0x78 /* Absolute branch to next inst */
|
||||
|
||||
1: or 31,31,31 /* yield */
|
||||
sync
|
||||
lwz %r1,0x40(0) /* Spin on ap_kexec_spin_sem */
|
||||
cmpw %r1,%r3 /* Until it equals our CPU ID */
|
||||
bne 1b
|
||||
|
||||
/* Released */
|
||||
or 2,2,2 /* unyield */
|
||||
ba EXC_RST
|
||||
|
||||
|
||||
/*
|
||||
* Now start the real text section
|
||||
*/
|
||||
|
||||
.text
|
||||
.globl btext
|
||||
btext:
|
||||
|
@ -108,7 +108,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef AIM
|
||||
#define KERNBASE 0x00100000UL /* start of kernel virtual */
|
||||
#define KERNBASE 0x00100100UL /* start of kernel virtual */
|
||||
|
||||
#ifndef __powerpc64__
|
||||
#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)KERNEL_SR << ADDR_SR_SHFT)
|
||||
|
Loading…
Reference in New Issue
Block a user