Fix x86 warnings, enable more warnings

git-svn-id: svn://coreboot.org/openbios/openbios-devel@359 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2009-01-06 18:46:22 +00:00
parent 251d1101ca
commit 1b47a7ee96
13 changed files with 60 additions and 27 deletions

View File

@@ -15,11 +15,6 @@
#include "sys_info.h" #include "sys_info.h"
#include "boot.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; struct sys_info sys_info;
void boot(void) void boot(void)

View File

@@ -11,3 +11,4 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline);
int linux_load(struct sys_info *info, const char *file, const char *cmdline); int linux_load(struct sys_info *info, const char *file, const char *cmdline);
unsigned int start_elf(unsigned long entry_point, unsigned long param); unsigned int start_elf(unsigned long entry_point, unsigned long param);
void boot(void);

View File

@@ -19,7 +19,6 @@
#define ADDRMASK 0x00ffffff #define ADDRMASK 0x00ffffff
/* #define ADDRMASK 0xffffffff // old behavior */ /* #define ADDRMASK 0xffffffff // old behavior */
extern unsigned int start_elf(unsigned long entry_point, unsigned long param);
extern char _start, _end; extern char _start, _end;
static char *image_name, *image_version; static char *image_name, *image_version;
@@ -212,7 +211,7 @@ static int verify_image(Elf_ehdr *ehdr, Elf_phdr *phdr, int phnum,
return 1; return 1;
} }
static inline unsigned const padded(unsigned s) static inline unsigned padded(unsigned s)
{ {
return (s + 3) & ~3; return (s + 3) & ~3;
} }
@@ -310,7 +309,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline)
Elf_phdr *phdr = NULL; Elf_phdr *phdr = NULL;
unsigned long phdr_size; unsigned long phdr_size;
unsigned long checksum_offset; unsigned long checksum_offset;
unsigned short checksum; unsigned short checksum = 0;
Elf_Bhdr *boot_notes = NULL; Elf_Bhdr *boot_notes = NULL;
int retval = -1; int retval = -1;
int image_retval; int image_retval;

View File

@@ -22,7 +22,7 @@ struct eregs {
uint32_t eflags; uint32_t eflags;
}; };
static char *exception_names[]= { static const char * const exception_names[]= {
"division by zero", "division by zero",
"single step", "single step",
"NMI", "NMI",

View File

@@ -45,7 +45,7 @@ void *malloc(int size)
if(memsize>=size) { if(memsize>=size) {
memsize-=size; memsize-=size;
ret=memptr; ret=memptr;
memptr+=size; memptr = (void *)((unsigned long)memptr + size);
} }
return ret; return ret;
} }

View File

@@ -65,7 +65,7 @@ void collect_multiboot_info(struct sys_info *info)
mod = (module_t *) mbinfo->mods_addr; mod = (module_t *) mbinfo->mods_addr;
info->dict_start=(unsigned long *)mod->mod_start; info->dict_start=(unsigned long *)mod->mod_start;
info->dict_end=(unsigned long *)mod->mod_end; 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); info->dict_start, info->dict_end);
if (mbinfo->flags & MULTIBOOT_MMAP_VALID) { if (mbinfo->flags & MULTIBOOT_MMAP_VALID) {

View File

@@ -19,7 +19,7 @@
void boot(void); void boot(void);
static char intdict[256 * 1024]; static unsigned char intdict[256 * 1024];
static void init_memory(void) static void init_memory(void)
{ {

View File

@@ -10,6 +10,8 @@ ARCH := x86
ODIR := obj-$(ARCH) ODIR := obj-$(ARCH)
HOSTCC := gcc HOSTCC := gcc
HOSTCFLAGS := -O2 -g -Wall -W -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS) 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 HOSTINCLUDES := -Iinclude -Ikernel/include -I$(ODIR)/target/include
#TARGET=i386-elf- #TARGET=i386-elf-
@@ -21,13 +23,12 @@ LD := $(TARGET)ld
NM := $(TARGET)nm NM := $(TARGET)nm
STRIP := $(TARGET)strip STRIP := $(TARGET)strip
RANLIB := $(TARGET)ranlib RANLIB := $(TARGET)ranlib
CFLAGS := -Os -Wall -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH -USWAP_ENDIANNESS -fno-builtin -g
ifeq ($(shell uname), Linux) CFLAGS+= -m32
LIBDL_LDFLAGS=-ldl CFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
endif CFLAGS+= -Wundef -Wendif-labels -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes
CFLAGS := -m32 -Os -Wall -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH -USWAP_ENDIANNESS -fno-builtin
INCLUDES := -Iinclude -Ikernel/include -I$(ODIR)/target/include INCLUDES := -Iinclude -Ikernel/include -I$(ODIR)/target/include
AS_FLAGS := -Wa,-32 -g
# #
# pre rules # pre rules
@@ -37,15 +38,20 @@ all: versions dictionaries host-libraries target-libraries host-executables targ
VERSION := "1.0RC1" VERSION := "1.0RC1"
versions: $(ODIR)/forth/version.fs versions: $(ODIR)/target/include/openbios-version.h $(ODIR)/forth/version.fs
$(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'`)" ; \ @DATE="$(shell echo `LC_ALL=C TZ=UTC date +'%b %e %Y %H:%M'`)" ; \
( echo ": builddate \" $$DATE\" ; " ; \ ( echo ": builddate \" $$DATE\" ; " ; \
echo ": version \" $(VERSION)\" ; " ; ) \ echo ": version \" $(VERSION)\" ; " ; ) \
> $(dir $@)/version.fs > $(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> ]]></pre>
<!-- host compiler build rules --> <!-- host compiler build rules -->

View File

@@ -10,6 +10,8 @@ ARCH := x86
ODIR := obj-$(ARCH) ODIR := obj-$(ARCH)
HOSTCC := gcc HOSTCC := gcc
HOSTCFLAGS := -O2 -g -Wall -W -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS) 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 HOSTINCLUDES := -Iinclude -Ikernel/include -I$(ODIR)/target/include
CC := gcc CC := gcc
@@ -23,8 +25,12 @@ ifeq ($(shell uname), Linux)
LIBDL_LDFLAGS=-ldl LIBDL_LDFLAGS=-ldl
endif 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 INCLUDES := -Iinclude -Ikernel/include -I$(ODIR)/target/include
AS_FLAGS := -Wa,-32 -g
# #
# pre rules # pre rules
@@ -34,15 +40,20 @@ all: versions dictionaries host-libraries target-libraries host-executables targ
VERSION := "1.0RC1" VERSION := "1.0RC1"
versions: $(ODIR)/forth/version.fs versions: $(ODIR)/target/include/openbios-version.h $(ODIR)/forth/version.fs
$(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'`)" ; \ @DATE="$(shell echo `LC_ALL=C TZ=UTC date +'%b %e %Y %H:%M'`)" ; \
( echo ": builddate \" $$DATE\" ; " ; \ ( echo ": builddate \" $$DATE\" ; " ; \
echo ": version \" $(VERSION)\" ; " ; ) \ echo ": version \" $(VERSION)\" ; " ; ) \
> $(dir $@)/version.fs > $(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> ]]></pre>
<!-- host compiler build rules --> <!-- host compiler build rules -->

View File

@@ -9,8 +9,8 @@ struct sys_info {
unsigned long boot_data; unsigned long boot_data;
unsigned long boot_arg; unsigned long boot_arg;
char *firmware; /* "PCBIOS", "LinuxBIOS", etc. */ const char *firmware; /* "PCBIOS", "LinuxBIOS", etc. */
char *command_line; /* command line given to us */ const char *command_line; /* command line given to us */
/* memory map */ /* memory map */
int n_memranges; int n_memranges;

View File

@@ -8,6 +8,7 @@ extern unsigned long virt_offset;
#define phys_to_virt(phys) ((void *) ((unsigned long) (phys) - virt_offset)) #define phys_to_virt(phys) ((void *) ((unsigned long) (phys) - virt_offset))
#define virt_to_phys(virt) ((unsigned long) (virt) + virt_offset) #define virt_to_phys(virt) ((unsigned long) (virt) + virt_offset)
#ifndef BOOTSTRAP
#define __SLOW_DOWN_IO "outb %%al,$0x80;" #define __SLOW_DOWN_IO "outb %%al,$0x80;"
static inline void slow_down_io(void) static inline void slow_down_io(void)
{ {
@@ -50,4 +51,23 @@ BUILDIO(w,w,short)
BUILDIO(l,,int) BUILDIO(l,,int)
#endif #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 #endif

View File

@@ -3,7 +3,7 @@
#include "asm/io.h" #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 */ #define PCI_CONFIG_1 1 /* default */
#endif #endif

View File

@@ -67,7 +67,8 @@ static unsigned long count_lb_records(void *start, unsigned long length)
count = 0; count = 0;
end = ((char *)start) + length; end = ((char *)start) + length;
for(rec = start; ((void *)rec < end) && 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)) { rec = (void *)(((char *)rec) + rec->size)) {
count++; count++;
} }