brintos

brintos / linux-shallow public Read only

0
0
Text · 421 B · 3e537ff Raw
20 lines · c
1// SPDX-License-Identifier: GPL-2.02#include "linux/string.h"3#include "util/env.h"4#include "env.h"5 6bool x86__is_amd_cpu(void)7{8	struct perf_env env = { .total_mem = 0, };9	static int is_amd; /* 0: Uninitialized, 1: Yes, -1: No */10 11	if (is_amd)12		goto ret;13 14	perf_env__cpuid(&env);15	is_amd = env.cpuid && strstarts(env.cpuid, "AuthenticAMD") ? 1 : -1;16	perf_env__exit(&env);17ret:18	return is_amd >= 1 ? true : false;19}20