diff options
author | Roland McGrath <roland@redhat.com> | 2008-03-04 17:28:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-03-04 19:35:10 -0500 |
commit | d31472b6d4f799a68d877f69b2f843eec5875472 (patch) | |
tree | beda33325687f2bebbdde49e68cad79b5e8242d2 /fs | |
parent | 938a9204e0df070bfbaac71f6403cebed76763ad (diff) |
core dump: user_regset writeback
This makes the user_regset-based core dump code call user_regset writeback
hooks when available. This is necessary groundwork to allow IA64 to set
CORE_DUMP_USE_REGSET.
Cc: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Roland McGrath <roland@redhat.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/binfmt_elf.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 41a958a7585e..5e1a4fb5cacb 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1424,6 +1424,18 @@ struct elf_note_info { | |||
1424 | int thread_notes; | 1424 | int thread_notes; |
1425 | }; | 1425 | }; |
1426 | 1426 | ||
1427 | /* | ||
1428 | * When a regset has a writeback hook, we call it on each thread before | ||
1429 | * dumping user memory. On register window machines, this makes sure the | ||
1430 | * user memory backing the register data is up to date before we read it. | ||
1431 | */ | ||
1432 | static void do_thread_regset_writeback(struct task_struct *task, | ||
1433 | const struct user_regset *regset) | ||
1434 | { | ||
1435 | if (regset->writeback) | ||
1436 | regset->writeback(task, regset, 1); | ||
1437 | } | ||
1438 | |||
1427 | static int fill_thread_core_info(struct elf_thread_core_info *t, | 1439 | static int fill_thread_core_info(struct elf_thread_core_info *t, |
1428 | const struct user_regset_view *view, | 1440 | const struct user_regset_view *view, |
1429 | long signr, size_t *total) | 1441 | long signr, size_t *total) |
@@ -1445,6 +1457,8 @@ static int fill_thread_core_info(struct elf_thread_core_info *t, | |||
1445 | sizeof(t->prstatus), &t->prstatus); | 1457 | sizeof(t->prstatus), &t->prstatus); |
1446 | *total += notesize(&t->notes[0]); | 1458 | *total += notesize(&t->notes[0]); |
1447 | 1459 | ||
1460 | do_thread_regset_writeback(t->task, &view->regsets[0]); | ||
1461 | |||
1448 | /* | 1462 | /* |
1449 | * Each other regset might generate a note too. For each regset | 1463 | * Each other regset might generate a note too. For each regset |
1450 | * that has no core_note_type or is inactive, we leave t->notes[i] | 1464 | * that has no core_note_type or is inactive, we leave t->notes[i] |
@@ -1452,6 +1466,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t, | |||
1452 | */ | 1466 | */ |
1453 | for (i = 1; i < view->n; ++i) { | 1467 | for (i = 1; i < view->n; ++i) { |
1454 | const struct user_regset *regset = &view->regsets[i]; | 1468 | const struct user_regset *regset = &view->regsets[i]; |
1469 | do_thread_regset_writeback(t->task, regset); | ||
1455 | if (regset->core_note_type && | 1470 | if (regset->core_note_type && |
1456 | (!regset->active || regset->active(t->task, regset))) { | 1471 | (!regset->active || regset->active(t->task, regset))) { |
1457 | int ret; | 1472 | int ret; |