merged mainline

This commit is contained in:
BVK Chaitanya 2010-03-21 11:03:41 +05:30
commit dd6fee39fa
208 changed files with 10984 additions and 2300 deletions

View file

@ -102,6 +102,7 @@ union grub_aout_header
#define AOUT_MID_I386 134 /* i386 BSD binary */
#define AOUT_MID_SPARC 138 /* sparc */
#define AOUT_MID_HP200 200 /* hp200 (68010) BSD binary */
#define AOUT_MID_SUN 0x103
#define AOUT_MID_HP300 300 /* hp300 (68020+68881) BSD binary */
#define AOUT_MID_HPUX 0x20C /* hp200/300 HP-UX binary */
#define AOUT_MID_HPUX800 0x20B /* hp800 HP-UX binary */
@ -114,10 +115,14 @@ union grub_aout_header
#define AOUT_GETMID(header) ((header).a_midmag >> 16) & 0x03ff)
#define AOUT_GETFLAG(header) ((header).a_midmag >> 26) & 0x3f)
#ifndef GRUB_UTIL
int EXPORT_FUNC(grub_aout_get_type) (union grub_aout_header *header);
grub_err_t EXPORT_FUNC(grub_aout_load) (grub_file_t file, int offset,
grub_addr_t load_addr, int load_size,
grub_addr_t bss_end_addr);
#endif
#endif /* ! GRUB_AOUT_HEADER */

View file

@ -47,24 +47,24 @@ struct grub_video_bitmap_reader
};
typedef struct grub_video_bitmap_reader *grub_video_bitmap_reader_t;
void grub_video_bitmap_reader_register (grub_video_bitmap_reader_t reader);
void grub_video_bitmap_reader_unregister (grub_video_bitmap_reader_t reader);
void EXPORT_FUNC (grub_video_bitmap_reader_register) (grub_video_bitmap_reader_t reader);
void EXPORT_FUNC (grub_video_bitmap_reader_unregister) (grub_video_bitmap_reader_t reader);
grub_err_t grub_video_bitmap_create (struct grub_video_bitmap **bitmap,
unsigned int width, unsigned int height,
enum grub_video_blit_format blit_format);
grub_err_t EXPORT_FUNC (grub_video_bitmap_create) (struct grub_video_bitmap **bitmap,
unsigned int width, unsigned int height,
enum grub_video_blit_format blit_format);
grub_err_t grub_video_bitmap_destroy (struct grub_video_bitmap *bitmap);
grub_err_t EXPORT_FUNC (grub_video_bitmap_destroy) (struct grub_video_bitmap *bitmap);
grub_err_t grub_video_bitmap_load (struct grub_video_bitmap **bitmap,
const char *filename);
grub_err_t EXPORT_FUNC (grub_video_bitmap_load) (struct grub_video_bitmap **bitmap,
const char *filename);
unsigned int grub_video_bitmap_get_width (struct grub_video_bitmap *bitmap);
unsigned int grub_video_bitmap_get_height (struct grub_video_bitmap *bitmap);
unsigned int EXPORT_FUNC (grub_video_bitmap_get_width) (struct grub_video_bitmap *bitmap);
unsigned int EXPORT_FUNC (grub_video_bitmap_get_height) (struct grub_video_bitmap *bitmap);
void grub_video_bitmap_get_mode_info (struct grub_video_bitmap *bitmap,
struct grub_video_mode_info *mode_info);
void EXPORT_FUNC (grub_video_bitmap_get_mode_info) (struct grub_video_bitmap *bitmap,
struct grub_video_mode_info *mode_info);
void *grub_video_bitmap_get_data (struct grub_video_bitmap *bitmap);
void *EXPORT_FUNC (grub_video_bitmap_get_data) (struct grub_video_bitmap *bitmap);
#endif /* ! GRUB_BITMAP_HEADER */

View file

@ -0,0 +1,49 @@
/* bitmap_scale.h - Bitmap scaling functions. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* 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 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_BITMAP_SCALE_HEADER
#define GRUB_BITMAP_SCALE_HEADER 1
#include <grub/err.h>
#include <grub/types.h>
#include <grub/bitmap_scale.h>
enum grub_video_bitmap_scale_method
{
/* Choose the fastest interpolation algorithm. */
GRUB_VIDEO_BITMAP_SCALE_METHOD_FASTEST,
/* Choose the highest quality interpolation algorithm. */
GRUB_VIDEO_BITMAP_SCALE_METHOD_BEST,
/* Specific algorithms: */
/* Nearest neighbor interpolation. */
GRUB_VIDEO_BITMAP_SCALE_METHOD_NEAREST,
/* Bilinear interpolation. */
GRUB_VIDEO_BITMAP_SCALE_METHOD_BILINEAR
};
grub_err_t
EXPORT_FUNC (grub_video_bitmap_create_scaled) (struct grub_video_bitmap **dst,
int dst_width, int dst_height,
struct grub_video_bitmap *src,
enum
grub_video_bitmap_scale_method
scale_method);
#endif /* ! GRUB_BITMAP_SCALE_HEADER */

View file

@ -22,7 +22,7 @@
#include <grub/file.h>
grub_file_t grub_bufio_open (grub_file_t io, int size);
grub_file_t grub_buffile_open (const char *name, int size);
grub_file_t EXPORT_FUNC (grub_bufio_open) (grub_file_t io, int size);
grub_file_t EXPORT_FUNC (grub_buffile_open) (const char *name, int size);
#endif /* ! GRUB_BUFIO_H */

View file

@ -23,6 +23,14 @@
#include <grub/symbol.h>
#include <grub/types.h>
#if defined (__i386__) || defined (__x86_64__)
static inline void
grub_arch_sync_caches (void *address __attribute__ ((unused)),
grub_size_t len __attribute__ ((unused)))
{
}
#else
void EXPORT_FUNC(grub_arch_sync_caches) (void *address, grub_size_t len);
#endif
#endif /* ! GRUB_CACHE_HEADER */

View file

@ -33,10 +33,17 @@ struct grub_datetime
};
/* Return date and time. */
#ifdef GRUB_MACHINE_EMU
grub_err_t EXPORT_FUNC(grub_get_datetime) (struct grub_datetime *datetime);
/* Set date and time. */
grub_err_t EXPORT_FUNC(grub_set_datetime) (struct grub_datetime *datetime);
#else
grub_err_t grub_get_datetime (struct grub_datetime *datetime);
/* Set date and time. */
grub_err_t grub_set_datetime (struct grub_datetime *datetime);
#endif
int grub_get_weekday (struct grub_datetime *datetime);
char *grub_get_weekday_name (struct grub_datetime *datetime);

View file

@ -91,7 +91,12 @@ 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);
#ifdef GRUB_UTIL
#if defined (GRUB_MACHINE_EMU) || defined (GRUB_UTIL)
#define GRUB_NO_MODULES 1
#else
#define GRUB_NO_MODULES 0
#endif
#if GRUB_NO_MODULES
static inline int
grub_dl_ref (grub_dl_t mod)
{
@ -110,13 +115,13 @@ int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
#endif
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);
grub_err_t grub_dl_register_symbol (const char *name, void *addr,
grub_dl_t mod);
grub_err_t grub_arch_dl_check_header (void *ehdr);
grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
#if defined (_mips) && ! defined (GRUB_UTIL)
#if defined (_mips) && ! defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)
#define GRUB_LINKER_HAVE_INIT 1
void grub_arch_dl_init_linker (void);
#endif

View file

@ -66,7 +66,7 @@ void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_error_push) (void);
int EXPORT_FUNC(grub_error_pop) (void);
void EXPORT_FUNC(grub_print_error) (void);
int EXPORT_FUNC(grub_err_printf) (const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
int grub_err_printf (const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
#endif /* ! GRUB_ERR_HEADER */

View file

@ -81,36 +81,38 @@ int grub_font_load (const char *filename);
"Family Name Bold Italic 14", where Bold and Italic are optional.
If no font matches the name specified, the most recently loaded font
is returned as a fallback. */
grub_font_t grub_font_get (const char *font_name);
grub_font_t EXPORT_FUNC (grub_font_get) (const char *font_name);
const char *grub_font_get_name (grub_font_t font);
const char *EXPORT_FUNC (grub_font_get_name) (grub_font_t font);
int grub_font_get_max_char_width (grub_font_t font);
int EXPORT_FUNC (grub_font_get_max_char_width) (grub_font_t font);
int grub_font_get_max_char_height (grub_font_t font);
int EXPORT_FUNC (grub_font_get_max_char_height) (grub_font_t font);
int grub_font_get_ascent (grub_font_t font);
int EXPORT_FUNC (grub_font_get_ascent) (grub_font_t font);
int grub_font_get_descent (grub_font_t font);
int EXPORT_FUNC (grub_font_get_descent) (grub_font_t font);
int grub_font_get_leading (grub_font_t font);
int EXPORT_FUNC (grub_font_get_leading) (grub_font_t font);
int grub_font_get_height (grub_font_t font);
int EXPORT_FUNC (grub_font_get_height) (grub_font_t font);
int grub_font_get_string_width (grub_font_t font, const char *str);
int EXPORT_FUNC (grub_font_get_string_width) (grub_font_t font,
const char *str);
struct grub_font_glyph *grub_font_get_glyph (grub_font_t font,
grub_uint32_t code);
struct grub_font_glyph *EXPORT_FUNC (grub_font_get_glyph) (grub_font_t font,
grub_uint32_t code);
struct grub_font_glyph *grub_font_get_glyph_with_fallback (grub_font_t font,
grub_uint32_t code);
struct grub_font_glyph *EXPORT_FUNC (grub_font_get_glyph_with_fallback) (grub_font_t font,
grub_uint32_t code);
grub_err_t grub_font_draw_glyph (struct grub_font_glyph *glyph,
grub_video_color_t color,
int left_x, int baseline_y);
grub_err_t EXPORT_FUNC (grub_font_draw_glyph) (struct grub_font_glyph *glyph,
grub_video_color_t color,
int left_x, int baseline_y);
grub_err_t grub_font_draw_string (const char *str, grub_font_t font,
grub_video_color_t color,
int left_x, int baseline_y);
grub_err_t EXPORT_FUNC (grub_font_draw_string) (const char *str,
grub_font_t font,
grub_video_color_t color,
int left_x, int baseline_y);
#endif /* ! GRUB_FONT_HEADER */

38
include/grub/fontformat.h Normal file
View file

@ -0,0 +1,38 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2010 Free Software Foundation, Inc.
*
* 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 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_FONT_FORMAT_HEADER
#define GRUB_FONT_FORMAT_HEADER 1
/* FONT_FORMAT_PFF2_MAGIC use only 4 relevants bytes and the \0. */
#define FONT_FORMAT_PFF2_MAGIC "PFF2"
#define FONT_FORMAT_SECTION_NAMES_FILE "FILE"
#define FONT_FORMAT_SECTION_NAMES_FONT_NAME "NAME"
#define FONT_FORMAT_SECTION_NAMES_POINT_SIZE "PTSZ"
#define FONT_FORMAT_SECTION_NAMES_WEIGHT "WEIG"
#define FONT_FORMAT_SECTION_NAMES_MAX_CHAR_WIDTH "MAXW"
#define FONT_FORMAT_SECTION_NAMES_MAX_CHAR_HEIGHT "MAXH"
#define FONT_FORMAT_SECTION_NAMES_ASCENT "ASCE"
#define FONT_FORMAT_SECTION_NAMES_DESCENT "DESC"
#define FONT_FORMAT_SECTION_NAMES_CHAR_INDEX "CHIX"
#define FONT_FORMAT_SECTION_NAMES_DATA "DATA"
#define FONT_FORMAT_SECTION_NAMES_FAMILY "FAMI"
#define FONT_FORMAT_SECTION_NAMES_SLAN "SLAN"
#endif /* ! GRUB_FONT_FORMAT_HEADER */

View file

@ -0,0 +1 @@

107
include/grub/gfxmenu_view.h Normal file
View file

@ -0,0 +1,107 @@
/* gfxmenu_view.h - gfxmenu view interface. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* 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 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_GFXMENU_VIEW_HEADER
#define GRUB_GFXMENU_VIEW_HEADER 1
#include <grub/types.h>
#include <grub/err.h>
#include <grub/menu.h>
#include <grub/font.h>
#include <grub/gfxwidgets.h>
struct grub_gfxmenu_view; /* Forward declaration of opaque type. */
typedef struct grub_gfxmenu_view *grub_gfxmenu_view_t;
grub_gfxmenu_view_t grub_gfxmenu_view_new (const char *theme_path,
int width, int height);
void grub_gfxmenu_view_destroy (grub_gfxmenu_view_t view);
/* Set properties on the view based on settings from the specified
theme file. */
grub_err_t grub_gfxmenu_view_load_theme (grub_gfxmenu_view_t view,
const char *theme_path);
grub_err_t grub_gui_recreate_box (grub_gfxmenu_box_t *boxptr,
const char *pattern, const char *theme_dir);
void grub_gfxmenu_view_draw (grub_gfxmenu_view_t view);
void
grub_gfxmenu_redraw_menu (grub_gfxmenu_view_t view);
void
grub_gfxmenu_redraw_timeout (grub_gfxmenu_view_t view);
void
grub_gfxmenu_view_redraw (grub_gfxmenu_view_t view,
const grub_video_rect_t *region);
void
grub_gfxmenu_clear_timeout (void *data);
void
grub_gfxmenu_print_timeout (int timeout, void *data);
void
grub_gfxmenu_set_chosen_entry (int entry, void *data);
/* Implementation details -- this should not be used outside of the
view itself. */
#include <grub/video.h>
#include <grub/bitmap.h>
#include <grub/gui.h>
#include <grub/gfxwidgets.h>
#include <grub/icon_manager.h>
/* Definition of the private representation of the view. */
struct grub_gfxmenu_view
{
grub_video_rect_t screen;
grub_font_t title_font;
grub_font_t message_font;
char *terminal_font_name;
grub_gui_color_t title_color;
grub_gui_color_t message_color;
grub_gui_color_t message_bg_color;
struct grub_video_bitmap *desktop_image;
grub_gui_color_t desktop_color;
grub_gfxmenu_box_t terminal_box;
char *title_text;
char *progress_message_text;
char *theme_path;
grub_gui_container_t canvas;
int double_repaint;
int selected;
grub_video_rect_t progress_message_frame;
grub_menu_t menu;
int nested;
int first_timeout;
};
#endif /* ! GRUB_GFXMENU_VIEW_HEADER */

44
include/grub/gfxterm.h Normal file
View file

@ -0,0 +1,44 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
*
* 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 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_GFXTERM_HEADER
#define GRUB_GFXTERM_HEADER 1
#include <grub/err.h>
#include <grub/types.h>
#include <grub/term.h>
#include <grub/video.h>
grub_err_t
EXPORT_FUNC (grub_gfxterm_set_window) (struct grub_video_render_target *target,
int x, int y, int width, int height,
int double_repaint,
const char *font_name, int border_width);
typedef void (*grub_gfxterm_repaint_callback_t)(int x, int y,
int width, int height);
void grub_gfxterm_set_repaint_callback (grub_gfxterm_repaint_callback_t func);
void EXPORT_FUNC (grub_gfxterm_schedule_repaint) (void);
grub_err_t EXPORT_FUNC (grub_gfxterm_fullscreen) (void);
extern void (*EXPORT_VAR (grub_gfxterm_decorator_hook)) (void);
#endif /* ! GRUB_GFXTERM_HEADER */

49
include/grub/gfxwidgets.h Normal file
View file

@ -0,0 +1,49 @@
/* gfxwidgets.h - Widgets for the graphical menu (gfxmenu). */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
*
* 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 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_GFXWIDGETS_HEADER
#define GRUB_GFXWIDGETS_HEADER 1
#include <grub/video.h>
typedef struct grub_gfxmenu_box *grub_gfxmenu_box_t;
struct grub_gfxmenu_box
{
/* The size of the content. */
int content_width;
int content_height;
struct grub_video_bitmap **raw_pixmaps;
struct grub_video_bitmap **scaled_pixmaps;
void (*draw) (grub_gfxmenu_box_t self, int x, int y);
void (*set_content_size) (grub_gfxmenu_box_t self,
int width, int height);
int (*get_left_pad) (grub_gfxmenu_box_t self);
int (*get_top_pad) (grub_gfxmenu_box_t self);
int (*get_right_pad) (grub_gfxmenu_box_t self);
int (*get_bottom_pad) (grub_gfxmenu_box_t self);
void (*destroy) (grub_gfxmenu_box_t self);
};
grub_gfxmenu_box_t grub_gfxmenu_create_box (const char *pixmaps_prefix,
const char *pixmaps_suffix);
#endif /* ! GRUB_GFXWIDGETS_HEADER */

230
include/grub/gui.h Normal file
View file

@ -0,0 +1,230 @@
/* gui.h - GUI components header file. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* 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 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/types.h>
#include <grub/err.h>
#include <grub/video.h>
#include <grub/bitmap.h>
#include <grub/gfxmenu_view.h>
#ifndef GRUB_GUI_H
#define GRUB_GUI_H 1
/* A representation of a color. Unlike grub_video_color_t, this
representation is independent of any video mode specifics. */
typedef struct grub_gui_color
{
grub_uint8_t red;
grub_uint8_t green;
grub_uint8_t blue;
grub_uint8_t alpha;
} grub_gui_color_t;
typedef struct grub_gui_component *grub_gui_component_t;
typedef struct grub_gui_container *grub_gui_container_t;
typedef struct grub_gui_list *grub_gui_list_t;
typedef void (*grub_gui_component_callback) (grub_gui_component_t component,
void *userdata);
/* Component interface. */
struct grub_gui_component_ops
{
void (*destroy) (void *self);
const char * (*get_id) (void *self);
int (*is_instance) (void *self, const char *type);
void (*paint) (void *self, const grub_video_rect_t *bounds);
void (*set_parent) (void *self, grub_gui_container_t parent);
grub_gui_container_t (*get_parent) (void *self);
void (*set_bounds) (void *self, const grub_video_rect_t *bounds);
void (*get_bounds) (void *self, grub_video_rect_t *bounds);
void (*get_minimal_size) (void *self, unsigned *width, unsigned *height);
grub_err_t (*set_property) (void *self, const char *name, const char *value);
void (*repaint) (void *self, int second_pass);
};
struct grub_gui_container_ops
{
void (*add) (void *self, grub_gui_component_t comp);
void (*remove) (void *self, grub_gui_component_t comp);
void (*iterate_children) (void *self,
grub_gui_component_callback cb, void *userdata);
};
struct grub_gui_list_ops
{
void (*set_view_info) (void *self,
grub_gfxmenu_view_t view);
};
struct grub_gui_progress_ops
{
void (*set_state) (void *self, int visible, int start, int current, int end);
};
typedef signed grub_fixed_signed_t;
#define GRUB_FIXED_1 0x10000
static inline signed
grub_fixed_sfs_divide (signed a, grub_fixed_signed_t b)
{
return (a * GRUB_FIXED_1) / b;
}
static inline grub_fixed_signed_t
grub_fixed_fsf_divide (grub_fixed_signed_t a, signed b)
{
return a / b;
}
static inline signed
grub_fixed_sfs_multiply (signed a, grub_fixed_signed_t b)
{
return (a * b) / GRUB_FIXED_1;
}
static inline signed
grub_fixed_to_signed (grub_fixed_signed_t in)
{
return in / GRUB_FIXED_1;
}
static inline grub_fixed_signed_t
grub_signed_to_fixed (signed in)
{
return in * GRUB_FIXED_1;
}
struct grub_gui_component
{
struct grub_gui_component_ops *ops;
signed x;
grub_fixed_signed_t xfrac;
signed y;
grub_fixed_signed_t yfrac;
signed w;
grub_fixed_signed_t wfrac;
signed h;
grub_fixed_signed_t hfrac;
};
struct grub_gui_progress
{
struct grub_gui_component component;
struct grub_gui_progress_ops *ops;
};
struct grub_gui_container
{
struct grub_gui_component component;
struct grub_gui_container_ops *ops;
};
struct grub_gui_list
{
struct grub_gui_component component;
struct grub_gui_list_ops *ops;
};
/* Interfaces to concrete component classes. */
grub_gui_container_t grub_gui_canvas_new (void);
grub_gui_container_t grub_gui_vbox_new (void);
grub_gui_container_t grub_gui_hbox_new (void);
grub_gui_component_t grub_gui_label_new (void);
grub_gui_component_t grub_gui_image_new (void);
grub_gui_component_t grub_gui_progress_bar_new (void);
grub_gui_component_t grub_gui_list_new (void);
grub_gui_component_t grub_gui_circular_progress_new (void);
/* Manipulation functions. */
/* Visit all components with the specified ID. */
void grub_gui_find_by_id (grub_gui_component_t root,
const char *id,
grub_gui_component_callback cb,
void *userdata);
/* Visit all components. */
void grub_gui_iterate_recursively (grub_gui_component_t root,
grub_gui_component_callback cb,
void *userdata);
/* Helper functions. */
static __inline void
grub_gui_save_viewport (grub_video_rect_t *r)
{
grub_video_get_viewport ((unsigned *) &r->x,
(unsigned *) &r->y,
(unsigned *) &r->width,
(unsigned *) &r->height);
}
static __inline void
grub_gui_restore_viewport (const grub_video_rect_t *r)
{
grub_video_set_viewport (r->x, r->y, r->width, r->height);
}
/* Set a new viewport relative the the current one, saving the current
viewport in OLD so it can be later restored. */
static __inline void
grub_gui_set_viewport (const grub_video_rect_t *r, grub_video_rect_t *old)
{
grub_gui_save_viewport (old);
grub_video_set_viewport (old->x + r->x,
old->y + r->y,
r->width,
r->height);
}
static __inline grub_gui_color_t
grub_gui_color_rgb (int r, int g, int b)
{
grub_gui_color_t c;
c.red = r;
c.green = g;
c.blue = b;
c.alpha = 255;
return c;
}
static __inline grub_video_color_t
grub_gui_map_color (grub_gui_color_t c)
{
return grub_video_map_rgba (c.red, c.green, c.blue, c.alpha);
}
static inline int
grub_video_have_common_points (const grub_video_rect_t *a,
const grub_video_rect_t *b)
{
if (!((a->x <= b->x && b->x <= a->x + a->width)
|| (b->x <= a->x && a->x <= b->x + b->width)))
return 0;
if (!((a->y <= b->y && b->y <= a->y + a->height)
|| (b->y <= a->y && a->y <= b->y + b->height)))
return 0;
return 1;
}
#endif /* ! GRUB_GUI_H */

View file

@ -0,0 +1,37 @@
/* gui_string_util.h - String utilities for the graphical menu interface. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* 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 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_GUI_STRING_UTIL_HEADER
#define GRUB_GUI_STRING_UTIL_HEADER 1
#include <grub/types.h>
#include <grub/gui.h>
char *grub_new_substring (const char *buf,
grub_size_t start, grub_size_t end);
char *grub_resolve_relative_path (const char *base, const char *path);
char *grub_get_dirname (const char *file_path);
int grub_gui_get_named_color (const char *name, grub_gui_color_t *color);
grub_err_t grub_gui_parse_color (const char *s, grub_gui_color_t *color);
#endif /* GRUB_GUI_STRING_UTIL_HEADER */

View file

@ -22,7 +22,6 @@
#include <config.h>
#include <grub/symbol.h>
const char *EXPORT_FUNC(grub_gettext_dummy) (const char *s);
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
/* NLS can be disabled through the configure --disable-nls option. */

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/serial.h>

View file

@ -66,6 +66,8 @@
/* The size of a block list used in the kernel startup code. */
#define GRUB_BOOT_MACHINE_LIST_SIZE 12
#define GRUB_BOOT_MACHINE_PXE_DL 0x7f
#ifndef ASM_FILE
/* This is the blocklist used in the diskboot image. */

View file

@ -19,8 +19,6 @@
#ifndef GRUB_VBE_MACHINE_HEADER
#define GRUB_VBE_MACHINE_HEADER 1
#include <grub/video_fb.h>
/* Default video mode to be used. */
#define GRUB_VBE_DEFAULT_VIDEO_MODE 0x101

View file

@ -0,0 +1,41 @@
/* icon_manager.h - gfxmenu icon manager. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
*
* 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 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_ICON_MANAGER_HEADER
#define GRUB_ICON_MANAGER_HEADER 1
#include <grub/menu.h>
#include <grub/bitmap.h>
/* Forward declaration of opaque structure handle type. */
typedef struct grub_gfxmenu_icon_manager *grub_gfxmenu_icon_manager_t;
grub_gfxmenu_icon_manager_t grub_gfxmenu_icon_manager_new (void);
void grub_gfxmenu_icon_manager_destroy (grub_gfxmenu_icon_manager_t mgr);
void grub_gfxmenu_icon_manager_clear_cache (grub_gfxmenu_icon_manager_t mgr);
void grub_gfxmenu_icon_manager_set_theme_path (grub_gfxmenu_icon_manager_t mgr,
const char *path);
void grub_gfxmenu_icon_manager_set_icon_size (grub_gfxmenu_icon_manager_t mgr,
int width, int height);
struct grub_video_bitmap *
grub_gfxmenu_icon_manager_get_icon (grub_gfxmenu_icon_manager_t mgr,
grub_menu_entry_t entry);
#endif /* GRUB_ICON_MANAGER_HEADER */

View file

@ -138,7 +138,7 @@ int EXPORT_FUNC(grub_ieee1275_read) (grub_ieee1275_ihandle_t ihandle,
void *buffer, grub_size_t len,
grub_ssize_t *actualp);
int EXPORT_FUNC(grub_ieee1275_seek) (grub_ieee1275_ihandle_t ihandle,
int pos_hi, int pos_lo,
grub_disk_addr_t pos,
grub_ssize_t *result);
int EXPORT_FUNC(grub_ieee1275_peer) (grub_ieee1275_phandle_t node,
grub_ieee1275_phandle_t *result);
@ -173,7 +173,15 @@ grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
int EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size);
int
EXPORT_FUNC(grub_ieee1275_map) (grub_addr_t phys, grub_addr_t virt,
grub_size_t size, grub_uint32_t mode);
char *EXPORT_FUNC(grub_ieee1275_encode_devname) (const char *path);
char *EXPORT_FUNC(grub_ieee1275_get_filename) (const char *path);
int EXPORT_FUNC(grub_ieee1275_devices_iterate) (int (*hook)
(struct grub_ieee1275_devalias *
alias));
#endif /* ! GRUB_IEEE1275_HEADER */

View file

@ -59,6 +59,8 @@ extern grub_addr_t grub_arch_modules_addr (void);
extern void EXPORT_FUNC(grub_module_iterate) (int (*hook) (struct grub_module_header *));
grub_addr_t grub_modules_get_end (void);
/* The start point of the C code. */
void grub_main (void);

View file

@ -83,7 +83,6 @@ typedef struct grub_menu_execute_callback
}
*grub_menu_execute_callback_t;
grub_menu_entry_t grub_menu_get_entry (grub_menu_t menu, int no);
int grub_menu_get_timeout (void);
void grub_menu_set_timeout (int timeout);
@ -93,5 +92,6 @@ void grub_menu_execute_with_fallback (grub_menu_t menu,
grub_menu_execute_callback_t callback,
void *callback_data);
void grub_menu_entry_run (grub_menu_entry_t entry);
int grub_menu_get_default_entry_index (grub_menu_t menu);
#endif /* GRUB_MENU_HEADER */

View file

@ -110,6 +110,12 @@ char *EXPORT_FUNC(grub_strstr) (const char *haystack, const char *needle);
int EXPORT_FUNC(grub_isspace) (int c);
int EXPORT_FUNC(grub_isprint) (int c);
static inline int
grub_iscntrl (int c)
{
return (c >= 0x00 && c <= 0x1F) || c == 0x7F;
}
static inline int
grub_isalpha (int c)
{
@ -128,6 +134,12 @@ grub_isdigit (int c)
return (c >= '0' && c <= '9');
}
static inline int
grub_isalnum (int c)
{
return grub_isalpha (c) || grub_isdigit (c);
}
static inline int
grub_tolower (int c)
{
@ -182,6 +194,43 @@ grub_strncasecmp (const char *s1, const char *s2, grub_size_t n)
unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, char **end, int base);
unsigned long long EXPORT_FUNC(grub_strtoull) (const char *str, char **end, int base);
static inline long
grub_strtol (const char *str, char **end, int base)
{
int negative = 0;
unsigned long magnitude;
while (*str && grub_isspace (*str))
str++;
if (*str == '-')
{
negative = 1;
str++;
}
magnitude = grub_strtoull (str, end, base);
if (negative)
{
if (magnitude > (unsigned long) GRUB_LONG_MAX + 1)
{
grub_error (GRUB_ERR_OUT_OF_RANGE, "negative overflow");
return GRUB_LONG_MIN;
}
return -((long) magnitude);
}
else
{
if (magnitude > GRUB_LONG_MAX)
{
grub_error (GRUB_ERR_OUT_OF_RANGE, "positive overflow");
return GRUB_LONG_MAX;
}
return (long) magnitude;
}
}
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);

View file

@ -36,7 +36,7 @@ void *EXPORT_FUNC(grub_realloc) (void *ptr, grub_size_t size);
void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size);
/* For debugging. */
#if defined(MM_DEBUG) && !defined(GRUB_UTIL)
#if defined(MM_DEBUG) && !defined(GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)
/* Set this variable to 1 when you want to trace all memory function calls. */
extern int EXPORT_VAR(grub_mm_debug);

View file

@ -1,70 +0,0 @@
/* multiboot2.h - multiboot2 header file with grub definitions. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2007 Free Software Foundation, Inc.
*
* 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 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MULTIBOOT2_HEADER
#define GRUB_MULTIBOOT2_HEADER 1
#include <grub/types.h>
#include <grub/err.h>
#include <grub/elf.h>
#ifndef GRUB_UTIL
typedef grub_uint32_t uint32_t;
typedef grub_uint64_t uint64_t;
#define __WORDSIZE GRUB_TARGET_WORDSIZE
#endif
struct multiboot2_tag_header;
grub_err_t
grub_mb2_tag_alloc (grub_addr_t *addr, int key, grub_size_t len);
grub_err_t
grub_mb2_tags_arch_create (void);
void
grub_mb2_arch_boot (grub_addr_t entry, void *tags);
void
grub_mb2_arch_unload (struct multiboot2_tag_header *tags);
grub_err_t
grub_mb2_arch_elf32_hook (Elf32_Phdr *phdr, grub_addr_t *addr, int *do_load);
grub_err_t
grub_mb2_arch_elf64_hook (Elf64_Phdr *phdr, grub_addr_t *addr, int *do_load);
grub_err_t
grub_mb2_arch_module_alloc (grub_size_t size, grub_addr_t *addr);
grub_err_t
grub_mb2_arch_module_free (grub_addr_t addr, grub_size_t size);
void
grub_multiboot2 (int argc, char *argv[]);
void
grub_module2 (int argc, char *argv[]);
#define for_each_tag(tag, tags) \
for (tag = tags; \
tag && tag->key != MULTIBOOT2_TAG_END; \
tag = (struct multiboot2_tag_header *)((char *)tag + tag->len))
#endif /* ! GRUB_MULTIBOOT2_HEADER */

View file

@ -110,37 +110,7 @@ void read_terminal_list (void);
void grub_set_more (int onoff);
#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);
void grub_loop_init (void);
void grub_loop_fini (void);
void grub_help_init (void);
void grub_help_fini (void);
void grub_halt_init (void);
void grub_halt_fini (void);
void grub_reboot_init (void);
void grub_reboot_fini (void);
void grub_configfile_init (void);
void grub_configfile_fini (void);
void grub_search_init (void);
void grub_search_fini (void);
void grub_test_init (void);
void grub_test_fini (void);
void grub_blocklist_init (void);
void grub_blocklist_fini (void);
#endif
int grub_normal_get_line_counter (void);
void grub_install_newline_hook (void);
#endif /* ! GRUB_NORMAL_HEADER */

View file

@ -83,20 +83,6 @@ void EXPORT_FUNC(grub_partition_map_register) (grub_partition_map_t partmap);
void EXPORT_FUNC(grub_partition_map_unregister) (grub_partition_map_t partmap);
#ifdef GRUB_UTIL
void grub_msdos_partition_map_init (void);
void grub_msdos_partition_map_fini (void);
void grub_amiga_partition_map_init (void);
void grub_amiga_partition_map_fini (void);
void grub_apple_partition_map_init (void);
void grub_apple_partition_map_fini (void);
void grub_sun_partition_map_init (void);
void grub_sun_partition_map_fini (void);
void grub_gpt_partition_map_init (void);
void grub_gpt_partition_map_fini (void);
void grub_apple_partition_map_init (void);
void grub_apple_partition_map_fini (void);
#endif
static inline grub_disk_addr_t
grub_partition_get_start (const grub_partition_t p)

View file

@ -68,7 +68,7 @@
typedef grub_uint32_t grub_pci_id_t;
#ifdef GRUB_UTIL
#ifdef GRUB_MACHINE_EMU
#include <grub/pciutils.h>
#else
typedef grub_uint32_t grub_pci_address_t;

View file

@ -22,6 +22,7 @@
#include <grub/types.h>
#define GRUB_IEEE1275_CELL_SIZEOF 4
typedef grub_uint32_t grub_ieee1275_cell_t;
#endif /* ! GRUB_IEEE1275_MACHINE_HEADER */

View file

@ -33,3 +33,42 @@ void EXPORT_FUNC (__trampoline_setup) (void);
#ifdef HAVE___UCMPDI2
void EXPORT_FUNC (__ucmpdi2) (void);
#endif
#ifdef HAVE__RESTGPR_14_X
void EXPORT_FUNC (_restgpr_14_x) (void);
void EXPORT_FUNC (_restgpr_15_x) (void);
void EXPORT_FUNC (_restgpr_16_x) (void);
void EXPORT_FUNC (_restgpr_17_x) (void);
void EXPORT_FUNC (_restgpr_18_x) (void);
void EXPORT_FUNC (_restgpr_19_x) (void);
void EXPORT_FUNC (_restgpr_20_x) (void);
void EXPORT_FUNC (_restgpr_21_x) (void);
void EXPORT_FUNC (_restgpr_22_x) (void);
void EXPORT_FUNC (_restgpr_23_x) (void);
void EXPORT_FUNC (_restgpr_24_x) (void);
void EXPORT_FUNC (_restgpr_25_x) (void);
void EXPORT_FUNC (_restgpr_26_x) (void);
void EXPORT_FUNC (_restgpr_27_x) (void);
void EXPORT_FUNC (_restgpr_28_x) (void);
void EXPORT_FUNC (_restgpr_29_x) (void);
void EXPORT_FUNC (_restgpr_30_x) (void);
void EXPORT_FUNC (_restgpr_31_x) (void);
void EXPORT_FUNC (_savegpr_14) (void);
void EXPORT_FUNC (_savegpr_15) (void);
void EXPORT_FUNC (_savegpr_16) (void);
void EXPORT_FUNC (_savegpr_17) (void);
void EXPORT_FUNC (_savegpr_18) (void);
void EXPORT_FUNC (_savegpr_19) (void);
void EXPORT_FUNC (_savegpr_20) (void);
void EXPORT_FUNC (_savegpr_21) (void);
void EXPORT_FUNC (_savegpr_22) (void);
void EXPORT_FUNC (_savegpr_23) (void);
void EXPORT_FUNC (_savegpr_24) (void);
void EXPORT_FUNC (_savegpr_25) (void);
void EXPORT_FUNC (_savegpr_26) (void);
void EXPORT_FUNC (_savegpr_27) (void);
void EXPORT_FUNC (_savegpr_28) (void);
void EXPORT_FUNC (_savegpr_29) (void);
void EXPORT_FUNC (_savegpr_30) (void);
void EXPORT_FUNC (_savegpr_31) (void);
#endif

View file

@ -145,7 +145,7 @@ struct grub_script_cmd_menuentry
struct grub_script_arglist *arglist;
/* The sourcecode the entry will be generated from. */
char *sourcecode;
const char *sourcecode;
/* Options. XXX: Not used yet. */
int options;

View file

@ -25,7 +25,8 @@
#define BOOTDEV_REG %l6
#define PIC_REG %l7
#define SCRATCH_PAD 0x10000
#define SCRATCH_PAD_BOOT 0x5000
#define SCRATCH_PAD_DISKBOOT 0x4000
#define GET_ABS(symbol, reg) \
add PIC_REG, (symbol - pic_base), reg
@ -51,7 +52,7 @@
#define GRUB_BOOT_MACHINE_LIST_SIZE 12
#define GRUB_BOOT_MACHINE_IMAGE_ADDRESS 0x200000
#define GRUB_BOOT_MACHINE_IMAGE_ADDRESS 0x4400
#define GRUB_BOOT_MACHINE_KERNEL_ADDR 0x4200

View file

@ -22,6 +22,7 @@
#include <grub/types.h>
#define GRUB_IEEE1275_CELL_SIZEOF 8
typedef grub_uint64_t grub_ieee1275_cell_t;
/* Encoding of 'mode' argument to grub_ieee1275_map_physical() */
@ -36,14 +37,12 @@ typedef grub_uint64_t grub_ieee1275_cell_t;
#define IEEE1275_MAP_DEFAULT (IEEE1275_MAP_WRITE | IEEE1275_MAP_READ | \
IEEE1275_MAP_EXEC | IEEE1275_MAP_CACHED)
extern int EXPORT_FUNC(grub_ieee1275_map_physical) (grub_addr_t paddr,
grub_addr_t vaddr,
grub_size_t size,
grub_uint32_t mode);
extern int EXPORT_FUNC(grub_ieee1275_claim_vaddr) (grub_addr_t vaddr,
grub_size_t size);
extern int EXPORT_FUNC(grub_ieee1275_alloc_physmem) (grub_addr_t *paddr,
grub_size_t size,
grub_uint32_t align);
extern grub_addr_t EXPORT_VAR (grub_ieee1275_original_stack);
#endif /* ! GRUB_IEEE1275_MACHINE_HEADER */

View file

@ -39,8 +39,24 @@
/* End of the data section. */
#define GRUB_KERNEL_MACHINE_DATA_END 0x114
#define GRUB_KERNEL_MACHINE_RAW_SIZE 0
#define GRUB_KERNEL_MACHINE_STACK_SIZE 0x40000
#define GRUB_PLATFORM_IMAGE_FORMATS "raw, aout"
#define GRUB_PLATFORM_IMAGE_DEFAULT_FORMAT "raw"
#define GRUB_PLATFORM_IMAGE_DEFAULT GRUB_PLATFORM_IMAGE_RAW
#ifndef ASM_FILE
typedef enum {
GRUB_PLATFORM_IMAGE_RAW,
GRUB_PLATFORM_IMAGE_AOUT
}
grub_platform_image_format_t;
#define GRUB_PLATFORM_IMAGE_RAW GRUB_PLATFORM_IMAGE_RAW
#define GRUB_PLATFORM_IMAGE_AOUT GRUB_PLATFORM_IMAGE_AOUT
#include <grub/symbol.h>
#include <grub/types.h>

View file

@ -25,6 +25,8 @@
#if defined (GRUB_MACHINE_EMU) || defined (GRUB_UTIL)
#define GRUB_TICKS_PER_SECOND 100000
/* Return the real time in ticks. */
grub_uint32_t EXPORT_FUNC (grub_get_rtc) (void);
#else
#include <grub/machine/time.h>
#endif

44
include/grub/trig.h Normal file
View file

@ -0,0 +1,44 @@
/* trig.h - Trigonometric function support. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
*
* 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 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_TRIG_HEADER
#define GRUB_TRIG_HEADER 1
#define GRUB_TRIG_ANGLE_MAX 256
#define GRUB_TRIG_ANGLE_MASK 255
#define GRUB_TRIG_FRACTION_SCALE 16384
extern short grub_trig_sintab[];
extern short grub_trig_costab[];
static __inline int
grub_sin (int x)
{
x &= GRUB_TRIG_ANGLE_MASK;
return grub_trig_sintab[x];
}
static __inline int
grub_cos (int x)
{
x &= GRUB_TRIG_ANGLE_MASK;
return grub_trig_costab[x];
}
#endif /* ! GRUB_TRIG_HEADER */

View file

@ -223,4 +223,10 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
# endif
#endif /* ! WORDS_BIGENDIAN */
#if GRUB_TARGET_SIZEOF_VOID_P == 8
# define grub_host_to_target_addr(x) grub_host_to_target64(x)
#else
# define grub_host_to_target_addr(x) grub_host_to_target32(x)
#endif
#endif /* ! GRUB_TYPES_HEADER */

View file

@ -34,6 +34,10 @@ struct grub_video_render_target;
struct grub_video_bitmap;
/* Defines used to describe video mode or rendering target. */
/* If following is set render target contains currenly displayed image
after swapping buffers (otherwise it contains previously displayed image).
*/
#define GRUB_VIDEO_MODE_TYPE_UPDATING_SWAP 0x00000080
#define GRUB_VIDEO_MODE_TYPE_PURE_TEXT 0x00000040
#define GRUB_VIDEO_MODE_TYPE_ALPHA 0x00000020
#define GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED 0x00000010
@ -48,6 +52,8 @@ struct grub_video_bitmap;
#define GRUB_VIDEO_MODE_TYPE_DEPTH_MASK 0x0000ff00
#define GRUB_VIDEO_MODE_TYPE_DEPTH_POS 8
/* The basic render target representing the whole display. This always
renders to the back buffer when double-buffering is in use. */
#define GRUB_VIDEO_RENDER_TARGET_DISPLAY \
((struct grub_video_render_target *) 0)
@ -151,6 +157,16 @@ struct grub_video_mode_info
grub_uint8_t fg_alpha;
};
/* A 2D rectangle type. */
struct grub_video_rect
{
unsigned x;
unsigned y;
unsigned width;
unsigned height;
};
typedef struct grub_video_rect grub_video_rect_t;
struct grub_video_palette_data
{
grub_uint8_t r; /* Red color value (0-255). */
@ -243,13 +259,13 @@ struct grub_video_adapter
};
typedef struct grub_video_adapter *grub_video_adapter_t;
void grub_video_register (grub_video_adapter_t adapter);
void EXPORT_FUNC (grub_video_register) (grub_video_adapter_t adapter);
void grub_video_unregister (grub_video_adapter_t adapter);
void grub_video_iterate (int (*hook) (grub_video_adapter_t adapter));
grub_err_t grub_video_restore (void);
grub_err_t EXPORT_FUNC (grub_video_restore) (void);
grub_err_t grub_video_get_info (struct grub_video_mode_info *mode_info);
grub_err_t EXPORT_FUNC (grub_video_get_info) (struct grub_video_mode_info *mode_info);
/* Framebuffer address may change as a part of normal operation
(e.g. double buffering). That's why you need to stop video subsystem to be
@ -267,57 +283,71 @@ grub_err_t grub_video_set_palette (unsigned int start, unsigned int count,
grub_err_t grub_video_get_palette (unsigned int start, unsigned int count,
struct grub_video_palette_data *palette_data);
grub_err_t grub_video_set_viewport (unsigned int x, unsigned int y,
unsigned int width, unsigned int height);
grub_err_t EXPORT_FUNC (grub_video_set_viewport) (unsigned int x,
unsigned int y,
unsigned int width,
unsigned int height);
grub_err_t grub_video_get_viewport (unsigned int *x, unsigned int *y,
unsigned int *width, unsigned int *height);
grub_err_t EXPORT_FUNC (grub_video_get_viewport) (unsigned int *x,
unsigned int *y,
unsigned int *width,
unsigned int *height);
grub_video_color_t grub_video_map_color (grub_uint32_t color_name);
grub_video_color_t EXPORT_FUNC (grub_video_map_color) (grub_uint32_t color_name);
grub_video_color_t grub_video_map_rgb (grub_uint8_t red, grub_uint8_t green,
grub_uint8_t blue);
grub_video_color_t EXPORT_FUNC (grub_video_map_rgb) (grub_uint8_t red,
grub_uint8_t green,
grub_uint8_t blue);
grub_video_color_t grub_video_map_rgba (grub_uint8_t red, grub_uint8_t green,
grub_uint8_t blue, grub_uint8_t alpha);
grub_video_color_t EXPORT_FUNC (grub_video_map_rgba) (grub_uint8_t red,
grub_uint8_t green,
grub_uint8_t blue,
grub_uint8_t alpha);
grub_err_t grub_video_unmap_color (grub_video_color_t color,
grub_uint8_t *red, grub_uint8_t *green,
grub_uint8_t *blue, grub_uint8_t *alpha);
grub_err_t EXPORT_FUNC (grub_video_unmap_color) (grub_video_color_t color,
grub_uint8_t *red,
grub_uint8_t *green,
grub_uint8_t *blue,
grub_uint8_t *alpha);
grub_err_t grub_video_fill_rect (grub_video_color_t color, int x, int y,
unsigned int width, unsigned int height);
grub_err_t EXPORT_FUNC (grub_video_fill_rect) (grub_video_color_t color,
int x, int y,
unsigned int width,
unsigned int height);
grub_err_t grub_video_blit_bitmap (struct grub_video_bitmap *bitmap,
enum grub_video_blit_operators oper,
int x, int y, int offset_x, int offset_y,
unsigned int width, unsigned int height);
grub_err_t EXPORT_FUNC (grub_video_blit_bitmap) (struct grub_video_bitmap *bitmap,
enum grub_video_blit_operators oper,
int x, int y,
int offset_x, int offset_y,
unsigned int width,
unsigned int height);
grub_err_t grub_video_blit_render_target (struct grub_video_render_target *source,
enum grub_video_blit_operators oper,
int x, int y,
int offset_x, int offset_y,
unsigned int width,
unsigned int height);
grub_err_t EXPORT_FUNC (grub_video_blit_render_target) (struct grub_video_render_target *source,
enum grub_video_blit_operators oper,
int x, int y,
int offset_x,
int offset_y,
unsigned int width,
unsigned int height);
grub_err_t grub_video_scroll (grub_video_color_t color, int dx, int dy);
grub_err_t grub_video_swap_buffers (void);
grub_err_t EXPORT_FUNC (grub_video_swap_buffers) (void);
grub_err_t grub_video_create_render_target (struct grub_video_render_target **result,
unsigned int width,
unsigned int height,
unsigned int mode_type);
grub_err_t EXPORT_FUNC (grub_video_create_render_target) (struct grub_video_render_target **result,
unsigned int width,
unsigned int height,
unsigned int mode_type);
grub_err_t grub_video_delete_render_target (struct grub_video_render_target *target);
grub_err_t EXPORT_FUNC (grub_video_delete_render_target) (struct grub_video_render_target *target);
grub_err_t grub_video_set_active_render_target (struct grub_video_render_target *target);
grub_err_t EXPORT_FUNC (grub_video_set_active_render_target) (struct grub_video_render_target *target);
grub_err_t grub_video_get_active_render_target (struct grub_video_render_target **target);
grub_err_t grub_video_set_mode (const char *modestring,
unsigned int modemask,
unsigned int modevalue);
grub_err_t EXPORT_FUNC (grub_video_set_mode) (const char *modestring,
unsigned int modemask,
unsigned int modevalue);
static inline int
grub_video_check_mode_flag (unsigned int flags, unsigned int mask,

View file

@ -115,4 +115,15 @@ grub_video_fb_get_active_render_target (struct grub_video_fbrender_target **targ
grub_err_t
grub_video_fb_set_active_render_target (struct grub_video_fbrender_target *target);
typedef grub_err_t
(*grub_video_fb_doublebuf_update_screen_t) (struct grub_video_fbrender_target *front,
struct grub_video_fbrender_target *back);
grub_err_t
grub_video_fb_doublebuf_blit_init (struct grub_video_fbrender_target **front,
struct grub_video_fbrender_target **back,
grub_video_fb_doublebuf_update_screen_t *update_screen,
struct grub_video_mode_info mode_info,
void *framebuf);
#endif /* ! GRUB_VIDEO_FB_HEADER */

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/serial.h>

View file

@ -108,5 +108,8 @@ extern grub_uint32_t grub_xnu_heap_real_start;
extern grub_size_t grub_xnu_heap_size;
extern void *grub_xnu_heap_start;
extern struct grub_video_bitmap *grub_xnu_bitmap;
typedef enum {GRUB_XNU_BITMAP_CENTER, GRUB_XNU_BITMAP_STRETCH}
grub_xnu_bitmap_mode_t;
extern grub_xnu_bitmap_mode_t grub_xnu_bitmap_mode;
extern int grub_xnu_is_64bit;
#endif