device/oprom/realmode/x86: temporary disable NULL breakpoints

Disable NULL breakpoints in setup_realmode_idt before calling
write_idt_stub in a loop.

TEST=No more spurious Null dereference errors in the console output.
Before Mandolin showed these two errors before running the VBIOS:

[ERROR]  Null dereference at eip: 0x4e6f1a35
[ERROR]  Null dereference at eip: 0x4e6f1a4f

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I2255d85030e41192ae8a3a7f0f6576c0d373eead
Reviewed-on: https://review.coreboot.org/c/coreboot/+/77172
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
This commit is contained in:
Felix Held 2023-08-12 00:30:36 +02:00
parent 6e039076ab
commit 38880d236f
1 changed files with 8 additions and 1 deletions

View File

@ -2,6 +2,7 @@
#include <device/mmio.h> #include <device/mmio.h>
#include <arch/interrupt.h> #include <arch/interrupt.h>
#include <arch/null_breakpoint.h>
#include <arch/registers.h> #include <arch/registers.h>
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#include <console/console.h> #include <console/console.h>
@ -178,6 +179,10 @@ static void setup_realmode_idt(void)
struct realmode_idt *idts = (struct realmode_idt *) 0; struct realmode_idt *idts = (struct realmode_idt *) 0;
int i; int i;
/* It's expected that we write to the NULL page in the first two iterations of the
following loop, so temporarily disable the NULL breakpoint. */
null_breakpoint_disable();
/* Copy IDT stub code for each interrupt. This might seem wasteful /* Copy IDT stub code for each interrupt. This might seem wasteful
* but it is really simple * but it is really simple
*/ */
@ -187,6 +192,8 @@ static void setup_realmode_idt(void)
write_idt_stub((void *)((uintptr_t)idts[i].offset), i); write_idt_stub((void *)((uintptr_t)idts[i].offset), i);
} }
null_breakpoint_init();
/* Many option ROMs use the hard coded interrupt entry points in the /* Many option ROMs use the hard coded interrupt entry points in the
* system bios. So install them at the known locations. * system bios. So install them at the known locations.
*/ */