4 * Common routines for dump records
5 * Copyright IBM Corp. 2001, 2006.
6 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
8 * Uses extern functions:
9 * - _dump_mem (device dependent function to write dump)
23 #define PAGE_SIZE 0x1000 /* 4096 */
24 #define HEADER_SIZE 0x1000 /* 4096 */
25 #define END_MARKER_SIZE 0x10
26 #define DUMP_END_MARKER 0x44554d50,0x5f454e44 /* DUMP_END */
27 #define IPL_SC 0xb8 /* Address of ipl subchannel */
28 #define S390_DUMP_MAGIC 0xa8190173,0x618f23fd /* magic number */
29 #define ARCH_S390_ID 0x1 /* arch flag for s390 */
30 #define ARCH_S390X_ID 0x2 /* arch flag for s390x */
32 /* Common error codes */
34 #define OK 0x00000000 /* Dump completed successfully */
35 #define EMEM 0x00000001 /* Device too small for dump */
36 #define EDEV_INVAL 0x00000002 /* Device not supported */
37 #define EMEMCOUNT 0x00000003 /* Mem counting did not work */
38 #define EENABLE_DEV 0x00000100 /* enable device failed */
39 #define EDISABLE_DEV 0x00000101 /* disable device failed */
40 #define EDSSCH 0x00000102 /* start subchannel failed */
42 /* Error codes specific to multi-volume dump */
44 #define ENODEV 0x00000200 /* devno does not exist */
45 #define ENOSIGN 0x00000201 /* no valid dump signature on device */
46 #define ENOTIME 0x00000202 /* zipl time stamps do not match */
48 #define __LC_ARCH_MODE_ID 163 /* here is the arch flag in the lowcore */
49 #define __LC_IPIB 0xe00 /* IPL Parameter Information Block */
50 #define DIAG308_IPL 3 /* Subcode 3 - Perform Load Clear */
51 #define DIAG308_SET 5 /* Subcode 5 - Set IPL Parameters */
53 #define PARAM_START 0x3000 /* 8-byte time stamp plus 2-byte count */
54 /* plus 32 13-byte entries */
55 #define IDA_LIST_START 0x3200 /* 64 8-byte IDAW's */
56 #define CCW_CHAIN_START 0x3400 /* chained write CCW's */
57 #define ZERO_MEM_START 0x4000
58 #define ZERO_MEM_SIZE 0x3000
60 #define SCPINCR1_OFF 8
63 #define SCPINCR2_OFF 104
65 #define ZERO_PAGE_START 0x5000
66 #define TMP_PAGE_START 0x6000
68 ################################################################################
70 ################################################################################
79 .Ldh_magic_number:.long S390_DUMP_MAGIC
80 .Ldh_version: .long 0x00000004
81 .Ldh_header_size: .long HEADER_SIZE
82 .Ldh_dump_level: .long 0x00000004 # DUMP_ALL
83 .Ldh_page_size: .long PAGE_SIZE
84 .Ldh_mem_size: .long 0x00000000,0x00000000
85 .Ldh_mem_start: .long 0x00000000,0x00000000
86 .Ldh_mem_end: .long 0x00000000,0x00000000
87 .Ldh_num_pages: .long 0x00000000
88 .Ldh_pad: .long 0x00000000
89 .Ldh_time: .long 0x00000000,0x00000000
90 .Ldh_cpuid: .long 0x00000000,0x00000000
91 .Ldh_arch: .long ARCH_S390_ID
92 .Ldh_vol_nr: .long 0x00000000
93 #if defined(__s390x__)
94 .Ldh_build_arch: .long ARCH_S390X_ID
96 .Ldh_build_arch: .long ARCH_S390_ID
98 .Ldh_real_mem_size: .long 0x00000000,0x00000000
99 .Ldh_mvdump: .byte 0x00
105 .Ld_endmarker: .long DUMP_END_MARKER
106 .Ld_end_time: .long 0x00000000,0x00000000
108 .endm /* dump_header */
112 ################################################################################
113 # Translate binary hex to decimal ebcdic
115 # -r3: outbuffer (ebcdic - decimal), 8 byte
116 ################################################################################
119 stm %r6,%r15,24(%r15)
120 basr %r13,0 # base register
121 0: cvd %r2,.Ltmp_data-0b(%r13) # convert to packed decimal
122 unpk 0(8,%r3),.Ltmp_data+4-0b(4,%r13)
123 oi 7(%r3),0xf0 # remove signed flag
131 #if defined(__s390x__)
134 /******************************** 64 BIT **************************************/
136 .macro print_progress_64
139 ################################################################################
140 # Init dump progress messages to sclp console
141 # (8 messages if the memory is 4G or less, otherwise one message for each
142 # 512M chunk of dumped memory)
143 ################################################################################
144 _init_print_progress_64:
145 stmg %r6,%r15,48(%r15)
146 basr %r13,0 # base register
149 lg %r8,.Ldh_mem_size-0b(%r13)
151 la %r3,.Lmsg_mem_size-0b(%r13)
152 bras %r14,_hex_to_ebcdic
154 lgf %r3,.Lprogress_increment-0b(%r13)
158 1: st %r2,.Lprogress_increment-0b(%r13)
159 stg %r2,.Lnext_print_addr-0b(%r13)
161 lmg %r6,%r15,248(%r15)
164 ################################################################################
165 # Print dump progress to sclp console
166 # -r2: memory location in bytes
167 ################################################################################
169 stmg %r6,%r15,48(%r15)
170 basr %r13,0 # base register
173 # check, if we have to print something
175 lg %r9,.Lnext_print_addr-0b(%r13)
177 bl .Lexit_progress-0b(%r13)
179 # print MBs to console
182 la %r3,.Lmsg_progress_mb-0b(%r13)
183 bras %r14,_hex_to_ebcdic
184 la %r2,.Lmsg_progress_mb-0b(%r13)
185 bras %r14,_sclp_print
187 # update address for next print
189 agf %r9,.Lprogress_increment-0b(%r13)
190 stg %r9,.Lnext_print_addr-0b(%r13)
193 lmg %r6,%r15,248(%r15)
197 .Lprogress_increment:
198 .long 0x20000000 # issue progress message at least each 512M
202 ################################################################################
203 # MACRO: dump_io_subroutines_64
204 # - _enable_device_64
208 ################################################################################
210 .macro dump_io_subroutines_64
213 ################################################################################
214 # Enable I/O on the ipl device.
215 # -r2 : device subchannel id
216 ################################################################################
219 stmg %r6,%r15,48(%r15)
220 basr %r13,0 # base register
223 lghi %r2,EENABLE_DEV # set panik code early
224 stsch .Ltmp_data-0b(%r13)
225 oi .Ltmp_data-0b+5(%r13),0x84 # enable ssch and multipath mode
226 msch .Ltmp_data-0b(%r13)
227 bnz _panik_64-0b(%r13) # subchannel busy or in error ?
228 lctl %c6,%c6,1f-0b(%r13) # enable all interrupt classes
229 lmg %r6,%r15,248(%r15)
232 1: .long 0xff000000 # CR6 initial value
234 ################################################################################
236 # -r2: device subchannel id
237 # -r3: address of orb
238 # -r4: address of irb
240 ################################################################################
243 stmg %r6,%r15,48(%r15)
244 basr %r13,0 # base register
245 0: aghi %r15,-200 # create stack frame
246 lghi %r8,10 # set retry count for ssch
247 lgr %r12,%r2 # save subchannel id
248 lgr %r11,%r3 # save orb
249 lgr %r10,%r4 # save irb
250 lgr %r9,%r5 # save retry count
255 bct %r8,1b-0b(%r13) # do retry
256 bnz 5f-0b(%r13) # houston, we have a problem
257 2: lgr %r2,%r12 # call _wait4de with subchannel id
258 lgr %r3,%r10 # and irb address as parameters
259 bas %r14,_wait4de_64-0b(%r13) # wait until DE or error
260 tm 9(%r10),0xff # test channel status
262 tm 8(%r10),0xd2 # test device status
264 bct %r9,1b-0b(%r13) # something went wrong, retry.
265 4: lmg %r6,%r15,248(%r15)
269 bas %r4,_panik_64-0b(%r13)
271 ################################################################################
272 # Wait for interrupt subroutine
273 # -r2: device subchannel id
274 # -r3: address of irb
275 ################################################################################
278 stmg %r6,%r15,48(%r15)
279 basr %r13,0 # base register
280 0: aghi %r15,-200 # create stack frame
282 mvc 496(16),6f-0b(%r13) # set i/o new psw
284 2: stnsm .Lpsw-0b(%r13),0xfd # disable io interrupts
285 c %r1,0xb8 # compare subchannel id
286 bne 1b-0b(%r13) # unequal -> continue waiting
288 tm 9(%r3),0xff # test channel status
291 3: tm 8(%r3),0x02 # got unit check ?
294 tm 8(%r3),0x04 # got device end ?
295 bz 1b-0b(%r13) # still busy -> continue waiting
297 4: lmg %r6,%r15,248(%r15)
300 5: .long 0x02020001,0x80000000,0x00000000,0x00000000+1b
301 6: .long 0x00000001,0x80000000,0x00000000,0x00000000+2b
304 ################################################################################
305 # Panik routine. Loads a disabled wait psw or performs reipl if required.
307 ################################################################################
310 stmg %r6,%r15,48(%r15)
311 basr %r13,0 # base register
312 0: aghi %r15,-200 # create stack frame
313 stg %r2,1f-0b+8(%r13) # store code in address part of psw
314 bras %r14,_print_exit_message
316 # perform reipl: check lowcore for the address of an IPL Information
317 # Block followed by a valid checksum (as defined in lowcore.h and set
318 # by ipl.c). In case of match use diag308 to IPL.
320 lg %r2,__LC_IPIB(%r0) # IPL Information Block
321 ltr %r2,%r2 # re-ipl required?
322 bz .Lnoreipl-0b(%r13) # no, skip diag308
323 llgf %r3,0(%r2) # length of IPIB
324 sr %r1,%r1 # zero accumator
326 cksm %r1,%r2 # compute IPIB checksum
327 bnz .Lcksmloop-0b(%r13) # repeat if not complete
328 cl %r1,__LC_IPIB+8(%r0) # compare with cksm in lowcore
329 bne .Lnoreipl-0b(%r13) # no match, skip diag308
330 lg %r2,__LC_IPIB(%r0) # reload IPL Information Block
331 lghi %r4,DIAG308_SET # load subcode
332 diag %r2,%r4,0x308 # set IPL parameters
333 lghi %r4,DIAG308_IPL # load subcode
334 diag %r2,%r4,0x308 # perform load clear
338 1: .long 0x00020000,0x80000000,0x00000000,0x00000000
341 ################################################################################
342 # MACRO: dump_common_fn_64
347 ################################################################################
349 .macro dump_common_fn_64
352 ################################################################################
355 ################################################################################
359 stmg %r6,%r15,48(%r15)
361 .Lbase: aghi %r15,-200 # create stack frame
363 sckc .Lclock_comparator-.Lbase(%r13) # set clock comparator to future
364 spt .Lcpu_timer-.Lbase(%r13) # set cpu timer to future
366 lghi %r6,ZERO_MEM_START # clear memory
367 lghi %r7,ZERO_MEM_START + ZERO_MEM_SIZE
377 bras %r14,_sclp_setup
379 # print start message
381 la %r2,.Lmsg_start-.Lbase(%r13)
382 bras %r14,_sclp_print
386 la %r2,.Lmsg_64bit_os-.Lbase(%r13)
387 l %r10,.Ldh_arch-.Lbase(%r13)
388 chi %r10,ARCH_S390_ID
389 bnz .Larch64-.Lbase(%r13)
390 la %r2,.Lmsg_31bit_os-.Lbase(%r13)
392 bras %r14,_sclp_print
396 bas %r14,_count_mem_64-.Lbase(%r13)
400 llgf %r14,.Ldump_mem_64-.Lbase(%r13)
401 basr %r14,%r14 # dump memory
406 bas %r14,_panik_64-.Lbase(%r13) # everything ok: stop now
410 .quad 0xffffffffffffffff
412 .quad 0x7fffffffffffffff
414 ################################################################################
415 # Find out memory size:
416 # Use Read SCP or Read SCP forced to do this
418 ################################################################################
422 stmg %r6,%r15,48(%r15)
423 basr %r13,0 # base register
424 0: aghi %r15,-200 # create stack frame
427 bras %r14,_sclp_read_info
429 bne .Lsclp_read_info_ok-0b(%r13)
436 icm %r1,3,SCPINCR1_OFF(%r12) # use this one if != 0
438 lg %r1,SCPINCR2_OFF(%r12) # otherwise use this one
440 xgr %r3,%r3 # same logic
441 ic %r3,SCPA1_OFF(%r12)
444 l %r3,SCPA2_OFF(%r12)
446 mlgr %r2,%r1 # mem in MB on 128-bit
447 l %r1,.Lonemb-0b(%r13)
448 mlgr %r2,%r1 # mem size in bytes in %r3
450 stg %r3,.Ldh_real_mem_size-0b(%r13)
451 lg %r6,.Lmem_upper_limit-0b(%r13) # check if we have an upper limit
453 bl .Lsavemem-0b(%r13)
454 lgr %r3,%r6 # upper mem limit set -> use it!
456 stg %r3,.Ldh_mem_size-0b(%r13) # store memory size
457 stg %r3,.Ldh_mem_end-0b(%r13) # store memory end
458 srlg %r12,%r3,12 # calculate page count (/ 4096)
459 st %r12,.Ldh_num_pages-0b(%r13) # store page count
461 lmg %r6,%r15,248(%r15)
467 ################################################################################
468 # store status of all cpus in their lowcores
470 ################################################################################
473 stmg %r6,%r15,48(%r15)
474 basr %r13,0 # base register
476 lghi %r7,0x0 # base register for 0 page
478 ######## move lowcore info (assume user has made store ########
479 ######## status) to prefix-page ########
481 bas %r14,_copy_lowcore_64-0b(%r13)
483 ######## stop all cpus and store status in prefix pages ########
485 lghi %r8,0 # first cpu
486 stap .Lcurrent_cpu_64+2-0b(%r13) # store current cpu address
489 cl %r8,.Lcurrent_cpu_64-0b(%r13) # is ipl cpu ?
490 be 4f-0b(%r13) # if yes get next cpu
493 sigp %r9,%r8,0x9 # store status of cpu
494 bc 8,3f-0b(%r13) # accepted
495 bc 4,4f-0b(%r13) # status stored: next cpu
496 bc 2,2b-0b(%r13) # busy: try again
497 bc 1,4f-0b(%r13) # not op: next cpu
499 bas %r14,_copy_lowcore_64-0b(%r13)
501 aghi %r8,1 # next cpu (r8 +=1)
502 cl %r8,.Llast_cpu_64-0b(%r13) # is last possible cpu ?
503 bl 1b-0b(%r13) # jump if not last cpu
505 lmg %r6,%r15,248(%r15)
506 br %r14 # return to caller
512 ################################################################################
515 ################################################################################
518 stmg %r6,%r15,48(%r15)
519 basr %r13,0 # base register
522 lghi %r2,0x1000 # offset for first page
523 llgf %r3,792(%r2) # get prefix page of current cpu
525 ###### check if lowcore address looks valid ######
527 cl %r3,.Llinux_start_64-0b(%r13) # looks valid ?
528 bl .Lcpy_locore_exit_64-0b(%r13) # if < linux-start addr
529 llgf %r6,.Lpage_align_64-0b(%r13) # check page alignment
531 cl %r3,792(%r2) # 4888
532 bnz .Lcpy_locore_exit_64-0b(%r13) # if not page aligned
534 ###### copy lowcore ######
536 llgf %r3,792(%r2) # get prefix page of current cpu
537 lghi %r5,0x1000 # first page
538 agr %r3,%r5 # get base register for second
539 # page of prefix pages
541 # |-----------------------------------------------------------|
542 # | Decimal | Length | Data |
543 # | Address | in Bytes | |
544 # |_________|___________|_____________________________________|
545 # | 163 | 1 | Architectural Mode ID |
546 # | 4608 | 128 | Fl-pt registers 0-15 |
547 # | 4736 | 128 | General registers 0-15 |
548 # | 4864 | 16 | Current PSW |
549 # | 4888 | 4 | Prefix register |
550 # | 4892 | 4 | Fl-pt control register |
551 # | 4900 | 4 | TOD programmable register |
552 # | 4904 | 8 | CPU timer |
553 # | 4912 | 1 | Zeros |
554 # | 4913 | 7 | Bits 0-55 of clock comparator |
555 # | 4928 | 64 | Access registers 0-15 |
556 # | 4992 | 128 | Control registers 0-15 |
557 # |_________|___________|_____________________________________|
559 mvc 512(256,%r3),512(%r2) # 4608
560 mvc 768(16,%r3),768(%r2)
561 mvc 792(8,%r3),792(%r2) # 4888
562 mvc 804(20,%r3),804(%r2) # 4900
563 mvc 832(192,%r3),832(%r2) # 4928
565 .Lcpy_locore_exit_64:
566 lmg %r6,%r15,248(%r15)
567 br %r14 # return to caller
574 .Ldump_mem_64: .long _dump_mem_64 # address of function
576 .endm /* dump_common_fn_64 */
579 ################################################################################
580 # MACRO: dump_idal_64
581 # - _create_ida_list_64
582 ################################################################################
587 ################################################################################
588 # This function creates a indirect data addressing list
592 # -r4: address of ida list
593 ################################################################################
595 stmg %r6,%r15,48(%r15)
596 basr %r13,0 # base register
597 0: aghi %r15,-200 # create stack frame
599 # setup new pgc psw for finding invalid pages
601 mvc .Ltmp_data-0b(16,%r13),464(%r0) # save old psw
602 mvc 464(16,%r0),.Lpage_invalid_psw-0b(%r13) # setup pgm check new
604 lgr %r14,%r4 # copy address of ida list
605 lgr %r11,%r2 # copy start address
606 lgr %r9,%r3 # copy length
607 agr %r9,%r11 # compute end address
609 l %r7,0(%r11) # test page
613 lghi %r7,ZERO_PAGE_START
615 stg %r7,0(%r14) # store address
616 aghi %r14,8 # update ida pointer
617 aghi %r11,4096 # update data address
618 clgr %r11,%r9 # enough ?
619 bl 1b-0b(%r13) # branch if r11 < r9
621 mvc 464(16,%r0),.Ltmp_data-0b(%r13) # restore pgm check new
622 lmg %r6,%r15,248(%r15)
623 br %r14 # return to caller
625 .long 0x00000001,0x80000000,0x00000000,0x00000000 + .Lpage_invalid
627 .endm /* dump_idal_64 */
630 #else /* __s390x__ */
634 /******************************** 32 BIT **************************************/
636 .macro print_progress_32
639 ################################################################################
640 # Init dump progress messages to sclp console (8 messages for all the memory)
642 ################################################################################
643 _init_print_progress_32:
644 stm %r6,%r15,24(%r15)
645 basr %r13,0 # base register
648 l %r2,.Ldh_mem_size+4-0b(%r13)
650 la %r3,.Lmsg_mem_size-0b(%r13)
651 bras %r14,_hex_to_ebcdic
652 l %r8,.Ldh_mem_size+4-0b(%r13)
654 st %r8,.Lnext_print_addr-0b(%r13)
656 lm %r6,%r15,120(%r15)
659 ################################################################################
660 # Print dump progress to sclp console (8 messages for all the memory)
661 # -r2: memory location in bytes
662 ################################################################################
664 stm %r6,%r15,24(%r15)
665 basr %r13,0 # base register
668 # check, if we have to print something
670 l %r9,.Lnext_print_addr-0b(%r13)
672 bl .Lexit_progress-0b(%r13)
674 # print MBs to console
677 la %r3,.Lmsg_progress_mb-0b(%r13)
678 bras %r14,_hex_to_ebcdic
679 la %r2,.Lmsg_progress_mb-0b(%r13)
680 bras %r14,_sclp_print
682 # update address for next print
684 l %r8,.Ldh_mem_size+4-0b(%r13)
687 st %r9,.Lnext_print_addr-0b(%r13)
690 lm %r6,%r15,120(%r15)
698 ################################################################################
699 # MACRO: dump_io_subroutines_32
700 # - _enable_device_32
703 ################################################################################
705 .macro dump_io_subroutines_32
708 ################################################################################
709 # Enable I/O on the ipl device.
710 # -r2 : device subchannel id
711 ################################################################################
714 stm %r6,%r15,24(%r15)
715 basr %r13,0 # base register
718 lhi %r2,EENABLE_DEV # set panik code early
719 stsch .Ltmp_data-0b(%r13)
720 oi .Ltmp_data-0b+5(%r13),0x84 # enable ssch and multipath mode
721 msch .Ltmp_data-0b(%r13)
722 bnz _panik_32-0b(%r13) # subchannel busy or in error ?
723 lctl %c6,%c6,1f-0b(%r13) # enable all interrupt classes
724 lm %r6,%r15,120(%r15)
727 1: .long 0xff000000 # CR6 initial value
729 ################################################################################
731 # -r2: device subchannel id
732 # -r3: address of orb
733 # -r4: address of irb
735 ################################################################################
738 stm %r6,%r15,24(%r15)
739 basr %r13,0 # base register
740 0: ahi %r15,-96 # create stack frame
741 lhi %r8,10 # set retry count for ssch
742 lr %r12,%r2 # save subchannel id
743 lr %r11,%r3 # save orb
744 lr %r10,%r4 # save irb
745 lr %r9,%r5 # save retry count
747 stnsm .Lpsw-0b(%r13),0xfd # disable io interrupts
751 bct %r8,1b-0b(%r13) # do retry
752 bnz 5f-0b(%r13) # houston, we have a problem
754 2: lr %r2,%r12 # call _wait4de with subchannel id
755 lr %r3,%r10 # and irb address as parameters
756 bas %r14,_wait4de_32-0b(%r13) # wait until DE or error
757 tm 9(%r10),0xff # test channel status
759 tm 8(%r10),0xd2 # f3 test device status
761 bct %r9,1b-0b(%r13) # something went wrong, retry.
763 4: lm %r6,%r15,120(%r15)
767 bas %r4,_panik_32-0b(%r13)
769 ################################################################################
770 # Wait for interrupt subroutine
771 # -r2: device subchannel id
772 # -r3: address of irb
773 ################################################################################
776 stm %r6,%r15,24(%r15)
777 basr %r13,0 # base register
778 0: ahi %r15,-96 # create stack frame
780 mvc 0x78(8),6f-0b(%r13) # set i/o new psw
782 2: stnsm .Lpsw-0b(%r13),0xfd # disable io interrupts
783 c %r1,0xb8 # compare subchannel id
784 bne 1b-0b(%r13) # unequal -> continue waiting
786 tm 9(%r3),0xff # test channel status
789 3: tm 8(%r3),0x02 # got unit check ?
792 tm 8(%r3),0x04 # got device end ?
793 bz 1b-0b(%r13) # still busy -> continue waiting
795 4: lm %r6,%r15,120(%r15)
798 5: .long 0x020a0000,0x80000000+1b
799 6: .long 0x00080000,0x80000000+2b # io new psw
802 ################################################################################
803 # Panik routine. Loads a disabled wait psw or performs reipl if required.
805 ################################################################################
808 stm %r6,%r15,24(%r15)
809 basr %r13,0 # base register
811 st %r2,1f-0b+4(%r13) # store code in address part of psw
812 bras %r14,_print_exit_message
814 # perform reipl: check lowcore for the address of an IPL Information
815 # Block followed by a valid checksum (as defined in lowcore.h and set
816 # by ipl.c). In case of match use diag308 to IPL.
818 l %r2,__LC_IPIB(%r0) # IPL Information Block
819 ltr %r2,%r2 # re-ipl required?
820 bz .Lnoreipl-0b(%r13) # no, skip diag308
821 l %r3,0(%r2) # length of IPIB
822 sr %r1,%r1 # zero accumator
824 cksm %r1,%r2 # compute IPIB checksum
825 bnz .Lcksmloop-0b(%r13) # repeat if not complete
826 cl %r1,__LC_IPIB+4(%r0) # compare with cksm in lowcore
827 bne .Lnoreipl-0b(%r13) # no match, skip diag308
828 l %r2,__LC_IPIB(%r0) # reload IPL Information Block
829 lhi %r4,DIAG308_SET # load subcode
830 diag %r2,%r4,0x308 # set IPL parameters
831 lhi %r4,DIAG308_IPL # load subcode
832 diag %r2,%r4,0x308 # perform load clear
836 1: .long 0x000a0000,0x00000000
838 .endm /* dump_io_subroutines_32 */
841 ################################################################################
842 # MACRO: dump_common_fn_32
848 ################################################################################
850 .macro dump_common_fn_32
853 ################################################################################
856 ################################################################################
859 stm %r6,%r15,24(%r15)
861 .Lbase: ahi %r15,-96 # create stack frame
863 sckc .Lclock_comparator-.Lbase(%r13) # set clock comparator to future
864 spt .Lcpu_timer-.Lbase(%r13) # set cpu timer to future
866 lhi %r6,ZERO_MEM_START # clear memory
867 lhi %r7,ZERO_MEM_START + ZERO_MEM_SIZE
874 bas %r14,_store_status_32-.Lbase(%r13) # store status
879 bras %r14,_sclp_setup
881 # print start message
883 la %r2,.Lmsg_start-.Lbase(%r13)
884 bras %r14,_sclp_print
888 la %r2,.Lmsg_waring_os-.Lbase(%r13)
889 l %r10,.Ldh_arch-.Lbase(%r13)
890 chi %r10,ARCH_S390X_ID
891 bz .Larch64-.Lbase(%r13)
892 la %r2,.Lmsg_31bit_os-.Lbase(%r13)
894 bras %r14,_sclp_print
898 bas %r14,_count_mem_32-.Lbase(%r13)
902 l %r14,.Ldump_mem_32-.Lbase(%r13)
908 bas %r14,_panik_32-.Lbase(%r13) # everything ok: stop now
911 .quad 0xffffffffffffffff
913 .quad 0x7fffffffffffffff
915 ################################################################################
916 # Find out memory size:
917 # Use Read SCP or Read SCP forced to do this
919 ################################################################################
922 stm %r6,%r15,24(%r15)
923 basr %r13,0 # base register
924 0: ahi %r15,-96 # create stack frame
926 bras %r14,_sclp_read_info
928 bne .Lsclp_read_info_ok-0b(%r13)
935 icm %r1,3,SCPINCR1_OFF(%r12) # use this one if != 0
937 lhi %r1,0x800 # otherwise report 2GB
939 lhi %r3,0x800 # limit reported memory to 2GB
944 xr %r3,%r3 # same logic
945 ic %r3,SCPA1_OFF(%r12)
948 l %r3,SCPA2_OFF(%r12)
950 mr %r2,%r1 # mem in MB on 128-bit
951 l %r1,.Lonemb-0b(%r13)
952 mr %r2,%r1 # mem size in bytes in %r3
954 st %r3,.Ldh_real_mem_size+4-0b(%r13)
955 cl %r6,.Lmem_upper_limit+4-0b(%r13) # check if we have an upper limit
956 bl .Lsavemem-0b(%r13)
957 l %r3,.Lmem_upper_limit+4-0b(%r13) # upper mem limit set -> use it!
959 st %r3,.Ldh_mem_size+4-0b(%r13) # store memory size
960 st %r3,.Ldh_mem_end+4-0b(%r13) # store memory end
961 srl %r3,12 # calculate page count (/ 4096)
962 st %r3,.Ldh_num_pages-0b(%r13) # store page count
964 lm %r6,%r15,120(%r15)
972 dump_common_store_status_32
977 .Ldump_mem_32: .long _dump_mem_32 # address of function
979 .endm /* dump_common_fn_32 */
982 ################################################################################
983 # MACRO: dump_idal_32
984 # - _create_ida_list_32
985 ################################################################################
989 ################################################################################
990 # This function creates a indirect data addressing list
994 # -r4: address of ida list
995 ################################################################################
997 stm %r6,%r15,24(%r15)
998 basr %r13,0 # base register
999 0: ahi %r15,-96 # create stack frame
1001 # setup new pgc psw for finding invalid pages
1003 mvc .Ltmp_data-0b(8,%r13),104(%r0) # save old psw
1004 mvc 104(8,%r0),.Lpage_invalid_psw-0b(%r13) # setup pgm check new
1006 lr %r14,%r4 # copy address of ida list
1007 lr %r11,%r2 # copy start address
1008 lr %r9,%r3 # copy length
1009 ar %r9,%r11 # compute end address
1011 l %r7,0(%r11) # test page
1013 b .Lpage_ok-0b(%r13)
1015 lhi %r7,ZERO_PAGE_START
1017 st %r7,0(%r14) # store address
1018 ahi %r14,4 # update ida pointer
1019 ahi %r11,2048 # update data address
1020 clr %r11,%r9 # enough ?
1021 bl 1b-0b(%r13) # branch if r11 < r9
1023 mvc 104(8,%r0),.Ltmp_data-0b(%r13) # restore pgm check new
1024 lm %r6,%r15,120(%r15)
1025 br %r14 # return to caller
1028 .long 0x00080000,0x80000000 + .Lpage_invalid
1030 .endm /* dump_idal_32 */
1032 #endif /* __s390x__ */
1037 ################################################################################
1038 # MACRO: dump_common_store_status_32
1039 # - _store_status_32
1040 # - _copy_lowcore_32
1041 ################################################################################
1044 .macro dump_common_store_status_32
1047 ################################################################################
1048 # store status of all cpus in their lowcores
1050 ################################################################################
1053 stm %r6,%r15,24(%r15)
1054 basr %r13,0 # base register
1056 la %r7,0x0 # base register for 0 page
1058 ######## move lowcore info (assume user has made store ########
1059 ######## status) to prefix-page ########
1061 bas %r14,_copy_lowcore_32-0b(%r13)
1063 ######## stop all cpus and store status in prefix pages ########
1065 la %r8,0 # first cpu
1066 stap .Lcurrent_cpu+2-0b(%r13) # store current cpu address
1069 cl %r8,.Lcurrent_cpu-0b(%r13) # is ipl cpu ?
1070 be 4f-0b(%r13) # if yes get next cpu
1073 sigp %r9,%r8,0x9 # stop & store status of cpu
1074 bc 8,3f-0b(%r13) # accepted
1075 bc 4,4f-0b(%r13) # status stored: next cpu
1076 bc 2,2b-0b(%r13) # busy: try again
1077 bc 1,4f-0b(%r13) # not op: next cpu
1079 bas %r14,_copy_lowcore_32-0b(%r13)
1081 la %r8,1(%r8) # next cpu (r8 +=1)
1082 cl %r8,.Llast_cpu-0b(%r13) # is last possible cpu ?
1083 bl 1b-0b(%r13) # jump if not last cpu
1084 .Lstore_status_exit:
1085 lm %r6,%r15,120(%r15)
1086 br %r14 # return to caller
1092 ################################################################################
1093 # copy lowcore to prefix page
1095 ################################################################################
1098 stm %r6,%r15,24(%r15)
1099 basr %r13,0 # base register
1102 l %r3,0x108(%r0) # get prefix page from lowcore
1104 ###### check if lowcore address looks valid ######
1106 cl %r3,.Llinux_start-0b(%r13) # looks valid ?
1107 bl .Lcpy_locore_exit-0b(%r13) # if < linux-start addr
1108 l %r6,.Lpage_align-0b(%r13) # check page alignment
1111 bnz .Lcpy_locore_exit-0b(%r13) # if not page aligned
1113 ###### copy lowcore ######
1115 # |-----------------------------------------------------------|
1116 # | Decimal | Length | Data |
1117 # | Address | in Bytes | |
1118 # |_________|___________|_____________________________________|
1119 # | 212 | 4 | Extended save area address |
1120 # | 216 | 8 | CPU timer |
1121 # | 224 | 8 | Clock comparator |
1122 # | 256 | 8 | Current PSW |
1123 # | 264 | 4 | Prefix register |
1124 # | 288 | 64 | Access registers 0 through 15 |
1125 # | 352 | 32 | Floating-point registers 0 through 6|
1126 # | 384 | 64 | General registers 0 through 15 |
1127 # | 448 | 64 | Control registers 0 through 15 |
1128 # |_________|___________|_____________________________________|
1130 mvc 212(20,%r3),212(%r0)
1131 mvc 256(12,%r3),256(%r0)
1132 mvc 288(224,%r3),288(%r0)
1135 lm %r6,%r15,120(%r15)
1136 br %r14 # return to caller
1142 .endm /* dump_common_store_status_32 */
1150 .macro dump_messages
1153 ################################################################################
1154 # Print out an exit message to the screen depending on the value of register 2
1157 ################################################################################
1159 _print_exit_message:
1160 stm %r6,%r15,24(%r15)
1161 basr %r13,0 # base register
1168 la %r2,.Lmsg_ok-0b(%r13)
1170 be .Lreturn_with_msg-0b(%r13)
1174 la %r2,.Lmsg_err-0b(%r13)
1175 bras %r14,_sclp_print
1179 la %r2,.Lmsg_err_mem-0b(%r13)
1181 be .Lreturn_with_msg-0b(%r13)
1183 # device not supported
1185 la %r2,.Lmsg_err_dev_inval-0b(%r13)
1186 chi %r10, EDEV_INVAL
1187 be .Lreturn_with_msg-0b(%r13)
1189 # multi-volume dumper already printed message
1192 bnl .Lreturn-0b(%r13)
1197 la %r3,.Lmsg_err_code-0b(%r13)
1198 bras %r14,_hex_to_ebcdic
1199 la %r2,.Lmsg_err_int-0b(%r13)
1202 bras %r14,_sclp_print
1204 #if !defined(__s390x__)
1206 # check for arch warning (31 bit dumper, but 64 bit OS)
1208 l %r10,.Ldh_arch-0b(%r13)
1209 chi %r10,ARCH_S390X_ID
1210 bnz .Larch_check_ok-0b(%r13)
1211 la %r2,.Lmsg_warning_reg_set-0b(%r13)
1212 bras %r14,_sclp_print
1216 lm %r6,%r15,120(%r15)
1217 br %r14 # return to caller
1222 .byte 0xc4, 0xa4, 0x94, 0x97, 0x40, 0xa2, 0xa4, 0x83
1223 .byte 0x83, 0x85, 0xa2, 0xa2, 0x86, 0xa4, 0x93, 0x00
1225 # "Warning: truncated register set (use 64 bit dump tool)"
1227 .Lmsg_warning_reg_set:
1228 .byte 0xe6, 0x81, 0x99, 0x95, 0x89, 0x95, 0x87, 0x7a
1229 .byte 0x40, 0xa3, 0x99, 0xa4, 0x95, 0x83, 0x81, 0xa3
1230 .byte 0x85, 0x84, 0x40, 0x99, 0x85, 0x87, 0x89, 0xa2
1231 .byte 0xa3, 0x85, 0x99, 0x40, 0xa2, 0x85, 0xa3, 0x40
1232 .byte 0x4d, 0xa4, 0xa2, 0x85, 0x40, 0xf6, 0xf4, 0x40
1233 .byte 0x82, 0x89, 0xa3, 0x40, 0x84, 0xa4, 0x94, 0x97
1234 .byte 0x40, 0xa3, 0x96, 0x96, 0x93, 0x5d, 0x00
1239 .byte 0xc4, 0xa4, 0x94, 0x97, 0x40, 0x86, 0x81, 0x89
1240 .byte 0x93, 0x85, 0x84, 0x00
1242 # "Device too small"
1245 .byte 0xc4, 0x85, 0xa5, 0x89, 0x83, 0x85, 0x40, 0xa3
1246 .byte 0x96, 0x96, 0x40, 0xa2, 0x94, 0x81, 0x93, 0x93
1249 # "Device not supported"
1251 .Lmsg_err_dev_inval:
1252 .byte 0xc4, 0x85, 0xa5, 0x89, 0x83, 0x85, 0x40, 0x95
1253 .byte 0x96, 0xa3, 0x40, 0xa2, 0xa4, 0x97, 0x97, 0x96
1254 .byte 0x99, 0xa3, 0x85, 0x84, 0x00
1256 # "Internal Error: RC=00000000"
1259 .byte 0xc9, 0x95, 0xa3, 0x85, 0x99, 0x95, 0x81, 0x93
1260 .byte 0x40, 0xc5, 0x99, 0x99, 0x96, 0x99, 0x7a, 0x40
1261 .byte 0xd9, 0xc3, 0x7e
1263 .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1266 # "zIPL v0.0.0 dump tool (64 bit)"
1269 .byte 0xa9, 0xc9, 0xd7, 0xd3, 0x40, 0xa5
1270 .byte S390_TOOLS_VERSION_EBCDIC
1272 .byte 0x84, 0xa4, 0x94, 0x97, 0x40, 0xa3, 0x96, 0x96
1273 .byte 0x93, 0x40, 0x4d
1274 #if defined(__s390x__)
1279 .byte 0x40, 0x82, 0x89
1280 .byte 0xa3, 0x5d, 0x00
1282 # "Dumping 64 bit OS"
1285 .byte 0xc4, 0xa4, 0x94, 0x97, 0x89, 0x95, 0x87, 0x40
1286 .byte 0xf6, 0xf4, 0x40, 0x82, 0x89, 0xa3, 0x40, 0xd6
1289 # "Dumping 31 bit OS"
1292 .byte 0xc4, 0xa4, 0x94, 0x97, 0x89, 0x95, 0x87, 0x40
1293 .byte 0xf3, 0xf1, 0x40, 0x82, 0x89, 0xa3, 0x40, 0xd6
1296 # "Warning: 31 bit dump tool, but 64 bit OS"
1299 .byte 0xe6, 0x81, 0x99, 0x95, 0x89, 0x95, 0x87, 0x7a
1300 .byte 0x40, 0xf3, 0xf1, 0x40, 0x82, 0x89, 0xa3, 0x40
1301 .byte 0x84, 0xa4, 0x94, 0x97, 0x40, 0xa3, 0x96, 0x96
1302 .byte 0x93, 0x6b, 0x40, 0x82, 0xa4, 0xa3, 0x40, 0xf6
1303 .byte 0xf4, 0x40, 0x82, 0x89, 0xa3, 0x40, 0xd6, 0xe2
1306 # "00000000 / 00000000 MB"
1309 .byte 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0
1310 .byte 0x40, 0x61, 0x40
1312 .byte 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0
1313 .byte 0x40, 0xd4, 0xc2, 0x00