summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2000-12-14 13:47:48 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2000-12-14 13:47:48 +0000
commitdfbf1bde4e19efae48fdc043af652f5445f42280 (patch)
treebef9a920a00091e755aa5214b17ddf72c9fc589e /sys/arch
parent858c060a426f5690fa151ec0df0fd7759ef95458 (diff)
First shot at making ELF compile.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/stand/headersize.c10
-rw-r--r--sys/arch/alpha/stand/loadfile.c18
2 files changed, 14 insertions, 14 deletions
diff --git a/sys/arch/alpha/stand/headersize.c b/sys/arch/alpha/stand/headersize.c
index 77acda5881e..70495db3bfb 100644
--- a/sys/arch/alpha/stand/headersize.c
+++ b/sys/arch/alpha/stand/headersize.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: headersize.c,v 1.5 1996/11/27 19:54:47 niklas Exp $ */
+/* $OpenBSD: headersize.c,v 1.6 2000/12/14 13:47:47 art Exp $ */
/* $NetBSD: headersize.c,v 1.5 1996/09/23 04:32:59 cgd Exp $ */
/*
@@ -49,7 +49,7 @@ main(argc, argv)
char buf[HDR_BUFSIZE], *fname;
struct ecoff_exechdr *ecoffp;
#ifdef ALPHA_BOOT_ELF
- Elf_Ehdr *elfp;
+ Elf64_Ehdr *elfp;
#endif
int fd;
unsigned long loadaddr;
@@ -67,15 +67,15 @@ main(argc, argv)
err(1, "%s: read failed", fname);
ecoffp = (struct ecoff_exechdr *)buf;
#ifdef ALPHA_BOOT_ELF
- elfp = (Elf_Ehdr *)buf;
+ elfp = (Elf64_Ehdr *)buf;
#endif
if (!ECOFF_BADMAG(ecoffp)) {
printf("%d\n", ECOFF_TXTOFF(ecoffp));
}
#ifdef ALPHA_BOOT_ELF
- else if (memcmp(Elf_e_ident, elfp->e_ident, Elf_e_siz) == 0) {
- Elf_Phdr phdr;
+ else if (memcmp(ELFMAG, elfp->e_ident, SELFMAG) == 0) {
+ Elf64_Phdr phdr;
/* XXX assume the first segment is the one we want */
if (lseek(fd, elfp->e_phoff, SEEK_SET) == -1)
diff --git a/sys/arch/alpha/stand/loadfile.c b/sys/arch/alpha/stand/loadfile.c
index 4d8bb2656d3..19297a8be96 100644
--- a/sys/arch/alpha/stand/loadfile.c
+++ b/sys/arch/alpha/stand/loadfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: loadfile.c,v 1.8 2000/11/08 16:01:24 art Exp $ */
+/* $OpenBSD: loadfile.c,v 1.9 2000/12/14 13:47:47 art Exp $ */
/* $NetBSD: loadfile.c,v 1.3 1997/04/06 08:40:59 cgd Exp $ */
/*
@@ -61,7 +61,7 @@
static int coff_exec __P((int, struct ecoff_exechdr *, u_int64_t *));
#endif
#ifdef ALPHA_BOOT_ELF
-static int elf_exec __P((int, Elf_Ehdr *, u_int64_t *));
+static int elf_exec __P((int, Elf64_Ehdr *, u_int64_t *));
#endif
int loadfile __P((char *, u_int64_t *));
@@ -82,7 +82,7 @@ loadfile(fname, entryp)
struct ecoff_exechdr coff;
#endif
#ifdef ALPHA_BOOT_ELF
- Elf_Ehdr elf;
+ Elf64_Ehdr elf;
#endif
} hdr;
int fd, rval;
@@ -108,7 +108,7 @@ loadfile(fname, entryp)
} else
#endif
#ifdef ALPHA_BOOT_ELF
- if (memcmp(Elf_e_ident, hdr.elf.e_ident, Elf_e_siz) == 0) {
+ if (memcmp(ELFMAG, hdr.elf.e_ident, SELFMAG) == 0) {
rval = elf_exec(fd, &hdr.elf, entryp);
} else
#endif
@@ -236,21 +236,21 @@ coff_exec(fd, coff, entryp)
static int
elf_exec(fd, elf, entryp)
int fd;
- Elf_Ehdr *elf;
+ Elf64_Ehdr *elf;
u_int64_t *entryp;
{
int i;
int first = 1;
for (i = 0; i < elf->e_phnum; i++) {
- Elf_Phdr phdr;
+ Elf64_Phdr phdr;
(void)lseek(fd, elf->e_phoff + sizeof(phdr) * i, SEEK_SET);
if (read(fd, (void *)&phdr, sizeof(phdr)) != sizeof(phdr)) {
(void)printf("read phdr: %s\n", strerror(errno));
return (1);
}
- if (phdr.p_type != Elf_pt_load ||
- (phdr.p_flags & (Elf_pf_w|Elf_pf_x)) == 0)
+ if (phdr.p_type != PT_LOAD ||
+ (phdr.p_flags & (PF_W|PF_X)) == 0)
continue;
/* Read in segment. */
@@ -267,7 +267,7 @@ elf_exec(fd, elf, entryp)
/* Zero out bss. */
if (phdr.p_filesz < phdr.p_memsz) {
(void)printf("+%lu", phdr.p_memsz - phdr.p_filesz);
- bzero(phdr.p_vaddr + phdr.p_filesz,
+ bzero((caddr_t)phdr.p_vaddr + phdr.p_filesz,
phdr.p_memsz - phdr.p_filesz);
}
first = 0;