Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mvme68k/stand/wrtvid Use the entry-point returned f...



details:   https://anonhg.NetBSD.org/src/rev/a520b82cc218
branches:  trunk
changeset: 516264:a520b82cc218
user:      scw <scw%NetBSD.org@localhost>
date:      Fri Oct 19 17:09:16 2001 +0000

description:
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.

diffstat:

 sys/arch/mvme68k/stand/wrtvid/wrtvid.c |  23 ++++++-----------------
 1 files changed, 6 insertions(+), 17 deletions(-)

diffs (51 lines):

diff -r 2cd6f9c8050e -r a520b82cc218 sys/arch/mvme68k/stand/wrtvid/wrtvid.c
--- a/sys/arch/mvme68k/stand/wrtvid/wrtvid.c    Fri Oct 19 17:05:26 2001 +0000
+++ b/sys/arch/mvme68k/stand/wrtvid/wrtvid.c    Fri Oct 19 17:09:16 2001 +0000
@@ -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 @@
        char *filebuff;
        char fileext[256];
        u_long marks[MARK_MAX];
+       u_long entry;
        size_t len;
 
        if (argc == 0)
@@ -40,7 +41,8 @@
        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 @@
                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 */



Home | Main Index | Thread Index | Old Index