Skip to content

Commit b10ac5d

Browse files
hcahcaVasily Gorbik
authored andcommitted
s390/boot: Pass pt_regs to program check handler
Setup a pt_regs structure on the stack, poplulate it in low level assembler code, and pass it to print_pgm_check_info(). This way there is no need to access then lowcore from print_pgm_check_info() anymore, and the function looks like a normal program check handler function. Acked-by: Alexander Gordeev <[email protected]> Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent a0a8f2b commit b10ac5d

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

arch/s390/boot/boot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void verify_facilities(void);
6565
void print_missing_facilities(void);
6666
void sclp_early_setup_buffer(void);
6767
void alt_debug_setup(char *str);
68-
void print_pgm_check_info(void);
68+
void print_pgm_check_info(struct pt_regs *regs);
6969
unsigned long randomize_within_range(unsigned long size, unsigned long align,
7070
unsigned long min, unsigned long max);
7171
void setup_vmem(unsigned long kernel_start, unsigned long kernel_end, unsigned long asce_limit);

arch/s390/boot/head.S

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,12 @@ SYM_CODE_START_LOCAL(startup_pgm_check_handler)
312312
oi __LC_RETURN_PSW+1,0x2 # set wait state bit
313313
larl %r9,.Lold_psw_disabled_wait
314314
stg %r9,__LC_PGM_NEW_PSW+8
315-
larl %r15,_dump_info_stack_end-STACK_FRAME_OVERHEAD
315+
larl %r15,_dump_info_stack_end-(STACK_FRAME_OVERHEAD+__PT_SIZE)
316+
la %r2,STACK_FRAME_OVERHEAD(%r15)
317+
mvc __PT_PSW(16,%r2),__LC_PSW_SAVE_AREA-4095(%r8)
318+
mvc __PT_R0(128,%r2),__LC_GPREGS_SAVE_AREA-4095(%r8)
319+
mvc __PT_LAST_BREAK(8,%r2),__LC_PGM_LAST_BREAK
320+
mvc __PT_INT_CODE(4,%r2),__LC_PGM_INT_CODE
316321
brasl %r14,print_pgm_check_info
317322
.Lold_psw_disabled_wait:
318323
la %r8,4095

arch/s390/boot/pgm_check_info.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,32 @@ void print_stacktrace(unsigned long sp)
3232
}
3333
}
3434

35-
void print_pgm_check_info(void)
35+
void print_pgm_check_info(struct pt_regs *regs)
3636
{
37-
unsigned long *gpregs = (unsigned long *)get_lowcore()->gpregs_save_area;
38-
struct psw_bits *psw = &psw_bits(get_lowcore()->psw_save_area);
37+
struct psw_bits *psw = &psw_bits(regs->psw);
38+
unsigned long *gpregs = regs->gprs;
3939

4040
if (bootdebug)
4141
boot_rb_dump();
4242
boot_emerg("Linux version %s\n", kernel_version);
4343
if (!is_prot_virt_guest() && early_command_line[0])
4444
boot_emerg("Kernel command line: %s\n", early_command_line);
4545
boot_emerg("Kernel fault: interruption code %04x ilc:%d\n",
46-
get_lowcore()->pgm_code, get_lowcore()->pgm_ilc >> 1);
46+
regs->int_code & 0xffff, regs->int_code >> 17);
4747
if (kaslr_enabled()) {
4848
boot_emerg("Kernel random base: %lx\n", __kaslr_offset);
4949
boot_emerg("Kernel random base phys: %lx\n", __kaslr_offset_phys);
5050
}
5151
boot_emerg("PSW : %016lx %016lx (%pS)\n",
52-
get_lowcore()->psw_save_area.mask,
53-
get_lowcore()->psw_save_area.addr,
54-
(void *)get_lowcore()->psw_save_area.addr);
52+
regs->psw.mask, regs->psw.addr, (void *)regs->psw.addr);
5553
boot_emerg(" R:%x T:%x IO:%x EX:%x Key:%x M:%x W:%x P:%x AS:%x CC:%x PM:%x RI:%x EA:%x\n",
5654
psw->per, psw->dat, psw->io, psw->ext, psw->key, psw->mcheck,
5755
psw->wait, psw->pstate, psw->as, psw->cc, psw->pm, psw->ri, psw->eaba);
5856
boot_emerg("GPRS: %016lx %016lx %016lx %016lx\n", gpregs[0], gpregs[1], gpregs[2], gpregs[3]);
5957
boot_emerg(" %016lx %016lx %016lx %016lx\n", gpregs[4], gpregs[5], gpregs[6], gpregs[7]);
6058
boot_emerg(" %016lx %016lx %016lx %016lx\n", gpregs[8], gpregs[9], gpregs[10], gpregs[11]);
6159
boot_emerg(" %016lx %016lx %016lx %016lx\n", gpregs[12], gpregs[13], gpregs[14], gpregs[15]);
62-
print_stacktrace(get_lowcore()->gpregs_save_area[15]);
60+
print_stacktrace(gpregs[15]);
6361
boot_emerg("Last Breaking-Event-Address:\n");
64-
boot_emerg(" [<%016lx>] %pS\n", (unsigned long)get_lowcore()->pgm_last_break,
65-
(void *)get_lowcore()->pgm_last_break);
62+
boot_emerg(" [<%016lx>] %pS\n", regs->last_break, (void *)regs->last_break);
6663
}

arch/s390/kernel/asm-offsets.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ int main(void)
4949
OFFSET(__PT_R14, pt_regs, gprs[14]);
5050
OFFSET(__PT_R15, pt_regs, gprs[15]);
5151
OFFSET(__PT_ORIG_GPR2, pt_regs, orig_gpr2);
52+
OFFSET(__PT_INT_CODE, pt_regs, int_code);
5253
OFFSET(__PT_FLAGS, pt_regs, flags);
5354
OFFSET(__PT_CR1, pt_regs, cr1);
5455
OFFSET(__PT_LAST_BREAK, pt_regs, last_break);
@@ -77,6 +78,7 @@ int main(void)
7778
OFFSET(__LC_EXT_INT_CODE, lowcore, ext_int_code);
7879
OFFSET(__LC_PGM_ILC, lowcore, pgm_ilc);
7980
OFFSET(__LC_PGM_CODE, lowcore, pgm_code);
81+
OFFSET(__LC_PGM_INT_CODE, lowcore, pgm_int_code);
8082
OFFSET(__LC_DATA_EXC_CODE, lowcore, data_exc_code);
8183
OFFSET(__LC_MON_CLASS_NR, lowcore, mon_class_num);
8284
OFFSET(__LC_PER_CODE, lowcore, per_code);

0 commit comments

Comments
 (0)