10 #define VIRTUAL_CS 0x08 11 #define VIRTUAL_DS 0x10 12 #define PHYSICAL_CS 0x18 13 #define PHYSICAL_DS 0x20 48 #define VIRTUAL(address) ( (address) - 0xffffffff00000000 ) 50 #define VIRTUAL(address) (address) 60 .macro virtcall
function 61 pushl $VIRTUAL(\
function)
72 #define VIRT_CALL( function ) \ 73 "pushl $( " _S2 ( VIRTUAL ( function ) ) " )\n\t" \ 82 extern char *
const data16;
83 extern char *
const text16;
85 #define __data16( variable ) \ 86 __attribute__ (( section ( ".data16" ) )) \ 87 _data16_ ## variable __asm__ ( #variable ) 89 #define __data16_array( variable, array ) \ 90 __attribute__ (( section ( ".data16" ) )) \ 91 _data16_ ## variable array __asm__ ( #variable ) 93 #define __bss16( variable ) \ 94 __attribute__ (( section ( ".bss16" ) )) \ 95 _data16_ ## variable __asm__ ( #variable ) 97 #define __bss16_array( variable, array ) \ 98 __attribute__ (( section ( ".bss16" ) )) \ 99 _data16_ ## variable array __asm__ ( #variable ) 101 #define __text16( variable ) \ 102 __attribute__ (( section ( ".text16.data" ) )) \ 103 _text16_ ## variable __asm__ ( #variable ) 105 #define __text16_array( variable, array ) \ 106 __attribute__ (( section ( ".text16.data" ) )) \ 107 _text16_ ## variable array __asm__ ( #variable ) 109 #define __use_data16( variable ) \ 110 ( * ( ( typeof ( _data16_ ## variable ) * ) \ 111 & ( data16 [ ( size_t ) & ( _data16_ ## variable ) ] ) ) ) 113 #define __use_text16( variable ) \ 114 ( * ( ( typeof ( _text16_ ## variable ) * ) \ 115 & ( text16 [ ( size_t ) & ( _text16_ ## variable ) ] ) ) ) 117 #define __from_data16( pointer ) \ 119 ( ( ( void * ) (pointer) ) - ( ( void * ) data16 ) ) ) 121 #define __from_text16( pointer ) \ 123 ( ( ( void * ) (pointer) ) - ( ( void * ) text16 ) ) ) 129 #define rm_cs __use_text16 ( rm_cs ) 131 #define rm_ds __use_text16 ( rm_ds ) 138 #define CODE_DEFAULT ".code64" 139 #define STACK_DEFAULT "q" 141 #define CODE_DEFAULT ".code32" 142 #define STACK_DEFAULT "l" 146 #define LINE_SYMBOL _S2 ( OBJECT ) "__line_" _S2 ( __LINE__ ) "__%=:" 149 #define TEXT16_CODE( asm_code_str ) \ 150 ".section \".text16\", \"ax\", @progbits\n\t" \ 151 "\n" LINE_SYMBOL "\n\t" \ 153 asm_code_str "\n\t" \ 154 CODE_DEFAULT "\n\t" \ 158 #define REAL_CODE( asm_code_str ) \ 159 "push" STACK_DEFAULT " $1f\n\t" \ 160 "call real_call\n\t" \ 161 TEXT16_CODE ( "\n1:\n\t" \ 167 #define PHYS_CODE( asm_code_str ) \ 168 "push" STACK_DEFAULT " $1f\n\t" \ 169 "call phys_call\n\t" \ 170 ".section \".text.phys\", \"ax\", @progbits\n\t"\ 171 "\n" LINE_SYMBOL "\n\t" \ 177 CODE_DEFAULT "\n\t" \ 232 #define IDTE_PRESENT 0x80 235 #define IDTE_TYPE_IRQ32 0x0e 238 #define IDTE_TYPE_IRQ64 0x0e 264 #define PUSH_INSN 0x50 267 #define MOVB_INSN 0xb0 270 #define JMP_INSN 0xe9 350 #define IO_PAGE_COUNT \ 351 ( sizeof ( io_pages.page ) / sizeof ( io_pages.page[0] ) ) 358 #define IO_PAGE_SIZE 0x200000UL 365 #define IO_BASE ( ( void * ) 0x100000000ULL ) 369 #define sipi __use_text16 ( sipi ) 373 #define sipi_len ABS_VALUE ( sipi_len ) 377 #define sipi_ds __use_text16 ( sipi_ds )
void remove_from_rm_stack(void *data, size_t size)
Deallocate space on the real-mode stack, optionally copying back data.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define __text16_array(variable, array)
uint16_t mid
Middle 16 bits of address.
uint8_t next[0]
Next instruction after jump.
uint32_t vector
MSI-X vector.
uint8_t intr
Interrupt number.
uint32_t sipi_handler
Startup IPI protected-mode handler (physical address)
uint16_t high
High 16 bits of address.
Page-level write-through.
uint16_t size
Buffer size.
uint8_t attr
Type and attributes.
unsigned long long uint64_t
uint16_t copy_to_rm_stack(const void *data, size_t size)
Allocate space on the real-mode stack and copy data there.
uint32_t high
High 32 bits of address.
Page-level cache disable.
struct i386_regs sipi_regs
Startup IPI register state.
A 32-bit interrupt descriptor table entry.
uint8_t intr
Interrupt number.
size_t ABS_SYMBOL(sipi_len)
Length of startup IPI real-mode handler.
uint8_t movb
"movb" instruction
Page is the last page in an allocation.
uint16_t low
Low 16 bits of address.
struct page_table __attribute__
A 32-bit interrupt descriptor table register.
uint8_t push
"push" instruction
uint16_t low
Low 16 bits of address.
void set_interrupt_vector(unsigned int intr, void *vector)
Set interrupt vector.
A 64-bit interrupt descriptor table entry.
A 32-bit general register dump.
void setup_sipi(unsigned int vector, uint32_t handler, struct i386_regs *regs)
Set up startup IPI handler.
32-bit interrupt wrapper stack frame
uint32_t reserved
Reserved.
uint16_t segment
Code segment.
#define __text16(variable)
struct page_table io_pages
The I/O space page table.
uint8_t data[48]
Additional event data.
uint32_t offset
Interrupt wrapper address offset.
Page is accessible by user code.
uint64_t page[512]
Page address and flags.
uint8_t jmp
"jmp" instruction
uint8_t attr
Type and attributes.
64-bit interrupt wrapper stack frame
A 64-bit interrupt descriptor table register.
uint16_t segment
Code segment.