Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/rbootd Pack the RMP packet layout definitions -- wi...



details:   https://anonhg.NetBSD.org/src/rev/607bde9496f1
branches:  trunk
changeset: 526925:607bde9496f1
user:      scottr <scottr%NetBSD.org@localhost>
date:      Tue May 14 04:58:56 2002 +0000

description:
Pack the RMP packet layout definitions -- with ELF, 32-bit words
are by default aligned on 32-bit boundaries. Update a semi-related
comment with this info.

diffstat:

 usr.sbin/rbootd/rmp_var.h |  20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diffs (68 lines):

diff -r 850a7dc3e2b5 -r 607bde9496f1 usr.sbin/rbootd/rmp_var.h
--- a/usr.sbin/rbootd/rmp_var.h Tue May 14 02:58:32 2002 +0000
+++ b/usr.sbin/rbootd/rmp_var.h Tue May 14 04:58:56 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rmp_var.h,v 1.8 1995/11/14 08:41:44 thorpej Exp $      */
+/*     $NetBSD: rmp_var.h,v 1.9 2002/05/14 04:58:56 scottr Exp $       */
 
 /*
  * Copyright (c) 1988, 1992 The University of Utah and the Center
@@ -119,9 +119,11 @@
 
 /*
  * Due to the RMP packet layout, we'll run into alignment problems
- * on machines that can't access (or don't, by default, align) words
- * on half-word boundaries.  If you know that your machine does not suffer
- * from this problem, add it to the vax/tahoe/m68k #define below.
+ * on machines that can't access (or don't, by default, align) 32-bit words
+ * on half-word (16-bit) boundaries.  If you know that your machine does
+ * not suffer from this problem, add it to the vax/tahoe/m68k #define below.
+ * Don't confuse this with structure packing, which for ELF objects we
+ * need to specify regardless.
  *
  * The following macros are used to deal with this problem:
  *     WORDZE(w)       Return True if u_word `w' is zero, False otherwise.
@@ -184,7 +186,7 @@
        char      rmp_machtype[RMP_MACHLEN];    /* machine type */
        u_int8_t  rmp_flnmsize;         /* length of rmp_flnm */
        restofpkt rmp_flnm;             /* name of file to be read */
-};
+} __attribute__((__packed__));
 
 struct rmp_boot_repl {         /* boot reply */
        u_int8_t  rmp_type;             /* packet type (RMP_BOOT_REPL) */
@@ -194,7 +196,7 @@
        u_int16_t rmp_version;          /* protocol version (RMP_VERSION) */
        u_int8_t  rmp_flnmsize;         /* length of rmp_flnm */
        restofpkt rmp_flnm;             /* name of file (from boot req) */
-};
+} __attribute__((__packed__));
 
 struct rmp_read_req {          /* read request */
        u_int8_t  rmp_type;             /* packet type (RMP_READ_REQ) */
@@ -202,7 +204,7 @@
        u_word    rmp_offset;           /* file relative byte offset */
        u_int16_t rmp_session;          /* session id (from boot repl) */
        u_int16_t rmp_size;             /* max no of bytes to send */
-};
+} __attribute__((__packed__));
 
 struct rmp_read_repl {         /* read reply */
        u_int8_t  rmp_type;             /* packet type (RMP_READ_REPL) */
@@ -211,14 +213,14 @@
        u_int16_t rmp_session;          /* session id (from read req) */
        restofpkt rmp_data;             /* data (max size from read req) */
        u_int8_t  rmp_unused;           /* padding to 16-bit boundary */
-};
+} __attribute__((__packed__));
 
 struct rmp_boot_done {         /* boot complete */
        u_int8_t  rmp_type;             /* packet type (RMP_BOOT_DONE) */
        u_int8_t  rmp_retcode;          /* return code (0) */
        u_word    rmp_unused;           /* not used (0) */
        u_int16_t rmp_session;          /* session id (from read repl) */
-};
+} __attribute__((__packed__));
 
 struct rmp_packet {
        struct hp_hdr hp_hdr;



Home | Main Index | Thread Index | Old Index