svn commit: r214257 - head/sys/boot/pc98/boot2

Takahashi Yoshihiro nyan at FreeBSD.org
Sun Oct 24 02:59:03 UTC 2010


Author: nyan
Date: Sun Oct 24 02:59:02 2010
New Revision: 214257
URL: http://svn.freebsd.org/changeset/base/214257

Log:
  MFi386: revision 214210
  
    Avoid using memcpy() for copying 32bit chunks. This shrinks
    the resulting code a little.

Modified:
  head/sys/boot/pc98/boot2/boot2.c

Modified: head/sys/boot/pc98/boot2/boot2.c
==============================================================================
--- head/sys/boot/pc98/boot2/boot2.c	Sun Oct 24 01:05:10 2010	(r214256)
+++ head/sys/boot/pc98/boot2/boot2.c	Sun Oct 24 02:59:02 2010	(r214257)
@@ -485,7 +485,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))
@@ -522,7 +522,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))


More information about the svn-src-all mailing list