david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[bios] Use intptr_t when casting .text16 function pointers

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2016-02-16 16:24:30 +00:00
parent b9c4c2676b
commit 15fadab533
9 changed files with 24 additions and 32 deletions

View File

@ -143,8 +143,7 @@ static void undinet_hook_isr ( unsigned int irq ) {
assert ( undiisr_irq == 0 );
undiisr_irq = irq;
hook_bios_interrupt ( IRQ_INT ( irq ),
( ( unsigned int ) undiisr ),
hook_bios_interrupt ( IRQ_INT ( irq ), ( ( intptr_t ) undiisr ),
&undiisr_next_handler );
}
@ -157,8 +156,7 @@ static void undinet_unhook_isr ( unsigned int irq ) {
assert ( irq <= IRQ_MAX );
unhook_bios_interrupt ( IRQ_INT ( irq ),
( ( unsigned int ) undiisr ),
unhook_bios_interrupt ( IRQ_INT ( irq ), ( ( intptr_t ) undiisr ),
&undiisr_next_handler );
undiisr_irq = 0;
}

View File

@ -543,7 +543,7 @@ static void bios_inject_startup ( void ) {
: : "i" ( bios_inject ) );
/* Hook INT 16 */
hook_bios_interrupt ( 0x16, ( ( unsigned int ) int16_wrapper ),
hook_bios_interrupt ( 0x16, ( ( intptr_t ) int16_wrapper ),
&int16_vector );
}
@ -555,7 +555,7 @@ static void bios_inject_startup ( void ) {
static void bios_inject_shutdown ( int booting __unused ) {
/* Unhook INT 16 */
unhook_bios_interrupt ( 0x16, ( ( unsigned int ) int16_wrapper ),
unhook_bios_interrupt ( 0x16, ( ( intptr_t ) int16_wrapper ),
&int16_vector );
}

View File

@ -88,11 +88,11 @@ void fake_e820 ( void ) {
"ljmp *%%cs:real_int15_vector\n\t" )
: : "i" ( sizeof ( e820map ) ) );
hook_bios_interrupt ( 0x15, ( unsigned int ) int15_fakee820,
hook_bios_interrupt ( 0x15, ( intptr_t ) int15_fakee820,
&real_int15_vector );
}
void unfake_e820 ( void ) {
unhook_bios_interrupt ( 0x15, ( unsigned int ) int15_fakee820,
unhook_bios_interrupt ( 0x15, ( intptr_t ) int15_fakee820,
&real_int15_vector );
}

View File

@ -179,8 +179,7 @@ static void hide_etherboot ( void ) {
}
/* Hook INT 15 */
hook_bios_interrupt ( 0x15, ( unsigned int ) int15,
&int15_vector );
hook_bios_interrupt ( 0x15, ( intptr_t ) int15, &int15_vector );
/* Dump memory map after mangling */
DBG ( "Hidden iPXE from system memory map\n" );
@ -210,7 +209,7 @@ static void unhide_etherboot ( int flags __unused ) {
}
/* 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 ) {
DBG ( "Cannot unhook INT15: %s\n", strerror ( rc ) );
/* Leave it hooked; there's nothing else we can do,

View File

@ -71,9 +71,9 @@ int call_bootsector ( unsigned int segment, unsigned int offset,
DBG ( "Booting from boot sector at %04x:%04x\n", segment, offset );
/* 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 );
hook_bios_interrupt ( 0x19, ( unsigned int ) bootsector_exec_fail,
hook_bios_interrupt ( 0x19, ( intptr_t ) bootsector_exec_fail,
&int19_vector );
/* 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" );
/* 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 );
unhook_bios_interrupt ( 0x19, ( unsigned int ) bootsector_exec_fail,
unhook_bios_interrupt ( 0x19, ( intptr_t ) bootsector_exec_fail,
&int19_vector );
return -ECANCELED;

View File

@ -1516,15 +1516,14 @@ static void int13_hook_vector ( void ) {
"iret\n\t" )
: : "i" ( int13 ) );
hook_bios_interrupt ( 0x13, ( unsigned int ) int13_wrapper,
&int13_vector );
hook_bios_interrupt ( 0x13, ( intptr_t ) int13_wrapper, &int13_vector );
}
/**
* Unhook INT 13 handler
*/
static void int13_unhook_vector ( void ) {
unhook_bios_interrupt ( 0x13, ( unsigned int ) int13_wrapper,
unhook_bios_interrupt ( 0x13, ( intptr_t ) int13_wrapper,
&int13_vector );
}

View File

@ -77,8 +77,7 @@ static void rtc_hook_isr ( void ) {
"i" ( CMOS_ADDRESS ), "i" ( CMOS_DATA ),
"i" ( RTC_STATUS_C ) );
hook_bios_interrupt ( RTC_INT, ( unsigned int ) rtc_isr,
&rtc_old_handler );
hook_bios_interrupt ( RTC_INT, ( intptr_t ) rtc_isr, &rtc_old_handler );
}
/**
@ -88,7 +87,7 @@ static void rtc_hook_isr ( void ) {
static void rtc_unhook_isr ( void ) {
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 );
assert ( rc == 0 ); /* Should always be able to unhook */
}

View File

@ -278,7 +278,7 @@ void pxe_activate ( struct net_device *netdev ) {
/* Ensure INT 1A is 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 );
devices_get();
int_1a_hooked = 1;
@ -311,7 +311,7 @@ int pxe_deactivate ( void ) {
/* Ensure INT 1A is unhooked, if possible */
if ( int_1a_hooked ) {
if ( ( rc = unhook_bios_interrupt ( 0x1a,
(unsigned int) pxe_int_1a,
( intptr_t ) pxe_int_1a,
&pxe_int_1a_vector ))!= 0){
DBGC ( &pxe_netdev, "PXE could not unhook INT 1A: %s\n",
strerror ( rc ) );

View File

@ -668,8 +668,7 @@ void hook_comboot_interrupts ( ) {
"iret\n\t" )
: : "i" ( int20 ) );
hook_bios_interrupt ( 0x20, ( unsigned int ) int20_wrapper,
&int20_vector );
hook_bios_interrupt ( 0x20, ( intptr_t ) int20_wrapper, &int20_vector );
__asm__ __volatile__ (
TEXT16_CODE ( "\nint21_wrapper:\n\t"
@ -681,8 +680,7 @@ void hook_comboot_interrupts ( ) {
"iret\n\t" )
: : "i" ( int21 ) );
hook_bios_interrupt ( 0x21, ( unsigned int ) int21_wrapper,
&int21_vector );
hook_bios_interrupt ( 0x21, ( intptr_t ) int21_wrapper, &int21_vector );
__asm__ __volatile__ (
TEXT16_CODE ( "\nint22_wrapper:\n\t"
@ -694,8 +692,7 @@ void hook_comboot_interrupts ( ) {
"iret\n\t" )
: : "i" ( int22) );
hook_bios_interrupt ( 0x22, ( unsigned int ) int22_wrapper,
&int22_vector );
hook_bios_interrupt ( 0x22, ( intptr_t ) int22_wrapper, &int22_vector );
}
/**
@ -703,13 +700,13 @@ void hook_comboot_interrupts ( ) {
*/
void unhook_comboot_interrupts ( ) {
unhook_bios_interrupt ( 0x20, ( unsigned int ) int20_wrapper,
unhook_bios_interrupt ( 0x20, ( intptr_t ) int20_wrapper,
&int20_vector );
unhook_bios_interrupt ( 0x21, ( unsigned int ) int21_wrapper,
unhook_bios_interrupt ( 0x21, ( intptr_t ) int21_wrapper,
&int21_vector );
unhook_bios_interrupt ( 0x22, ( unsigned int ) int22_wrapper,
unhook_bios_interrupt ( 0x22, ( intptr_t ) int22_wrapper,
&int22_vector );
}