📄 shared.h
字号:
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, 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;#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);#endif#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;/* 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) (int, int, int);extern void (*disk_read_func) (int, int, int);#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;/* 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 int current_slice;extern int buf_drive;extern int buf_track;extern struct geometry buf_geom;/* these are the current file position and maximum file position */extern int filepos;extern int filemax;/* * Common BIOS/boot data. */extern struct multiboot_info mbi;extern unsigned long saved_drive;extern unsigned long saved_partition;extern unsigned long cdrom_drive;#ifndef STAGE1_5extern unsigned long saved_mem_upper;extern unsigned long extended_memory;#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));/* Copy MAP to the drive map and set up int13_handler. */void set_int13_handler (unsigned short *map);/* 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. */void track_int13 (int drive);/* The key map. */extern unsigned short bios_key_map[];extern unsigned short ascii_key_map[];extern unsigned short io_map[];/* calls for direct boot-loader chaining */void chain_stage1 (unsigned long segment, unsigned long offset, unsigned long part_table_addr) __attribute__ ((noreturn));void chain_stage2 (unsigned long segment, unsigned long offset, int second_sector) __attribute__ ((noreturn));/* do some funky stuff, then boot linux */void linux_boot (void) __attribute__ ((noreturn));/* do some funky stuff, then boot bzImage linux */void big_linux_boot (void) __attribute__ ((noreturn));/* booting a multiboot executable */void multi_boot (int start, int mb_info) __attribute__ ((noreturn));/* If LINEAR is nonzero, then set the Intel processor to linear mode. Otherwise, bit 20 of all memory accesses is always forced to zero, causing a wraparound effect for bugwards compatibility with the 8086 CPU. */void gateA20 (int linear);/* memory probe routines */int get_memsize (int type);int get_eisamemsize (void);/* Fetch the next entry in the memory map and return the continuation value. DESC is a pointer to the descriptor buffer, and CONT is the previous continuation value (0 to get the first entry in the map). */int get_mmap_entry (struct mmar_desc *desc, int cont);/* Get the linear address of a ROM configuration table. Return zero, if fails. */unsigned long get_rom_config_table (void);/* Get APM BIOS information. */void get_apm_info (void);/* Get VBE controller information. */int get_vbe_controller_info (struct vbe_controller *controller);/* Get VBE mode information. */int get_vbe_mode_info (int mode_number, struct vbe_mode *mode);/* Set VBE mode. */int set_vbe_mode (int mode_number);/* Return the data area immediately following our code. */int get_code_end (void);/* low-level timing info */int getrtsecs (void);int currticks (void);/* Clear the screen. */void cls (void);/* Turn on/off cursor. */int setcursor (int on);/* Get the current cursor position (where 0,0 is the top left hand corner of the screen). Returns packed values, (RET >> 8) is x, (RET & 0xff) is y. */int getxy (void);/* Set the cursor position. */void gotoxy (int x, int y);/* Displays an ASCII character. IBM displays will translate some characters to special graphical ones (see the DISP_* constants). */void grub_putchar (int c);/* Wait for a keypress, and return its packed BIOS/ASCII key code. Use ASCII_CHAR(ret) to extract the ASCII code. */int getkey (void);/* Like GETKEY, but doesn't block, and returns -1 if no keystroke is available. */int checkkey (void);/* Low-level disk I/O */int get_diskinfo (int drive, struct geometry *geometry);int biosdisk (int subfunc, int drive, struct geometry *geometry, int sector, int nsec, int segment);void stop_floppy (void);/* Command-line interface functions. */#ifndef STAGE1_5/* The flags for the builtins. */#define BUILTIN_CMDLINE 0x1 /* Run in the command-line. */#define BUILTIN_MENU 0x2 /* Run in the menu. */#define BUILTIN_TITLE 0x4 /* Only for the command title. */#define BUILTIN_SCRIPT 0x8 /* Run in the script. */#define BUILTIN_NO_ECHO 0x10 /* Don't print command on booting. */#define BUILTIN_HELP_LIST 0x20 /* Show help in listing. *//* The table for a builtin. */struct builtin{ /* The command name. */ char *name; /* The callback function. */ int (*func) (char *, int); /* The combination of the flags defined above. */ int flags; /* The short version of the documentation. */ char *short_doc; /* The long version of the documentation. */ char *long_doc;};/* All the builtins are registered in this. */extern struct builtin *builtin_table[];/* The constants for kernel types. */typedef enum{ KERNEL_TYPE_NONE, /* None is loaded. */ KERNEL_TYPE_MULTIBOOT, /* Multiboot. */ KERNEL_TYPE_LINUX, /* Linux. */ KERNEL_TYPE_BIG_LINUX, /* Big Linux. */ KERNEL_TYPE_FREEBSD, /* FreeBSD. */ KERNEL_TYPE_NETBSD, /* NetBSD. */ KERNEL_TYPE_CHAINLOADER /* Chainloader. */}kernel_t;extern kernel_t kernel_type;extern int show_menu;extern int grub_timeout;void init_builtins (void);void init_config (void);char *skip_to (int after_equal, char *cmdline);struct builtin *find_command (char *command);void print_cmdline_message (int forever);void enter_cmdline (char *heap, int forever);int run_script (char *script, char *heap);#endif/* C library replacement functions with identical semantics. */void grub_printf (const char *format,...);int grub_sprintf (char *buffer, const char *format, ...);int grub_tolower (int c);int grub_isspace (int c);int grub_strncat (char *s1, const char *s2, int n);void *grub_memmove (void *to, const void *from, int len);void *grub_memset (void *start, int c, int len);int grub_strncat (char *s1, const char *s2, int n);char *grub_strstr (const char *s1, const char *s2);int grub_memcmp (const char *s1, const char *s2, int n);int grub_strcmp (const char *s1, const char *s2);int grub_strlen (const char *str);char *grub_strcpy (char *dest, const char *src);#ifndef GRUB_UTILtypedef unsigned long grub_jmp_buf[6];#else/* In the grub shell, use the libc jmp_buf instead. */# include <setjmp.h># define grub_jmp_buf jmp_buf#endif#ifdef GRUB_UTIL# define grub_setjmp setjmp# define grub_longjmp longjmp#else /* ! GRUB_UTIL */int grub_setjmp (grub_jmp_buf env);void grub_longjmp (grub_jmp_buf env, int val);#endif /* ! GRUB_UTIL *//* The environment for restarting Stage 2. */extern grub_jmp_buf restart_env;/* The environment for restarting the command-line interface. */extern grub_jmp_buf restart_cmdline_env;/* misc */void init_page (void);void print_error (void);char *convert_to_ascii (char *buf, int c, ...);int get_cmdline (char *prompt, char *cmdline, int maxlen, int echo_char, int history);int substring (const char *s1, const char *s2);int nul_terminate (char *str);int get_based_digit (int c, int base);int safe_parse_maxint (char **str_ptr, int *myint_ptr);int memcheck (int start, int len);void grub_putstr (const char *str);#ifndef NO_DECOMPRESSION/* Compression support. */int gunzip_test_header (void);int gunzip_read (char *buf, int len);#endif /* NO_DECOMPRESSION */int rawread (int drive, int sector, int byte_offset, int byte_len, char *buf);int devread (int sector, int byte_offset, int byte_len, char *buf);int rawwrite (int drive, int sector, char *buf);int devwrite (int sector, int sector_len, char *buf);/* Parse a device string and initialize the global parameters. */char *set_device (char *device);int open_device (void);int real_open_partition (int flags);int open_partition (void);int next_partition (unsigned long drive, unsigned long dest, unsigned long *partition, int *type, unsigned long *start, unsigned long *len, unsigned long *offset, int *entry, unsigned long *ext_offset, char *buf);/* Sets device to the one represented by the SAVED_* parameters. */int make_saved_active (void);/* Set or clear the current root partition's hidden flag. */int set_partition_hidden_flag (int hidden);/* Open a file or directory on the active device, using GRUB's internal filesystem support. */int grub_open (char *filename);/* Read LEN bytes into BUF from the file that was opened with GRUB_OPEN. If LEN is -1, read all the remaining data in the file. */int grub_read (char *buf, int len);/* Reposition a file offset. */int grub_seek (int offset);/* Close a file. */void grub_close (void);/* List the contents of the directory that was opened with GRUB_OPEN, printing all completions. */int dir (char *dirname);int set_bootdev (int hdbias);/* Display statistics on the current active device. */void print_fsys_type (void);/* Display device and filename completions. */void print_a_completion (char *filename);int print_completions (int is_filename, int is_completion);/* Copies the current partition data to the desired address. */void copy_current_part_entry (char *buf);#ifndef STAGE1_5void bsd_boot (kernel_t type, int bootdev, char *arg) __attribute__ ((noreturn));/* Define flags for load_image here. *//* Don't pass a Linux's mem option automatically. */#define KERNEL_LOAD_NO_MEM_OPTION (1 << 0)kernel_t load_image (char *kernel, char *arg, kernel_t suggested_type, unsigned long load_flags);int load_module (char *module, char *arg);int load_initrd (char *initrd);int check_password(char *entered, char* expected, password_t type);#endifvoid init_bios_info (void);#endif /* ASM_FILE */#endif /* ! GRUB_SHARED_HEADER */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -