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 Add -Wstrict-prototypes, and fi...
details: https://anonhg.NetBSD.org/src/rev/b39e181b949b
branches: trunk
changeset: 357530:b39e181b949b
user: maxv <maxv%NetBSD.org@localhost>
date: Tue Nov 14 07:06:34 2017 +0000
description:
Add -Wstrict-prototypes, and fix each warning.
diffstat:
sys/arch/amd64/stand/prekern/Makefile | 3 ++-
sys/arch/amd64/stand/prekern/console.c | 8 ++++----
sys/arch/amd64/stand/prekern/elf.c | 13 ++++++-------
sys/arch/amd64/stand/prekern/mm.c | 15 +++++++--------
sys/arch/amd64/stand/prekern/prekern.c | 13 ++++++-------
sys/arch/amd64/stand/prekern/prekern.h | 18 +++++++++---------
6 files changed, 34 insertions(+), 36 deletions(-)
diffs (280 lines):
diff -r 9858712c9d85 -r b39e181b949b sys/arch/amd64/stand/prekern/Makefile
--- a/sys/arch/amd64/stand/prekern/Makefile Tue Nov 14 06:43:23 2017 +0000
+++ b/sys/arch/amd64/stand/prekern/Makefile Tue Nov 14 07:06:34 2017 +0000
@@ -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+= -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
diff -r 9858712c9d85 -r b39e181b949b sys/arch/amd64/stand/prekern/console.c
--- a/sys/arch/amd64/stand/prekern/console.c Tue Nov 14 06:43:23 2017 +0000
+++ b/sys/arch/amd64/stand/prekern/console.c Tue Nov 14 07:06:34 2017 +0000
@@ -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 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 @@
print("\n");
}
-void print_banner()
+void print_banner(void)
{
char *banner =
" __________ __ \n"
diff -r 9858712c9d85 -r b39e181b949b sys/arch/amd64/stand/prekern/elf.c
--- a/sys/arch/amd64/stand/prekern/elf.c Tue Nov 14 06:43:23 2017 +0000
+++ b/sys/arch/amd64/stand/prekern/elf.c Tue Nov 14 07:06:34 2017 +0000
@@ -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 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 @@
}
static vaddr_t
-elf_get_entrypoint()
+elf_get_entrypoint(void)
{
Elf_Sym *sym;
size_t i;
@@ -259,7 +259,7 @@
}
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 @@
}
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 @@
/*
* 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 @@
return ent;
}
-
diff -r 9858712c9d85 -r b39e181b949b sys/arch/amd64/stand/prekern/mm.c
--- a/sys/arch/amd64/stand/prekern/mm.c Tue Nov 14 06:43:23 2017 +0000
+++ b/sys/arch/amd64/stand/prekern/mm.c Tue Nov 14 07:06:34 2017 +0000
@@ -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 @@
}
void
-mm_bootspace_mprotect()
+mm_bootspace_mprotect(void)
{
int prot;
size_t i;
@@ -196,14 +196,14 @@
}
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 @@
}
static paddr_t
-bootspace_getend()
+bootspace_getend(void)
{
paddr_t pa, max = 0;
size_t i;
@@ -344,7 +344,7 @@
}
static void
-mm_map_boot()
+mm_map_boot(void)
{
size_t i, npages, size;
vaddr_t randva;
@@ -401,7 +401,7 @@
* 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_boot();
print_state(true, "Boot region mapped");
}
-
diff -r 9858712c9d85 -r b39e181b949b sys/arch/amd64/stand/prekern/prekern.c
--- a/sys/arch/amd64/stand/prekern/prekern.c Tue Nov 14 06:43:23 2017 +0000
+++ b/sys/arch/amd64/stand/prekern/prekern.c Tue Nov 14 07:06:34 2017 +0000
@@ -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 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 @@
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 @@
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 pkargs;
static void
-init_prekern_args()
+init_prekern_args(void)
{
extern struct bootspace bootspace;
extern int esym;
@@ -353,4 +353,3 @@
fatal("init_prekern: unreachable!");
}
-
diff -r 9858712c9d85 -r b39e181b949b sys/arch/amd64/stand/prekern/prekern.h
--- a/sys/arch/amd64/stand/prekern/prekern.h Tue Nov 14 06:43:23 2017 +0000
+++ b/sys/arch/amd64/stand/prekern/prekern.h Tue Nov 14 07:06:34 2017 +0000
@@ -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 @@
};
/* 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 *);
Home |
Main Index |
Thread Index |
Old Index