summaryrefslogtreecommitdiffstats
path: root/src/arch/x86
diff options
context:
space:
mode:
authorSimon Rettberg2024-04-12 14:00:15 +0200
committerSimon Rettberg2024-04-12 14:00:15 +0200
commit98dc341428e247141f120d05fac48c4e144a4c0f (patch)
tree3ebacb37927e338383ac64c2e20eb0b2f820cb85 /src/arch/x86
parentMerge branch 'master' into openslx (diff)
parentMerge branch 'ipxe:master' into aqc1xx (diff)
downloadipxe-98dc341428e247141f120d05fac48c4e144a4c0f.tar.gz
ipxe-98dc341428e247141f120d05fac48c4e144a4c0f.tar.xz
ipxe-98dc341428e247141f120d05fac48c4e144a4c0f.zip
Merge branch 'aqc1xx' into openslx
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/core/patch_cf.S3
-rw-r--r--src/arch/x86/core/stack.S1
-rw-r--r--src/arch/x86/core/stack16.S1
-rw-r--r--src/arch/x86/core/x86_bigint.c26
-rw-r--r--src/arch/x86/drivers/net/undiisr.S3
-rw-r--r--src/arch/x86/include/bits/bigint.h4
-rw-r--r--src/arch/x86/interface/efi/efix86_nap.c6
-rw-r--r--src/arch/x86/interface/pcbios/bios_smbios.c55
-rw-r--r--src/arch/x86/interface/pcbios/e820mangler.S3
-rw-r--r--src/arch/x86/interface/pcbios/int13.c215
-rw-r--r--src/arch/x86/interface/pcbios/pcicloud.c25
-rw-r--r--src/arch/x86/interface/pxe/pxe_entry.S1
-rw-r--r--src/arch/x86/prefix/bootpart.S3
-rw-r--r--src/arch/x86/prefix/dskprefix.S3
-rw-r--r--src/arch/x86/prefix/exeprefix.S3
-rw-r--r--src/arch/x86/prefix/hdprefix.S3
-rw-r--r--src/arch/x86/prefix/libprefix.S1
-rw-r--r--src/arch/x86/prefix/lkrnprefix.S3
-rw-r--r--src/arch/x86/prefix/mbr.S3
-rw-r--r--src/arch/x86/prefix/mromprefix.S3
-rw-r--r--src/arch/x86/prefix/nbiprefix.S3
-rw-r--r--src/arch/x86/prefix/nullprefix.S3
-rw-r--r--src/arch/x86/prefix/pxeprefix.S3
-rw-r--r--src/arch/x86/prefix/rawprefix.S3
-rw-r--r--src/arch/x86/prefix/romprefix.S1
-rw-r--r--src/arch/x86/prefix/undiloader.S1
-rw-r--r--src/arch/x86/prefix/unlzma.S2
-rw-r--r--src/arch/x86/prefix/usbdisk.S3
-rw-r--r--src/arch/x86/transitions/liba20.S1
-rw-r--r--src/arch/x86/transitions/libkir.S3
30 files changed, 222 insertions, 166 deletions
diff --git a/src/arch/x86/core/patch_cf.S b/src/arch/x86/core/patch_cf.S
index 63730c3f..62f19e45 100644
--- a/src/arch/x86/core/patch_cf.S
+++ b/src/arch/x86/core/patch_cf.S
@@ -23,9 +23,8 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
- .text
- .arch i386
.code16
+ .arch i386
/****************************************************************************
* Set/clear CF on the stack as appropriate, assumes stack is as it should
diff --git a/src/arch/x86/core/stack.S b/src/arch/x86/core/stack.S
index 49345347..1bcaf18f 100644
--- a/src/arch/x86/core/stack.S
+++ b/src/arch/x86/core/stack.S
@@ -1,7 +1,6 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
- .arch i386
#ifdef __x86_64__
#define STACK_SIZE 8192
diff --git a/src/arch/x86/core/stack16.S b/src/arch/x86/core/stack16.S
index d3949a55..622887ea 100644
--- a/src/arch/x86/core/stack16.S
+++ b/src/arch/x86/core/stack16.S
@@ -1,7 +1,6 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
- .arch i386
/****************************************************************************
* Internal stack
diff --git a/src/arch/x86/core/x86_bigint.c b/src/arch/x86/core/x86_bigint.c
index 9a25bdad..74e5da9a 100644
--- a/src/arch/x86/core/x86_bigint.c
+++ b/src/arch/x86/core/x86_bigint.c
@@ -36,19 +36,23 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* Multiply big integers
*
* @v multiplicand0 Element 0 of big integer to be multiplied
+ * @v multiplicand_size Number of elements in multiplicand
* @v multiplier0 Element 0 of big integer to be multiplied
+ * @v multiplier_size Number of elements in multiplier
* @v result0 Element 0 of big integer to hold result
- * @v size Number of elements
*/
void bigint_multiply_raw ( const uint32_t *multiplicand0,
+ unsigned int multiplicand_size,
const uint32_t *multiplier0,
- uint32_t *result0, unsigned int size ) {
- const bigint_t ( size ) __attribute__ (( may_alias )) *multiplicand =
- ( ( const void * ) multiplicand0 );
- const bigint_t ( size ) __attribute__ (( may_alias )) *multiplier =
- ( ( const void * ) multiplier0 );
- bigint_t ( size * 2 ) __attribute__ (( may_alias )) *result =
- ( ( void * ) result0 );
+ unsigned int multiplier_size,
+ uint32_t *result0 ) {
+ unsigned int result_size = ( multiplicand_size + multiplier_size );
+ const bigint_t ( multiplicand_size ) __attribute__ (( may_alias ))
+ *multiplicand = ( ( const void * ) multiplicand0 );
+ const bigint_t ( multiplier_size ) __attribute__ (( may_alias ))
+ *multiplier = ( ( const void * ) multiplier0 );
+ bigint_t ( result_size ) __attribute__ (( may_alias ))
+ *result = ( ( void * ) result0 );
unsigned int i;
unsigned int j;
uint32_t multiplicand_element;
@@ -62,9 +66,9 @@ void bigint_multiply_raw ( const uint32_t *multiplicand0,
memset ( result, 0, sizeof ( *result ) );
/* Multiply integers one element at a time */
- for ( i = 0 ; i < size ; i++ ) {
+ for ( i = 0 ; i < multiplicand_size ; i++ ) {
multiplicand_element = multiplicand->element[i];
- for ( j = 0 ; j < size ; j++ ) {
+ for ( j = 0 ; j < multiplier_size ; j++ ) {
multiplier_element = multiplier->element[j];
result_elements = &result->element[ i + j ];
/* Perform a single multiply, and add the
@@ -73,7 +77,7 @@ void bigint_multiply_raw ( const uint32_t *multiplicand0,
* never overflow beyond the end of the
* result, since:
*
- * a < 2^{n}, b < 2^{n} => ab < 2^{2n}
+ * a < 2^{n}, b < 2^{m} => ab < 2^{n+m}
*/
__asm__ __volatile__ ( "mull %5\n\t"
"addl %%eax, (%6,%2,4)\n\t"
diff --git a/src/arch/x86/drivers/net/undiisr.S b/src/arch/x86/drivers/net/undiisr.S
index a1098b83..8ba5c535 100644
--- a/src/arch/x86/drivers/net/undiisr.S
+++ b/src/arch/x86/drivers/net/undiisr.S
@@ -11,9 +11,8 @@ FILE_LICENCE ( GPL2_OR_LATER )
#define PIC2_ICR 0xa0
.section ".note.GNU-stack", "", @progbits
- .text
- .arch i386
.code16
+ .arch i386
.section ".text16", "ax", @progbits
.globl undiisr
diff --git a/src/arch/x86/include/bits/bigint.h b/src/arch/x86/include/bits/bigint.h
index 7443d6fd..a6bc2ca1 100644
--- a/src/arch/x86/include/bits/bigint.h
+++ b/src/arch/x86/include/bits/bigint.h
@@ -323,7 +323,9 @@ bigint_done_raw ( const uint32_t *value0, unsigned int size __unused,
}
extern void bigint_multiply_raw ( const uint32_t *multiplicand0,
+ unsigned int multiplicand_size,
const uint32_t *multiplier0,
- uint32_t *value0, unsigned int size );
+ unsigned int multiplier_size,
+ uint32_t *value0 );
#endif /* _BITS_BIGINT_H */
diff --git a/src/arch/x86/interface/efi/efix86_nap.c b/src/arch/x86/interface/efi/efix86_nap.c
index 3ebf0bd6..296876b8 100644
--- a/src/arch/x86/interface/efi/efix86_nap.c
+++ b/src/arch/x86/interface/efi/efix86_nap.c
@@ -46,8 +46,12 @@ static void efix86_cpu_nap ( void ) {
* The EFI shell doesn't seem to bother sleeping the CPU; it
* just sits there idly burning power.
*
+ * If a shutdown is in progess, there may be nothing to
+ * generate an interrupt since the timer is disabled in the
+ * first step of ExitBootServices().
*/
- __asm__ __volatile__ ( "hlt" );
+ if ( ! efi_shutdown_in_progress )
+ __asm__ __volatile__ ( "hlt" );
}
PROVIDE_NAP ( efix86, cpu_nap, efix86_cpu_nap );
diff --git a/src/arch/x86/interface/pcbios/bios_smbios.c b/src/arch/x86/interface/pcbios/bios_smbios.c
index a8c0fc32..366679d3 100644
--- a/src/arch/x86/interface/pcbios/bios_smbios.c
+++ b/src/arch/x86/interface/pcbios/bios_smbios.c
@@ -44,11 +44,11 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* @v smbios SMBIOS entry point descriptor structure to fill in
* @ret rc Return status code
*/
-static int bios_find_smbios ( struct smbios *smbios ) {
+static int bios_find_smbios2 ( struct smbios *smbios ) {
struct smbios_entry entry;
int rc;
- /* Scan through BIOS segment to find SMBIOS entry point */
+ /* Scan through BIOS segment to find SMBIOS 32-bit entry point */
if ( ( rc = find_smbios_entry ( real_to_user ( BIOS_SEG, 0 ), 0x10000,
&entry ) ) != 0 )
return rc;
@@ -62,4 +62,55 @@ static int bios_find_smbios ( struct smbios *smbios ) {
return 0;
}
+/**
+ * Find SMBIOS
+ *
+ * @v smbios SMBIOS entry point descriptor structure to fill in
+ * @ret rc Return status code
+ */
+static int bios_find_smbios3 ( struct smbios *smbios ) {
+ struct smbios3_entry entry;
+ int rc;
+
+ /* Scan through BIOS segment to find SMBIOS 64-bit entry point */
+ if ( ( rc = find_smbios3_entry ( real_to_user ( BIOS_SEG, 0 ), 0x10000,
+ &entry ) ) != 0 )
+ return rc;
+
+ /* Check that address is accessible */
+ if ( entry.smbios_address > ~( ( physaddr_t ) 0 ) ) {
+ DBG ( "SMBIOS3 at %08llx is inaccessible\n",
+ ( ( unsigned long long ) entry.smbios_address ) );
+ return -ENOTSUP;
+ }
+
+ /* Fill in entry point descriptor structure */
+ smbios->address = phys_to_user ( entry.smbios_address );
+ smbios->len = entry.smbios_len;
+ smbios->count = 0;
+ smbios->version = SMBIOS_VERSION ( entry.major, entry.minor );
+
+ return 0;
+}
+
+/**
+ * Find SMBIOS
+ *
+ * @v smbios SMBIOS entry point descriptor structure to fill in
+ * @ret rc Return status code
+ */
+static int bios_find_smbios ( struct smbios *smbios ) {
+ int rc;
+
+ /* Use 32-bit table if present */
+ if ( ( rc = bios_find_smbios2 ( smbios ) ) == 0 )
+ return 0;
+
+ /* Otherwise, use 64-bit table if present and accessible */
+ if ( ( rc = bios_find_smbios3 ( smbios ) ) == 0 )
+ return 0;
+
+ return rc;
+}
+
PROVIDE_SMBIOS ( pcbios, find_smbios, bios_find_smbios );
diff --git a/src/arch/x86/interface/pcbios/e820mangler.S b/src/arch/x86/interface/pcbios/e820mangler.S
index 46e1cab4..ef5dc275 100644
--- a/src/arch/x86/interface/pcbios/e820mangler.S
+++ b/src/arch/x86/interface/pcbios/e820mangler.S
@@ -24,9 +24,8 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
- .text
- .arch i386
.code16
+ .arch i386
#define SMAP 0x534d4150
diff --git a/src/arch/x86/interface/pcbios/int13.c b/src/arch/x86/interface/pcbios/int13.c
index d6c4d7eb..372d40ba 100644
--- a/src/arch/x86/interface/pcbios/int13.c
+++ b/src/arch/x86/interface/pcbios/int13.c
@@ -183,8 +183,8 @@ static int int13_parse_eltorito ( struct san_device *sandev, void *scratch ) {
/* Read boot record volume descriptor */
if ( ( rc = sandev_read ( sandev, ELTORITO_LBA, 1,
virt_to_user ( boot ) ) ) != 0 ) {
- DBGC ( sandev, "INT13 drive %02x could not read El Torito boot "
- "record volume descriptor: %s\n",
+ DBGC ( sandev->drive, "INT13 drive %02x could not read El "
+ "Torito boot record volume descriptor: %s\n",
sandev->drive, strerror ( rc ) );
return rc;
}
@@ -192,10 +192,11 @@ static int int13_parse_eltorito ( struct san_device *sandev, void *scratch ) {
/* Check for an El Torito boot catalog */
if ( memcmp ( boot, &boot_check, sizeof ( boot_check ) ) == 0 ) {
int13->boot_catalog = boot->sector;
- DBGC ( sandev, "INT13 drive %02x has an El Torito boot catalog "
- "at LBA %08x\n", sandev->drive, int13->boot_catalog );
+ DBGC ( sandev->drive, "INT13 drive %02x has an El Torito boot "
+ "catalog at LBA %08x\n", sandev->drive,
+ int13->boot_catalog );
} else {
- DBGC ( sandev, "INT13 drive %02x has no El Torito boot "
+ DBGC ( sandev->drive, "INT13 drive %02x has no El Torito boot "
"catalog\n", sandev->drive );
}
@@ -228,14 +229,14 @@ static int int13_guess_geometry_hdd ( struct san_device *sandev, void *scratch,
/* Read partition table */
if ( ( rc = sandev_read ( sandev, 0, 1, virt_to_user ( mbr ) ) ) != 0 ) {
- DBGC ( sandev, "INT13 drive %02x could not read "
+ DBGC ( sandev->drive, "INT13 drive %02x could not read "
"partition table to guess geometry: %s\n",
sandev->drive, strerror ( rc ) );
return rc;
}
- DBGC2 ( sandev, "INT13 drive %02x has MBR:\n", sandev->drive );
- DBGC2_HDA ( sandev, 0, mbr, sizeof ( *mbr ) );
- DBGC ( sandev, "INT13 drive %02x has signature %08x\n",
+ DBGC2 ( sandev->drive, "INT13 drive %02x has MBR:\n", sandev->drive );
+ DBGC2_HDA ( sandev->drive, 0, mbr, sizeof ( *mbr ) );
+ DBGC ( sandev->drive, "INT13 drive %02x has signature %08x\n",
sandev->drive, mbr->signature );
/* Scan through partition table and modify guesses for
@@ -260,8 +261,8 @@ static int int13_guess_geometry_hdd ( struct san_device *sandev, void *scratch,
if ( ( start_cylinder == 0 ) && ( start_head != 0 ) ) {
*sectors = ( ( partition->start + 1 - start_sector ) /
start_head );
- DBGC ( sandev, "INT13 drive %02x guessing C/H/S "
- "xx/xx/%d based on partition %d\n",
+ DBGC ( sandev->drive, "INT13 drive %02x guessing "
+ "C/H/S xx/xx/%d based on partition %d\n",
sandev->drive, *sectors, ( i + 1 ) );
}
@@ -272,14 +273,14 @@ static int int13_guess_geometry_hdd ( struct san_device *sandev, void *scratch,
end_sector = PART_SECTOR ( partition->chs_end );
if ( ( end_head + 1 ) > *heads ) {
*heads = ( end_head + 1 );
- DBGC ( sandev, "INT13 drive %02x guessing C/H/S "
- "xx/%d/xx based on partition %d\n",
+ DBGC ( sandev->drive, "INT13 drive %02x guessing "
+ "C/H/S xx/%d/xx based on partition %d\n",
sandev->drive, *heads, ( i + 1 ) );
}
if ( end_sector > *sectors ) {
*sectors = end_sector;
- DBGC ( sandev, "INT13 drive %02x guessing C/H/S "
- "xx/xx/%d based on partition %d\n",
+ DBGC ( sandev->drive, "INT13 drive %02x guessing "
+ "C/H/S xx/xx/%d based on partition %d\n",
sandev->drive, *sectors, ( i + 1 ) );
}
}
@@ -343,9 +344,10 @@ static int int13_guess_geometry_fdd ( struct san_device *sandev,
*heads = INT13_FDD_HEADS ( geometry );
*sectors = INT13_FDD_SECTORS ( geometry );
if ( ( cylinders * (*heads) * (*sectors) ) == blocks ) {
- DBGC ( sandev, "INT13 drive %02x guessing C/H/S "
- "%d/%d/%d based on size %dK\n", sandev->drive,
- cylinders, *heads, *sectors, ( blocks / 2 ) );
+ DBGC ( sandev->drive, "INT13 drive %02x guessing "
+ "C/H/S %d/%d/%d based on size %dK\n",
+ sandev->drive, cylinders, *heads, *sectors,
+ ( blocks / 2 ) );
return 0;
}
}
@@ -355,8 +357,9 @@ static int int13_guess_geometry_fdd ( struct san_device *sandev,
*/
*heads = 2;
*sectors = 18;
- DBGC ( sandev, "INT13 drive %02x guessing C/H/S xx/%d/%d based on size "
- "%dK\n", sandev->drive, *heads, *sectors, ( blocks / 2 ) );
+ DBGC ( sandev->drive, "INT13 drive %02x guessing C/H/S xx/%d/%d "
+ "based on size %dK\n", sandev->drive, *heads, *sectors,
+ ( blocks / 2 ) );
return 0;
}
@@ -431,8 +434,8 @@ static void int13_sync_num_drives ( void ) {
required = ( ( max_drive & 0x7f ) + 1 );
if ( *counter < required ) {
*counter = required;
- DBGC ( sandev, "INT13 drive %02x added to drive count: "
- "%d HDDs, %d FDDs\n",
+ DBGC ( sandev->drive, "INT13 drive %02x added to "
+ "drive count: %d HDDs, %d FDDs\n",
sandev->drive, num_drives, num_fdds );
}
}
@@ -472,7 +475,7 @@ static int int13_reset ( struct san_device *sandev,
struct i386_all_regs *ix86 __unused ) {
int rc;
- DBGC2 ( sandev, "Reset drive\n" );
+ DBGC2 ( sandev->drive, "Reset drive\n" );
/* Reset SAN device */
if ( ( rc = sandev_reset ( sandev ) ) != 0 )
@@ -491,7 +494,7 @@ static int int13_get_last_status ( struct san_device *sandev,
struct i386_all_regs *ix86 __unused ) {
struct int13_data *int13 = sandev->priv;
- DBGC2 ( sandev, "Get status of last operation\n" );
+ DBGC2 ( sandev->drive, "Get status of last operation\n" );
return int13->last_status;
}
@@ -524,8 +527,8 @@ static int int13_rw_sectors ( struct san_device *sandev,
/* Validate blocksize */
if ( sandev_blksize ( sandev ) != INT13_BLKSIZE ) {
- DBGC ( sandev, "\nINT 13 drive %02x invalid blocksize (%zd) "
- "for non-extended read/write\n",
+ DBGC ( sandev->drive, "\nINT 13 drive %02x invalid blocksize "
+ "(%zd) for non-extended read/write\n",
sandev->drive, sandev_blksize ( sandev ) );
return -INT13_STATUS_INVALID;
}
@@ -537,9 +540,10 @@ static int int13_rw_sectors ( struct san_device *sandev,
if ( ( cylinder >= int13->cylinders ) ||
( head >= int13->heads ) ||
( sector < 1 ) || ( sector > int13->sectors_per_track ) ) {
- DBGC ( sandev, "C/H/S %d/%d/%d out of range for geometry "
- "%d/%d/%d\n", cylinder, head, sector, int13->cylinders,
- int13->heads, int13->sectors_per_track );
+ DBGC ( sandev->drive, "C/H/S %d/%d/%d out of range for "
+ "geometry %d/%d/%d\n", cylinder, head, sector,
+ int13->cylinders, int13->heads,
+ int13->sectors_per_track );
return -INT13_STATUS_INVALID;
}
lba = ( ( ( ( cylinder * int13->heads ) + head )
@@ -547,13 +551,13 @@ static int int13_rw_sectors ( struct san_device *sandev,
count = ix86->regs.al;
buffer = real_to_user ( ix86->segs.es, ix86->regs.bx );
- DBGC2 ( sandev, "C/H/S %d/%d/%d = LBA %08lx <-> %04x:%04x (count %d)\n",
- cylinder, head, sector, lba, ix86->segs.es, ix86->regs.bx,
- count );
+ DBGC2 ( sandev->drive, "C/H/S %d/%d/%d = LBA %08lx <-> %04x:%04x "
+ "(count %d)\n", cylinder, head, sector, lba, ix86->segs.es,
+ ix86->regs.bx, count );
/* Read from / write to block device */
if ( ( rc = sandev_rw ( sandev, lba, count, buffer ) ) != 0 ){
- DBGC ( sandev, "INT13 drive %02x I/O failed: %s\n",
+ DBGC ( sandev->drive, "INT13 drive %02x I/O failed: %s\n",
sandev->drive, strerror ( rc ) );
return -INT13_STATUS_READ_ERROR;
}
@@ -577,7 +581,7 @@ static int int13_rw_sectors ( struct san_device *sandev,
static int int13_read_sectors ( struct san_device *sandev,
struct i386_all_regs *ix86 ) {
- DBGC2 ( sandev, "Read: " );
+ DBGC2 ( sandev->drive, "Read: " );
return int13_rw_sectors ( sandev, ix86, sandev_read );
}
@@ -597,7 +601,7 @@ static int int13_read_sectors ( struct san_device *sandev,
static int int13_write_sectors ( struct san_device *sandev,
struct i386_all_regs *ix86 ) {
- DBGC2 ( sandev, "Write: " );
+ DBGC2 ( sandev->drive, "Write: " );
return int13_rw_sectors ( sandev, ix86, sandev_write );
}
@@ -619,12 +623,12 @@ static int int13_get_parameters ( struct san_device *sandev,
unsigned int max_head = int13->heads - 1;
unsigned int max_sector = int13->sectors_per_track; /* sic */
- DBGC2 ( sandev, "Get drive parameters\n" );
+ DBGC2 ( sandev->drive, "Get drive parameters\n" );
/* Validate blocksize */
if ( sandev_blksize ( sandev ) != INT13_BLKSIZE ) {
- DBGC ( sandev, "\nINT 13 drive %02x invalid blocksize (%zd) "
- "for non-extended parameters\n",
+ DBGC ( sandev->drive, "\nINT 13 drive %02x invalid blocksize "
+ "(%zd) for non-extended parameters\n",
sandev->drive, sandev_blksize ( sandev ) );
return -INT13_STATUS_INVALID;
}
@@ -657,7 +661,7 @@ static int int13_get_disk_type ( struct san_device *sandev,
struct i386_all_regs *ix86 ) {
uint32_t blocks;
- DBGC2 ( sandev, "Get disk type\n" );
+ DBGC2 ( sandev->drive, "Get disk type\n" );
if ( int13_is_fdd ( sandev ) ) {
return INT13_DISK_TYPE_FDD;
@@ -682,7 +686,7 @@ static int int13_extension_check ( struct san_device *sandev,
struct i386_all_regs *ix86 ) {
if ( ( ix86->regs.bx == 0x55aa ) && ! int13_is_fdd ( sandev ) ) {
- DBGC2 ( sandev, "INT13 extensions installation check\n" );
+ DBGC2 ( sandev->drive, "INT13 extensions check\n" );
ix86->regs.bx = 0xaa55;
ix86->regs.cx = ( INT13_EXTENSION_LINEAR |
INT13_EXTENSION_EDD |
@@ -725,7 +729,8 @@ static int int13_extended_rw ( struct san_device *sandev,
get_real ( bufsize, ix86->segs.ds,
( ix86->regs.si + offsetof ( typeof ( addr ), bufsize ) ) );
if ( bufsize < offsetof ( typeof ( addr ), buffer_phys ) ) {
- DBGC2 ( sandev, "<invalid buffer size %#02x\n>\n", bufsize );
+ DBGC2 ( sandev->drive, "<invalid buffer size %#02x\n>\n",
+ bufsize );
return -INT13_STATUS_INVALID;
}
@@ -733,17 +738,18 @@ static int int13_extended_rw ( struct san_device *sandev,
memset ( &addr, 0, sizeof ( addr ) );
copy_from_real ( &addr, ix86->segs.ds, ix86->regs.si, bufsize );
lba = addr.lba;
- DBGC2 ( sandev, "LBA %08llx <-> ", ( ( unsigned long long ) lba ) );
+ DBGC2 ( sandev->drive, "LBA %08llx <-> ",
+ ( ( unsigned long long ) lba ) );
if ( ( addr.count == 0xff ) ||
( ( addr.buffer.segment == 0xffff ) &&
( addr.buffer.offset == 0xffff ) ) ) {
buffer = phys_to_user ( addr.buffer_phys );
- DBGC2 ( sandev, "%08llx",
+ DBGC2 ( sandev->drive, "%08llx",
( ( unsigned long long ) addr.buffer_phys ) );
} else {
buffer = real_to_user ( addr.buffer.segment,
addr.buffer.offset );
- DBGC2 ( sandev, "%04x:%04x", addr.buffer.segment,
+ DBGC2 ( sandev->drive, "%04x:%04x", addr.buffer.segment,
addr.buffer.offset );
}
if ( addr.count <= 0x7f ) {
@@ -751,15 +757,15 @@ static int int13_extended_rw ( struct san_device *sandev,
} else if ( addr.count == 0xff ) {
count = addr.long_count;
} else {
- DBGC2 ( sandev, " <invalid count %#02x>\n", addr.count );
+ DBGC2 ( sandev->drive, " <invalid count %#02x>\n", addr.count );
return -INT13_STATUS_INVALID;
}
- DBGC2 ( sandev, " (count %ld)\n", count );
+ DBGC2 ( sandev->drive, " (count %ld)\n", count );
/* Read from / write to block device */
if ( ( rc = sandev_rw ( sandev, lba, count, buffer ) ) != 0 ) {
- DBGC ( sandev, "INT13 drive %02x extended I/O failed: %s\n",
- sandev->drive, strerror ( rc ) );
+ DBGC ( sandev->drive, "INT13 drive %02x extended I/O failed: "
+ "%s\n", sandev->drive, strerror ( rc ) );
/* Record that no blocks were transferred successfully */
addr.count = 0;
put_real ( addr.count, ix86->segs.ds,
@@ -781,7 +787,7 @@ static int int13_extended_rw ( struct san_device *sandev,
static int int13_extended_read ( struct san_device *sandev,
struct i386_all_regs *ix86 ) {
- DBGC2 ( sandev, "Extended read: " );
+ DBGC2 ( sandev->drive, "Extended read: " );
return int13_extended_rw ( sandev, ix86, sandev_read );
}
@@ -795,7 +801,7 @@ static int int13_extended_read ( struct san_device *sandev,
static int int13_extended_write ( struct san_device *sandev,
struct i386_all_regs *ix86 ) {
- DBGC2 ( sandev, "Extended write: " );
+ DBGC2 ( sandev->drive, "Extended write: " );
return int13_extended_rw ( sandev, ix86, sandev_write );
}
@@ -818,7 +824,7 @@ static int int13_extended_verify ( struct san_device *sandev,
sizeof ( addr ));
lba = addr.lba;
count = addr.count;
- DBGC2 ( sandev, "Verify: LBA %08llx (count %ld)\n",
+ DBGC2 ( sandev->drive, "Verify: LBA %08llx (count %ld)\n",
( ( unsigned long long ) lba ), count );
}
@@ -845,7 +851,7 @@ static int int13_extended_seek ( struct san_device *sandev,
sizeof ( addr ));
lba = addr.lba;
count = addr.count;
- DBGC2 ( sandev, "Seek: LBA %08llx (count %ld)\n",
+ DBGC2 ( sandev->drive, "Seek: LBA %08llx (count %ld)\n",
( ( unsigned long long ) lba ), count );
}
@@ -879,8 +885,8 @@ static int int13_device_path_info ( struct san_device *sandev,
/* Get underlying hardware device */
device = identify_device ( &sanpath->block );
if ( ! device ) {
- DBGC ( sandev, "INT13 drive %02x cannot identify hardware "
- "device\n", sandev->drive );
+ DBGC ( sandev->drive, "INT13 drive %02x cannot identify "
+ "hardware device\n", sandev->drive );
return -ENODEV;
}
@@ -895,16 +901,16 @@ static int int13_device_path_info ( struct san_device *sandev,
dpi->interface_path.pci.channel = 0xff; /* unused */
break;
default:
- DBGC ( sandev, "INT13 drive %02x unrecognised bus type %d\n",
- sandev->drive, desc->bus_type );
+ DBGC ( sandev->drive, "INT13 drive %02x unrecognised bus "
+ "type %d\n", sandev->drive, desc->bus_type );
return -ENOTSUP;
}
/* Get EDD block device description */
if ( ( rc = edd_describe ( &sanpath->block, &dpi->interface_type,
&dpi->device_path ) ) != 0 ) {
- DBGC ( sandev, "INT13 drive %02x cannot identify block device: "
- "%s\n", sandev->drive, strerror ( rc ) );
+ DBGC ( sandev->drive, "INT13 drive %02x cannot identify "
+ "block device: %s\n", sandev->drive, strerror ( rc ) );
return rc;
}
@@ -938,8 +944,8 @@ static int int13_get_extended_parameters ( struct san_device *sandev,
get_real ( bufsize, ix86->segs.ds,
( ix86->regs.si + offsetof ( typeof ( params ), bufsize )));
- DBGC2 ( sandev, "Get extended drive parameters to %04x:%04x+%02x\n",
- ix86->segs.ds, ix86->regs.si, bufsize );
+ DBGC2 ( sandev->drive, "Get extended drive parameters to "
+ "%04x:%04x+%02x\n", ix86->segs.ds, ix86->regs.si, bufsize );
/* Build drive parameters */
memset ( &params, 0, sizeof ( params ) );
@@ -955,8 +961,8 @@ static int int13_get_extended_parameters ( struct san_device *sandev,
params.sector_size = sandev_blksize ( sandev );
memset ( &params.dpte, 0xff, sizeof ( params.dpte ) );
if ( ( rc = int13_device_path_info ( sandev, &params.dpi ) ) != 0 ) {
- DBGC ( sandev, "INT13 drive %02x could not provide device "
- "path information: %s\n",
+ DBGC ( sandev->drive, "INT13 drive %02x could not provide "
+ "device path information: %s\n",
sandev->drive, strerror ( rc ) );
len = offsetof ( typeof ( params ), dpi );
}
@@ -973,11 +979,11 @@ static int int13_get_extended_parameters ( struct san_device *sandev,
params.bufsize = offsetof ( typeof ( params ), dpi );
}
- DBGC ( sandev, "INT 13 drive %02x described using extended "
+ DBGC ( sandev->drive, "INT 13 drive %02x described using extended "
"parameters:\n", sandev->drive );
address.segment = ix86->segs.ds;
address.offset = ix86->regs.si;
- DBGC_HDA ( sandev, address, &params, len );
+ DBGC_HDA ( sandev->drive, address, &params, len );
/* Return drive parameters */
if ( len > bufsize )
@@ -998,13 +1004,13 @@ static int int13_cdrom_status_terminate ( struct san_device *sandev,
struct i386_all_regs *ix86 ) {
struct int13_cdrom_specification specification;
- DBGC2 ( sandev, "Get CD-ROM emulation status to %04x:%04x%s\n",
+ DBGC2 ( sandev->drive, "Get CD-ROM emulation status to %04x:%04x%s\n",
ix86->segs.ds, ix86->regs.si,
( ix86->regs.al ? "" : " and terminate" ) );
/* Fail if we are not a CD-ROM */
if ( ! sandev->is_cdrom ) {
- DBGC ( sandev, "INT13 drive %02x is not a CD-ROM\n",
+ DBGC ( sandev->drive, "INT13 drive %02x is not a CD-ROM\n",
sandev->drive );
return -INT13_STATUS_INVALID;
}
@@ -1039,11 +1045,12 @@ static int int13_cdrom_read_boot_catalog ( struct san_device *sandev,
/* Read parameters from command packet */
copy_from_real ( &command, ix86->segs.ds, ix86->regs.si,
sizeof ( command ) );
- DBGC2 ( sandev, "Read CD-ROM boot catalog to %08x\n", command.buffer );
+ DBGC2 ( sandev->drive, "Read CD-ROM boot catalog to %08x\n",
+ command.buffer );
/* Fail if we have no boot catalog */
if ( ! int13->boot_catalog ) {
- DBGC ( sandev, "INT13 drive %02x has no boot catalog\n",
+ DBGC ( sandev->drive, "INT13 drive %02x has no boot catalog\n",
sandev->drive );
return -INT13_STATUS_INVALID;
}
@@ -1052,8 +1059,8 @@ static int int13_cdrom_read_boot_catalog ( struct san_device *sandev,
/* Read from boot catalog */
if ( ( rc = sandev_read ( sandev, start, command.count,
phys_to_user ( command.buffer ) ) ) != 0 ) {
- DBGC ( sandev, "INT13 drive %02x could not read boot catalog: "
- "%s\n", sandev->drive, strerror ( rc ) );
+ DBGC ( sandev->drive, "INT13 drive %02x could not read boot "
+ "catalog: %s\n", sandev->drive, strerror ( rc ) );
return -INT13_STATUS_READ_ERROR;
}
@@ -1080,8 +1087,8 @@ static __asmcall __used void int13 ( struct i386_all_regs *ix86 ) {
if ( bios_drive != sandev->drive ) {
/* Remap any accesses to this drive's natural number */
if ( bios_drive == int13->natural_drive ) {
- DBGC2 ( sandev, "INT13,%02x (%02x) remapped to "
- "(%02x)\n", ix86->regs.ah,
+ DBGC2 ( sandev->drive, "INT13,%02x (%02x) "
+ "remapped to (%02x)\n", ix86->regs.ah,
bios_drive, sandev->drive );
ix86->regs.dl = sandev->drive;
return;
@@ -1094,7 +1101,7 @@ static __asmcall __used void int13 ( struct i386_all_regs *ix86 ) {
}
}
- DBGC2 ( sandev, "INT13,%02x (%02x): ",
+ DBGC2 ( sandev->drive, "INT13,%02x (%02x): ",
ix86->regs.ah, bios_drive );
switch ( command ) {
@@ -1141,7 +1148,7 @@ static __asmcall __used void int13 ( struct i386_all_regs *ix86 ) {
status = int13_cdrom_read_boot_catalog ( sandev, ix86 );
break;
default:
- DBGC2 ( sandev, "*** Unrecognised INT13 ***\n" );
+ DBGC2 ( sandev->drive, "*** Unrecognised INT13 ***\n" );
status = -INT13_STATUS_INVALID;
break;
}
@@ -1152,8 +1159,9 @@ static __asmcall __used void int13 ( struct i386_all_regs *ix86 ) {
/* Negative status indicates an error */
if ( status < 0 ) {
status = -status;
- DBGC ( sandev, "INT13,%02x (%02x) failed with status "
- "%02x\n", ix86->regs.ah, sandev->drive, status );
+ DBGC ( sandev->drive, "INT13,%02x (%02x) failed with "
+ "status %02x\n", ix86->regs.ah, sandev->drive,
+ status );
} else {
ix86->flags &= ~CF;
}
@@ -1269,7 +1277,7 @@ static int int13_hook ( unsigned int drive, struct uri **uris,
/* Register SAN device */
if ( ( rc = register_sandev ( sandev, drive, flags ) ) != 0 ) {
- DBGC ( sandev, "INT13 drive %02x could not register: %s\n",
+ DBGC ( drive, "INT13 drive %02x could not register: %s\n",
drive, strerror ( rc ) );
goto err_register;
}
@@ -1289,10 +1297,9 @@ static int int13_hook ( unsigned int drive, struct uri **uris,
( ( rc = int13_guess_geometry ( sandev, scratch ) ) != 0 ) )
goto err_guess_geometry;
- DBGC ( sandev, "INT13 drive %02x (naturally %02x) registered with "
- "C/H/S geometry %d/%d/%d\n",
- sandev->drive, int13->natural_drive, int13->cylinders,
- int13->heads, int13->sectors_per_track );
+ DBGC ( drive, "INT13 drive %02x (naturally %02x) registered with "
+ "C/H/S geometry %d/%d/%d\n", drive, int13->natural_drive,
+ int13->cylinders, int13->heads, int13->sectors_per_track );
/* Hook INT 13 vector if not already hooked */
if ( need_hook ) {
@@ -1332,7 +1339,7 @@ static void int13_unhook ( unsigned int drive ) {
/* Find drive */
sandev = sandev_find ( drive );
if ( ! sandev ) {
- DBG ( "INT13 cannot find drive %02x\n", drive );
+ DBGC ( drive, "INT13 drive %02x is not a SAN drive\n", drive );
return;
}
@@ -1343,7 +1350,7 @@ static void int13_unhook ( unsigned int drive ) {
* to do so reliably.
*/
- DBGC ( sandev, "INT13 drive %02x unregistered\n", sandev->drive );
+ DBGC ( drive, "INT13 drive %02x unregistered\n", drive );
/* Unhook INT 13 vector if no more drives */
if ( ! have_sandevs() ) {
@@ -1387,8 +1394,8 @@ static int int13_load_mbr ( unsigned int drive, struct segoff *address ) {
: "a" ( 0x0201 ), "b" ( *address ),
"c" ( 1 ), "d" ( drive ) );
if ( status ) {
- DBG ( "INT13 drive %02x could not read MBR (status %04x)\n",
- drive, status );
+ DBGC ( drive, "INT13 drive %02x could not read MBR (status "
+ "%04x)\n", drive, status );
return -EIO;
}
@@ -1397,8 +1404,8 @@ static int int13_load_mbr ( unsigned int drive, struct segoff *address ) {
( address->offset +
offsetof ( struct master_boot_record, magic ) ) );
if ( magic != INT13_MBR_MAGIC ) {
- DBG ( "INT13 drive %02x does not contain a valid MBR\n",
- drive );
+ DBGC ( drive, "INT13 drive %02x does not contain a valid MBR\n",
+ drive );
return -ENOEXEC;
}
@@ -1444,8 +1451,8 @@ static int int13_load_eltorito ( unsigned int drive, struct segoff *address ) {
: "a" ( 0x4d00 ), "d" ( drive ),
"S" ( __from_data16 ( &eltorito_cmd ) ) );
if ( status ) {
- DBG ( "INT13 drive %02x could not read El Torito boot catalog "
- "(status %04x)\n", drive, status );
+ DBGC ( drive, "INT13 drive %02x could not read El Torito boot "
+ "catalog (status %04x)\n", drive, status );
return -EIO;
}
copy_from_user ( &catalog, phys_to_user ( eltorito_cmd.buffer ), 0,
@@ -1453,26 +1460,27 @@ static int int13_load_eltorito ( unsigned int drive, struct segoff *address ) {
/* Sanity checks */
if ( catalog.valid.platform_id != ELTORITO_PLATFORM_X86 ) {
- DBG ( "INT13 drive %02x El Torito specifies unknown platform "
- "%02x\n", drive, catalog.valid.platform_id );
+ DBGC ( drive, "INT13 drive %02x El Torito specifies unknown "
+ "platform %02x\n", drive, catalog.valid.platform_id );
return -ENOEXEC;
}
if ( catalog.boot.indicator != ELTORITO_BOOTABLE ) {
- DBG ( "INT13 drive %02x El Torito is not bootable\n", drive );
+ DBGC ( drive, "INT13 drive %02x El Torito is not bootable\n",
+ drive );
return -ENOEXEC;
}
if ( catalog.boot.media_type != ELTORITO_NO_EMULATION ) {
- DBG ( "INT13 drive %02x El Torito requires emulation "
+ DBGC ( drive, "INT13 drive %02x El Torito requires emulation "
"type %02x\n", drive, catalog.boot.media_type );
return -ENOTSUP;
}
- DBG ( "INT13 drive %02x El Torito boot image at LBA %08x (count %d)\n",
- drive, catalog.boot.start, catalog.boot.length );
+ DBGC ( drive, "INT13 drive %02x El Torito boot image at LBA %08x "
+ "(count %d)\n", drive, catalog.boot.start, catalog.boot.length );
address->segment = ( catalog.boot.load_segment ?
catalog.boot.load_segment : 0x7c0 );
address->offset = 0;
- DBG ( "INT13 drive %02x El Torito boot image loads at %04x:%04x\n",
- drive, address->segment, address->offset );
+ DBGC ( drive, "INT13 drive %02x El Torito boot image loads at "
+ "%04x:%04x\n", drive, address->segment, address->offset );
/* Use INT 13, 42 to read the boot image */
eltorito_address.bufsize =
@@ -1491,8 +1499,8 @@ static int int13_load_eltorito ( unsigned int drive, struct segoff *address ) {
: "a" ( 0x4200 ), "d" ( drive ),
"S" ( __from_data16 ( &eltorito_address ) ) );
if ( status ) {
- DBG ( "INT13 drive %02x could not read El Torito boot image "
- "(status %04x)\n", drive, status );
+ DBGC ( drive, "INT13 drive %02x could not read El Torito boot "
+ "image (status %04x)\n", drive, status );
return -EIO;
}
@@ -1503,7 +1511,7 @@ static int int13_load_eltorito ( unsigned int drive, struct segoff *address ) {
* Attempt to boot from an INT 13 drive
*
* @v drive Drive number
- * @v filename Filename (or NULL to use default)
+ * @v config Boot configuration parameters
* @ret rc Return status code
*
* This boots from the specified INT 13 drive by loading the Master
@@ -1513,7 +1521,8 @@ static int int13_load_eltorito ( unsigned int drive, struct segoff *address ) {
*
* Note that this function can never return success, by definition.
*/
-static int int13_boot ( unsigned int drive, const char *filename __unused ) {
+static int int13_boot ( unsigned int drive,
+ struct san_boot_config *config __unused ) {
struct memory_map memmap;
struct segoff address;
int rc;
@@ -1533,8 +1542,8 @@ static int int13_boot ( unsigned int drive, const char *filename __unused ) {
/* Jump to boot sector */
if ( ( rc = call_bootsector ( address.segment, address.offset,
drive ) ) != 0 ) {
- DBG ( "INT13 drive %02x boot returned: %s\n",
- drive, strerror ( rc ) );
+ DBGC ( drive, "INT13 drive %02x boot returned: %s\n",
+ drive, strerror ( rc ) );
return rc;
}
diff --git a/src/arch/x86/interface/pcbios/pcicloud.c b/src/arch/x86/interface/pcbios/pcicloud.c
index 97d7cac1..98ba38b3 100644
--- a/src/arch/x86/interface/pcbios/pcicloud.c
+++ b/src/arch/x86/interface/pcbios/pcicloud.c
@@ -165,24 +165,27 @@ static void pcicloud_init ( void ) {
static struct pci_api *apis[] = {
&ecam_api, &pcibios_api, &pcidirect_api
};
- struct pci_range range;
+ struct pci_device pci;
+ uint32_t busdevfn;
unsigned int i;
+ int rc;
- /* Select first API that successfully discovers an address range */
+ /* Select first API that successfully discovers a PCI device */
for ( i = 0 ; i < ( sizeof ( apis ) / sizeof ( apis[0] ) ) ; i++ ) {
pcicloud = apis[i];
- pcicloud_discover ( 0, &range );
- if ( range.count != 0 ) {
- DBGC ( pcicloud, "PCICLOUD selected %s API\n",
- pcicloud->name );
- break;
+ busdevfn = 0;
+ if ( ( rc = pci_find_next ( &pci, &busdevfn ) ) == 0 ) {
+ DBGC ( pcicloud, "PCICLOUD selected %s API (found "
+ PCI_FMT ")\n", pcicloud->name,
+ PCI_ARGS ( &pci ) );
+ return;
}
}
- /* The PCI direct API can never fail discovery since the range
- * is hardcoded.
- */
- assert ( range.count != 0 );
+ /* Fall back to using final attempted API if no devices found */
+ pcicloud = apis[ i - 1 ];
+ DBGC ( pcicloud, "PCICLOUD selected %s API (nothing detected)\n",
+ pcicloud->name );
}
/** Cloud VM PCI configuration space access initialisation function */
diff --git a/src/arch/x86/interface/pxe/pxe_entry.S b/src/arch/x86/interface/pxe/pxe_entry.S
index 354dd1b3..3899e1bc 100644
--- a/src/arch/x86/interface/pxe/pxe_entry.S
+++ b/src/arch/x86/interface/pxe/pxe_entry.S
@@ -27,6 +27,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#include <librm.h>
.section ".note.GNU-stack", "", @progbits
+ .code16
.arch i386
/****************************************************************************
diff --git a/src/arch/x86/prefix/bootpart.S b/src/arch/x86/prefix/bootpart.S
index 575cb1c0..7b9920fd 100644
--- a/src/arch/x86/prefix/bootpart.S
+++ b/src/arch/x86/prefix/bootpart.S
@@ -6,10 +6,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#define STACK_SIZE 0x2000
.section ".note.GNU-stack", "", @progbits
- .text
+ .code16
.arch i386
.section ".prefix", "awx", @progbits
- .code16
/*
* Find active partition
diff --git a/src/arch/x86/prefix/dskprefix.S b/src/arch/x86/prefix/dskprefix.S
index bc194887..e8e55ef1 100644
--- a/src/arch/x86/prefix/dskprefix.S
+++ b/src/arch/x86/prefix/dskprefix.S
@@ -26,10 +26,9 @@ FILE_LICENCE ( GPL2_ONLY )
.section ".note.GNU-stack", "", @progbits
.org 0
+ .code16
.arch i386
- .text
.section ".prefix", "ax", @progbits
- .code16
.globl _dsk_start
_dsk_start:
diff --git a/src/arch/x86/prefix/exeprefix.S b/src/arch/x86/prefix/exeprefix.S
index 5b2605e8..98ed6c5f 100644
--- a/src/arch/x86/prefix/exeprefix.S
+++ b/src/arch/x86/prefix/exeprefix.S
@@ -37,10 +37,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#define PSP_CMDLINE_START 0x81
.section ".note.GNU-stack", "", @progbits
- .text
+ .code16
.arch i386
.org 0
- .code16
.section ".prefix", "awx", @progbits
signature:
diff --git a/src/arch/x86/prefix/hdprefix.S b/src/arch/x86/prefix/hdprefix.S
index fbf8d2e4..3133dec6 100644
--- a/src/arch/x86/prefix/hdprefix.S
+++ b/src/arch/x86/prefix/hdprefix.S
@@ -3,10 +3,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#include <librm.h>
.section ".note.GNU-stack", "", @progbits
- .text
+ .code16
.arch i386
.section ".prefix", "awx", @progbits
- .code16
.org 0
.globl _hd_start
_hd_start:
diff --git a/src/arch/x86/prefix/libprefix.S b/src/arch/x86/prefix/libprefix.S
index 380e471d..b08a5782 100644
--- a/src/arch/x86/prefix/libprefix.S
+++ b/src/arch/x86/prefix/libprefix.S
@@ -27,6 +27,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#include <librm.h>
.section ".note.GNU-stack", "", @progbits
+ .code16
.arch i386
/* Image compression enabled */
diff --git a/src/arch/x86/prefix/lkrnprefix.S b/src/arch/x86/prefix/lkrnprefix.S
index 2c17f79d..c8a04c9d 100644
--- a/src/arch/x86/prefix/lkrnprefix.S
+++ b/src/arch/x86/prefix/lkrnprefix.S
@@ -5,9 +5,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#define BZI_LOAD_HIGH_ADDR 0x100000
.section ".note.GNU-stack", "", @progbits
- .text
- .arch i386
.code16
+ .arch i386
.section ".prefix", "ax", @progbits
.globl _lkrn_start
_lkrn_start:
diff --git a/src/arch/x86/prefix/mbr.S b/src/arch/x86/prefix/mbr.S
index 928bb338..5e0ed5dd 100644
--- a/src/arch/x86/prefix/mbr.S
+++ b/src/arch/x86/prefix/mbr.S
@@ -1,10 +1,9 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
- .text
+ .code16
.arch i386
.section ".prefix", "awx", @progbits
- .code16
.org 0
.globl mbr
diff --git a/src/arch/x86/prefix/mromprefix.S b/src/arch/x86/prefix/mromprefix.S
index 5f3496b2..d05278e6 100644
--- a/src/arch/x86/prefix/mromprefix.S
+++ b/src/arch/x86/prefix/mromprefix.S
@@ -42,9 +42,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#include "pciromprefix.S"
.section ".note.GNU-stack", "", @progbits
- .text
- .arch i386
.code16
+ .arch i386
/* Obtain access to payload by exposing the expansion ROM BAR at the
* address currently used by a suitably large memory BAR on the same
diff --git a/src/arch/x86/prefix/nbiprefix.S b/src/arch/x86/prefix/nbiprefix.S
index cae1009b..bbacd4b7 100644
--- a/src/arch/x86/prefix/nbiprefix.S
+++ b/src/arch/x86/prefix/nbiprefix.S
@@ -3,9 +3,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#include <librm.h>
.section ".note.GNU-stack", "", @progbits
- .text
- .arch i386
.code16
+ .arch i386
.section ".prefix", "ax", @progbits
.org 0
diff --git a/src/arch/x86/prefix/nullprefix.S b/src/arch/x86/prefix/nullprefix.S
index 1568188d..426f1f2c 100644
--- a/src/arch/x86/prefix/nullprefix.S
+++ b/src/arch/x86/prefix/nullprefix.S
@@ -2,11 +2,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
.org 0
- .text
+ .code16
.arch i386
.section ".prefix", "ax", @progbits
- .code16
_prefix:
.section ".text16", "ax", @progbits
diff --git a/src/arch/x86/prefix/pxeprefix.S b/src/arch/x86/prefix/pxeprefix.S
index 494fbc13..5181ef61 100644
--- a/src/arch/x86/prefix/pxeprefix.S
+++ b/src/arch/x86/prefix/pxeprefix.S
@@ -12,10 +12,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#define PXE_HACK_EB54 0x0001
.section ".note.GNU-stack", "", @progbits
- .text
+ .code16
.arch i386
.org 0
- .code16
#include <librm.h>
#include <undi.h>
diff --git a/src/arch/x86/prefix/rawprefix.S b/src/arch/x86/prefix/rawprefix.S
index 4a3d3504..962c9718 100644
--- a/src/arch/x86/prefix/rawprefix.S
+++ b/src/arch/x86/prefix/rawprefix.S
@@ -9,10 +9,9 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
- .text
+ .code16
.arch i386
.org 0
- .code16
#include <librm.h>
diff --git a/src/arch/x86/prefix/romprefix.S b/src/arch/x86/prefix/romprefix.S
index 79fed2a3..09837cee 100644
--- a/src/arch/x86/prefix/romprefix.S
+++ b/src/arch/x86/prefix/romprefix.S
@@ -55,7 +55,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#endif
.section ".note.GNU-stack", "", @progbits
- .text
.code16
.arch i386
.section ".prefix", "ax", @progbits
diff --git a/src/arch/x86/prefix/undiloader.S b/src/arch/x86/prefix/undiloader.S
index e544d504..33573230 100644
--- a/src/arch/x86/prefix/undiloader.S
+++ b/src/arch/x86/prefix/undiloader.S
@@ -3,7 +3,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#include <librm.h>
.section ".note.GNU-stack", "", @progbits
- .text
.code16
.arch i386
.section ".prefix", "ax", @progbits
diff --git a/src/arch/x86/prefix/unlzma.S b/src/arch/x86/prefix/unlzma.S
index f4bd81bd..e4d1e190 100644
--- a/src/arch/x86/prefix/unlzma.S
+++ b/src/arch/x86/prefix/unlzma.S
@@ -44,7 +44,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
.section ".note.GNU-stack", "", @progbits
- .text
+ .code32
.arch i486
.section ".prefix.lib", "ax", @progbits
diff --git a/src/arch/x86/prefix/usbdisk.S b/src/arch/x86/prefix/usbdisk.S
index 461a0837..11ab6a46 100644
--- a/src/arch/x86/prefix/usbdisk.S
+++ b/src/arch/x86/prefix/usbdisk.S
@@ -3,10 +3,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#include <config/console.h>
.section ".note.GNU-stack", "", @progbits
- .text
+ .code16
.arch i386
.section ".prefix", "awx", @progbits
- .code16
.org 0
#include "mbr.S"
diff --git a/src/arch/x86/transitions/liba20.S b/src/arch/x86/transitions/liba20.S
index 6c1bac67..971cff22 100644
--- a/src/arch/x86/transitions/liba20.S
+++ b/src/arch/x86/transitions/liba20.S
@@ -25,6 +25,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
+ .code16
.arch i386
/****************************************************************************
diff --git a/src/arch/x86/transitions/libkir.S b/src/arch/x86/transitions/libkir.S
index af090b26..2c4dc948 100644
--- a/src/arch/x86/transitions/libkir.S
+++ b/src/arch/x86/transitions/libkir.S
@@ -32,10 +32,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#define BOCHSBP xchgw %bx, %bx
.section ".note.GNU-stack", "", @progbits
- .text
+ .code16
.arch i386
.section ".text16", "awx", @progbits
- .code16
/****************************************************************************
* init_libkir (real-mode or 16:xx protected-mode far call)