mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 13:00:15 +02:00
Merge pull request #1284 from Sonicadvance1/fix_struct_match
StructVerifier: Fix struct match and minor fixes
This commit is contained in:
9 files changed
+62
-16
No files matched your search
@@ -244,7 +244,7 @@ def HandleVarDeclElements(Arch, VarDecl, Cursor):
|
||||
logging.critical ("Can't handle alias type '{0}'".format(Child.spelling))
|
||||
Arch.Parsed = False
|
||||
elif (Child.spelling == "fex-match"):
|
||||
VarDecl.ExpectedFEXMatch = True
|
||||
VarDecl.ExpectFEXMatch = True
|
||||
else:
|
||||
# Unknown annotation
|
||||
pass
|
||||
@@ -317,7 +317,7 @@ def HandleStructElements(Arch, Struct, Cursor):
|
||||
Arch.Parsed = False
|
||||
|
||||
elif (Child.spelling == "fex-match"):
|
||||
Struct.ExpectedFEXMatch = True
|
||||
Struct.ExpectFEXMatch = True
|
||||
else:
|
||||
# Unknown annotation
|
||||
pass
|
||||
|
||||
@@ -18,7 +18,7 @@ $end_info$
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
ARG_TO_STR(FEX::HLE::x32::compat_ptr<FEX::HLE::epoll_event_x86>, "%lx")
|
||||
ARG_TO_STR(FEX::HLE::x32::compat_ptr<FEX::HLE::x32::epoll_event32>, "%lx")
|
||||
ARG_TO_STR(FEX::HLE::x32::compat_ptr<FEX::HLE::x32::timespec32>, "%lx")
|
||||
|
||||
namespace FEXCore::Core {
|
||||
@@ -27,9 +27,9 @@ namespace FEXCore::Core {
|
||||
|
||||
namespace FEX::HLE::x32 {
|
||||
void RegisterEpoll(FEX::HLE::SyscallHandler *const Handler) {
|
||||
REGISTER_SYSCALL_IMPL_X32(epoll_wait, [](FEXCore::Core::CpuStateFrame *Frame, int epfd, compat_ptr<FEX::HLE::epoll_event_x86> events, int maxevents, int timeout) -> uint64_t {
|
||||
REGISTER_SYSCALL_IMPL_X32(epoll_wait, [](FEXCore::Core::CpuStateFrame *Frame, int epfd, compat_ptr<FEX::HLE::x32::epoll_event32> events, int maxevents, int timeout) -> uint64_t {
|
||||
std::vector<struct epoll_event> Events(std::max(0, maxevents));
|
||||
uint64_t Result = ::syscall(SYS_epoll_pwait, epfd, Events.data(), maxevents, timeout, nullptr);
|
||||
uint64_t Result = ::syscall(SYS_epoll_pwait, epfd, Events.data(), maxevents, timeout, nullptr, 8);
|
||||
|
||||
if (Result != -1) {
|
||||
for (size_t i = 0; i < Result; ++i) {
|
||||
@@ -39,16 +39,13 @@ namespace FEX::HLE::x32 {
|
||||
SYSCALL_ERRNO();
|
||||
});
|
||||
|
||||
REGISTER_SYSCALL_IMPL_X32(epoll_ctl, [](FEXCore::Core::CpuStateFrame *Frame, int epfd, int op, int fd, compat_ptr<FEX::HLE::epoll_event_x86> event) -> uint64_t {
|
||||
REGISTER_SYSCALL_IMPL_X32(epoll_ctl, [](FEXCore::Core::CpuStateFrame *Frame, int epfd, int op, int fd, compat_ptr<FEX::HLE::x32::epoll_event32> event) -> uint64_t {
|
||||
struct epoll_event Event = *event;
|
||||
uint64_t Result = ::syscall(SYS_epoll_ctl, epfd, op, fd, &Event);
|
||||
if (Result != -1) {
|
||||
*event = Event;
|
||||
}
|
||||
SYSCALL_ERRNO();
|
||||
});
|
||||
|
||||
REGISTER_SYSCALL_IMPL_X32(epoll_pwait, [](FEXCore::Core::CpuStateFrame *Frame, int epfd, compat_ptr<FEX::HLE::epoll_event_x86> events, int maxevent, int timeout, const uint64_t* sigmask, size_t sigsetsize) -> uint64_t {
|
||||
REGISTER_SYSCALL_IMPL_X32(epoll_pwait, [](FEXCore::Core::CpuStateFrame *Frame, int epfd, compat_ptr<FEX::HLE::x32::epoll_event32> events, int maxevent, int timeout, const uint64_t* sigmask, size_t sigsetsize) -> uint64_t {
|
||||
std::vector<struct epoll_event> Events(std::max(0, maxevent));
|
||||
|
||||
uint64_t Result = ::syscall(SYS_epoll_pwait,
|
||||
@@ -72,7 +69,7 @@ namespace FEX::HLE::x32 {
|
||||
#ifndef SYS_epoll_pwait2
|
||||
#define SYS_epoll_pwait2 354
|
||||
#endif
|
||||
REGISTER_SYSCALL_IMPL_X32(epoll_pwait2, [](FEXCore::Core::CpuStateFrame *Frame, int epfd, compat_ptr<FEX::HLE::epoll_event_x86> events, int maxevent, compat_ptr<timespec32> timeout, const uint64_t* sigmask, size_t sigsetsize) -> uint64_t {
|
||||
REGISTER_SYSCALL_IMPL_X32(epoll_pwait2, [](FEXCore::Core::CpuStateFrame *Frame, int epfd, compat_ptr<FEX::HLE::x32::epoll_event32> events, int maxevent, compat_ptr<timespec32> timeout, const uint64_t* sigmask, size_t sigsetsize) -> uint64_t {
|
||||
std::vector<struct epoll_event> Events(std::max(0, maxevent));
|
||||
|
||||
struct timespec tp64{};
|
||||
|
||||
@@ -21,6 +21,9 @@ namespace FEXCore::Core {
|
||||
struct CpuStateFrame;
|
||||
}
|
||||
|
||||
ARG_TO_STR(FEX::HLE::x32::compat_ptr<FEX::HLE::x32::rlimit32<true>>, "%lx")
|
||||
ARG_TO_STR(FEX::HLE::x32::compat_ptr<FEX::HLE::x32::rlimit32<false>>, "%lx")
|
||||
|
||||
namespace FEX::HLE::x32 {
|
||||
struct sysinfo32 {
|
||||
int32_t uptime;
|
||||
|
||||
@@ -14,6 +14,9 @@ $end_info$
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
ARG_TO_STR(FEX::HLE::x32::compat_ptr<FEX::HLE::x32::mq_attr32>, "%lx")
|
||||
ARG_TO_STR(FEX::HLE::x32::compat_ptr<FEX::HLE::x32::sigevent32>, "%lx")
|
||||
|
||||
namespace FEX::HLE::x32 {
|
||||
void RegisterMsg() {
|
||||
REGISTER_SYSCALL_IMPL_X32(mq_timedsend, [](FEXCore::Core::CpuStateFrame *Frame, mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec32 *abs_timeout) -> uint64_t {
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace FEXCore::Core {
|
||||
struct CpuStateFrame;
|
||||
}
|
||||
|
||||
ARG_TO_STR(FEX::HLE::x32::compat_ptr<FEXCore::x86::siginfo_t>, "%lx")
|
||||
|
||||
namespace FEX::HLE::x32 {
|
||||
void CopySigInfo(FEXCore::x86::siginfo_t *Info, siginfo_t const &Host) {
|
||||
// Copy the basic things first
|
||||
|
||||
@@ -19,6 +19,7 @@ $end_info$
|
||||
#include <utime.h>
|
||||
|
||||
ARG_TO_STR(FEX::HLE::x32::compat_ptr<FEX::HLE::x32::timespec32>, "%lx")
|
||||
ARG_TO_STR(FEX::HLE::x32::compat_ptr<FEX::HLE::x32::timex32>, "%lx")
|
||||
|
||||
struct timespec;
|
||||
namespace FEXCore::Core {
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace FEXCore::Core {
|
||||
struct CpuStateFrame;
|
||||
}
|
||||
|
||||
ARG_TO_STR(FEX::HLE::x32::compat_ptr<FEX::HLE::x32::sigevent32>, "%lx")
|
||||
|
||||
namespace FEX::HLE::x32 {
|
||||
void RegisterTimer() {
|
||||
REGISTER_SYSCALL_IMPL_X32(timer_settime, [](FEXCore::Core::CpuStateFrame *Frame,
|
||||
|
||||
@@ -36,7 +36,6 @@ using compat_long_t = int32_t;
|
||||
using compat_uptr_t = uint32_t;
|
||||
using compat_size_t = uint32_t;
|
||||
using compat_off_t = uint32_t;
|
||||
using compat_loff_t = int64_t;
|
||||
using compat_pid_t = int32_t;
|
||||
using compat_dev_t = uint16_t;
|
||||
using compat_ino_t = uint32_t;
|
||||
@@ -51,6 +50,7 @@ using compat_clock_t = int32_t;
|
||||
// Can't use using with aligned attributes, clang doesn't honour it
|
||||
typedef FEX_ALIGNED(4) uint64_t compat_uint64_t;
|
||||
typedef FEX_ALIGNED(4) int64_t compat_int64_t;
|
||||
typedef FEX_ALIGNED(4) int64_t compat_loff_t;
|
||||
|
||||
template<typename T>
|
||||
class compat_ptr {
|
||||
@@ -645,8 +645,8 @@ static_assert(sizeof(flock64_32) == 24, "Incorrect size");
|
||||
struct
|
||||
FEX_ANNOTATE("fex-match")
|
||||
linux_dirent {
|
||||
uint64_t d_ino;
|
||||
int64_t d_off;
|
||||
compat_uint64_t d_ino;
|
||||
compat_int64_t d_off;
|
||||
uint16_t d_reclen;
|
||||
uint8_t _pad[6];
|
||||
char d_name[];
|
||||
@@ -673,8 +673,8 @@ static_assert(sizeof(linux_dirent_32) == 12, "Incorrect size");
|
||||
struct
|
||||
FEX_ANNOTATE("fex-match")
|
||||
linux_dirent_64 {
|
||||
uint64_t d_ino;
|
||||
uint64_t d_off;
|
||||
compat_uint64_t d_ino;
|
||||
compat_uint64_t d_off;
|
||||
uint16_t d_reclen;
|
||||
uint8_t d_type;
|
||||
uint8_t _pad[5];
|
||||
@@ -1156,4 +1156,40 @@ mq_attr32 {
|
||||
|
||||
static_assert(std::is_trivial<mq_attr32>::value, "Needs to be trivial");
|
||||
static_assert(sizeof(mq_attr32) == 32, "Incorrect size");
|
||||
|
||||
union
|
||||
FEX_ANNOTATE("alias-x86_32-epoll_data_t")
|
||||
FEX_ANNOTATE("fex-match")
|
||||
epoll_data32 {
|
||||
compat_ptr<void> ptr;
|
||||
int fd;
|
||||
uint32_t u32;
|
||||
compat_uint64_t u64;
|
||||
};
|
||||
|
||||
struct
|
||||
FEX_PACKED
|
||||
FEX_ANNOTATE("alias-x86_32-epoll_event")
|
||||
FEX_ANNOTATE("fex-match")
|
||||
epoll_event32 {
|
||||
uint32_t events;
|
||||
epoll_data32 data;
|
||||
|
||||
epoll_event32() = delete;
|
||||
|
||||
operator struct epoll_event() const {
|
||||
epoll_event event{};
|
||||
event.events = events;
|
||||
event.data.u64 = data.u64;
|
||||
return event;
|
||||
}
|
||||
|
||||
epoll_event32(struct epoll_event event)
|
||||
: data { event.data.u64 }{
|
||||
events = event.events;
|
||||
}
|
||||
};
|
||||
static_assert(std::is_trivial<epoll_event32>::value, "Needs to be trivial");
|
||||
static_assert(sizeof(epoll_event32) == 12, "Incorrect size");
|
||||
|
||||
}
|
||||
@@ -16,6 +16,8 @@ namespace FEXCore::Core {
|
||||
struct CpuStateFrame;
|
||||
}
|
||||
|
||||
ARG_TO_STR(FEX::HLE::x64::semun, "%lx")
|
||||
|
||||
namespace FEX::HLE::x64 {
|
||||
void RegisterSemaphore() {
|
||||
REGISTER_SYSCALL_IMPL_X64(semop, [](FEXCore::Core::CpuStateFrame *Frame, int semid, struct sembuf *sops, size_t nsops) -> uint64_t {
|
||||
|
||||
Reference in new issue
Block a user