x32 is now compiling

This commit is contained in:
Alex
2023-03-04 21:17:19 +02:00
parent aa29c8a415
commit 5c91f23527
57 changed files with 1217 additions and 573 deletions

View File

@ -972,15 +972,39 @@ static uint64_t sys_arch_prctl(int code, unsigned long arg2, unsigned long arg3,
switch (code)
{
case 0x1001: // ARCH_SET_GS
{
#if defined(a64)
CPU::x64::wrmsr(CPU::x64::MSRID::MSR_GS_BASE, arg2);
#elif defined(a32)
CPU::x32::wrmsr(CPU::x32::MSRID::MSR_GS_BASE, arg2);
#endif
return arg2;
}
case 0x1002: // ARCH_SET_FS
{
#if defined(a64)
CPU::x64::wrmsr(CPU::x64::MSRID::MSR_FS_BASE, arg2);
#elif defined(a32)
CPU::x32::wrmsr(CPU::x32::MSRID::MSR_FS_BASE, arg2);
#endif
return arg2;
}
case 0x1003: // ARCH_GET_FS
{
#if defined(a64)
return CPU::x64::rdmsr(CPU::x64::MSRID::MSR_FS_BASE);
#elif defined(a32)
return CPU::x32::rdmsr(CPU::x32::MSRID::MSR_FS_BASE);
#endif
}
case 0x1004: // ARCH_GET_GS
{
#if defined(a64)
return CPU::x64::rdmsr(CPU::x64::MSRID::MSR_GS_BASE);
#elif defined(a32)
return CPU::x32::rdmsr(CPU::x32::MSRID::MSR_GS_BASE);
#endif
}
default:
warn("Unimplemented prctl code %#lx (arg2=%lx, arg3=%lx, arg4=%lx, arg5=%lx)", code, arg2, arg3, arg4, arg5);
return -1; /* EINVAL */
@ -2393,7 +2417,7 @@ static void *LinuxSyscallsTable[] = {
uintptr_t HandleLinuxSyscalls(SyscallsFrame *Frame)
{
#if defined(__amd64__)
#if defined(a64)
if (Frame->rax > sizeof(LinuxSyscallsTable))
{
fixme("Syscall %lld not implemented", Frame->rax);
@ -2409,7 +2433,7 @@ uintptr_t HandleLinuxSyscalls(SyscallsFrame *Frame)
uint64_t ret = call(Frame->rdi, Frame->rsi, Frame->rdx, Frame->r10, Frame->r8, Frame->r9);
Frame->rax = ret;
return ret;
#elif defined(__i386__)
#elif defined(__aarch64__)
#elif defined(a32)
#elif defined(aa64)
#endif
}

View File

@ -276,7 +276,7 @@ static void *NativeSyscallsTable[] = {
uintptr_t HandleNativeSyscalls(SyscallsFrame *Frame)
{
#if defined(__amd64__)
#if defined(a64)
// debug("rax: %#llx, rbx: %#llx, rcx: %#llx, rdx: %#llx, rsi: %#llx, rdi: %#llx, rbp: %#llx, r8: %#llx, r9: %#llx, r10: %#llx, r11: %#llx, r12: %#llx, r13: %#llx, r14: %#llx, r15: %#llx", Frame->rax, Frame->rbx, Frame->rcx, Frame->rdx, Frame->rsi, Frame->rdi, Frame->rbp, Frame->r8, Frame->r9, Frame->r10, Frame->r11, Frame->r12, Frame->r13, Frame->r14, Frame->r15);
if (Frame->rax > sizeof(NativeSyscallsTable))
{
@ -294,7 +294,7 @@ uintptr_t HandleNativeSyscalls(SyscallsFrame *Frame)
uintptr_t ret = call((uintptr_t)Frame, Frame->rdi, Frame->rsi, Frame->rdx, Frame->r10, Frame->r8, Frame->r9);
Frame->rax = ret;
return ret;
#elif defined(__i386__)
#elif defined(__aarch64__)
#elif defined(a32)
#elif defined(aa64)
#endif
}

View File

@ -11,7 +11,7 @@ extern "C" uintptr_t SystemCallsHandler(SyscallsFrame *Frame)
CPU::Interrupts(CPU::Enable);
SmartLock(SyscallsLock); /* TODO: This should be replaced or moved somewhere else. */
#if defined(__amd64__)
#if defined(a64)
switch (TaskManager->GetCurrentThread()->Info.Compatibility)
{
case Tasking::TaskCompatibility::Native:
@ -30,9 +30,9 @@ extern "C" uintptr_t SystemCallsHandler(SyscallsFrame *Frame)
break;
}
}
#elif defined(__i386__)
#elif defined(a32)
fixme("System call %lld", Frame->eax);
#elif defined(__aarch64__)
#elif defined(aa64)
fixme("System call");
#endif
return -1;