libc cleanups

This commit is contained in:
georgemoralis 2023-10-06 16:05:34 +03:00
parent e31365aea3
commit 5a2ee268f8
4 changed files with 34 additions and 21 deletions

View file

@ -1,9 +1,29 @@
#include "libc.h"
#include <debug.h>
#include <cstdlib>
#include <cstring>
namespace Emulator::HLE::Libraries::LibC {
PS4_SYSV_ABI int printf(VA_ARGS) {
VA_CTX(ctx);
return printf_ctx(&ctx);
}
PS4_SYSV_ABI void exit(int code) { std::exit(code); }
PS4_SYSV_ABI int atexit(void (*func)()) {
int rt = std::atexit(func);
if (rt != 0) {
BREAKPOINT();
}
return rt;
}
int PS4_SYSV_ABI memcmp(const void* s1, const void* s2, size_t n) { return std::memcmp(s1, s2, n); }
void* PS4_SYSV_ABI memcpy(void* dest, const void* src, size_t n) { return std::memcpy(dest, src, n); }
}; // namespace Emulator::HLE::Libraries::LibC

View file

@ -1,10 +1,15 @@
#pragma once
#include <types.h>
#include "printf.h"
namespace Emulator::HLE::Libraries::LibC {
//HLE functions
PS4_SYSV_ABI int printf(VA_ARGS);
}
// HLE functions
PS4_SYSV_ABI int printf(VA_ARGS);
PS4_SYSV_ABI void exit(int code);
PS4_SYSV_ABI int atexit(void (*func)());
int PS4_SYSV_ABI memcmp(const void* s1, const void* s2, size_t n);
void* PS4_SYSV_ABI memcpy(void* dest, const void* src, size_t n);
} // namespace Emulator::HLE::Libraries::LibC