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 style



details:   https://anonhg.NetBSD.org/src/rev/9678664486cc
branches:  trunk
changeset: 827893:9678664486cc
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Nov 17 07:07:52 2017 +0000

description:
style

diffstat:

 sys/arch/amd64/stand/prekern/Makefile  |   8 ++++----
 sys/arch/amd64/stand/prekern/console.c |   4 ++--
 sys/arch/amd64/stand/prekern/elf.c     |   3 ++-
 sys/arch/amd64/stand/prekern/pdir.h    |   6 +++---
 sys/arch/amd64/stand/prekern/prekern.c |  22 ++++++++++++----------
 5 files changed, 23 insertions(+), 20 deletions(-)

diffs (159 lines):

diff -r 68fac3ba61b8 -r 9678664486cc sys/arch/amd64/stand/prekern/Makefile
--- a/sys/arch/amd64/stand/prekern/Makefile     Thu Nov 16 23:43:48 2017 +0000
+++ b/sys/arch/amd64/stand/prekern/Makefile     Fri Nov 17 07:07:52 2017 +0000
@@ -1,7 +1,7 @@
-#      $NetBSD: Makefile,v 1.3 2017/11/14 07:06:34 maxv Exp $
+#      $NetBSD: Makefile,v 1.4 2017/11/17 07:07:52 maxv Exp $
 
 PROG=          prekern
-SRCS=  locore.S trap.S prekern.c mm.c console.c elf.c
+SRCS=          locore.S trap.S prekern.c mm.c console.c elf.c
 
 NOSSP=         # defined
 NOPIE=         # defined
@@ -22,8 +22,8 @@
 .include <bsd.klinks.mk>
 
 CPPFLAGS+=     -DKERNEL -D__x86_64__
-CFLAGS+=       -Wall -Werror -mno-red-zone -mno-mmx -mno-sse -mno-avx -ffreestanding
-CFLAGS+=       -Wstrict-prototypes
+CFLAGS+=       -Wall -Werror -Wstrict-prototypes
+CFLAGS+=       -mno-red-zone -mno-mmx -mno-sse -mno-avx -ffreestanding
 STRIPFLAG=
 LINKFLAGS=     -X -z max-page-size=0x100000 -Ttext 0x100000 -T prekern.ldscript
 
diff -r 68fac3ba61b8 -r 9678664486cc sys/arch/amd64/stand/prekern/console.c
--- a/sys/arch/amd64/stand/prekern/console.c    Thu Nov 16 23:43:48 2017 +0000
+++ b/sys/arch/amd64/stand/prekern/console.c    Fri Nov 17 07:07:52 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: console.c,v 1.2 2017/11/14 07:06:34 maxv Exp $ */
+/*     $NetBSD: console.c,v 1.3 2017/11/17 07:07:52 maxv Exp $ */
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -108,7 +108,7 @@
 
 void print_banner(void)
 {
-       char *banner = 
+       char *banner =
                "           __________                 __                        \n"
                "           \\______   \\_______   ____ |  | __ ___________  ____  \n"
                "            |     ___/\\_  __ \\_/ __ \\|  |/ // __ \\_  __ \\/    \\ \n"
diff -r 68fac3ba61b8 -r 9678664486cc sys/arch/amd64/stand/prekern/elf.c
--- a/sys/arch/amd64/stand/prekern/elf.c        Thu Nov 16 23:43:48 2017 +0000
+++ b/sys/arch/amd64/stand/prekern/elf.c        Fri Nov 17 07:07:52 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: elf.c,v 1.15 2017/11/15 20:45:16 maxv Exp $    */
+/*     $NetBSD: elf.c,v 1.16 2017/11/17 07:07:52 maxv Exp $    */
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -292,6 +292,7 @@
                secalign = shdr->sh_addralign;
                ASSERT(shdr->sh_offset != 0);
                ASSERT(secpa % PAGE_SIZE == 0);
+               ASSERT(secpa + secsz <= kernpa_end);
 
                secva = mm_map_segment(segtype, secpa, secsz, secalign);
 
diff -r 68fac3ba61b8 -r 9678664486cc sys/arch/amd64/stand/prekern/pdir.h
--- a/sys/arch/amd64/stand/prekern/pdir.h       Thu Nov 16 23:43:48 2017 +0000
+++ b/sys/arch/amd64/stand/prekern/pdir.h       Fri Nov 17 07:07:52 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pdir.h,v 1.2 2017/11/05 16:27:18 maxv Exp $    */
+/*     $NetBSD: pdir.h,v 1.3 2017/11/17 07:07:52 maxv Exp $    */
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -28,11 +28,11 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#define PREKERNBASE            0x0
+#define PREKERNBASE    0x0
 #define PREKERNTEXTOFF (PREKERNBASE + 0x100000)
 
 #define L4_SLOT_PREKERN        0 /* pl4_i(PREKERNBASE) */
-#define L4_SLOT_PTE            255
+#define L4_SLOT_PTE    255
 
 #define PDIR_SLOT_KERN L4_SLOT_PREKERN
 #define PDIR_SLOT_PTE  L4_SLOT_PTE
diff -r 68fac3ba61b8 -r 9678664486cc sys/arch/amd64/stand/prekern/prekern.c
--- a/sys/arch/amd64/stand/prekern/prekern.c    Thu Nov 16 23:43:48 2017 +0000
+++ b/sys/arch/amd64/stand/prekern/prekern.c    Fri Nov 17 07:07:52 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: prekern.c,v 1.5 2017/11/14 07:06:34 maxv Exp $ */
+/*     $NetBSD: prekern.c,v 1.6 2017/11/17 07:07:52 maxv Exp $ */
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -46,10 +46,9 @@
 
 extern paddr_t kernpa_start, kernpa_end;
 
-extern uint64_t *gdt64_start;
-uint8_t idtstore[PAGE_SIZE];
-uint8_t faultstack[PAGE_SIZE];
-struct x86_64_tss prekern_tss;
+static uint8_t idtstore[PAGE_SIZE];
+static uint8_t faultstack[PAGE_SIZE];
+static struct x86_64_tss prekern_tss;
 
 /* GDT offsets */
 #define PREKERN_GDT_NUL_OFF    (0 * 8)
@@ -117,7 +116,7 @@
        "SSE FP exception",                     /* 19 T_XMM */
        "reserved trap",                        /* 20 T_RESERVED */
 };
-int    trap_types = __arraycount(trap_type);
+static int trap_types = __arraycount(trap_type);
 
 /*
  * Trap handler.
@@ -152,7 +151,7 @@
 
 static void
 setgate(struct gate_descriptor *gd, void *func, int ist, int type, int dpl,
-       int sel)
+    int sel)
 {
        gd->gd_looffset = (uint64_t)func & 0xffff;
        gd->gd_selector = sel;
@@ -169,7 +168,7 @@
 
 static void
 set_sys_segment(struct sys_segment_descriptor *sd, void *base, size_t limit,
-       int type, int dpl, int gran)
+    int type, int dpl, int gran)
 {
        memset(sd, 0, sizeof(*sd));
        sd->sd_lolimit = (unsigned)limit;
@@ -186,13 +185,15 @@
 set_sys_gdt(int slotoff, void *base, size_t limit, int type, int dpl, int gran)
 {
        struct sys_segment_descriptor sd;
+       extern uint64_t *gdt64_start;
 
        set_sys_segment(&sd, base, limit, type, dpl, gran);
 
        memcpy(&gdt64_start + slotoff, &sd, sizeof(sd));
 }
 
-static void init_tss(void)
+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 +202,8 @@
            sizeof(struct x86_64_tss) - 1, SDT_SYS386TSS, SEL_KPL, 0);
 }
 
-static void init_idt(void)
+static void
+init_idt(void)
 {
        struct region_descriptor region;
        struct gate_descriptor *idt;



Home | Main Index | Thread Index | Old Index