Skip to content

Instantly share code, notes, and snippets.

@Lencerf
Created June 18, 2020 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lencerf/90d33472d5e8e2a8abeefc7c11c798c6 to your computer and use it in GitHub Desktop.
Save Lencerf/90d33472d5e8e2a8abeefc7c11c798c6 to your computer and use it in GitHub Desktop.
sizeof setup_header
#include <stdint.h>
#include <stdio.h>
typedef uint8_t __u8;
typedef uint16_t __u16;
typedef uint32_t __u32;
typedef uint64_t __u64;
struct setup_header {
__u8 setup_sects;
__u16 root_flags;
__u32 syssize;
__u16 ram_size;
__u16 vid_mode;
__u16 root_dev;
__u16 boot_flag;
__u16 jump;
__u32 header;
__u16 version;
__u32 realmode_swtch;
__u16 start_sys_seg;
__u16 kernel_version;
__u8 type_of_loader;
__u8 loadflags;
__u16 setup_move_size;
__u32 code32_start;
__u32 ramdisk_image;
__u32 ramdisk_size;
__u32 bootsect_kludge;
__u16 heap_end_ptr;
__u8 ext_loader_ver;
__u8 ext_loader_type;
__u32 cmd_line_ptr;
__u32 initrd_addr_max;
__u32 kernel_alignment;
__u8 relocatable_kernel;
__u8 min_alignment;
__u16 xloadflags;
__u32 cmdline_size;
__u32 hardware_subarch;
__u64 hardware_subarch_data;
__u32 payload_offset;
__u32 payload_length;
__u64 setup_data;
__u64 pref_address;
__u32 init_size;
__u32 handover_offset;
__u32 kernel_info_offset;
} __attribute__((packed));
int main() {
struct setup_header sp;
printf("sizeof(sp)=%lu\n", sizeof(sp));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment