summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-09-01 17:30:57 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-09-01 17:30:57 +0000
commitb5ddfff7891a756d08e42a986080abc019cf830c (patch)
tree2d2e16402c922e643d1ccadcc085c3796c7bb75d /sys/arch
parent400b04c7f1f655a02a152b93e698f7448833e20e (diff)
Avoid #pragma pack(1) and unify everything towards using __packed.
This requires that structures defined within __packed structures must independently request that they themselves become __packed, too. worked on with toby CVS: ----------------------------------------------------------------------
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/include/biosvar.h26
-rw-r--r--sys/arch/i386/include/biosvar.h26
-rw-r--r--sys/arch/i386/include/segments.h10
3 files changed, 25 insertions, 37 deletions
diff --git a/sys/arch/amd64/include/biosvar.h b/sys/arch/amd64/include/biosvar.h
index 92e505a2532..95a86283986 100644
--- a/sys/arch/amd64/include/biosvar.h
+++ b/sys/arch/amd64/include/biosvar.h
@@ -1,5 +1,5 @@
/* XXX - DSR */
-/* $OpenBSD: biosvar.h,v 1.8 2007/12/05 19:17:14 deraadt Exp $ */
+/* $OpenBSD: biosvar.h,v 1.9 2008/09/01 17:30:55 deraadt Exp $ */
/*
* Copyright (c) 1997-1999 Michael Shalayeff
@@ -31,7 +31,6 @@
#ifndef _I386_BIOSVAR_H_
#define _I386_BIOSVAR_H_
-#pragma pack(1)
/* some boxes put apm data seg in the 2nd page */
#define BOOTARG_OFF (NBPG*2)
@@ -75,7 +74,7 @@ struct bios_romheader {
u_int32_t entry; /* initialization entry point */
u_int8_t reserved[19];
u_int16_t pnpheader; /* offset to PnP expansion header */
-} *bios_romheader_t;
+} __packed *bios_romheader_t;
/*
* BIOS32
@@ -88,20 +87,20 @@ struct bios32_header {
u_int8_t length; /* 09: header length */
u_int8_t cksum; /* 0a: modulo 256 checksum */
u_int8_t reserved[5];
-} *bios32_header_t;
+} __packed *bios32_header_t;
typedef
struct bios32_entry_info {
paddr_t bei_base;
psize_t bei_size;
paddr_t bei_entry;
-} *bios32_entry_info_t;
+} __packed *bios32_entry_info_t;
typedef
struct bios32_entry {
u_int32_t offset;
u_int16_t segment;
-} *bios32_entry_t;
+} __packed *bios32_entry_t;
#define BIOS32_START 0xe0000
#define BIOS32_SIZE 0x20000
@@ -133,7 +132,7 @@ typedef struct _bios_memmap {
u_int64_t addr; /* Beginning of block */
u_int64_t size; /* Size of block */
u_int32_t type; /* Type of block */
-} bios_memmap_t;
+} __packed bios_memmap_t;
/* Info about disk from the bios, plus the mapping from
* BIOS numbers to BSD major (driver?) number.
@@ -166,7 +165,7 @@ typedef struct _bios_diskinfo {
#define BDI_EL_TORITO 0x00000008 /* 2,048-byte sectors */
#define BDI_PICKED 0x80000000 /* kernel-only: cksum matched */
-} bios_diskinfo_t;
+} __packed bios_diskinfo_t;
#define BOOTARG_APMINFO 2
typedef struct _bios_apminfo {
@@ -179,7 +178,7 @@ typedef struct _bios_apminfo {
u_int apm_data_len;
u_int apm_entry;
u_int apm_code16_len;
-} bios_apminfo_t;
+} __packed bios_apminfo_t;
#define BOOTARG_CKSUMLEN 3 /* u_int32_t */
@@ -190,18 +189,18 @@ typedef struct _bios_pciinfo {
u_int32_t pci_rev; /* BCD Revision (%ebx) */
u_int32_t pci_entry32; /* PM entry point for PCI BIOS */
u_int32_t pci_lastbus; /* Number of last PCI bus */
-} bios_pciinfo_t;
+} __packed bios_pciinfo_t;
#define BOOTARG_CONSDEV 5
typedef struct _bios_consdev {
dev_t consdev;
int conspeed;
-} bios_consdev_t;
+} __packed bios_consdev_t;
#define BOOTARG_BOOTMAC 7
typedef struct _bios_bootmac {
char mac[6];
-} bios_bootmac_t;
+} __packed bios_bootmac_t;
#if defined(_KERNEL) || defined (_STANDALONE)
@@ -220,7 +219,7 @@ extern volatile struct BIOS_regs {
u_int32_t biosr_di;
u_int32_t biosr_ds;
u_int32_t biosr_es;
-} BIOS_regs;
+} __packed BIOS_regs;
#ifdef _KERNEL
#include <machine/bus.h>
@@ -263,5 +262,4 @@ extern bios_memmap_t *bios_memmap;
#endif /* _LOCORE */
#endif /* _KERNEL || _STANDALONE */
-#pragma pack()
#endif /* _I386_BIOSVAR_H_ */
diff --git a/sys/arch/i386/include/biosvar.h b/sys/arch/i386/include/biosvar.h
index 75882686370..4a55da90ae4 100644
--- a/sys/arch/i386/include/biosvar.h
+++ b/sys/arch/i386/include/biosvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: biosvar.h,v 1.49 2007/12/05 19:17:13 deraadt Exp $ */
+/* $OpenBSD: biosvar.h,v 1.50 2008/09/01 17:30:56 deraadt Exp $ */
/*
* Copyright (c) 1997-1999 Michael Shalayeff
@@ -28,7 +28,6 @@
#ifndef _I386_BIOSVAR_H_
#define _I386_BIOSVAR_H_
-#pragma pack(1)
/* some boxes put apm data seg in the 2nd page */
#define BOOTARG_OFF (NBPG*2)
@@ -72,7 +71,7 @@ struct bios_romheader {
u_int32_t entry; /* initialization entry point */
u_int8_t reserved[19];
u_int16_t pnpheader; /* offset to PnP expansion header */
-} *bios_romheader_t;
+} __packed *bios_romheader_t;
/*
* BIOS32
@@ -85,20 +84,20 @@ struct bios32_header {
u_int8_t length; /* 09: header length */
u_int8_t cksum; /* 0a: modulo 256 checksum */
u_int8_t reserved[5];
-} *bios32_header_t;
+} __packed *bios32_header_t;
typedef
struct bios32_entry_info {
u_int32_t bei_base;
u_int32_t bei_size;
u_int32_t bei_entry;
-} *bios32_entry_info_t;
+} __packed *bios32_entry_info_t;
typedef
struct bios32_entry {
u_int32_t offset;
u_int16_t segment;
-} *bios32_entry_t;
+} __packed *bios32_entry_t;
#define BIOS32_START 0xe0000
#define BIOS32_SIZE 0x20000
@@ -130,7 +129,7 @@ typedef struct _bios_memmap {
u_int64_t addr; /* Beginning of block */
u_int64_t size; /* Size of block */
u_int32_t type; /* Type of block */
-} bios_memmap_t;
+} __packed bios_memmap_t;
/* Info about disk from the bios, plus the mapping from
* BIOS numbers to BSD major (driver?) number.
@@ -163,7 +162,7 @@ typedef struct _bios_diskinfo {
#define BDI_EL_TORITO 0x00000008 /* 2,048-byte sectors */
#define BDI_PICKED 0x80000000 /* kernel-only: cksum matched */
-} bios_diskinfo_t;
+} __packed bios_diskinfo_t;
#define BOOTARG_APMINFO 2
typedef struct _bios_apminfo {
@@ -176,7 +175,7 @@ typedef struct _bios_apminfo {
u_int apm_data_len;
u_int apm_entry;
u_int apm_code16_len;
-} bios_apminfo_t;
+} __packed bios_apminfo_t;
#define BOOTARG_CKSUMLEN 3 /* u_int32_t */
@@ -187,20 +186,20 @@ typedef struct _bios_pciinfo {
u_int32_t pci_rev; /* BCD Revision (%ebx) */
u_int32_t pci_entry32; /* PM entry point for PCI BIOS */
u_int32_t pci_lastbus; /* Number of last PCI bus */
-} bios_pciinfo_t;
+} __packed bios_pciinfo_t;
#define BOOTARG_CONSDEV 5
typedef struct _bios_consdev {
dev_t consdev;
int conspeed;
-} bios_consdev_t;
+} __packed bios_consdev_t;
#define BOOTARG_SMPINFO 6 /* struct mp_float[] */
#define BOOTARG_BOOTMAC 7
typedef struct _bios_bootmac {
char mac[6];
-} bios_bootmac_t;
+} __packed bios_bootmac_t;
#if defined(_KERNEL) || defined (_STANDALONE)
@@ -219,7 +218,7 @@ extern volatile struct BIOS_regs {
u_int32_t biosr_di;
u_int32_t biosr_ds;
u_int32_t biosr_es;
-} BIOS_regs;
+} __packed BIOS_regs;
#ifdef _KERNEL
#include <machine/bus.h>
@@ -263,5 +262,4 @@ extern bios_pciinfo_t *bios_pciinfo;
#endif /* _LOCORE */
#endif /* _KERNEL || _STANDALONE */
-#pragma pack()
#endif /* _I386_BIOSVAR_H_ */
diff --git a/sys/arch/i386/include/segments.h b/sys/arch/i386/include/segments.h
index da6f9abf187..e84cd3b951a 100644
--- a/sys/arch/i386/include/segments.h
+++ b/sys/arch/i386/include/segments.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: segments.h,v 1.14 2006/01/12 22:39:21 weingart Exp $ */
+/* $OpenBSD: segments.h,v 1.15 2008/09/01 17:30:56 deraadt Exp $ */
/* $NetBSD: segments.h,v 1.23 1996/02/01 22:31:03 mycroft Exp $ */
/*-
@@ -69,10 +69,6 @@
#ifndef _LOCORE
-#if __GNUC__ == 2 && __GNUC_MINOR__ < 7
-#pragma pack(1)
-#endif
-
/*
* Memory and System segment descriptors
*/
@@ -119,10 +115,6 @@ struct region_descriptor {
unsigned rd_base:32; /* base address */
} __packed;
-#if __GNUC__ == 2 && __GNUC_MINOR__ < 7
-#pragma pack(4)
-#endif
-
#ifdef _KERNEL
extern union descriptor *gdt, ldt[];
extern struct gate_descriptor idt_region[];