Go to the source code of this file.
Defines | |
| #define | VIRTUAL_CS 0x08 |
| #define | VIRTUAL_DS 0x10 |
| #define | PHYSICAL_CS 0x18 |
| #define | PHYSICAL_DS 0x20 |
| #define | REAL_CS 0x28 |
| #define | REAL_DS 0x30 |
| #define | UACCESS_PREFIX_librm __librm_ |
| #define | __data16(variable) |
| #define | __data16_array(variable, array) |
| #define | __bss16(variable) |
| #define | __bss16_array(variable, array) |
| #define | __text16(variable) |
| #define | __text16_array(variable, array) |
| #define | __use_data16(variable) |
| #define | __use_text16(variable) |
| #define | __from_data16(pointer) |
| #define | __from_text16(pointer) |
| #define | rm_cs __use_data16 ( rm_cs ) |
| #define | rm_ds __use_text16 ( rm_ds ) |
| #define | TEXT16_CODE(asm_code_str) |
| #define | REAL_CODE(asm_code_str) |
| #define | PHYS_CODE(asm_code_str) |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| static __always_inline userptr_t | UACCESS_INLINE (librm, phys_to_user)(unsigned long phys_addr) |
| Convert physical address to user pointer. | |
| static __always_inline unsigned long | UACCESS_INLINE (librm, user_to_phys)(userptr_t userptr |
| Convert user buffer to physical address. | |
| uint16_t | __data16 (rm_cs) |
| uint16_t | __text16 (rm_ds) |
| void | gateA20_set (void) |
| static __always_inline userptr_t | real_to_user (unsigned int segment, unsigned int offset) |
| Convert segment:offset address to user buffer. | |
| 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. | |
| 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. | |
Variables | |
| unsigned long | virt_offset |
| char * | text16 |
| uint16_t | rm_sp |
| uint16_t | rm_ss |
| #define __data16 | ( | variable | ) |
Value:
__attribute__ (( section ( ".data16" ) )) \ _data16_ ## variable __asm__ ( #variable )
| #define __data16_array | ( | variable, | |||
| array | ) |
Value:
__attribute__ (( section ( ".data16" ) )) \ _data16_ ## variable array __asm__ ( #variable )
| #define __bss16 | ( | variable | ) |
Value:
__attribute__ (( section ( ".bss16" ) )) \ _data16_ ## variable __asm__ ( #variable )
| #define __bss16_array | ( | variable, | |||
| array | ) |
Value:
__attribute__ (( section ( ".bss16" ) )) \ _data16_ ## variable array __asm__ ( #variable )
| #define __text16 | ( | variable | ) |
Value:
__attribute__ (( section ( ".text16.data" ) )) \ _text16_ ## variable __asm__ ( #variable )
| #define __text16_array | ( | variable, | |||
| array | ) |
Value:
__attribute__ (( section ( ".text16.data" ) )) \ _text16_ ## variable array __asm__ ( #variable )
| #define __use_data16 | ( | variable | ) |
| #define __use_text16 | ( | variable | ) |
| #define __from_data16 | ( | pointer | ) |
| #define __from_text16 | ( | pointer | ) |
| #define TEXT16_CODE | ( | asm_code_str | ) |
| #define REAL_CODE | ( | asm_code_str | ) |
Value:
"pushl $1f\n\t" \ "call real_call\n\t" \ "addl $4, %%esp\n\t" \ TEXT16_CODE ( "\n1:\n\t" \ asm_code_str \ "\n\t" \ "ret\n\t" )
| #define PHYS_CODE | ( | asm_code_str | ) |
Value:
"call _virt_to_phys\n\t" \ asm_code_str \ "call _phys_to_virt\n\t"
Definition at line 199 of file librm.h.
Referenced by elfboot_exec(), multiboot_exec(), and nbi_boot32().
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| static __always_inline userptr_t UACCESS_INLINE | ( | librm | , | |
| phys_to_user | ||||
| ) | [inline, static] |
Convert physical address to user pointer.
| phys_addr | Physical address |
| userptr | User pointer |
Definition at line 40 of file librm.h.
References virt_offset.
| static __always_inline unsigned long UACCESS_INLINE | ( | librm | , | |
| user_to_phys | ||||
| ) | [inline, static] |
Convert user buffer to physical address.
| userptr | User pointer | |
| offset | Offset from user pointer |
| phys_addr | Physical address |
| uint16_t __data16 | ( | rm_cs | ) |
| uint16_t __text16 | ( | rm_ds | ) |
| void gateA20_set | ( | void | ) |
Definition at line 100 of file gateA20.c.
References __asm__(), A20_INT15, A20_INT15_RETRIES, A20_KBC, A20_KBC_RETRIES, A20_MAX_RETRIES, A20_SCPA, A20_SCPA_RETRIES, A20_UNKNOWN, DBG, empty_8042(), Enable_A20, gateA20_is_set(), inb, iodelay(), K_CMD, K_RDWR, KB_SET_A20, KC_CMD_NULL, KC_CMD_WOUT, outb, printf(), REAL_CODE, and SCP_A.
Referenced by nbi_boot16(), pxeparent_call(), and undi_load().
00100 { 00101 static char reentry_guard = 0; 00102 static int a20_method = A20_UNKNOWN; 00103 unsigned int discard_a; 00104 unsigned int scp_a; 00105 int retries = 0; 00106 00107 /* Avoid potential infinite recursion */ 00108 if ( reentry_guard ) 00109 return; 00110 reentry_guard = 1; 00111 00112 /* Fast check to see if gate A20 is already enabled */ 00113 if ( gateA20_is_set ( 0 ) ) 00114 goto out; 00115 00116 for ( ; retries < A20_MAX_RETRIES ; retries++ ) { 00117 switch ( a20_method ) { 00118 case A20_UNKNOWN: 00119 case A20_INT15: 00120 /* Try INT 15 method */ 00121 __asm__ __volatile__ ( REAL_CODE ( "int $0x15" ) 00122 : "=a" ( discard_a ) 00123 : "a" ( Enable_A20 ) ); 00124 if ( gateA20_is_set ( A20_INT15_RETRIES ) ) { 00125 DBG ( "Enabled gate A20 using BIOS\n" ); 00126 a20_method = A20_INT15; 00127 goto out; 00128 } 00129 /* fall through */ 00130 case A20_KBC: 00131 /* Try keyboard controller method */ 00132 empty_8042(); 00133 outb ( KC_CMD_WOUT, K_CMD ); 00134 empty_8042(); 00135 outb ( KB_SET_A20, K_RDWR ); 00136 empty_8042(); 00137 outb ( KC_CMD_NULL, K_CMD ); 00138 empty_8042(); 00139 if ( gateA20_is_set ( A20_KBC_RETRIES ) ) { 00140 DBG ( "Enabled gate A20 using " 00141 "keyboard controller\n" ); 00142 a20_method = A20_KBC; 00143 goto out; 00144 } 00145 /* fall through */ 00146 case A20_SCPA: 00147 /* Try "Fast gate A20" method */ 00148 scp_a = inb ( SCP_A ); 00149 scp_a &= ~0x01; /* Avoid triggering a reset */ 00150 scp_a |= 0x02; /* Enable A20 */ 00151 iodelay(); 00152 outb ( scp_a, SCP_A ); 00153 iodelay(); 00154 if ( gateA20_is_set ( A20_SCPA_RETRIES ) ) { 00155 DBG ( "Enabled gate A20 using " 00156 "Fast Gate A20\n" ); 00157 a20_method = A20_SCPA; 00158 goto out; 00159 } 00160 } 00161 } 00162 00163 /* Better to die now than corrupt memory later */ 00164 printf ( "FATAL: Gate A20 stuck\n" ); 00165 while ( 1 ) {} 00166 00167 out: 00168 if ( retries ) 00169 DBG ( "%d attempts were required to enable A20\n", 00170 ( retries + 1 ) ); 00171 reentry_guard = 0; 00172 }
| static __always_inline userptr_t real_to_user | ( | unsigned int | segment, | |
| unsigned int | offset | |||
| ) | [inline, static] |
Convert segment:offset address to user buffer.
| segment | Real-mode segment | |
| offset | Real-mode offset |
| buffer | User buffer |
Definition at line 173 of file librm.h.
References phys_to_user().
Referenced by bzimage_parse_header(), comboot_exec(), comboot_prepare_bounce_buffer(), comboot_prepare_segment(), copy_from_real(), copy_to_real(), copy_user_to_rm_stack(), eltorito_load_disk(), get_cached_dhcpack(), int13_extended_rw(), int13_rw_sectors(), int22(), nbi_load(), nbi_process_segments(), print_user_string(), pxe_api_call(), pxe_load(), pxe_loader_call(), pxe_udp_deliver_iob(), pxenv_file_exec(), pxenv_file_open(), pxenv_file_read(), pxenv_get_cached_info(), pxenv_tftp_read(), pxenv_udp_write(), remove_user_from_rm_stack(), and shuffle().
00173 { 00174 return ( phys_to_user ( ( segment << 4 ) + offset ) ); 00175 }
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 26 of file librm_mgmt.c.
References memcpy_user(), real_to_user(), rm_sp, and rm_ss.
Referenced by com32_cfarcall().
00026 { 00027 userptr_t rm_stack; 00028 rm_sp -= size; 00029 rm_stack = real_to_user ( rm_ss, rm_sp ); 00030 memcpy_user ( rm_stack, 0, data, 0, size ); 00031 return rm_sp; 00032 };
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 41 of file librm_mgmt.c.
References memcpy_user(), real_to_user(), rm_sp, and rm_ss.
Referenced by com32_cfarcall().
00041 { 00042 if ( data ) { 00043 userptr_t rm_stack = real_to_user ( rm_ss, rm_sp ); 00044 memcpy_user ( rm_stack, 0, data, 0, size ); 00045 } 00046 rm_sp += size; 00047 };
| unsigned long virt_offset |
Referenced by gdbmach_set_breakpoint(), and UACCESS_INLINE().
| char* text16 |
Referenced by copy_user_to_rm_stack(), and remove_user_from_rm_stack().
Referenced by copy_user_to_rm_stack(), and remove_user_from_rm_stack().
1.5.7.1