From bae7848e662b0e8ca2d626cf75d3e6a24914b4b2 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 17 Jan 2006 02:21:17 +0000 Subject: [PATCH] We were trashing non-volatile register ebx in the arch_call_{init,term}() functions. Weird things could happen due to that. E.g. application crashes when unloading add-ons. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15994 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../runtime_loader/arch/x86/arch_call_init_term.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/system/runtime_loader/arch/x86/arch_call_init_term.c b/src/system/runtime_loader/arch/x86/arch_call_init_term.c index e0844804d2..e92fcf6a08 100644 --- a/src/system/runtime_loader/arch/x86/arch_call_init_term.c +++ b/src/system/runtime_loader/arch/x86/arch_call_init_term.c @@ -17,13 +17,21 @@ arch_call_init(image_t *image) // This calls the init code in crti.S (in glue/arch/x86/) // It would have been too easy to just call this function with its arguments // on the stack, so Be went the ugly way. Once more. - asm("mov %0, %%ebx; call *%1" : : "g"(image->id), "g"(image->init_routine)); + asm("push %%ebx;" + "mov %0, %%ebx;" + "call *%1;" + "pop %%ebx" + : : "g"(image->id), "g"(image->init_routine)); } void arch_call_term(image_t *image) { - asm("mov %0, %%ebx; call *%1" : : "g"(image->id), "g"(image->term_routine)); + asm("push %%ebx;" + "mov %0, %%ebx;" + "call *%1;" + "pop %%ebx" + : : "g"(image->id), "g"(image->term_routine)); }