Module Name:    src
Committed By:   maxv
Date:           Mon Nov 13 20:03:26 UTC 2017

Modified Files:
        src/sys/arch/amd64/stand/prekern: Makefile prekern.h

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


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amd64/stand/prekern/Makefile
cvs rdiff -u -r1.9 -r1.10 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/Makefile
diff -u src/sys/arch/amd64/stand/prekern/Makefile:1.1 src/sys/arch/amd64/stand/prekern/Makefile:1.2
--- src/sys/arch/amd64/stand/prekern/Makefile:1.1	Tue Oct 10 09:29:14 2017
+++ src/sys/arch/amd64/stand/prekern/Makefile	Mon Nov 13 20:03:26 2017
@@ -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 @@ BINMODE=	444
 
 .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 @@ CFLAGS+=	-Wall -Werror -mno-red-zone -mn
 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

Index: src/sys/arch/amd64/stand/prekern/prekern.h
diff -u src/sys/arch/amd64/stand/prekern/prekern.h:1.9 src/sys/arch/amd64/stand/prekern/prekern.h:1.10
--- src/sys/arch/amd64/stand/prekern/prekern.h:1.9	Sat Nov 11 12:51:06 2017
+++ src/sys/arch/amd64/stand/prekern/prekern.h	Mon Nov 13 20:03:26 2017
@@ -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 @@ 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;
-	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

Reply via email to