[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.)
This commit is contained in:
Michael Brown
2008-06-30 18:52:13 -07:00
parent d51d80f785
commit 4fbbf651d7
9 changed files with 23 additions and 30 deletions

View File

@@ -42,11 +42,9 @@ PXENV_EXIT_t undi_loader ( struct s_UNDI_LOADER *undi_loader ) {
/* Fill in UNDI loader structure */
undi_loader->PXEptr.segment = rm_cs;
undi_loader->PXEptr.offset =
( ( unsigned ) & __from_text16 ( ppxe ) );
undi_loader->PXEptr.offset = __from_text16 ( &ppxe );
undi_loader->PXENVptr.segment = rm_cs;
undi_loader->PXENVptr.offset =
( ( unsigned ) & __from_text16 ( pxenv ) );
undi_loader->PXENVptr.offset = __from_text16 ( &pxenv );
undi_loader->Status = PXENV_STATUS_SUCCESS;
return PXENV_EXIT_SUCCESS;

View File

@@ -196,8 +196,7 @@ PXENV_EXIT_t pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO
* fill it in.
*/
get_cached_info->Buffer.segment = rm_ds;
get_cached_info->Buffer.offset =
( unsigned ) ( & __from_data16 ( *info ) );
get_cached_info->Buffer.offset = __from_data16 ( info );
get_cached_info->BufferSize = sizeof ( *info );
DBG ( " returning %04x:%04x+%04x['%x']",
get_cached_info->Buffer.segment,

View File

@@ -597,8 +597,7 @@ PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) {
undi_isr->FrameHeaderLength =
pxe_netdev->ll_protocol->ll_header_len;
undi_isr->Frame.segment = rm_ds;
undi_isr->Frame.offset =
( ( unsigned ) & __from_data16 ( basemem_packet ) );
undi_isr->Frame.offset = __from_data16 ( basemem_packet );
/* Probably ought to fill in packet type */
undi_isr->ProtType = P_UNKNOWN;
undi_isr->PktType = XMT_DESTADDR;