Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amd64/stand/prekern Implement memcpy, the builtin v...
details: https://anonhg.NetBSD.org/src/rev/032dcf69cec1
branches: trunk
changeset: 357428:032dcf69cec1
user: maxv <maxv%NetBSD.org@localhost>
date: Fri Nov 10 08:52:57 2017 +0000
description:
Implement memcpy, the builtin version does not work with variable sizes.
diffstat:
sys/arch/amd64/stand/prekern/prekern.h | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diffs (34 lines):
diff -r d0fe3ca974e5 -r 032dcf69cec1 sys/arch/amd64/stand/prekern/prekern.h
--- a/sys/arch/amd64/stand/prekern/prekern.h Fri Nov 10 08:05:38 2017 +0000
+++ b/sys/arch/amd64/stand/prekern/prekern.h Fri Nov 10 08:52:57 2017 +0000
@@ -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 @@
/* -------------------------------------------------------------------------- */
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;
Home |
Main Index |
Thread Index |
Old Index