typedef target_ulong target_elf_greg_t;
#ifdef USE_UID16
-typedef uint16_t target_uid_t;
-typedef uint16_t target_gid_t;
+typedef target_ushort target_uid_t;
+typedef target_ushort target_gid_t;
#else
-typedef uint32_t target_uid_t;
-typedef uint32_t target_gid_t;
+typedef target_uint target_uid_t;
+typedef target_uint target_gid_t;
#endif
-typedef int32_t target_pid_t;
+typedef target_int target_pid_t;
#ifdef TARGET_I386
size_t namesz_rounded;
int type;
size_t datasz;
+ size_t datasz_rounded;
void *data;
size_t notesz;
};
struct target_elf_siginfo {
- int si_signo; /* signal number */
- int si_code; /* extra code */
- int si_errno; /* errno */
+ target_int si_signo; /* signal number */
+ target_int si_code; /* extra code */
+ target_int si_errno; /* errno */
};
struct target_elf_prstatus {
struct target_elf_siginfo pr_info; /* Info associated with signal */
- short pr_cursig; /* Current signal */
+ target_short pr_cursig; /* Current signal */
target_ulong pr_sigpend; /* XXX */
target_ulong pr_sighold; /* XXX */
target_pid_t pr_pid;
struct target_timeval pr_cutime; /* XXX Cumulative user time */
struct target_timeval pr_cstime; /* XXX Cumulative system time */
target_elf_gregset_t pr_reg; /* GP registers */
- int pr_fpvalid; /* XXX */
+ target_int pr_fpvalid; /* XXX */
};
#define ELF_PRARGSZ (80) /* Number of chars for args */
note->namesz = namesz;
note->namesz_rounded = roundup(namesz, sizeof (int32_t));
note->type = type;
- note->datasz = roundup(sz, sizeof (int32_t));;
+ note->datasz = sz;
+ note->datasz_rounded = roundup(sz, sizeof (int32_t));
+
note->data = data;
/*
* ELF document.
*/
note->notesz = sizeof (struct elf_note) +
- note->namesz_rounded + note->datasz;
+ note->namesz_rounded + note->datasz_rounded;
}
static void fill_elf_header(struct elfhdr *elf, int segs, uint16_t machine,
return (-1);
if (dump_write(fd, men->name, men->namesz_rounded) != 0)
return (-1);
- if (dump_write(fd, men->data, men->datasz) != 0)
+ if (dump_write(fd, men->data, men->datasz_rounded) != 0)
return (-1);
return (0);
* ELF specification wants data to start at page boundary so
* we align it here.
*/
- offset = roundup(offset, ELF_EXEC_PAGESIZE);
+ data_offset = offset = roundup(offset, ELF_EXEC_PAGESIZE);
/*
* Write program headers for memory regions mapped in
phdr.p_flags |= PF_X;
phdr.p_align = ELF_EXEC_PAGESIZE;
+ bswap_phdr(&phdr, 1);
dump_write(fd, &phdr, sizeof (phdr));
}
goto out;
/* align data to page boundary */
- data_offset = lseek(fd, 0, SEEK_CUR);
- data_offset = TARGET_PAGE_ALIGN(data_offset);
if (lseek(fd, data_offset, SEEK_SET) != data_offset)
goto out;