Author: blueswirl Date: 2009-01-06 19:46:22 +0100 (Tue, 06 Jan 2009) New Revision: 359
Modified: openbios-devel/arch/x86/boot.c openbios-devel/arch/x86/boot.h openbios-devel/arch/x86/elfload.c openbios-devel/arch/x86/exception.c openbios-devel/arch/x86/lib.c openbios-devel/arch/x86/multiboot.c openbios-devel/arch/x86/openbios.c openbios-devel/config/examples/cross-x86_rules.xml openbios-devel/config/examples/x86_rules.xml openbios-devel/include/sys_info.h openbios-devel/include/x86/io.h openbios-devel/include/x86/pci.h openbios-devel/modules/linuxbios.c Log: Fix x86 warnings, enable more warnings
Modified: openbios-devel/arch/x86/boot.c =================================================================== --- openbios-devel/arch/x86/boot.c 2009-01-06 18:09:22 UTC (rev 358) +++ openbios-devel/arch/x86/boot.c 2009-01-06 18:46:22 UTC (rev 359) @@ -15,11 +15,6 @@ #include "sys_info.h" #include "boot.h"
-int elf_load(struct sys_info *, const char *filename, const char *cmdline); -int linux_load(struct sys_info *, const char *filename, const char *cmdline); - -void boot(void); - struct sys_info sys_info;
void boot(void)
Modified: openbios-devel/arch/x86/boot.h =================================================================== --- openbios-devel/arch/x86/boot.h 2009-01-06 18:09:22 UTC (rev 358) +++ openbios-devel/arch/x86/boot.h 2009-01-06 18:46:22 UTC (rev 359) @@ -11,3 +11,4 @@ int linux_load(struct sys_info *info, const char *file, const char *cmdline);
unsigned int start_elf(unsigned long entry_point, unsigned long param); +void boot(void);
Modified: openbios-devel/arch/x86/elfload.c =================================================================== --- openbios-devel/arch/x86/elfload.c 2009-01-06 18:09:22 UTC (rev 358) +++ openbios-devel/arch/x86/elfload.c 2009-01-06 18:46:22 UTC (rev 359) @@ -19,7 +19,6 @@ #define ADDRMASK 0x00ffffff /* #define ADDRMASK 0xffffffff // old behavior */
-extern unsigned int start_elf(unsigned long entry_point, unsigned long param); extern char _start, _end;
static char *image_name, *image_version; @@ -212,7 +211,7 @@ return 1; }
-static inline unsigned const padded(unsigned s) +static inline unsigned padded(unsigned s) { return (s + 3) & ~3; } @@ -310,7 +309,7 @@ Elf_phdr *phdr = NULL; unsigned long phdr_size; unsigned long checksum_offset; - unsigned short checksum; + unsigned short checksum = 0; Elf_Bhdr *boot_notes = NULL; int retval = -1; int image_retval;
Modified: openbios-devel/arch/x86/exception.c =================================================================== --- openbios-devel/arch/x86/exception.c 2009-01-06 18:09:22 UTC (rev 358) +++ openbios-devel/arch/x86/exception.c 2009-01-06 18:46:22 UTC (rev 359) @@ -22,7 +22,7 @@ uint32_t eflags; };
-static char *exception_names[]= { +static const char * const exception_names[]= { "division by zero", "single step", "NMI",
Modified: openbios-devel/arch/x86/lib.c =================================================================== --- openbios-devel/arch/x86/lib.c 2009-01-06 18:09:22 UTC (rev 358) +++ openbios-devel/arch/x86/lib.c 2009-01-06 18:46:22 UTC (rev 359) @@ -45,7 +45,7 @@ if(memsize>=size) { memsize-=size; ret=memptr; - memptr+=size; + memptr = (void *)((unsigned long)memptr + size); } return ret; }
Modified: openbios-devel/arch/x86/multiboot.c =================================================================== --- openbios-devel/arch/x86/multiboot.c 2009-01-06 18:09:22 UTC (rev 358) +++ openbios-devel/arch/x86/multiboot.c 2009-01-06 18:46:22 UTC (rev 359) @@ -65,7 +65,7 @@ mod = (module_t *) mbinfo->mods_addr; info->dict_start=(unsigned long *)mod->mod_start; info->dict_end=(unsigned long *)mod->mod_end; - debug("multiboot: dictionary at %x-%x\n", + debug("multiboot: dictionary at %p-%p\n", info->dict_start, info->dict_end);
if (mbinfo->flags & MULTIBOOT_MMAP_VALID) {
Modified: openbios-devel/arch/x86/openbios.c =================================================================== --- openbios-devel/arch/x86/openbios.c 2009-01-06 18:09:22 UTC (rev 358) +++ openbios-devel/arch/x86/openbios.c 2009-01-06 18:46:22 UTC (rev 359) @@ -19,7 +19,7 @@
void boot(void);
-static char intdict[256 * 1024]; +static unsigned char intdict[256 * 1024];
static void init_memory(void) {
Modified: openbios-devel/config/examples/cross-x86_rules.xml =================================================================== --- openbios-devel/config/examples/cross-x86_rules.xml 2009-01-06 18:09:22 UTC (rev 358) +++ openbios-devel/config/examples/cross-x86_rules.xml 2009-01-06 18:46:22 UTC (rev 359) @@ -10,6 +10,8 @@ ODIR := obj-$(ARCH) HOSTCC := gcc HOSTCFLAGS := -O2 -g -Wall -W -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS) +HOSTCFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations +HOSTCFLAGS+= -Wundef -Wendif-labels -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes HOSTINCLUDES := -Iinclude -Ikernel/include -I$(ODIR)/target/include
#TARGET=i386-elf- @@ -21,13 +23,12 @@ NM := $(TARGET)nm STRIP := $(TARGET)strip RANLIB := $(TARGET)ranlib - -ifeq ($(shell uname), Linux) - LIBDL_LDFLAGS=-ldl -endif - -CFLAGS := -m32 -Os -Wall -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH -USWAP_ENDIANNESS -fno-builtin +CFLAGS := -Os -Wall -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH -USWAP_ENDIANNESS -fno-builtin -g +CFLAGS+= -m32 +CFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations +CFLAGS+= -Wundef -Wendif-labels -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes INCLUDES := -Iinclude -Ikernel/include -I$(ODIR)/target/include +AS_FLAGS := -Wa,-32 -g
# # pre rules @@ -37,15 +38,20 @@
VERSION := "1.0RC1"
-versions: $(ODIR)/forth/version.fs +versions: $(ODIR)/target/include/openbios-version.h $(ODIR)/forth/version.fs
$(ODIR)/forth/version.fs: - @test -d $(dir $@) || $(INSTALL) -d $(dir $@) @DATE="$(shell echo `LC_ALL=C TZ=UTC date +'%b %e %Y %H:%M'`)" ; \ ( echo ": builddate " $$DATE" ; " ; \ echo ": version " $(VERSION)" ; " ; ) \ > $(dir $@)/version.fs
+$(ODIR)/target/include/openbios-version.h: + @DATE="$(shell echo `LC_ALL=C TZ=UTC date +'%b %e %Y %H:%M'`)" ; \ + ( echo "#define OPENBIOS_BUILD_DATE "$$DATE"" ; \ + echo "#define OPENBIOS_VERSION_STR "$(VERSION)"" ; \ + echo "#define OPENBIOS_RELEASE "$(VERSION)"" ; ) \ + > $(dir $@)/openbios-version.h ]]></pre>
<!-- host compiler build rules -->
Modified: openbios-devel/config/examples/x86_rules.xml =================================================================== --- openbios-devel/config/examples/x86_rules.xml 2009-01-06 18:09:22 UTC (rev 358) +++ openbios-devel/config/examples/x86_rules.xml 2009-01-06 18:46:22 UTC (rev 359) @@ -10,6 +10,8 @@ ODIR := obj-$(ARCH) HOSTCC := gcc HOSTCFLAGS := -O2 -g -Wall -W -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS) +HOSTCFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations +HOSTCFLAGS+= -Wundef -Wendif-labels -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes HOSTINCLUDES := -Iinclude -Ikernel/include -I$(ODIR)/target/include
CC := gcc @@ -23,8 +25,12 @@ LIBDL_LDFLAGS=-ldl endif
-CFLAGS := -m32 -Os -Wall -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH -USWAP_ENDIANNESS -fno-builtin +CFLAGS := -Os -Wall -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH -USWAP_ENDIANNESS -fno-builtin -g +CFLAGS+= -m32 +CFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations +CFLAGS+= -Wundef -Wendif-labels -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes INCLUDES := -Iinclude -Ikernel/include -I$(ODIR)/target/include +AS_FLAGS := -Wa,-32 -g
# # pre rules @@ -34,15 +40,20 @@
VERSION := "1.0RC1"
-versions: $(ODIR)/forth/version.fs +versions: $(ODIR)/target/include/openbios-version.h $(ODIR)/forth/version.fs
$(ODIR)/forth/version.fs: - @test -d $(dir $@) || $(INSTALL) -d $(dir $@) @DATE="$(shell echo `LC_ALL=C TZ=UTC date +'%b %e %Y %H:%M'`)" ; \ ( echo ": builddate " $$DATE" ; " ; \ echo ": version " $(VERSION)" ; " ; ) \ > $(dir $@)/version.fs
+$(ODIR)/target/include/openbios-version.h: + @DATE="$(shell echo `LC_ALL=C TZ=UTC date +'%b %e %Y %H:%M'`)" ; \ + ( echo "#define OPENBIOS_BUILD_DATE "$$DATE"" ; \ + echo "#define OPENBIOS_VERSION_STR "$(VERSION)"" ; \ + echo "#define OPENBIOS_RELEASE "$(VERSION)"" ; ) \ + > $(dir $@)/openbios-version.h ]]></pre>
<!-- host compiler build rules -->
Modified: openbios-devel/include/sys_info.h =================================================================== --- openbios-devel/include/sys_info.h 2009-01-06 18:09:22 UTC (rev 358) +++ openbios-devel/include/sys_info.h 2009-01-06 18:46:22 UTC (rev 359) @@ -9,8 +9,8 @@ unsigned long boot_data; unsigned long boot_arg;
- char *firmware; /* "PCBIOS", "LinuxBIOS", etc. */ - char *command_line; /* command line given to us */ + const char *firmware; /* "PCBIOS", "LinuxBIOS", etc. */ + const char *command_line; /* command line given to us */
/* memory map */ int n_memranges;
Modified: openbios-devel/include/x86/io.h =================================================================== --- openbios-devel/include/x86/io.h 2009-01-06 18:09:22 UTC (rev 358) +++ openbios-devel/include/x86/io.h 2009-01-06 18:46:22 UTC (rev 359) @@ -8,6 +8,7 @@ #define phys_to_virt(phys) ((void *) ((unsigned long) (phys) - virt_offset)) #define virt_to_phys(virt) ((unsigned long) (virt) + virt_offset)
+#ifndef BOOTSTRAP #define __SLOW_DOWN_IO "outb %%al,$0x80;" static inline void slow_down_io(void) { @@ -50,4 +51,23 @@ BUILDIO(l,,int) #endif
+#else /* BOOTSTRAP */ +#ifdef FCOMPILER +#define inb(reg) ((u8)0xff) +#define inw(reg) ((u16)0xffff) +#define inl(reg) ((u32)0xffffffff) +#define outb(reg, val) do{} while(0) +#define outw(reg, val) do{} while(0) +#define outl(reg, val) do{} while(0) +#else +extern u8 inb(u32 reg); +extern u16 inw(u32 reg); +extern u32 inl(u32 reg); +extern void insw(u32 reg, void *addr, unsigned long count); +extern void outb(u32 reg, u8 val); +extern void outw(u32 reg, u16 val); +extern void outl(u32 reg, u32 val); +extern void outsw(u32 reg, const void *addr, unsigned long count); #endif +#endif +#endif
Modified: openbios-devel/include/x86/pci.h =================================================================== --- openbios-devel/include/x86/pci.h 2009-01-06 18:09:22 UTC (rev 358) +++ openbios-devel/include/x86/pci.h 2009-01-06 18:46:22 UTC (rev 359) @@ -3,7 +3,7 @@
#include "asm/io.h"
-#if !(PCI_CONFIG_1 || PCI_CONFIG_2) +#if !(defined(PCI_CONFIG_1) || defined(PCI_CONFIG_2)) #define PCI_CONFIG_1 1 /* default */ #endif
Modified: openbios-devel/modules/linuxbios.c =================================================================== --- openbios-devel/modules/linuxbios.c 2009-01-06 18:09:22 UTC (rev 358) +++ openbios-devel/modules/linuxbios.c 2009-01-06 18:46:22 UTC (rev 359) @@ -67,7 +67,8 @@ count = 0; end = ((char *)start) + length; for(rec = start; ((void *)rec < end) && - ((signed long)rec->size <= (end - (void *)rec)); + ((signed long)rec->size <= + ((signed long)end - (signed long)rec)); rec = (void *)(((char *)rec) + rec->size)) { count++; }