/* The purgatory is the code running between two kernels. It's main purpose *istoverifythatthenextkernelwasnotcorruptedafterloadandto *startit. * *Ifthenextkernelisacrashkerneltherearesomepeculiaritiesto *consider: * *Firstthepurgatoryiscalledtwice.Onceonlytoverifythe *shadigest.Soifthecrashkernelgotcorruptedtheoldkernelcantry *totriggerastand-alonedumper.Andoncetoactuallyloadthecrashkernel. * *Secondthepurgatoryalsohastoswapthecrashmemoryregionwithits *destinationataddress0.Asthepurgatoryispartofcrashmemorythis *requiressomefinesse.Thetactichereisthatthepurgatoryfirstcopies *itselftotheendofthedestinationandthenswapstherestofthe *memoryrunningfromthere.
*/
.text
.balign PAGE_SIZE
SYM_CODE_START(purgatory_start) /* The purgatory might be called after a diag308 so better set *architectureandaddressingmode.
*/
lhi %r1,1
sigp %r1,%r0,SIGP_SET_ARCHITECTURE
sam64
/* If the next kernel is KEXEC_TYPE_CRASH the purgatory is called *directlywithaflagpassedin%r2whetherthepurgatoryshalldo *checksumverificationonly(%r2=0->verificationonly). * *ChecknowandpreserveoverCfunctioncallbystoringin *%r10with *1->checksumverificationonly *0->loadnewkernel
*/
lghi %r10,0
lg %r11,kernel_type-.base_crash(%r13)
cghi %r11,1/* KEXEC_TYPE_CRASH */
jne .do_checksum_verification
cghi %r2,0/* checksum verification only */
jne .do_checksum_verification
lghi %r10,1
.start_crash_kernel: /* Location of purgatory_start in crash memory */
larl %r0,.base_crash
larl %r1,purgatory_start
slgr %r0,%r1
lgr %r8,%r13
sgr %r8,%r0
/* Destination for this code i.e. end of memory to be swapped. */
larl %r0,purgatory_end
larl %r1,purgatory_start
slgr %r0,%r1
lg %r9,crash_size-.base_crash(%r13)
sgr %r9,%r0
/* Destination in crash memory, i.e. same as r9 but in crash memory. */
lg %r10,crash_start-.base_crash(%r13)
agr %r10,%r9
/* Buffer location (in crash memory) and size. As the purgatory is *behindthepointofnoreturnitcanreusethestackasbuffer.
*/
larl %r11,purgatory_end
larl %r12,stack
slgr %r11,%r12
/* Now the code is set up to run from its designated location. Start *swappingtherestofcrashmemorynow. * *Theregisterswillbeusedasfollow: * *%r0-%r4reservedformacrosdefinedabove *%r5-%r6tmpregisters *%r7pointertocurrentstructsharegion *%r8indextoiterateoverallsharegions *%r9pointerincrashmemory *%r10pointerinoldkernel *%r11totalsize(still)tobemoved *%r12pointertobuffer
*/
lgr %r12,%r7
lgr %r11,%r9
lghi %r10,0
lg %r9,crash_start-.base_dst(%r13)
lghi %r8,16/* KEXEC_SEGMENTS_MAX */
larl %r7,purgatory_sha_regions
j .loop_first
/* Loop over all purgatory_sha_regions. */
.loop_next:
aghi %r8,-1
cghi %r8,0
je .loop_out
aghi %r7,__KEXEC_SHA_REGION_SIZE
.loop_first:
lg %r5,__KEXEC_SHA_REGION_START(%r7)
cghi %r5,0
je .loop_next
/* Copy [end last sha region, start current sha region) */ /* Note: kexec_sha_region->start points in crash memory */
sgr %r5,%r9
MEMCPY %r9,%r10,%r5
agr %r9,%r5
agr %r10,%r5
sgr %r11,%r5
/* Swap sha region */
lg %r6,__KEXEC_SHA_REGION_LEN(%r7)
MEMSWAP %r9,%r10,%r12,%r6
sg %r11,__KEXEC_SHA_REGION_LEN(%r7)
j .loop_next
.loop_out: /* Copy rest of crash memory */
MEMCPY %r9,%r10,%r11
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.