Date: Fri, 22 Oct 2010 18:07:21 +0000 (UTC) From: Roman Divacky <rdivacky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r214210 - head/sys/boot/i386/boot2 Message-ID: <201010221807.o9MI7LD8061657@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rdivacky Date: Fri Oct 22 18:07:21 2010 New Revision: 214210 URL: http://svn.freebsd.org/changeset/base/214210 Log: Avoid using memcpy() for copying 32bit chunks. This shrinks the resulting code a little. Approved by: rpaulo (mentor) Reviewed by: jhb Modified: head/sys/boot/i386/boot2/boot2.c Modified: head/sys/boot/i386/boot2/boot2.c ============================================================================== --- head/sys/boot/i386/boot2/boot2.c Fri Oct 22 18:06:58 2010 (r214209) +++ head/sys/boot/i386/boot2/boot2.c Fri Oct 22 18:07:21 2010 (r214210) @@ -348,7 +348,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)) @@ -385,7 +385,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?201010221807.o9MI7LD8061657>