[OpenBIOS] r534 - trunk/openbios-devel/arch/x86

svn at openbios.org svn at openbios.org
Tue Aug 4 22:37:32 CEST 2009


Author: blueswirl
Date: 2009-08-04 22:37:32 +0200 (Tue, 04 Aug 2009)
New Revision: 534

Modified:
   trunk/openbios-devel/arch/x86/boot.h
   trunk/openbios-devel/arch/x86/context.c
   trunk/openbios-devel/arch/x86/elfload.c
   trunk/openbios-devel/arch/x86/linux_load.c
   trunk/openbios-devel/arch/x86/multiboot.c
Log:
Fix most x86 warnings from Sparse

Signed-off-by: Blue Swirl <blauwirbel at gmail.com>

Modified: trunk/openbios-devel/arch/x86/boot.h
===================================================================
--- trunk/openbios-devel/arch/x86/boot.h	2009-08-02 18:20:53 UTC (rev 533)
+++ trunk/openbios-devel/arch/x86/boot.h	2009-08-04 20:37:32 UTC (rev 534)
@@ -6,9 +6,19 @@
  * the copyright and warranty status of this work.
  */
 
+/* forthload.c */
 int forth_load(struct sys_info *info, const char *filename, const char *cmdline);
+
+/* elfload.c */
 int elf_load(struct sys_info *info, const char *filename, const char *cmdline);
+
+/* linux_load.c */
 int linux_load(struct sys_info *info, const char *file, const char *cmdline);
 
+/* context.c */
+extern struct context *__context;
 unsigned int start_elf(unsigned long entry_point, unsigned long param);
+
+/* boot.c */
+extern struct sys_info sys_info;
 void boot(void);

Modified: trunk/openbios-devel/arch/x86/context.c
===================================================================
--- trunk/openbios-devel/arch/x86/context.c	2009-08-02 18:20:53 UTC (rev 533)
+++ trunk/openbios-devel/arch/x86/context.c	2009-08-04 20:37:32 UTC (rev 534)
@@ -26,7 +26,7 @@
  * It is placed at the bottom of our stack, and loaded by assembly routine
  * to start us up.
  */
-struct context main_ctx __attribute__((section (".initctx"))) = {
+static struct context main_ctx __attribute__((section (".initctx"))) = {
     .gdt_base = (uint32_t) gdt,
     .gdt_limit = GDT_LIMIT,
     .cs = FLAT_CS,

Modified: trunk/openbios-devel/arch/x86/elfload.c
===================================================================
--- trunk/openbios-devel/arch/x86/elfload.c	2009-08-02 18:20:53 UTC (rev 533)
+++ trunk/openbios-devel/arch/x86/elfload.c	2009-08-04 20:37:32 UTC (rev 534)
@@ -30,7 +30,7 @@
 
     if (alloc_size < nmemb || alloc_size < size) {
         printk("calloc overflow: %u, %u\n", nmemb, size);
-        return 0;
+        return NULL;
     }
 
     mem = malloc(alloc_size);
@@ -314,7 +314,7 @@
     int retval = -1;
     int image_retval;
 
-    image_name = image_version = 0;
+    image_name = image_version = NULL;
 
     if (!file_open(filename))
 	goto out;

Modified: trunk/openbios-devel/arch/x86/linux_load.c
===================================================================
--- trunk/openbios-devel/arch/x86/linux_load.c	2009-08-02 18:20:53 UTC (rev 533)
+++ trunk/openbios-devel/arch/x86/linux_load.c	2009-08-04 20:37:32 UTC (rev 534)
@@ -157,7 +157,7 @@
     uint8_t  reserved17[1792];		/* 0x900 - 0x1000 */
 };
 
-uint64_t forced_memsize;
+static uint64_t forced_memsize;
 
 /* Load the first part the file and check if it's Linux */
 static uint32_t load_linux_header(struct linux_header *hdr)
@@ -294,14 +294,14 @@
     int len;
     int k_len;
     int to_kern;
-    char *initrd = 0;
+    char *initrd = NULL;
     int toolong = 0;
 
     forced_memsize = 0;
 
     if (!orig_cmdline) {
 	*kern_cmdline = 0;
-	return 0;
+        return NULL;
     }
 
     k_len = 0;
@@ -328,7 +328,7 @@
 	    val = sep + 1;
 	    len = end - val;
 	} else {
-	    val = 0;
+            val = NULL;
 	    len = 0;
 	}
 
@@ -610,7 +610,7 @@
     struct linux_header hdr;
     struct linux_params *params;
     uint32_t kern_addr, kern_size;
-    char *initrd_file = 0;
+    char *initrd_file = NULL;
 
     if (!file_open(file))
 	return -1;

Modified: trunk/openbios-devel/arch/x86/multiboot.c
===================================================================
--- trunk/openbios-devel/arch/x86/multiboot.c	2009-08-02 18:20:53 UTC (rev 533)
+++ trunk/openbios-devel/arch/x86/multiboot.c	2009-08-04 20:37:32 UTC (rev 534)
@@ -14,7 +14,8 @@
 struct mbheader {
     unsigned int magic, flags, checksum;
 };
-const struct mbheader multiboot_header
+
+static const struct mbheader multiboot_header
 	__attribute__((section (".hdr"))) =
 {
     MULTIBOOT_HEADER_MAGIC,




More information about the OpenBIOS mailing list