Use the entry-point returned from the first call to loadfile()

instead of the one from the second call (which has a non-zero
offset included in it).

Fixes port-mvme68k/14292 from Ken Seefried.
This commit is contained in:
scw 2001-10-19 17:09:16 +00:00
parent 336a299fa4
commit f6e6d32172
1 changed files with 6 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: wrtvid.c,v 1.3 2001/07/07 09:06:45 scw Exp $ */
/* $NetBSD: wrtvid.c,v 1.4 2001/10/19 17:09:16 scw Exp $ */
#include <sys/types.h>
#include <fcntl.h>
@ -24,6 +24,7 @@ main(int argc, char **argv)
char *filebuff;
char fileext[256];
u_long marks[MARK_MAX];
u_long entry;
size_t len;
if (argc == 0)
@ -40,7 +41,8 @@ main(int argc, char **argv)
len *= 256;
filebuff = malloc(len);
marks[MARK_START] = (u_long)(filebuff - marks[MARK_START]);
entry = marks[MARK_START];
marks[MARK_START] = (u_long)(filebuff - entry);
if ((fd = loadfile(filename, marks, LOAD_TEXT|LOAD_DATA)) == -1)
return NULL;
@ -62,21 +64,8 @@ main(int argc, char **argv)
pcpul->vid_oss = 2;
}
pcpul->vid_osl = len / 256;
/* check this, it may not work in both endian. */
{
union {
struct s {
unsigned short s1;
unsigned short s2;
} s;
unsigned long l;
} a;
a.l = marks[MARK_ENTRY];
pcpul->vid_osa_u = a.s.s1;
pcpul->vid_osa_l = a.s.s2;
}
pcpul->vid_osa_u = entry >> 16;
pcpul->vid_osa_l = entry & 0xffff;
pcpul->vid_cas = 1;
pcpul->vid_cal = 1;
/* do not want to write past end of structure, not null terminated */