diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2008-02-27 10:41:41 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2008-02-27 10:41:41 -0500 |
commit | 786502d7838fb7ae0488bd0302415c842f791afb (patch) | |
tree | 2ccb1656bfcb880d9cff8c993d9b47c4adcd21db | |
parent | a2e7380fdfd466c275f61ea1745ed8a5ec4a90f8 (diff) | |
download | seabios-hppa-786502d7838fb7ae0488bd0302415c842f791afb.zip seabios-hppa-786502d7838fb7ae0488bd0302415c842f791afb.tar.gz seabios-hppa-786502d7838fb7ae0488bd0302415c842f791afb.tar.bz2 |
Some cleanups based on patch by Nguyen Anh Quynh
Add include guards to header files.
Disable stack protector on gcc versions with that option.
Fix lds bug in src/rombios32.lds.S
Don't forward declare "struct bregs;" - it may be confusing gcc on some versions.
-rw-r--r-- | Makefile | 12 | ||||
-rw-r--r-- | src/disk.h | 6 | ||||
-rw-r--r-- | src/farptr.h | 4 | ||||
-rw-r--r-- | src/rombios32.lds.S | 2 | ||||
-rw-r--r-- | src/util.h | 15 |
5 files changed, 30 insertions, 9 deletions
@@ -11,9 +11,17 @@ OUT=out/ SRC16=floppy.c disk.c system.c clock.c serial.c kbd.c mouse.c output.c boot.c SRC32=post.c output.c +cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \ + /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;) + # Default compiler flags -CFLAGS = -Wall -g -Os -MD -m32 -march=i386 -mregparm=2 -ffreestanding -CFLAGS16 = -Wall -Os -MD -m32 -DMODE16 -march=i386 -mregparm=2 -ffreestanding -fno-jump-tables +COMMONCFLAGS = -Wall -Os -MD -m32 -march=i386 -mregparm=2 -ffreestanding +COMMONCFLAGS += $(call cc-option,$(CC),-nopie,) +COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) +COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) + +CFLAGS = $(COMMONCFLAGS) -g +CFLAGS16 = $(COMMONCFLAGS) -DMODE16 -fno-jump-tables all: $(OUT) $(OUT)rom.bin @@ -3,8 +3,11 @@ // Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net> // // This file may be distributed under the terms of the GNU GPLv3 license. +#ifndef __DISK_H +#define __DISK_H #include "ioport.h" // outb +#include "biosvar.h" // struct bregs #define DISK_RET_SUCCESS 0x00 #define DISK_RET_EPARAM 0x01 @@ -15,6 +18,7 @@ #define DISK_RET_EMEDIA 0xC0 // floppy.c -struct bregs; void floppy_13(struct bregs *regs, u8 drive); void floppy_tick(); + +#endif // disk.h diff --git a/src/farptr.h b/src/farptr.h index 86179cc..7216f23 100644 --- a/src/farptr.h +++ b/src/farptr.h @@ -3,6 +3,8 @@ // Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net> // // This file may be distributed under the terms of the GNU GPLv3 license. +#ifndef __FARPTR_H +#define __FARPTR_H #define READ8_SEG(SEG, var) ({ \ u8 __value; \ @@ -97,3 +99,5 @@ extern void __force_link_error__unknown_type(); #define GET_FARPTR(ptr) (ptr) #define SET_FARPTR(ptr, val) do { (var) = (val); } while (0) #endif + +#endif // farptr.h diff --git a/src/rombios32.lds.S b/src/rombios32.lds.S index 18b8ab0..5d7e772 100644 --- a/src/rombios32.lds.S +++ b/src/rombios32.lds.S @@ -9,7 +9,7 @@ #include "../out/rom16.offset.auto.h" OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") -OUTPUT_ARCH(i386) +OUTPUT_ARCH("i386") ENTRY(_start); SECTIONS { @@ -3,16 +3,20 @@ // Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net> // // This file may be distributed under the terms of the GNU GPLv3 license. +#ifndef __UTIL_H +#define __UTIL_H #include "ioport.h" // outb #include "biosvar.h" // struct bregs -static inline void irq_disable(void) { - asm volatile("cli": : :"memory"); +static inline void irq_disable(void) +{ + asm volatile("cli": : :"memory"); } -static inline void irq_enable(void) { - asm volatile("sti": : :"memory"); +static inline void irq_enable(void) +{ + asm volatile("sti": : :"memory"); } static inline unsigned long irq_save(void) @@ -91,7 +95,6 @@ void call16(struct bregs *callregs) // output.c void bprintf(u16 action, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); -struct bregs; void __debug_enter(const char *fname, struct bregs *regs); void __debug_exit(const char *fname, struct bregs *regs); #define debug_enter(regs) \ @@ -115,3 +118,5 @@ handle_ret(struct bregs *regs, u8 code) regs->ah = code; set_cf(regs, code); } + +#endif // util.h |