Module Name: src Committed By: maxv Date: Fri Nov 10 08:52:57 UTC 2017
Modified Files: src/sys/arch/amd64/stand/prekern: prekern.h Log Message: Implement memcpy, the builtin version does not work with variable sizes. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amd64/stand/prekern/prekern.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/amd64/stand/prekern/prekern.h diff -u src/sys/arch/amd64/stand/prekern/prekern.h:1.7 src/sys/arch/amd64/stand/prekern/prekern.h:1.8 --- src/sys/arch/amd64/stand/prekern/prekern.h:1.7 Fri Nov 10 08:05:38 2017 +++ src/sys/arch/amd64/stand/prekern/prekern.h Fri Nov 10 08:52:57 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: prekern.h,v 1.7 2017/11/10 08:05:38 maxv Exp $ */ +/* $NetBSD: prekern.h,v 1.8 2017/11/10 08:52:57 maxv Exp $ */ /* * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved. @@ -41,7 +41,6 @@ #define MM_PROT_EXECUTE 0x02 #define ASSERT(a) if (!(a)) fatal("ASSERT"); -#define memcpy(d, v, l) __builtin_memcpy(d, v, l) typedef uint64_t paddr_t; typedef uint64_t vaddr_t; typedef uint64_t pt_entry_t; @@ -60,6 +59,16 @@ typedef uint64_t pte_prot_t; /* -------------------------------------------------------------------------- */ static inline void +memcpy(void *dst, void *src, size_t sz) +{ + char *bdst = dst, *bsrc = src; + while (sz > 0) { + *bdst = *bsrc; + bdst++, bsrc++, sz--; + } +} + +static inline void memset(void *dst, char c, size_t sz) { char *bdst = dst;