Milton Miller wrote:
On Oct 23, 2008, at 10:15 AM, Mohan Kumar M wrote:
Hi Milton,
My suggestions:
Milton Miller wrote:

i.e.,
[code snip 1]
        lwz     r7,__run_at_load-_stext(r26)
        cmplwi  cr0,r7,1        /* kdump kernel ? - stay where we are */
        bne     1f
        add     r25,r25,r26

        lwz     r7,__run_at_load-_stext(r26)
        cmplwi  cr0,r7,1
        bne     3f

kexec-tools
[code snip 2]
        LOADADDR(6,run_at_load)
        ld      18,0(6)
        cmpd    18,1
        bne     skip
        li      7,1
        stw     7,92(4)         # mark __run_at_load flag at kernel
skip:
        lwz     7,0(4)          # get the first instruction that we stole
        stw     7,0(0)          # and put it in the slave loop at 0
                                # skip cache flush, do we care?

[code snip 3]
        if (info->kexec_flags & KEXEC_ON_CRASH) {
                ....
                elf_rel_set_symbol(&info->rhdr, "run_at_load",
&my_run_at_load, sizeof(my_run_at_load));
        }


This elf_rel_set_symbol sets the copy in purgatory,
after we have copied the code from the kernel.  It
is this copy that gets copied to address 0.


Yes, elf_ret_symbol sets the copy in purgatory. But the following code in purgatory (to be introduced)

        LOADADDR(6,run_at_load)
        ld      18,0(6)
        cmpd    18,1
        bne     skip
        li      7,1
        stw     7,92(4)         # mark __run_at_load flag at kernel

will set the __run_at_load in the kernel image (ie where ever kernel is loaded + 0x5c(92). Or am I missing some thing?

However this information is not in the code that
is at the start of the kernel.  We don't have any
symbols for the kernel itself, it might be stripped.
So we can't use the elf_set_symbol api.  (The kernel
may not be relocatable either).

Regards,
Mohan.
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to