kernel: Make sure the stack is 16-byte aligned on program startup
This is required by the System V ABI and fixes some movaps-related GPFs in ndisasm.
This commit is contained in:
parent
795b0ca8d4
commit
ae01a31104
@ -1,6 +1,7 @@
|
||||
#include "thread/ThreadImage.h"
|
||||
#include "memory/MemoryManager.h"
|
||||
#include "thread/Thread.h"
|
||||
#include <luna/Alignment.h>
|
||||
#include <luna/CString.h>
|
||||
|
||||
static constexpr usize DEFAULT_USER_STACK_PAGES = 6;
|
||||
@ -122,7 +123,7 @@ void ThreadImage::apply(Thread* thread)
|
||||
|
||||
thread->kernel_stack = m_kernel_stack;
|
||||
thread->stack = m_user_stack;
|
||||
thread->set_sp(m_sp);
|
||||
thread->set_sp(align_down<16>(m_sp));
|
||||
|
||||
thread->directory = m_directory;
|
||||
|
||||
|
@ -6,5 +6,5 @@ Stack::Stack(u64 base, usize bytes) : m_base(base), m_bytes(bytes)
|
||||
|
||||
u64 Stack::top() const
|
||||
{
|
||||
return (m_base + m_bytes) - sizeof(void*);
|
||||
return (m_base + m_bytes) - 16;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user