Actually updated the hardcoded guest kernel locations

Just a couple of files and uname syscall
This commit is contained in:
Ryan Houdek committed 2021-05-27 22:59:47 -07:00
1 parent a7858f4d37
commit 9d44dfdca6
2 files changed
+19 -5

No files matched your search

@@ -600,8 +600,12 @@ namespace FEX::EmulatedFile {
FDReadCreators["/proc/sys/kernel/osrelease"] = [&](FEXCore::Context::Context *ctx, int32_t fd, const char *pathname, int32_t flags, mode_t mode) -> int32_t {
FILE *fp = tmpfile();
const char kernel_version[] = "5.0.0\0";
fwrite(kernel_version, sizeof(uint8_t), strlen(kernel_version) + 1, fp);
uint32_t GuestVersion = FEX::HLE::_SyscallHandler->GetGuestKernelVersion();
fprintf(fp, "%d.%d.%d\n",
FEX::HLE::SyscallHandler::KernelMajor(GuestVersion),
FEX::HLE::SyscallHandler::KernelMinor(GuestVersion),
FEX::HLE::SyscallHandler::KernelPatch(GuestVersion));
fputc('\0', fp);
fseek(fp, 0, SEEK_SET);
int32_t f = fileno(fp);
return f;
@@ -611,8 +615,13 @@ namespace FEX::EmulatedFile {
FILE *fp = tmpfile();
// UTS version NEEDS to be in a format that can pass to `date -d`
// Format of this is Linux version <Release> (<Compile By>@<Compile Host>) (<Linux Compiler>) #<version> {SMP, PREEMPT, PREEMPT_RT} <UTS version>\n"
const char kernel_version[] = "Linux version 5.0.0 (FEX@FEX) (clang) #" GIT_DESCRIBE_STRING " SMP " __DATE__ " " __TIME__ "\n\0";
fwrite(kernel_version, sizeof(uint8_t), strlen(kernel_version) + 1, fp);
const char kernel_version[] = "Linux version %d.%d.%d (FEX@FEX) (clang) #" GIT_DESCRIBE_STRING " SMP " __DATE__ " " __TIME__ "\n";
uint32_t GuestVersion = FEX::HLE::_SyscallHandler->GetGuestKernelVersion();
fprintf(fp, kernel_version,
FEX::HLE::SyscallHandler::KernelMajor(GuestVersion),
FEX::HLE::SyscallHandler::KernelMinor(GuestVersion),
FEX::HLE::SyscallHandler::KernelPatch(GuestVersion));
fputc('\0', fp);
fseek(fp, 0, SEEK_SET);
int32_t f = fileno(fp);
return f;
+6 -1
View File
@@ -42,7 +42,12 @@ namespace FEX::HLE {
LogMan::Msg::E("Couldn't determine host nodename. Defaulting to '%s'", buf->nodename);
}
strcpy(buf->sysname, "Linux");
strcpy(buf->release, "5.0.0");
uint32_t GuestVersion = FEX::HLE::_SyscallHandler->GetGuestKernelVersion();
snprintf(buf->release, sizeof(buf->release), "%d.%d.%d",
FEX::HLE::SyscallHandler::KernelMajor(GuestVersion),
FEX::HLE::SyscallHandler::KernelMinor(GuestVersion),
FEX::HLE::SyscallHandler::KernelPatch(GuestVersion));
const char version[] = "#" GIT_DESCRIBE_STRING " SMP " __DATE__ " " __TIME__;
strcpy(buf->version, version);
static_assert(sizeof(version) <= sizeof(buf->version), "uname version define became too large!");