Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/installboot/arch ensure that members of apple_drvr_...



details:   https://anonhg.NetBSD.org/src/rev/80d1c3d0d93f
branches:  trunk
changeset: 527000:80d1c3d0d93f
user:      lukem <lukem%NetBSD.org@localhost>
date:      Wed May 15 15:43:01 2002 +0000

description:
ensure that members of apple_drvr_map and apple_part_map_entry are big endian

diffstat:

 usr.sbin/installboot/arch/macppc.c |  39 ++++++++++++++++++++-----------------
 1 files changed, 21 insertions(+), 18 deletions(-)

diffs (85 lines):

diff -r 77f75e72b23e -r 80d1c3d0d93f usr.sbin/installboot/arch/macppc.c
--- a/usr.sbin/installboot/arch/macppc.c        Wed May 15 15:19:54 2002 +0000
+++ b/usr.sbin/installboot/arch/macppc.c        Wed May 15 15:43:01 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: macppc.c,v 1.2 2002/05/15 13:38:42 lukem Exp $ */
+/*     $NetBSD: macppc.c,v 1.3 2002/05/15 15:43:01 lukem Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: macppc.c,v 1.2 2002/05/15 13:38:42 lukem Exp $");
+__RCSID("$NetBSD: macppc.c,v 1.3 2002/05/15 15:43:01 lukem Exp $");
 #endif /* !__lint */
 
 #if HAVE_CONFIG_H
@@ -78,6 +78,7 @@
                    params->machine->name);
                return (0);
        }
+               /* XXX: maybe clear the apple partition map too? */
        return (shared_bbinfo_clearboot(params, &bbparams));
 }
 
@@ -100,9 +101,9 @@
                warn("Can't read sector 0 of `%s'", params->filesystem);
                return (0);
        }
-       dm.sbSig = APPLE_DRVR_MAP_MAGIC;
-       dm.sbBlockSize = 512;
-       dm.sbBlkCount = 0;
+       dm.sbSig =              htobe16(APPLE_DRVR_MAP_MAGIC);
+       dm.sbBlockSize =        htobe16(512);
+       dm.sbBlkCount =         htobe32(0);
        if (pwrite(params->fsfd, &dm, MACPPC_BOOT_BLOCK_BLOCKSIZE, 0) !=
            MACPPC_BOOT_BLOCK_BLOCKSIZE) {
                warn("Can't write sector 0 of `%s'", params->filesystem);
@@ -111,13 +112,14 @@
 
                /* block 1: Apple Partition Map */
        memset(&pme, 0, sizeof(pme));
-       pme.pmSig = APPLE_PART_MAP_ENTRY_MAGIC;
-       pme.pmMapBlkCnt = 2;
-       pme.pmPyPartStart = 1;
-       pme.pmPartBlkCnt = pme.pmDataCnt = 2;
+       pme.pmSig =             htobe16(APPLE_PART_MAP_ENTRY_MAGIC);
+       pme.pmMapBlkCnt =       htobe32(2);
+       pme.pmPyPartStart =     htobe32(1);
+       pme.pmPartBlkCnt =      htobe32(2);
+       pme.pmDataCnt =         htobe32(2);
        strlcpy(pme.pmPartName, "Apple", sizeof(pme.pmPartName));
        strlcpy(pme.pmPartType, "Apple_partition_map", sizeof(pme.pmPartType));
-       pme.pmPartStatus = 0x37;
+       pme.pmPartStatus =      htobe32(0x37);
        if (pwrite(params->fsfd, &pme, MACPPC_BOOT_BLOCK_BLOCKSIZE,
            1 * MACPPC_BOOT_BLOCK_BLOCKSIZE) != MACPPC_BOOT_BLOCK_BLOCKSIZE) {
                warn("Can't write Apple Partition Map into sector 1 of `%s'",
@@ -127,16 +129,17 @@
 
                /* block 2: NetBSD partition */
        memset(&pme, 0, sizeof(pme));
-       pme.pmSig = APPLE_PART_MAP_ENTRY_MAGIC;
-       pme.pmMapBlkCnt = 2;
-       pme.pmPyPartStart = 4;
-       pme.pmPartBlkCnt = pme.pmDataCnt = 0x7fffffff;
+       pme.pmSig =             htobe16(APPLE_PART_MAP_ENTRY_MAGIC);
+       pme.pmMapBlkCnt =       htobe32(2);
+       pme.pmPyPartStart =     htobe32(4);
+       pme.pmPartBlkCnt =      htobe32(0x7fffffff);
+       pme.pmDataCnt =         htobe32(0x7fffffff);
        strlcpy(pme.pmPartName, "NetBSD", sizeof(pme.pmPartName));
        strlcpy(pme.pmPartType, "NetBSD/macppc", sizeof(pme.pmPartType));
-       pme.pmPartStatus = 0x3b;
-       pme.pmBootSize = 0x400;
-       pme.pmBootLoad = 0x4000;
-       pme.pmBootEntry = 0x4000;
+       pme.pmPartStatus =      htobe32(0x3b);
+       pme.pmBootSize =        htobe32(0x400);
+       pme.pmBootLoad =        htobe32(0x4000);
+       pme.pmBootEntry =       htobe32(0x4000);
        strlcpy(pme.pmProcessor, "PowerPC", sizeof(pme.pmProcessor));
        if (pwrite(params->fsfd, &pme, MACPPC_BOOT_BLOCK_BLOCKSIZE,
            2 * MACPPC_BOOT_BLOCK_BLOCKSIZE) != MACPPC_BOOT_BLOCK_BLOCKSIZE) {



Home | Main Index | Thread Index | Old Index