mirror of https://github.com/ipxe/ipxe.git
[bios] Use intptr_t when casting .text16 function pointers
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/45/head
parent
b9c4c2676b
commit
15fadab533
|
@ -143,8 +143,7 @@ static void undinet_hook_isr ( unsigned int irq ) {
|
||||||
assert ( undiisr_irq == 0 );
|
assert ( undiisr_irq == 0 );
|
||||||
|
|
||||||
undiisr_irq = irq;
|
undiisr_irq = irq;
|
||||||
hook_bios_interrupt ( IRQ_INT ( irq ),
|
hook_bios_interrupt ( IRQ_INT ( irq ), ( ( intptr_t ) undiisr ),
|
||||||
( ( unsigned int ) undiisr ),
|
|
||||||
&undiisr_next_handler );
|
&undiisr_next_handler );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,8 +156,7 @@ static void undinet_unhook_isr ( unsigned int irq ) {
|
||||||
|
|
||||||
assert ( irq <= IRQ_MAX );
|
assert ( irq <= IRQ_MAX );
|
||||||
|
|
||||||
unhook_bios_interrupt ( IRQ_INT ( irq ),
|
unhook_bios_interrupt ( IRQ_INT ( irq ), ( ( intptr_t ) undiisr ),
|
||||||
( ( unsigned int ) undiisr ),
|
|
||||||
&undiisr_next_handler );
|
&undiisr_next_handler );
|
||||||
undiisr_irq = 0;
|
undiisr_irq = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -543,7 +543,7 @@ static void bios_inject_startup ( void ) {
|
||||||
: : "i" ( bios_inject ) );
|
: : "i" ( bios_inject ) );
|
||||||
|
|
||||||
/* Hook INT 16 */
|
/* Hook INT 16 */
|
||||||
hook_bios_interrupt ( 0x16, ( ( unsigned int ) int16_wrapper ),
|
hook_bios_interrupt ( 0x16, ( ( intptr_t ) int16_wrapper ),
|
||||||
&int16_vector );
|
&int16_vector );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@ static void bios_inject_startup ( void ) {
|
||||||
static void bios_inject_shutdown ( int booting __unused ) {
|
static void bios_inject_shutdown ( int booting __unused ) {
|
||||||
|
|
||||||
/* Unhook INT 16 */
|
/* Unhook INT 16 */
|
||||||
unhook_bios_interrupt ( 0x16, ( ( unsigned int ) int16_wrapper ),
|
unhook_bios_interrupt ( 0x16, ( ( intptr_t ) int16_wrapper ),
|
||||||
&int16_vector );
|
&int16_vector );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,11 +88,11 @@ void fake_e820 ( void ) {
|
||||||
"ljmp *%%cs:real_int15_vector\n\t" )
|
"ljmp *%%cs:real_int15_vector\n\t" )
|
||||||
: : "i" ( sizeof ( e820map ) ) );
|
: : "i" ( sizeof ( e820map ) ) );
|
||||||
|
|
||||||
hook_bios_interrupt ( 0x15, ( unsigned int ) int15_fakee820,
|
hook_bios_interrupt ( 0x15, ( intptr_t ) int15_fakee820,
|
||||||
&real_int15_vector );
|
&real_int15_vector );
|
||||||
}
|
}
|
||||||
|
|
||||||
void unfake_e820 ( void ) {
|
void unfake_e820 ( void ) {
|
||||||
unhook_bios_interrupt ( 0x15, ( unsigned int ) int15_fakee820,
|
unhook_bios_interrupt ( 0x15, ( intptr_t ) int15_fakee820,
|
||||||
&real_int15_vector );
|
&real_int15_vector );
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,8 +179,7 @@ static void hide_etherboot ( void ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hook INT 15 */
|
/* Hook INT 15 */
|
||||||
hook_bios_interrupt ( 0x15, ( unsigned int ) int15,
|
hook_bios_interrupt ( 0x15, ( intptr_t ) int15, &int15_vector );
|
||||||
&int15_vector );
|
|
||||||
|
|
||||||
/* Dump memory map after mangling */
|
/* Dump memory map after mangling */
|
||||||
DBG ( "Hidden iPXE from system memory map\n" );
|
DBG ( "Hidden iPXE from system memory map\n" );
|
||||||
|
@ -210,7 +209,7 @@ static void unhide_etherboot ( int flags __unused ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to unhook INT 15 */
|
/* Try to unhook INT 15 */
|
||||||
if ( ( rc = unhook_bios_interrupt ( 0x15, ( unsigned int ) int15,
|
if ( ( rc = unhook_bios_interrupt ( 0x15, ( intptr_t ) int15,
|
||||||
&int15_vector ) ) != 0 ) {
|
&int15_vector ) ) != 0 ) {
|
||||||
DBG ( "Cannot unhook INT15: %s\n", strerror ( rc ) );
|
DBG ( "Cannot unhook INT15: %s\n", strerror ( rc ) );
|
||||||
/* Leave it hooked; there's nothing else we can do,
|
/* Leave it hooked; there's nothing else we can do,
|
||||||
|
|
|
@ -71,9 +71,9 @@ int call_bootsector ( unsigned int segment, unsigned int offset,
|
||||||
DBG ( "Booting from boot sector at %04x:%04x\n", segment, offset );
|
DBG ( "Booting from boot sector at %04x:%04x\n", segment, offset );
|
||||||
|
|
||||||
/* Hook INTs 18 and 19 to capture failure paths */
|
/* Hook INTs 18 and 19 to capture failure paths */
|
||||||
hook_bios_interrupt ( 0x18, ( unsigned int ) bootsector_exec_fail,
|
hook_bios_interrupt ( 0x18, ( intptr_t ) bootsector_exec_fail,
|
||||||
&int18_vector );
|
&int18_vector );
|
||||||
hook_bios_interrupt ( 0x19, ( unsigned int ) bootsector_exec_fail,
|
hook_bios_interrupt ( 0x19, ( intptr_t ) bootsector_exec_fail,
|
||||||
&int19_vector );
|
&int19_vector );
|
||||||
|
|
||||||
/* Boot the loaded sector
|
/* Boot the loaded sector
|
||||||
|
@ -132,9 +132,9 @@ int call_bootsector ( unsigned int segment, unsigned int offset,
|
||||||
DBG ( "Booted disk returned via INT 18 or 19\n" );
|
DBG ( "Booted disk returned via INT 18 or 19\n" );
|
||||||
|
|
||||||
/* Unhook INTs 18 and 19 */
|
/* Unhook INTs 18 and 19 */
|
||||||
unhook_bios_interrupt ( 0x18, ( unsigned int ) bootsector_exec_fail,
|
unhook_bios_interrupt ( 0x18, ( intptr_t ) bootsector_exec_fail,
|
||||||
&int18_vector );
|
&int18_vector );
|
||||||
unhook_bios_interrupt ( 0x19, ( unsigned int ) bootsector_exec_fail,
|
unhook_bios_interrupt ( 0x19, ( intptr_t ) bootsector_exec_fail,
|
||||||
&int19_vector );
|
&int19_vector );
|
||||||
|
|
||||||
return -ECANCELED;
|
return -ECANCELED;
|
||||||
|
|
|
@ -1516,15 +1516,14 @@ static void int13_hook_vector ( void ) {
|
||||||
"iret\n\t" )
|
"iret\n\t" )
|
||||||
: : "i" ( int13 ) );
|
: : "i" ( int13 ) );
|
||||||
|
|
||||||
hook_bios_interrupt ( 0x13, ( unsigned int ) int13_wrapper,
|
hook_bios_interrupt ( 0x13, ( intptr_t ) int13_wrapper, &int13_vector );
|
||||||
&int13_vector );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unhook INT 13 handler
|
* Unhook INT 13 handler
|
||||||
*/
|
*/
|
||||||
static void int13_unhook_vector ( void ) {
|
static void int13_unhook_vector ( void ) {
|
||||||
unhook_bios_interrupt ( 0x13, ( unsigned int ) int13_wrapper,
|
unhook_bios_interrupt ( 0x13, ( intptr_t ) int13_wrapper,
|
||||||
&int13_vector );
|
&int13_vector );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,8 +77,7 @@ static void rtc_hook_isr ( void ) {
|
||||||
"i" ( CMOS_ADDRESS ), "i" ( CMOS_DATA ),
|
"i" ( CMOS_ADDRESS ), "i" ( CMOS_DATA ),
|
||||||
"i" ( RTC_STATUS_C ) );
|
"i" ( RTC_STATUS_C ) );
|
||||||
|
|
||||||
hook_bios_interrupt ( RTC_INT, ( unsigned int ) rtc_isr,
|
hook_bios_interrupt ( RTC_INT, ( intptr_t ) rtc_isr, &rtc_old_handler );
|
||||||
&rtc_old_handler );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +87,7 @@ static void rtc_hook_isr ( void ) {
|
||||||
static void rtc_unhook_isr ( void ) {
|
static void rtc_unhook_isr ( void ) {
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = unhook_bios_interrupt ( RTC_INT, ( unsigned int ) rtc_isr,
|
rc = unhook_bios_interrupt ( RTC_INT, ( intptr_t ) rtc_isr,
|
||||||
&rtc_old_handler );
|
&rtc_old_handler );
|
||||||
assert ( rc == 0 ); /* Should always be able to unhook */
|
assert ( rc == 0 ); /* Should always be able to unhook */
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,7 +278,7 @@ void pxe_activate ( struct net_device *netdev ) {
|
||||||
|
|
||||||
/* Ensure INT 1A is hooked */
|
/* Ensure INT 1A is hooked */
|
||||||
if ( ! int_1a_hooked ) {
|
if ( ! int_1a_hooked ) {
|
||||||
hook_bios_interrupt ( 0x1a, ( unsigned int ) pxe_int_1a,
|
hook_bios_interrupt ( 0x1a, ( intptr_t ) pxe_int_1a,
|
||||||
&pxe_int_1a_vector );
|
&pxe_int_1a_vector );
|
||||||
devices_get();
|
devices_get();
|
||||||
int_1a_hooked = 1;
|
int_1a_hooked = 1;
|
||||||
|
@ -311,7 +311,7 @@ int pxe_deactivate ( void ) {
|
||||||
/* Ensure INT 1A is unhooked, if possible */
|
/* Ensure INT 1A is unhooked, if possible */
|
||||||
if ( int_1a_hooked ) {
|
if ( int_1a_hooked ) {
|
||||||
if ( ( rc = unhook_bios_interrupt ( 0x1a,
|
if ( ( rc = unhook_bios_interrupt ( 0x1a,
|
||||||
(unsigned int) pxe_int_1a,
|
( intptr_t ) pxe_int_1a,
|
||||||
&pxe_int_1a_vector ))!= 0){
|
&pxe_int_1a_vector ))!= 0){
|
||||||
DBGC ( &pxe_netdev, "PXE could not unhook INT 1A: %s\n",
|
DBGC ( &pxe_netdev, "PXE could not unhook INT 1A: %s\n",
|
||||||
strerror ( rc ) );
|
strerror ( rc ) );
|
||||||
|
|
|
@ -668,8 +668,7 @@ void hook_comboot_interrupts ( ) {
|
||||||
"iret\n\t" )
|
"iret\n\t" )
|
||||||
: : "i" ( int20 ) );
|
: : "i" ( int20 ) );
|
||||||
|
|
||||||
hook_bios_interrupt ( 0x20, ( unsigned int ) int20_wrapper,
|
hook_bios_interrupt ( 0x20, ( intptr_t ) int20_wrapper, &int20_vector );
|
||||||
&int20_vector );
|
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
TEXT16_CODE ( "\nint21_wrapper:\n\t"
|
TEXT16_CODE ( "\nint21_wrapper:\n\t"
|
||||||
|
@ -681,8 +680,7 @@ void hook_comboot_interrupts ( ) {
|
||||||
"iret\n\t" )
|
"iret\n\t" )
|
||||||
: : "i" ( int21 ) );
|
: : "i" ( int21 ) );
|
||||||
|
|
||||||
hook_bios_interrupt ( 0x21, ( unsigned int ) int21_wrapper,
|
hook_bios_interrupt ( 0x21, ( intptr_t ) int21_wrapper, &int21_vector );
|
||||||
&int21_vector );
|
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
TEXT16_CODE ( "\nint22_wrapper:\n\t"
|
TEXT16_CODE ( "\nint22_wrapper:\n\t"
|
||||||
|
@ -694,8 +692,7 @@ void hook_comboot_interrupts ( ) {
|
||||||
"iret\n\t" )
|
"iret\n\t" )
|
||||||
: : "i" ( int22) );
|
: : "i" ( int22) );
|
||||||
|
|
||||||
hook_bios_interrupt ( 0x22, ( unsigned int ) int22_wrapper,
|
hook_bios_interrupt ( 0x22, ( intptr_t ) int22_wrapper, &int22_vector );
|
||||||
&int22_vector );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -703,13 +700,13 @@ void hook_comboot_interrupts ( ) {
|
||||||
*/
|
*/
|
||||||
void unhook_comboot_interrupts ( ) {
|
void unhook_comboot_interrupts ( ) {
|
||||||
|
|
||||||
unhook_bios_interrupt ( 0x20, ( unsigned int ) int20_wrapper,
|
unhook_bios_interrupt ( 0x20, ( intptr_t ) int20_wrapper,
|
||||||
&int20_vector );
|
&int20_vector );
|
||||||
|
|
||||||
unhook_bios_interrupt ( 0x21, ( unsigned int ) int21_wrapper,
|
unhook_bios_interrupt ( 0x21, ( intptr_t ) int21_wrapper,
|
||||||
&int21_vector );
|
&int21_vector );
|
||||||
|
|
||||||
unhook_bios_interrupt ( 0x22, ( unsigned int ) int22_wrapper,
|
unhook_bios_interrupt ( 0x22, ( intptr_t ) int22_wrapper,
|
||||||
&int22_vector );
|
&int22_vector );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue