diff options
author | rodrigc <rodrigc@FreeBSD.org> | 2011-06-15 23:22:35 +0000 |
---|---|---|
committer | rodrigc <rodrigc@FreeBSD.org> | 2011-06-15 23:22:35 +0000 |
commit | dc6fca7b3ac89d3d25ef631eef77b284031e509e (patch) | |
tree | 2c0a30846141ab7191f49e3c2639728bad04cfbb | |
parent | ef6ee3faed283f9910e11c5d56af10d587a6803a (diff) | |
download | FreeBSD-src-dc6fca7b3ac89d3d25ef631eef77b284031e509e.zip FreeBSD-src-dc6fca7b3ac89d3d25ef631eef77b284031e509e.tar.gz |
Bring back following change which was undone in previous commit:
------------------------------------------------------------------------
r172854 | marius | 2007-10-21 10:03:18 -0700 (Sun, 21 Oct 2007) | 16 lines
Changed paths:
M /head/lib/libstand/tftp.c
- Given that we tell the compiler that struct ip is packed and 32-bit
aligned, GCC 4.2.1 also generates code for sendudp() that assumes
this alignment. GCC 4.2.1 however doesn't 32-bit align wbuf, causing
the loader to crash due to an unaligned access of wbuf in sendudp()
when netbooting sparc64. Solve this by specifying wbuf as packed and
32-bit aligned, too. As for lastdata and readudp() this currently is
no issue when compiled with GCC 4.2.1, though give lastdata the same
treatment as wbuf for consistency and possibility of being affected
in the future. [1]
- Sprinkle const on a lookup table.
------------------------------------------------------------------------
-rw-r--r-- | lib/libstand/tftp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libstand/tftp.c b/lib/libstand/tftp.c index f34dfdb..54e184c 100644 --- a/lib/libstand/tftp.c +++ b/lib/libstand/tftp.c @@ -118,10 +118,10 @@ struct tftp_handle { u_char header[HEADER_SIZE]; struct tftphdr t; u_char space[TFTP_MAX_BLKSIZE]; - } lastdata; + } __packed __aligned(4) lastdata; }; -static int tftperrors[8] = { +static const int tftperrors[8] = { 0, /* ??? */ ENOENT, EPERM, @@ -208,7 +208,7 @@ tftp_makereq(struct tftp_handle *h) u_char header[HEADER_SIZE]; struct tftphdr t; u_char space[FNAME_SIZE + 6]; - } wbuf; + } __packed __aligned(4) wbuf; char *wtail; int l; ssize_t res; @@ -286,7 +286,7 @@ tftp_getnextblock(struct tftp_handle *h) struct { u_char header[HEADER_SIZE]; struct tftphdr t; - } wbuf; + } __packed __aligned(4) wbuf; char *wtail; int res; struct tftphdr *t; |