2004-04-04 Yoshinori K. Okuji <okuji@enbug.org>

All symbols prefixed with PUPA_ and pupa_ are renamed to GRUB_
	and grub_, respectively. Because the conversion is trivial and
	mechanical, I omit the details here. Please refer to the CVS
	if you need more information.
This commit is contained in:
okuji 2004-04-04 13:46:03 +00:00
parent 6a1425510d
commit 4b13b216f4
125 changed files with 6198 additions and 6181 deletions

View file

@ -1,8 +1,8 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -13,18 +13,18 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_ARG_HEADER
#define PUPA_ARG_HEADER 1
#ifndef GRUB_ARG_HEADER
#define GRUB_ARG_HEADER 1
#include <pupa/symbol.h>
#include <pupa/err.h>
#include <pupa/types.h>
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
enum pupa_arg_type
enum grub_arg_type
{
ARG_TYPE_NONE,
ARG_TYPE_STRING,
@ -35,32 +35,32 @@ enum pupa_arg_type
ARG_TYPE_PATHNAME
};
typedef enum pupa_arg_type pupa_arg_type_t;
typedef enum grub_arg_type grub_arg_type_t;
/* Flags for the option field op pupa_arg_option. */
#define PUPA_ARG_OPTION_OPTIONAL 1 << 1
/* Flags for the option field op grub_arg_option. */
#define GRUB_ARG_OPTION_OPTIONAL 1 << 1
enum pupa_key_type
enum grub_key_type
{
PUPA_KEY_ARG = -1,
PUPA_KEY_END = -2
GRUB_KEY_ARG = -1,
GRUB_KEY_END = -2
};
typedef enum pupa_key_type pupa_arg_key_type_t;
typedef enum grub_key_type grub_arg_key_type_t;
struct pupa_arg_option
struct grub_arg_option
{
char *longarg;
char shortarg;
int flags;
char *doc;
char *arg;
pupa_arg_type_t type;
grub_arg_type_t type;
};
struct pupa_arg_list
struct grub_arg_list
{
int set;
char *arg;
};
#endif /* ! PUPA_ARG_HEADER */
#endif /* ! GRUB_ARG_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -17,12 +17,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_BOOT_HEADER
#define PUPA_BOOT_HEADER 1
#ifndef GRUB_BOOT_HEADER
#define GRUB_BOOT_HEADER 1
#define PUPA_BOOT_VERSION_MAJOR 4
#define PUPA_BOOT_VERSION_MINOR 0
#define PUPA_BOOT_VERSION ((PUPA_BOOT_VERSION_MINOR << 8) \
| PUPA_BOOT_VERSION_MAJOR)
#define GRUB_BOOT_VERSION_MAJOR 4
#define GRUB_BOOT_VERSION_MINOR 0
#define GRUB_BOOT_VERSION ((GRUB_BOOT_VERSION_MINOR << 8) \
| GRUB_BOOT_VERSION_MAJOR)
#endif /* ! PUPA_BOOT_HEADER */
#endif /* ! GRUB_BOOT_HEADER */

View file

@ -1,9 +1,9 @@
/* device.h - device manager */
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -14,31 +14,31 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_DEVICE_HEADER
#define PUPA_DEVICE_HEADER 1
#ifndef GRUB_DEVICE_HEADER
#define GRUB_DEVICE_HEADER 1
#include <pupa/symbol.h>
#include <pupa/err.h>
#include <grub/symbol.h>
#include <grub/err.h>
struct pupa_disk;
struct pupa_net;
struct pupa_fs;
struct grub_disk;
struct grub_net;
struct grub_fs;
struct pupa_device
struct grub_device
{
struct pupa_disk *disk;
struct pupa_net *net;
struct grub_disk *disk;
struct grub_net *net;
};
typedef struct pupa_device *pupa_device_t;
typedef struct grub_device *grub_device_t;
pupa_device_t EXPORT_FUNC(pupa_device_open) (const char *name);
pupa_err_t EXPORT_FUNC(pupa_device_close) (pupa_device_t device);
grub_device_t EXPORT_FUNC(grub_device_open) (const char *name);
grub_err_t EXPORT_FUNC(grub_device_close) (grub_device_t device);
pupa_err_t EXPORT_FUNC(pupa_device_set_root) (const char *name);
const char *EXPORT_FUNC(pupa_device_get_root) (void);
grub_err_t EXPORT_FUNC(grub_device_set_root) (const char *name);
const char *EXPORT_FUNC(grub_device_get_root) (void);
#endif /* ! PUPA_DEVICE_HEADER */
#endif /* ! GRUB_DEVICE_HEADER */

View file

@ -1,8 +1,8 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -13,22 +13,22 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_DISK_HEADER
#define PUPA_DISK_HEADER 1
#ifndef GRUB_DISK_HEADER
#define GRUB_DISK_HEADER 1
#include <pupa/symbol.h>
#include <pupa/err.h>
#include <pupa/types.h>
#include <pupa/device.h>
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
#include <grub/device.h>
struct pupa_disk;
struct grub_disk;
/* Disk device. */
struct pupa_disk_dev
struct grub_disk_dev
{
/* The device name. */
const char *name;
@ -37,34 +37,34 @@ struct pupa_disk_dev
int (*iterate) (int (*hook) (const char *name));
/* Open the device named NAME, and set up DISK. */
pupa_err_t (*open) (const char *name, struct pupa_disk *disk);
grub_err_t (*open) (const char *name, struct grub_disk *disk);
/* Close the disk DISK. */
void (*close) (struct pupa_disk *disk);
void (*close) (struct grub_disk *disk);
/* Read SIZE sectors from the sector SECTOR of the disk DISK into BUF. */
pupa_err_t (*read) (struct pupa_disk *disk, unsigned long sector,
grub_err_t (*read) (struct grub_disk *disk, unsigned long sector,
unsigned long size, char *buf);
/* Write SIZE sectors from BUF into the sector SECTOR of the disk DISK. */
pupa_err_t (*write) (struct pupa_disk *disk, unsigned long sector,
grub_err_t (*write) (struct grub_disk *disk, unsigned long sector,
unsigned long size, const char *buf);
/* The next disk device. */
struct pupa_disk_dev *next;
struct grub_disk_dev *next;
};
typedef struct pupa_disk_dev *pupa_disk_dev_t;
typedef struct grub_disk_dev *grub_disk_dev_t;
struct pupa_partition;
struct grub_partition;
/* Disk. */
struct pupa_disk
struct grub_disk
{
/* The disk name. */
const char *name;
/* The underlying disk device. */
pupa_disk_dev_t dev;
grub_disk_dev_t dev;
/* The total number of sectors. */
unsigned long total_sectors;
@ -76,7 +76,7 @@ struct pupa_disk
unsigned long id;
/* The partition information. This is machine-specific. */
struct pupa_partition *partition;
struct grub_partition *partition;
/* Called when a sector was read. */
void (*read_hook) (unsigned long sector, unsigned offset, unsigned length);
@ -84,40 +84,40 @@ struct pupa_disk
/* Device-specific data. */
void *data;
};
typedef struct pupa_disk *pupa_disk_t;
typedef struct grub_disk *grub_disk_t;
/* The sector size. */
#define PUPA_DISK_SECTOR_SIZE 0x200
#define PUPA_DISK_SECTOR_BITS 9
#define GRUB_DISK_SECTOR_SIZE 0x200
#define GRUB_DISK_SECTOR_BITS 9
/* The maximum number of disk caches. */
#define PUPA_DISK_CACHE_NUM 1021
#define GRUB_DISK_CACHE_NUM 1021
/* The size of a disk cache in sector units. */
#define PUPA_DISK_CACHE_SIZE 8
#define PUPA_DISK_CACHE_BITS 3
#define GRUB_DISK_CACHE_SIZE 8
#define GRUB_DISK_CACHE_BITS 3
/* This is called from the memory manager. */
void pupa_disk_cache_invalidate_all (void);
void grub_disk_cache_invalidate_all (void);
void EXPORT_FUNC(pupa_disk_dev_register) (pupa_disk_dev_t dev);
void EXPORT_FUNC(pupa_disk_dev_unregister) (pupa_disk_dev_t dev);
void EXPORT_FUNC(pupa_disk_dev_iterate) (int (*hook) (const char *name));
void EXPORT_FUNC(grub_disk_dev_register) (grub_disk_dev_t dev);
void EXPORT_FUNC(grub_disk_dev_unregister) (grub_disk_dev_t dev);
void EXPORT_FUNC(grub_disk_dev_iterate) (int (*hook) (const char *name));
pupa_disk_t EXPORT_FUNC(pupa_disk_open) (const char *name);
void EXPORT_FUNC(pupa_disk_close) (pupa_disk_t disk);
pupa_err_t EXPORT_FUNC(pupa_disk_read) (pupa_disk_t disk,
grub_disk_t EXPORT_FUNC(grub_disk_open) (const char *name);
void EXPORT_FUNC(grub_disk_close) (grub_disk_t disk);
grub_err_t EXPORT_FUNC(grub_disk_read) (grub_disk_t disk,
unsigned long sector,
unsigned long offset,
unsigned long size,
char *buf);
pupa_err_t EXPORT_FUNC(pupa_disk_write) (pupa_disk_t disk,
grub_err_t EXPORT_FUNC(grub_disk_write) (grub_disk_t disk,
unsigned long sector,
unsigned long offset,
unsigned long size,
const char *buf);
pupa_err_t EXPORT_FUNC(pupa_print_partinfo) (pupa_device_t disk,
grub_err_t EXPORT_FUNC(grub_print_partinfo) (grub_device_t disk,
char *partname);
#endif /* ! PUPA_DISK_HEADER */
#endif /* ! GRUB_DISK_HEADER */

View file

@ -1,9 +1,9 @@
/* dl.h - types and prototypes for loadable module support */
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -14,77 +14,77 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_DL_H
#define PUPA_DL_H 1
#ifndef GRUB_DL_H
#define GRUB_DL_H 1
#include <pupa/symbol.h>
#include <pupa/err.h>
#include <pupa/types.h>
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
#define PUPA_MOD_INIT \
static void pupa_mod_init (pupa_dl_t mod) __attribute__ ((unused)); \
#define GRUB_MOD_INIT \
static void grub_mod_init (grub_dl_t mod) __attribute__ ((unused)); \
static void \
pupa_mod_init (pupa_dl_t mod)
grub_mod_init (grub_dl_t mod)
#define PUPA_MOD_FINI \
static void pupa_mod_fini (void) __attribute__ ((unused)); \
#define GRUB_MOD_FINI \
static void grub_mod_fini (void) __attribute__ ((unused)); \
static void \
pupa_mod_fini (void)
grub_mod_fini (void)
#define PUPA_MOD_NAME(name) \
#define GRUB_MOD_NAME(name) \
__asm__ (".section .modname,\"S\"\n.string \"" #name "\"\n.previous")
#define PUPA_MOD_DEP(name) \
#define GRUB_MOD_DEP(name) \
__asm__ (".section .moddeps,\"S\"\n.string \"" #name "\"\n.previous")
struct pupa_dl_segment
struct grub_dl_segment
{
struct pupa_dl_segment *next;
struct grub_dl_segment *next;
void *addr;
pupa_size_t size;
grub_size_t size;
unsigned section;
};
typedef struct pupa_dl_segment *pupa_dl_segment_t;
typedef struct grub_dl_segment *grub_dl_segment_t;
struct pupa_dl;
struct grub_dl;
struct pupa_dl_dep
struct grub_dl_dep
{
struct pupa_dl_dep *next;
struct pupa_dl *mod;
struct grub_dl_dep *next;
struct grub_dl *mod;
};
typedef struct pupa_dl_dep *pupa_dl_dep_t;
typedef struct grub_dl_dep *grub_dl_dep_t;
struct pupa_dl
struct grub_dl
{
char *name;
int ref_count;
pupa_dl_dep_t dep;
pupa_dl_segment_t segment;
void (*init) (struct pupa_dl *mod);
grub_dl_dep_t dep;
grub_dl_segment_t segment;
void (*init) (struct grub_dl *mod);
void (*fini) (void);
};
typedef struct pupa_dl *pupa_dl_t;
typedef struct grub_dl *grub_dl_t;
pupa_dl_t EXPORT_FUNC(pupa_dl_load_file) (const char *filename);
pupa_dl_t EXPORT_FUNC(pupa_dl_load) (const char *name);
pupa_dl_t pupa_dl_load_core (void *addr, pupa_size_t size);
int EXPORT_FUNC(pupa_dl_unload) (pupa_dl_t mod);
void pupa_dl_unload_unneeded (void);
void pupa_dl_unload_all (void);
int EXPORT_FUNC(pupa_dl_ref) (pupa_dl_t mod);
int EXPORT_FUNC(pupa_dl_unref) (pupa_dl_t mod);
void EXPORT_FUNC(pupa_dl_iterate) (int (*hook) (pupa_dl_t mod));
pupa_dl_t EXPORT_FUNC(pupa_dl_get) (const char *name);
pupa_err_t EXPORT_FUNC(pupa_dl_register_symbol) (const char *name, void *addr,
pupa_dl_t mod);
void *EXPORT_FUNC(pupa_dl_resolve_symbol) (const char *name);
grub_dl_t EXPORT_FUNC(grub_dl_load_file) (const char *filename);
grub_dl_t EXPORT_FUNC(grub_dl_load) (const char *name);
grub_dl_t grub_dl_load_core (void *addr, grub_size_t size);
int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod);
void grub_dl_unload_unneeded (void);
void grub_dl_unload_all (void);
int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
void EXPORT_FUNC(grub_dl_iterate) (int (*hook) (grub_dl_t mod));
grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name);
grub_err_t EXPORT_FUNC(grub_dl_register_symbol) (const char *name, void *addr,
grub_dl_t mod);
void *EXPORT_FUNC(grub_dl_resolve_symbol) (const char *name);
int pupa_arch_dl_check_header (void *ehdr, pupa_size_t size);
pupa_err_t pupa_arch_dl_relocate_symbols (pupa_dl_t mod, void *ehdr);
int grub_arch_dl_check_header (void *ehdr, grub_size_t size);
grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
#endif /* ! PUPA_DL_H */
#endif /* ! GRUB_DL_H */

View file

@ -17,40 +17,40 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef PUPA_ELF_H
#define PUPA_ELF_H 1
#ifndef GRUB_ELF_H
#define GRUB_ELF_H 1
/* Standard ELF types. */
#include <pupa/types.h>
#include <grub/types.h>
/* Type for a 16-bit quantity. */
typedef pupa_uint16_t Elf32_Half;
typedef pupa_uint16_t Elf64_Half;
typedef grub_uint16_t Elf32_Half;
typedef grub_uint16_t Elf64_Half;
/* Types for signed and unsigned 32-bit quantities. */
typedef pupa_uint32_t Elf32_Word;
typedef pupa_int32_t Elf32_Sword;
typedef pupa_uint32_t Elf64_Word;
typedef pupa_int32_t Elf64_Sword;
typedef grub_uint32_t Elf32_Word;
typedef grub_int32_t Elf32_Sword;
typedef grub_uint32_t Elf64_Word;
typedef grub_int32_t Elf64_Sword;
/* Types for signed and unsigned 64-bit quantities. */
typedef pupa_uint64_t Elf32_Xword;
typedef pupa_int64_t Elf32_Sxword;
typedef pupa_uint64_t Elf64_Xword;
typedef pupa_int64_t Elf64_Sxword;
typedef grub_uint64_t Elf32_Xword;
typedef grub_int64_t Elf32_Sxword;
typedef grub_uint64_t Elf64_Xword;
typedef grub_int64_t Elf64_Sxword;
/* Type of addresses. */
typedef pupa_uint32_t Elf32_Addr;
typedef pupa_uint64_t Elf64_Addr;
typedef grub_uint32_t Elf32_Addr;
typedef grub_uint64_t Elf64_Addr;
/* Type of file offsets. */
typedef pupa_uint32_t Elf32_Off;
typedef pupa_uint64_t Elf64_Off;
typedef grub_uint32_t Elf32_Off;
typedef grub_uint64_t Elf64_Off;
/* Type for section indices, which are 16-bit quantities. */
typedef pupa_uint16_t Elf32_Section;
typedef pupa_uint16_t Elf64_Section;
typedef grub_uint16_t Elf32_Section;
typedef grub_uint16_t Elf64_Section;
/* Type for version symbol information. */
typedef Elf32_Half Elf32_Versym;
@ -2310,4 +2310,4 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_X86_64_NUM 24
#endif /* ! PUPA_ELF_H */
#endif /* ! GRUB_ELF_H */

View file

@ -1,8 +1,8 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -13,37 +13,37 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_ENV_HEADER
#define PUPA_ENV_HEADER 1
#ifndef GRUB_ENV_HEADER
#define GRUB_ENV_HEADER 1
#include <pupa/symbol.h>
#include <pupa/err.h>
#include <pupa/types.h>
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
struct pupa_env_var
struct grub_env_var
{
char *name;
char *value;
pupa_err_t (*read_hook) (struct pupa_env_var *var, char **val);
pupa_err_t (*write_hook) (struct pupa_env_var *var);
struct pupa_env_var *next;
struct pupa_env_var **prevp;
struct pupa_env_var *sort_next;
struct pupa_env_var **sort_prevp;
grub_err_t (*read_hook) (struct grub_env_var *var, char **val);
grub_err_t (*write_hook) (struct grub_env_var *var);
struct grub_env_var *next;
struct grub_env_var **prevp;
struct grub_env_var *sort_next;
struct grub_env_var **sort_prevp;
};
pupa_err_t EXPORT_FUNC(pupa_env_set) (const char *var, const char *val);
char *EXPORT_FUNC(pupa_env_get) (const char *name);
void EXPORT_FUNC(pupa_env_unset) (const char *name);
void EXPORT_FUNC(pupa_env_iterate) (int (* func) (struct pupa_env_var *var));
pupa_err_t EXPORT_FUNC(pupa_register_variable_hook) (const char *var,
pupa_err_t (*read_hook)
(struct pupa_env_var *var, char **val),
pupa_err_t (*write_hook)
(struct pupa_env_var *var));
grub_err_t EXPORT_FUNC(grub_env_set) (const char *var, const char *val);
char *EXPORT_FUNC(grub_env_get) (const char *name);
void EXPORT_FUNC(grub_env_unset) (const char *name);
void EXPORT_FUNC(grub_env_iterate) (int (* func) (struct grub_env_var *var));
grub_err_t EXPORT_FUNC(grub_register_variable_hook) (const char *var,
grub_err_t (*read_hook)
(struct grub_env_var *var, char **val),
grub_err_t (*write_hook)
(struct grub_env_var *var));
#endif /* ! PUPA_ENV_HEADER */
#endif /* ! GRUB_ENV_HEADER */

View file

@ -1,9 +1,9 @@
/* err.h - error numbers and prototypes */
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -14,49 +14,49 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_ERR_HEADER
#define PUPA_ERR_HEADER 1
#ifndef GRUB_ERR_HEADER
#define GRUB_ERR_HEADER 1
#include <pupa/symbol.h>
#include <grub/symbol.h>
typedef enum
{
PUPA_ERR_NONE = 0,
PUPA_ERR_BAD_MODULE,
PUPA_ERR_OUT_OF_MEMORY,
PUPA_ERR_BAD_FILE_TYPE,
PUPA_ERR_FILE_NOT_FOUND,
PUPA_ERR_FILE_READ_ERROR,
PUPA_ERR_BAD_FILENAME,
PUPA_ERR_UNKNOWN_FS,
PUPA_ERR_BAD_FS,
PUPA_ERR_BAD_NUMBER,
PUPA_ERR_OUT_OF_RANGE,
PUPA_ERR_UNKNOWN_DEVICE,
PUPA_ERR_BAD_DEVICE,
PUPA_ERR_READ_ERROR,
PUPA_ERR_WRITE_ERROR,
PUPA_ERR_UNKNOWN_COMMAND,
PUPA_ERR_BAD_ARGUMENT,
PUPA_ERR_BAD_PART_TABLE,
PUPA_ERR_UNKNOWN_OS,
PUPA_ERR_BAD_OS,
PUPA_ERR_NO_KERNEL,
PUPA_ERR_BAD_FONT,
PUPA_ERR_NOT_IMPLEMENTED_YET,
PUPA_ERR_SYMLINK_LOOP
GRUB_ERR_NONE = 0,
GRUB_ERR_BAD_MODULE,
GRUB_ERR_OUT_OF_MEMORY,
GRUB_ERR_BAD_FILE_TYPE,
GRUB_ERR_FILE_NOT_FOUND,
GRUB_ERR_FILE_READ_ERROR,
GRUB_ERR_BAD_FILENAME,
GRUB_ERR_UNKNOWN_FS,
GRUB_ERR_BAD_FS,
GRUB_ERR_BAD_NUMBER,
GRUB_ERR_OUT_OF_RANGE,
GRUB_ERR_UNKNOWN_DEVICE,
GRUB_ERR_BAD_DEVICE,
GRUB_ERR_READ_ERROR,
GRUB_ERR_WRITE_ERROR,
GRUB_ERR_UNKNOWN_COMMAND,
GRUB_ERR_BAD_ARGUMENT,
GRUB_ERR_BAD_PART_TABLE,
GRUB_ERR_UNKNOWN_OS,
GRUB_ERR_BAD_OS,
GRUB_ERR_NO_KERNEL,
GRUB_ERR_BAD_FONT,
GRUB_ERR_NOT_IMPLEMENTED_YET,
GRUB_ERR_SYMLINK_LOOP
}
pupa_err_t;
grub_err_t;
extern pupa_err_t EXPORT_VAR(pupa_errno);
extern char EXPORT_VAR(pupa_errmsg)[];
extern grub_err_t EXPORT_VAR(grub_errno);
extern char EXPORT_VAR(grub_errmsg)[];
pupa_err_t EXPORT_FUNC(pupa_error) (pupa_err_t n, const char *fmt, ...);
void EXPORT_FUNC(pupa_fatal) (const char *fmt, ...) __attribute__ ((noreturn));
void EXPORT_FUNC(pupa_print_error) (void);
grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt, ...);
void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_print_error) (void);
#endif /* ! PUPA_ERR_HEADER */
#endif /* ! GRUB_ERR_HEADER */

View file

@ -1,8 +1,8 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -13,32 +13,32 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_FILE_HEADER
#define PUPA_FILE_HEADER 1
#ifndef GRUB_FILE_HEADER
#define GRUB_FILE_HEADER 1
#include <pupa/types.h>
#include <pupa/err.h>
#include <pupa/device.h>
#include <pupa/fs.h>
#include <grub/types.h>
#include <grub/err.h>
#include <grub/device.h>
#include <grub/fs.h>
/* File description. */
struct pupa_file
struct grub_file
{
/* The underlying device. */
pupa_device_t device;
grub_device_t device;
/* The underlying filesystem. */
pupa_fs_t fs;
grub_fs_t fs;
/* The current offset. */
pupa_ssize_t offset;
grub_ssize_t offset;
/* The file size. */
pupa_ssize_t size;
grub_ssize_t size;
/* Filesystem-specific data. */
void *data;
@ -46,28 +46,28 @@ struct pupa_file
/* This is called when a sector is read. Used only for a disk device. */
void (*read_hook) (unsigned long sector, unsigned offset, unsigned length);
};
typedef struct pupa_file *pupa_file_t;
typedef struct grub_file *grub_file_t;
/* Get a device name from NAME. */
char *EXPORT_FUNC(pupa_file_get_device_name) (const char *name);
char *EXPORT_FUNC(grub_file_get_device_name) (const char *name);
pupa_file_t EXPORT_FUNC(pupa_file_open) (const char *name);
pupa_ssize_t EXPORT_FUNC(pupa_file_read) (pupa_file_t file, char *buf,
pupa_ssize_t len);
pupa_ssize_t EXPORT_FUNC(pupa_file_seek) (pupa_file_t file,
pupa_ssize_t offset);
pupa_err_t EXPORT_FUNC(pupa_file_close) (pupa_file_t file);
grub_file_t EXPORT_FUNC(grub_file_open) (const char *name);
grub_ssize_t EXPORT_FUNC(grub_file_read) (grub_file_t file, char *buf,
grub_ssize_t len);
grub_ssize_t EXPORT_FUNC(grub_file_seek) (grub_file_t file,
grub_ssize_t offset);
grub_err_t EXPORT_FUNC(grub_file_close) (grub_file_t file);
static inline pupa_ssize_t
pupa_file_size (const pupa_file_t file)
static inline grub_ssize_t
grub_file_size (const grub_file_t file)
{
return file->size;
}
static inline pupa_ssize_t
pupa_file_tell (const pupa_file_t file)
static inline grub_ssize_t
grub_file_tell (const grub_file_t file)
{
return file->offset;
}
#endif /* ! PUPA_FILE_HEADER */
#endif /* ! GRUB_FILE_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -17,14 +17,14 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_FONT_HEADER
#define PUPA_FONT_HEADER 1
#ifndef GRUB_FONT_HEADER
#define GRUB_FONT_HEADER 1
#include <pupa/types.h>
#include <grub/types.h>
#define PUPA_FONT_MAGIC "PPF\x7f"
#define GRUB_FONT_MAGIC "PPF\x7f"
int pupa_font_get_glyph (pupa_uint32_t code,
int grub_font_get_glyph (grub_uint32_t code,
unsigned char bitmap[32], unsigned *width);
#endif /* ! PUPA_FONT_HEADER */
#endif /* ! GRUB_FONT_HEADER */

View file

@ -1,9 +1,9 @@
/* fs.h - filesystem manager */
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -14,62 +14,62 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_FS_HEADER
#define PUPA_FS_HEADER 1
#ifndef GRUB_FS_HEADER
#define GRUB_FS_HEADER 1
#include <pupa/device.h>
#include <pupa/symbol.h>
#include <pupa/types.h>
#include <grub/device.h>
#include <grub/symbol.h>
#include <grub/types.h>
/* Forward declaration is required, because of mutual reference. */
struct pupa_file;
struct grub_file;
/* Filesystem descriptor. */
struct pupa_fs
struct grub_fs
{
/* My name. */
const char *name;
/* Call HOOK with each file under DIR. */
pupa_err_t (*dir) (pupa_device_t device, const char *path,
grub_err_t (*dir) (grub_device_t device, const char *path,
int (*hook) (const char *filename, int dir));
/* Open a file named NAME and initialize FILE. */
pupa_err_t (*open) (struct pupa_file *file, const char *name);
grub_err_t (*open) (struct grub_file *file, const char *name);
/* Read LEN bytes data from FILE into BUF. */
pupa_ssize_t (*read) (struct pupa_file *file, char *buf, pupa_ssize_t len);
grub_ssize_t (*read) (struct grub_file *file, char *buf, grub_ssize_t len);
/* Close the file FILE. */
pupa_err_t (*close) (struct pupa_file *file);
grub_err_t (*close) (struct grub_file *file);
/* Return the label of the device DEVICE in LABEL. The label is
returned in a pupa_malloc'ed buffer and should be freed by the
returned in a grub_malloc'ed buffer and should be freed by the
caller. */
pupa_err_t (*label) (pupa_device_t device, char **label);
grub_err_t (*label) (grub_device_t device, char **label);
/* The next filesystem. */
struct pupa_fs *next;
struct grub_fs *next;
};
typedef struct pupa_fs *pupa_fs_t;
typedef struct grub_fs *grub_fs_t;
/* This is special, because block lists are not files in usual sense. */
extern struct pupa_fs pupa_fs_blocklist;
extern struct grub_fs grub_fs_blocklist;
void EXPORT_FUNC(pupa_fs_register) (pupa_fs_t fs);
void EXPORT_FUNC(pupa_fs_unregister) (pupa_fs_t fs);
void EXPORT_FUNC(pupa_fs_iterate) (int (*hook) (const pupa_fs_t fs));
pupa_fs_t EXPORT_FUNC(pupa_fs_probe) (pupa_device_t device);
void EXPORT_FUNC(grub_fs_register) (grub_fs_t fs);
void EXPORT_FUNC(grub_fs_unregister) (grub_fs_t fs);
void EXPORT_FUNC(grub_fs_iterate) (int (*hook) (const grub_fs_t fs));
grub_fs_t EXPORT_FUNC(grub_fs_probe) (grub_device_t device);
#ifdef PUPA_UTIL
void pupa_fat_init (void);
void pupa_fat_fini (void);
void pupa_ext2_init (void);
void pupa_ext2_fini (void);
#endif /* PUPA_UTIL */
#ifdef GRUB_UTIL
void grub_fat_init (void);
void grub_fat_fini (void);
void grub_ext2_init (void);
void grub_ext2_fini (void);
#endif /* GRUB_UTIL */
#endif /* ! PUPA_FS_HEADER */
#endif /* ! GRUB_FS_HEADER */

View file

@ -1,8 +1,8 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -13,16 +13,16 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_BIOSDISK_MACHINE_HEADER
#define PUPA_BIOSDISK_MACHINE_HEADER 1
#ifndef GRUB_BIOSDISK_MACHINE_HEADER
#define GRUB_BIOSDISK_MACHINE_HEADER 1
#define PUPA_BIOSDISK_FLAG_LBA 1
#define GRUB_BIOSDISK_FLAG_LBA 1
struct pupa_biosdisk_data
struct grub_biosdisk_data
{
int drive;
unsigned long cylinders;
@ -31,17 +31,17 @@ struct pupa_biosdisk_data
unsigned long flags;
};
int pupa_biosdisk_rw_int13_extensions (int ah, int drive, void *dap);
int pupa_biosdisk_rw_standard (int ah, int drive, int coff, int hoff,
int grub_biosdisk_rw_int13_extensions (int ah, int drive, void *dap);
int grub_biosdisk_rw_standard (int ah, int drive, int coff, int hoff,
int soff, int nsec, int segment);
int pupa_biosdisk_check_int13_extensions (int drive);
int pupa_biosdisk_get_diskinfo_int13_extensions (int drive, void *drp);
int pupa_biosdisk_get_diskinfo_standard (int drive,
int grub_biosdisk_check_int13_extensions (int drive);
int grub_biosdisk_get_diskinfo_int13_extensions (int drive, void *drp);
int grub_biosdisk_get_diskinfo_standard (int drive,
unsigned long *cylinders,
unsigned long *heads,
unsigned long *sectors);
int pupa_biosdisk_get_num_floppies (void);
int grub_biosdisk_get_num_floppies (void);
void pupa_biosdisk_init (void);
void grub_biosdisk_init (void);
#endif /* ! PUPA_BIOSDISK_MACHINE_HEADER */
#endif /* ! GRUB_BIOSDISK_MACHINE_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2002 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -17,69 +17,69 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_BOOT_MACHINE_HEADER
#define PUPA_BOOT_MACHINE_HEADER 1
#ifndef GRUB_BOOT_MACHINE_HEADER
#define GRUB_BOOT_MACHINE_HEADER 1
/* The signature for bootloader. */
#define PUPA_BOOT_MACHINE_SIGNATURE 0xaa55
#define GRUB_BOOT_MACHINE_SIGNATURE 0xaa55
/* The offset of the start of BPB (BIOS Parameter Block). */
#define PUPA_BOOT_MACHINE_BPB_START 0x3
#define GRUB_BOOT_MACHINE_BPB_START 0x3
/* The offset of the end of BPB (BIOS Parameter Block). */
#define PUPA_BOOT_MACHINE_BPB_END 0x3e
#define GRUB_BOOT_MACHINE_BPB_END 0x3e
/* The offset of the major version. */
#define PUPA_BOOT_MACHINE_VER_MAJ 0x3e
#define GRUB_BOOT_MACHINE_VER_MAJ 0x3e
/* The offset of BOOT_DRIVE. */
#define PUPA_BOOT_MACHINE_BOOT_DRIVE 0x40
#define GRUB_BOOT_MACHINE_BOOT_DRIVE 0x40
/* The offset of FORCE_LBA. */
#define PUPA_BOOT_MACHINE_FORCE_LBA 0x41
#define GRUB_BOOT_MACHINE_FORCE_LBA 0x41
/* The offset of KERNEL_ADDRESS. */
#define PUPA_BOOT_MACHINE_KERNEL_ADDRESS 0x42
#define GRUB_BOOT_MACHINE_KERNEL_ADDRESS 0x42
/* The offset of KERNEL_SECTOR. */
#define PUPA_BOOT_MACHINE_KERNEL_SECTOR 0x44
#define GRUB_BOOT_MACHINE_KERNEL_SECTOR 0x44
/* The offset of KERNEL_SEGMENT. */
#define PUPA_BOOT_MACHINE_KERNEL_SEGMENT 0x48
#define GRUB_BOOT_MACHINE_KERNEL_SEGMENT 0x48
/* The offset of a magic number used by Windows NT. */
#define PUPA_BOOT_MACHINE_WINDOWS_NT_MAGIC 0x1b8
#define GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC 0x1b8
/* The offset of the start of the partition table. */
#define PUPA_BOOT_MACHINE_PART_START 0x1be
#define GRUB_BOOT_MACHINE_PART_START 0x1be
/* The offset of the end of the partition table. */
#define PUPA_BOOT_MACHINE_PART_END 0x1fe
#define GRUB_BOOT_MACHINE_PART_END 0x1fe
/* The stack segment. */
#define PUPA_BOOT_MACHINE_STACK_SEG 0x2000
#define GRUB_BOOT_MACHINE_STACK_SEG 0x2000
/* The segment of disk buffer. The disk buffer MUST be 32K long and
cannot straddle a 64K boundary. */
#define PUPA_BOOT_MACHINE_BUFFER_SEG 0x7000
#define GRUB_BOOT_MACHINE_BUFFER_SEG 0x7000
/* The address of drive parameters. */
#define PUPA_BOOT_MACHINE_DRP_ADDR 0x7f00
#define GRUB_BOOT_MACHINE_DRP_ADDR 0x7f00
/* The size of drive parameters. */
#define PUPA_BOOT_MACHINE_DRP_SIZE 0x42
#define GRUB_BOOT_MACHINE_DRP_SIZE 0x42
/* The flag for BIOS drive number to designate a hard disk vs. a
floppy. */
#define PUPA_BOOT_MACHINE_BIOS_HD_FLAG 0x80
#define GRUB_BOOT_MACHINE_BIOS_HD_FLAG 0x80
/* The segment where the kernel is loaded. */
#define PUPA_BOOT_MACHINE_KERNEL_SEG 0x800
#define GRUB_BOOT_MACHINE_KERNEL_SEG 0x800
/* The address where the kernel is loaded. */
#define PUPA_BOOT_MACHINE_KERNEL_ADDR (PUPA_BOOT_MACHINE_KERNEL_SEG << 4)
#define GRUB_BOOT_MACHINE_KERNEL_ADDR (GRUB_BOOT_MACHINE_KERNEL_SEG << 4)
/* The size of a block list used in the kernel startup code. */
#define PUPA_BOOT_MACHINE_LIST_SIZE 8
#define GRUB_BOOT_MACHINE_LIST_SIZE 8
#endif /* ! BOOT_MACHINE_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -17,40 +17,40 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_CONSOLE_MACHINE_HEADER
#define PUPA_CONSOLE_MACHINE_HEADER 1
#ifndef GRUB_CONSOLE_MACHINE_HEADER
#define GRUB_CONSOLE_MACHINE_HEADER 1
/* Define scan codes. */
#define PUPA_CONSOLE_KEY_LEFT 0x4B00
#define PUPA_CONSOLE_KEY_RIGHT 0x4D00
#define PUPA_CONSOLE_KEY_UP 0x4800
#define PUPA_CONSOLE_KEY_DOWN 0x5000
#define PUPA_CONSOLE_KEY_IC 0x5200
#define PUPA_CONSOLE_KEY_DC 0x5300
#define PUPA_CONSOLE_KEY_BACKSPACE 0x0008
#define PUPA_CONSOLE_KEY_HOME 0x4700
#define PUPA_CONSOLE_KEY_END 0x4F00
#define PUPA_CONSOLE_KEY_NPAGE 0x4900
#define PUPA_CONSOLE_KEY_PPAGE 0x5100
#define GRUB_CONSOLE_KEY_LEFT 0x4B00
#define GRUB_CONSOLE_KEY_RIGHT 0x4D00
#define GRUB_CONSOLE_KEY_UP 0x4800
#define GRUB_CONSOLE_KEY_DOWN 0x5000
#define GRUB_CONSOLE_KEY_IC 0x5200
#define GRUB_CONSOLE_KEY_DC 0x5300
#define GRUB_CONSOLE_KEY_BACKSPACE 0x0008
#define GRUB_CONSOLE_KEY_HOME 0x4700
#define GRUB_CONSOLE_KEY_END 0x4F00
#define GRUB_CONSOLE_KEY_NPAGE 0x4900
#define GRUB_CONSOLE_KEY_PPAGE 0x5100
#ifndef ASM_FILE
#include <pupa/types.h>
#include <pupa/symbol.h>
#include <grub/types.h>
#include <grub/symbol.h>
/* These are global to share code between C and asm. */
extern pupa_uint8_t pupa_console_cur_color;
void pupa_console_real_putchar (int c);
int EXPORT_FUNC(pupa_console_checkkey) (void);
int EXPORT_FUNC(pupa_console_getkey) (void);
pupa_uint16_t pupa_console_getxy (void);
void pupa_console_gotoxy (pupa_uint8_t x, pupa_uint8_t y);
void pupa_console_cls (void);
void pupa_console_setcursor (int on);
extern grub_uint8_t grub_console_cur_color;
void grub_console_real_putchar (int c);
int EXPORT_FUNC(grub_console_checkkey) (void);
int EXPORT_FUNC(grub_console_getkey) (void);
grub_uint16_t grub_console_getxy (void);
void grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y);
void grub_console_cls (void);
void grub_console_setcursor (int on);
/* Initialize the console system. */
void pupa_console_init (void);
void grub_console_init (void);
#endif
#endif /* ! PUPA_CONSOLE_MACHINE_HEADER */
#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -17,38 +17,38 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_INIT_MACHINE_HEADER
#define PUPA_INIT_MACHINE_HEADER 1
#ifndef GRUB_INIT_MACHINE_HEADER
#define GRUB_INIT_MACHINE_HEADER 1
#include <pupa/types.h>
#include <pupa/symbol.h>
#include <grub/types.h>
#include <grub/symbol.h>
/* FIXME: Should these be declared in memory.h? */
extern pupa_size_t EXPORT_VAR(pupa_lower_mem);
extern pupa_size_t EXPORT_VAR(pupa_upper_mem);
extern grub_size_t EXPORT_VAR(grub_lower_mem);
extern grub_size_t EXPORT_VAR(grub_upper_mem);
/* Get the memory size in KB. If EXTENDED is zero, return conventional
memory, otherwise return extended memory. */
pupa_uint16_t pupa_get_memsize (int extended);
grub_uint16_t grub_get_memsize (int extended);
/* Get a packed EISA memory map. Lower 16 bits are between 1MB and 16MB
in 1KB parts, and upper 16 bits are above 16MB in 64KB parts. */
pupa_uint32_t pupa_get_eisa_mmap (void);
grub_uint32_t grub_get_eisa_mmap (void);
struct pupa_machine_mmap_entry
struct grub_machine_mmap_entry
{
pupa_uint32_t size;
pupa_uint64_t addr;
pupa_uint64_t len;
pupa_uint32_t type;
grub_uint32_t size;
grub_uint64_t addr;
grub_uint64_t len;
grub_uint32_t type;
};
/* Get a memory map entry. Return next continuation value. Zero means
the end. */
pupa_uint32_t pupa_get_mmap_entry (struct pupa_machine_mmap_entry *entry,
pupa_uint32_t cont);
grub_uint32_t grub_get_mmap_entry (struct grub_machine_mmap_entry *entry,
grub_uint32_t cont);
/* Turn on/off Gate A20. */
void pupa_gate_a20 (int on);
void grub_gate_a20 (int on);
#endif /* ! PUPA_INIT_MACHINE_HEADER */
#endif /* ! GRUB_INIT_MACHINE_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -20,43 +20,43 @@
#ifndef KERNEL_MACHINE_HEADER
#define KERNEL_MACHINE_HEADER 1
/* The offset of PUPA_TOTAL_MODULE_SIZE. */
#define PUPA_KERNEL_MACHINE_TOTAL_MODULE_SIZE 0x8
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE 0x8
/* The offset of PUPA_KERNEL_IMAGE_SIZE. */
#define PUPA_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc
/* The offset of PUPA_COMPRESSED_SIZE. */
#define PUPA_KERNEL_MACHINE_COMPRESSED_SIZE 0x10
/* The offset of GRUB_COMPRESSED_SIZE. */
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE 0x10
/* The offset of PUPA_INSTALL_DOS_PART. */
#define PUPA_KERNEL_MACHINE_INSTALL_DOS_PART 0x14
/* The offset of GRUB_INSTALL_DOS_PART. */
#define GRUB_KERNEL_MACHINE_INSTALL_DOS_PART 0x14
/* The offset of PUPA_INSTALL_BSD_PART. */
#define PUPA_KERNEL_MACHINE_INSTALL_BSD_PART 0x18
/* The offset of GRUB_INSTALL_BSD_PART. */
#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART 0x18
/* The offset of PUPA_PREFIX. */
#define PUPA_KERNEL_MACHINE_PREFIX 0x1c
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_MACHINE_PREFIX 0x1c
/* The size of the first region which won't be compressed. */
#define PUPA_KERNEL_MACHINE_RAW_SIZE 0x400
#define GRUB_KERNEL_MACHINE_RAW_SIZE 0x400
#ifndef ASM_FILE
#include <pupa/types.h>
#include <grub/types.h>
/* The DOS partition number of the installed partition. */
extern pupa_int32_t pupa_install_dos_part;
extern grub_int32_t grub_install_dos_part;
/* The BSD partition number of the installed partition. */
extern pupa_int32_t pupa_install_bsd_part;
extern grub_int32_t grub_install_bsd_part;
/* The prefix which points to the directory where PUPA modules and its
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char pupa_prefix[];
extern char grub_prefix[];
/* The boot BIOS drive number. */
extern pupa_int32_t pupa_boot_drive;
extern grub_int32_t grub_boot_drive;
#endif /* ! ASM_FILE */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -17,70 +17,70 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_LINUX_MACHINE_HEADER
#define PUPA_LINUX_MACHINE_HEADER 1
#ifndef GRUB_LINUX_MACHINE_HEADER
#define GRUB_LINUX_MACHINE_HEADER 1
#define PUPA_LINUX_MAGIC_SIGNATURE 0x53726448 /* "HdrS" */
#define PUPA_LINUX_DEFAULT_SETUP_SECTS 4
#define PUPA_LINUX_FLAG_CAN_USE_HEAP 0x80
#define PUPA_LINUX_INITRD_MAX_ADDRESS 0x37FFFFFF
#define PUPA_LINUX_MAX_SETUP_SECTS 64
#define PUPA_LINUX_BOOT_LOADER_TYPE 0x72
#define PUPA_LINUX_HEAP_END_OFFSET (0x9000 - 0x200)
#define GRUB_LINUX_MAGIC_SIGNATURE 0x53726448 /* "HdrS" */
#define GRUB_LINUX_DEFAULT_SETUP_SECTS 4
#define GRUB_LINUX_FLAG_CAN_USE_HEAP 0x80
#define GRUB_LINUX_INITRD_MAX_ADDRESS 0x37FFFFFF
#define GRUB_LINUX_MAX_SETUP_SECTS 64
#define GRUB_LINUX_BOOT_LOADER_TYPE 0x72
#define GRUB_LINUX_HEAP_END_OFFSET (0x9000 - 0x200)
#define PUPA_LINUX_BZIMAGE_ADDR 0x100000
#define PUPA_LINUX_ZIMAGE_ADDR 0x10000
#define PUPA_LINUX_OLD_REAL_MODE_ADDR 0x90000
#define PUPA_LINUX_SETUP_STACK 0x9000
#define GRUB_LINUX_BZIMAGE_ADDR 0x100000
#define GRUB_LINUX_ZIMAGE_ADDR 0x10000
#define GRUB_LINUX_OLD_REAL_MODE_ADDR 0x90000
#define GRUB_LINUX_SETUP_STACK 0x9000
#define PUPA_LINUX_FLAG_BIG_KERNEL 0x1
#define GRUB_LINUX_FLAG_BIG_KERNEL 0x1
/* Linux's video mode selection support. Actually I hate it! */
#define PUPA_LINUX_VID_MODE_NORMAL 0xFFFF
#define PUPA_LINUX_VID_MODE_EXTENDED 0xFFFE
#define PUPA_LINUX_VID_MODE_ASK 0xFFFD
#define GRUB_LINUX_VID_MODE_NORMAL 0xFFFF
#define GRUB_LINUX_VID_MODE_EXTENDED 0xFFFE
#define GRUB_LINUX_VID_MODE_ASK 0xFFFD
#define PUPA_LINUX_CL_OFFSET 0x9000
#define PUPA_LINUX_CL_END_OFFSET 0x90FF
#define PUPA_LINUX_SETUP_MOVE_SIZE 0x9100
#define PUPA_LINUX_CL_MAGIC 0xA33F
#define GRUB_LINUX_CL_OFFSET 0x9000
#define GRUB_LINUX_CL_END_OFFSET 0x90FF
#define GRUB_LINUX_SETUP_MOVE_SIZE 0x9100
#define GRUB_LINUX_CL_MAGIC 0xA33F
#ifndef ASM_FILE
/* For the Linux/i386 boot protocol version 2.03. */
struct linux_kernel_header
{
pupa_uint8_t code1[0x0020];
pupa_uint16_t cl_magic; /* Magic number 0xA33F */
pupa_uint16_t cl_offset; /* The offset of command line */
pupa_uint8_t code2[0x01F1 - 0x0020 - 2 - 2];
pupa_uint8_t setup_sects; /* The size of the setup in sectors */
pupa_uint16_t root_flags; /* If the root is mounted readonly */
pupa_uint16_t syssize; /* obsolete */
pupa_uint16_t swap_dev; /* obsolete */
pupa_uint16_t ram_size; /* obsolete */
pupa_uint16_t vid_mode; /* Video mode control */
pupa_uint16_t root_dev; /* Default root device number */
pupa_uint16_t boot_flag; /* 0xAA55 magic number */
pupa_uint16_t jump; /* Jump instruction */
pupa_uint32_t header; /* Magic signature "HdrS" */
pupa_uint16_t version; /* Boot protocol version supported */
pupa_uint32_t realmode_swtch; /* Boot loader hook */
pupa_uint16_t start_sys; /* The load-low segment (obsolete) */
pupa_uint16_t kernel_version; /* Points to kernel version string */
pupa_uint8_t type_of_loader; /* Boot loader identifier */
pupa_uint8_t loadflags; /* Boot protocol option flags */
pupa_uint16_t setup_move_size; /* Move to high memory size */
pupa_uint32_t code32_start; /* Boot loader hook */
pupa_uint32_t ramdisk_image; /* initrd load address */
pupa_uint32_t ramdisk_size; /* initrd size */
pupa_uint32_t bootsect_kludge; /* obsolete */
pupa_uint16_t heap_end_ptr; /* Free memory after setup end */
pupa_uint16_t pad1; /* Unused */
grub_uint8_t code1[0x0020];
grub_uint16_t cl_magic; /* Magic number 0xA33F */
grub_uint16_t cl_offset; /* The offset of command line */
grub_uint8_t code2[0x01F1 - 0x0020 - 2 - 2];
grub_uint8_t setup_sects; /* The size of the setup in sectors */
grub_uint16_t root_flags; /* If the root is mounted readonly */
grub_uint16_t syssize; /* obsolete */
grub_uint16_t swap_dev; /* obsolete */
grub_uint16_t ram_size; /* obsolete */
grub_uint16_t vid_mode; /* Video mode control */
grub_uint16_t root_dev; /* Default root device number */
grub_uint16_t boot_flag; /* 0xAA55 magic number */
grub_uint16_t jump; /* Jump instruction */
grub_uint32_t header; /* Magic signature "HdrS" */
grub_uint16_t version; /* Boot protocol version supported */
grub_uint32_t realmode_swtch; /* Boot loader hook */
grub_uint16_t start_sys; /* The load-low segment (obsolete) */
grub_uint16_t kernel_version; /* Points to kernel version string */
grub_uint8_t type_of_loader; /* Boot loader identifier */
grub_uint8_t loadflags; /* Boot protocol option flags */
grub_uint16_t setup_move_size; /* Move to high memory size */
grub_uint32_t code32_start; /* Boot loader hook */
grub_uint32_t ramdisk_image; /* initrd load address */
grub_uint32_t ramdisk_size; /* initrd size */
grub_uint32_t bootsect_kludge; /* obsolete */
grub_uint16_t heap_end_ptr; /* Free memory after setup end */
grub_uint16_t pad1; /* Unused */
char *cmd_line_ptr; /* Points to the kernel command line */
pupa_uint32_t initrd_addr_max; /* Highest address for initrd */
grub_uint32_t initrd_addr_max; /* Highest address for initrd */
} __attribute__ ((packed));
#endif /* ! ASM_FILE */
#endif /* ! PUPA_LINUX_MACHINE_HEADER */
#endif /* ! GRUB_LINUX_MACHINE_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -17,34 +17,34 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_LOADER_MACHINE_HEADER
#define PUPA_LOADER_MACHINE_HEADER 1
#ifndef GRUB_LOADER_MACHINE_HEADER
#define GRUB_LOADER_MACHINE_HEADER 1
#include <pupa/types.h>
#include <pupa/symbol.h>
#include <pupa/machine/multiboot.h>
#include <grub/types.h>
#include <grub/symbol.h>
#include <grub/machine/multiboot.h>
extern pupa_uint32_t EXPORT_VAR(pupa_linux_prot_size);
extern char *EXPORT_VAR(pupa_linux_tmp_addr);
extern char *EXPORT_VAR(pupa_linux_real_addr);
extern grub_uint32_t EXPORT_VAR(grub_linux_prot_size);
extern char *EXPORT_VAR(grub_linux_tmp_addr);
extern char *EXPORT_VAR(grub_linux_real_addr);
void EXPORT_FUNC(pupa_linux_boot_zimage) (void) __attribute__ ((noreturn));
void EXPORT_FUNC(pupa_linux_boot_bzimage) (void) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_linux_boot_zimage) (void) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_linux_boot_bzimage) (void) __attribute__ ((noreturn));
/* This is an asm part of the chainloader. */
void EXPORT_FUNC(pupa_chainloader_real_boot) (int drive, void *part_addr) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_chainloader_real_boot) (int drive, void *part_addr) __attribute__ ((noreturn));
/* The asm part of the multiboot loader. */
void EXPORT_FUNC(pupa_multiboot_real_boot) (pupa_addr_t entry,
struct pupa_multiboot_info *mbi)
void EXPORT_FUNC(grub_multiboot_real_boot) (grub_addr_t entry,
struct grub_multiboot_info *mbi)
__attribute__ ((noreturn));
/* It is necessary to export these functions, because normal mode commands
reuse rescue mode commands. */
void pupa_rescue_cmd_chainloader (int argc, char *argv[]);
void pupa_rescue_cmd_linux (int argc, char *argv[]);
void pupa_rescue_cmd_initrd (int argc, char *argv[]);
void pupa_rescue_cmd_multiboot (int argc, char *argv[]);
void pupa_rescue_cmd_module (int argc, char *argv[]);
void grub_rescue_cmd_chainloader (int argc, char *argv[]);
void grub_rescue_cmd_linux (int argc, char *argv[]);
void grub_rescue_cmd_initrd (int argc, char *argv[]);
void grub_rescue_cmd_multiboot (int argc, char *argv[]);
void grub_rescue_cmd_module (int argc, char *argv[]);
#endif /* ! PUPA_LOADER_MACHINE_HEADER */
#endif /* ! GRUB_LOADER_MACHINE_HEADER */

View file

@ -1,6 +1,6 @@
/* memory.h - describe the memory map */
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -18,50 +18,50 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_MEMORY_MACHINE_HEADER
#define PUPA_MEMORY_MACHINE_HEADER 1
#ifndef GRUB_MEMORY_MACHINE_HEADER
#define GRUB_MEMORY_MACHINE_HEADER 1
/* The scratch buffer used in real mode code. */
#define PUPA_MEMORY_MACHINE_SCRATCH_ADDR 0x68000
#define PUPA_MEMORY_MACHINE_SCRATCH_SEG (PUPA_MEMORY_MACHINE_SCRATCH_ADDR >> 4)
#define PUPA_MEMORY_MACHINE_SCRATCH_SIZE 0x10000
#define GRUB_MEMORY_MACHINE_SCRATCH_ADDR 0x68000
#define GRUB_MEMORY_MACHINE_SCRATCH_SEG (GRUB_MEMORY_MACHINE_SCRATCH_ADDR >> 4)
#define GRUB_MEMORY_MACHINE_SCRATCH_SIZE 0x10000
/* The real mode stack. */
#define PUPA_MEMORY_MACHINE_REAL_STACK (0x2000 - 0x10)
#define GRUB_MEMORY_MACHINE_REAL_STACK (0x2000 - 0x10)
/* The size of the protect mode stack. */
#define PUPA_MEMORY_MACHINE_PROT_STACK_SIZE 0x8000
#define GRUB_MEMORY_MACHINE_PROT_STACK_SIZE 0x8000
/* The protected mode stack. */
#define PUPA_MEMORY_MACHINE_PROT_STACK \
(PUPA_MEMORY_MACHINE_SCRATCH_ADDR + PUPA_MEMORY_MACHINE_SCRATCH_SIZE \
+ PUPA_MEMORY_MACHINE_PROT_STACK_SIZE - 0x10)
#define GRUB_MEMORY_MACHINE_PROT_STACK \
(GRUB_MEMORY_MACHINE_SCRATCH_ADDR + GRUB_MEMORY_MACHINE_SCRATCH_SIZE \
+ GRUB_MEMORY_MACHINE_PROT_STACK_SIZE - 0x10)
/* The memory area where PUPA uses its own purpose. */
#define PUPA_MEMORY_MACHINE_RESERVED_START \
PUPA_MEMORY_MACHINE_SCRATCH_ADDR
#define PUPA_MEMORY_MACHINE_RESERVED_END \
(PUPA_MEMORY_MACHINE_PROT_STACK + 0x10)
/* The memory area where GRUB uses its own purpose. */
#define GRUB_MEMORY_MACHINE_RESERVED_START \
GRUB_MEMORY_MACHINE_SCRATCH_ADDR
#define GRUB_MEMORY_MACHINE_RESERVED_END \
(GRUB_MEMORY_MACHINE_PROT_STACK + 0x10)
/* The address of a partition table passed to another boot loader. */
#define PUPA_MEMORY_MACHINE_PART_TABLE_ADDR 0x7be
#define GRUB_MEMORY_MACHINE_PART_TABLE_ADDR 0x7be
/* The address where another boot loader is loaded. */
#define PUPA_MEMORY_MACHINE_BOOT_LOADER_ADDR 0x7c00
#define GRUB_MEMORY_MACHINE_BOOT_LOADER_ADDR 0x7c00
/* The flag for protected mode. */
#define PUPA_MEMORY_MACHINE_CR0_PE_ON 0x1
#define GRUB_MEMORY_MACHINE_CR0_PE_ON 0x1
/* The code segment of the protected mode. */
#define PUPA_MEMORY_MACHINE_PROT_MODE_CSEG 0x8
#define GRUB_MEMORY_MACHINE_PROT_MODE_CSEG 0x8
/* The data segment of the protected mode. */
#define PUPA_MEMORY_MACHINE_PROT_MODE_DSEG 0x10
#define GRUB_MEMORY_MACHINE_PROT_MODE_DSEG 0x10
/* The code segment of the pseudo real mode. */
#define PUPA_MEMORY_MACHINE_PSEUDO_REAL_CSEG 0x18
#define GRUB_MEMORY_MACHINE_PSEUDO_REAL_CSEG 0x18
/* The data segment of the pseudo real mode. */
#define PUPA_MEMORY_MACHINE_PSEUDO_REAL_DSEG 0x20
#define GRUB_MEMORY_MACHINE_PSEUDO_REAL_DSEG 0x20
#endif /* ! PUPA_MEMORY_MACHINE_HEADER */
#endif /* ! GRUB_MEMORY_MACHINE_HEADER */

View file

@ -1,6 +1,6 @@
/* multiboot.h - multiboot header file. */
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -18,167 +18,167 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_MULTIBOOT_MACHINE_HEADER
#define PUPA_MULTIBOOT_MACHINE_HEADER 1
#ifndef GRUB_MULTIBOOT_MACHINE_HEADER
#define GRUB_MULTIBOOT_MACHINE_HEADER 1
/* How many bytes from the start of the file we search for the header. */
#define PUPA_MB_SEARCH 8192
#define GRUB_MB_SEARCH 8192
/* The magic field should contain this. */
#define PUPA_MB_MAGIC 0x1BADB002
#define GRUB_MB_MAGIC 0x1BADB002
/* This should be in %eax. */
#define PUPA_MB_MAGIC2 0x2BADB002
#define GRUB_MB_MAGIC2 0x2BADB002
/* The bits in the required part of flags field we don't support. */
#define PUPA_MB_UNSUPPORTED 0x0000fffc
#define GRUB_MB_UNSUPPORTED 0x0000fffc
/* Alignment of multiboot modules. */
#define PUPA_MB_MOD_ALIGN 0x00001000
#define GRUB_MB_MOD_ALIGN 0x00001000
/*
* Flags set in the 'flags' member of the multiboot header.
*/
/* Align all boot modules on i386 page (4KB) boundaries. */
#define PUPA_MB_PAGE_ALIGN 0x00000001
#define GRUB_MB_PAGE_ALIGN 0x00000001
/* Must pass memory information to OS. */
#define PUPA_MB_MEMORY_INFO 0x00000002
#define GRUB_MB_MEMORY_INFO 0x00000002
/* Must pass video information to OS. */
#define PUPA_MB_VIDEO_MODE 0x00000004
#define GRUB_MB_VIDEO_MODE 0x00000004
/* This flag indicates the use of the address fields in the header. */
#define PUPA_MB_AOUT_KLUDGE 0x00010000
#define GRUB_MB_AOUT_KLUDGE 0x00010000
/*
* Flags to be set in the 'flags' member of the multiboot info structure.
*/
/* is there basic lower/upper memory information? */
#define PUPA_MB_INFO_MEMORY 0x00000001
#define GRUB_MB_INFO_MEMORY 0x00000001
/* is there a boot device set? */
#define PUPA_MB_INFO_BOOTDEV 0x00000002
#define GRUB_MB_INFO_BOOTDEV 0x00000002
/* is the command-line defined? */
#define PUPA_MB_INFO_CMDLINE 0x00000004
#define GRUB_MB_INFO_CMDLINE 0x00000004
/* are there modules to do something with? */
#define PUPA_MB_INFO_MODS 0x00000008
#define GRUB_MB_INFO_MODS 0x00000008
/* These next two are mutually exclusive */
/* is there a symbol table loaded? */
#define PUPA_MB_INFO_AOUT_SYMS 0x00000010
#define GRUB_MB_INFO_AOUT_SYMS 0x00000010
/* is there an ELF section header table? */
#define PUPA_MB_INFO_ELF_SHDR 0x00000020
#define GRUB_MB_INFO_ELF_SHDR 0x00000020
/* is there a full memory map? */
#define PUPA_MB_INFO_MEM_MAP 0x00000040
#define GRUB_MB_INFO_MEM_MAP 0x00000040
/* Is there drive info? */
#define PUPA_MB_INFO_DRIVE_INFO 0x00000080
#define GRUB_MB_INFO_DRIVE_INFO 0x00000080
/* Is there a config table? */
#define PUPA_MB_INFO_CONFIG_TABLE 0x00000100
#define GRUB_MB_INFO_CONFIG_TABLE 0x00000100
/* Is there a boot loader name? */
#define PUPA_MB_INFO_BOOT_LOADER_NAME 0x00000200
#define GRUB_MB_INFO_BOOT_LOADER_NAME 0x00000200
/* Is there a APM table? */
#define PUPA_MB_INFO_APM_TABLE 0x00000400
#define GRUB_MB_INFO_APM_TABLE 0x00000400
/* Is there video information? */
#define PUPA_MB_INFO_VIDEO_INFO 0x00000800
#define GRUB_MB_INFO_VIDEO_INFO 0x00000800
#ifndef ASM_FILE
#include <pupa/types.h>
#include <grub/types.h>
struct pupa_multiboot_header
struct grub_multiboot_header
{
/* Must be PUPA_MB_MAGIC - see above. */
pupa_uint32_t magic;
/* Must be GRUB_MB_MAGIC - see above. */
grub_uint32_t magic;
/* Feature flags. */
pupa_uint32_t flags;
grub_uint32_t flags;
/* The above fields plus this one must equal 0 mod 2^32. */
pupa_uint32_t checksum;
grub_uint32_t checksum;
/* These are only valid if PUPA_MB_AOUT_KLUDGE is set. */
pupa_uint32_t header_addr;
pupa_uint32_t load_addr;
pupa_uint32_t load_end_addr;
pupa_uint32_t bss_end_addr;
pupa_uint32_t entry_addr;
/* These are only valid if GRUB_MB_AOUT_KLUDGE is set. */
grub_uint32_t header_addr;
grub_uint32_t load_addr;
grub_uint32_t load_end_addr;
grub_uint32_t bss_end_addr;
grub_uint32_t entry_addr;
/* These are only valid if PUPA_MB_VIDEO_MODE is set. */
pupa_uint32_t mode_type;
pupa_uint32_t width;
pupa_uint32_t height;
pupa_uint32_t depth;
/* These are only valid if GRUB_MB_VIDEO_MODE is set. */
grub_uint32_t mode_type;
grub_uint32_t width;
grub_uint32_t height;
grub_uint32_t depth;
};
struct pupa_multiboot_info
struct grub_multiboot_info
{
/* MultiBoot info version number */
pupa_uint32_t flags;
grub_uint32_t flags;
/* Available memory from BIOS */
pupa_uint32_t mem_lower;
pupa_uint32_t mem_upper;
grub_uint32_t mem_lower;
grub_uint32_t mem_upper;
/* "root" partition */
pupa_uint32_t boot_device;
grub_uint32_t boot_device;
/* Kernel command line */
pupa_uint32_t cmdline;
grub_uint32_t cmdline;
/* Boot-Module list */
pupa_uint32_t mods_count;
pupa_uint32_t mods_addr;
grub_uint32_t mods_count;
grub_uint32_t mods_addr;
pupa_uint32_t syms[4];
grub_uint32_t syms[4];
/* Memory Mapping buffer */
pupa_uint32_t mmap_length;
pupa_uint32_t mmap_addr;
grub_uint32_t mmap_length;
grub_uint32_t mmap_addr;
/* Drive Info buffer */
pupa_uint32_t drives_length;
pupa_uint32_t drives_addr;
grub_uint32_t drives_length;
grub_uint32_t drives_addr;
/* ROM configuration table */
pupa_uint32_t config_table;
grub_uint32_t config_table;
/* Boot Loader Name */
pupa_uint32_t boot_loader_name;
grub_uint32_t boot_loader_name;
/* APM table */
pupa_uint32_t apm_table;
grub_uint32_t apm_table;
/* Video */
pupa_uint32_t vbe_control_info;
pupa_uint32_t vbe_mode_info;
pupa_uint16_t vbe_mode;
pupa_uint16_t vbe_interface_seg;
pupa_uint16_t vbe_interface_off;
pupa_uint16_t vbe_interface_len;
grub_uint32_t vbe_control_info;
grub_uint32_t vbe_mode_info;
grub_uint16_t vbe_mode;
grub_uint16_t vbe_interface_seg;
grub_uint16_t vbe_interface_off;
grub_uint16_t vbe_interface_len;
};
struct pupa_mod_list
struct grub_mod_list
{
/* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
pupa_uint32_t mod_start;
pupa_uint32_t mod_end;
grub_uint32_t mod_start;
grub_uint32_t mod_end;
/* Module command line */
pupa_uint32_t cmdline;
grub_uint32_t cmdline;
/* padding to take it to 16 bytes (must be zero) */
pupa_uint32_t pad;
grub_uint32_t pad;
};
#endif /* ! ASM_FILE */
#endif /* ! PUPA_MULTIBOOT_MACHINE_HEADER */
#endif /* ! GRUB_MULTIBOOT_MACHINE_HEADER */

View file

@ -1,8 +1,8 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -13,160 +13,160 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_PARTITION_HEADER
#define PUPA_PARTITION_HEADER 1
#ifndef GRUB_PARTITION_HEADER
#define GRUB_PARTITION_HEADER 1
#include <pupa/symbol.h>
#include <pupa/types.h>
#include <pupa/err.h>
#include <grub/symbol.h>
#include <grub/types.h>
#include <grub/err.h>
/* The signature. */
#define PUPA_PARTITION_SIGNATURE 0xaa55
#define GRUB_PARTITION_SIGNATURE 0xaa55
/* This is not a flag actually, but used as if it were a flag. */
#define PUPA_PARTITION_TYPE_HIDDEN_FLAG 0x10
#define GRUB_PARTITION_TYPE_HIDDEN_FLAG 0x10
/* DOS partition types. */
#define PUPA_PARTITION_TYPE_NONE 0
#define PUPA_PARTITION_TYPE_FAT12 1
#define PUPA_PARTITION_TYPE_FAT16_LT32M 4
#define PUPA_PARTITION_TYPE_EXTENDED 5
#define PUPA_PARTITION_TYPE_FAT16_GT32M 6
#define PUPA_PARTITION_TYPE_FAT32 0xb
#define PUPA_PARTITION_TYPE_FAT32_LBA 0xc
#define PUPA_PARTITION_TYPE_FAT16_LBA 0xe
#define PUPA_PARTITION_TYPE_WIN95_EXTENDED 0xf
#define PUPA_PARTITION_TYPE_EZD 0x55
#define PUPA_PARTITION_TYPE_MINIX 0x80
#define PUPA_PARTITION_TYPE_LINUX_MINIX 0x81
#define PUPA_PARTITION_TYPE_EXT2FS 0x83
#define PUPA_PARTITION_TYPE_LINUX_EXTENDED 0x85
#define PUPA_PARTITION_TYPE_VSTAFS 0x9e
#define PUPA_PARTITION_TYPE_FREEBSD 0xa5
#define PUPA_PARTITION_TYPE_OPENBSD 0xa6
#define PUPA_PARTITION_TYPE_NETBSD 0xa9
#define PUPA_PARTITION_TYPE_LINUX_RAID 0xfd
#define GRUB_PARTITION_TYPE_NONE 0
#define GRUB_PARTITION_TYPE_FAT12 1
#define GRUB_PARTITION_TYPE_FAT16_LT32M 4
#define GRUB_PARTITION_TYPE_EXTENDED 5
#define GRUB_PARTITION_TYPE_FAT16_GT32M 6
#define GRUB_PARTITION_TYPE_FAT32 0xb
#define GRUB_PARTITION_TYPE_FAT32_LBA 0xc
#define GRUB_PARTITION_TYPE_FAT16_LBA 0xe
#define GRUB_PARTITION_TYPE_WIN95_EXTENDED 0xf
#define GRUB_PARTITION_TYPE_EZD 0x55
#define GRUB_PARTITION_TYPE_MINIX 0x80
#define GRUB_PARTITION_TYPE_LINUX_MINIX 0x81
#define GRUB_PARTITION_TYPE_EXT2FS 0x83
#define GRUB_PARTITION_TYPE_LINUX_EXTENDED 0x85
#define GRUB_PARTITION_TYPE_VSTAFS 0x9e
#define GRUB_PARTITION_TYPE_FREEBSD 0xa5
#define GRUB_PARTITION_TYPE_OPENBSD 0xa6
#define GRUB_PARTITION_TYPE_NETBSD 0xa9
#define GRUB_PARTITION_TYPE_LINUX_RAID 0xfd
/* Constants for BSD disk label. */
#define PUPA_PARTITION_BSD_LABEL_SECTOR 1
#define PUPA_PARTITION_BSD_LABEL_MAGIC 0x82564557
#define PUPA_PARTITION_BSD_MAX_ENTRIES 8
#define GRUB_PARTITION_BSD_LABEL_SECTOR 1
#define GRUB_PARTITION_BSD_LABEL_MAGIC 0x82564557
#define GRUB_PARTITION_BSD_MAX_ENTRIES 8
/* BSD partition types. */
#define PUPA_PARTITION_BSD_TYPE_UNUSED 0
#define PUPA_PARTITION_BSD_TYPE_SWAP 1
#define PUPA_PARTITION_BSD_TYPE_V6 2
#define PUPA_PARTITION_BSD_TYPE_V7 3
#define PUPA_PARTITION_BSD_TYPE_SYSV 4
#define PUPA_PARTITION_BSD_TYPE_V71K 5
#define PUPA_PARTITION_BSD_TYPE_V8 6
#define PUPA_PARTITION_BSD_TYPE_BSDFFS 7
#define PUPA_PARTITION_BSD_TYPE_MSDOS 8
#define PUPA_PARTITION_BSD_TYPE_BSDLFS 9
#define PUPA_PARTITION_BSD_TYPE_OTHER 10
#define PUPA_PARTITION_BSD_TYPE_HPFS 11
#define PUPA_PARTITION_BSD_TYPE_ISO9660 12
#define PUPA_PARTITION_BSD_TYPE_BOOT 13
#define GRUB_PARTITION_BSD_TYPE_UNUSED 0
#define GRUB_PARTITION_BSD_TYPE_SWAP 1
#define GRUB_PARTITION_BSD_TYPE_V6 2
#define GRUB_PARTITION_BSD_TYPE_V7 3
#define GRUB_PARTITION_BSD_TYPE_SYSV 4
#define GRUB_PARTITION_BSD_TYPE_V71K 5
#define GRUB_PARTITION_BSD_TYPE_V8 6
#define GRUB_PARTITION_BSD_TYPE_BSDFFS 7
#define GRUB_PARTITION_BSD_TYPE_MSDOS 8
#define GRUB_PARTITION_BSD_TYPE_BSDLFS 9
#define GRUB_PARTITION_BSD_TYPE_OTHER 10
#define GRUB_PARTITION_BSD_TYPE_HPFS 11
#define GRUB_PARTITION_BSD_TYPE_ISO9660 12
#define GRUB_PARTITION_BSD_TYPE_BOOT 13
/* FreeBSD-specific types. */
#define PUPA_PARTITION_FREEBSD_TYPE_VINUM 14
#define PUPA_PARTITION_FREEBSD_TYPE_RAID 15
#define PUPA_PARTITION_FREEBSD_TYPE_JFS2 21
#define GRUB_PARTITION_FREEBSD_TYPE_VINUM 14
#define GRUB_PARTITION_FREEBSD_TYPE_RAID 15
#define GRUB_PARTITION_FREEBSD_TYPE_JFS2 21
/* NetBSD-specific types. */
#define PUPA_PARTITION_NETBSD_TYPE_ADOS 14
#define PUPA_PARTITION_NETBSD_TYPE_HFS 15
#define PUPA_PARTITION_NETBSD_TYPE_FILECORE 16
#define PUPA_PARTITION_NETBSD_TYPE_EXT2FS 17
#define PUPA_PARTITION_NETBSD_TYPE_NTFS 18
#define PUPA_PARTITION_NETBSD_TYPE_RAID 19
#define PUPA_PARTITION_NETBSD_TYPE_CCD 20
#define PUPA_PARTITION_NETBSD_TYPE_JFS2 21
#define PUPA_PARTITION_NETBSD_TYPE_APPLEUFS 22
#define GRUB_PARTITION_NETBSD_TYPE_ADOS 14
#define GRUB_PARTITION_NETBSD_TYPE_HFS 15
#define GRUB_PARTITION_NETBSD_TYPE_FILECORE 16
#define GRUB_PARTITION_NETBSD_TYPE_EXT2FS 17
#define GRUB_PARTITION_NETBSD_TYPE_NTFS 18
#define GRUB_PARTITION_NETBSD_TYPE_RAID 19
#define GRUB_PARTITION_NETBSD_TYPE_CCD 20
#define GRUB_PARTITION_NETBSD_TYPE_JFS2 21
#define GRUB_PARTITION_NETBSD_TYPE_APPLEUFS 22
/* OpenBSD-specific types. */
#define PUPA_PARTITION_OPENBSD_TYPE_ADOS 14
#define PUPA_PARTITION_OPENBSD_TYPE_HFS 15
#define PUPA_PARTITION_OPENBSD_TYPE_FILECORE 16
#define PUPA_PARTITION_OPENBSD_TYPE_EXT2FS 17
#define PUPA_PARTITION_OPENBSD_TYPE_NTFS 18
#define PUPA_PARTITION_OPENBSD_TYPE_RAID 19
#define GRUB_PARTITION_OPENBSD_TYPE_ADOS 14
#define GRUB_PARTITION_OPENBSD_TYPE_HFS 15
#define GRUB_PARTITION_OPENBSD_TYPE_FILECORE 16
#define GRUB_PARTITION_OPENBSD_TYPE_EXT2FS 17
#define GRUB_PARTITION_OPENBSD_TYPE_NTFS 18
#define GRUB_PARTITION_OPENBSD_TYPE_RAID 19
/* The BSD partition entry. */
struct pupa_partition_bsd_entry
struct grub_partition_bsd_entry
{
pupa_uint32_t size;
pupa_uint32_t offset;
pupa_uint32_t fragment_size;
pupa_uint8_t fs_type;
pupa_uint8_t fs_fragments;
pupa_uint16_t fs_cylinders;
grub_uint32_t size;
grub_uint32_t offset;
grub_uint32_t fragment_size;
grub_uint8_t fs_type;
grub_uint8_t fs_fragments;
grub_uint16_t fs_cylinders;
} __attribute__ ((packed));
/* The BSD disk label. Only define members useful for PUPA. */
struct pupa_partition_disk_label
/* The BSD disk label. Only define members useful for GRUB. */
struct grub_partition_disk_label
{
pupa_uint32_t magic;
pupa_uint8_t padding[128];
pupa_uint32_t magic2;
pupa_uint16_t checksum;
pupa_uint16_t num_partitions;
pupa_uint32_t boot_size;
pupa_uint32_t superblock_size;
struct pupa_partition_bsd_entry entries[PUPA_PARTITION_BSD_MAX_ENTRIES];
grub_uint32_t magic;
grub_uint8_t padding[128];
grub_uint32_t magic2;
grub_uint16_t checksum;
grub_uint16_t num_partitions;
grub_uint32_t boot_size;
grub_uint32_t superblock_size;
struct grub_partition_bsd_entry entries[GRUB_PARTITION_BSD_MAX_ENTRIES];
} __attribute__ ((packed));
/* The partition entry. */
struct pupa_partition_entry
struct grub_partition_entry
{
/* If active, 0x80, otherwise, 0x00. */
pupa_uint8_t flag;
grub_uint8_t flag;
/* The head of the start. */
pupa_uint8_t start_head;
grub_uint8_t start_head;
/* (S | ((C >> 2) & 0xC0)) where S is the sector of the start and C
is the cylinder of the start. Note that S is counted from one. */
pupa_uint8_t start_sector;
grub_uint8_t start_sector;
/* (C & 0xFF) where C is the cylinder of the start. */
pupa_uint8_t start_cylinder;
grub_uint8_t start_cylinder;
/* The partition type. */
pupa_uint8_t type;
grub_uint8_t type;
/* The end versions of start_head, start_sector and start_cylinder,
respectively. */
pupa_uint8_t end_head;
pupa_uint8_t end_sector;
pupa_uint8_t end_cylinder;
grub_uint8_t end_head;
grub_uint8_t end_sector;
grub_uint8_t end_cylinder;
/* The start sector. Note that this is counted from zero. */
pupa_uint32_t start;
grub_uint32_t start;
/* The length in sector units. */
pupa_uint32_t length;
grub_uint32_t length;
} __attribute__ ((packed));
/* The structure of MBR. */
struct pupa_partition_mbr
struct grub_partition_mbr
{
/* The code area (actually, including BPB). */
pupa_uint8_t code[446];
grub_uint8_t code[446];
/* Four partition entries. */
struct pupa_partition_entry entries[4];
struct grub_partition_entry entries[4];
/* The signature 0xaa55. */
pupa_uint16_t signature;
grub_uint16_t signature;
} __attribute__ ((packed));
/* Partition description. */
struct pupa_partition
struct grub_partition
{
/* The start sector. */
unsigned long start;
@ -195,48 +195,48 @@ struct pupa_partition
/* The BSD partition type. */
int bsd_type;
};
typedef struct pupa_partition *pupa_partition_t;
typedef struct grub_partition *grub_partition_t;
struct pupa_disk;
struct grub_disk;
pupa_partition_t EXPORT_FUNC(pupa_partition_probe) (struct pupa_disk *disk,
grub_partition_t EXPORT_FUNC(grub_partition_probe) (struct grub_disk *disk,
const char *str);
pupa_err_t EXPORT_FUNC(pupa_partition_iterate) (struct pupa_disk *disk,
int (*hook) (const pupa_partition_t partition));
char *EXPORT_FUNC(pupa_partition_get_name) (const pupa_partition_t partition);
grub_err_t EXPORT_FUNC(grub_partition_iterate) (struct grub_disk *disk,
int (*hook) (const grub_partition_t partition));
char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition);
static inline unsigned long
pupa_partition_get_start (const pupa_partition_t p)
grub_partition_get_start (const grub_partition_t p)
{
return p->start;
}
static inline unsigned long
pupa_partition_get_len (const pupa_partition_t p)
grub_partition_get_len (const grub_partition_t p)
{
return p->len;
}
static inline int
pupa_partition_is_empty (int type)
grub_partition_is_empty (int type)
{
return (type == PUPA_PARTITION_TYPE_NONE);
return (type == GRUB_PARTITION_TYPE_NONE);
}
static inline int
pupa_partition_is_extended (int type)
grub_partition_is_extended (int type)
{
return (type == PUPA_PARTITION_TYPE_EXTENDED
|| type == PUPA_PARTITION_TYPE_WIN95_EXTENDED
|| type == PUPA_PARTITION_TYPE_LINUX_EXTENDED);
return (type == GRUB_PARTITION_TYPE_EXTENDED
|| type == GRUB_PARTITION_TYPE_WIN95_EXTENDED
|| type == GRUB_PARTITION_TYPE_LINUX_EXTENDED);
}
static inline int
pupa_partition_is_bsd (int type)
grub_partition_is_bsd (int type)
{
return (type == PUPA_PARTITION_TYPE_FREEBSD
|| type == PUPA_PARTITION_TYPE_OPENBSD
|| type == PUPA_PARTITION_TYPE_NETBSD);
return (type == GRUB_PARTITION_TYPE_FREEBSD
|| type == GRUB_PARTITION_TYPE_OPENBSD
|| type == GRUB_PARTITION_TYPE_NETBSD);
}
#endif /* ! PUPA_PARTITION_HEADER */
#endif /* ! GRUB_PARTITION_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -20,14 +20,14 @@
#ifndef KERNEL_TIME_HEADER
#define KERNEL_TIME_HEADER 1
#ifdef PUPA_UTIL
#ifdef GRUB_UTIL
# include <time.h>
# define PUPA_TICKS_PER_SECOND CLOCKS_PER_SEC
# define GRUB_TICKS_PER_SECOND CLOCKS_PER_SEC
#else
# define PUPA_TICKS_PER_SECOND 18
# define GRUB_TICKS_PER_SECOND 18
#endif
/* Return the real time in ticks. */
pupa_uint32_t pupa_get_rtc (void);
grub_uint32_t grub_get_rtc (void);
#endif /* ! KERNEL_TIME_HEADER */

View file

@ -1,9 +1,9 @@
/* biosdisk.h - emulate biosdisk */
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -14,15 +14,15 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_BIOSDISK_MACHINE_UTIL_HEADER
#define PUPA_BIOSDISK_MACHINE_UTIL_HEADER 1
#ifndef GRUB_BIOSDISK_MACHINE_UTIL_HEADER
#define GRUB_BIOSDISK_MACHINE_UTIL_HEADER 1
void pupa_util_biosdisk_init (const char *dev_map);
void pupa_util_biosdisk_fini (void);
char *pupa_util_biosdisk_get_pupa_dev (const char *os_dev);
void grub_util_biosdisk_init (const char *dev_map);
void grub_util_biosdisk_fini (void);
char *grub_util_biosdisk_get_grub_dev (const char *os_dev);
#endif /* ! PUPA_BIOSDISK_MACHINE_UTIL_HEADER */
#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -17,15 +17,15 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_VGA_MACHINE_HEADER
#define PUPA_VGA_MACHINE_HEADER 1
#ifndef GRUB_VGA_MACHINE_HEADER
#define GRUB_VGA_MACHINE_HEADER 1
#include <pupa/symbol.h>
#include <grub/symbol.h>
/* Set the video mode to MODE and return the previous mode. */
unsigned char EXPORT_FUNC(pupa_vga_set_mode) (unsigned char mode);
unsigned char EXPORT_FUNC(grub_vga_set_mode) (unsigned char mode);
/* Return a pointer to the ROM font table. */
unsigned char *EXPORT_FUNC(pupa_vga_get_font) (void);
unsigned char *EXPORT_FUNC(grub_vga_get_font) (void);
#endif /* ! PUPA_VGA_MACHINE_HEADER */
#endif /* ! GRUB_VGA_MACHINE_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -17,9 +17,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_SETJMP_CPU_HEADER
#define PUPA_SETJMP_CPU_HEADER 1
#ifndef GRUB_SETJMP_CPU_HEADER
#define GRUB_SETJMP_CPU_HEADER 1
typedef unsigned long pupa_jmp_buf[6];
typedef unsigned long grub_jmp_buf[6];
#endif /* ! PUPA_SETJMP_CPU_HEADER */
#endif /* ! GRUB_SETJMP_CPU_HEADER */

View file

@ -1,8 +1,8 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -13,20 +13,20 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_TYPES_CPU_HEADER
#define PUPA_TYPES_CPU_HEADER 1
#ifndef GRUB_TYPES_CPU_HEADER
#define GRUB_TYPES_CPU_HEADER 1
/* The size of void *. */
#define PUPA_HOST_SIZEOF_VOID_P 4
#define GRUB_HOST_SIZEOF_VOID_P 4
/* The size of long. */
#define PUPA_HOST_SIZEOF_LONG 4
#define GRUB_HOST_SIZEOF_LONG 4
/* i386 is little-endian. */
#undef PUPA_HOST_WORDS_BIGENDIAN
#undef GRUB_HOST_WORDS_BIGENDIAN
#endif /* ! PUPA_TYPES_CPU_HEADER */
#endif /* ! GRUB_TYPES_CPU_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -17,42 +17,42 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_KERNEL_HEADER
#define PUPA_KERNEL_HEADER 1
#ifndef GRUB_KERNEL_HEADER
#define GRUB_KERNEL_HEADER 1
#include <pupa/types.h>
#include <grub/types.h>
/* The module header. */
struct pupa_module_header
struct grub_module_header
{
/* The offset of object code. */
pupa_off_t offset;
grub_off_t offset;
/* The size of object code plus this header. */
pupa_size_t size;
grub_size_t size;
};
/* The start address of the kernel. */
extern pupa_addr_t pupa_start_addr;
extern grub_addr_t grub_start_addr;
/* The end address of the kernel. */
extern pupa_addr_t pupa_end_addr;
extern grub_addr_t grub_end_addr;
/* The total size of modules including their headers. */
extern pupa_size_t pupa_total_module_size;
extern grub_size_t grub_total_module_size;
/* The size of the kernel image. */
extern pupa_size_t pupa_kernel_image_size;
extern grub_size_t grub_kernel_image_size;
/* The start point of the C code. */
void pupa_main (void);
void grub_main (void);
/* The machine-specific initialization. This must initialize memory. */
void pupa_machine_init (void);
void grub_machine_init (void);
/* Return the end address of the core image. */
pupa_addr_t pupa_get_end_addr (void);
grub_addr_t grub_get_end_addr (void);
/* Register all the exported symbols. This is automatically generated. */
void pupa_register_exported_symbols (void);
void grub_register_exported_symbols (void);
#endif /* ! PUPA_KERNEL_HEADER */
#endif /* ! GRUB_KERNEL_HEADER */

View file

@ -1,6 +1,6 @@
/* loader.h - OS loaders */
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -18,21 +18,21 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_LOADER_HEADER
#define PUPA_LOADER_HEADER 1
#ifndef GRUB_LOADER_HEADER
#define GRUB_LOADER_HEADER 1
#include <pupa/file.h>
#include <pupa/symbol.h>
#include <pupa/err.h>
#include <pupa/types.h>
#include <grub/file.h>
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
extern pupa_addr_t EXPORT_VAR(pupa_os_area_addr);
extern pupa_size_t EXPORT_VAR(pupa_os_area_size);
extern grub_addr_t EXPORT_VAR(grub_os_area_addr);
extern grub_size_t EXPORT_VAR(grub_os_area_size);
void EXPORT_FUNC(pupa_loader_set) (pupa_err_t (*boot) (void),
pupa_err_t (*unload) (void));
void EXPORT_FUNC(pupa_loader_unset) (void);
void EXPORT_FUNC(grub_loader_set) (grub_err_t (*boot) (void),
grub_err_t (*unload) (void));
void EXPORT_FUNC(grub_loader_unset) (void);
pupa_err_t EXPORT_FUNC(pupa_loader_boot) (void);
grub_err_t EXPORT_FUNC(grub_loader_boot) (void);
#endif /* ! PUPA_LOADER_HEADER */
#endif /* ! GRUB_LOADER_HEADER */

View file

@ -1,9 +1,9 @@
/* misc.h - prototypes for misc functions */
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -14,51 +14,51 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_MISC_HEADER
#define PUPA_MISC_HEADER 1
#ifndef GRUB_MISC_HEADER
#define GRUB_MISC_HEADER 1
#include <stdarg.h>
#include <pupa/types.h>
#include <pupa/symbol.h>
#include <pupa/err.h>
#include <grub/types.h>
#include <grub/symbol.h>
#include <grub/err.h>
/* XXX: If pupa_memmove is too slow, we must implement pupa_memcpy. */
#define pupa_memcpy(d,s,n) pupa_memmove ((d), (s), (n))
/* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */
#define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n))
void *EXPORT_FUNC(pupa_memmove) (void *dest, const void *src, pupa_size_t n);
char *EXPORT_FUNC(pupa_strcpy) (char *dest, const char *src);
char *EXPORT_FUNC(pupa_strncpy) (char *dest, const char *src, int c);
char *EXPORT_FUNC(pupa_stpcpy) (char *dest, const char *src);
char *EXPORT_FUNC(pupa_strcat) (char *dest, const char *src);
void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n);
char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src);
char *EXPORT_FUNC(grub_strncpy) (char *dest, const char *src, int c);
char *EXPORT_FUNC(grub_stpcpy) (char *dest, const char *src);
char *EXPORT_FUNC(grub_strcat) (char *dest, const char *src);
int EXPORT_FUNC(pupa_memcmp) (const void *s1, const void *s2, pupa_size_t n);
int EXPORT_FUNC(pupa_strcmp) (const char *s1, const char *s2);
int EXPORT_FUNC(pupa_strncmp) (const char *s1, const char *s2, int c);
char *EXPORT_FUNC(pupa_strchr) (const char *s, int c);
char *EXPORT_FUNC(pupa_strrchr) (const char *s, int c);
int EXPORT_FUNC(pupa_isspace) (int c);
int EXPORT_FUNC(pupa_isprint) (int c);
int EXPORT_FUNC(pupa_isalpha) (int c);
int EXPORT_FUNC(pupa_isgraph) (int c);
int EXPORT_FUNC(pupa_isdigit) (int c);
int EXPORT_FUNC(pupa_tolower) (int c);
unsigned long EXPORT_FUNC(pupa_strtoul) (const char *str, char **end, int base);
char *EXPORT_FUNC(pupa_strdup) (const char *s);
char *EXPORT_FUNC(pupa_strndup) (const char *s, pupa_size_t n);
void *EXPORT_FUNC(pupa_memset) (void *s, int c, pupa_size_t n);
pupa_size_t EXPORT_FUNC(pupa_strlen) (const char *s);
int EXPORT_FUNC(pupa_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
int EXPORT_FUNC(pupa_vprintf) (const char *fmt, va_list args);
int EXPORT_FUNC(pupa_sprintf) (char *str, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
int EXPORT_FUNC(pupa_vsprintf) (char *str, const char *fmt, va_list args);
void EXPORT_FUNC(pupa_stop) (void) __attribute__ ((noreturn));
pupa_err_t EXPORT_FUNC(pupa_split_cmdline) (const char *str,
pupa_err_t (* getline) (char **),
int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n);
int EXPORT_FUNC(grub_strcmp) (const char *s1, const char *s2);
int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, int c);
char *EXPORT_FUNC(grub_strchr) (const char *s, int c);
char *EXPORT_FUNC(grub_strrchr) (const char *s, int c);
int EXPORT_FUNC(grub_isspace) (int c);
int EXPORT_FUNC(grub_isprint) (int c);
int EXPORT_FUNC(grub_isalpha) (int c);
int EXPORT_FUNC(grub_isgraph) (int c);
int EXPORT_FUNC(grub_isdigit) (int c);
int EXPORT_FUNC(grub_tolower) (int c);
unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, char **end, int base);
char *EXPORT_FUNC(grub_strdup) (const char *s);
char *EXPORT_FUNC(grub_strndup) (const char *s, grub_size_t n);
void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n);
grub_size_t EXPORT_FUNC(grub_strlen) (const char *s);
int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args);
int EXPORT_FUNC(grub_sprintf) (char *str, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
int EXPORT_FUNC(grub_vsprintf) (char *str, const char *fmt, va_list args);
void EXPORT_FUNC(grub_stop) (void) __attribute__ ((noreturn));
grub_err_t EXPORT_FUNC(grub_split_cmdline) (const char *str,
grub_err_t (* getline) (char **),
int *argc, char ***argv);
#endif /* ! PUPA_MISC_HEADER */
#endif /* ! GRUB_MISC_HEADER */

View file

@ -1,9 +1,9 @@
/* mm.h - prototypes and declarations for memory manager */
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -14,26 +14,26 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_MM_H
#define PUPA_MM_H 1
#ifndef GRUB_MM_H
#define GRUB_MM_H 1
#include <pupa/types.h>
#include <pupa/symbol.h>
#include <grub/types.h>
#include <grub/symbol.h>
void pupa_mm_init_region (void *addr, unsigned size);
void *EXPORT_FUNC(pupa_malloc) (unsigned size);
void EXPORT_FUNC(pupa_free) (void *ptr);
void *EXPORT_FUNC(pupa_realloc) (void *ptr, unsigned size);
void *EXPORT_FUNC(pupa_memalign) (unsigned align, unsigned size);
void grub_mm_init_region (void *addr, unsigned size);
void *EXPORT_FUNC(grub_malloc) (unsigned size);
void EXPORT_FUNC(grub_free) (void *ptr);
void *EXPORT_FUNC(grub_realloc) (void *ptr, unsigned size);
void *EXPORT_FUNC(grub_memalign) (unsigned align, unsigned size);
/* For debugging. */
#define MM_DEBUG 1
#if MM_DEBUG
void pupa_mm_dump (unsigned lineno);
void grub_mm_dump (unsigned lineno);
#endif
#endif /* ! PUPA_MM_H */
#endif /* ! GRUB_MM_H */

View file

@ -1,8 +1,8 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -13,49 +13,49 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_NET_HEADER
#define PUPA_NET_HEADER 1
#ifndef GRUB_NET_HEADER
#define GRUB_NET_HEADER 1
#include <pupa/symbol.h>
#include <pupa/err.h>
#include <pupa/types.h>
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
struct pupa_net;
struct grub_net;
struct pupa_net_dev
struct grub_net_dev
{
/* The device name. */
const char *name;
/* FIXME: Just a template. */
int (*probe) (struct pupa_net *net, const void *addr);
void (*reset) (struct pupa_net *net);
int (*poll) (struct pupa_net *net);
void (*transmit) (struct pupa_net *net, const void *destip,
int (*probe) (struct grub_net *net, const void *addr);
void (*reset) (struct grub_net *net);
int (*poll) (struct grub_net *net);
void (*transmit) (struct grub_net *net, const void *destip,
unsigned srcsock, unsigned destsock, const void *packet);
void (*disable) (struct pupa_net *net);
void (*disable) (struct grub_net *net);
/* The next net device. */
struct pupa_net_dev *next;
struct grub_net_dev *next;
};
typedef struct pupa_net_dev *pupa_net_dev_t;
typedef struct grub_net_dev *grub_net_dev_t;
struct pupa_fs;
struct grub_fs;
struct pupa_net
struct grub_net
{
/* The net name. */
const char *name;
/* The underlying disk device. */
pupa_net_dev_t dev;
grub_net_dev_t dev;
/* The binding filesystem. */
struct pupa_fs *fs;
struct grub_fs *fs;
/* FIXME: More data would be required, such as an IP address, a mask,
a gateway, etc. */
@ -63,11 +63,11 @@ struct pupa_net
/* Device-specific data. */
void *data;
};
typedef struct pupa_net *pupa_net_t;
typedef struct grub_net *grub_net_t;
/* FIXME: How to abstract networks? More consideration is necessary. */
/* Note: Networks are very different from disks, because networks must
be initialized before used, and the status is persistent. */
#endif /* ! PUPA_NET_HEADER */
#endif /* ! GRUB_NET_HEADER */

View file

@ -1,6 +1,6 @@
/* normal.h - prototypes for the normal mode */
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -18,36 +18,36 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_NORMAL_HEADER
#define PUPA_NORMAL_HEADER 1
#ifndef GRUB_NORMAL_HEADER
#define GRUB_NORMAL_HEADER 1
#include <pupa/setjmp.h>
#include <pupa/symbol.h>
#include <pupa/err.h>
#include <pupa/arg.h>
#include <grub/setjmp.h>
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/arg.h>
/* The maximum size of a command-line. */
#define PUPA_MAX_CMDLINE 1600
#define GRUB_MAX_CMDLINE 1600
/* Can be run in the command-line. */
#define PUPA_COMMAND_FLAG_CMDLINE 0x1
#define GRUB_COMMAND_FLAG_CMDLINE 0x1
/* Can be run in the menu. */
#define PUPA_COMMAND_FLAG_MENU 0x2
#define GRUB_COMMAND_FLAG_MENU 0x2
/* Can be run in both interfaces. */
#define PUPA_COMMAND_FLAG_BOTH 0x3
#define GRUB_COMMAND_FLAG_BOTH 0x3
/* Only for the command title. */
#define PUPA_COMMAND_FLAG_TITLE 0x4
#define GRUB_COMMAND_FLAG_TITLE 0x4
/* Don't print the command on booting. */
#define PUPA_COMMAND_FLAG_NO_ECHO 0x8
#define GRUB_COMMAND_FLAG_NO_ECHO 0x8
/* The command description. */
struct pupa_command
struct grub_command
{
/* The name. */
const char *name;
/* The callback function. */
pupa_err_t (*func) (struct pupa_arg_list *state, int argc, char **args);
grub_err_t (*func) (struct grub_arg_list *state, int argc, char **args);
/* The flags. */
unsigned flags;
@ -59,26 +59,26 @@ struct pupa_command
const char *description;
/* The argument parser optionlist. */
const struct pupa_arg_option *options;
const struct grub_arg_option *options;
/* The next element. */
struct pupa_command *next;
struct grub_command *next;
};
typedef struct pupa_command *pupa_command_t;
typedef struct grub_command *grub_command_t;
/* The command list. */
struct pupa_command_list
struct grub_command_list
{
/* The string of a command. */
const char *command;
/* The next element. */
struct pupa_command_list *next;
struct grub_command_list *next;
};
typedef struct pupa_command_list *pupa_command_list_t;
typedef struct grub_command_list *grub_command_list_t;
/* The menu entry. */
struct pupa_menu_entry
struct grub_menu_entry
{
/* The title name. */
const char *title;
@ -87,15 +87,15 @@ struct pupa_menu_entry
int num;
/* The list of commands. */
pupa_command_list_t command_list;
grub_command_list_t command_list;
/* The next element. */
struct pupa_menu_entry *next;
struct grub_menu_entry *next;
};
typedef struct pupa_menu_entry *pupa_menu_entry_t;
typedef struct grub_menu_entry *grub_menu_entry_t;
/* The menu. */
struct pupa_menu
struct grub_menu
{
/* The default entry number. */
int default_entry;
@ -110,52 +110,52 @@ struct pupa_menu
int size;
/* The list of menu entries. */
pupa_menu_entry_t entry_list;
grub_menu_entry_t entry_list;
};
typedef struct pupa_menu *pupa_menu_t;
typedef struct grub_menu *grub_menu_t;
/* To exit from the normal mode. */
extern pupa_jmp_buf pupa_exit_env;
extern grub_jmp_buf grub_exit_env;
void pupa_enter_normal_mode (const char *config);
void pupa_normal_execute (const char *config, int nested);
void pupa_menu_run (pupa_menu_t menu, int nested);
void pupa_cmdline_run (int nested);
int pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
void grub_enter_normal_mode (const char *config);
void grub_normal_execute (const char *config, int nested);
void grub_menu_run (grub_menu_t menu, int nested);
void grub_cmdline_run (int nested);
int grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
int echo_char, int readline);
void EXPORT_FUNC(pupa_register_command) (const char *name,
pupa_err_t (*func) (struct pupa_arg_list *state,
void EXPORT_FUNC(grub_register_command) (const char *name,
grub_err_t (*func) (struct grub_arg_list *state,
int argc, char **args),
unsigned flags,
const char *summary,
const char *description,
const struct pupa_arg_option *parser);
void EXPORT_FUNC(pupa_unregister_command) (const char *name);
pupa_command_t pupa_command_find (char *cmdline);
pupa_err_t pupa_set_history (int newsize);
int pupa_iterate_commands (int (*iterate) (pupa_command_t));
int pupa_command_execute (char *cmdline);
void pupa_command_init (void);
void pupa_normal_init_page (void);
int pupa_arg_parse (pupa_command_t parser, int argc, char **argv,
struct pupa_arg_list *usr, char ***args, int *argnum);
const struct grub_arg_option *parser);
void EXPORT_FUNC(grub_unregister_command) (const char *name);
grub_command_t grub_command_find (char *cmdline);
grub_err_t grub_set_history (int newsize);
int grub_iterate_commands (int (*iterate) (grub_command_t));
int grub_command_execute (char *cmdline);
void grub_command_init (void);
void grub_normal_init_page (void);
int grub_arg_parse (grub_command_t parser, int argc, char **argv,
struct grub_arg_list *usr, char ***args, int *argnum);
#ifdef PUPA_UTIL
void pupa_normal_init (void);
void pupa_normal_fini (void);
void pupa_hello_init (void);
void pupa_hello_fini (void);
void pupa_ls_init (void);
void pupa_ls_fini (void);
void pupa_cat_init (void);
void pupa_cat_fini (void);
void pupa_boot_init (void);
void pupa_boot_fini (void);
void pupa_cmp_init (void);
void pupa_cmp_fini (void);
void pupa_terminal_init (void);
void pupa_terminal_fini (void);
#ifdef GRUB_UTIL
void grub_normal_init (void);
void grub_normal_fini (void);
void grub_hello_init (void);
void grub_hello_fini (void);
void grub_ls_init (void);
void grub_ls_fini (void);
void grub_cat_init (void);
void grub_cat_fini (void);
void grub_boot_init (void);
void grub_boot_fini (void);
void grub_cmp_init (void);
void grub_cmp_fini (void);
void grub_terminal_init (void);
void grub_terminal_fini (void);
#endif
#endif /* ! PUPA_NORMAL_HEADER */
#endif /* ! GRUB_NORMAL_HEADER */

View file

@ -1,8 +1,8 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -13,16 +13,16 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_BIOSDISK_MACHINE_HEADER
#define PUPA_BIOSDISK_MACHINE_HEADER 1
#ifndef GRUB_BIOSDISK_MACHINE_HEADER
#define GRUB_BIOSDISK_MACHINE_HEADER 1
#define PUPA_BIOSDISK_FLAG_LBA 1
#define GRUB_BIOSDISK_FLAG_LBA 1
struct pupa_biosdisk_data
struct grub_biosdisk_data
{
int drive;
unsigned long cylinders;
@ -31,17 +31,17 @@ struct pupa_biosdisk_data
unsigned long flags;
};
int pupa_biosdisk_rw_int13_extensions (int ah, int drive, void *dap);
int pupa_biosdisk_rw_standard (int ah, int drive, int coff, int hoff,
int grub_biosdisk_rw_int13_extensions (int ah, int drive, void *dap);
int grub_biosdisk_rw_standard (int ah, int drive, int coff, int hoff,
int soff, int nsec, int segment);
int pupa_biosdisk_check_int13_extensions (int drive);
int pupa_biosdisk_get_diskinfo_int13_extensions (int drive, void *drp);
int pupa_biosdisk_get_diskinfo_standard (int drive,
int grub_biosdisk_check_int13_extensions (int drive);
int grub_biosdisk_get_diskinfo_int13_extensions (int drive, void *drp);
int grub_biosdisk_get_diskinfo_standard (int drive,
unsigned long *cylinders,
unsigned long *heads,
unsigned long *sectors);
int pupa_biosdisk_get_num_floppies (void);
int grub_biosdisk_get_num_floppies (void);
void pupa_biosdisk_init (void);
void grub_biosdisk_init (void);
#endif /* ! PUPA_BIOSDISK_MACHINE_HEADER */
#endif /* ! GRUB_BIOSDISK_MACHINE_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -17,40 +17,40 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_CONSOLE_MACHINE_HEADER
#define PUPA_CONSOLE_MACHINE_HEADER 1
#ifndef GRUB_CONSOLE_MACHINE_HEADER
#define GRUB_CONSOLE_MACHINE_HEADER 1
/* Define scan codes. */
#define PUPA_CONSOLE_KEY_LEFT 0x4B00
#define PUPA_CONSOLE_KEY_RIGHT 0x4D00
#define PUPA_CONSOLE_KEY_UP 0x4800
#define PUPA_CONSOLE_KEY_DOWN 0x5000
#define PUPA_CONSOLE_KEY_IC 0x5200
#define PUPA_CONSOLE_KEY_DC 0x5300
#define PUPA_CONSOLE_KEY_BACKSPACE 0x0008
#define PUPA_CONSOLE_KEY_HOME 0x4700
#define PUPA_CONSOLE_KEY_END 0x4F00
#define PUPA_CONSOLE_KEY_NPAGE 0x4900
#define PUPA_CONSOLE_KEY_PPAGE 0x5100
#define GRUB_CONSOLE_KEY_LEFT 0x4B00
#define GRUB_CONSOLE_KEY_RIGHT 0x4D00
#define GRUB_CONSOLE_KEY_UP 0x4800
#define GRUB_CONSOLE_KEY_DOWN 0x5000
#define GRUB_CONSOLE_KEY_IC 0x5200
#define GRUB_CONSOLE_KEY_DC 0x5300
#define GRUB_CONSOLE_KEY_BACKSPACE 0x0008
#define GRUB_CONSOLE_KEY_HOME 0x4700
#define GRUB_CONSOLE_KEY_END 0x4F00
#define GRUB_CONSOLE_KEY_NPAGE 0x4900
#define GRUB_CONSOLE_KEY_PPAGE 0x5100
#ifndef ASM_FILE
#include <pupa/types.h>
#include <pupa/symbol.h>
#include <grub/types.h>
#include <grub/symbol.h>
/* These are global to share code between C and asm. */
extern pupa_uint8_t pupa_console_cur_color;
void pupa_console_real_putchar (int c);
int EXPORT_FUNC(pupa_console_checkkey) (void);
int EXPORT_FUNC(pupa_console_getkey) (void);
pupa_uint16_t pupa_console_getxy (void);
void pupa_console_gotoxy (pupa_uint8_t x, pupa_uint8_t y);
void pupa_console_cls (void);
void pupa_console_setcursor (int on);
extern grub_uint8_t grub_console_cur_color;
void grub_console_real_putchar (int c);
int EXPORT_FUNC(grub_console_checkkey) (void);
int EXPORT_FUNC(grub_console_getkey) (void);
grub_uint16_t grub_console_getxy (void);
void grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y);
void grub_console_cls (void);
void grub_console_setcursor (int on);
/* Initialize the console system. */
void pupa_console_init (void);
void grub_console_init (void);
#endif
#endif /* ! PUPA_CONSOLE_MACHINE_HEADER */
#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */

View file

@ -1,6 +1,6 @@
/* ieee1275.h - Access the Open Firmware client interface. */
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -18,82 +18,82 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_IEEE1275_MACHINE_HEADER
#define PUPA_IEEE1275_MACHINE_HEADER 1
#ifndef GRUB_IEEE1275_MACHINE_HEADER
#define GRUB_IEEE1275_MACHINE_HEADER 1
#include <stdint.h>
#include <pupa/err.h>
#include <pupa/types.h>
#include <grub/err.h>
#include <grub/types.h>
/* Maps a device alias to a pathname. */
struct pupa_ieee1275_devalias
struct grub_ieee1275_devalias
{
char *name;
char *path;
char *type;
};
struct pupa_ieee1275_mem_region
struct grub_ieee1275_mem_region
{
unsigned int start;
unsigned int size;
};
/* FIXME jrydberg: is this correct cell types? */
typedef intptr_t pupa_ieee1275_ihandle_t;
typedef intptr_t pupa_ieee1275_phandle_t;
typedef intptr_t grub_ieee1275_ihandle_t;
typedef intptr_t grub_ieee1275_phandle_t;
extern intptr_t (*pupa_ieee1275_entry_fn) (void *);
extern intptr_t (*grub_ieee1275_entry_fn) (void *);
uint32_t EXPORT_FUNC(pupa_ieee1275_decode_int_4) (unsigned char *p);
int EXPORT_FUNC(pupa_ieee1275_finddevice) (char *name,
pupa_ieee1275_phandle_t *phandlep);
int EXPORT_FUNC(pupa_ieee1275_get_property) (int handle, const char *property,
void *buf, pupa_size_t size,
pupa_size_t *actual);
int EXPORT_FUNC(pupa_ieee1275_next_property) (int handle, char *prev_prop,
uint32_t EXPORT_FUNC(grub_ieee1275_decode_int_4) (unsigned char *p);
int EXPORT_FUNC(grub_ieee1275_finddevice) (char *name,
grub_ieee1275_phandle_t *phandlep);
int EXPORT_FUNC(grub_ieee1275_get_property) (int handle, const char *property,
void *buf, grub_size_t size,
grub_size_t *actual);
int EXPORT_FUNC(grub_ieee1275_next_property) (int handle, char *prev_prop,
char *prop, int *flags);
int EXPORT_FUNC(pupa_ieee1275_get_property_length)
(pupa_ieee1275_phandle_t handle, const char *prop, pupa_size_t *length);
int EXPORT_FUNC(pupa_ieee1275_instance_to_package)
(pupa_ieee1275_ihandle_t ihandle, pupa_ieee1275_phandle_t *phandlep);
int EXPORT_FUNC(pupa_ieee1275_package_to_path) (pupa_ieee1275_phandle_t phandle,
char *path, pupa_size_t len,
pupa_size_t *actual);
int EXPORT_FUNC(pupa_ieee1275_instance_to_path)
(pupa_ieee1275_ihandle_t ihandle, char *path, pupa_size_t len,
pupa_size_t *actual);
int EXPORT_FUNC(pupa_ieee1275_write) (pupa_ieee1275_ihandle_t ihandle,
void *buffer, pupa_size_t len,
pupa_size_t *actualp);
int EXPORT_FUNC(pupa_ieee1275_read) (pupa_ieee1275_ihandle_t ihandle,
void *buffer, pupa_size_t len,
pupa_size_t *actualp);
int EXPORT_FUNC(pupa_ieee1275_seek) (pupa_ieee1275_ihandle_t ihandle,
int EXPORT_FUNC(grub_ieee1275_get_property_length)
(grub_ieee1275_phandle_t handle, const char *prop, grub_size_t *length);
int EXPORT_FUNC(grub_ieee1275_instance_to_package)
(grub_ieee1275_ihandle_t ihandle, grub_ieee1275_phandle_t *phandlep);
int EXPORT_FUNC(grub_ieee1275_package_to_path) (grub_ieee1275_phandle_t phandle,
char *path, grub_size_t len,
grub_size_t *actual);
int EXPORT_FUNC(grub_ieee1275_instance_to_path)
(grub_ieee1275_ihandle_t ihandle, char *path, grub_size_t len,
grub_size_t *actual);
int EXPORT_FUNC(grub_ieee1275_write) (grub_ieee1275_ihandle_t ihandle,
void *buffer, grub_size_t len,
grub_size_t *actualp);
int EXPORT_FUNC(grub_ieee1275_read) (grub_ieee1275_ihandle_t ihandle,
void *buffer, grub_size_t len,
grub_size_t *actualp);
int EXPORT_FUNC(grub_ieee1275_seek) (grub_ieee1275_ihandle_t ihandle,
int pos_hi, int pos_lo, int *result);
int EXPORT_FUNC(pupa_ieee1275_peer) (pupa_ieee1275_phandle_t node,
pupa_ieee1275_phandle_t *result);
int EXPORT_FUNC(pupa_ieee1275_child) (pupa_ieee1275_phandle_t node,
pupa_ieee1275_phandle_t *result);
int EXPORT_FUNC(pupa_ieee1275_parent) (pupa_ieee1275_phandle_t node,
pupa_ieee1275_phandle_t *result);
int EXPORT_FUNC(pupa_ieee1275_exit) (void);
int EXPORT_FUNC(pupa_ieee1275_open) (char *node,
pupa_ieee1275_ihandle_t *result);
int EXPORT_FUNC(pupa_ieee1275_close) (pupa_ieee1275_ihandle_t ihandle);
int EXPORT_FUNC(pupa_ieee1275_claim) (void *p, pupa_size_t size, unsigned int align,
int EXPORT_FUNC(grub_ieee1275_peer) (grub_ieee1275_phandle_t node,
grub_ieee1275_phandle_t *result);
int EXPORT_FUNC(grub_ieee1275_child) (grub_ieee1275_phandle_t node,
grub_ieee1275_phandle_t *result);
int EXPORT_FUNC(grub_ieee1275_parent) (grub_ieee1275_phandle_t node,
grub_ieee1275_phandle_t *result);
int EXPORT_FUNC(grub_ieee1275_exit) (void);
int EXPORT_FUNC(grub_ieee1275_open) (char *node,
grub_ieee1275_ihandle_t *result);
int EXPORT_FUNC(grub_ieee1275_close) (grub_ieee1275_ihandle_t ihandle);
int EXPORT_FUNC(grub_ieee1275_claim) (void *p, grub_size_t size, unsigned int align,
void **result);
int EXPORT_FUNC(pupa_ieee1275_set_property) (pupa_ieee1275_phandle_t phandle,
int EXPORT_FUNC(grub_ieee1275_set_property) (grub_ieee1275_phandle_t phandle,
const char *propname, void *buf,
pupa_size_t size,
pupa_size_t *actual);
int EXPORT_FUNC(pupa_ieee1275_set_color) (pupa_ieee1275_ihandle_t ihandle,
grub_size_t size,
grub_size_t *actual);
int EXPORT_FUNC(grub_ieee1275_set_color) (grub_ieee1275_ihandle_t ihandle,
int index, int r, int g, int b);
pupa_err_t EXPORT_FUNC(pupa_devalias_iterate)
(int (*hook) (struct pupa_ieee1275_devalias *alias));
grub_err_t EXPORT_FUNC(grub_devalias_iterate)
(int (*hook) (struct grub_ieee1275_devalias *alias));
#endif /* ! PUPA_IEEE1275_MACHINE_HEADER */
#endif /* ! GRUB_IEEE1275_MACHINE_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Yoshinori K. Okuji <okuji@enbug.org>
* Copyright (C) 2003 Jeroen Dekkers <jeroen@dekkers.cx>
*
@ -18,34 +18,34 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_LOADER_MACHINE_HEADER
#define PUPA_LOADER_MACHINE_HEADER 1
#ifndef GRUB_LOADER_MACHINE_HEADER
#define GRUB_LOADER_MACHINE_HEADER 1
#include <pupa/types.h>
#include <pupa/symbol.h>
#include <pupa/machine/multiboot.h>
#include <grub/types.h>
#include <grub/symbol.h>
#include <grub/machine/multiboot.h>
extern pupa_uint32_t EXPORT_VAR(pupa_linux_prot_size);
extern char *EXPORT_VAR(pupa_linux_tmp_addr);
extern char *EXPORT_VAR(pupa_linux_real_addr);
extern grub_uint32_t EXPORT_VAR(grub_linux_prot_size);
extern char *EXPORT_VAR(grub_linux_tmp_addr);
extern char *EXPORT_VAR(grub_linux_real_addr);
void EXPORT_FUNC(pupa_linux_boot_zimage) (void) __attribute__ ((noreturn));
void EXPORT_FUNC(pupa_linux_boot_bzimage) (void) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_linux_boot_zimage) (void) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_linux_boot_bzimage) (void) __attribute__ ((noreturn));
/* This is an asm part of the chainloader. */
void EXPORT_FUNC(pupa_chainloader_real_boot) (int drive, void *part_addr) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_chainloader_real_boot) (int drive, void *part_addr) __attribute__ ((noreturn));
/* The asm part of the multiboot loader. */
void EXPORT_FUNC(pupa_multiboot_real_boot) (pupa_addr_t entry,
struct pupa_multiboot_info *mbi)
void EXPORT_FUNC(grub_multiboot_real_boot) (grub_addr_t entry,
struct grub_multiboot_info *mbi)
__attribute__ ((noreturn));
/* It is necessary to export these functions, because normal mode commands
reuse rescue mode commands. */
void pupa_rescue_cmd_chainloader (int argc, char *argv[]);
void pupa_rescue_cmd_linux (int argc, char *argv[]);
void pupa_rescue_cmd_initrd (int argc, char *argv[]);
void pupa_rescue_cmd_multiboot (int argc, char *argv[]);
void pupa_rescue_cmd_module (int argc, char *argv[]);
void grub_rescue_cmd_chainloader (int argc, char *argv[]);
void grub_rescue_cmd_linux (int argc, char *argv[]);
void grub_rescue_cmd_initrd (int argc, char *argv[]);
void grub_rescue_cmd_multiboot (int argc, char *argv[]);
void grub_rescue_cmd_module (int argc, char *argv[]);
#endif /* ! PUPA_LOADER_MACHINE_HEADER */
#endif /* ! GRUB_LOADER_MACHINE_HEADER */

View file

@ -1,6 +1,6 @@
/* multiboot.h - multiboot header file. */
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -18,167 +18,167 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_MULTIBOOT_MACHINE_HEADER
#define PUPA_MULTIBOOT_MACHINE_HEADER 1
#ifndef GRUB_MULTIBOOT_MACHINE_HEADER
#define GRUB_MULTIBOOT_MACHINE_HEADER 1
/* How many bytes from the start of the file we search for the header. */
#define PUPA_MB_SEARCH 8192
#define GRUB_MB_SEARCH 8192
/* The magic field should contain this. */
#define PUPA_MB_MAGIC 0x1BADB002
#define GRUB_MB_MAGIC 0x1BADB002
/* This should be in %eax. */
#define PUPA_MB_MAGIC2 0x2BADB002
#define GRUB_MB_MAGIC2 0x2BADB002
/* The bits in the required part of flags field we don't support. */
#define PUPA_MB_UNSUPPORTED 0x0000fffc
#define GRUB_MB_UNSUPPORTED 0x0000fffc
/* Alignment of multiboot modules. */
#define PUPA_MB_MOD_ALIGN 0x00001000
#define GRUB_MB_MOD_ALIGN 0x00001000
/*
* Flags set in the 'flags' member of the multiboot header.
*/
/* Align all boot modules on i386 page (4KB) boundaries. */
#define PUPA_MB_PAGE_ALIGN 0x00000001
#define GRUB_MB_PAGE_ALIGN 0x00000001
/* Must pass memory information to OS. */
#define PUPA_MB_MEMORY_INFO 0x00000002
#define GRUB_MB_MEMORY_INFO 0x00000002
/* Must pass video information to OS. */
#define PUPA_MB_VIDEO_MODE 0x00000004
#define GRUB_MB_VIDEO_MODE 0x00000004
/* This flag indicates the use of the address fields in the header. */
#define PUPA_MB_AOUT_KLUDGE 0x00010000
#define GRUB_MB_AOUT_KLUDGE 0x00010000
/*
* Flags to be set in the 'flags' member of the multiboot info structure.
*/
/* is there basic lower/upper memory information? */
#define PUPA_MB_INFO_MEMORY 0x00000001
#define GRUB_MB_INFO_MEMORY 0x00000001
/* is there a boot device set? */
#define PUPA_MB_INFO_BOOTDEV 0x00000002
#define GRUB_MB_INFO_BOOTDEV 0x00000002
/* is the command-line defined? */
#define PUPA_MB_INFO_CMDLINE 0x00000004
#define GRUB_MB_INFO_CMDLINE 0x00000004
/* are there modules to do something with? */
#define PUPA_MB_INFO_MODS 0x00000008
#define GRUB_MB_INFO_MODS 0x00000008
/* These next two are mutually exclusive */
/* is there a symbol table loaded? */
#define PUPA_MB_INFO_AOUT_SYMS 0x00000010
#define GRUB_MB_INFO_AOUT_SYMS 0x00000010
/* is there an ELF section header table? */
#define PUPA_MB_INFO_ELF_SHDR 0x00000020
#define GRUB_MB_INFO_ELF_SHDR 0x00000020
/* is there a full memory map? */
#define PUPA_MB_INFO_MEM_MAP 0x00000040
#define GRUB_MB_INFO_MEM_MAP 0x00000040
/* Is there drive info? */
#define PUPA_MB_INFO_DRIVE_INFO 0x00000080
#define GRUB_MB_INFO_DRIVE_INFO 0x00000080
/* Is there a config table? */
#define PUPA_MB_INFO_CONFIG_TABLE 0x00000100
#define GRUB_MB_INFO_CONFIG_TABLE 0x00000100
/* Is there a boot loader name? */
#define PUPA_MB_INFO_BOOT_LOADER_NAME 0x00000200
#define GRUB_MB_INFO_BOOT_LOADER_NAME 0x00000200
/* Is there a APM table? */
#define PUPA_MB_INFO_APM_TABLE 0x00000400
#define GRUB_MB_INFO_APM_TABLE 0x00000400
/* Is there video information? */
#define PUPA_MB_INFO_VIDEO_INFO 0x00000800
#define GRUB_MB_INFO_VIDEO_INFO 0x00000800
#ifndef ASM_FILE
#include <pupa/types.h>
#include <grub/types.h>
struct pupa_multiboot_header
struct grub_multiboot_header
{
/* Must be PUPA_MB_MAGIC - see above. */
pupa_uint32_t magic;
/* Must be GRUB_MB_MAGIC - see above. */
grub_uint32_t magic;
/* Feature flags. */
pupa_uint32_t flags;
grub_uint32_t flags;
/* The above fields plus this one must equal 0 mod 2^32. */
pupa_uint32_t checksum;
grub_uint32_t checksum;
/* These are only valid if PUPA_MB_AOUT_KLUDGE is set. */
pupa_uint32_t header_addr;
pupa_uint32_t load_addr;
pupa_uint32_t load_end_addr;
pupa_uint32_t bss_end_addr;
pupa_uint32_t entry_addr;
/* These are only valid if GRUB_MB_AOUT_KLUDGE is set. */
grub_uint32_t header_addr;
grub_uint32_t load_addr;
grub_uint32_t load_end_addr;
grub_uint32_t bss_end_addr;
grub_uint32_t entry_addr;
/* These are only valid if PUPA_MB_VIDEO_MODE is set. */
pupa_uint32_t mode_type;
pupa_uint32_t width;
pupa_uint32_t height;
pupa_uint32_t depth;
/* These are only valid if GRUB_MB_VIDEO_MODE is set. */
grub_uint32_t mode_type;
grub_uint32_t width;
grub_uint32_t height;
grub_uint32_t depth;
};
struct pupa_multiboot_info
struct grub_multiboot_info
{
/* MultiBoot info version number */
pupa_uint32_t flags;
grub_uint32_t flags;
/* Available memory from BIOS */
pupa_uint32_t mem_lower;
pupa_uint32_t mem_upper;
grub_uint32_t mem_lower;
grub_uint32_t mem_upper;
/* "root" partition */
pupa_uint32_t boot_device;
grub_uint32_t boot_device;
/* Kernel command line */
pupa_uint32_t cmdline;
grub_uint32_t cmdline;
/* Boot-Module list */
pupa_uint32_t mods_count;
pupa_uint32_t mods_addr;
grub_uint32_t mods_count;
grub_uint32_t mods_addr;
pupa_uint32_t syms[4];
grub_uint32_t syms[4];
/* Memory Mapping buffer */
pupa_uint32_t mmap_length;
pupa_uint32_t mmap_addr;
grub_uint32_t mmap_length;
grub_uint32_t mmap_addr;
/* Drive Info buffer */
pupa_uint32_t drives_length;
pupa_uint32_t drives_addr;
grub_uint32_t drives_length;
grub_uint32_t drives_addr;
/* ROM configuration table */
pupa_uint32_t config_table;
grub_uint32_t config_table;
/* Boot Loader Name */
pupa_uint32_t boot_loader_name;
grub_uint32_t boot_loader_name;
/* APM table */
pupa_uint32_t apm_table;
grub_uint32_t apm_table;
/* Video */
pupa_uint32_t vbe_control_info;
pupa_uint32_t vbe_mode_info;
pupa_uint16_t vbe_mode;
pupa_uint16_t vbe_interface_seg;
pupa_uint16_t vbe_interface_off;
pupa_uint16_t vbe_interface_len;
grub_uint32_t vbe_control_info;
grub_uint32_t vbe_mode_info;
grub_uint16_t vbe_mode;
grub_uint16_t vbe_interface_seg;
grub_uint16_t vbe_interface_off;
grub_uint16_t vbe_interface_len;
};
struct pupa_mod_list
struct grub_mod_list
{
/* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
pupa_uint32_t mod_start;
pupa_uint32_t mod_end;
grub_uint32_t mod_start;
grub_uint32_t mod_end;
/* Module command line */
pupa_uint32_t cmdline;
grub_uint32_t cmdline;
/* padding to take it to 16 bytes (must be zero) */
pupa_uint32_t pad;
grub_uint32_t pad;
};
#endif /* ! ASM_FILE */
#endif /* ! PUPA_MULTIBOOT_MACHINE_HEADER */
#endif /* ! GRUB_MULTIBOOT_MACHINE_HEADER */

View file

@ -1,8 +1,8 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -13,36 +13,36 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_PARTITION_HEADER
#define PUPA_PARTITION_HEADER 1
#ifndef GRUB_PARTITION_HEADER
#define GRUB_PARTITION_HEADER 1
#include <pupa/symbol.h>
#include <pupa/types.h>
#include <pupa/err.h>
#include <grub/symbol.h>
#include <grub/types.h>
#include <grub/err.h>
#define PUPA_APPLE_PART_MAGIC 0x504D
#define GRUB_APPLE_PART_MAGIC 0x504D
struct pupa_apple_part
struct grub_apple_part
{
/* The magic number to idenify this as a partition, it should have
the value `0x504D'. */
pupa_uint16_t magic;
grub_uint16_t magic;
/* Reserved. */
pupa_uint16_t reserved;
grub_uint16_t reserved;
/* The size of the partition map in blocks. */
pupa_uint32_t partmap_size;
grub_uint32_t partmap_size;
/* The first physical block of the partition. */
pupa_uint32_t first_phys_block;
grub_uint32_t first_phys_block;
/* The amount of blocks. */
pupa_uint32_t blockcnt;
grub_uint32_t blockcnt;
/* The partition name. */
char partname[32];
@ -51,44 +51,44 @@ struct pupa_apple_part
char parttype[32];
/* The first datablock of the partition. */
pupa_uint32_t datablocks_first;
grub_uint32_t datablocks_first;
/* The amount datablocks. */
pupa_uint32_t datablocks_count;
grub_uint32_t datablocks_count;
/* The status of the partition. (???) */
pupa_uint32_t status;
grub_uint32_t status;
/* The first block on which the bootcode can be found. */
pupa_uint32_t bootcode_pos;
grub_uint32_t bootcode_pos;
/* The size of the bootcode in bytes. */
pupa_uint32_t bootcode_size;
grub_uint32_t bootcode_size;
/* The load address of the bootcode. */
pupa_uint32_t bootcode_loadaddr;
grub_uint32_t bootcode_loadaddr;
/* Reserved. */
pupa_uint32_t reserved2;
grub_uint32_t reserved2;
/* The entrypoint of the bootcode. */
pupa_uint32_t bootcode_entrypoint;
grub_uint32_t bootcode_entrypoint;
/* Reserved. */
pupa_uint32_t reserved3;
grub_uint32_t reserved3;
/* A checksum of the bootcode. */
pupa_uint32_t bootcode_checksum;
grub_uint32_t bootcode_checksum;
/* The processor type. */
char processor[16];
/* Padding. */
pupa_uint16_t pad[187];
grub_uint16_t pad[187];
};
/* Partition description. */
struct pupa_partition
struct grub_partition
{
/* The start sector. */
unsigned long start;
@ -114,27 +114,27 @@ struct pupa_partition
/* The BSD partition type. */
int bsd_type;
};
typedef struct pupa_partition *pupa_partition_t;
typedef struct grub_partition *grub_partition_t;
struct pupa_disk;
struct grub_disk;
pupa_partition_t EXPORT_FUNC(pupa_partition_probe) (struct pupa_disk *disk,
grub_partition_t EXPORT_FUNC(grub_partition_probe) (struct grub_disk *disk,
const char *str);
pupa_err_t EXPORT_FUNC(pupa_partition_iterate) (struct pupa_disk *disk,
int (*hook) (const pupa_partition_t partition));
char *EXPORT_FUNC(pupa_partition_get_name) (const pupa_partition_t partition);
grub_err_t EXPORT_FUNC(grub_partition_iterate) (struct grub_disk *disk,
int (*hook) (const grub_partition_t partition));
char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition);
static inline unsigned long
pupa_partition_get_start (const pupa_partition_t p)
grub_partition_get_start (const grub_partition_t p)
{
return p->start;
}
static inline unsigned long
pupa_partition_get_len (const pupa_partition_t p)
grub_partition_get_len (const grub_partition_t p)
{
return p->len;
}
#endif /* ! PUPA_PARTITION_HEADER */
#endif /* ! GRUB_PARTITION_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003 Marco Gerards <metgerards@student.han.nl>
*
* This program is free software; you can redistribute it and/or modify
@ -20,14 +20,14 @@
#ifndef KERNEL_TIME_HEADER
#define KERNEL_TIME_HEADER 1
#ifdef PUPA_UTIL
#ifdef GRUB_UTIL
# include <time.h>
# define PUPA_TICKS_PER_SECOND CLOCKS_PER_SEC
# define GRUB_TICKS_PER_SECOND CLOCKS_PER_SEC
#else
# define PUPA_TICKS_PER_SECOND 18
# define GRUB_TICKS_PER_SECOND 18
#endif
/* Return the real time in ticks. */
pupa_uint32_t pupa_get_rtc (void);
grub_uint32_t grub_get_rtc (void);
#endif /* ! KERNEL_TIME_HEADER */

View file

@ -1,9 +1,9 @@
/* biosdisk.h - emulate biosdisk */
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -14,15 +14,15 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_BIOSDISK_MACHINE_UTIL_HEADER
#define PUPA_BIOSDISK_MACHINE_UTIL_HEADER 1
#ifndef GRUB_BIOSDISK_MACHINE_UTIL_HEADER
#define GRUB_BIOSDISK_MACHINE_UTIL_HEADER 1
void pupa_util_biosdisk_init (const char *dev_map);
void pupa_util_biosdisk_fini (void);
char *pupa_util_biosdisk_get_pupa_dev (const char *os_dev);
void grub_util_biosdisk_init (const char *dev_map);
void grub_util_biosdisk_fini (void);
char *grub_util_biosdisk_get_grub_dev (const char *os_dev);
#endif /* ! PUPA_BIOSDISK_MACHINE_UTIL_HEADER */
#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -17,9 +17,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_SETJMP_CPU_HEADER
#define PUPA_SETJMP_CPU_HEADER 1
#ifndef GRUB_SETJMP_CPU_HEADER
#define GRUB_SETJMP_CPU_HEADER 1
typedef unsigned long pupa_jmp_buf[6];
typedef unsigned long grub_jmp_buf[6];
#endif /* ! PUPA_SETJMP_CPU_HEADER */
#endif /* ! GRUB_SETJMP_CPU_HEADER */

View file

@ -1,8 +1,8 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -13,20 +13,20 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_TYPES_CPU_HEADER
#define PUPA_TYPES_CPU_HEADER 1
#ifndef GRUB_TYPES_CPU_HEADER
#define GRUB_TYPES_CPU_HEADER 1
/* The size of void *. */
#define PUPA_HOST_SIZEOF_VOID_P 4
#define GRUB_HOST_SIZEOF_VOID_P 4
/* The size of long. */
#define PUPA_HOST_SIZEOF_LONG 4
#define GRUB_HOST_SIZEOF_LONG 4
/* powerpc is little-endian. */
#undef PUPA_HOST_WORDS_LITTLEENDIAN
#undef GRUB_HOST_WORDS_LITTLEENDIAN
#endif /* ! PUPA_TYPES_CPU_HEADER */
#endif /* ! GRUB_TYPES_CPU_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -17,21 +17,21 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_RESCUE_HEADER
#define PUPA_RESCUE_HEADER 1
#ifndef GRUB_RESCUE_HEADER
#define GRUB_RESCUE_HEADER 1
#include <pupa/symbol.h>
#include <grub/symbol.h>
/* Enter rescue mode. */
void pupa_enter_rescue_mode (void);
void grub_enter_rescue_mode (void);
/* Register a rescue mode command. */
void EXPORT_FUNC(pupa_rescue_register_command) (const char *name,
void EXPORT_FUNC(grub_rescue_register_command) (const char *name,
void (*func) (int argc,
char *argv[]),
const char *message);
/* Unregister a rescue mode command. */
void EXPORT_FUNC(pupa_rescue_unregister_command) (const char *name);
void EXPORT_FUNC(grub_rescue_unregister_command) (const char *name);
#endif /* ! PUPA_RESCUE_HEADER */
#endif /* ! GRUB_RESCUE_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -17,20 +17,20 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_SETJMP_HEADER
#define PUPA_SETJMP_HEADER 1
#ifndef GRUB_SETJMP_HEADER
#define GRUB_SETJMP_HEADER 1
#ifdef PUPA_UTIL
#ifdef GRUB_UTIL
#include <setjmp.h>
typedef jmp_buf pupa_jmp_buf;
#define pupa_setjmp setjmp
#define pupa_longjmp longjmp
typedef jmp_buf grub_jmp_buf;
#define grub_setjmp setjmp
#define grub_longjmp longjmp
#else
/* This must define pupa_jmp_buf. */
#include <pupa/cpu/setjmp.h>
/* This must define grub_jmp_buf. */
#include <grub/cpu/setjmp.h>
int pupa_setjmp (pupa_jmp_buf env);
void pupa_longjmp (pupa_jmp_buf env, int val) __attribute__ ((noreturn));
int grub_setjmp (grub_jmp_buf env);
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
#endif
#endif /* ! PUPA_SETJMP_HEADER */
#endif /* ! GRUB_SETJMP_HEADER */

View file

@ -1,8 +1,8 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -13,12 +13,12 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_SYMBOL_HEADER
#define PUPA_SYMBOL_HEADER 1
#ifndef GRUB_SYMBOL_HEADER
#define GRUB_SYMBOL_HEADER 1
#include <config.h>
@ -36,4 +36,4 @@
#define EXPORT_FUNC(x) x
#define EXPORT_VAR(x) x
#endif /* ! PUPA_SYMBOL_HEADER */
#endif /* ! GRUB_SYMBOL_HEADER */

View file

@ -1,8 +1,8 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -13,29 +13,29 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_TERM_HEADER
#define PUPA_TERM_HEADER 1
#ifndef GRUB_TERM_HEADER
#define GRUB_TERM_HEADER 1
#include <pupa/err.h>
#include <pupa/symbol.h>
#include <pupa/types.h>
#include <grub/err.h>
#include <grub/symbol.h>
#include <grub/types.h>
/* These are used to represent the various color states we use. */
typedef enum
{
/* The color used to display all text that does not use the
user defined colors below. */
PUPA_TERM_COLOR_STANDARD,
GRUB_TERM_COLOR_STANDARD,
/* The user defined colors for normal text. */
PUPA_TERM_COLOR_NORMAL,
GRUB_TERM_COLOR_NORMAL,
/* The user defined colors for highlighted text. */
PUPA_TERM_COLOR_HIGHLIGHT
GRUB_TERM_COLOR_HIGHLIGHT
}
pupa_term_color_state;
grub_term_color_state;
/* Flags for representing the capabilities of a terminal. */
/* Some notes about the flags:
@ -47,27 +47,27 @@ pupa_term_color_state;
to NULL. */
/* Set when input characters shouldn't be echoed back. */
#define PUPA_TERM_NO_ECHO (1 << 0)
#define GRUB_TERM_NO_ECHO (1 << 0)
/* Set when the editing feature should be disabled. */
#define PUPA_TERM_NO_EDIT (1 << 1)
#define GRUB_TERM_NO_EDIT (1 << 1)
/* Set when the terminal cannot do fancy things. */
#define PUPA_TERM_DUMB (1 << 2)
#define GRUB_TERM_DUMB (1 << 2)
/* Set when the terminal needs to be initialized. */
#define PUPA_TERM_NEED_INIT (1 << 16)
#define GRUB_TERM_NEED_INIT (1 << 16)
struct pupa_term
struct grub_term
{
/* The terminal name. */
const char *name;
/* Initialize the terminal. */
pupa_err_t (*init) (void);
grub_err_t (*init) (void);
/* Clean up the terminal. */
pupa_err_t (*fini) (void);
grub_err_t (*fini) (void);
/* Put a character. C is encoded in Unicode. */
void (*putchar) (pupa_uint32_t c);
void (*putchar) (grub_uint32_t c);
/* Check if any input character is available. */
int (*checkkey) (void);
@ -76,20 +76,20 @@ struct pupa_term
int (*getkey) (void);
/* Get the cursor position. The return value is ((X << 8) | Y). */
pupa_uint16_t (*getxy) (void);
grub_uint16_t (*getxy) (void);
/* Go to the position (X, Y). */
void (*gotoxy) (pupa_uint8_t x, pupa_uint8_t y);
void (*gotoxy) (grub_uint8_t x, grub_uint8_t y);
/* Clear the screen. */
void (*cls) (void);
/* Set the current color to be used */
void (*setcolorstate) (pupa_term_color_state state);
void (*setcolorstate) (grub_term_color_state state);
/* Set the normal color and the highlight color. The format of each
color is VGA's. */
void (*setcolor) (pupa_uint8_t normal_color, pupa_uint8_t highlight_color);
void (*setcolor) (grub_uint8_t normal_color, grub_uint8_t highlight_color);
/* Turn on/off the cursor. */
void (*setcursor) (int on);
@ -98,35 +98,35 @@ struct pupa_term
void (*refresh) (void);
/* The feature flags defined above. */
pupa_uint32_t flags;
grub_uint32_t flags;
/* The next terminal. */
struct pupa_term *next;
struct grub_term *next;
};
typedef struct pupa_term *pupa_term_t;
typedef struct grub_term *grub_term_t;
void EXPORT_FUNC(pupa_term_register) (pupa_term_t term);
void EXPORT_FUNC(pupa_term_unregister) (pupa_term_t term);
void EXPORT_FUNC(pupa_term_iterate) (int (*hook) (pupa_term_t term));
void EXPORT_FUNC(grub_term_register) (grub_term_t term);
void EXPORT_FUNC(grub_term_unregister) (grub_term_t term);
void EXPORT_FUNC(grub_term_iterate) (int (*hook) (grub_term_t term));
pupa_err_t EXPORT_FUNC(pupa_term_set_current) (pupa_term_t term);
pupa_term_t EXPORT_FUNC(pupa_term_get_current) (void);
grub_err_t EXPORT_FUNC(grub_term_set_current) (grub_term_t term);
grub_term_t EXPORT_FUNC(grub_term_get_current) (void);
void EXPORT_FUNC(pupa_putchar) (int c);
void EXPORT_FUNC(pupa_putcode) (pupa_uint32_t code);
int EXPORT_FUNC(pupa_getkey) (void);
int EXPORT_FUNC(pupa_checkkey) (void);
pupa_uint16_t EXPORT_FUNC(pupa_getxy) (void);
void EXPORT_FUNC(pupa_gotoxy) (pupa_uint8_t x, pupa_uint8_t y);
void EXPORT_FUNC(pupa_cls) (void);
void EXPORT_FUNC(pupa_setcolorstate) (pupa_term_color_state state);
void EXPORT_FUNC(pupa_setcolor) (pupa_uint8_t normal_color,
pupa_uint8_t highlight_color);
int EXPORT_FUNC(pupa_setcursor) (int on);
void EXPORT_FUNC(pupa_refresh) (void);
void EXPORT_FUNC(pupa_set_more) (int onoff);
void EXPORT_FUNC(grub_putchar) (int c);
void EXPORT_FUNC(grub_putcode) (grub_uint32_t code);
int EXPORT_FUNC(grub_getkey) (void);
int EXPORT_FUNC(grub_checkkey) (void);
grub_uint16_t EXPORT_FUNC(grub_getxy) (void);
void EXPORT_FUNC(grub_gotoxy) (grub_uint8_t x, grub_uint8_t y);
void EXPORT_FUNC(grub_cls) (void);
void EXPORT_FUNC(grub_setcolorstate) (grub_term_color_state state);
void EXPORT_FUNC(grub_setcolor) (grub_uint8_t normal_color,
grub_uint8_t highlight_color);
int EXPORT_FUNC(grub_setcursor) (int on);
void EXPORT_FUNC(grub_refresh) (void);
void EXPORT_FUNC(grub_set_more) (int onoff);
/* For convenience. */
#define PUPA_TERM_ASCII_CHAR(c) ((c) & 0xff)
#define GRUB_TERM_ASCII_CHAR(c) ((c) & 0xff)
#endif /* ! PUPA_TERM_HEADER */
#endif /* ! GRUB_TERM_HEADER */

View file

@ -1,5 +1,5 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -17,125 +17,125 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_TYPES_HEADER
#define PUPA_TYPES_HEADER 1
#ifndef GRUB_TYPES_HEADER
#define GRUB_TYPES_HEADER 1
#include <config.h>
#include <pupa/cpu/types.h>
#include <grub/cpu/types.h>
#ifdef PUPA_UTIL
# define PUPA_CPU_SIZEOF_VOID_P SIZEOF_VOID_P
# define PUPA_CPU_SIZEOF_LONG SIZEOF_LONG
#ifdef GRUB_UTIL
# define GRUB_CPU_SIZEOF_VOID_P SIZEOF_VOID_P
# define GRUB_CPU_SIZEOF_LONG SIZEOF_LONG
# ifdef WORDS_BIGENDIAN
# define PUPA_CPU_WORDS_BIGENDIAN 1
# define GRUB_CPU_WORDS_BIGENDIAN 1
# else
# undef PUPA_CPU_WORDS_BIGENDIAN
# undef GRUB_CPU_WORDS_BIGENDIAN
# endif
#else /* ! PUPA_UTIL */
# define PUPA_CPU_SIZEOF_VOID_P PUPA_HOST_SIZEOF_VOID_P
# define PUPA_CPU_SIZEOF_LONG PUPA_HOST_SIZEOF_LONG
# ifdef PUPA_HOST_WORDS_BIGENDIAN
# define PUPA_CPU_WORDS_BIGENDIAN 1
#else /* ! GRUB_UTIL */
# define GRUB_CPU_SIZEOF_VOID_P GRUB_HOST_SIZEOF_VOID_P
# define GRUB_CPU_SIZEOF_LONG GRUB_HOST_SIZEOF_LONG
# ifdef GRUB_HOST_WORDS_BIGENDIAN
# define GRUB_CPU_WORDS_BIGENDIAN 1
# else
# undef PUPA_CPU_WORDS_BIGENDIAN
# undef GRUB_CPU_WORDS_BIGENDIAN
# endif
#endif /* ! PUPA_UTIL */
#endif /* ! GRUB_UTIL */
#if PUPA_CPU_SIZEOF_VOID_P != PUPA_CPU_SIZEOF_LONG
#if GRUB_CPU_SIZEOF_VOID_P != GRUB_CPU_SIZEOF_LONG
# error "This architecture is not supported because sizeof(void *) != sizeof(long)"
#endif
#if PUPA_CPU_SIZEOF_VOID_P != 4 && PUPA_CPU_SIZEOF_VOID_P != 8
#if GRUB_CPU_SIZEOF_VOID_P != 4 && GRUB_CPU_SIZEOF_VOID_P != 8
# error "This architecture is not supported because sizeof(void *) != 4 and sizeof(void *) != 8"
#endif
/* Define various wide integers. */
typedef signed char pupa_int8_t;
typedef short pupa_int16_t;
typedef int pupa_int32_t;
#if PUPA_CPU_SIZEOF_VOID_P == 8
typedef long pupa_int64_t;
typedef signed char grub_int8_t;
typedef short grub_int16_t;
typedef int grub_int32_t;
#if GRUB_CPU_SIZEOF_VOID_P == 8
typedef long grub_int64_t;
#else
typedef long long pupa_int64_t;
typedef long long grub_int64_t;
#endif
typedef unsigned char pupa_uint8_t;
typedef unsigned short pupa_uint16_t;
typedef unsigned pupa_uint32_t;
#if PUPA_CPU_SIZEOF_VOID_P == 8
typedef unsigned long pupa_uint64_t;
typedef unsigned char grub_uint8_t;
typedef unsigned short grub_uint16_t;
typedef unsigned grub_uint32_t;
#if GRUB_CPU_SIZEOF_VOID_P == 8
typedef unsigned long grub_uint64_t;
#else
typedef unsigned long long pupa_uint64_t;
typedef unsigned long long grub_uint64_t;
#endif
/* Misc types. */
#if PUPA_HOST_SIZEOF_VOID_P == 8
typedef pupa_uint64_t pupa_addr_t;
typedef pupa_uint64_t pupa_off_t;
typedef pupa_uint64_t pupa_size_t;
typedef pupa_int64_t pupa_ssize_t;
#if GRUB_HOST_SIZEOF_VOID_P == 8
typedef grub_uint64_t grub_addr_t;
typedef grub_uint64_t grub_off_t;
typedef grub_uint64_t grub_size_t;
typedef grub_int64_t grub_ssize_t;
#else
typedef pupa_uint32_t pupa_addr_t;
typedef pupa_uint32_t pupa_off_t;
typedef pupa_uint32_t pupa_size_t;
typedef pupa_int32_t pupa_ssize_t;
typedef grub_uint32_t grub_addr_t;
typedef grub_uint32_t grub_off_t;
typedef grub_uint32_t grub_size_t;
typedef grub_int32_t grub_ssize_t;
#endif
/* Byte-orders. */
#define pupa_swap_bytes16(x) \
#define grub_swap_bytes16(x) \
({ \
pupa_uint16_t _x = (x); \
(pupa_uint16_t) ((_x << 8) | (_x >> 8)); \
grub_uint16_t _x = (x); \
(grub_uint16_t) ((_x << 8) | (_x >> 8)); \
})
#define pupa_swap_bytes32(x) \
#define grub_swap_bytes32(x) \
({ \
pupa_uint32_t _x = (x); \
(pupa_uint32_t) ((_x << 24) \
| ((_x & (pupa_uint32_t) 0xFF00UL) << 8) \
| ((_x & (pupa_uint32_t) 0xFF0000UL) >> 8) \
grub_uint32_t _x = (x); \
(grub_uint32_t) ((_x << 24) \
| ((_x & (grub_uint32_t) 0xFF00UL) << 8) \
| ((_x & (grub_uint32_t) 0xFF0000UL) >> 8) \
| (_x >> 24)); \
})
#define pupa_swap_bytes64(x) \
#define grub_swap_bytes64(x) \
({ \
pupa_uint64_t _x = (x); \
(pupa_uint64_t) ((_x << 56) \
| ((_x & (pupa_uint64_t) 0xFF00ULL) << 40) \
| ((_x & (pupa_uint64_t) 0xFF0000ULL) << 24) \
| ((_x & (pupa_uint64_t) 0xFF000000ULL) << 8) \
| ((_x & (pupa_uint64_t) 0xFF00000000ULL) >> 8) \
| ((_x & (pupa_uint64_t) 0xFF0000000000ULL) >> 24) \
| ((_x & (pupa_uint64_t) 0xFF000000000000ULL) >> 40) \
grub_uint64_t _x = (x); \
(grub_uint64_t) ((_x << 56) \
| ((_x & (grub_uint64_t) 0xFF00ULL) << 40) \
| ((_x & (grub_uint64_t) 0xFF0000ULL) << 24) \
| ((_x & (grub_uint64_t) 0xFF000000ULL) << 8) \
| ((_x & (grub_uint64_t) 0xFF00000000ULL) >> 8) \
| ((_x & (grub_uint64_t) 0xFF0000000000ULL) >> 24) \
| ((_x & (grub_uint64_t) 0xFF000000000000ULL) >> 40) \
| (_x >> 56)); \
})
#ifdef PUPA_CPU_WORDS_BIGENDIAN
# define pupa_cpu_to_le16(x) pupa_swap_bytes16(x)
# define pupa_cpu_to_le32(x) pupa_swap_bytes32(x)
# define pupa_cpu_to_le64(x) pupa_swap_bytes64(x)
# define pupa_le_to_cpu16(x) pupa_swap_bytes16(x)
# define pupa_le_to_cpu32(x) pupa_swap_bytes32(x)
# define pupa_le_to_cpu64(x) pupa_swap_bytes64(x)
# define pupa_cpu_to_be16(x) ((pupa_uint16_t) (x))
# define pupa_cpu_to_be32(x) ((pupa_uint32_t) (x))
# define pupa_cpu_to_be64(x) ((pupa_uint64_t) (x))
# define pupa_be_to_cpu16(x) ((pupa_uint16_t) (x))
# define pupa_be_to_cpu32(x) ((pupa_uint32_t) (x))
# define pupa_be_to_cpu64(x) ((pupa_uint64_t) (x))
#ifdef GRUB_CPU_WORDS_BIGENDIAN
# define grub_cpu_to_le16(x) grub_swap_bytes16(x)
# define grub_cpu_to_le32(x) grub_swap_bytes32(x)
# define grub_cpu_to_le64(x) grub_swap_bytes64(x)
# define grub_le_to_cpu16(x) grub_swap_bytes16(x)
# define grub_le_to_cpu32(x) grub_swap_bytes32(x)
# define grub_le_to_cpu64(x) grub_swap_bytes64(x)
# define grub_cpu_to_be16(x) ((grub_uint16_t) (x))
# define grub_cpu_to_be32(x) ((grub_uint32_t) (x))
# define grub_cpu_to_be64(x) ((grub_uint64_t) (x))
# define grub_be_to_cpu16(x) ((grub_uint16_t) (x))
# define grub_be_to_cpu32(x) ((grub_uint32_t) (x))
# define grub_be_to_cpu64(x) ((grub_uint64_t) (x))
#else /* ! WORDS_BIGENDIAN */
# define pupa_cpu_to_le16(x) ((pupa_uint16_t) (x))
# define pupa_cpu_to_le32(x) ((pupa_uint32_t) (x))
# define pupa_cpu_to_le64(x) ((pupa_uint64_t) (x))
# define pupa_le_to_cpu16(x) ((pupa_uint16_t) (x))
# define pupa_le_to_cpu32(x) ((pupa_uint32_t) (x))
# define pupa_le_to_cpu64(x) ((pupa_uint64_t) (x))
# define pupa_cpu_to_be16(x) pupa_swap_bytes16(x)
# define pupa_cpu_to_be32(x) pupa_swap_bytes32(x)
# define pupa_cpu_to_be64(x) pupa_swap_bytes64(x)
# define pupa_be_to_cpu16(x) pupa_swap_bytes16(x)
# define pupa_be_to_cpu32(x) pupa_swap_bytes32(x)
# define pupa_be_to_cpu64(x) pupa_swap_bytes64(x)
# define grub_cpu_to_le16(x) ((grub_uint16_t) (x))
# define grub_cpu_to_le32(x) ((grub_uint32_t) (x))
# define grub_cpu_to_le64(x) ((grub_uint64_t) (x))
# define grub_le_to_cpu16(x) ((grub_uint16_t) (x))
# define grub_le_to_cpu32(x) ((grub_uint32_t) (x))
# define grub_le_to_cpu64(x) ((grub_uint64_t) (x))
# define grub_cpu_to_be16(x) grub_swap_bytes16(x)
# define grub_cpu_to_be32(x) grub_swap_bytes32(x)
# define grub_cpu_to_be64(x) grub_swap_bytes64(x)
# define grub_be_to_cpu16(x) grub_swap_bytes16(x)
# define grub_be_to_cpu32(x) grub_swap_bytes32(x)
# define grub_be_to_cpu64(x) grub_swap_bytes64(x)
#endif /* ! WORDS_BIGENDIAN */
#endif /* ! PUPA_TYPES_HEADER */
#endif /* ! GRUB_TYPES_HEADER */

View file

@ -1,8 +1,8 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -13,14 +13,14 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_UTIL_GETROOT_HEADER
#define PUPA_UTIL_GETROOT_HEADER 1
#ifndef GRUB_UTIL_GETROOT_HEADER
#define GRUB_UTIL_GETROOT_HEADER 1
char *pupa_guess_root_device (const char *dir);
char *pupa_get_prefix (const char *dir);
char *grub_guess_root_device (const char *dir);
char *grub_get_prefix (const char *dir);
#endif /* ! PUPA_UTIL_GETROOT_HEADER */
#endif /* ! GRUB_UTIL_GETROOT_HEADER */

View file

@ -1,8 +1,8 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -13,12 +13,12 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_UTIL_MISC_HEADER
#define PUPA_UTIL_MISC_HEADER 1
#ifndef GRUB_UTIL_MISC_HEADER
#define GRUB_UTIL_MISC_HEADER 1
#include <stdlib.h>
#include <stdio.h>
@ -26,17 +26,17 @@
extern char *progname;
extern int verbosity;
void pupa_util_info (const char *fmt, ...);
void pupa_util_error (const char *fmt, ...) __attribute__ ((noreturn));
void grub_util_info (const char *fmt, ...);
void grub_util_error (const char *fmt, ...) __attribute__ ((noreturn));
void *xmalloc (size_t size);
void *xrealloc (void *ptr, size_t size);
char *xstrdup (const char *str);
char *pupa_util_get_path (const char *dir, const char *file);
size_t pupa_util_get_image_size (const char *path);
char *pupa_util_read_image (const char *path);
void pupa_util_load_image (const char *path, char *buf);
void pupa_util_write_image (const char *img, size_t size, FILE *out);
char *grub_util_get_path (const char *dir, const char *file);
size_t grub_util_get_image_size (const char *path);
char *grub_util_read_image (const char *path);
void grub_util_load_image (const char *path, char *buf);
void grub_util_write_image (const char *img, size_t size, FILE *out);
#endif /* ! PUPA_UTIL_MISC_HEADER */
#endif /* ! GRUB_UTIL_MISC_HEADER */

View file

@ -1,8 +1,8 @@
/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@ -13,24 +13,24 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_UTIL_RESOLVE_HEADER
#define PUPA_UTIL_RESOLVE_HEADER 1
#ifndef GRUB_UTIL_RESOLVE_HEADER
#define GRUB_UTIL_RESOLVE_HEADER 1
struct pupa_util_path_list
struct grub_util_path_list
{
const char *name;
struct pupa_util_path_list *next;
struct grub_util_path_list *next;
};
/* Resolve the dependencies of the modules MODULES using the information
in the file DEP_LIST_FILE. The directory PREFIX is used to find files. */
struct pupa_util_path_list *
pupa_util_resolve_dependencies (const char *prefix,
struct grub_util_path_list *
grub_util_resolve_dependencies (const char *prefix,
const char *dep_list_file,
char *modules[]);
#endif /* ! PUPA_UTIL_RESOLVE_HEADER */
#endif /* ! GRUB_UTIL_RESOLVE_HEADER */