mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-09 06:00:15 +02:00
I thought this was incorrect but since it only supports IPC_64 it is actually correct. If a 32-bit application wants to use the old encoding then it needs to use the ipc syscall instead. Fixes #1253
51 lines
1.8 KiB
C++
51 lines
1.8 KiB
C++
/*
|
|
$info$
|
|
tags: LinuxSyscalls|syscalls-shared
|
|
$end_info$
|
|
*/
|
|
|
|
#include "Tests/LinuxSyscalls/Syscalls.h"
|
|
#include "Tests/LinuxSyscalls/x64/Syscalls.h"
|
|
#include "Tests/LinuxSyscalls/x32/Syscalls.h"
|
|
|
|
#include <mqueue.h>
|
|
#include <sys/types.h>
|
|
#include <sys/ipc.h>
|
|
#include <sys/msg.h>
|
|
#include <sys/syscall.h>
|
|
#include <unistd.h>
|
|
|
|
namespace FEX::HLE {
|
|
void RegisterMsg() {
|
|
REGISTER_SYSCALL_IMPL_PASS(msgget, [](FEXCore::Core::CpuStateFrame *Frame, key_t key, int msgflg) -> uint64_t {
|
|
uint64_t Result = ::msgget(key, msgflg);
|
|
SYSCALL_ERRNO();
|
|
});
|
|
|
|
REGISTER_SYSCALL_IMPL_PASS(msgsnd, [](FEXCore::Core::CpuStateFrame *Frame, int msqid, const void *msgp, size_t msgsz, int msgflg) -> uint64_t {
|
|
uint64_t Result = ::msgsnd(msqid, msgp, msgsz, msgflg);
|
|
SYSCALL_ERRNO();
|
|
});
|
|
|
|
REGISTER_SYSCALL_IMPL_PASS(msgrcv, [](FEXCore::Core::CpuStateFrame *Frame, int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg) -> uint64_t {
|
|
uint64_t Result = ::msgrcv(msqid, msgp, msgsz, msgtyp, msgflg);
|
|
SYSCALL_ERRNO();
|
|
});
|
|
|
|
REGISTER_SYSCALL_IMPL_PASS(msgctl, [](FEXCore::Core::CpuStateFrame *Frame, int msqid, int cmd, struct msqid_ds *buf) -> uint64_t {
|
|
// A quirk of this syscall
|
|
// On 32-bit this syscall ONLY supports IPC_64 msqid_ds encoding
|
|
// If an application want to use the old style encoding then it needs to use the ipc syscall with MSGCTL command
|
|
// ipc syscall supports both IPC_64 and old encoding
|
|
uint64_t Result = ::msgctl(msqid, cmd, buf);
|
|
SYSCALL_ERRNO();
|
|
});
|
|
|
|
// last two parameters are optional
|
|
REGISTER_SYSCALL_IMPL_PASS(mq_unlink, [](FEXCore::Core::CpuStateFrame *Frame, const char *name) -> uint64_t {
|
|
uint64_t Result = ::syscall(SYSCALL_DEF(mq_unlink), name);
|
|
SYSCALL_ERRNO();
|
|
});
|
|
}
|
|
}
|