iPXE
|
#include <stdint.h>
#include <strings.h>
#include <assert.h>
#include <ipxe/profile.h>
#include <realmode.h>
#include <pic8259.h>
#include <ipxe/shell.h>
#include <ipxe/cpuid.h>
Go to the source code of this file.
Macros | |
#define | STACK_DUMP_LEN 128 |
Length of stack dump. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
uint16_t | copy_user_to_rm_stack (userptr_t data, size_t size) |
Allocate space on the real-mode stack and copy data there from a user buffer. More... | |
void | remove_user_from_rm_stack (userptr_t data, size_t size) |
Deallocate space on the real-mode stack, optionally copying back data to a user buffer. More... | |
void | set_interrupt_vector (unsigned int intr, void *vector) |
Set interrupt vector. More... | |
__asmcall void | init_idt (void) |
Initialise interrupt descriptor table. More... | |
static struct profiler * | interrupt_profiler (int intr) |
Determine interrupt profiler (for debugging) More... | |
static void | interrupt_dump (int intr, struct interrupt_frame32 *frame32, struct interrupt_frame64 *frame64) |
Display interrupt stack dump (for debugging) More... | |
void | interrupt (int intr, struct interrupt_frame32 *frame32, struct interrupt_frame64 *frame64) |
Interrupt handler. More... | |
static void * | ioremap_pages (unsigned long bus_addr, size_t len) |
Map pages for I/O. More... | |
static void | iounmap_pages (volatile const void *io_addr) |
Unmap pages for I/O. More... | |
__asmcall void | check_fxsr (struct i386_all_regs *regs) |
Check for FXSAVE/FXRSTOR instruction support. More... | |
void | setup_sipi (unsigned int vector, uint32_t handler, struct i386_regs *regs) |
Set up startup IPI handler. More... | |
PROVIDE_UACCESS_INLINE (librm, phys_to_user) | |
PROVIDE_UACCESS_INLINE (librm, user_to_phys) | |
PROVIDE_UACCESS_INLINE (librm, virt_to_user) | |
PROVIDE_UACCESS_INLINE (librm, user_to_virt) | |
PROVIDE_UACCESS_INLINE (librm, userptr_add) | |
PROVIDE_UACCESS_INLINE (librm, memcpy_user) | |
PROVIDE_UACCESS_INLINE (librm, memmove_user) | |
PROVIDE_UACCESS_INLINE (librm, memset_user) | |
PROVIDE_UACCESS_INLINE (librm, strlen_user) | |
PROVIDE_UACCESS_INLINE (librm, memchr_user) | |
PROVIDE_IOMAP_INLINE (pages, io_to_bus) | |
PROVIDE_IOMAP (pages, ioremap, ioremap_pages) | |
PROVIDE_IOMAP (pages, iounmap, iounmap_pages) | |
Variables | |
char | interrupt_wrapper [] |
The interrupt wrapper. More... | |
static struct interrupt_vector | intr_vec [NUM_INT] |
The interrupt vectors. More... | |
static struct interrupt32_descriptor | idt32 [NUM_INT] |
The 32-bit interrupt descriptor table. More... | |
struct idtr32 | idtr32 |
The 32-bit interrupt descriptor table register. More... | |
static struct interrupt64_descriptor | idt64 [NUM_INT] |
The 64-bit interrupt descriptor table. More... | |
struct idtr64 | idtr64 |
The interrupt descriptor table register. More... | |
struct i386_regs | sipi_regs |
Startup IPI register state. More... | |
static struct profiler timer_irq_profiler | __profiler = { .name = "irq.timer" } |
Timer interrupt profiler. More... | |
#define STACK_DUMP_LEN 128 |
Length of stack dump.
Definition at line 52 of file librm_mgmt.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
Allocate space on the real-mode stack and copy data there from a user buffer.
data | User buffer |
size | Size of stack data |
sp | New value of real-mode stack pointer |
Definition at line 68 of file librm_mgmt.c.
References data, memcpy_user(), real_to_user(), rm_sp, rm_ss, and size.
Referenced by com32_cfarcall().
Deallocate space on the real-mode stack, optionally copying back data to a user buffer.
data | User buffer |
size | Size of stack data |
Definition at line 83 of file librm_mgmt.c.
References data, memcpy_user(), real_to_user(), rm_sp, rm_ss, and size.
Referenced by com32_cfarcall().
void set_interrupt_vector | ( | unsigned int | intr, |
void * | vector | ||
) |
Set interrupt vector.
intr | Interrupt number |
vector | Interrupt vector, or NULL to disable |
Definition at line 97 of file librm_mgmt.c.
References addr, interrupt32_descriptor::attr, interrupt64_descriptor::attr, interrupt32_descriptor::high, interrupt64_descriptor::high, idt32, idt64, IDTE_PRESENT, IDTE_TYPE_IRQ32, IDTE_TYPE_IRQ64, intr, LONG_CS, interrupt32_descriptor::low, interrupt64_descriptor::low, interrupt64_descriptor::mid, interrupt32_descriptor::segment, interrupt64_descriptor::segment, vector, and VIRTUAL_CS.
Referenced by gdbmach_init(), and init_idt().
__asmcall void init_idt | ( | void | ) |
Initialise interrupt descriptor table.
Definition at line 125 of file librm_mgmt.c.
References idtr32::base, idtr64::base, DBGC, idt32, idt64, interrupt_wrapper, intr, interrupt_vector::intr, intr_vec, interrupt_vector::jmp, JMP_INSN, interrupt_vector::movb, MOVB_INSN, interrupt_vector::next, NUM_INT, interrupt_vector::offset, interrupt_vector::push, PUSH_INSN, set_interrupt_vector(), and virt_to_phys().
|
static |
Determine interrupt profiler (for debugging)
intr | Interrupt number |
profiler | Profiler |
Definition at line 160 of file librm_mgmt.c.
Referenced by interrupt().
|
static |
Display interrupt stack dump (for debugging)
intr | Interrupt number |
frame32 | 32-bit interrupt wrapper stack frame (or NULL) |
frame64 | 64-bit interrupt wrapper stack frame (or NULL) |
Definition at line 178 of file librm_mgmt.c.
References interrupt_frame32::cs, interrupt_frame64::cs, DBG_LOG, DBGC, DBGC_HDA, interrupt_frame32::ds, interrupt_frame32::eax, interrupt_frame32::ebp, interrupt_frame32::ebx, interrupt_frame32::ecx, interrupt_frame32::edi, interrupt_frame32::edx, interrupt_frame32::eflags, interrupt_frame32::eip, interrupt_frame32::es, interrupt_frame32::esi, esp, interrupt_frame32::esp, interrupt_frame32::fs, interrupt_frame32::gs, intr, offsetof, phys_to_virt(), interrupt_frame64::r10, interrupt_frame64::r11, interrupt_frame64::r12, interrupt_frame64::r13, interrupt_frame64::r14, interrupt_frame64::r15, interrupt_frame64::r8, interrupt_frame64::r9, interrupt_frame64::rax, interrupt_frame64::rbp, interrupt_frame64::rbx, interrupt_frame64::rcx, interrupt_frame64::rdi, interrupt_frame64::rdx, interrupt_frame64::rflags, interrupt_frame64::rip, interrupt_frame64::rsi, interrupt_frame64::rsp, sp, interrupt_frame32::ss, interrupt_frame64::ss, STACK_DUMP_LEN, and typeof().
Referenced by interrupt().
void interrupt | ( | int | intr, |
struct interrupt_frame32 * | frame32, | ||
struct interrupt_frame64 * | frame64 | ||
) |
Interrupt handler.
intr | Interrupt number |
frame32 | 32-bit interrupt wrapper stack frame (or NULL) |
frame64 | 64-bit interrupt wrapper stack frame (or NULL) |
frame | Interrupt wrapper stack frame |
Definition at line 250 of file librm_mgmt.c.
References __asm__(), __volatile__(), DBG, DBG_LOG, interrupt_dump(), interrupt_profiler(), intr, IRQ_INT, profile_exclude(), profile_start(), profile_stop(), REAL_CODE, and shell().
Referenced by com32_intcall(), hook_bios_interrupt(), and unhook_bios_interrupt().
|
static |
Map pages for I/O.
bus_addr | Bus address |
len | Length of region |
io_addr | I/O address |
Definition at line 282 of file librm_mgmt.c.
References assert(), bus_addr, count, DBGC, first, fls, IO_BASE, IO_PAGE_SIZE, io_pages, len, NULL, offset, page_table::page, PAGE_LAST, PAGE_P, PAGE_PCD, PAGE_PS, PAGE_PWT, PAGE_RW, PAGE_US, and start.
|
static |
Unmap pages for I/O.
io_addr | I/O address |
Definition at line 357 of file librm_mgmt.c.
References __asm__(), __volatile__(), assert(), DBGC, first, IO_BASE, IO_PAGE_SIZE, io_pages, page_table::page, PAGE_LAST, and PAGE_P.
__asmcall void check_fxsr | ( | struct i386_all_regs * | regs | ) |
Check for FXSAVE/FXRSTOR instruction support.
Definition at line 397 of file librm_mgmt.c.
References CF, CPUID_FEATURES_INTEL_EDX_FXSR, DBGC, features, regs, and x86_features().
Set up startup IPI handler.
vector | Startup IPI vector |
handler | Protected-mode startup IPI handler physical address |
regs | Initial register state |
Definition at line 415 of file librm_mgmt.c.
References copy_to_real, memcpy(), regs, rm_ds, sipi, sipi_ds, sipi_handler, sipi_len, sipi_regs, and vector.
Referenced by bios_mp_start_all().
PROVIDE_UACCESS_INLINE | ( | librm | , |
phys_to_user | |||
) |
PROVIDE_UACCESS_INLINE | ( | librm | , |
user_to_phys | |||
) |
PROVIDE_UACCESS_INLINE | ( | librm | , |
virt_to_user | |||
) |
PROVIDE_UACCESS_INLINE | ( | librm | , |
user_to_virt | |||
) |
PROVIDE_UACCESS_INLINE | ( | librm | , |
userptr_add | |||
) |
PROVIDE_UACCESS_INLINE | ( | librm | , |
memcpy_user | |||
) |
PROVIDE_UACCESS_INLINE | ( | librm | , |
memmove_user | |||
) |
PROVIDE_UACCESS_INLINE | ( | librm | , |
memset_user | |||
) |
PROVIDE_UACCESS_INLINE | ( | librm | , |
strlen_user | |||
) |
PROVIDE_UACCESS_INLINE | ( | librm | , |
memchr_user | |||
) |
PROVIDE_IOMAP_INLINE | ( | pages | , |
io_to_bus | |||
) |
PROVIDE_IOMAP | ( | pages | , |
ioremap | , | ||
ioremap_pages | |||
) |
PROVIDE_IOMAP | ( | pages | , |
iounmap | , | ||
iounmap_pages | |||
) |
char interrupt_wrapper[] |
The interrupt wrapper.
Referenced by init_idt().
|
static |
|
static |
The 32-bit interrupt descriptor table.
Definition at line 31 of file librm_mgmt.c.
Referenced by init_idt(), and set_interrupt_vector().
The 32-bit interrupt descriptor table register.
Definition at line 35 of file librm_mgmt.c.
|
static |
The 64-bit interrupt descriptor table.
Definition at line 40 of file librm_mgmt.c.
Referenced by init_idt(), and set_interrupt_vector().
The interrupt descriptor table register.
Definition at line 44 of file librm_mgmt.c.
struct i386_regs sipi_regs |