1/*
2 * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Copyright 2012-2017, Haiku, Inc. All rights reserved.
4 * Distributed under the terms of the MIT License.
5 */
6
7
8#include "bios.h"
9
10#include <KernelExport.h>
11
12#include "interrupts.h"
13
14
15//#define TRACE_BIOS
16#ifdef TRACE_BIOS
17#   define TRACE(x) dprintf x
18#else
19#   define TRACE(x) ;
20#endif
21
22
23extern "C" void call_bios_internal(uint8 num, struct bios_regs* regs);
24
25
26void
27call_bios(uint8 num, struct bios_regs* regs)
28{
29	TRACE(("BIOS(%" B_PRIx8 "h): Restore BIOS IDT\n", num));
30	restore_bios_idt();
31	TRACE(("BIOS(%" B_PRIx8 "h): eax: 0x%" B_PRIx32 ", ebx: 0x%" B_PRIx32 ", "
32		"ecx: 0x%" B_PRIx32 ", edx: 0x%" B_PRIx32 ", esi: 0x%" B_PRIx32 ", "
33		"edi: 0x%" B_PRIx32 ", es: 0x%" B_PRIx16 ", flags: 0x%" B_PRIx8 "\n",
34		num, regs->eax, regs->ebx, regs->ecx, regs->edx, regs->esi, regs->edi,
35		regs->es, regs->flags));
36	call_bios_internal(num, regs);
37	TRACE(("BIOS(%" B_PRIx8 "h): Set debug BIOS IDT\n", num));
38	set_debug_idt();
39}
40