From 63a54736f31f9e11da6fb52319bba26e7d24f571 Mon Sep 17 00:00:00 2001 From: Jason Wessel Date: Tue, 26 Jan 2010 16:29:50 -0600 Subject: target-i386: fix crash on x86 32bit linux host with hw breakpoint exceptions If you make use of hw breakpoints on a 32bit x86 linux host, qemu will segmentation fault when processing the exception. The problem is that the value of env is stored in $ebp in the op_helper raise_exception() function, and it can have the wrong value when calling it from non generated code. It is possible to work around the problem by restoring the value of env before calling raise_exception() using a new helper function that takes (CPUState *) as one of the arguments. Signed-off-by: Jason Wessel Signed-off-by: Aurelien Jarno --- target-i386/op_helper.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'target-i386/op_helper.c') diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c index 5eea3221b3..4bb434708c 100644 --- a/target-i386/op_helper.c +++ b/target-i386/op_helper.c @@ -1351,6 +1351,11 @@ void raise_exception(int exception_index) raise_interrupt(exception_index, 0, 0, 0); } +void raise_exception_env(int exception_index, CPUState *nenv) +{ + env = nenv; + raise_exception(exception_index); +} /* SMM support */ #if defined(CONFIG_USER_ONLY) -- cgit v1.2.3