* abt kernel 2.6 compressed/head.s
@ 2009-10-25 6:49 zyxsjl
0 siblings, 0 replies; 3+ messages in thread
From: zyxsjl @ 2009-10-25 6:49 UTC (permalink / raw)
To: linux-arm-kernel
hi anyone, I have not understood some code in this file below: #ifndef CONFIG_ZBOOT_ROM /* * If we're running fully PIC === CONFIG_ZBOOT_ROM = n, * we need to fix up pointers into the BSS region. * r2 - BSS start * r3 - BSS end * sp - stack pointer */ add r2, r2, r0 add r3, r3, r0 add sp, sp, r0 /* * Relocate all entries in the GOT table. */ 1: ldr r1, [r6, #0] @ relocate entries in the GOT add r1, r1, r0 @ table. This fixes up the str r1, [r6], #4 @ C references. cmp r6, ip blo 1b #else /* * Relocate entries in the GOT table. We only relocate * the entries that are outside the (relocated) BSS region. */ 1: ldr r1, [r6, #0] @ relocate entries in the GOT cmp r1, r2 @ entry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091025/b0453206/attachment-0001.htm>
^ permalink raw reply [flat|nested] 3+ messages in thread
* abt kernel 2.6 compressed/head.s
@ 2009-10-27 3:54 zyxsjl
2009-10-27 18:06 ` Russell King - ARM Linux
0 siblings, 1 reply; 3+ messages in thread
From: zyxsjl @ 2009-10-27 3:54 UTC (permalink / raw)
To: linux-arm-kernel
hi anyone,
I have not understood some code in this file below:
#ifndef CONFIG_ZBOOT_ROM
/*
* If we're running fully PIC === CONFIG_ZBOOT_ROM = n,
* we need to fix up pointers into the BSS region.
* r2 - BSS start
* r3 - BSS end
* sp - stack pointer
*/
add r2, r2, r0
add r3, r3, r0
add sp, sp, r0
/*
* Relocate all entries in the GOT table.
*/
1: ldr r1, [r6, #0] @ relocate entries in the GOT
add r1, r1, r0 @ table. This fixes up the
str r1, [r6], #4 @ C references.
cmp r6, ip
blo 1b
#else
/*
* Relocate entries in the GOT table. We only relocate
* the entries that are outside the (relocated) BSS region.
*/
1: ldr r1, [r6, #0] @ relocate entries in the GOT
cmp r1, r2 @ entry < bss_start ||
cmphs r3, r1 @ _end < entry
addlo r1, r1, r0 @ table. This fixes up the
str r1, [r6], #4 @ C references.
cmp r6, ip
blo 1b
#endif
my question is:what is the different between the both CONFIG_ZBOOT_ROM=y or n, and so led to the different tackles from the above code on relocation?
thanks ahead
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091027/78b61379/attachment-0001.htm>
^ permalink raw reply [flat|nested] 3+ messages in thread* abt kernel 2.6 compressed/head.s
2009-10-27 3:54 zyxsjl
@ 2009-10-27 18:06 ` Russell King - ARM Linux
0 siblings, 0 replies; 3+ messages in thread
From: Russell King - ARM Linux @ 2009-10-27 18:06 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Oct 27, 2009 at 11:54:24AM +0800, zyxsjl wrote:
>
> hi anyone,
> I have not understood some code in this file below:
...
> my question is:what is the different between the both CONFIG_ZBOOT_ROM=y
> or n, and so led to the different tackles from the above code on relocation?
The first thing to note is that there is no initialized data section -
we only have text, constant data, and BSS.
When ZBOOT_ROM=n, we relocate all entries. This means that the entire
image can be relocated as a whole anywhere in RAM, and the BSS segment
moves with the image. Such an image can not be programmed into ROM or
flash.
When ZBOOT_ROM=y, we exclude BSS entries from being relocated. This
means that the image can still be relocated _provided_ it is located
in RAM, but the BSS remains at the compile-time fixed address.
If the image is located in ROM or flash, it can not be relocated and
_must_ be built for the precise address it will be executed from.
This restriction is because the GOT table will be in ROM and therefore
can not be written to (the code explicitly avoids any writes to the GOT
in this case.)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-27 18:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-25 6:49 abt kernel 2.6 compressed/head.s zyxsjl
-- strict thread matches above, loose matches on Subject: below --
2009-10-27 3:54 zyxsjl
2009-10-27 18:06 ` Russell King - ARM Linux
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).