Module Name: src Committed By: maxv Date: Thu Nov 9 15:56:56 UTC 2017
Modified Files: src/sys/arch/amd64/stand/prekern: elf.c prekern.h Log Message: Define utility functions as inlines in prekern.h. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/amd64/stand/prekern/elf.c cvs rdiff -u -r1.5 -r1.6 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/elf.c diff -u src/sys/arch/amd64/stand/prekern/elf.c:1.8 src/sys/arch/amd64/stand/prekern/elf.c:1.9 --- src/sys/arch/amd64/stand/prekern/elf.c:1.8 Thu Nov 9 15:24:39 2017 +++ src/sys/arch/amd64/stand/prekern/elf.c Thu Nov 9 15:56:56 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: elf.c,v 1.8 2017/11/09 15:24:39 maxv Exp $ */ +/* $NetBSD: elf.c,v 1.9 2017/11/09 15:56:56 maxv Exp $ */ /* * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved. @@ -49,29 +49,6 @@ extern paddr_t kernpa_start, kernpa_end; static struct elfinfo eif; static const char entrypoint[] = "start_prekern"; -/* XXX */ -static 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 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; -} - - static int elf_check_header() { Index: src/sys/arch/amd64/stand/prekern/prekern.h diff -u src/sys/arch/amd64/stand/prekern/prekern.h:1.5 src/sys/arch/amd64/stand/prekern/prekern.h:1.6 --- src/sys/arch/amd64/stand/prekern/prekern.h:1.5 Thu Nov 9 15:24:39 2017 +++ src/sys/arch/amd64/stand/prekern/prekern.h Thu Nov 9 15:56:56 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: prekern.h,v 1.5 2017/11/09 15:24:39 maxv Exp $ */ +/* $NetBSD: prekern.h,v 1.6 2017/11/09 15:56:56 maxv Exp $ */ /* * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved. @@ -69,6 +69,28 @@ memset(void *dst, char c, size_t 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; +} + /* -------------------------------------------------------------------------- */ struct bootspace {