What I was thinking was:
In kernel A()
relocate_new_kernel:
...
call *%eax
kexec_jump_back_entry:
/* This code should be PIC so figure out where we are */
call 1f
1:
popl %edi
subl $(1b - relocate_kernel), %edi
/* Setup a safe stack */
leal PAGE_SIZE(%edi), %esp
...
Then in purgatory we can read the address of kexec_jump_back_entry
by examining 0(%esp) and export it in whatever fashion is sane.
However we reach kexec_jump_back_entry we should be fine.
Eric
--