Add handling of OMAGIC files, where exec header isn't part of the
text segment. Needed for woring installboot, since biosboot.sym is OMAGIC.
This commit is contained in:
parent
be61c999f6
commit
e9f9c1625e
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: loadfile.c,v 1.6 1999/03/05 20:33:08 fvdl Exp $ */
|
/* $NetBSD: loadfile.c,v 1.7 1999/03/07 20:03:44 he Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||||
@ -446,6 +446,14 @@ aout_exec(fd, x, marks, flags)
|
|||||||
paddr_t minp, maxp;
|
paddr_t minp, maxp;
|
||||||
int cc;
|
int cc;
|
||||||
paddr_t offset = marks[MARK_START];
|
paddr_t offset = marks[MARK_START];
|
||||||
|
u_long magic = N_GETMAGIC(*x);
|
||||||
|
int sub;
|
||||||
|
|
||||||
|
/* In OMAGIC, exec header isn't part of text segment */
|
||||||
|
if (magic == OMAGIC)
|
||||||
|
sub = 0;
|
||||||
|
else
|
||||||
|
sub = sizeof(*x);
|
||||||
|
|
||||||
minp = maxp = ALIGNENTRY(entry);
|
minp = maxp = ALIGNENTRY(entry);
|
||||||
|
|
||||||
@ -471,19 +479,18 @@ aout_exec(fd, x, marks, flags)
|
|||||||
if (flags & LOAD_TEXT) {
|
if (flags & LOAD_TEXT) {
|
||||||
PROGRESS(("%ld", x->a_text));
|
PROGRESS(("%ld", x->a_text));
|
||||||
|
|
||||||
if (READ(fd, maxp, x->a_text - sizeof(*x)) !=
|
if (READ(fd, maxp, x->a_text - sub) != x->a_text - sub) {
|
||||||
x->a_text - sizeof(*x)) {
|
|
||||||
WARN(("read text"));
|
WARN(("read text"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (lseek(fd, x->a_text - sizeof(*x), SEEK_CUR) == -1) {
|
if (lseek(fd, x->a_text - sub, SEEK_CUR) == -1) {
|
||||||
WARN(("seek text"));
|
WARN(("seek text"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flags & (LOAD_TEXT|COUNT_TEXT))
|
if (flags & (LOAD_TEXT|COUNT_TEXT))
|
||||||
maxp += x->a_text - sizeof(*x);
|
maxp += x->a_text - sub;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read in the data segment.
|
* Read in the data segment.
|
||||||
|
Loading…
Reference in New Issue
Block a user