summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/drivers
diff options
context:
space:
mode:
authorMichael Brown2008-07-01 03:52:13 +0200
committerMichael Brown2008-07-01 03:52:13 +0200
commit4fbbf651d7cb91983801904f5ed2b07d15566c1d (patch)
tree36e8d2ecd24b17a0fd4cbe9dfd7c0143bb0d578f /src/arch/i386/drivers
parent[pxe] Fix a typo in PXENV_GET_CACHED_INFO that broke Altiris (diff)
downloadipxe-4fbbf651d7cb91983801904f5ed2b07d15566c1d.tar.gz
ipxe-4fbbf651d7cb91983801904f5ed2b07d15566c1d.tar.xz
ipxe-4fbbf651d7cb91983801904f5ed2b07d15566c1d.zip
[i386] Change semantics of __from_data16 and __from_text16
__from_data16 and __from_text16 now take a pointer to a .data16/.text16 variable, and return the real-mode offset within the appropriate segment. This matches the use case for every occurrence of these macros, and prevents potential future bugs such as that fixed in commit d51d80f. (The bug arose essentially because "&pointer" is still syntactically valid.)
Diffstat (limited to 'src/arch/i386/drivers')
-rw-r--r--src/arch/i386/drivers/net/undiload.c4
-rw-r--r--src/arch/i386/drivers/net/undinet.c15
2 files changed, 8 insertions, 11 deletions
diff --git a/src/arch/i386/drivers/net/undiload.c b/src/arch/i386/drivers/net/undiload.c
index a3284f802..dbd9e7c20 100644
--- a/src/arch/i386/drivers/net/undiload.c
+++ b/src/arch/i386/drivers/net/undiload.c
@@ -93,8 +93,8 @@ int undi_load ( struct undi_device *undi, struct undi_rom *undirom ) {
"lcall *%c2\n\t"
"addw $4, %%sp\n\t" )
: "=a" ( exit )
- : "a" ( & __from_data16 ( undi_loader ) ),
- "p" ( & __from_data16 ( undi_loader_entry ) )
+ : "a" ( __from_data16 ( &undi_loader ) ),
+ "p" ( __from_data16 ( &undi_loader_entry ) )
: "ebx", "ecx", "edx", "esi", "edi", "ebp" );
/* UNDI API calls may rudely change the status of A20 and not
diff --git a/src/arch/i386/drivers/net/undinet.c b/src/arch/i386/drivers/net/undinet.c
index 09c29abae..12b954c07 100644
--- a/src/arch/i386/drivers/net/undinet.c
+++ b/src/arch/i386/drivers/net/undinet.c
@@ -176,9 +176,9 @@ static int undinet_call ( struct undi_nic *undinic, unsigned int function,
"addw $6, %%sp\n\t" )
: "=a" ( exit ), "=b" ( discard_b ),
"=D" ( discard_D )
- : "p" ( &__from_data16 ( undinet_entry_point )),
+ : "p" ( __from_data16 ( &undinet_entry_point )),
"b" ( function ),
- "D" ( &__from_data16 ( undinet_params ) )
+ "D" ( __from_data16 ( &undinet_params ) )
: "ecx", "edx", "esi", "ebp" );
/* UNDI API calls may rudely change the status of A20 and not
@@ -211,7 +211,7 @@ static int undinet_call ( struct undi_nic *undinic, unsigned int function,
if ( rc != 0 ) {
SEGOFF16_t rm_params = {
.segment = rm_ds,
- .offset = (intptr_t) &__from_data16 ( undinet_params ),
+ .offset = __from_data16 ( &undinet_params ),
};
DBGC ( undinic, "UNDINIC %p %s failed: %s\n", undinic,
@@ -357,17 +357,14 @@ static int undinet_transmit ( struct net_device *netdev,
/* Create PXENV_UNDI_TRANSMIT data structure */
memset ( &undi_transmit, 0, sizeof ( undi_transmit ) );
undi_transmit.DestAddr.segment = rm_ds;
- undi_transmit.DestAddr.offset
- = ( ( unsigned ) & __from_data16 ( undinet_tbd ) );
+ undi_transmit.DestAddr.offset = __from_data16 ( &undinet_tbd );
undi_transmit.TBD.segment = rm_ds;
- undi_transmit.TBD.offset
- = ( ( unsigned ) & __from_data16 ( undinet_tbd ) );
+ undi_transmit.TBD.offset = __from_data16 ( &undinet_tbd );
/* Create PXENV_UNDI_TBD data structure */
undinet_tbd.ImmedLength = len;
undinet_tbd.Xmit.segment = rm_ds;
- undinet_tbd.Xmit.offset
- = ( ( unsigned ) & __from_data16 ( basemem_packet ) );
+ undinet_tbd.Xmit.offset = __from_data16 ( basemem_packet );
/* Issue PXE API call */
if ( ( rc = undinet_call ( undinic, PXENV_UNDI_TRANSMIT,