Kernel: Fix 32 bit target compile and runtime
Apparently I have to reload stack in the fork trampoline. Not sure why or why not on x86_64. Also sse builtins did not compile
This commit is contained in:
parent
74f70ae4bd
commit
12489a4c6b
|
|
@ -63,7 +63,7 @@ sys_fork_trampoline:
|
||||||
|
|
||||||
call read_ip
|
call read_ip
|
||||||
testl %eax, %eax
|
testl %eax, %eax
|
||||||
jz .done
|
jz .reload_stack
|
||||||
|
|
||||||
movl %esp, %ebx
|
movl %esp, %ebx
|
||||||
|
|
||||||
|
|
@ -79,3 +79,9 @@ sys_fork_trampoline:
|
||||||
popl %ebx
|
popl %ebx
|
||||||
popl %ebp
|
popl %ebp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.reload_stack:
|
||||||
|
call get_thread_start_sp
|
||||||
|
movl %eax, %esp
|
||||||
|
xorl %eax, %eax
|
||||||
|
jmp .done
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
movw %ax, %ds
|
movw %ax, %ds
|
||||||
movw %ax, %es
|
movw %ax, %es
|
||||||
movw %ax, %fs
|
movw %ax, %fs
|
||||||
|
|
||||||
movw $0x28, %ax
|
movw $0x28, %ax
|
||||||
movw %ax, %gs
|
movw %ax, %gs
|
||||||
1:
|
1:
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ namespace Kernel
|
||||||
asm volatile("wrmsr" :: "d"(val_hi), "a"(val_lo), "c"(MSR_IA32_GS_BASE));
|
asm volatile("wrmsr" :: "d"(val_hi), "a"(val_lo), "c"(MSR_IA32_GS_BASE));
|
||||||
}
|
}
|
||||||
#elif ARCH(i686)
|
#elif ARCH(i686)
|
||||||
asm volatile("movw %0, %%gs" :: "r"(0x28));
|
asm volatile("movw %0, %%gs" :: "r"(static_cast<uint16_t>(0x28)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ARCH(x86_64)
|
#if ARCH(x86_64)
|
||||||
|
|
|
||||||
|
|
@ -910,7 +910,8 @@ namespace Kernel
|
||||||
#if ARCH(x86_64)
|
#if ARCH(x86_64)
|
||||||
__builtin_ia32_fxsave64(m_sse_storage);
|
__builtin_ia32_fxsave64(m_sse_storage);
|
||||||
#elif ARCH(i686)
|
#elif ARCH(i686)
|
||||||
__builtin_ia32_fxsave(m_sse_storage);
|
// no idea why the builtin don't work
|
||||||
|
asm volatile("fxsave %0" :: "m"(m_sse_storage));
|
||||||
#else
|
#else
|
||||||
#error
|
#error
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -921,7 +922,8 @@ namespace Kernel
|
||||||
#if ARCH(x86_64)
|
#if ARCH(x86_64)
|
||||||
__builtin_ia32_fxrstor64(m_sse_storage);
|
__builtin_ia32_fxrstor64(m_sse_storage);
|
||||||
#elif ARCH(i686)
|
#elif ARCH(i686)
|
||||||
__builtin_ia32_fxrstor(m_sse_storage);
|
// no idea why the builtin don't work
|
||||||
|
asm volatile("fxrstor %0" :: "m"(m_sse_storage));
|
||||||
#else
|
#else
|
||||||
#error
|
#error
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue