All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Yinghai Lu <yinghai@kernel.org>
Cc: Haren Myneni <hbabu@us.ibm.com>,
	Simon Horman <horms@verge.net.au>,
	kexec@lists.infradead.org, Vivek Goyal <vgoyal@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH 3/8] add mem64_min/max control
Date: Sat, 17 Nov 2012 22:11:18 -0800	[thread overview]
Message-ID: <871ufrqw3d.fsf@xmission.com> (raw)
In-Reply-To: <CAE9FiQWm=6yas4dRfbc+qLC7yEhbdt+pnRMwAYSQ1jjk5qOvBw@mail.gmail.com> (Yinghai Lu's message of "Sat, 17 Nov 2012 21:58:48 -0800")

Yinghai Lu <yinghai@kernel.org> writes:

> On Sat, Nov 17, 2012 at 9:39 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>> On Sat, Nov 17, 2012 at 9:35 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>>> On Sat, Nov 17, 2012 at 9:20 PM, Eric W. Biederman
>>> <ebiederm@xmission.com> wrote:
>>>> Yinghai Lu <yinghai@kernel.org> writes:
>>>>>
>>>>> there is lots of R_X86_64_32 and R_X86_64_32S for 64bit purgatory.
>>>>>
>>>>> those come from global variables...could kill some by converting them static...
>>>>>
>>>>> but still have some global string or ro data....
>>>>>
>>>>> build one big file include all .S ?
>>>>
>>>> For R_x86_64_32 and R_x86_64_32S the problem is that the instructions
>>>> are using absolute 32bit addresses.
>>>>
>>>> It is probably overkill but we should be able to solve this with
>>>> by adding "-mcmodel=large" to the build of purgatory.
>>>
>>> it kill some...
>>>
>>> still have left.... looks they from .S
>>>
>>> yhlu@linux-siqj:~/xx/xx/utils/kexec-tools> readelf --relocs
>>> purgatory/purgatory.ro | grep R_X86_64_32
>>> 0000000005e9  00020000000b R_X86_64_32S      0000000000000000 .rodata + c0
>>
>> looks like .S did not get that -mcmodel=large applied..
>
> so -mcmodel=large only work with .c, but does not have effects on .S ?

Yes it -mcmodel=large is about which instructions you generate.  The
instructions used determine the relocates.

Just for playing with it the following patch modifies things so
purgatory is 64bit clean.

I don't know yet what to do with the 32bit and 16bit assembly.

Eric


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)"
diff --git a/purgatory/arch/x86_64/Makefile b/purgatory/arch/x86_64/Makefile
index 22b4228..2a768c6 100644
--- a/purgatory/arch/x86_64/Makefile
+++ b/purgatory/arch/x86_64/Makefile
@@ -2,7 +2,7 @@
 # Purgatory x86_64
 #
 
-x86_64_PURGATORY_SRCS_native = purgatory/arch/x86_64/entry64-32.S
+#x86_64_PURGATORY_SRCS_native = purgatory/arch/x86_64/entry64-32.S
 x86_64_PURGATORY_SRCS_native += purgatory/arch/x86_64/entry64.S
 x86_64_PURGATORY_SRCS_native += purgatory/arch/x86_64/setup-x86_64.S
 x86_64_PURGATORY_SRCS_native += purgatory/arch/x86_64/stack.S
@@ -16,9 +16,11 @@ dist += purgatory/arch/x86_64/Makefile $(x86_64_PURGATORY_SRCS_native) 	\
 	purgatory/arch/x86_64/purgatory-x86_64.h
 
 # Don't add sources in i386/ to dist, as i386/Makefile adds them
-x86_64_PURGATORY_SRCS +=  purgatory/arch/i386/entry32-16.S
-x86_64_PURGATORY_SRCS += purgatory/arch/i386/entry32-16-debug.S
+#x86_64_PURGATORY_SRCS +=  purgatory/arch/i386/entry32-16.S
+#x86_64_PURGATORY_SRCS += purgatory/arch/i386/entry32-16-debug.S
 x86_64_PURGATORY_SRCS += purgatory/arch/i386/crashdump_backup.c
 x86_64_PURGATORY_SRCS += purgatory/arch/i386/console-x86.c
 x86_64_PURGATORY_SRCS += purgatory/arch/i386/vga.c
 x86_64_PURGATORY_SRCS += purgatory/arch/i386/pic.c
+
+x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large
diff --git a/purgatory/arch/x86_64/entry64.S b/purgatory/arch/x86_64/entry64.S
index 666023c..e3223b7 100644
--- a/purgatory/arch/x86_64/entry64.S
+++ b/purgatory/arch/x86_64/entry64.S
@@ -37,9 +37,10 @@ entry64:
 	movl	%eax, %fs
 	movl	%eax, %gs
 
-	movq	$stack_init, %rsp
+	leaq	stack_init(%rip), %rsp
 	pushq	$0x10 /* CS */
-	pushq	$new_cs_exit
+	leaq	new_cs_exit(%rip), %rax
+	pushq	%rax
 	lretq
 new_cs_exit:
 
diff --git a/purgatory/arch/x86_64/setup-x86_64.S b/purgatory/arch/x86_64/setup-x86_64.S
index 74997fa..95572d8 100644
--- a/purgatory/arch/x86_64/setup-x86_64.S
+++ b/purgatory/arch/x86_64/setup-x86_64.S
@@ -42,10 +42,10 @@ purgatory_start:
 	/* In 64bit mode the code segment is meaningless */
 
 	movq	0(%rsp), %rax
-	movq	%rax, jump_back_entry
+	movq	%rax, jump_back_entry(%rip)
 
 	/* Setup a stack */
-	movq	$lstack_end, %rsp
+	leaq	lstack_end(%rip), %rsp
 
 	/* Call the C code */
 	call purgatory


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2012-11-18  6:11 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-16 23:04 [PATCH 0/8] kexec: put bzImage and ramdisk above 4G for x86 64bit Yinghai Lu
2012-11-16 23:04 ` [PATCH 1/8] Add min/max macro Yinghai Lu
2012-11-16 23:04 ` [PATCH 2/8] x86: add boot header member for version 2.12 Yinghai Lu
2012-11-16 23:04 ` [PATCH 3/8] add mem64_min/max control Yinghai Lu
2012-11-17  6:18   ` Eric W. Biederman
2012-11-17  7:06     ` Yinghai Lu
2012-11-17  8:25       ` Eric W. Biederman
2012-11-17 20:04         ` Yinghai Lu
2012-11-17 20:41           ` H. Peter Anvin
2012-11-17 20:51             ` Yinghai Lu
2012-11-17 20:54               ` H. Peter Anvin
2012-11-18  0:44           ` Yinghai Lu
2012-11-18  4:34             ` H. Peter Anvin
2012-11-18  4:47               ` Eric W. Biederman
2012-11-18  4:55                 ` H. Peter Anvin
2012-11-18  5:00                   ` Eric W. Biederman
2012-11-18  5:14                     ` H. Peter Anvin
2012-11-18  4:56                 ` Yinghai Lu
2012-11-18  5:20                   ` Eric W. Biederman
2012-11-18  5:35                     ` Yinghai Lu
2012-11-18  5:39                       ` Yinghai Lu
2012-11-18  5:58                         ` Yinghai Lu
2012-11-18  6:11                           ` Eric W. Biederman [this message]
2012-11-18  6:32                             ` Yinghai Lu
2012-11-18  6:38                             ` Yinghai Lu
2012-11-18  6:50                               ` Eric W. Biederman
2012-11-18  6:53                                 ` Yinghai Lu
2012-11-18  7:18                                   ` Yinghai Lu
2012-11-18 10:38                                     ` Eric W. Biederman
2012-11-19  3:02                                       ` [PATCH 0/6] kexec: put bzImage and ramdisk above 4G for x86 64bit Yinghai Lu
2012-11-19  3:02                                         ` [PATCH 1/6] kexec, x86: add boot header member for version 2.12 Yinghai Lu
2012-11-19  3:02                                         ` [PATCH 2/6] kexec: don't die during buffer finding Yinghai Lu
2012-11-19  3:02                                         ` [PATCH 3/6] kexec, x86: put ramdisk high for 64bit bzImage Yinghai Lu
2012-11-19  3:02                                         ` [PATCH 4/6] kexec, x86: set ext_cmd_line_ptr when boot_param is put high Yinghai Lu
2012-11-19  3:02                                         ` [PATCH 5/6] kexec, x86: Make x64_64 purgatory relocatable above 4G Yinghai Lu
2012-11-19  3:02                                         ` [PATCH 6/6] kexec, x86_64: put 64bit bzImage high Yinghai Lu
2012-11-19  3:04                                       ` [PATCH v2 0/6] kexec: put bzImage and ramdisk above 4G for x86 64bit Yinghai Lu
2012-11-19  3:04                                         ` [PATCH v2 1/6] kexec, x86: add boot header member for version 2.12 Yinghai Lu
2012-11-19  3:04                                         ` [PATCH v2 2/6] kexec: don't die during buffer finding Yinghai Lu
2012-11-19 17:05                                           ` Eric W. Biederman
2012-11-19  3:04                                         ` [PATCH v2 3/6] kexec, x86: put ramdisk high for 64bit bzImage Yinghai Lu
2012-11-19 17:20                                           ` Eric W. Biederman
2012-11-19  3:04                                         ` [PATCH v2 4/6] kexec, x86: set ext_cmd_line_ptr when boot_param is put high Yinghai Lu
2012-11-19 17:22                                           ` Eric W. Biederman
2012-11-19  3:04                                         ` [PATCH v2 5/6] kexec, x86: Make x64_64 purgatory relocatable above 4G Yinghai Lu
2012-11-19  3:04                                         ` [PATCH v2 6/6] kexec, x86_64: put 64bit bzImage high Yinghai Lu
2012-11-19 17:28                                           ` Eric W. Biederman
2012-11-19 17:04                                         ` [PATCH v2 0/6] kexec: put bzImage and ramdisk above 4G for x86 64bit Eric W. Biederman
2012-11-18  6:24                         ` [PATCH 3/8] add mem64_min/max control H. Peter Anvin
2012-11-18  6:23                     ` H. Peter Anvin
2012-11-18  6:44                       ` Eric W. Biederman
2012-11-16 23:04 ` [PATCH 4/8] Move out mem_min/max checking in locate_hole Yinghai Lu
2012-11-16 23:04 ` [PATCH 5/8] seperate checking 64bit mem range Yinghai Lu
2012-11-16 23:04 ` [PATCH 6/8] debug print out for add_buf Yinghai Lu
2012-11-16 23:04 ` [PATCH 7/8] x86: put ramdisk high for 64bit bzImage Yinghai Lu
2012-11-16 23:04 ` [PATCH 8/8] x86: put 64bit bzImage high Yinghai Lu
2012-11-17  6:33   ` Eric W. Biederman
     [not found]     ` <CAE9FiQWJaT9yfdV0rgV-5rM=BR4eX8sr+a99g8Ggf-+YkD8qgQ@mail.gmail.com>
2012-11-17  8:43       ` Eric W. Biederman
2012-11-19 21:00 ` [PATCH 0/8] kexec: put bzImage and ramdisk above 4G for x86 64bit Vivek Goyal
2012-11-19 22:34   ` Yinghai Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871ufrqw3d.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=hbabu@us.ibm.com \
    --cc=horms@verge.net.au \
    --cc=hpa@zytor.com \
    --cc=kexec@lists.infradead.org \
    --cc=vgoyal@redhat.com \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.