[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] tools: caml-stubdom: fix "red zone" bug
# HG changeset patch # User Patrick Colp <pjcolp@xxxxxxxxx> # Date 1288264541 -3600 # Node ID 951222c08589729770af022dd4f5d0ed41bea233 # Parent 2795279e7533b1955112877620b32731aec4ec2d tools: caml-stubdom: fix "red zone" bug According to the AMD64 ABI, the 128-byte area below %rsp is reserved for scratch space and should not be used by signal, interrupt, or exception handlers. However, Mini-OS does not adhere to this interface. As a result, the -mno-red-zone flag must be provided to gcc in order to force code to be compiled without this assumption. In the case of the c-stubdom or the ioemu stubdom, Makefile configuration and flags are inherited from Xen, which includes this flag. However, in the case of the ocaml stubdom, since an independent ocaml version is pulled and compiled, with its own make system in place, this flag is not present. As a default optimisation (no optimisation flags specified), gcc generates function header code that uses mov instead of push (to save a few instructions). However, with the 128-byte scratch space assumption in place, registers are moved onto the stack *before* %rsp is updated. This results in cases where when a function is being called, *after* the first mov <foo>, <offset>(%rsp) but *before* the %rsp update, sub <bar>, %rsp, if an interrupt is fired, then the stack will be clobbered (as Mini-OS uses the application stack for its stack, pushing registers onto the stack on entry and popping them off on exit). This patch fixes this issue by passing the -mno-red-zone flag to the ocaml configure script in the stubdom Makefile. Signed-off-by: Patrick Colp <pjcolp@xxxxxxxxx> Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- stubdom/Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 2795279e7533 -r 951222c08589 stubdom/Makefile --- a/stubdom/Makefile Thu Oct 28 12:05:45 2010 +0100 +++ b/stubdom/Makefile Thu Oct 28 12:15:41 2010 +0100 @@ -200,7 +200,7 @@ cross-ocaml: $(OCAML_STAMPFILE) $(OCAML_STAMPFILE): ocaml-$(XEN_TARGET_ARCH)/.dirstamp cd ocaml-$(XEN_TARGET_ARCH) && ./configure -prefix $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf \ -no-pthread -no-shared-libs -no-tk -no-curses \ - -cc "$(CC) -U_FORTIFY_SOURCE -fno-stack-protector" + -cc "$(CC) -U_FORTIFY_SOURCE -fno-stack-protector -mno-red-zone" $(foreach i,$(MINIOS_HASNOT),sed -i 's,^\(#define HAS_$(i)\),//\1,' ocaml-$(XEN_TARGET_ARCH)/config/s.h ; ) $(CROSS_MAKE) -C ocaml-$(XEN_TARGET_ARCH) world $(CROSS_MAKE) -C ocaml-$(XEN_TARGET_ARCH) opt _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |