diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2012-11-19 08:56:22 -0800 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2012-11-21 09:15:59 +0900 |
commit | b4f9f8599679259a471f3430f11966c6db78ad3d (patch) | |
tree | be9bf0f8d71432d974956e829ad4abfb1fbe61bb /purgatory/Makefile | |
parent | 53e81b4ad85ef2b3326a15d54a07e481c44ed17b (diff) |
kexec x86_64: Make purgatory relocatable anywhere in the 64bit address space.
Remove kexec/arch/i386/compat_x6_64.S
purgatory/arch/i386/linux-entry16.S and purgatory/arch/i386/entry16.S
Those were early attempts at entry32-16.S that should have been
deleted long ago.
Strip the purgatory code of debug symbols. There is no need to carry
debug symbols we will never use around in /sbin/kexec.
On x86_64 use -mcmodel=large so that the code is built without
any 32bit assumptions. -mcmodel=medium and -mcmodel=small
result int code that has 32bit relocations against variables
that can live anywhere in the address space
Modify the assembly in entry64.S and setup-x86_64.S to use %rip
relative addressing of variables so no relocates are emitted.
Modify entry64-32.S so that it does not have any relocations that can
not be processed when purgatory is loaded above 4G. entry64-32.S
jumps to a 32bit entry point and can not itself be used above 4G so
these changes merely prevent it from being a problem in the other case.
eip is modifed to be a 64bit value of which only the low 32bits are
exported outside of entry64-32.S
The long mode exit code is modified to run with a %cs value whose
base address is the address of the symbol entry32. From there
all of the 32bit code in entry64-32.S can read variables by reading
them through %cs. Until the final jump to the the target address
which is made a far jump reloading %cs and the intstruction pointer.
Modify entry32-16.S and entry32-16-debug.S to be position independent
32bit code. At their start make a short call to push the current value
of %eip on the stack and pop it off. Allowing the calculation of the
address of entry16 which the code has always kept in %ebx.
Update the pointer to the gdt in the gdt so that lgdt will work.
Modify the instructions in entry32-16.S and entry32-16-debug.S so
that the 32bit code uses offsets from %ebx which points at entry16.
Tested-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'purgatory/Makefile')
-rw-r--r-- | purgatory/Makefile | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/purgatory/Makefile b/purgatory/Makefile index ee1679c..e39adec 100644 --- a/purgatory/Makefile +++ b/purgatory/Makefile @@ -64,6 +64,7 @@ $(PURGATORY): $(PURGATORY_OBJS) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ # $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB) + $(STRIP) --strip-debug $@ echo:: @echo "PURGATORY_SRCS $(PURGATORY_SRCS)" |