Module Name: src
Committed By: maxv
Date: Tue Nov 14 07:06:34 UTC 2017
Modified Files:
src/sys/arch/amd64/stand/prekern: Makefile console.c elf.c mm.c
prekern.c prekern.h
Log Message:
Add -Wstrict-prototypes, and fix each warning.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/amd64/stand/prekern/Makefile
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amd64/stand/prekern/console.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/amd64/stand/prekern/elf.c \
src/sys/arch/amd64/stand/prekern/mm.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/stand/prekern/prekern.c
cvs rdiff -u -r1.11 -r1.12 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.2 src/sys/arch/amd64/stand/prekern/Makefile:1.3
--- src/sys/arch/amd64/stand/prekern/Makefile:1.2 Mon Nov 13 20:03:26 2017
+++ src/sys/arch/amd64/stand/prekern/Makefile Tue Nov 14 07:06:34 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2017/11/13 20:03:26 maxv Exp $
+# $NetBSD: Makefile,v 1.3 2017/11/14 07:06:34 maxv Exp $
PROG= prekern
SRCS= locore.S trap.S prekern.c mm.c console.c elf.c
@@ -23,6 +23,7 @@ CPPFLAGS+= -D_STANDALONE
CPPFLAGS+= -DKERNEL -D__x86_64__
CFLAGS+= -Wall -Werror -mno-red-zone -mno-mmx -mno-sse -mno-avx -ffreestanding
+CFLAGS+= -Wstrict-prototypes
STRIPFLAG=
LINKFLAGS= -X -z max-page-size=0x100000 -Ttext 0x100000 -T prekern.ldscript
Index: src/sys/arch/amd64/stand/prekern/console.c
diff -u src/sys/arch/amd64/stand/prekern/console.c:1.1 src/sys/arch/amd64/stand/prekern/console.c:1.2
--- src/sys/arch/amd64/stand/prekern/console.c:1.1 Tue Oct 10 09:29:14 2017
+++ src/sys/arch/amd64/stand/prekern/console.c Tue Nov 14 07:06:34 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: console.c,v 1.1 2017/10/10 09:29:14 maxv Exp $ */
+/* $NetBSD: console.c,v 1.2 2017/11/14 07:06:34 maxv Exp $ */
/*
* Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -38,14 +38,14 @@ static char *cons_start;
static size_t cons_x, cons_y;
static char cons_buffer[CONS_WID * 2 * CONS_HEI];
-void init_cons()
+void init_cons(void)
{
cons_start = (char *)atdevbase + (0xB8000 - IOM_BEGIN);
cons_x = 0;
cons_y = 0;
}
-static void check_scroll()
+static void check_scroll(void)
{
char *src, *dst;
size_t i;
@@ -106,7 +106,7 @@ void print_state(bool ok, char *buf)
print("\n");
}
-void print_banner()
+void print_banner(void)
{
char *banner =
" __________ __ \n"
Index: src/sys/arch/amd64/stand/prekern/elf.c
diff -u src/sys/arch/amd64/stand/prekern/elf.c:1.12 src/sys/arch/amd64/stand/prekern/elf.c:1.13
--- src/sys/arch/amd64/stand/prekern/elf.c:1.12 Mon Nov 13 21:33:42 2017
+++ src/sys/arch/amd64/stand/prekern/elf.c Tue Nov 14 07:06:34 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: elf.c,v 1.12 2017/11/13 21:33:42 maxv Exp $ */
+/* $NetBSD: elf.c,v 1.13 2017/11/14 07:06:34 maxv Exp $ */
/*
* Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -50,7 +50,7 @@ static struct elfinfo eif;
static const char entrypoint[] = "start_prekern";
static int
-elf_check_header()
+elf_check_header(void)
{
if (memcmp((char *)eif.ehdr->e_ident, ELFMAG, SELFMAG) != 0 ||
eif.ehdr->e_ident[EI_CLASS] != ELFCLASS ||
@@ -61,7 +61,7 @@ elf_check_header()
}
static vaddr_t
-elf_get_entrypoint()
+elf_get_entrypoint(void)
{
Elf_Sym *sym;
size_t i;
@@ -259,7 +259,7 @@ elf_build_head(vaddr_t headva)
}
void
-elf_map_sections()
+elf_map_sections(void)
{
const paddr_t basepa = kernpa_start;
const vaddr_t headva = (vaddr_t)eif.ehdr;
@@ -361,7 +361,7 @@ elf_build_boot(vaddr_t bootva, paddr_t b
}
vaddr_t
-elf_kernel_reloc()
+elf_kernel_reloc(void)
{
const vaddr_t baseva = (vaddr_t)eif.ehdr;
vaddr_t secva, ent;
@@ -454,7 +454,7 @@ elf_kernel_reloc()
/*
* Get the entry point.
*/
- ent = elf_get_entrypoint(&eif);
+ ent = elf_get_entrypoint();
if (ent == 0) {
fatal("elf_kernel_reloc: entry point not found");
}
@@ -463,4 +463,3 @@ elf_kernel_reloc()
return ent;
}
-
Index: src/sys/arch/amd64/stand/prekern/mm.c
diff -u src/sys/arch/amd64/stand/prekern/mm.c:1.12 src/sys/arch/amd64/stand/prekern/mm.c:1.13
--- src/sys/arch/amd64/stand/prekern/mm.c:1.12 Mon Nov 13 21:14:04 2017
+++ src/sys/arch/amd64/stand/prekern/mm.c Tue Nov 14 07:06:34 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: mm.c,v 1.12 2017/11/13 21:14:04 maxv Exp $ */
+/* $NetBSD: mm.c,v 1.13 2017/11/14 07:06:34 maxv Exp $ */
/*
* Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -119,7 +119,7 @@ mm_mprotect(vaddr_t startva, size_t size
}
void
-mm_bootspace_mprotect()
+mm_bootspace_mprotect(void)
{
int prot;
size_t i;
@@ -196,14 +196,14 @@ mm_map_tree(vaddr_t startva, vaddr_t end
}
static uint64_t
-mm_rand_num64()
+mm_rand_num64(void)
{
/* XXX: yes, this is ridiculous, will be fixed soon */
return rdtsc();
}
static void
-mm_map_head()
+mm_map_head(void)
{
size_t i, npages, size;
uint64_t rnd;
@@ -278,7 +278,7 @@ mm_randva_kregion(size_t size)
}
static paddr_t
-bootspace_getend()
+bootspace_getend(void)
{
paddr_t pa, max = 0;
size_t i;
@@ -344,7 +344,7 @@ mm_map_segment(int segtype, paddr_t pa,
}
static void
-mm_map_boot()
+mm_map_boot(void)
{
size_t i, npages, size;
vaddr_t randva;
@@ -401,7 +401,7 @@ mm_map_boot()
* At the end of this function, the bootspace structure is fully constructed.
*/
void
-mm_map_kernel()
+mm_map_kernel(void)
{
memset(&bootspace, 0, sizeof(bootspace));
mm_map_head();
@@ -411,4 +411,3 @@ mm_map_kernel()
mm_map_boot();
print_state(true, "Boot region mapped");
}
-
Index: src/sys/arch/amd64/stand/prekern/prekern.c
diff -u src/sys/arch/amd64/stand/prekern/prekern.c:1.4 src/sys/arch/amd64/stand/prekern/prekern.c:1.5
--- src/sys/arch/amd64/stand/prekern/prekern.c:1.4 Sun Nov 5 16:26:15 2017
+++ src/sys/arch/amd64/stand/prekern/prekern.c Tue Nov 14 07:06:34 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: prekern.c,v 1.4 2017/11/05 16:26:15 maxv Exp $ */
+/* $NetBSD: prekern.c,v 1.5 2017/11/14 07:06:34 maxv Exp $ */
/*
* Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -89,8 +89,8 @@ static void setgate(struct gate_descript
static void set_sys_segment(struct sys_segment_descriptor *, void *,
size_t, int, int, int);
static void set_sys_gdt(int, void *, size_t, int, int, int);
-static void init_tss();
-static void init_idt();
+static void init_tss(void);
+static void init_idt(void);
void trap(struct smallframe *);
@@ -192,7 +192,7 @@ set_sys_gdt(int slotoff, void *base, siz
memcpy(&gdt64_start + slotoff, &sd, sizeof(sd));
}
-static void init_tss()
+static void init_tss(void)
{
memset(&prekern_tss, 0, sizeof(prekern_tss));
prekern_tss.tss_ist[0] = (uintptr_t)(&faultstack[PAGE_SIZE-1]) & ~0xf;
@@ -201,7 +201,7 @@ static void init_tss()
sizeof(struct x86_64_tss) - 1, SDT_SYS386TSS, SEL_KPL, 0);
}
-static void init_idt()
+static void init_idt(void)
{
struct region_descriptor region;
struct gate_descriptor *idt;
@@ -237,7 +237,7 @@ struct prekern_args {
struct prekern_args pkargs;
static void
-init_prekern_args()
+init_prekern_args(void)
{
extern struct bootspace bootspace;
extern int esym;
@@ -353,4 +353,3 @@ init_prekern(paddr_t pa_start)
fatal("init_prekern: unreachable!");
}
-
Index: src/sys/arch/amd64/stand/prekern/prekern.h
diff -u src/sys/arch/amd64/stand/prekern/prekern.h:1.11 src/sys/arch/amd64/stand/prekern/prekern.h:1.12
--- src/sys/arch/amd64/stand/prekern/prekern.h:1.11 Mon Nov 13 21:14:03 2017
+++ src/sys/arch/amd64/stand/prekern/prekern.h Tue Nov 14 07:06:34 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: prekern.h,v 1.11 2017/11/13 21:14:03 maxv Exp $ */
+/* $NetBSD: prekern.h,v 1.12 2017/11/14 07:06:34 maxv Exp $ */
/*
* Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -87,32 +87,32 @@ struct bootspace {
};
/* console.c */
-void init_cons();
+void init_cons(void);
void print_ext(int, char *);
void print(char *);
void print_state(bool, char *);
-void print_banner();
+void print_banner(void);
/* elf.c */
size_t elf_get_head_size(vaddr_t);
void elf_build_head(vaddr_t);
-void elf_map_sections();
+void elf_map_sections(void);
void elf_build_boot(vaddr_t, paddr_t);
-vaddr_t elf_kernel_reloc();
+vaddr_t elf_kernel_reloc(void);
/* locore.S */
void cpuid(uint32_t, uint32_t, uint32_t *);
void lidt(void *);
-uint64_t rdtsc();
+uint64_t rdtsc(void);
int rdseed(uint64_t *);
-void jump_kernel();
+void jump_kernel(vaddr_t);
/* mm.c */
void mm_init(paddr_t);
paddr_t mm_vatopa(vaddr_t);
-void mm_bootspace_mprotect();
+void mm_bootspace_mprotect(void);
vaddr_t mm_map_segment(int, paddr_t, size_t);
-void mm_map_kernel();
+void mm_map_kernel(void);
/* prekern.c */
void fatal(char *);