⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shared.h

📁 grub4dos-0.4.4-2008- 08-src.zip
💻 H
📖 第 1 页 / 共 3 页
字号:
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. Return 0 for failure and 1 for success. */int 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);/* Get current date and time */void get_datetime(unsigned long *date, unsigned long *time);#ifdef GRUB_UTILint currticks (void);#else#define currticks()	(*(unsigned long *)0x46C)#endif/* 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 */extern int biosdisk_int13_extensions (int ax, int drive, void *dap);int get_cdinfo (int drive, struct geometry *geometry);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_TYPE_CDROM}kernel_t;extern kernel_t kernel_type;extern int show_menu;#if !defined(STAGE1_5) && !defined(GRUB_UTIL)extern char *mbr;#endifextern 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_memcpy (void *to, const void *from, unsigned 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, ...);extern char *prompt;extern int maxlen;extern int echo_char;extern int readline;int get_cmdline (char *cmdline);int substring (const char *s1, const char *s2, int case_insensitive);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 (unsigned long start, unsigned long len);void grub_putstr (const char *str);#ifndef NO_DECOMPRESSION/* Compression support. */int gunzip_test_header (void);unsigned long gunzip_read (char *buf, unsigned long len);#endif /* NO_DECOMPRESSION */int rawread (unsigned long drive, unsigned long sector, unsigned long byte_offset, unsigned long byte_len, char *buf);int devread (unsigned long sector, unsigned long byte_offset, unsigned long byte_len, char *buf);int rawwrite (unsigned long drive, unsigned long sector, char *buf);int devwrite (unsigned long sector, unsigned long sector_len, char *buf);/* Parse a device string and initialize the global parameters. */char *set_device (char *device);int open_device (void);//char *setup_part (char *filename);int real_open_partition (int flags);int open_partition (void);int next_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 (int status_only);/* 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.  */unsigned long grub_read (char *buf, unsigned long len);/* Reposition a file offset.  */unsigned long grub_seek (unsigned long 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);struct master_and_dos_boot_sector {/* 00 */ char dummy1[0x0b]; /* at offset 0, normally there is a short JMP instuction(opcode is 0xEB) *//* 0B */ unsigned short bytes_per_sector __attribute__ ((packed));/* seems always to be 512, so we just use 512 *//* 0D */ unsigned char sectors_per_cluster;/* non-zero, the power of 2, i.e., 2^n *//* 0E */ unsigned short reserved_sectors __attribute__ ((packed));/* FAT=non-zero, NTFS=0? *//* 10 */ unsigned char number_of_fats;/* NTFS=0; FAT=1 or 2  *//* 11 */ unsigned short root_dir_entries __attribute__ ((packed));/* FAT32=0, NTFS=0, FAT12/16=non-zero *//* 13 */ unsigned short total_sectors_short __attribute__ ((packed));/* FAT32=0, NTFS=0, FAT12/16=any *//* 15 */ unsigned char media_descriptor;/* range from 0xf0 to 0xff *//* 16 */ unsigned short sectors_per_fat __attribute__ ((packed));/* FAT32=0, NTFS=0, FAT12/16=non-zero *//* 18 */ unsigned short sectors_per_track __attribute__ ((packed));/* range from 1 to 63 *//* 1A */ unsigned short total_heads __attribute__ ((packed));/* range from 1 to 256 *//* 1C */ unsigned long hidden_sectors __attribute__ ((packed));/* any value *//* 20 */ unsigned long total_sectors_long __attribute__ ((packed));/* FAT32=non-zero, NTFS=0, FAT12/16=any *//* 24 */ unsigned long sectors_per_fat32 __attribute__ ((packed));/* FAT32=non-zero, NTFS=any, FAT12/16=any *//* 28 */ unsigned long long total_sectors_long_long __attribute__ ((packed));/* NTFS=non-zero, FAT12/16/32=any *//* 30 */ char dummy2[0x18e];    /* Partition Table, starting at offset 0x1BE *//* 1BE */ struct {	/* +00 */ unsigned char boot_indicator;	/* +01 */ unsigned char start_head;	/* +02 */ unsigned short start_sector_cylinder __attribute__ ((packed));	/* +04 */ unsigned char system_indicator;	/* +05 */ unsigned char end_head;	/* +06 */ unsigned short end_sector_cylinder __attribute__ ((packed));	/* +08 */ unsigned long start_lba __attribute__ ((packed));	/* +0C */ unsigned long total_sectors __attribute__ ((packed));	/* +10 */    } P[4];/* 1FE */ unsigned short boot_signature __attribute__ ((packed));/* 0xAA55 */#if 0	 /* This starts at offset 0x200 *//* 200 */ unsigned long probed_total_sectors __attribute__ ((packed));/* 204 */ unsigned long probed_heads __attribute__ ((packed));/* 208 */ unsigned long probed_sectors_per_track __attribute__ ((packed));/* 20C */ unsigned long probed_cylinders __attribute__ ((packed));/* 210 */ unsigned long sectors_per_cylinder __attribute__ ((packed));/* 214 */ char dummy3[0x0c] __attribute__ ((packed));    /* matrix of coefficients of linear equations     *     *   C[n] * (H_count * S_count) + H[n] * S_count = LBA[n] - S[n] + 1     *     * where n = 1, 2, 3, 4, 5, 6, 7, 8     */	 /* This starts at offset 0x130 *//* 220 */ long long L[9] __attribute__ ((packed)); /* L[n] == LBA[n] - S[n] + 1 *//* 268 */ long H[9] __attribute__ ((packed));/* 28C */ short C[9] __attribute__ ((packed));/* 29E */ short X __attribute__ ((packed));/* 2A0 */ short Y __attribute__ ((packed));/* 2A2 */ short Cmax __attribute__ ((packed));/* 2A4 */ long Hmax __attribute__ ((packed));/* 2A8 */ unsigned long Z __attribute__ ((packed));/* 2AC */ short Smax __attribute__ ((packed));/* 2AE */#endif  };extern unsigned long probed_total_sectors;extern unsigned long probed_heads;extern unsigned long probed_sectors_per_track;extern unsigned long probed_cylinders;extern unsigned long sectors_per_cylinder;extern int filesystem_type;extern unsigned long bios_id;	/* 1 for bochs, 0 for unknown. */int probe_bpb (struct master_and_dos_boot_sector *BS);int probe_mbr (struct master_and_dos_boot_sector *BS, unsigned long start_sector1, unsigned long sector_count1, unsigned long part_start1);extern int check_int13_extensions (int drive);struct drive_parameters{	unsigned short size;	unsigned short flags;	unsigned long cylinders;	unsigned long heads;	unsigned long sectors;	unsigned long long total_sectors;	unsigned short bytes_per_sector;	/* ver 2.0 or higher */	unsigned long EDD_configuration_parameters;	/* ver 3.0 or higher */	unsigned short signature_dpi;	unsigned char length_dpi;	unsigned char reserved[3];	unsigned char name_of_host_bus[4];	unsigned char name_of_interface_type[8];	unsigned char interface_path[8];	unsigned char device_path[8];	unsigned char reserved2;	unsigned char checksum;	/* XXX: This is necessary, because the BIOS of Thinkpad X20	   writes a garbage to the tail of drive parameters,	   regardless of a size specified in a caller.  */	unsigned char dummy[16];} __attribute__ ((packed));int check_64bit (void);extern int is64bit;extern int errorcheck;#ifdef FSYS_PXEextern unsigned long pxe_entry;extern char* pxe_scan(void);extern void pxe_detect(void);extern void pxe_unload(void);extern int pxe_call(int func,void* data);#if PXE_FAST_READextern int pxe_fast_read(void* data,int num);#endifint pxe_func(char* arg,int flags);#else /* ! FSYS_PXE */#define pxe_detect()#endif /* FSYS_PXE */#endif /* ! ASM_FILE */#endif /* ! GRUB_SHARED_HEADER */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -