coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
name.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <arch/cpu.h>
4 #include <cpu/x86/name.h>
5 #include <stdint.h>
6 #include <string.h>
7 
9 {
10  struct cpuid_result regs;
11  char *processor_name_start;
12  uint32_t name_as_ints[13];
13  int i;
14 
15  for (i = 0; i < 3; i++) {
16  regs = cpuid(0x80000002 + i);
17  name_as_ints[i * 4 + 0] = regs.eax;
18  name_as_ints[i * 4 + 1] = regs.ebx;
19  name_as_ints[i * 4 + 2] = regs.ecx;
20  name_as_ints[i * 4 + 3] = regs.edx;
21  }
22 
23  name_as_ints[12] = 0;
24 
25  /* Skip leading spaces. */
26  processor_name_start = (char *)name_as_ints;
27  while (*processor_name_start == ' ')
28  processor_name_start++;
29 
30  strcpy(processor_name, processor_name_start);
31 }
static char processor_name[49]
Definition: mp_init.c:37
void fill_processor_name(char *processor_name)
Definition: name.c:8
u32 cpuid
unsigned int uint32_t
Definition: stdint.h:14
char * strcpy(char *dst, const char *src)
Definition: string.c:92