On Thu, Aug 24, 2006 at 08:12:02AM +0100, Ian Campbell wrote:
> On Thu, 2006-08-24 at 11:17 +0900, Horms wrote:
> > Sorry for being so naieve, but where is the staging tree?
>
> It's an internal tree which gets regression tested and then copied
> automatically to the public xen-unstable tree.
>
> The code in question is in the xen-unstable tree now.
>
> > I included elf notes infastructure in the kexec patches that I have
> > posted to this list serveral times. It sounds like there is probably
> > some infastructure overlap. I'd like to take a look at what you have
> > done to see if it fits the needs of kexec so we can avoid code duplication.
>
> I didn't know you guys had ELF infrastructure in the kexec patches, I
> hope my stuff is useful for you...
Hi Ian,
I took a look over the changes, and unforunately there doesn't seem
to be much overlap. This is for two main reasons:
1. kexec is mainly concerned with crash notes, rather than
generic notes (I was a bit confused when I read your original post).
2. kexec creates these notes from within the hypervisor,
but I beleive that your code has linux create the notes,
while the hypervisor just reads them.
I'd really appreciate it if you could take a moment to cast your eyes
over my elf code.
Below is the x86 code to fill in the crash notes, and below that
is include/xen/elfcore.h. This comprises the bulk of the elf code
that I have. I can come up with a full patch if you are interested.
The x86 fill-in code was basically copied from i386 linux kexec,
if there is room for improvement there, then its probably something
that also wants fixing in Linux.
The include/xen/elfcore.h. portion is based on linux, translated
to the xen style of elf code - which apparently does not have
the same origin as the linux code. I'd appreciate feedback on
the style here.
--
Horms
H: http://www.vergenet.net/~horms/
W: http://www.valinux.co.jp/en/
=== begin x86 fill-in snippet ===
static u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data,
size_t data_len)
{
Elf_Note note;
note.namesz = strlen(name) + 1;
note.descsz = data_len;
note.type = type;
memcpy(buf, ¬e, sizeof(note));
buf += (sizeof(note) +3)/4;
memcpy(buf, name, note.namesz);
buf += (note.namesz + 3)/4;
memcpy(buf, data, note.descsz);
buf += (note.descsz + 3)/4;
return buf;
}
static void final_note(u32 *buf)
{
Elf_Note note;
note.namesz = 0;
note.descsz = 0;
note.type = 0;
memcpy(buf, ¬e, sizeof(note));
}
=== end x86 fill-in snippet ===
=== begin include/xen/elfcore.h ===
/******************************************************************************
* include/xen/elfcore.h
*
* Created By: Horms
*
* Based heavily on include/linux/elfcore.h from Linux 2.6.16
* Naming scheeme based on include/xen/elf.h (not include/linux/elfcore.h)
*
*/
#ifndef __ELFCOREC_H__
#define __ELFCOREC_H__
#include <xen/types.h>
#include <xen/elf.h>
#include <public/xen.h>
#define NT_PRSTATUS 1
#define NT_XEN_DOM0_CR3 0x10000001 /* XXX: Hopefully this is unused,
feel free to change to a
better/different value */
typedef struct
{
int signo; /* signal number */
int code; /* extra code */
int errno; /* errno */
} ELF_Signifo;
/* These seem to be the same length on all architectures on Linux */
typedef int ELF_Pid;
typedef struct {
long tv_sec;
long tv_usec;
} ELF_Timeval;
typedef unsigned long ELF_Greg;
#define ELF_NGREG (sizeof (struct cpu_user_regs) / sizeof(ELF_Greg))
typedef ELF_Greg ELF_Gregset[ELF_NGREG];
/*
* Definitions to generate Intel SVR4-like core files.
* These mostly have the same names as the SVR4 types with "elf_"
* tacked on the front to prevent clashes with linux definitions,
* and the typedef forms have been avoided. This is mostly like
* the SVR4 structure, but more Linuxy, with things that Linux does
* not support and which gdb doesn't really use excluded.
*/
typedef struct
{
ELF_Signifo pr_info; /* Info associated with signal */
short pr_cursig; /* Current signal */
unsigned long pr_sigpend; /* Set of pending signals */
unsigned long pr_sighold; /* Set of held signals */
ELF_Pid pr_pid;
ELF_Pid pr_ppid;
ELF_Pid pr_pgrp;
ELF_Pid pr_sid;
ELF_Timeval pr_utime; /* User time */
ELF_Timeval pr_stime; /* System time */
ELF_Timeval pr_cutime; /* Cumulative user time */
ELF_Timeval pr_cstime; /* Cumulative system time */
ELF_Gregset pr_reg; /* GP registers */
int pr_fpvalid; /* True if math co-processor being used. */
} ELF_Prstatus;
#endif /* __ELFCOREC_H__ */
/*
* Local variables:
* mode: C
* c-set-style: "BSD"
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: nil
* End:
*/
=== end include/xen/elfcore.h ===
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|