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
This commit is contained in:
Ingo Weinhold 2006-01-17 02:21:17 +00:00
parent 5fb1a4102a
commit bae7848e66

View File

@ -17,13 +17,21 @@ arch_call_init(image_t *image)
// This calls the init code in crti.S (in glue/arch/x86/) // 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 // 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. // 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 void
arch_call_term(image_t *image) 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));
} }