[prev in list] [next in list] [prev in thread] [next in thread]
List: bochs-dev
Subject: [Bochs-developers] [PATCH] Use "__attribute__((__packed__))"
From: "Sebastian Herbszt" <herbszt () gmx ! de>
Date: 2008-12-22 22:01:16
Message-ID: 599E1C34865342119E9C09A60C516C7E () FSCPC
[Download RAW message or body]
Use "__attribute__((__packed__))" instead of "#pragma pack".
- Sebastian
Index: bochs-cvs/bios/rombios32.c
===================================================================
--- bochs-cvs.orig/bios/rombios32.c
+++ bochs-cvs/bios/rombios32.c
@@ -1098,7 +1098,6 @@ static void mptable_init(void)
* All tables must be byte-packed to match the ACPI specification, since
* the tables are provided by the system BIOS.
*/
-#pragma pack(1)
#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \
uint8_t signature [4]; /* ACPI signature (4 \
ASCII characters) */\ @@ -1115,7 +1114,7 @@ static void mptable_init(void)
struct acpi_table_header /* ACPI common table header */
{
ACPI_TABLE_HEADER_DEF
-};
+} __attribute__((__packed__));
struct rsdp_descriptor /* Root System Descriptor Pointer */
{
@@ -1128,7 +1127,7 @@ struct rsdp_descriptor /* Root S
uint64_t xsdt_physical_address; /* 64-bit physical \
address of XSDT */ uint8_t extended_checksum; /* \
Checksum of entire table */ uint8_t reserved [3]; \
/* Reserved field must be 0 */
-};
+} __attribute__((__packed__));
/*
* ACPI 1.0 Root System Description Table (RSDT)
@@ -1138,7 +1137,7 @@ struct rsdt_descriptor_rev1
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
uint32_t table_offset_entry [3]; /* Array of pointers \
to other */ /* ACPI tables */
-};
+} __attribute__((__packed__));
/*
* ACPI 1.0 Firmware ACPI Control Structure (FACS)
@@ -1153,7 +1152,7 @@ struct facs_descriptor_rev1
uint32_t S4bios_f : 1; /* Indicates if S4BIOS \
support is present */ uint32_t reserved1 : 31; \
/* Must be 0 */ uint8_t resverved3 [40]; /* \
Reserved - must be zero */
-};
+} __attribute__((__packed__));
/*
@@ -1214,7 +1213,7 @@ struct fadt_descriptor_rev1
#else
uint32_t flags;
#endif
-};
+} __attribute__((__packed__));
/*
* MADT values and structures
@@ -1238,7 +1237,7 @@ struct multiple_apic_table
#else
uint32_t flags;
#endif
-};
+} __attribute__((__packed__));
/* Values for Type in APIC_HEADER_DEF */
@@ -1274,7 +1273,7 @@ struct madt_processor_apic
#else
uint32_t flags;
#endif
-};
+} __attribute__((__packed__));
struct madt_io_apic
{
@@ -1284,11 +1283,7 @@ struct madt_io_apic
uint32_t address; /* APIC physical \
address */ uint32_t interrupt; /* Global \
system interrupt where INTI
* lines start */
-};
-
-/* Reset to default packing */
-
-#pragma pack()
+} __attribute__((__packed__));
#include "acpi-dsdt.hex"
["pragma-pack-to-attribute-packed.diff" (application/octet-stream)]
Index: bochs-cvs/bios/rombios32.c
===================================================================
--- bochs-cvs.orig/bios/rombios32.c
+++ bochs-cvs/bios/rombios32.c
@@ -1098,7 +1098,6 @@ static void mptable_init(void)
* All tables must be byte-packed to match the ACPI specification, since
* the tables are provided by the system BIOS.
*/
-#pragma pack(1)
#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \
uint8_t signature [4]; /* ACPI signature (4 \
ASCII characters) */\ @@ -1115,7 +1114,7 @@ static void mptable_init(void)
struct acpi_table_header /* ACPI common table header */
{
ACPI_TABLE_HEADER_DEF
-};
+} __attribute__((__packed__));
struct rsdp_descriptor /* Root System Descriptor Pointer */
{
@@ -1128,7 +1127,7 @@ struct rsdp_descriptor /* Root S
uint64_t xsdt_physical_address; /* 64-bit physical \
address of XSDT */ uint8_t extended_checksum; /* \
Checksum of entire table */ uint8_t reserved [3]; \
/* Reserved field must be 0 */
-};
+} __attribute__((__packed__));
/*
* ACPI 1.0 Root System Description Table (RSDT)
@@ -1138,7 +1137,7 @@ struct rsdt_descriptor_rev1
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
uint32_t table_offset_entry [3]; /* Array of pointers \
to other */ /* ACPI tables */
-};
+} __attribute__((__packed__));
/*
* ACPI 1.0 Firmware ACPI Control Structure (FACS)
@@ -1153,7 +1152,7 @@ struct facs_descriptor_rev1
uint32_t S4bios_f : 1; /* Indicates if S4BIOS \
support is present */ uint32_t reserved1 : 31; \
/* Must be 0 */ uint8_t resverved3 [40]; /* \
Reserved - must be zero */
-};
+} __attribute__((__packed__));
/*
@@ -1214,7 +1213,7 @@ struct fadt_descriptor_rev1
#else
uint32_t flags;
#endif
-};
+} __attribute__((__packed__));
/*
* MADT values and structures
@@ -1238,7 +1237,7 @@ struct multiple_apic_table
#else
uint32_t flags;
#endif
-};
+} __attribute__((__packed__));
/* Values for Type in APIC_HEADER_DEF */
@@ -1274,7 +1273,7 @@ struct madt_processor_apic
#else
uint32_t flags;
#endif
-};
+} __attribute__((__packed__));
struct madt_io_apic
{
@@ -1284,11 +1283,7 @@ struct madt_io_apic
uint32_t address; /* APIC physical \
address */ uint32_t interrupt; /* Global \
system interrupt where INTI
* lines start */
-};
-
-/* Reset to default packing */
-
-#pragma pack()
+} __attribute__((__packed__));
#include "acpi-dsdt.hex"
------------------------------------------------------------------------------
_______________________________________________
bochs-developers mailing list
bochs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bochs-developers
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic