On 12/16/2011 03:15 PM, Julian Pidancet wrote:
The real-mode emulator that Windows 7 uses to execute the vga bios rom
becomes very confused when the code tries to dereference the stack
pointer instead of using the frame pointer, leading to corruption of
parameters passed on the stack from one function to another.

Signed-off-by: Julian Pidancet<[email protected]>
---
  Makefile |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index c3ba2f3..cb00958 100644
--- a/Makefile
+++ b/Makefile
@@ -32,14 +32,14 @@ COMMONCFLAGS = -I$(OUT) -Os -MD \
                 $(call cc-option,$(CC),-Wtype-limits,) \
                 -m32 -march=i386 -mregparm=3 -mpreferred-stack-boundary=2 \
                 -mrtd -minline-all-stringops \
-               -freg-struct-return -ffreestanding -fomit-frame-pointer \
+               -freg-struct-return -ffreestanding \
                 -fno-delete-null-pointer-checks \
                 -ffunction-sections -fdata-sections -fno-common
  COMMONCFLAGS += $(call cc-option,$(CC),-nopie,)
  COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
  COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)

-CFLAGS32FLAT = $(COMMONCFLAGS) -g -DMODE16=0 -DMODESEGMENT=0
+CFLAGS32FLAT = $(COMMONCFLAGS) -fomit-frame-pointer -g -DMODE16=0 
-DMODESEGMENT=0
  CFLAGSSEG = $(COMMONCFLAGS) -DMODESEGMENT=1 -fno-defer-pop \
              $(call cc-option,$(CC),-fno-jump-tables,-DMANUAL_NO_JUMP_TABLE) \
              $(call cc-option,$(CC),-fno-tree-switch-conversion,)

Ouch.  I can imagine how fun it must have been to debug this.  Good catch.

Paolo

_______________________________________________
SeaBIOS mailing list
[email protected]
http://www.seabios.org/mailman/listinfo/seabios

Reply via email to