diff options
Diffstat (limited to 'arch/s390/kernel/crash_dump.c')
-rw-r--r-- | arch/s390/kernel/crash_dump.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c index 171e09bb8ea2..df4685905015 100644 --- a/arch/s390/kernel/crash_dump.c +++ b/arch/s390/kernel/crash_dump.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #define PTR_SUB(x, y) (((char *) (x)) - ((unsigned long) (y))) | 23 | #define PTR_SUB(x, y) (((char *) (x)) - ((unsigned long) (y))) |
24 | #define PTR_DIFF(x, y) ((unsigned long)(((char *) (x)) - ((unsigned long) (y)))) | 24 | #define PTR_DIFF(x, y) ((unsigned long)(((char *) (x)) - ((unsigned long) (y)))) |
25 | 25 | ||
26 | #define LINUX_NOTE_NAME "LINUX" | ||
27 | |||
26 | static struct memblock_region oldmem_region; | 28 | static struct memblock_region oldmem_region; |
27 | 29 | ||
28 | static struct memblock_type oldmem_type = { | 30 | static struct memblock_type oldmem_type = { |
@@ -312,7 +314,7 @@ static void *nt_fpregset(void *ptr, struct save_area *sa) | |||
312 | static void *nt_s390_timer(void *ptr, struct save_area *sa) | 314 | static void *nt_s390_timer(void *ptr, struct save_area *sa) |
313 | { | 315 | { |
314 | return nt_init(ptr, NT_S390_TIMER, &sa->timer, sizeof(sa->timer), | 316 | return nt_init(ptr, NT_S390_TIMER, &sa->timer, sizeof(sa->timer), |
315 | KEXEC_CORE_NOTE_NAME); | 317 | LINUX_NOTE_NAME); |
316 | } | 318 | } |
317 | 319 | ||
318 | /* | 320 | /* |
@@ -321,7 +323,7 @@ static void *nt_s390_timer(void *ptr, struct save_area *sa) | |||
321 | static void *nt_s390_tod_cmp(void *ptr, struct save_area *sa) | 323 | static void *nt_s390_tod_cmp(void *ptr, struct save_area *sa) |
322 | { | 324 | { |
323 | return nt_init(ptr, NT_S390_TODCMP, &sa->clk_cmp, | 325 | return nt_init(ptr, NT_S390_TODCMP, &sa->clk_cmp, |
324 | sizeof(sa->clk_cmp), KEXEC_CORE_NOTE_NAME); | 326 | sizeof(sa->clk_cmp), LINUX_NOTE_NAME); |
325 | } | 327 | } |
326 | 328 | ||
327 | /* | 329 | /* |
@@ -330,7 +332,7 @@ static void *nt_s390_tod_cmp(void *ptr, struct save_area *sa) | |||
330 | static void *nt_s390_tod_preg(void *ptr, struct save_area *sa) | 332 | static void *nt_s390_tod_preg(void *ptr, struct save_area *sa) |
331 | { | 333 | { |
332 | return nt_init(ptr, NT_S390_TODPREG, &sa->tod_reg, | 334 | return nt_init(ptr, NT_S390_TODPREG, &sa->tod_reg, |
333 | sizeof(sa->tod_reg), KEXEC_CORE_NOTE_NAME); | 335 | sizeof(sa->tod_reg), LINUX_NOTE_NAME); |
334 | } | 336 | } |
335 | 337 | ||
336 | /* | 338 | /* |
@@ -339,7 +341,7 @@ static void *nt_s390_tod_preg(void *ptr, struct save_area *sa) | |||
339 | static void *nt_s390_ctrs(void *ptr, struct save_area *sa) | 341 | static void *nt_s390_ctrs(void *ptr, struct save_area *sa) |
340 | { | 342 | { |
341 | return nt_init(ptr, NT_S390_CTRS, &sa->ctrl_regs, | 343 | return nt_init(ptr, NT_S390_CTRS, &sa->ctrl_regs, |
342 | sizeof(sa->ctrl_regs), KEXEC_CORE_NOTE_NAME); | 344 | sizeof(sa->ctrl_regs), LINUX_NOTE_NAME); |
343 | } | 345 | } |
344 | 346 | ||
345 | /* | 347 | /* |
@@ -348,7 +350,7 @@ static void *nt_s390_ctrs(void *ptr, struct save_area *sa) | |||
348 | static void *nt_s390_prefix(void *ptr, struct save_area *sa) | 350 | static void *nt_s390_prefix(void *ptr, struct save_area *sa) |
349 | { | 351 | { |
350 | return nt_init(ptr, NT_S390_PREFIX, &sa->pref_reg, | 352 | return nt_init(ptr, NT_S390_PREFIX, &sa->pref_reg, |
351 | sizeof(sa->pref_reg), KEXEC_CORE_NOTE_NAME); | 353 | sizeof(sa->pref_reg), LINUX_NOTE_NAME); |
352 | } | 354 | } |
353 | 355 | ||
354 | /* | 356 | /* |
@@ -357,7 +359,7 @@ static void *nt_s390_prefix(void *ptr, struct save_area *sa) | |||
357 | static void *nt_s390_vx_high(void *ptr, __vector128 *vx_regs) | 359 | static void *nt_s390_vx_high(void *ptr, __vector128 *vx_regs) |
358 | { | 360 | { |
359 | return nt_init(ptr, NT_S390_VXRS_HIGH, &vx_regs[16], | 361 | return nt_init(ptr, NT_S390_VXRS_HIGH, &vx_regs[16], |
360 | 16 * sizeof(__vector128), KEXEC_CORE_NOTE_NAME); | 362 | 16 * sizeof(__vector128), LINUX_NOTE_NAME); |
361 | } | 363 | } |
362 | 364 | ||
363 | /* | 365 | /* |
@@ -370,12 +372,12 @@ static void *nt_s390_vx_low(void *ptr, __vector128 *vx_regs) | |||
370 | int i; | 372 | int i; |
371 | 373 | ||
372 | note = (Elf64_Nhdr *)ptr; | 374 | note = (Elf64_Nhdr *)ptr; |
373 | note->n_namesz = strlen(KEXEC_CORE_NOTE_NAME) + 1; | 375 | note->n_namesz = strlen(LINUX_NOTE_NAME) + 1; |
374 | note->n_descsz = 16 * 8; | 376 | note->n_descsz = 16 * 8; |
375 | note->n_type = NT_S390_VXRS_LOW; | 377 | note->n_type = NT_S390_VXRS_LOW; |
376 | len = sizeof(Elf64_Nhdr); | 378 | len = sizeof(Elf64_Nhdr); |
377 | 379 | ||
378 | memcpy(ptr + len, KEXEC_CORE_NOTE_NAME, note->n_namesz); | 380 | memcpy(ptr + len, LINUX_NOTE_NAME, note->n_namesz); |
379 | len = roundup(len + note->n_namesz, 4); | 381 | len = roundup(len + note->n_namesz, 4); |
380 | 382 | ||
381 | ptr += len; | 383 | ptr += len; |
@@ -462,6 +464,20 @@ static void *nt_vmcoreinfo(void *ptr) | |||
462 | } | 464 | } |
463 | 465 | ||
464 | /* | 466 | /* |
467 | * Initialize final note (needed for /proc/vmcore code) | ||
468 | */ | ||
469 | static void *nt_final(void *ptr) | ||
470 | { | ||
471 | Elf64_Nhdr *note; | ||
472 | |||
473 | note = (Elf64_Nhdr *) ptr; | ||
474 | note->n_namesz = 0; | ||
475 | note->n_descsz = 0; | ||
476 | note->n_type = 0; | ||
477 | return PTR_ADD(ptr, sizeof(Elf64_Nhdr)); | ||
478 | } | ||
479 | |||
480 | /* | ||
465 | * Initialize ELF header (new kernel) | 481 | * Initialize ELF header (new kernel) |
466 | */ | 482 | */ |
467 | static void *ehdr_init(Elf64_Ehdr *ehdr, int mem_chunk_cnt) | 483 | static void *ehdr_init(Elf64_Ehdr *ehdr, int mem_chunk_cnt) |
@@ -551,6 +567,7 @@ static void *notes_init(Elf64_Phdr *phdr, void *ptr, u64 notes_offset) | |||
551 | ptr = fill_cpu_elf_notes(ptr, &sa_ext->sa, sa_ext->vx_regs); | 567 | ptr = fill_cpu_elf_notes(ptr, &sa_ext->sa, sa_ext->vx_regs); |
552 | } | 568 | } |
553 | ptr = nt_vmcoreinfo(ptr); | 569 | ptr = nt_vmcoreinfo(ptr); |
570 | ptr = nt_final(ptr); | ||
554 | memset(phdr, 0, sizeof(*phdr)); | 571 | memset(phdr, 0, sizeof(*phdr)); |
555 | phdr->p_type = PT_NOTE; | 572 | phdr->p_type = PT_NOTE; |
556 | phdr->p_offset = notes_offset; | 573 | phdr->p_offset = notes_offset; |