Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: cpu: aarch64: updated xbyak_aarch64 #1832

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/cpu/aarch64/xbyak_aarch64/src/util_impl_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

namespace Xbyak_aarch64 {
namespace util {
#define XBYAK_AARCH64_ERROR_ fprintf(stderr, "%s, %d, Error occurrs during read cache infomation.\n", __FILE__, __LINE__);
#define XBYAK_AARCH64_ERROR_ fprintf(stderr, "%s, %d, Error occured while reading cache infomation.\n", __FILE__, __LINE__);
#define XBYAK_AARCH64_PATH_NODES "/sys/devices/system/node/node"
#define XBYAK_AARCH64_PATH_CORES "/sys/devices/system/node/node0/cpu"
#define XBYAK_AARCH64_PATH_CACHE_DIR "/sys/devices/system/cpu/cpu0/cache"
Expand Down Expand Up @@ -103,6 +103,8 @@ class CpuInfoLinux : public CpuInfo {
strncat(file_pattern, "[0-9]+", 16);

DIR *dir = opendir(dir_path);
if (dir == NULL)
return retVal;
struct dirent *dp;

dp = readdir(dir);
Expand Down Expand Up @@ -438,12 +440,16 @@ class CpuInfoLinux : public CpuInfo {

FILE *file = fopen(path_midr_el1, "r");
if (file == nullptr) {
throw Error(ERR_INTERNAL);
// sysfs is unaccessible for AWS Lambdas
fprintf(stderr, "%s, %d: Can't open MIDR_EL1 sysfs entry\n", __FILE__, __LINE__);
cacheInfo_.midr_el1 = 0xFF << 24;
return;
}

if (fread(buf, sizeof(char), 64, file) == 0) {
throw Error(ERR_INTERNAL);
// File can be empty if invoked inside docker container
fprintf(stderr, "%s, %d: Can't read MIDR_EL1 sysfs entry\n", __FILE__, __LINE__);
cacheInfo_.midr_el1 = 0xFF << 24;
return;
}

Expand Down