[Linux-ia64] RE: [PATCH] head.S fix for unusual load addrs

Luck, Tony
2003-05-16T22:54:27Z

[-- Attachment #1: Type: text/plain, Size: 509 bytes --]

> Well, the patch looks fine to me, so I'm probably the wrong person to
> ask. Might be good to bring this up on linux-kernel.
>
> Was there a particular reason to send the full file instead of just a
> diff? Also, your file seems to revert the ANSI 99 initializer changes
> for no good reason.

It's the wrong file ... that's from last November ... it just happened
to be in the folder on my PC where I dump things to attach to e-mail. I
meant to pick up the kcore.diff (now attached).

-Tony

[-- Attachment #2: kcore.diff --]
[-- Type: application/octet-stream, Size: 2375 bytes --]

diff -ru l2569-mosberger/fs/proc/kcore.c l2569-aegl/fs/proc/kcore.c
--- l2569-mosberger/fs/proc/kcore.c Thu May 15 10:12:56 2003
+++ l2569-aegl/fs/proc/kcore.c Fri May 16 15:00:17 2003
@@ -99,7 +99,13 @@
}
#else /* CONFIG_KCORE_AOUT */

+#ifdef CONFIG_IA64
+#define KCORE_BASE 0xA000000000000000UL
+#else
#define KCORE_BASE PAGE_OFFSET
+#endif
+
+extern char _stext[], _end[];

#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))

@@ -133,7 +139,7 @@
*num_vma = *num_vma + 1;
}
*elf_buflen = sizeof(struct elfhdr) +
- (*num_vma + 2)*sizeof(struct elf_phdr) +
+ (*num_vma + 3)*sizeof(struct elf_phdr) +
3 * sizeof(struct memelfnote);
*elf_buflen = PAGE_ALIGN(*elf_buflen);
return size + *elf_buflen;
@@ -214,7 +220,7 @@
elf->e_flags = 0;
elf->e_ehsize = sizeof(struct elfhdr);
elf->e_phentsize= sizeof(struct elf_phdr);
- elf->e_phnum = 2 + num_vma;
+ elf->e_phnum = 3 + num_vma;
elf->e_shentsize= 0;
elf->e_shnum = 0;
elf->e_shstrndx = 0;
@@ -245,6 +251,27 @@
phdr->p_filesz = phdr->p_memsz = ((unsigned long)high_memory - PAGE_OFFSET);
phdr->p_align = PAGE_SIZE;

+ phdr = (struct elf_phdr *) bufp;
+ bufp += sizeof(struct elf_phdr);
+ offset += sizeof(struct elf_phdr);
+ if ((unsigned long)_end < PAGE_OFFSET) {
+ phdr->p_type = PT_LOAD;
+ phdr->p_flags = PF_R|PF_W|PF_X;
+ phdr->p_offset = (unsigned long)_stext - KCORE_BASE + dataoff;
+ phdr->p_vaddr = (unsigned long)_stext;
+ phdr->p_paddr = ia64_tpa((unsigned long)_stext);
+ phdr->p_filesz = phdr->p_memsz = _end - _stext;
+ phdr->p_align = PAGE_SIZE;
+ } else {
+ phdr->p_type = PT_NULL;
+ phdr->p_flags = 0;
+ phdr->p_offset = 0;
+ phdr->p_vaddr = 0;
+ phdr->p_paddr = 0;
+ phdr->p_filesz = 0;
+ phdr->p_align = 0;
+ }
+
/* setup ELF PT_LOAD program header for every vmalloc'd area */
for (m=vmlist; m; m=m->next) {
if (m->flags & VM_IOREMAP) /* don't dump ioremap'd stuff! (TA) */
@@ -444,6 +471,15 @@
if (kern_addr_valid(start)) {
if (copy_to_user(buffer, (char *)start, tsz))
return -EFAULT;
+ } else {
+ if (clear_user(buffer, tsz))
+ return -EFAULT;
+ }
+ } else if ((start > (unsigned long)_stext) && (start <
+ (unsigned long)_end)) {
+ if (kern_addr_valid(start)) {
+ if (copy_to_user(buffer, (char *)start, tsz))
+ return -EFAULT;
} else {
if (clear_user(buffer, tsz))
return -EFAULT;