📄 shared.h
字号:
unsigned long ramdisk_image; /* initrd load address */ unsigned long ramdisk_size; /* initrd size */ unsigned long bootsect_kludge; /* obsolete */ unsigned short heap_end_ptr; /* Free memory after setup end */ unsigned short pad1; /* Unused */ char *cmd_line_ptr; /* Points to the kernel command line */ unsigned long initrd_addr_max; /* The highest address of initrd */} __attribute__ ((packed));/* Memory map address range descriptor used by GET_MMAP_ENTRY. */struct mmar_desc{ unsigned long desc_len; /* Size of this descriptor. */ unsigned long long addr; /* Base address. */ unsigned long long length; /* Length in bytes. */ unsigned long type; /* Type of address range. */} __attribute__ ((packed));/* VBE controller information. */struct vbe_controller{ unsigned char signature[4]; unsigned short version; unsigned long oem_string; unsigned long capabilities; unsigned long video_mode; unsigned short total_memory; unsigned short oem_software_rev; unsigned long oem_vendor_name; unsigned long oem_product_name; unsigned long oem_product_rev; unsigned char reserved[222]; unsigned char oem_data[256];} __attribute__ ((packed));/* VBE mode information. */struct vbe_mode{ unsigned short mode_attributes; unsigned char win_a_attributes; unsigned char win_b_attributes; unsigned short win_granularity; unsigned short win_size; unsigned short win_a_segment; unsigned short win_b_segment; unsigned long win_func; unsigned short bytes_per_scanline; /* >=1.2 */ unsigned short x_resolution; unsigned short y_resolution; unsigned char x_char_size; unsigned char y_char_size; unsigned char number_of_planes; unsigned char bits_per_pixel; unsigned char number_of_banks; unsigned char memory_model; unsigned char bank_size; unsigned char number_of_image_pages; unsigned char reserved0; /* direct color */ unsigned char red_mask_size; unsigned char red_field_position; unsigned char green_mask_size; unsigned char green_field_position; unsigned char blue_mask_size; unsigned char blue_field_position; unsigned char reserved_mask_size; unsigned char reserved_field_position; unsigned char direct_color_mode_info; /* >=2.0 */ unsigned long phys_base; unsigned long reserved1; unsigned short reversed2; /* >=3.0 */ unsigned short linear_bytes_per_scanline; unsigned char banked_number_of_image_pages; unsigned char linear_number_of_image_pages; unsigned char linear_red_mask_size; unsigned char linear_red_field_position; unsigned char linear_green_mask_size; unsigned char linear_green_field_position; unsigned char linear_blue_mask_size; unsigned char linear_blue_field_position; unsigned char linear_reserved_mask_size; unsigned char linear_reserved_field_position; unsigned long max_pixel_clock; unsigned char reserved3[189];} __attribute__ ((packed));#undef NULL#define NULL ((void *) 0)/* Error codes (descriptions are in common.c) */typedef enum{ ERR_NONE = 0, ERR_BAD_FILENAME, ERR_BAD_FILETYPE, ERR_BAD_GZIP_DATA, ERR_BAD_GZIP_HEADER, ERR_BAD_PART_TABLE, ERR_BAD_VERSION, ERR_BELOW_1MB, ERR_BOOT_COMMAND, ERR_BOOT_FAILURE, ERR_BOOT_FEATURES, ERR_DEV_FORMAT, ERR_DEV_VALUES, ERR_EXEC_FORMAT, ERR_FILELENGTH, ERR_FILE_NOT_FOUND, ERR_FSYS_CORRUPT, ERR_FSYS_MOUNT, ERR_GEOM, ERR_NEED_LX_KERNEL, ERR_NEED_MB_KERNEL, ERR_NO_DISK, ERR_NO_PART, ERR_NUMBER_PARSING, ERR_OUTSIDE_PART, ERR_READ, ERR_SYMLINK_LOOP, ERR_UNRECOGNIZED, ERR_WONT_FIT, ERR_WRITE, ERR_BAD_ARGUMENT, ERR_UNALIGNED, ERR_PRIVILEGED, ERR_DEV_NEED_INIT, ERR_NO_DISK_SPACE, ERR_NUMBER_OVERFLOW, ERR_DEFAULT_FILE, ERR_DEL_MEM_DRIVE, ERR_DISABLE_A20, ERR_DOS_BACKUP, ERR_ENABLE_A20, ERR_EXTENDED_PARTITION, ERR_FILENAME_FORMAT, ERR_HD_VOL_START_0, ERR_INT13_ON_HOOK, ERR_INT13_OFF_HOOK, ERR_INVALID_BOOT_CS, ERR_INVALID_BOOT_IP, ERR_INVALID_FLOPPIES, ERR_INVALID_HARDDRIVES, ERR_INVALID_HEADS, ERR_INVALID_LOAD_LENGTH, ERR_INVALID_LOAD_OFFSET, ERR_INVALID_LOAD_SEGMENT, ERR_INVALID_SECTORS, ERR_INVALID_SKIP_LENGTH, ERR_INVALID_RAM_DRIVE, ERR_IN_SITU_FLOPPY, ERR_IN_SITU_MEM, ERR_MD_BASE, ERR_NON_CONTIGUOUS, ERR_NO_DRIVE_MAPPED, ERR_NO_HEADS, ERR_NO_SECTORS, ERR_PARTITION_TABLE_FULL, ERR_RD_BASE, ERR_SPECIFY_GEOM, ERR_SPECIFY_MEM, ERR_SPECIFY_RESTRICTION,// ERR_INVALID_RD_BASE,// ERR_INVALID_RD_SIZE, ERR_MD5_FORMAT, MAX_ERR_NUM} grub_error_t;extern unsigned long install_partition;extern unsigned long boot_drive;//extern unsigned long install_second_sector;//extern struct apm_info apm_bios_info;extern unsigned long boot_part_addr;extern int saved_entryno;extern unsigned char force_lba;extern char version_string[];extern char config_file[];extern unsigned long linux_text_len;extern char *linux_data_tmp_addr;extern char *linux_data_real_addr;extern int quit_print;#ifdef GRUB_UTIL/* If not using config file, this variable is set to zero, otherwise non-zero. */extern int use_config_file;/* If using the preset menu, this variable is set to non-zero, otherwise zero. */extern int use_preset_menu;/* If not using curses, this variable is set to zero, otherwise non-zero. */extern int use_curses;/* The flag for verbose messages. */extern int verbose;/* The flag for read-only. */extern int read_only;/* The number of floppies to be probed. */extern int floppy_disks;/* The map between BIOS drives and UNIX device file names. */extern char **device_map;/* The filename which stores the information about a device map. */extern char *device_map_file;/* The array of geometries. */extern struct geometry *disks;/* Assign DRIVE to a device name DEVICE. */extern void assign_device_name (int drive, const char *device);#define DEBUG_SLEEP {}#else/* print debug message on startup if the DEBUG_KEY is pressed. */extern int debug_boot;extern int console_getkey (void);//#define SLEEP {unsigned long i;for (i=0;i<0xFFFFFFFF;i++);}#define DEBUG_SLEEP {if (debug_boot) console_getkey ();}#endifextern void hexdump(unsigned long,char*,int);#ifndef STAGE1_5/* GUI interface variables. */# define MAX_FALLBACK_ENTRIES 8extern int fallback_entries[MAX_FALLBACK_ENTRIES];extern int fallback_entryno;extern int default_entry;extern int current_entryno;extern const char *preset_menu;/* The constants for password types. */typedef enum{ PASSWORD_PLAIN, PASSWORD_MD5, PASSWORD_UNSUPPORTED}password_t;extern char *password;extern password_t password_type;extern int auth;extern char commands[];/* For `more'-like feature. */extern int max_lines;extern int count_lines;extern int use_pager;#endif#ifndef NO_DECOMPRESSIONextern int no_decompression;extern int compressed_file;#endif/* instrumentation variables */extern void (*disk_read_hook) (unsigned long, unsigned long, unsigned long);extern void (*disk_read_func) (unsigned long, unsigned long, unsigned long);#ifndef STAGE1_5/* The flag for debug mode. */extern int debug;#endif /* STAGE1_5 */extern unsigned long current_drive;extern unsigned long current_partition;extern int fsys_type;extern inline unsigned long log2_tmp (unsigned long word);extern void unicode_to_utf8 (unsigned short *filename, unsigned char *utf8, unsigned long n);/* The information for a disk geometry. The CHS information is only for DOS/Partition table compatibility, and the real number of sectors is stored in TOTAL_SECTORS. */struct geometry{ /* The number of cylinders */ unsigned long cylinders; /* The number of heads */ unsigned long heads; /* The number of sectors */ unsigned long sectors; /* The total number of sectors */ unsigned long total_sectors; /* Device sector size */ unsigned long sector_size; /* Flags */ unsigned long flags;};extern unsigned long part_start;extern unsigned long part_length;extern unsigned long current_slice;extern int buf_drive;extern int buf_track;extern struct geometry buf_geom;extern struct geometry tmp_geom;extern struct geometry fd_geom[4];extern struct geometry hd_geom[4];/* these are the current file position and maximum file position */extern unsigned long filepos;extern unsigned long filemax;extern unsigned long emu_iso_sector_size_2048;/* * Common BIOS/boot data. */extern struct multiboot_info mbi;extern unsigned long saved_drive;extern unsigned long saved_partition;extern char saved_dir[256];extern unsigned long memdisk_raw; /* raw mode as in memdisk */extern unsigned long a20_keep_on; /* keep a20 on after RAM drive sector access */extern unsigned long lba_cd_boot; /* LBA of no-emulation boot image, in 2048-byte sectors */extern unsigned long safe_mbr_hook; /* safe mbr hook flags used by Win9x */extern unsigned long int13_scheme; /* controls disk access methods in emulation */extern unsigned long atapi_dev_count; /* ATAPI CDROM DRIVE COUNT */extern unsigned long *reg_base_addr_append;extern unsigned long init_atapi(void);extern unsigned long min_cdrom_id; /* MINIMUM ATAPI CDROM DRIVE NUMBER */extern unsigned long cdrom_drive;//extern unsigned long cdrom_drives[];//#ifndef cdrom_drive//#define cdrom_drive (*cdrom_drives)//#endifextern unsigned long force_cdrom_as_boot_device;extern unsigned long ram_drive;extern unsigned long rd_base;extern unsigned long rd_size;extern unsigned long saved_mem_upper;extern unsigned long saved_mem_lower;extern unsigned long saved_mmap_addr;extern unsigned long saved_mmap_length;#ifndef STAGE1_5extern unsigned long extended_memory;extern unsigned long init_free_mem_start;#endif/* * Error variables. */extern grub_error_t errnum;extern char *err_list[];/* Simplify declaration of entry_addr. */typedef void (*entry_func) (int, int, int, int, int, int) __attribute__ ((noreturn));extern entry_func entry_addr;/* Enter the stage1.5/stage2 C code after the stack is set up. */void cmain (void);/* Halt the processor (called after an unrecoverable error). */void stop (void) __attribute__ ((noreturn));/* Reboot the system. */void grub_reboot (void) __attribute__ ((noreturn));/* Halt the system, using APM if possible. If NO_APM is true, don't use APM even if it is available. */void grub_halt (int no_apm) __attribute__ ((noreturn));struct drive_map_slot{ /* Remember to update DRIVE_MAP_SLOT_SIZE once this is modified. * The struct size must be a multiple of 4. */ /* X=max_sector bit 7: read only or fake write */ /* Y=to_sector bit 6: safe boot or fake write */ /* ------------------------------------------- */ /* X Y: meaning of restrictions imposed on map */ /* ------------------------------------------- */ /* 1 1: read only=0, fake write=1, safe boot=0 */ /* 1 0: read only=1, fake write=0, safe boot=0 */ /* 0 1: read only=0, fake write=0, safe boot=1 */ /* 0 0: read only=0, fake write=0, safe boot=0 */ unsigned char from_drive; unsigned char to_drive; /* 0xFF indicates a memdrive */ unsigned char max_head; unsigned char max_sector; /* bit 7: read only */ /* bit 6: disable lba */ unsigned short to_cylinder; /* max cylinder of the TO drive */ /* bit 15: TO drive support LBA */ /* bit 14: TO drive is CDROM(with big 2048-byte sector) */ /* bit 13: FROM drive is CDROM(with big 2048-byte sector) */ unsigned char to_head; /* max head of the TO drive */ unsigned char to_sector; /* max sector of the TO drive */ /* bit 7: in-situ */ /* bit 6: fake-write or safe-boot */ unsigned long start_sector; unsigned long start_sector_hi; /* hi dword of the 64-bit value */ unsigned long sector_count; unsigned long sector_count_hi; /* hi dword of the 64-bit value */};/* Copy MAP to the drive map and set up int13_handler. */void set_int13_handler (struct drive_map_slot *map);/* Restore the original int13 handler. */int unset_int13_handler (int check_status_only);/* Set up int15_handler. */void set_int15_handler (void);/* Restore the original int15 handler. */void unset_int15_handler (void);/* Track the int13 handler to probe I/O address space. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -