Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jul 2011 13:19:57 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r224431 - stable/8/sys/boot/i386/boot2
Message-ID:  <201107261319.p6QDJvgC009952@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Tue Jul 26 13:19:57 2011
New Revision: 224431
URL: http://svn.freebsd.org/changeset/base/224431

Log:
  MFC: r214210
  
  Avoid using memcpy() for copying 32bit chunks. This shrinks
  the resulting code a little.
  
  Approved by:    rpaulo (mentor)
  Reviewed by:    jhb

Modified:
  stable/8/sys/boot/i386/boot2/boot2.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/geom/label/   (props changed)

Modified: stable/8/sys/boot/i386/boot2/boot2.c
==============================================================================
--- stable/8/sys/boot/i386/boot2/boot2.c	Tue Jul 26 13:19:57 2011	(r224430)
+++ stable/8/sys/boot/i386/boot2/boot2.c	Tue Jul 26 13:19:57 2011	(r224431)
@@ -349,7 +349,7 @@ load(void)
 	    return;
 	p += hdr.ex.a_data + roundup2(hdr.ex.a_bss, PAGE_SIZE);
 	bootinfo.bi_symtab = VTOP(p);
-	memcpy(p, &hdr.ex.a_syms, sizeof(hdr.ex.a_syms));
+	*(uint32_t*)p = hdr.ex.a_syms;
 	p += sizeof(hdr.ex.a_syms);
 	if (hdr.ex.a_syms) {
 	    if (xfsread(ino, p, hdr.ex.a_syms))
@@ -386,7 +386,7 @@ load(void)
 	    if (xfsread(ino, &es, sizeof(es)))
 		return;
 	    for (i = 0; i < 2; i++) {
-		memcpy(p, &es[i].sh_size, sizeof(es[i].sh_size));
+		*(Elf32_Word *)p = es[i].sh_size;
 		p += sizeof(es[i].sh_size);
 		fs_off = es[i].sh_offset;
 		if (xfsread(ino, p, es[i].sh_size))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107261319.p6QDJvgC009952>