1 /* SPDX-License-Identifier: GPL-2.0 */
3 * S390 kdump lowlevel functions (new kernel)
5 * Copyright IBM Corp. 2011
6 * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
11 #define DATAMOVER_ADDR 0x4000
12 #define COPY_PAGE_ADDR 0x6000
14 #ifdef CONFIG_CRASH_DUMP
17 # kdump entry (new kernel - not yet relocated)
19 # Note: This code has to be position independent
24 lhi %r1,2 # mode 2 = esame (dump)
25 sigp %r1,%r0,SIGP_SET_ARCHITECTURE # Switch to esame mode
26 sam64 # Switch to 64 bit addressing
29 larl %r2,.Lbase_addr # Check, if we have been
30 lg %r2,0(%r2) # already relocated:
32 jne .Lrelocate # No : Start data mover
33 lghi %r2,0 # Yes: Start kdump kernel
34 brasl %r14,startup_kdump_relocated
38 lg %r2,0x418(%r4) # Get kdump base
39 lg %r3,0x420(%r4) # Get kdump size
41 larl %r10,.Lcopy_start # Source of data mover
42 lghi %r8,DATAMOVER_ADDR # Target of data mover
43 mvc 0(256,%r8),0(%r10) # Copy data mover code
45 agr %r8,%r2 # Copy data mover to
46 mvc 0(256,%r8),0(%r10) # reserved mem
48 lghi %r14,DATAMOVER_ADDR # Jump to copied data mover
54 # kdump data mover code (runs at address DATAMOVER_ADDR)
56 # r2: kdump base address
62 lgr %r11,%r2 # Save kdump base address
64 agr %r12,%r3 # Compute kdump end address
67 lghi %r10,COPY_PAGE_ADDR # Load copy page address
69 mvc 0(256,%r10),0(%r5) # Copy old kernel to tmp
70 mvc 0(256,%r5),0(%r11) # Copy new kernel to old
71 mvc 0(256,%r11),0(%r10) # Copy tmp to new
77 lg %r14,.Lstartup_kdump-0b(%r13)
78 basr %r14,%r14 # Start relocated kernel
80 .long 0x00000000,0x00000000 + startup_kdump_relocated
84 # Startup of kdump (relocated new kernel)
87 startup_kdump_relocated:
89 0: lpswe .Lrestart_psw-0b(%r13) # Start new kernel...
92 .quad 0x0000000080000000,0x0000000000000000 + startup
96 larl %r13,startup_kdump_crash
100 .quad 0x0002000080000000,0x0000000000000000 + startup_kdump_crash
101 #endif /* CONFIG_CRASH_DUMP */