aboutsummaryrefslogtreecommitdiffstats
path: root/com32/mboot
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-04-27 11:00:44 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-04-27 11:00:44 -0700
commit6c0fb9ea3e8ac6ecf7c9fe3f8708999c0031e9b6 (patch)
treec9ba63f7256adb4403c3959ea9efb271ca03018f /com32/mboot
parent5c87f5fe02d93311b0a374ce847549fd28260f67 (diff)
downloadsyslinux-6c0fb9ea3e8ac6ecf7c9fe3f8708999c0031e9b6.tar.gz
syslinux-6c0fb9ea3e8ac6ecf7c9fe3f8708999c0031e9b6.tar.xz
syslinux-6c0fb9ea3e8ac6ecf7c9fe3f8708999c0031e9b6.zip
mboot: add header guards; use <inttypes.h>; formatting changes
Reformat the mboot header files slightly, use <inttypes.h> types, and add header inclusion guards. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/mboot')
-rw-r--r--com32/mboot/mb_header.h42
-rw-r--r--com32/mboot/mb_info.h40
2 files changed, 36 insertions, 46 deletions
diff --git a/com32/mboot/mb_header.h b/com32/mboot/mb_header.h
index 4215323f..2a5be724 100644
--- a/com32/mboot/mb_header.h
+++ b/com32/mboot/mb_header.h
@@ -17,37 +17,41 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#ifndef MBOOT_MB_HEADER_H
+#define MBOOT_MB_HEADER_H
+
+#include <inttypes.h>
+
/*
* MultiBoot Header description
*/
-struct multiboot_header
-{
+struct multiboot_header {
/* Must be MULTIBOOT_MAGIC - see below. */
- unsigned magic;
+ uint32_t magic;
/* Feature flags - see below. */
- unsigned flags;
+ uint32_t flags;
/*
* Checksum
*
* The above fields plus this one must equal 0 mod 2^32.
*/
- unsigned checksum;
+ uint32_t checksum;
/* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */
- unsigned header_addr;
- unsigned load_addr;
- unsigned load_end_addr;
- unsigned bss_end_addr;
- unsigned entry_addr;
+ uint32_t header_addr;
+ uint32_t load_addr;
+ uint32_t load_end_addr;
+ uint32_t bss_end_addr;
+ uint32_t entry_addr;
/* These are only valid if MULTIBOOT_VIDEO_MODE is set. */
- unsigned mode_type;
- unsigned width;
- unsigned height;
- unsigned depth;
+ uint32_t mode_type;
+ uint32_t width;
+ uint32_t height;
+ uint32_t depth;
};
/*
@@ -55,14 +59,6 @@ struct multiboot_header
* within the first MULTIBOOT_SEARCH bytes of the kernel image.
*/
#define MULTIBOOT_SEARCH 8192
-#define MULTIBOOT_FOUND(addr, len) \
- (! ((addr) & 0x3) \
- && (len) >= 12 \
- && *((int *) (addr)) == MULTIBOOT_MAGIC \
- && ! (*((unsigned *) (addr)) + *((unsigned *) (addr + 4)) \
- + *((unsigned *) (addr + 8))) \
- && (! (MULTIBOOT_AOUT_KLUDGE & *((int *) (addr + 4))) || (len) >= 32) \
- && (! (MULTIBOOT_VIDEO_MODE & *((int *) (addr + 4))) || (len) >= 48))
/* Magic value identifying the multiboot_header. */
#define MULTIBOOT_MAGIC 0x1BADB002
@@ -88,3 +84,5 @@ struct multiboot_header
/* This flag indicates the use of the address fields in the header. */
#define MULTIBOOT_AOUT_KLUDGE 0x00010000
+
+#endif /* MBOOT_MB_HEADER_H */
diff --git a/com32/mboot/mb_info.h b/com32/mboot/mb_info.h
index ec12fe8a..149099fc 100644
--- a/com32/mboot/mb_info.h
+++ b/com32/mboot/mb_info.h
@@ -21,10 +21,12 @@
* The structure type "mod_list" is used by the "multiboot_info" structure.
*/
+#ifndef MBOOT_MB_INFO_H
+#define MBOOT_MB_INFO_H
+
#include <inttypes.h>
-struct mod_list
-{
+struct mod_list {
/* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
uint32_t mod_start;
uint32_t mod_end;
@@ -44,13 +46,11 @@ struct mod_list
* map has been reached.
*/
-struct AddrRangeDesc
-{
+struct AddrRangeDesc {
uint32_t size;
uint64_t BaseAddr;
uint64_t Length;
uint32_t Type;
-
/* unspecified optional padding... */
} __attribute__((packed));
@@ -59,8 +59,7 @@ struct AddrRangeDesc
/* Drive Info structure. */
-struct drive_info
-{
+struct drive_info {
/* The size of this structure. */
uint32_t size;
@@ -85,8 +84,7 @@ struct drive_info
/* APM BIOS info. */
-struct apm_info
-{
+struct apm_info {
uint16_t version;
uint16_t cseg;
uint32_t offset;
@@ -105,8 +103,7 @@ struct apm_info
* its address in the EAX register.
*/
-struct multiboot_info
-{
+struct multiboot_info {
/* MultiBoot info version number */
uint32_t flags;
@@ -124,29 +121,22 @@ struct multiboot_info
uint32_t mods_count;
uint32_t mods_addr;
- union
- {
- struct
- {
+ union {
+ struct {
/* (a.out) Kernel symbol table info */
uint32_t tabsize;
uint32_t strsize;
uint32_t addr;
uint32_t pad;
- }
- a;
-
- struct
- {
+ } a;
+ struct {
/* (ELF) Kernel section header table */
uint32_t num;
uint32_t size;
uint32_t addr;
uint32_t shndx;
- }
- e;
- }
- syms;
+ } e;
+ } syms;
/* Memory Mapping buffer */
uint32_t mmap_length;
@@ -217,3 +207,5 @@ struct multiboot_info
*/
#define MULTIBOOT_VALID 0x2BADB002
+
+#endif /* MBOOT_MB_INFO_H */