mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-16 07:27:35 +00:00
parent
43c73eff13
commit
a7dd2b3171
@ -17,11 +17,17 @@
|
||||
#include <base/stdint.h>
|
||||
|
||||
namespace Abi {
|
||||
|
||||
/**
|
||||
* On ARM a call (or branch) will not change the stack pointer, so we do not
|
||||
* need stack adjustment
|
||||
*/
|
||||
static constexpr Genode::size_t stack_adjustment() { return 0; }
|
||||
|
||||
/**
|
||||
* Do ABI specific initialization to a freshly created stack
|
||||
*/
|
||||
inline void init_stack(Genode::addr_t) { }
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__ARM__CPU__CONSTS_H_ */
|
||||
|
@ -39,6 +39,20 @@ namespace Abi {
|
||||
* On x86 a call will result in a growth of the stack by machine word size
|
||||
*/
|
||||
static constexpr Genode::size_t stack_adjustment() { return sizeof(Genode::addr_t); }
|
||||
|
||||
/**
|
||||
* Do ABI specific initialization to a freshly created stack
|
||||
*
|
||||
* \param stack_top top of the stack
|
||||
*/
|
||||
inline void init_stack(Genode::addr_t const stack_top)
|
||||
{
|
||||
/*
|
||||
* The value at the top of the stack might get interpreted as return
|
||||
* address of the thread start function by GDB, so we set it to 0.
|
||||
*/
|
||||
*(Genode::addr_t *)stack_top = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__X86__CPU__CONSTS_H_ */
|
||||
|
@ -91,12 +91,7 @@ Thread_base::_alloc_context(size_t stack_size, bool main_thread)
|
||||
context->stack_base = ds_addr;
|
||||
context->ds_cap = ds_cap;
|
||||
|
||||
/*
|
||||
* The value at the top of the stack might get interpreted as return
|
||||
* address of the thread start function by GDB, so we set it to 0.
|
||||
*/
|
||||
*(addr_t*)context->stack_top() = 0;
|
||||
|
||||
Abi::init_stack(context->stack_top());
|
||||
return context;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user