Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/pmax Make this compilable on other than pmax.



details:   https://anonhg.NetBSD.org/src/rev/7bebc796cd98
branches:  trunk
changeset: 487707:7bebc796cd98
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Jun 11 23:28:38 2000 +0000

description:
Make this compilable on other than pmax.

diffstat:

 sys/arch/pmax/include/dec_boot.h                |  12 +++++-----
 sys/arch/pmax/stand/installboot/installboot.c   |  26 ++++++++++++------------
 sys/arch/pmax/stand/installboot/loadbootstrap.c |   8 +++---
 3 files changed, 23 insertions(+), 23 deletions(-)

diffs (174 lines):

diff -r c71161426bb2 -r 7bebc796cd98 sys/arch/pmax/include/dec_boot.h
--- a/sys/arch/pmax/include/dec_boot.h  Sun Jun 11 22:47:00 2000 +0000
+++ b/sys/arch/pmax/include/dec_boot.h  Sun Jun 11 23:28:38 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dec_boot.h,v 1.9 2000/01/09 15:34:42 ad Exp $  */
+/*     $NetBSD: dec_boot.h,v 1.10 2000/06/11 23:28:38 matt Exp $       */
 
 /*
  * Copyright (c) 1992, 1993
@@ -63,7 +63,7 @@
  * after the boot information expected by the PROM boot loader.
  */
 
-struct boot_map {
+struct pmax_boot_map {
        int32_t num_blocks;             /* Number of blocks to read. */
        int32_t start_block;            /* Starting block on disk. */
 };
@@ -74,21 +74,21 @@
  * or a list of up to 61 (to fill a 512 byte sector) block count and
  * start block pairs.  Under NetBSD, contiguous mode is always used.
  */
-struct boot_block {
+struct pmax_boot_block {
        char            pad[8];
        int32_t         magic;                  /* DEC_BOOT_MAGIC */
        int32_t         mode;                   /* Mode for boot info. */
        u_int32_t       load_addr;              /* Address to start loading. */
        u_int32_t       exec_addr;              /* Address to start execing. */
-       struct          boot_map map[61];       /* boot program section(s). */
+       struct          pmax_boot_map map[61];  /* boot program section(s). */
 };
 
 #define DEC_BOOT_MAGIC         0x0002757a
 #define DEC_BOOTMODE_CONTIGUOUS        0
 #define DEC_BOOTMODE_SCATTERED 1
 
-#define BOOT_BLOCK_OFFSET      0
-#define BOOT_BLOCK_BLOCKSIZE   512
+#define PMAX_BOOT_BLOCK_OFFSET 0
+#define PMAX_BOOT_BLOCK_BLOCKSIZE      512
 
 /*
  * DEC_NUM_DISK_PARTS is the number of partitions that are recorded in
diff -r c71161426bb2 -r 7bebc796cd98 sys/arch/pmax/stand/installboot/installboot.c
--- a/sys/arch/pmax/stand/installboot/installboot.c     Sun Jun 11 22:47:00 2000 +0000
+++ b/sys/arch/pmax/stand/installboot/installboot.c     Sun Jun 11 23:28:38 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: installboot.c,v 1.1 1999/11/28 00:32:29 simonb Exp $ */
+/* $NetBSD: installboot.c,v 1.2 2000/06/11 23:28:39 matt Exp $ */
 
 /*
  * Copyright (c) 1999 Ross Harvey.  All rights reserved.
@@ -146,7 +146,7 @@
                fprintf(stderr, "bootstrap: %s\n",
                    bootstrap != NULL ? bootstrap : "to be cleared");
        }
-       if (sizeof (struct boot_block) != BOOT_BLOCK_BLOCKSIZE)
+       if (sizeof (struct pmax_boot_block) != PMAX_BOOT_BLOCK_BLOCKSIZE)
                errx(EXIT_FAILURE,
                    "boot_block structure badly sized (build error)");
 
@@ -169,14 +169,14 @@
 static void
 clr_bootstrap(const char *disk)
 {
-       struct boot_block bb;
+       struct pmax_boot_block bb;
        ssize_t rv;
        int diskfd;
 
        if ((diskfd = open(disk, nowrite ? O_RDONLY : O_RDWR)) == -1)
                err(EXIT_FAILURE, "open %s", disk);
 
-       rv = pread(diskfd, &bb, sizeof bb, BOOT_BLOCK_OFFSET);
+       rv = pread(diskfd, &bb, sizeof bb, PMAX_BOOT_BLOCK_OFFSET);
        if (rv == -1)
                err(EXIT_FAILURE, "read %s", disk);
        else if (rv != sizeof bb)
@@ -206,7 +206,7 @@
        if (verbose)
                fprintf(stderr, "writing\n");
        
-       rv = pwrite(diskfd, &bb, sizeof bb, BOOT_BLOCK_OFFSET);
+       rv = pwrite(diskfd, &bb, sizeof bb, PMAX_BOOT_BLOCK_OFFSET);
        if (rv == -1)
                err(EXIT_FAILURE, "write %s", disk);
        else if (rv != sizeof bb)
@@ -220,7 +220,7 @@
 set_bootstrap(const char *disk, const char *bootstrap)
 {
        struct stat bootstrapsb;
-       struct boot_block bb;
+       struct pmax_boot_block bb;
        int diskfd, startblock;
        char *bootstrapbuf;
        size_t bootstrapsize;
@@ -238,7 +238,7 @@
        if ((diskfd = open(disk, nowrite ? O_RDONLY : O_RDWR)) == -1)
                err(EXIT_FAILURE, "open %s", disk);
 
-       rv = pread(diskfd, &bb, sizeof bb, BOOT_BLOCK_OFFSET);
+       rv = pread(diskfd, &bb, sizeof bb, PMAX_BOOT_BLOCK_OFFSET);
        if (rv == -1)
                err(EXIT_FAILURE, "read %s", disk);
        else if (rv != sizeof bb)
@@ -246,15 +246,15 @@
 
        /* fill in the updated boot block fields */
        if (append) {
-               startblock = howmany(disksb.st_size, BOOT_BLOCK_BLOCKSIZE);
+               startblock = howmany(disksb.st_size, PMAX_BOOT_BLOCK_BLOCKSIZE);
        } else if (isoblock) {
-               startblock = isoblock * (ISO_DEFAULT_BLOCK_SIZE / BOOT_BLOCK_BLOCKSIZE);
+               startblock = isoblock * (ISO_DEFAULT_BLOCK_SIZE / PMAX_BOOT_BLOCK_BLOCKSIZE);
        } else {
-               startblock = BOOT_BLOCK_OFFSET / BOOT_BLOCK_BLOCKSIZE + 1;
+               startblock = PMAX_BOOT_BLOCK_OFFSET / PMAX_BOOT_BLOCK_BLOCKSIZE + 1;
        }
 
        bb.map[0].start_block = startblock;
-       bb.map[0].num_blocks = howmany(bootstrapsize, BOOT_BLOCK_BLOCKSIZE);
+       bb.map[0].num_blocks = howmany(bootstrapsize, PMAX_BOOT_BLOCK_BLOCKSIZE);
        bb.magic = DEC_BOOT_MAGIC;
        bb.load_addr = bootstrapload;
        bb.exec_addr = bootstrapexec;
@@ -281,7 +281,7 @@
                fprintf(stderr, "writing bootstrap\n");
 
        rv = pwrite(diskfd, bootstrapbuf, bootstrapsize,
-            startblock * BOOT_BLOCK_BLOCKSIZE);
+            startblock * PMAX_BOOT_BLOCK_BLOCKSIZE);
        if (rv == -1)
                err(EXIT_FAILURE, "write %s", disk);
        else if (rv != bootstrapsize)
@@ -290,7 +290,7 @@
        if (verbose)
                fprintf(stderr, "writing boot block\n");
 
-       rv = pwrite(diskfd, &bb, sizeof bb, BOOT_BLOCK_OFFSET);
+       rv = pwrite(diskfd, &bb, sizeof bb, PMAX_BOOT_BLOCK_OFFSET);
        if (rv == -1)
                err(EXIT_FAILURE, "write %s", disk);
        else if (rv != sizeof bb)
diff -r c71161426bb2 -r 7bebc796cd98 sys/arch/pmax/stand/installboot/loadbootstrap.c
--- a/sys/arch/pmax/stand/installboot/loadbootstrap.c   Sun Jun 11 22:47:00 2000 +0000
+++ b/sys/arch/pmax/stand/installboot/loadbootstrap.c   Sun Jun 11 23:28:38 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadbootstrap.c,v 1.2 1999/12/01 05:02:03 simonb Exp $ */
+/* $NetBSD: loadbootstrap.c,v 1.3 2000/06/11 23:28:39 matt Exp $ */
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
                errx(EXIT_FAILURE, "no ELF header in %s", bootstrap);
        
        nsegs = highaddr = 0;
-       lowaddr = ULONG_MAX;
+       lowaddr = (uint32_t) ULONG_MAX;
 
        for (i = 0; i < ehdr.e_phnum; i++) {
                if (lseek(fd, (off_t) ehdr.e_phoff + i * sizeof(phdr), 0) < 0)
@@ -99,9 +99,9 @@
 
        *loadaddr = lowaddr;
        *execaddr = ehdr.e_entry;
-       *len = roundup(highaddr - lowaddr, BOOT_BLOCK_BLOCKSIZE);
+       *len = roundup(highaddr - lowaddr, PMAX_BOOT_BLOCK_BLOCKSIZE);
        if ((*data = malloc(*len)) == NULL)
-               err(1, "malloc %d bytes", *len);
+               err(1, "malloc %lu bytes", (unsigned long) *len);
 
        /* Now load the bootstrap into memory */
        for (i = 0; i < nsegs; i++) {



Home | Main Index | Thread Index | Old Index