coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
x86.c File Reference
#include <device/mmio.h>
#include <arch/interrupt.h>
#include <arch/registers.h>
#include <boot/coreboot_tables.h>
#include <console/console.h>
#include <delay.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <pc80/i8259.h>
#include <pc80/i8254.h>
#include <stdint.h>
#include <string.h>
#include <vbe.h>
#include <framebuffer_info.h>
#include <x86emu/regs.h>
#include "x86.h"
Include dependency graph for x86.c:

Go to the source code of this file.

Data Structures

struct  __packed
 

Macros

#define PTR_TO_REAL_MODE(sym)    (void *)(REALMODE_BASE + ((char *)&(sym) - (char *)&__realmode_code))
 

Functions

static void setup_realmode_code (void)
 
static void setup_rombios (void)
 
static int intXX_exception_handler (void)
 
static int intXX_unknown_handler (void)
 
void mainboard_interrupt_handlers (int intXX, int(*intXX_func)(void))
 
static void setup_interrupt_handlers (void)
 
static void write_idt_stub (void *target, u8 intnum)
 
static void setup_realmode_idt (void)
 
void run_bios (struct device *dev, unsigned long addr)
 
int asmlinkage interrupt_handler (u32 intnumber, u32 gsfs, u32 dses, u32 edi, u32 esi, u32 ebp, u32 esp, u32 ebx, u32 edx, u32 ecx, u32 eax, u32 cs_ip, u16 stackflags)
 

Variables

unsigned char __realmode_call
 
unsigned char __realmode_interrupt
 
unsigned char __realmode_buffer
 
X86EMU_sysEnv _X86EMU_env
 
unsigned int(* realmode_call )(u32 addr, u32 eax, u32 ebx, u32 ecx, u32 edx, u32 esi, u32 edi) asmlinkage
 
unsigned int(* realmode_interrupt )(u32 intno, u32 eax, u32 ebx, u32 ecx, u32 edx, u32 esi, u32 edi) asmlinkage
 
static int(* intXX_handler [256])(void) = { NULL }
 

Macro Definition Documentation

◆ PTR_TO_REAL_MODE

#define PTR_TO_REAL_MODE (   sym)     (void *)(REALMODE_BASE + ((char *)&(sym) - (char *)&__realmode_code))

Definition at line 41 of file x86.c.

Function Documentation

◆ interrupt_handler()

int asmlinkage interrupt_handler ( u32  intnumber,
u32  gsfs,
u32  dses,
u32  edi,
u32  esi,
u32  ebp,
u32  esp,
u32  ebx,
u32  edx,
u32  ecx,
u32  eax,
u32  cs_ip,
u16  stackflags 
)

◆ intXX_exception_handler()

static int intXX_exception_handler ( void  )
static

Definition at line 79 of file x86.c.

References BIOS_INFO, M, printk, X86_CS, X86_EAX, X86_EBP, X86_EBX, X86_ECX, X86_EDI, X86_EDX, X86_EFLAGS, X86_EIP, X86_ESI, X86_ESP, and x86_exception().

Referenced by setup_interrupt_handlers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intXX_unknown_handler()

static int intXX_unknown_handler ( void  )
static

Definition at line 111 of file x86.c.

References BIOS_INFO, M, printk, and X86_EAX.

Referenced by setup_interrupt_handlers().

Here is the caller graph for this function:

◆ mainboard_interrupt_handlers()

void mainboard_interrupt_handlers ( int  intXX,
int(*)(void intXX_func 
)

Definition at line 120 of file x86.c.

References intXX_handler.

◆ run_bios()

◆ setup_interrupt_handlers()

static void setup_interrupt_handlers ( void  )
static

Definition at line 125 of file x86.c.

References int10_handler(), int12_handler(), int16_handler(), int1a_handler(), intXX_exception_handler(), intXX_handler, and intXX_unknown_handler().

Referenced by run_bios().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_realmode_code()

static void setup_realmode_code ( void  )
static

Definition at line 53 of file x86.c.

References __realmode_call, __realmode_code, __realmode_code_size, __realmode_interrupt, BIOS_SPEW, memcpy(), printk, PTR_TO_REAL_MODE, REALMODE_BASE, realmode_call, and realmode_interrupt.

Referenced by run_bios().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_realmode_idt()

static void setup_realmode_idt ( void  )
static

Definition at line 176 of file x86.c.

References __idt_handler_size, realmode_idt::cs, realmode_idt::offset, offset, and write_idt_stub().

Referenced by run_bios().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_rombios()

static void setup_rombios ( void  )
static

Definition at line 65 of file x86.c.

References memcpy(), and write8().

Referenced by run_bios().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_idt_stub()

static void write_idt_stub ( void target,
u8  intnum 
)
static

Definition at line 168 of file x86.c.

References __idt_handler, __idt_handler_size, and memcpy().

Referenced by setup_realmode_idt().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ __realmode_buffer

unsigned char __realmode_buffer
extern

◆ __realmode_call

unsigned char __realmode_call
extern

Referenced by setup_realmode_code().

◆ __realmode_interrupt

unsigned char __realmode_interrupt

Definition at line 38 of file x86.c.

Referenced by setup_realmode_code().

◆ _X86EMU_env

X86EMU_sysEnv _X86EMU_env

Definition at line 45 of file x86.c.

◆ intXX_handler

int(* intXX_handler[256])(void) ( void  ) = { NULL }
static

Definition at line 77 of file x86.c.

Referenced by interrupt_handler(), mainboard_interrupt_handlers(), and setup_interrupt_handlers().

◆ realmode_call

unsigned int(* realmode_call) (u32 addr, u32 eax, u32 ebx, u32 ecx, u32 edx, u32 esi, u32 edi) asmlinkage ( u32  addr,
u32  eax,
u32  ebx,
u32  ecx,
u32  edx,
u32  esi,
u32  edi 
)

Definition at line 47 of file x86.c.

Referenced by run_bios(), and setup_realmode_code().

◆ realmode_interrupt

unsigned int(* realmode_interrupt) (u32 intno, u32 eax, u32 ebx, u32 ecx, u32 edx, u32 esi, u32 edi) asmlinkage ( u32  intno,
u32  eax,
u32  ebx,
u32  ecx,
u32  edx,
u32  esi,
u32  edi 
)

Definition at line 50 of file x86.c.

Referenced by setup_realmode_code().