sync code with last fixes and improvements from OpenBSD

This commit is contained in:
purplerain 2023-07-27 09:35:44 +00:00
parent 58df21ce75
commit f960599e67
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
399 changed files with 7016 additions and 6902 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: exec_i386.c,v 1.52 2022/07/07 00:56:47 daniel Exp $ */
/* $OpenBSD: exec_i386.c,v 1.53 2023/07/22 10:11:20 jsg Exp $ */
/*
* Copyright (c) 1997-1998 Michael Shalayeff
@ -190,7 +190,8 @@ ucode_load(void)
CPUID(0, dummy, vendor[0], vendor[2], vendor[1]);
vendor[3] = 0; /* NULL-terminate */
if (strcmp((char *)vendor, "GenuineIntel") != 0)
if (strcmp((char *)vendor, "GenuineIntel") != 0 &&
strcmp((char *)vendor, "AuthenticAMD") != 0)
return;
CPUID(1, signature, dummy, dummy, dummy);
@ -202,8 +203,22 @@ ucode_load(void)
}
stepping = (signature >> 0) & 0x0f;
snprintf(path, sizeof(path), "%s:/etc/firmware/intel/%02x-%02x-%02x",
cmd.bootdev, family, model, stepping);
if (strcmp((char *)vendor, "GenuineIntel") == 0) {
snprintf(path, sizeof(path),
"%s:/etc/firmware/intel/%02x-%02x-%02x",
cmd.bootdev, family, model, stepping);
} else if (strcmp((char *)vendor, "AuthenticAMD") == 0) {
if (family < 0x10)
return;
else if (family <= 0x14)
snprintf(path, sizeof(path),
"%s:/etc/firmware/amd/microcode_amd.bin",
cmd.bootdev);
else
snprintf(path, sizeof(path),
"%s:/etc/firmware/amd/microcode_amd_fam%02xh.bin",
cmd.bootdev, family);
}
fd = open(path, O_RDONLY);
if (fd == -1)