[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 08/17] dump: Split write of section headers and data and a
From: |
Janis Schoetterl-Glausch |
Subject: |
Re: [PATCH v4 08/17] dump: Split write of section headers and data and add a prepare step |
Date: |
Fri, 29 Jul 2022 19:16:15 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 |
On 7/26/22 11:22, Janosch Frank wrote:
> By splitting the writing of the section headers and (future) section
> data we prepare for the addition of a string table section and
> architecture sections.
>
> At the same time we move the writing of the section to the end of the
> dump process. This allows the upcoming architecture section code to
> add data after all of the common dump data has been written.
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
> dump/dump.c | 112 ++++++++++++++++++++++++++++++++----------
> include/sysemu/dump.h | 4 ++
> 2 files changed, 90 insertions(+), 26 deletions(-)
>
> diff --git a/dump/dump.c b/dump/dump.c
> index 8a7ce95610..a6bb7bfa21 100644
> --- a/dump/dump.c
> +++ b/dump/dump.c
> @@ -342,30 +342,69 @@ static void write_elf_phdr_note(DumpState *s, Error
> **errp)
> }
> }
>
[...]
> +
> +static void prepare_elf_section_hdrs(DumpState *s)
> +{
> + size_t len, sizeof_shdr;
> +
> + /*
> + * Section ordering:
> + * - HDR zero (if needed)
> + */
> + sizeof_shdr = dump_is_64bit(s) ? sizeof(Elf64_Shdr) : sizeof(Elf32_Shdr);
> + len = sizeof_shdr * s->shdr_num;
> + s->elf_section_hdrs = g_malloc0(len);
> +
> + /* Write special section first */
> + if (s->phdr_num == PN_XNUM) {
Should be >= right?
> + prepare_elf_section_hdr_zero(s);
> + }
> +}
> +
[...]
- Re: [PATCH v4 05/17] dump: Cleanup and annotate guest memory related DumpState struct members, (continued)
- [PATCH v4 07/17] dump: Allocate header, Janosch Frank, 2022/07/26
- [PATCH v4 04/17] dump: Rework get_start_block, Janosch Frank, 2022/07/26
- [PATCH v4 08/17] dump: Split write of section headers and data and add a prepare step, Janosch Frank, 2022/07/26
- [PATCH v4 09/17] dump: Reorder struct DumpState, Janosch Frank, 2022/07/26
- [PATCH v4 10/17] dump: Swap segment and section header locations, Janosch Frank, 2022/07/26
- [PATCH v4 11/17] dump/dump: Add section string table support, Janosch Frank, 2022/07/26