Dave Anderson wrote:
>
> Wouldn't it be easier to create a additional per-segment "pls->zero_fill"
> field
> that is based upon the (possibly) larger p->memsz value? Then, if the request
> does not fall into the (pls->phys_start <= startaddr < pls->phys_end) range,
> a subsequent check can be made to see if it falls within the alternative
> (pls->phys_end <= startaddr < pls->zero_fill) range? If that's true,
> then we can just return a block of zeroes.
>
>
Hi Ken'ichi,
Can you apply and verify the attached crash patch?
I've add a new pls->zero_fill field, which will be initialized to
(pls->phys_start + p->p_memsz) only if p->memsz != p->filesz;
otherwise it will be set to zero.
When walking through each segment in read_netdump(), if the
pls->zero_fill value is non-zero, the requested paddr will also be
checked whether it fits into the segment's zero-fill region, and if so,
zeroes will be returned.
If it doesn't work, please explain why! ;-)
Thanks,
Dave
--- crash/netdump.h.orig 2006-11-28 15:00:23.000000000 -0500
+++ crash/netdump.h 2006-11-28 15:00:33.000000000 -0500
@@ -40,6 +40,7 @@
off_t file_offset;
physaddr_t phys_start;
physaddr_t phys_end;
+ physaddr_t zero_fill;
};
struct vmcore_data {
--- crash/netdump.c.orig 2006-11-28 15:00:16.000000000 -0500
+++ crash/netdump.c 2006-11-28 15:00:27.000000000 -0500
@@ -326,6 +326,11 @@
pls->file_offset;
break;
}
+ if (pls->zero_fill && (paddr >= pls->phys_end) &&
+ (paddr < pls->zero_fill)) {
+ memset(bufptr, 0, cnt);
+ return cnt;
+ }
}
if (!offset)
@@ -682,6 +687,8 @@
pls->phys_start);
netdump_print(" phys_end: %llx\n",
pls->phys_end);
+ netdump_print(" zero_fill: %llx\n",
+ pls->zero_fill);
}
netdump_print(" elf_header: %lx\n", nd->elf_header);
netdump_print(" elf32: %lx\n", nd->elf32);
@@ -1135,8 +1142,11 @@
pls->phys_start = prog->p_paddr;
netdump_print(" p_filesz: %lu (%lx)\n", prog->p_filesz,
prog->p_filesz);
- if (store_pt_load_data)
+ if (store_pt_load_data) {
pls->phys_end = pls->phys_start + prog->p_filesz;
+ pls->zero_fill = (prog->p_filesz == prog->p_memsz) ?
+ 0 : pls->phys_start + prog->p_memsz;
+ }
netdump_print(" p_memsz: %lu (%lx)\n", prog->p_memsz,
prog->p_memsz);
netdump_print(" p_flags: %lx (", prog->p_flags);
@@ -1214,8 +1224,11 @@
pls->phys_start = prog->p_paddr;
netdump_print(" p_filesz: %lu (%lx)\n", prog->p_filesz,
prog->p_filesz);
- if (store_pt_load_data)
+ if (store_pt_load_data) {
pls->phys_end = pls->phys_start + prog->p_filesz;
+ pls->zero_fill = (prog->p_filesz == prog->p_memsz) ?
+ 0 : pls->phys_start + prog->p_memsz;
+ }
netdump_print(" p_memsz: %lu (%lx)\n", prog->p_memsz,
prog->p_memsz);
netdump_print(" p_flags: %lx (", prog->p_flags);
_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot