mirror of
https://github.com/lemonade-sdk/mac_linuxgpu.git
synced 2026-11-22 23:57:31 -10:00
Runs the unmodified upstream Linux amdgpu and amdkfd drivers on Apple Silicon Macs inside a DriverKit system extension, for AMD GPUs attached over Thunderbolt. The Linux sources come from a pinned submodule and are compiled against linuxu, a userspace implementation of the Linux kernel APIs they use. Includes the HSA runtime, the host installer app, the setup and firmware fetch scripts, and the offline test suite.
34 lines
926 B
C
34 lines
926 B
C
#ifndef LINUXU_TEST_MEMORY_SYSCTL_H
|
|
#define LINUXU_TEST_MEMORY_SYSCTL_H
|
|
|
|
/* Deterministic host-memory boundary for offline upstream integration tests.
|
|
* Production uses the real platform adapter; these fixtures never query it. */
|
|
#ifdef __APPLE__
|
|
#include <assert.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
#include <sys/sysctl.h>
|
|
|
|
int sysctlbyname(const char *name, void *out, size_t *length,
|
|
void *replacement, size_t replacement_length)
|
|
{
|
|
assert(name && out && length && !replacement && !replacement_length);
|
|
if (!strcmp(name, "hw.memsize")) {
|
|
const uint64_t bytes = 64ull << 30;
|
|
assert(*length == sizeof(bytes));
|
|
memcpy(out, &bytes, sizeof(bytes));
|
|
} else {
|
|
uint32_t value;
|
|
if (!strcmp(name, "hw.pagesize")) value = 16384;
|
|
else {
|
|
assert(!strcmp(name, "vm.page_free_count"));
|
|
value = 4096;
|
|
}
|
|
assert(*length == sizeof(value));
|
|
memcpy(out, &value, sizeof(value));
|
|
}
|
|
return 0;
|
|
}
|
|
#endif
|
|
#endif
|