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 Link libkern in the prekern, an...



details:   https://anonhg.NetBSD.org/src/rev/29418049c5c1
branches:  trunk
changeset: 827820:29418049c5c1
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Nov 13 20:03:26 2017 +0000

description:
Link libkern in the prekern, and remove redefined functions.

diffstat:

 sys/arch/amd64/stand/prekern/Makefile  |  18 ++++++++++--
 sys/arch/amd64/stand/prekern/prekern.h |  47 +--------------------------------
 2 files changed, 16 insertions(+), 49 deletions(-)

diffs (115 lines):

diff -r e43e89630e2d -r 29418049c5c1 sys/arch/amd64/stand/prekern/Makefile
--- a/sys/arch/amd64/stand/prekern/Makefile     Mon Nov 13 20:01:48 2017 +0000
+++ b/sys/arch/amd64/stand/prekern/Makefile     Mon Nov 13 20:03:26 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.1 2017/10/10 09:29:14 maxv Exp $
+#      $NetBSD: Makefile,v 1.2 2017/11/13 20:03:26 maxv Exp $
 
 PROG=          prekern
 SRCS=  locore.S trap.S prekern.c mm.c console.c elf.c
@@ -16,7 +16,8 @@
 
 .include <bsd.own.mk>
 
-CPPFLAGS+=     -I. -I${S}
+CPPFLAGS+=     -I. -I${S} -I${.OBJDIR} -I${.CURDIR}
+CPPFLAGS+=     -D_STANDALONE
 
 .include <bsd.klinks.mk>
 
@@ -25,16 +26,25 @@
 STRIPFLAG=
 LINKFLAGS=     -X -z max-page-size=0x100000 -Ttext 0x100000 -T prekern.ldscript
 
+KERN_AS=       library
+.include       "${S}/lib/libkern/Makefile.inc"
+LIBKERN=       ${KERNLIB}
+
 LIBCRT0=       # nothing
 LIBCRTI=       # nothing
 LIBC=          # nothing
 LIBCRTBEGIN=   # nothing
 LIBCRTEND=     # nothing
 
-${PROG}: ${OBJS}
-       ${LD} ${LINKFLAGS} -o ${.TARGET} ${OBJS}
+${PROG}: ${OBJS} ${LIBKERN}
+       ${_MKTARGET_LINK}
+       ${LD} ${LINKFLAGS} -o ${.TARGET} ${OBJS} ${LIBKERN}
 
 all:   ${PROG}
 
 .include <bsd.prog.mk>
 
+cleandir distclean: .WAIT cleanlibdir
+
+cleanlibdir:
+       -rm -rf lib
diff -r e43e89630e2d -r 29418049c5c1 sys/arch/amd64/stand/prekern/prekern.h
--- a/sys/arch/amd64/stand/prekern/prekern.h    Mon Nov 13 20:01:48 2017 +0000
+++ b/sys/arch/amd64/stand/prekern/prekern.h    Mon Nov 13 20:03:26 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: prekern.h,v 1.9 2017/11/11 12:51:06 maxv Exp $ */
+/*     $NetBSD: prekern.h,v 1.10 2017/11/13 20:03:26 maxv Exp $        */
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -31,6 +31,7 @@
 #include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/stdbool.h>
+#include <lib/libkern/libkern.h>
 #include <machine/pte.h>
 
 #include "pdir.h"
@@ -58,50 +59,6 @@
 
 /* -------------------------------------------------------------------------- */
 
-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;
-       while (sz > 0) {
-               *bdst = c;
-               bdst++, sz--;
-       }
-}
-
-static inline int
-memcmp(const char *a, const char *b, size_t c)
-{
-       size_t i;
-       for (i = 0; i < c; i++) {
-               if (a[i] != b[i])
-                       return 1;
-       }
-       return 0;
-}
-
-static inline int
-strcmp(char *a, char *b)
-{
-       size_t i;
-       for (i = 0; a[i] != '\0'; i++) {
-               if (a[i] != b[i])
-                       return 1;
-       }
-       return 0;
-}
-
-/* -------------------------------------------------------------------------- */
-
 #define BTSEG_NONE     0
 #define BTSEG_TEXT     1
 #define BTSEG_RODATA   2



Home | Main Index | Thread Index | Old Index