xref: /illumos-gate/usr/src/boot/i386/libi386/linux.h (revision dd72704bd9e794056c558153663c739e2012d721)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2015 Toomas Soome <tsoome@me.com>
14  */
15 
16 #ifndef _LINUX_H
17 #define	_LINUX_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #ifndef ASM_FILE
24 /* For the Linux/i386 boot protocol version 2.10.  */
25 struct linux_kernel_header
26 {
27   uint8_t code1[0x0020];
28   uint16_t cl_magic;               /* Magic number 0xA33F */
29   uint16_t cl_offset;              /* The offset of command line */
30   uint8_t code2[0x01F1 - 0x0020 - 2 - 2];
31   uint8_t setup_sects;             /* The size of the setup in sectors */
32   uint16_t root_flags;             /* If the root is mounted readonly */
33   uint16_t syssize;                /* obsolete */
34   uint16_t swap_dev;               /* obsolete */
35   uint16_t ram_size;               /* obsolete */
36   uint16_t vid_mode;               /* Video mode control */
37   uint16_t root_dev;               /* Default root device number */
38   uint16_t boot_flag;              /* 0xAA55 magic number */
39   uint16_t jump;                   /* Jump instruction */
40   uint32_t header;                 /* Magic signature "HdrS" */
41   uint16_t version;                /* Boot protocol version supported */
42   uint32_t realmode_swtch;         /* Boot loader hook */
43   uint16_t start_sys;              /* The load-low segment (obsolete) */
44   uint16_t kernel_version;         /* Points to kernel version string */
45   uint8_t type_of_loader;          /* Boot loader identifier */
46   uint8_t loadflags;               /* Boot protocol option flags */
47   uint16_t setup_move_size;        /* Move to high memory size */
48   uint32_t code32_start;           /* Boot loader hook */
49   uint32_t ramdisk_image;          /* initrd load address */
50   uint32_t ramdisk_size;           /* initrd size */
51   uint32_t bootsect_kludge;        /* obsolete */
52   uint16_t heap_end_ptr;           /* Free memory after setup end */
53   uint16_t pad1;                   /* Unused */
54   uint32_t cmd_line_ptr;           /* Points to the kernel command line */
55   uint32_t initrd_addr_max;        /* Highest address for initrd */
56   uint32_t kernel_alignment;
57   uint8_t relocatable;
58   uint8_t min_alignment;
59   uint8_t pad[2];
60   uint32_t cmdline_size;
61   uint32_t hardware_subarch;
62   uint64_t hardware_subarch_data;
63   uint32_t payload_offset;
64   uint32_t payload_length;
65   uint64_t setup_data;
66   uint64_t pref_address;
67   uint32_t init_size;
68 } __attribute__ ((packed));
69 #endif
70 
71 #define	LINUX_VID_MODE_NORMAL		0xFFFF
72 #define	LINUX_VID_MODE_EXTENDED		0xFFFE
73 #define	LINUX_VID_MODE_ASK		0xFFFD
74 
75 #define	BOOTSEC_SIGNATURE		0xAA55
76 #define	LINUX_BOOT_LOADER_TYPE		0x72
77 #define	LINUX_BZIMAGE_ADDR		0x100000
78 #define	LINUX_CL_END_OFFSET		0x90FF
79 #define	LINUX_CL_MAGIC			0xA33F
80 #define	LINUX_CL_OFFSET			0x9000
81 #define	LINUX_DEFAULT_SETUP_SECTS	4
82 #define	LINUX_ESP			0x9000
83 #define	LINUX_FLAG_BIG_KERNEL		0x1
84 #define	LINUX_FLAG_CAN_USE_HEAP		0x80
85 #define	LINUX_HEAP_END_OFFSET		(0x9000 - 0x200)
86 #define	LINUX_MAGIC_SIGNATURE		0x53726448
87 #define	LINUX_MAX_SETUP_SECTS		64
88 #define	LINUX_OLD_REAL_MODE_ADDR	0x90000
89 #define	LINUX_SETUP_MOVE_SIZE		0x9100
90 #define	LINUX_ZIMAGE_ADDR		0x10000
91 #define	LINUX_INITRD_MAX_ADDRESS	0x38000000
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif /* _LINUX_H */
98