Merge branch 'mainline' into relocator
Conflicts: loader/i386/multiboot.c
This commit is contained in:
commit
5e03640baf
56 changed files with 2847 additions and 4824 deletions
362
ChangeLog
362
ChangeLog
|
@ -1,3 +1,365 @@
|
|||
2009-08-22 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* commands/xnu_uuid.c (transform): Use grub_memcpy instead of memcpy.
|
||||
|
||||
2009-08-21 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* Makefile.in (install-local): When checking if a file is in the
|
||||
build directory, use "test -e" to detect symlinks.
|
||||
|
||||
* Makefile.in (install-local): Remove all files in
|
||||
$(DESTDIR)$(pkglibdir) before installing new files there.
|
||||
|
||||
2009-08-18 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* util/powerpc/ieee1275/grub-mkrescue.in (grub_mkimage): Use
|
||||
grub-mkelfimage.
|
||||
|
||||
2009-08-18 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* util/grub-mkconfig.in: Don't use gfxterm by default if not
|
||||
explicitly specified by the user.
|
||||
|
||||
2009-08-18 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* include/grub/fbfill.h (struct grub_video_fbrender_target): Use
|
||||
grub_uint8_t pointer for data.
|
||||
* include/grub/fbutil.h (struct grub_video_fbblit_info):
|
||||
Likewise.
|
||||
* video/fb/fbutil.c: Remove unnecessary casts.
|
||||
|
||||
2009-08-17 Michal Suchanek <hramrach@centrum.cz>
|
||||
|
||||
VBE cleanup.
|
||||
|
||||
* video/i386/pc/vbe.c (vbe_mode_in_use): Removed (duplicate).
|
||||
(grub_vbe_set_video_mode): Save active mode info
|
||||
only after setting the mode.
|
||||
(grub_video_vbe_setup): Call 'grub_vbe_set_video_mode' with NULL as
|
||||
second argument.
|
||||
|
||||
2009-08-17 Michal Suchanek <hramrach@centrum.cz>
|
||||
|
||||
Rename variables for clarity.
|
||||
|
||||
* video/i386/pc/vbe.c (active_mode_info): Renamed to ...
|
||||
(active_vbe_mode_info): ... this. All users updated.
|
||||
(framebuffer): Rename 'active_mode' to 'active_vbe_mode'.
|
||||
All users updated.
|
||||
(initial_mode): Rename to ...
|
||||
(initial_vbe_mode): ... this. All users updated.
|
||||
(mode_in_use): Rename to ..
|
||||
(vbe_mode_in_use): ... this. All users updated.
|
||||
(mode_list): Rename to ..
|
||||
(vbe_mode_list): ... this. All users updated.
|
||||
(grub_vbe_set_video_mode): Rename 'mode' to 'vbe_mode', 'mode_info' to
|
||||
'vbe_mode_info' and 'old_mode' to 'old_vbe_mode'.
|
||||
(grub_video_vbe_init): Rename 'rm_mode_list' to 'rm_vbe_mode_list' and
|
||||
'mode_list_size' to 'vbe_mode_list_size'.
|
||||
(grub_video_vbe_setup): Rename 'mode_info' to 'vbe_mode_info',
|
||||
'best_mode_info' to 'best_vbe_mode_info' and
|
||||
'best_mode' to 'best_vbe_mode'
|
||||
|
||||
2009-08-17 Michal Suchanek <hramrach@centrum.cz>
|
||||
|
||||
Remove duplicate grub_video_fb_get_video_ptr.
|
||||
|
||||
* include/grub/fbutil.h (get_data_ptr): Rename to ...
|
||||
(grub_video_fb_get_video_ptr): ... this.
|
||||
* include/grub/video_fb.h (grub_video_fb_get_video_ptr): Removed.
|
||||
* video/fb/fbutil.c: Add comment about addressing.
|
||||
(get_data_ptr): Rename to ...
|
||||
(grub_video_fb_get_video_ptr): ... this. All users updated.
|
||||
* video/fb/video_fb.c (grub_video_fb_get_video_ptr): Remove.
|
||||
|
||||
2009-08-17 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* fs/fat.c (grub_fat_read_data): Remove `#if 0' braces around the
|
||||
grub_dprintf() that was just added.
|
||||
|
||||
2009-08-17 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* loader/i386/linux.c (GRUB_ASSUME_LINUX_HAS_FB_SUPPORT)
|
||||
(DEFAULT_VIDEO_MODE): Remove macros.
|
||||
(grub_linux_boot): Remove assumption that Linux has FB support,
|
||||
and use "text" as default video mode.
|
||||
|
||||
2009-08-15 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* fs/affs.c (grub_affs_read_symlink): Change leftover grub_printf into
|
||||
grub_dprintf.
|
||||
* fs/fat.c (grub_fat_read_data): Likewise.
|
||||
|
||||
2009-08-14 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* loader/i386/multiboot.c (grub_multiboot): Don't pass filename to
|
||||
payload.
|
||||
(grub_module): Likewise.
|
||||
|
||||
2009-08-14 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* loader/i386/multiboot.c (grub_multiboot_unload): Don't free mbi and
|
||||
mbi->cmdline but free playground.
|
||||
|
||||
2009-08-14 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Handle group offset on UFS1.
|
||||
|
||||
* fs/ufs.c (grub_ufs_sblock): New field 'cylg_mask'.
|
||||
(grub_ufs_read_inode) [!MODE_UFS2]: handle cylg_offset and cylg_mask.
|
||||
|
||||
2009-08-14 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Split ufs.mod into ufs1.mod and ufs2.mod.
|
||||
|
||||
* conf/common.rmk (grub_probe_SOURCES): Add fs/ufs2.c.
|
||||
(grub_fstest_SOURCES): Likewise.
|
||||
(pkglib_MODULES): Remove ufs.mod. Add ufs1.mod and ufs2.mod.
|
||||
(ufs_mod_SOURCES): Remove.
|
||||
(ufs_mod_CFLAGS): Likewise.
|
||||
(ufs_mod_LDFLAGS): Likewise.
|
||||
(ufs1_mod_SOURCES): New variable.
|
||||
(ufs1_mod_CFLAGS): Likewise.
|
||||
(ufs1_mod_LDFLAGS): Likewise.
|
||||
(ufs2_mod_SOURCES): New variable.
|
||||
(ufs2_mod_CFLAGS): Likewise.
|
||||
(ufs2_mod_LDFLAGS): Likewise.
|
||||
* conf/i386-coreboot.rmk (grub_emu_SOURCES): Add fs/ufs2.c.
|
||||
* conf/i386-efi.rmk (util/i386/efi/grub-mkimage.c_DEPENDENCIES):
|
||||
Likewise.
|
||||
(grub_emu_SOURCES): Likewise.
|
||||
* conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise.
|
||||
* conf/i386-pc.rmk (grub_emu_SOURCES): Likewise.
|
||||
(grub_setup_SOURCES): Likewise.
|
||||
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
|
||||
* conf/sparc64.rmk (grub_emu_SOURCES): Likewise.
|
||||
(grub_setup_SOURCES): Likewise.
|
||||
* conf/x86_64-efi.rmk (util/i386/efi/grub-mkimage.c_DEPENDENCIES):
|
||||
Likewise.
|
||||
* fs/ufs2.c: New file.
|
||||
* fs/ufs.c: Separate UFS1 from UFS2 by using preprocessor.
|
||||
|
||||
2009-08-14 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Framebuffer split.
|
||||
|
||||
* commands/i386/pc/vbetest.c (grub_cmd_vbetest): Restore video
|
||||
subsystem at the end.
|
||||
* conf/common.rmk (pkglib_MODULES): Add video_fb.mod.
|
||||
(video_fb_mod_SOURCES): New variable.
|
||||
(video_fb_mod_CFLAGS): Likewise.
|
||||
(video_fb_mod_LDFLAGS): Likewise.
|
||||
* conf/i386-pc.rmk (vbe_mod_SOURCES): Remove video/i386/pc/vbeblit.c,
|
||||
video/i386/pc/vbefill.c and video/i386/pc/vbeutil.c.
|
||||
* video/i386/pc/vbeblit.c: Moved from here ...
|
||||
* video/fb/fbblit.c: ..here. Replaced 'vbe' with 'fb'.
|
||||
* video/i386/pc/vbefill.c: Moved from here ...
|
||||
* video/fb/fbfill.c: ..here. Replaced 'vbe' with 'fb'.
|
||||
* video/i386/pc/vbeutil.c: Moved from here ...
|
||||
* video/fb/fbutil.c: ..here. Replaced 'vbe' with 'fb'.
|
||||
* include/grub/i386/pc/vbeblit.h: Moved from here ...
|
||||
* include/grub/fbblit.h: ... here. Replaced 'vbe' with 'fb'.
|
||||
* include/grub/i386/pc/vbefill.h: Moved from here ...
|
||||
* include/grub/fbfill.h: ... here. Replaced 'vbe' with 'fb'.
|
||||
* include/grub/i386/pc/vbeutil.h: Moved from here ...
|
||||
* include/grub/fbutil.h: ... here. Replaced 'vbe' with 'fb'.
|
||||
* include/grub/i386/pc/vbe.h: Moved framebuffer part ...
|
||||
* include/grub/video_fb.h: ... here. Replaced 'vbe' with 'fb'.
|
||||
* include/grub/video.h (GRUB_VIDEO_RENDER_TARGET_FRONT_BUFFER): Removed.
|
||||
(GRUB_VIDEO_RENDER_TARGET_BACK_BUFFER): Likewise.
|
||||
(grub_video_adapter): Added 'get_info_and_fini'.
|
||||
(grub_video_get_info_and_fini): New prototype.
|
||||
(grub_video_set_mode): make modestring const char *.
|
||||
* loader/i386/linux.c (grub_linux_setup_video): Use
|
||||
grub_video_get_info_and_fini.
|
||||
(grub_linux_boot): Move modesetting just before booting.
|
||||
* loader/i386/pc/xnu.c (grub_xnu_set_video): Use
|
||||
grub_video_get_info_and_fini.
|
||||
* video/i386/pc/vbe.c: Moved framebuffer part ...
|
||||
* video/fb/video_fb.c: ... here. Replaced 'vbe' with 'fb'.
|
||||
* video/i386/pc/vbe.c (grub_vbe_set_video_mode): Use
|
||||
grub_video_fbstd_colors and grub_video_fb_set_palette.
|
||||
(grub_video_vbe_init): Clear 'framebuffer' variable and use
|
||||
grub_video_fb_init.
|
||||
(grub_video_vbe_fini): Use grub_video_fb_fini.
|
||||
(grub_video_vbe_setup): Use framebuffer.render_target instead of
|
||||
render_target and use grub_video_fb_set_active_render_target and
|
||||
grub_video_fb_set_palette.
|
||||
(grub_video_vbe_set_palette): Use grub_video_fb_set_palette.
|
||||
(grub_video_vbe_set_viewport): Use grub_video_fb_set_viewport.
|
||||
(grub_video_vbe_adapter): Use framebuffer.
|
||||
* video/video.c (grub_video_get_info_and_fini): New function.
|
||||
(grub_video_set_mode): Make modestring const char *.
|
||||
(GRUB_MOD_INIT(video_video)): Don't set variables to 0 since these
|
||||
values are already initialised.
|
||||
|
||||
2009-08-14 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* boot/i386/pc/cdboot.S: Use LOCAL for local labels. Eliminate
|
||||
ABS and APPLE_CC.
|
||||
* boot/i386/pc/diskboot.S: Likewise.
|
||||
* boot/i386/pc/lnxboot.S: Likewise. Hardcode the number of code
|
||||
sectors allow compilation on MacOSX.
|
||||
* conf/i386-pc.rmk: Enable unconditional compilation of
|
||||
lnxboot.img.
|
||||
|
||||
2009-08-13 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-mkconfig.in: Export GRUB_HIDDEN_TIMEOUT.
|
||||
* util/grub.d/00_header.in: Enter interruptible sleep if
|
||||
GRUB_HIDDEN_TIMEOUT is set.
|
||||
|
||||
2009-08-13 Yves Blusseau <blusseau@zetam.org>
|
||||
|
||||
* include/grub/symbol.h: Add the LOCAL macro.
|
||||
* boot/i386/pc/boot.S: Use the LOCAL macro for all labels
|
||||
starting with "L_".
|
||||
|
||||
2009-08-13 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* boot/i386/pc/boot.S: Remove ABS macro, it's not required by
|
||||
any modern compilers we support.
|
||||
|
||||
* boot/i386/pc/boot.S: Remove all code dependent on APPLE_CC.
|
||||
Use local labels starting with "L_" so that Apple assembler
|
||||
knows they are local.
|
||||
|
||||
2009-08-10 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* include/grub/i386/bsd.h (KERNEL_TYPE_NONE, KERNEL_TYPE_FREEBSD)
|
||||
(KERNEL_TYPE_OPENBSD, KERNEL_TYPE_NETBSD): Convert to ...
|
||||
(bsd_kernel_types): ... this enum.
|
||||
|
||||
* loader/i386/bsd.c (grub_cmd_freebsd_loadenv, grub_cmd_freebsd_module)
|
||||
(grub_cmd_freebsd_module_elf): Abort with "You need to load the
|
||||
kernel first." when `kernel_type' is set to KERNEL_TYPE_NONE.
|
||||
|
||||
(grub_bsd_load_aout, grub_bsd_load, grub_cmd_freebsd_loadenv)
|
||||
(grub_cmd_freebsd_module, grub_cmd_freebsd_module_elf)
|
||||
(GRUB_MOD_INIT (bsd)): Fix capitalization in a few error
|
||||
messages.
|
||||
|
||||
2009-08-08 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* util/grub-dumpdevtree: Moved from here ...
|
||||
* util/i386/efi/grub-dumpdevtree: ... to here.
|
||||
(hexify): New function. Converts a string to its hex version.
|
||||
Generate hex versions of "efi" and "device-properties" by calling
|
||||
hexify() on the ASCII strings rather than by hardcoding numbers.
|
||||
|
||||
2009-08-08 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* fs/jfs.c: Update copyright year.
|
||||
|
||||
2009-08-08 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* util/grub.d/00_header.in: Fix a comment.
|
||||
* util/grub.d/10_linux.in: Likewise.
|
||||
* util/grub.d/10_windows.in: Likewise.
|
||||
* util/grub.d/10_hurd.in: Likewise.
|
||||
|
||||
2009-08-08 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* util/grub-mkconfig.in: Allow the user to specify the used font
|
||||
with GRUB_FONT.
|
||||
|
||||
2009-08-08 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* include/grub/powerpc/libgcc.h: Export __ashrdi3() if
|
||||
available, xfs.mod needs it now.
|
||||
|
||||
* util/grub-mkconfig_lib.in (version_test_numeric): Don't use
|
||||
the "g" modifier in sed when the intention is to strip something
|
||||
once. This fixes comparison of kernels with multiple dashes.
|
||||
|
||||
* util/grub-mkconfig.in: Define datarootdir, datadir may depend
|
||||
on it. Add missing space before closing bracket. Fix
|
||||
misleading formatting.
|
||||
|
||||
2009-08-07 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* docs/grub.texi: Major overhaul. Remove all sections that are
|
||||
specific to GRUB Legacy, or mostly composed of Legacy-specific
|
||||
information.
|
||||
|
||||
2009-08-07 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* docs/version.texi: New file. Provides version information for
|
||||
grub.texi.
|
||||
|
||||
2009-08-07 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* docs/grub.texi: Update CVS information to SVN.
|
||||
Replace outdated "GRUB 2 will include" phrase with "GRUB 2 includes".
|
||||
|
||||
2009-08-07 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* util/grub-mkconfig.in: Remove a wrong `fi'.
|
||||
|
||||
2009-08-07 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* fs/uuid.c (grub_jfs_superblock): New fields unused2 and uuid.
|
||||
(grub_jfs_uuid): New function.
|
||||
(grub_jfs_fs): Set uuid field to grub_jfs_uuid.
|
||||
|
||||
2009-08-07 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* util/grub-mkconfig_lib.in (font_path): Move the functionality
|
||||
of it to ...
|
||||
* util/grub-mkconfig.in: ... here. Prefer unicode.pf2 and
|
||||
unifont.pf2 over ascii.pf2. Export LANG=C in case ascii.pf2 gets used.
|
||||
|
||||
2009-08-07 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* util/grub.d/10_linux.in (test_numeric): Moved from here ...
|
||||
* util/grub-mkconfig_lib.in (version_test_numeric): ... to here.
|
||||
Update all users.
|
||||
|
||||
* util/grub.d/10_linux.in (test_gt): Strip any basename prefix,
|
||||
not just "vmlinu[zx]".
|
||||
Moved from here ...
|
||||
* util/grub-mkconfig_lib.in (version_test_gt): ... to here. Update
|
||||
all users.
|
||||
|
||||
* util/grub.d/10_linux.in (find_latest): Moved from here ...
|
||||
* util/grub-mkconfig_lib.in (version_find_latest): ... to here. Update
|
||||
all users.
|
||||
|
||||
2009-08-07 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* util/grub.d/10_freebsd.in: Use an absolute device path for
|
||||
`vfs.root.mountfrom'. Set `vfs.root.mountfrom.options=rw'.
|
||||
|
||||
2009-08-06 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* util/grub-mkconfig_lib.in (prepare_grub_to_access_device): Fix
|
||||
handling of multiple abstraction modules.
|
||||
|
||||
2009-08-04 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
Fix a bug resulting in black screen when loading Linux using a
|
||||
packed video mode.
|
||||
|
||||
* kern/i386/pc/startup.S (grub_vbe_bios_getset_dac_palette_width): New
|
||||
function.
|
||||
|
||||
* include/grub/i386/pc/vbe.h (GRUB_VBE_CAPABILITY_DACWIDTH): New macro.
|
||||
(grub_vbe_bios_getset_dac_palette_width): New function.
|
||||
(grub_vbe_bios_get_dac_palette_width)
|
||||
(grub_vbe_bios_set_dac_palette_width): New macros (act as wrappers for
|
||||
grub_vbe_bios_getset_dac_palette_width()).
|
||||
|
||||
* video/i386/pc/vbe.c (grub_vbe_probe): Use `GRUB_VBE_STATUS_OK' to
|
||||
check for return status.
|
||||
(grub_vbe_get_video_mode_info): When getting information for a packed
|
||||
mode (<= 8 bpp), obtain DAC palette width using
|
||||
grub_vbe_bios_getset_dac_palette_width(), and use that for initializing
|
||||
{red,green,blue}_mark_size.
|
||||
|
||||
2009-08-04 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* commands/search.c (options): Fix help output to match actual code.
|
||||
|
||||
2009-08-02 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* commands/hexdump.c (grub_cmd_hexdump): Use grub_disk_read instead
|
||||
|
|
|
@ -212,6 +212,7 @@ install: install-local
|
|||
|
||||
install-local: all
|
||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(pkglibdir)
|
||||
rm -f $(DESTDIR)$(pkglibdir)/*
|
||||
@list='$(PKGLIB)'; \
|
||||
for file in $$list; do \
|
||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||
|
@ -221,7 +222,7 @@ install-local: all
|
|||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(includedir)
|
||||
@list='$(include_DATA)'; \
|
||||
for file in $$list; do \
|
||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||
if test -e "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||
dest="`echo $$file | sed 's,include/,,'`"; \
|
||||
destdir="`echo $$dest | sed 's,[^/]*$$,,g'`"; \
|
||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(includedir)/$$destdir; \
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/boot.h>
|
||||
#include <grub/machine/boot.h>
|
||||
|
||||
|
@ -24,17 +25,8 @@
|
|||
* defines for the code go here
|
||||
*/
|
||||
|
||||
/* Absolute addresses
|
||||
This makes the assembler generate the address without support
|
||||
from the linker. (ELF can't relocate 16-bit addresses!) */
|
||||
#define ABS(x) (x-_start+0x7c00)
|
||||
|
||||
/* Print message string */
|
||||
#ifdef APPLE_CC
|
||||
#define MSG(x) x ## _abs = ABS(x); movw $x ## _abs, %si; call message
|
||||
#else
|
||||
#define MSG(x) movw $ABS(x), %si; call message
|
||||
#endif
|
||||
#define MSG(x) movw $x, %si; call LOCAL(message)
|
||||
|
||||
.file "boot.S"
|
||||
|
||||
|
@ -56,7 +48,7 @@ start:
|
|||
* parameter block.
|
||||
*/
|
||||
|
||||
jmp after_BPB
|
||||
jmp LOCAL(after_BPB)
|
||||
nop /* do I care about this ??? */
|
||||
|
||||
/*
|
||||
|
@ -104,7 +96,7 @@ boot_drive:
|
|||
.byte 0xff /* the disk to load kernel from */
|
||||
/* 0xff means use the boot drive */
|
||||
|
||||
after_BPB:
|
||||
LOCAL(after_BPB):
|
||||
|
||||
/* general setup */
|
||||
cli /* we're not safe here! */
|
||||
|
@ -129,12 +121,7 @@ boot_drive_check:
|
|||
* ljmp to the next instruction because some bogus BIOSes
|
||||
* jump to 07C0:0000 instead of 0000:7C00.
|
||||
*/
|
||||
#ifdef APPLE_CC
|
||||
real_start_abs = ABS(real_start)
|
||||
ljmp $0, $(real_start_abs)
|
||||
#else
|
||||
ljmp $0, $ABS(real_start)
|
||||
#endif
|
||||
ljmp $0, $real_start
|
||||
|
||||
real_start:
|
||||
|
||||
|
@ -151,12 +138,7 @@ real_start:
|
|||
/*
|
||||
* Check if we have a forced disk reference here
|
||||
*/
|
||||
#ifdef APPLE_CC
|
||||
boot_drive_abs = ABS (boot_drive)
|
||||
movb boot_drive_abs, %al
|
||||
#else
|
||||
movb ABS(boot_drive), %al
|
||||
#endif
|
||||
movb boot_drive, %al
|
||||
cmpb $0xff, %al
|
||||
je 1f
|
||||
movb %al, %dl
|
||||
|
@ -168,16 +150,11 @@ real_start:
|
|||
MSG(notification_string)
|
||||
|
||||
/* set %si to the disk address packet */
|
||||
#ifdef APPLE_CC
|
||||
disk_address_packet_abs = ABS (disk_address_packet)
|
||||
movw $disk_address_packet_abs, %si
|
||||
#else
|
||||
movw $ABS(disk_address_packet), %si
|
||||
#endif
|
||||
movw $disk_address_packet, %si
|
||||
|
||||
/* do not probe LBA if the drive is a floppy */
|
||||
testb $GRUB_BOOT_MACHINE_BIOS_HD_FLAG, %dl
|
||||
jz chs_mode
|
||||
jz LOCAL(chs_mode)
|
||||
|
||||
/* check if LBA is supported */
|
||||
movb $0x41, %ah
|
||||
|
@ -192,12 +169,12 @@ real_start:
|
|||
pushw %dx
|
||||
|
||||
/* use CHS if fails */
|
||||
jc chs_mode
|
||||
jc LOCAL(chs_mode)
|
||||
cmpw $0xaa55, %bx
|
||||
jne chs_mode
|
||||
jne LOCAL(chs_mode)
|
||||
|
||||
andw $1, %cx
|
||||
jz chs_mode
|
||||
jz LOCAL(chs_mode)
|
||||
|
||||
lba_mode:
|
||||
xorw %ax, %ax
|
||||
|
@ -214,18 +191,10 @@ lba_mode:
|
|||
movw $0x0010, (%si)
|
||||
|
||||
/* the absolute address */
|
||||
#ifdef APPLE_CC
|
||||
kernel_sector_abs = ABS (kernel_sector)
|
||||
movl (kernel_sector_abs), %ebx
|
||||
movl kernel_sector, %ebx
|
||||
movl %ebx, 8(%si)
|
||||
movl (kernel_sector_abs + 4), %ebx
|
||||
movl kernel_sector + 4, %ebx
|
||||
movl %ebx, 12(%si)
|
||||
#else
|
||||
movl ABS(kernel_sector), %ebx
|
||||
movl %ebx, 8(%si)
|
||||
movl ABS(kernel_sector + 4), %ebx
|
||||
movl %ebx, 12(%si)
|
||||
#endif
|
||||
|
||||
/* the segment of buffer address */
|
||||
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, 6(%si)
|
||||
|
@ -243,30 +212,30 @@ lba_mode:
|
|||
int $0x13
|
||||
|
||||
/* LBA read is not supported, so fallback to CHS. */
|
||||
jc chs_mode
|
||||
jc LOCAL(chs_mode)
|
||||
|
||||
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx
|
||||
jmp copy_buffer
|
||||
jmp LOCAL(copy_buffer)
|
||||
|
||||
chs_mode:
|
||||
LOCAL(chs_mode):
|
||||
/*
|
||||
* Determine the hard disk geometry from the BIOS!
|
||||
* We do this first, so that LS-120 IDE floppies work correctly.
|
||||
*/
|
||||
movb $8, %ah
|
||||
int $0x13
|
||||
jnc final_init
|
||||
jnc LOCAL(final_init)
|
||||
|
||||
/*
|
||||
* The call failed, so maybe use the floppy probe instead.
|
||||
*/
|
||||
testb $GRUB_BOOT_MACHINE_BIOS_HD_FLAG, %dl
|
||||
jz floppy_probe
|
||||
jz LOCAL(floppy_probe)
|
||||
|
||||
/* Nope, we definitely have a hard disk, and we're screwed. */
|
||||
jmp hd_probe_error
|
||||
jmp LOCAL(hd_probe_error)
|
||||
|
||||
final_init:
|
||||
LOCAL(final_init):
|
||||
/* set the mode to zero */
|
||||
movzbl %dh, %eax
|
||||
movb %ah, -1(%si)
|
||||
|
@ -292,22 +261,13 @@ final_init:
|
|||
|
||||
setup_sectors:
|
||||
/* load logical sector start (top half) */
|
||||
#ifdef APPLE_CC
|
||||
kernel_sector_abs = ABS (kernel_sector)
|
||||
movl (kernel_sector_abs + 4), %eax
|
||||
#else
|
||||
movl ABS(kernel_sector + 4), %eax
|
||||
#endif
|
||||
movl kernel_sector + 4, %eax
|
||||
|
||||
orl %eax, %eax
|
||||
jnz geometry_error
|
||||
jnz LOCAL(geometry_error)
|
||||
|
||||
/* load logical sector start (bottom half) */
|
||||
#ifdef APPLE_CC
|
||||
movl (kernel_sector_abs), %eax
|
||||
#else
|
||||
movl ABS(kernel_sector), %eax
|
||||
#endif
|
||||
movl kernel_sector, %eax
|
||||
|
||||
/* zero %edx */
|
||||
xorl %edx, %edx
|
||||
|
@ -323,7 +283,7 @@ setup_sectors:
|
|||
|
||||
/* do we need too many cylinders? */
|
||||
cmpw 8(%si), %ax
|
||||
jge geometry_error
|
||||
jge LOCAL(geometry_error)
|
||||
|
||||
/* normalize sector start (1-based) */
|
||||
incb %cl
|
||||
|
@ -365,11 +325,11 @@ setup_sectors:
|
|||
movw $0x0201, %ax /* function 2 */
|
||||
int $0x13
|
||||
|
||||
jc read_error
|
||||
jc LOCAL(read_error)
|
||||
|
||||
movw %es, %bx
|
||||
|
||||
copy_buffer:
|
||||
LOCAL(copy_buffer):
|
||||
/*
|
||||
* We need to save %cx and %si because the startup code in
|
||||
* kernel uses them without initializing them.
|
||||
|
@ -392,42 +352,38 @@ copy_buffer:
|
|||
popa
|
||||
|
||||
/* boot kernel */
|
||||
#ifdef APPLE_CC
|
||||
kernel_address_abs = ABS (kernel_address)
|
||||
jmp *(kernel_address_abs)
|
||||
#else
|
||||
jmp *(kernel_address)
|
||||
#endif
|
||||
|
||||
/* END OF MAIN LOOP */
|
||||
|
||||
/*
|
||||
* BIOS Geometry translation error (past the end of the disk geometry!).
|
||||
*/
|
||||
geometry_error:
|
||||
LOCAL(geometry_error):
|
||||
MSG(geometry_error_string)
|
||||
jmp general_error
|
||||
jmp LOCAL(general_error)
|
||||
|
||||
/*
|
||||
* Disk probe failure.
|
||||
*/
|
||||
hd_probe_error:
|
||||
LOCAL(hd_probe_error):
|
||||
MSG(hd_probe_error_string)
|
||||
jmp general_error
|
||||
jmp LOCAL(general_error)
|
||||
|
||||
/*
|
||||
* Read error on the disk.
|
||||
*/
|
||||
read_error:
|
||||
LOCAL(read_error):
|
||||
MSG(read_error_string)
|
||||
|
||||
general_error:
|
||||
LOCAL(general_error):
|
||||
MSG(general_error_string)
|
||||
|
||||
/* go here when you need to stop the machine hard after an error condition */
|
||||
/* tell the BIOS a boot failure, which may result in no effect */
|
||||
int $0x18
|
||||
stop: jmp stop
|
||||
LOCAL(stop):
|
||||
jmp LOCAL(stop)
|
||||
|
||||
notification_string: .asciz "GRUB "
|
||||
geometry_error_string: .asciz "Geom"
|
||||
|
@ -450,7 +406,7 @@ general_error_string: .asciz " Error\r\n"
|
|||
movw $0x0001, %bx
|
||||
movb $0xe, %ah
|
||||
int $0x10 /* display a byte */
|
||||
message:
|
||||
LOCAL(message):
|
||||
lodsb
|
||||
cmpb $0, %al
|
||||
jne 1b /* if not end of string, jmp to display */
|
||||
|
@ -478,19 +434,14 @@ part_start:
|
|||
probe_values:
|
||||
.byte 36, 18, 15, 9, 0
|
||||
|
||||
floppy_probe:
|
||||
LOCAL(floppy_probe):
|
||||
/*
|
||||
* Perform floppy probe.
|
||||
*/
|
||||
|
||||
#ifdef APPLE_CC
|
||||
probe_values_abs = ABS (probe_values)
|
||||
movw $(probe_values_abs-1), %si
|
||||
#else
|
||||
movw $ABS(probe_values-1), %si
|
||||
#endif
|
||||
movw $probe_values - 1, %si
|
||||
|
||||
probe_loop:
|
||||
LOCAL(probe_loop):
|
||||
/* reset floppy controller INT 13h AH=0 */
|
||||
xorw %ax, %ax
|
||||
int $0x13
|
||||
|
@ -506,7 +457,7 @@ probe_loop:
|
|||
* Floppy disk probe failure.
|
||||
*/
|
||||
MSG(fd_probe_error_string)
|
||||
jmp general_error
|
||||
jmp LOCAL(general_error)
|
||||
|
||||
/* "Floppy" */
|
||||
fd_probe_error_string: .asciz "Floppy"
|
||||
|
@ -519,14 +470,14 @@ fd_probe_error_string: .asciz "Floppy"
|
|||
movb $0, %dh
|
||||
int $0x13
|
||||
|
||||
/* if error, jump to "probe_loop" */
|
||||
jc probe_loop
|
||||
/* if error, jump to "LOCAL(probe_loop)" */
|
||||
jc LOCAL(probe_loop)
|
||||
|
||||
/* %cl is already the correct value! */
|
||||
movb $1, %dh
|
||||
movb $79, %ch
|
||||
|
||||
jmp final_init
|
||||
jmp LOCAL(final_init)
|
||||
|
||||
. = _start + GRUB_BOOT_MACHINE_PART_END
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/boot.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
|
@ -38,9 +39,9 @@
|
|||
|
||||
start:
|
||||
_start:
|
||||
call next
|
||||
call LOCAL(next)
|
||||
|
||||
next:
|
||||
LOCAL(next):
|
||||
jmp 1f
|
||||
|
||||
. = start + 8
|
||||
|
@ -67,24 +68,17 @@ bi_reserved:
|
|||
movw %ax, %ds
|
||||
movw %ax, %es
|
||||
|
||||
#ifdef APPLE_CC
|
||||
err_noboot_msg_abs = 0x7C00 + err_noboot_msg - start
|
||||
movw $err_noboot_msg_abs, %si
|
||||
bi_length_dif = bi_length - next
|
||||
movl %cs:bi_length_dif(%bx), %ecx
|
||||
#else
|
||||
movw $(0x7C00 + err_noboot_msg - start), %si
|
||||
movl %cs: bi_length - next(%bx), %ecx
|
||||
#endif
|
||||
movl %cs: bi_length - LOCAL(next)(%bx), %ecx
|
||||
orl %ecx, %ecx
|
||||
jz fail
|
||||
jz LOCAL(fail)
|
||||
|
||||
addl $((1 << CDSEC_SHIFT) - 1), %ecx
|
||||
shrl $CDSEC_SHIFT, %ecx
|
||||
|
||||
movl %cs: bi_file - next(%bx), %esi
|
||||
movl %cs: bi_file - LOCAL(next)(%bx), %esi
|
||||
|
||||
call read_cdrom
|
||||
call LOCAL(read_cdrom)
|
||||
|
||||
ljmp $(DATA_ADDR >> 4), $0
|
||||
|
||||
|
@ -93,7 +87,7 @@ bi_reserved:
|
|||
* esi: start sector
|
||||
* ecx: number of sectors
|
||||
*/
|
||||
read_cdrom:
|
||||
LOCAL(read_cdrom):
|
||||
xorl %eax, %eax
|
||||
|
||||
/* Number of blocks to read. */
|
||||
|
@ -134,7 +128,7 @@ read_cdrom:
|
|||
|
||||
2:
|
||||
shrw $1, %di /* Reduce transfer size. */
|
||||
jz cdrom_fail
|
||||
jz LOCAL(cdrom_fail)
|
||||
movw %di, 0x10(%si)
|
||||
movw %di, 2(%si)
|
||||
movb $0x42, %ah
|
||||
|
@ -155,15 +149,10 @@ read_cdrom:
|
|||
addw $0x12, %sp
|
||||
ret
|
||||
|
||||
cdrom_fail:
|
||||
#ifdef APPLE_CC
|
||||
err_cdfail_msg_abs = 0x7C00 + err_cdfail_msg - start
|
||||
movw $(err_cdfail_msg_abs), %si
|
||||
#else
|
||||
LOCAL(cdrom_fail):
|
||||
movw $(0x7C00 + err_cdfail_msg - start), %si
|
||||
#endif
|
||||
|
||||
fail:
|
||||
LOCAL(fail):
|
||||
movb $0x0e, %ah
|
||||
xorw %bx, %bx
|
||||
1:
|
||||
|
|
|
@ -16,23 +16,14 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/machine/boot.h>
|
||||
|
||||
/*
|
||||
* defines for the code go here
|
||||
*/
|
||||
|
||||
/* Absolute addresses
|
||||
This makes the assembler generate the address without support
|
||||
from the linker. (ELF can't relocate 16-bit addresses!) */
|
||||
#define ABS(x) (x-_start+GRUB_BOOT_MACHINE_KERNEL_ADDR)
|
||||
|
||||
/* Print message string */
|
||||
#ifdef APPLE_CC
|
||||
#define MSG(x) x ## _abs = ABS(x); mov $x ## _abs, %esi; call message
|
||||
#else
|
||||
#define MSG(x) movw $ABS(x), %si; call message
|
||||
#endif
|
||||
#define MSG(x) movw $x, %si; call LOCAL(message)
|
||||
|
||||
.file "diskboot.S"
|
||||
|
||||
|
@ -65,33 +56,27 @@ _start:
|
|||
popw %si
|
||||
|
||||
/* this sets up for the first run through "bootloop" */
|
||||
#ifdef APPLE_CC
|
||||
firstlist_off_abs = ABS (firstlist - GRUB_BOOT_MACHINE_LIST_SIZE)
|
||||
movl $firstlist_off_abs, %edi
|
||||
#else
|
||||
movw $ABS(firstlist - GRUB_BOOT_MACHINE_LIST_SIZE), %di
|
||||
#endif
|
||||
movw $(firstlist - GRUB_BOOT_MACHINE_LIST_SIZE), %di
|
||||
|
||||
/* save the sector number of the second sector in %ebp */
|
||||
movl (%di), %ebp
|
||||
|
||||
/* this is the loop for reading the rest of the kernel in */
|
||||
bootloop:
|
||||
LOCAL(bootloop):
|
||||
|
||||
/* check the number of sectors to read */
|
||||
cmpw $0, 8(%di)
|
||||
|
||||
/* if zero, go to the start function */
|
||||
je bootit
|
||||
je LOCAL(bootit)
|
||||
|
||||
setup_sectors:
|
||||
LOCAL(setup_sectors):
|
||||
/* check if we use LBA or CHS */
|
||||
cmpb $0, -1(%si)
|
||||
|
||||
/* jump to chs_mode if zero */
|
||||
je chs_mode
|
||||
/* use CHS if zero, LBA otherwise */
|
||||
je LOCAL(chs_mode)
|
||||
|
||||
lba_mode:
|
||||
/* load logical sector start */
|
||||
movl (%di), %ebx
|
||||
movl 4(%di), %ecx
|
||||
|
@ -150,16 +135,16 @@ lba_mode:
|
|||
movb $0x42, %ah
|
||||
int $0x13
|
||||
|
||||
jc read_error
|
||||
jc LOCAL(read_error)
|
||||
|
||||
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx
|
||||
jmp copy_buffer
|
||||
jmp LOCAL(copy_buffer)
|
||||
|
||||
chs_mode:
|
||||
LOCAL(chs_mode):
|
||||
/* load logical sector start (top half) */
|
||||
movl 4(%di), %eax
|
||||
orl %eax, %eax
|
||||
jnz geometry_error
|
||||
jnz LOCAL(geometry_error)
|
||||
|
||||
/* load logical sector start (bottom half) */
|
||||
movl (%di), %eax
|
||||
|
@ -184,7 +169,7 @@ chs_mode:
|
|||
|
||||
/* do we need too many cylinders? */
|
||||
cmpw 8(%si), %ax
|
||||
jge geometry_error
|
||||
jge LOCAL(geometry_error)
|
||||
|
||||
/* determine the maximum sector length of this read */
|
||||
movw (%si), %ax /* get number of sectors per track/head */
|
||||
|
@ -254,12 +239,12 @@ chs_mode:
|
|||
movb $0x2, %ah /* function 2 */
|
||||
int $0x13
|
||||
|
||||
jc read_error
|
||||
jc LOCAL(read_error)
|
||||
|
||||
/* save source segment */
|
||||
movw %es, %bx
|
||||
|
||||
copy_buffer:
|
||||
LOCAL(copy_buffer):
|
||||
|
||||
/* load addresses for copy from disk buffer to destination */
|
||||
movw 10(%di), %es /* load destination segment */
|
||||
|
@ -299,17 +284,17 @@ copy_buffer:
|
|||
|
||||
/* check if finished with this dataset */
|
||||
cmpw $0, 8(%di)
|
||||
jne setup_sectors
|
||||
jne LOCAL(setup_sectors)
|
||||
|
||||
/* update position to load from */
|
||||
subw $GRUB_BOOT_MACHINE_LIST_SIZE, %di
|
||||
|
||||
/* jump to bootloop */
|
||||
jmp bootloop
|
||||
jmp LOCAL(bootloop)
|
||||
|
||||
/* END OF MAIN LOOP */
|
||||
|
||||
bootit:
|
||||
LOCAL(bootit):
|
||||
/* print a newline */
|
||||
MSG(notification_done)
|
||||
popw %dx /* this makes sure %dl is our "boot" drive */
|
||||
|
@ -319,21 +304,21 @@ bootit:
|
|||
/*
|
||||
* BIOS Geometry translation error (past the end of the disk geometry!).
|
||||
*/
|
||||
geometry_error:
|
||||
LOCAL(geometry_error):
|
||||
MSG(geometry_error_string)
|
||||
jmp general_error
|
||||
jmp LOCAL(general_error)
|
||||
|
||||
/*
|
||||
* Read error on the disk.
|
||||
*/
|
||||
read_error:
|
||||
LOCAL(read_error):
|
||||
MSG(read_error_string)
|
||||
|
||||
general_error:
|
||||
LOCAL(general_error):
|
||||
MSG(general_error_string)
|
||||
|
||||
/* go here when you need to stop the machine hard after an error condition */
|
||||
stop: jmp stop
|
||||
LOCAL(stop): jmp LOCAL(stop)
|
||||
|
||||
notification_string: .asciz "loading"
|
||||
|
||||
|
@ -361,12 +346,11 @@ general_error_string: .asciz " Error"
|
|||
int $0x10 /* display a byte */
|
||||
|
||||
incw %si
|
||||
message:
|
||||
LOCAL(message):
|
||||
movb (%si), %al
|
||||
cmpb $0, %al
|
||||
jne 1b /* if not end of string, jmp to display */
|
||||
ret
|
||||
lastlist:
|
||||
|
||||
/*
|
||||
* This area is an empty space between the main body of code below which
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/boot.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
|
@ -25,14 +26,8 @@
|
|||
|
||||
.file "lnxboot.S"
|
||||
|
||||
#ifdef APPLE_CC
|
||||
#error Building lnxboot.img with Apple's as results in an unusable image
|
||||
#endif
|
||||
|
||||
#define CODE_ADDR 0x6000
|
||||
#ifndef APPLE_CC
|
||||
#define CODE_LENG (code_end - start)
|
||||
#endif
|
||||
#define CODE_SECTORS 1
|
||||
#define DATA_ADDR ((GRUB_BOOT_MACHINE_KERNEL_ADDR) + 0x200)
|
||||
|
||||
#define BLCK_LENG 0x4000
|
||||
|
@ -45,17 +40,12 @@
|
|||
|
||||
data_start:
|
||||
xorl %ebp, %ebp
|
||||
jmp linux_next
|
||||
jmp LOCAL(linux_next)
|
||||
|
||||
. = data_start + 0x1F1
|
||||
|
||||
setup_sects:
|
||||
/* Apple's cc can't fill this value. */
|
||||
#ifdef APPLE_CC
|
||||
.byte 0
|
||||
#else
|
||||
.byte (CODE_LENG >> 9)
|
||||
#endif
|
||||
.byte CODE_SECTORS
|
||||
root_flags:
|
||||
.word 0
|
||||
syssize:
|
||||
|
@ -74,7 +64,7 @@ boot_flag:
|
|||
start:
|
||||
_start:
|
||||
|
||||
jmp linux_init
|
||||
jmp LOCAL(linux_init)
|
||||
|
||||
.ascii "HdrS" /* Header signature. */
|
||||
.word 0x0203 /* Header version number. */
|
||||
|
@ -132,40 +122,22 @@ reg_edx:
|
|||
data_leng:
|
||||
.long 0
|
||||
|
||||
linux_init:
|
||||
|
||||
#ifdef APPLE_CC
|
||||
reg_edx_rel = reg_edx - start
|
||||
code32_start_rel = code32_start - start
|
||||
movw %cs:(reg_edx_rel), %dx
|
||||
movl %cs:(code32_start_rel), %ebp
|
||||
#else
|
||||
LOCAL(linux_init):
|
||||
movw %cs:(reg_edx - start), %dx
|
||||
movl %cs:(code32_start - start), %ebp
|
||||
#endif
|
||||
|
||||
linux_next:
|
||||
LOCAL(linux_next):
|
||||
|
||||
call normalize
|
||||
call LOCAL(normalize)
|
||||
|
||||
normalize:
|
||||
LOCAL(normalize):
|
||||
popw %bx
|
||||
#ifdef APPLE_CC
|
||||
normalize_rel = normalize - start
|
||||
subw $(normalize_rel), %bx
|
||||
#else
|
||||
subw $(normalize - start), %bx
|
||||
#endif
|
||||
subw $(LOCAL(normalize) - start), %bx
|
||||
shrw $4, %bx
|
||||
movw %cs, %ax
|
||||
addw %bx, %ax
|
||||
pushw %ax
|
||||
#ifdef APPLE_CC
|
||||
real_code_rel = real_code - start
|
||||
pushw $(real_code_rel)
|
||||
#else
|
||||
pushw $(real_code - start)
|
||||
#endif
|
||||
lret /* Jump to real_code. */
|
||||
|
||||
real_code:
|
||||
|
@ -191,13 +163,7 @@ real_code:
|
|||
|
||||
rep
|
||||
movsl
|
||||
|
||||
#ifdef APPLE_CC
|
||||
real_code_2_rel = real_code_2 - start
|
||||
ljmp $(CODE_ADDR >> 4), $(real_code_2_rel)
|
||||
#else
|
||||
ljmp $(CODE_ADDR >> 4), $(real_code_2 - start)
|
||||
#endif
|
||||
|
||||
real_code_2:
|
||||
|
||||
|
@ -216,21 +182,14 @@ real_code_2:
|
|||
addl %ecx, %esi
|
||||
movl $DATA_ADDR, %edi
|
||||
|
||||
call move_memory
|
||||
call LOCAL(move_memory)
|
||||
|
||||
/* Check for multiboot signature. */
|
||||
cmpl $MULTIBOOT_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_DATA_END)
|
||||
jz 1f
|
||||
|
||||
#ifdef APPLE_CC
|
||||
ramdisk_image_rel = ramdisk_image - start
|
||||
ramdisk_size_rel = ramdisk_size - start
|
||||
movl (ramdisk_image_rel), %esi
|
||||
movl (ramdisk_size_rel), %ecx
|
||||
#else
|
||||
movl (ramdisk_image - start), %esi
|
||||
movl (ramdisk_size - start), %ecx
|
||||
#endif
|
||||
movl $(DATA_ADDR - 0x200), %edi
|
||||
jmp 2f
|
||||
|
||||
|
@ -240,17 +199,11 @@ real_code_2:
|
|||
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - 0x200), %ecx
|
||||
|
||||
2:
|
||||
call move_memory
|
||||
call LOCAL(move_memory)
|
||||
|
||||
movsbl %dh, %eax
|
||||
movl %eax, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_INSTALL_DOS_PART)
|
||||
|
||||
#ifdef APPLE_CC
|
||||
reg_edx_rel = reg_edx - start
|
||||
movsbl (reg_edx_rel + 2), %eax
|
||||
#else
|
||||
movsbl (reg_edx + 2 - start), %eax
|
||||
#endif
|
||||
movl %eax, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_INSTALL_BSD_PART)
|
||||
|
||||
movb $0xFF, %dh
|
||||
|
@ -264,7 +217,7 @@ real_code_2:
|
|||
* ecx: number of bytes
|
||||
*/
|
||||
|
||||
move_memory:
|
||||
LOCAL(move_memory):
|
||||
incl %ecx
|
||||
andb $0xFE, %cl
|
||||
pushw %dx
|
||||
|
@ -279,28 +232,6 @@ move_memory:
|
|||
pushl %ecx
|
||||
|
||||
movl %esi, %eax
|
||||
#ifdef APPLE_CC
|
||||
gdt_src1_rel = gdt_src1 - start
|
||||
gdt_src2_rel = gdt_src2 - start
|
||||
gdt_dst1_rel = gdt_dst1 - start
|
||||
gdt_dst2_rel = gdt_dst2 - start
|
||||
gdt_rel = gdt - start
|
||||
|
||||
movw %si, (gdt_src1_rel)
|
||||
shrl $16, %eax
|
||||
movb %al, (gdt_src1_rel + 2)
|
||||
movb %ah, (gdt_src2_rel)
|
||||
|
||||
movl %edi, %eax
|
||||
movw %di, (gdt_dst1_rel)
|
||||
shrl $16, %eax
|
||||
movb %al, (gdt_dst1_rel + 2)
|
||||
movb %ah, (gdt_dst2_rel)
|
||||
|
||||
movw $(gdt_rel), %si
|
||||
movb $0x87, %ah
|
||||
shrw $1, %cx
|
||||
#else
|
||||
movw %si, (gdt_src1 - start)
|
||||
shrl $16, %eax
|
||||
movb %al, (gdt_src1 + 2 - start)
|
||||
|
@ -315,7 +246,6 @@ move_memory:
|
|||
movw $(gdt - start), %si
|
||||
movb $0x87, %ah
|
||||
shrw $1, %cx
|
||||
#endif
|
||||
|
||||
int $0x15
|
||||
|
||||
|
@ -325,13 +255,8 @@ move_memory:
|
|||
popl %esi
|
||||
|
||||
jnc 2f
|
||||
#ifdef APPLE_CC
|
||||
err_int15_msg_rel = err_int15_msg - start
|
||||
movw $(err_int15_msg_rel), %si
|
||||
#else
|
||||
movw $(err_int15_msg - start), %si
|
||||
#endif
|
||||
jmp fail
|
||||
jmp LOCAL(fail)
|
||||
|
||||
2:
|
||||
|
||||
|
@ -349,7 +274,7 @@ move_memory:
|
|||
* si: message
|
||||
*/
|
||||
|
||||
fail:
|
||||
LOCAL(fail):
|
||||
movb $0x0e, %ah
|
||||
xorw %bx, %bx
|
||||
1:
|
||||
|
@ -362,11 +287,4 @@ fail:
|
|||
err_int15_msg:
|
||||
.ascii "move memory fails\0"
|
||||
|
||||
/* Unsupported feature in Apple's cc. */
|
||||
#ifndef APPLE_CC
|
||||
. = (. & (~0x1FF)) + 0x1FF
|
||||
#endif
|
||||
|
||||
.byte 0
|
||||
|
||||
code_end:
|
||||
. = _start + CODE_SECTORS * 512
|
||||
|
|
|
@ -155,6 +155,8 @@ grub_cmd_vbetest (grub_command_t cmd __attribute__ ((unused)),
|
|||
|
||||
grub_getkey ();
|
||||
|
||||
grub_video_restore ();
|
||||
|
||||
/* Restore old video mode. */
|
||||
grub_vbe_set_video_mode (old_mode, 0);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"file", 'f', 0, "search devices by a file (default)", 0, 0},
|
||||
{"file", 'f', 0, "search devices by a file", 0, 0},
|
||||
{"label", 'l', 0, "search devices by a filesystem label", 0, 0},
|
||||
{"fs-uuid", 'u', 0, "search devices by a filesystem UUID", 0, 0},
|
||||
{"set", 's', GRUB_ARG_OPTION_OPTIONAL, "set a variable to the first device found", "VAR", ARG_TYPE_STRING},
|
||||
|
|
|
@ -100,7 +100,7 @@ transform ( MD5_CONTEXT *ctx, const unsigned char *data )
|
|||
correct_words[i] = grub_le_to_cpu32 (p[i]);
|
||||
}
|
||||
#else
|
||||
memcpy (correct_words, data, 64);
|
||||
grub_memcpy (correct_words, data, 64);
|
||||
#endif
|
||||
|
||||
#define OP(a, b, c, d, s, T) \
|
||||
|
|
|
@ -17,7 +17,7 @@ grub_probe_SOURCES = util/grub-probe.c \
|
|||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
||||
fs/ufs.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
\
|
||||
partmap/pc.c partmap/apple.c partmap/sun.c partmap/gpt.c\
|
||||
kern/fs.c kern/env.c fs/fshelp.c \
|
||||
|
@ -38,7 +38,7 @@ grub_fstest_SOURCES = util/grub-fstest.c util/hostfs.c util/misc.c \
|
|||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
||||
fs/ufs.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
\
|
||||
kern/partition.c partmap/pc.c partmap/apple.c partmap/sun.c \
|
||||
partmap/gpt.c \
|
||||
|
@ -174,7 +174,7 @@ sbin_SCRIPTS += grub-dumpbios
|
|||
CLEANFILES += grub-dumpbios
|
||||
|
||||
# Filing systems.
|
||||
pkglib_MODULES += fshelp.mod fat.mod ufs.mod ext2.mod ntfs.mod \
|
||||
pkglib_MODULES += fshelp.mod fat.mod ufs1.mod ufs2.mod ext2.mod ntfs.mod \
|
||||
ntfscomp.mod minix.mod hfs.mod jfs.mod iso9660.mod xfs.mod \
|
||||
affs.mod sfs.mod hfsplus.mod reiserfs.mod cpio.mod tar.mod \
|
||||
udf.mod afs.mod befs.mod
|
||||
|
@ -189,10 +189,15 @@ fat_mod_SOURCES = fs/fat.c
|
|||
fat_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
fat_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For ufs.mod.
|
||||
ufs_mod_SOURCES = fs/ufs.c
|
||||
ufs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
ufs_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
# For ufs1.mod.
|
||||
ufs1_mod_SOURCES = fs/ufs.c
|
||||
ufs1_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
ufs1_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For ufs2.mod.
|
||||
ufs2_mod_SOURCES = fs/ufs2.c
|
||||
ufs2_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
ufs2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For ext2.mod.
|
||||
ext2_mod_SOURCES = fs/ext2.c
|
||||
|
@ -535,13 +540,18 @@ lua_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|||
|
||||
# Common Video Subsystem specific modules.
|
||||
pkglib_MODULES += video.mod videotest.mod bitmap.mod tga.mod jpeg.mod \
|
||||
png.mod font.mod gfxterm.mod
|
||||
png.mod font.mod gfxterm.mod video_fb.mod
|
||||
|
||||
# For video.mod.
|
||||
video_mod_SOURCES = video/video.c
|
||||
video_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
video_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
video_fb_mod_SOURCES = video/fb/video_fb.c video/fb/fbblit.c \
|
||||
video/fb/fbfill.c video/fb/fbutil.c
|
||||
video_fb_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
video_fb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For videotest.mod.
|
||||
videotest_mod_SOURCES = commands/videotest.c
|
||||
videotest_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
|
|
@ -116,7 +116,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
||||
fs/ufs.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
\
|
||||
fs/fshelp.c \
|
||||
io/gzio.c \
|
||||
|
|
|
@ -24,7 +24,7 @@ util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile
|
|||
# util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
||||
# kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \
|
||||
# fs/sfs.c kern/parser.c kern/partition.c partmap/pc.c \
|
||||
# fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \
|
||||
# fs/ufs.c fs/ufs2.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \
|
||||
# kern/fs.c kern/env.c fs/fshelp.c
|
||||
|
||||
# For grub-mkdevicemap.
|
||||
|
@ -44,7 +44,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
||||
fs/ufs.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
\
|
||||
io/gzio.c \
|
||||
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
|
||||
|
|
|
@ -71,7 +71,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
||||
fs/ufs.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
\
|
||||
fs/fshelp.c \
|
||||
io/gzio.c \
|
||||
|
|
|
@ -10,7 +10,8 @@ COMMON_LDFLAGS = -m32 -nostdlib
|
|||
script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
|
||||
|
||||
# Images.
|
||||
pkglib_IMAGES = boot.img diskboot.img kernel.img pxeboot.img cdboot.img
|
||||
pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \
|
||||
pxeboot.img
|
||||
|
||||
# For boot.img.
|
||||
boot_img_SOURCES = boot/i386/pc/boot.S
|
||||
|
@ -31,9 +32,6 @@ diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)8000
|
|||
diskboot_img_FORMAT = binary
|
||||
|
||||
# For lnxboot.img.
|
||||
ifeq ($(TARGET_APPLE_CC), 0)
|
||||
pkglib_IMAGES += lnxboot.img
|
||||
endif
|
||||
lnxboot_img_SOURCES = boot/i386/pc/lnxboot.S
|
||||
lnxboot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
lnxboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)6000
|
||||
|
@ -104,7 +102,7 @@ grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c \
|
|||
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
||||
fs/ufs.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
\
|
||||
partmap/pc.c partmap/gpt.c \
|
||||
\
|
||||
|
@ -148,7 +146,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
||||
fs/ufs.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
\
|
||||
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
|
||||
util/hostdisk.c util/getroot.c \
|
||||
|
@ -273,8 +271,7 @@ multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|||
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
||||
# For vbe.mod.
|
||||
vbe_mod_SOURCES = video/i386/pc/vbe.c video/i386/pc/vbeblit.c \
|
||||
video/i386/pc/vbefill.c video/i386/pc/vbeutil.c
|
||||
vbe_mod_SOURCES = video/i386/pc/vbe.c
|
||||
vbe_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
vbe_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
||||
fs/ufs.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
\
|
||||
io/gzio.c \
|
||||
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
|
||||
|
|
|
@ -78,7 +78,7 @@ grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
|
|||
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
||||
fs/ufs.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
\
|
||||
partmap/amiga.c partmap/apple.c partmap/pc.c \
|
||||
partmap/sun.c partmap/acorn.c \
|
||||
|
@ -108,7 +108,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
||||
fs/ufs.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
|
||||
\
|
||||
io/gzio.c \
|
||||
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
|
||||
|
|
|
@ -23,7 +23,7 @@ grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
|
|||
# util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
||||
# kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \
|
||||
# fs/sfs.c kern/parser.c kern/partition.c partmap/pc.c \
|
||||
# fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \
|
||||
# fs/ufs.c fs/ufs2.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \
|
||||
# kern/fs.c kern/env.c fs/fshelp.c
|
||||
|
||||
# For grub-mkdevicemap.
|
||||
|
@ -42,7 +42,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
||||
fs/ufs.c fs/xfs.c fs/afs.c \
|
||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
|
||||
\
|
||||
io/gzio.c \
|
||||
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
|
||||
|
|
2587
docs/grub.texi
2587
docs/grub.texi
File diff suppressed because it is too large
Load diff
4
docs/version.texi
Normal file
4
docs/version.texi
Normal file
|
@ -0,0 +1,4 @@
|
|||
@set UPDATED 7 Ago 2009
|
||||
@set UPDATED-MONTH Ago 2009
|
||||
@set EDITION 1.97~snapshot
|
||||
@set VERSION 1.97~snapshot
|
|
@ -273,7 +273,7 @@ grub_affs_read_symlink (grub_fshelp_node_t node)
|
|||
grub_free (symlink);
|
||||
return 0;
|
||||
}
|
||||
grub_printf ("Symlink: `%s'\n", symlink);
|
||||
grub_dprintf ("affs", "Symlink: `%s'\n", symlink);
|
||||
return symlink;
|
||||
}
|
||||
|
||||
|
|
6
fs/fat.c
6
fs/fat.c
|
@ -422,10 +422,8 @@ grub_fat_read_data (grub_disk_t disk, struct grub_fat_data *data,
|
|||
break;
|
||||
}
|
||||
|
||||
#if 0
|
||||
grub_printf ("%s:%d: fat_size=%d, next_cluster=%u\n",
|
||||
__FILE__, __LINE__, data->fat_size, next_cluster);
|
||||
#endif
|
||||
grub_dprintf ("fat", "fat_size=%d, next_cluster=%u\n",
|
||||
data->fat_size, next_cluster);
|
||||
|
||||
/* Check the end. */
|
||||
if (next_cluster >= data->cluster_eof_mark)
|
||||
|
|
37
fs/jfs.c
37
fs/jfs.c
|
@ -1,7 +1,7 @@
|
|||
/* jfs.c - JFS. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2004,2005,2006,2007,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2004,2005,2006,2007,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
|
||||
|
@ -51,6 +51,8 @@ struct grub_jfs_sblock
|
|||
|
||||
grub_uint8_t unused[71];
|
||||
grub_uint8_t volname[11];
|
||||
grub_uint8_t unused2[32];
|
||||
grub_uint8_t uuid[16];
|
||||
};
|
||||
|
||||
struct grub_jfs_extent
|
||||
|
@ -832,6 +834,38 @@ grub_jfs_close (grub_file_t file)
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_jfs_uuid (grub_device_t device, char **uuid)
|
||||
{
|
||||
struct grub_jfs_data *data;
|
||||
grub_disk_t disk = device->disk;
|
||||
|
||||
grub_dl_ref (my_mod);
|
||||
|
||||
data = grub_jfs_mount (disk);
|
||||
if (data)
|
||||
{
|
||||
*uuid = grub_malloc (40 + sizeof ('\0'));
|
||||
|
||||
grub_sprintf (*uuid, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
data->sblock.uuid[0], data->sblock.uuid[1],
|
||||
data->sblock.uuid[2], data->sblock.uuid[3],
|
||||
data->sblock.uuid[4], data->sblock.uuid[5],
|
||||
data->sblock.uuid[6], data->sblock.uuid[7],
|
||||
data->sblock.uuid[8], data->sblock.uuid[9],
|
||||
data->sblock.uuid[10], data->sblock.uuid[11],
|
||||
data->sblock.uuid[12], data->sblock.uuid[13],
|
||||
data->sblock.uuid[14], data->sblock.uuid[15]);
|
||||
}
|
||||
else
|
||||
*uuid = NULL;
|
||||
|
||||
grub_dl_unref (my_mod);
|
||||
|
||||
grub_free (data);
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_jfs_label (grub_device_t device, char **label)
|
||||
|
@ -856,6 +890,7 @@ static struct grub_fs grub_jfs_fs =
|
|||
.read = grub_jfs_read,
|
||||
.close = grub_jfs_close,
|
||||
.label = grub_jfs_label,
|
||||
.uuid = grub_jfs_uuid,
|
||||
.next = 0
|
||||
};
|
||||
|
||||
|
|
283
fs/ufs.c
283
fs/ufs.c
|
@ -25,9 +25,12 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
|
||||
#ifdef MODE_UFS2
|
||||
#define GRUB_UFS_MAGIC 0x19540119
|
||||
#else
|
||||
#define GRUB_UFS_MAGIC 0x11954
|
||||
#define GRUB_UFS2_MAGIC 0x19540119
|
||||
#endif
|
||||
|
||||
#define GRUB_UFS_INODE 2
|
||||
#define GRUB_UFS_FILETYPE_DIR 4
|
||||
#define GRUB_UFS_FILETYPE_LNK 10
|
||||
|
@ -44,20 +47,29 @@
|
|||
#define GRUB_UFS_VOLNAME_LEN 32
|
||||
|
||||
/* Calculate in which group the inode can be found. */
|
||||
#define inode_group(inode,sblock) ()
|
||||
|
||||
#define UFS_BLKSZ(sblock) (grub_le_to_cpu32 (sblock->bsize))
|
||||
|
||||
#define INODE(data,field) (data->ufs_type == UFS1 ? \
|
||||
data->inode. field : data->inode2. field)
|
||||
#define INODE_ENDIAN(data,field,bits1,bits2) (data->ufs_type == UFS1 ? \
|
||||
grub_le_to_cpu##bits1 (data->inode.field) : \
|
||||
grub_le_to_cpu##bits2 (data->inode2.field))
|
||||
#define INODE(data,field) data->inode. field
|
||||
#ifdef MODE_UFS2
|
||||
#define INODE_ENDIAN(data,field,bits1,bits2) grub_le_to_cpu##bits2 (data->inode.field)
|
||||
#else
|
||||
#define INODE_ENDIAN(data,field,bits1,bits2) grub_le_to_cpu##bits1 (data->inode.field)
|
||||
#endif
|
||||
|
||||
#define INODE_SIZE(data) INODE_ENDIAN (data,size,32,64)
|
||||
#define INODE_NBLOCKS(data) INODE_ENDIAN (data,nblocks,32,64)
|
||||
|
||||
#define INODE_MODE(data) INODE_ENDIAN (data,mode,16,16)
|
||||
#define INODE_BLKSZ(data) (data->ufs_type == UFS1 ? 4 : 8)
|
||||
#ifdef MODE_UFS2
|
||||
#define INODE_BLKSZ 8
|
||||
#else
|
||||
#define INODE_BLKSZ 4
|
||||
#endif
|
||||
#ifdef MODE_UFS2
|
||||
#define UFS_INODE_PER_BLOCK 2
|
||||
#else
|
||||
#define UFS_INODE_PER_BLOCK 4
|
||||
#endif
|
||||
#define INODE_DIRBLOCKS(data,blk) INODE_ENDIAN \
|
||||
(data,blocks.dir_blocks[blk],32,64)
|
||||
#define INODE_INDIRBLOCKS(data,blk) INODE_ENDIAN \
|
||||
|
@ -76,7 +88,7 @@ struct grub_ufs_sblock
|
|||
|
||||
/* The start of the cylinder group. */
|
||||
grub_uint32_t cylg_offset;
|
||||
grub_uint8_t unused3[4];
|
||||
grub_uint32_t cylg_mask;
|
||||
|
||||
grub_uint32_t mtime;
|
||||
grub_uint8_t unused4[12];
|
||||
|
@ -111,35 +123,9 @@ struct grub_ufs_sblock
|
|||
grub_uint32_t magic;
|
||||
};
|
||||
|
||||
#ifdef MODE_UFS2
|
||||
/* UFS inode. */
|
||||
struct grub_ufs_inode
|
||||
{
|
||||
grub_uint16_t mode;
|
||||
grub_uint16_t nlinks;
|
||||
grub_uint16_t uid;
|
||||
grub_uint16_t gid;
|
||||
grub_int64_t size;
|
||||
grub_uint64_t atime;
|
||||
grub_uint64_t mtime;
|
||||
grub_uint64_t ctime;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
grub_uint32_t dir_blocks[GRUB_UFS_DIRBLKS];
|
||||
grub_uint32_t indir_blocks[GRUB_UFS_INDIRBLKS];
|
||||
} blocks;
|
||||
grub_uint8_t symlink[(GRUB_UFS_DIRBLKS + GRUB_UFS_INDIRBLKS) * 4];
|
||||
};
|
||||
grub_uint32_t flags;
|
||||
grub_uint32_t nblocks;
|
||||
grub_uint32_t gen;
|
||||
grub_uint32_t unused;
|
||||
grub_uint8_t pad[12];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* UFS inode. */
|
||||
struct grub_ufs2_inode
|
||||
{
|
||||
grub_uint16_t mode;
|
||||
grub_uint16_t nlinks;
|
||||
|
@ -173,6 +159,34 @@ struct grub_ufs2_inode
|
|||
|
||||
grub_uint8_t unused[24];
|
||||
} __attribute__ ((packed));
|
||||
#else
|
||||
/* UFS inode. */
|
||||
struct grub_ufs_inode
|
||||
{
|
||||
grub_uint16_t mode;
|
||||
grub_uint16_t nlinks;
|
||||
grub_uint16_t uid;
|
||||
grub_uint16_t gid;
|
||||
grub_int64_t size;
|
||||
grub_uint64_t atime;
|
||||
grub_uint64_t mtime;
|
||||
grub_uint64_t ctime;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
grub_uint32_t dir_blocks[GRUB_UFS_DIRBLKS];
|
||||
grub_uint32_t indir_blocks[GRUB_UFS_INDIRBLKS];
|
||||
} blocks;
|
||||
grub_uint8_t symlink[(GRUB_UFS_DIRBLKS + GRUB_UFS_INDIRBLKS) * 4];
|
||||
};
|
||||
grub_uint32_t flags;
|
||||
grub_uint32_t nblocks;
|
||||
grub_uint32_t gen;
|
||||
grub_uint32_t unused;
|
||||
grub_uint8_t pad[12];
|
||||
} __attribute__ ((packed));
|
||||
#endif
|
||||
|
||||
/* Directory entry. */
|
||||
struct grub_ufs_dirent
|
||||
|
@ -195,17 +209,7 @@ struct grub_ufs_data
|
|||
{
|
||||
struct grub_ufs_sblock sblock;
|
||||
grub_disk_t disk;
|
||||
union
|
||||
{
|
||||
struct grub_ufs_inode inode;
|
||||
struct grub_ufs2_inode inode2;
|
||||
};
|
||||
enum
|
||||
{
|
||||
UFS1,
|
||||
UFS2,
|
||||
UNKNOWN
|
||||
} ufs_type;
|
||||
struct grub_ufs_inode inode;
|
||||
int ino;
|
||||
int linknest;
|
||||
};
|
||||
|
@ -217,7 +221,7 @@ static grub_err_t grub_ufs_find_file (struct grub_ufs_data *data,
|
|||
const char *path);
|
||||
|
||||
|
||||
static int
|
||||
static grub_disk_addr_t
|
||||
grub_ufs_get_file_block (struct grub_ufs_data *data, unsigned int blk)
|
||||
{
|
||||
struct grub_ufs_sblock *sblock = &data->sblock;
|
||||
|
@ -232,32 +236,38 @@ grub_ufs_get_file_block (struct grub_ufs_data *data, unsigned int blk)
|
|||
|
||||
blk -= GRUB_UFS_DIRBLKS;
|
||||
|
||||
indirsz = UFS_BLKSZ (sblock) / INODE_BLKSZ (data);
|
||||
indirsz = UFS_BLKSZ (sblock) / INODE_BLKSZ;
|
||||
/* Single indirect block. */
|
||||
if (blk < indirsz)
|
||||
{
|
||||
grub_uint32_t indir[UFS_BLKSZ (sblock) >> 2];
|
||||
#ifdef MODE_UFS2
|
||||
grub_uint64_t indir[UFS_BLKSZ (sblock) / sizeof (grub_uint64_t)];
|
||||
#else
|
||||
grub_uint32_t indir[UFS_BLKSZ (sblock) / sizeof (grub_uint32_t)];
|
||||
#endif
|
||||
grub_disk_read (data->disk, INODE_INDIRBLOCKS (data, 0) << log2_blksz,
|
||||
0, sizeof (indir), indir);
|
||||
return (data->ufs_type == UFS1) ? indir[blk] : indir[blk << 1];
|
||||
return indir[blk];
|
||||
}
|
||||
blk -= indirsz;
|
||||
|
||||
/* Double indirect block. */
|
||||
if (blk < indirsz * indirsz)
|
||||
{
|
||||
grub_uint32_t indir[UFS_BLKSZ (sblock) >> 2];
|
||||
#ifdef MODE_UFS2
|
||||
grub_uint64_t indir[UFS_BLKSZ (sblock) / sizeof (grub_uint64_t)];
|
||||
#else
|
||||
grub_uint32_t indir[UFS_BLKSZ (sblock) / sizeof (grub_uint32_t)];
|
||||
#endif
|
||||
|
||||
grub_disk_read (data->disk, INODE_INDIRBLOCKS (data, 1) << log2_blksz,
|
||||
0, sizeof (indir), indir);
|
||||
grub_disk_read (data->disk,
|
||||
((data->ufs_type == UFS1) ?
|
||||
indir[blk / indirsz] : indir [(blk / indirsz) << 1])
|
||||
(indir [blk / indirsz])
|
||||
<< log2_blksz,
|
||||
0, sizeof (indir), indir);
|
||||
|
||||
return (data->ufs_type == UFS1) ?
|
||||
indir[blk % indirsz] : indir[(blk % indirsz) << 1];
|
||||
return indir[blk % indirsz];
|
||||
}
|
||||
|
||||
|
||||
|
@ -334,7 +344,6 @@ grub_ufs_read_file (struct grub_ufs_data *data,
|
|||
return len;
|
||||
}
|
||||
|
||||
|
||||
/* Read inode INO from the mounted filesystem described by DATA. This
|
||||
inode is used by default now. */
|
||||
static grub_err_t
|
||||
|
@ -351,39 +360,26 @@ grub_ufs_read_inode (struct grub_ufs_data *data, int ino, char *inode)
|
|||
/* The first block of the group. */
|
||||
int grpblk = group * (grub_le_to_cpu32 (sblock->frags_per_group));
|
||||
|
||||
if (data->ufs_type == UFS1)
|
||||
{
|
||||
if (!inode)
|
||||
{
|
||||
inode = (char *) &data->inode;
|
||||
data->ino = ino;
|
||||
}
|
||||
#ifndef MODE_UFS2
|
||||
grpblk += grub_le_to_cpu32 (sblock->cylg_offset)
|
||||
* (group & (~grub_le_to_cpu32 (sblock->cylg_mask)));
|
||||
#endif
|
||||
|
||||
grub_disk_read (data->disk,
|
||||
(((grub_le_to_cpu32 (sblock->inoblk_offs) + grpblk)
|
||||
<< grub_le_to_cpu32 (data->sblock.log2_blksz)))
|
||||
+ grpino / 4,
|
||||
(grpino % 4) * sizeof (struct grub_ufs_inode),
|
||||
sizeof (struct grub_ufs_inode),
|
||||
inode);
|
||||
}
|
||||
else
|
||||
if (!inode)
|
||||
{
|
||||
if (!inode)
|
||||
{
|
||||
inode = (char *) &data->inode2;
|
||||
data->ino = ino;
|
||||
}
|
||||
|
||||
grub_disk_read (data->disk,
|
||||
(((grub_le_to_cpu32 (sblock->inoblk_offs) + grpblk)
|
||||
<< grub_le_to_cpu32 (data->sblock.log2_blksz)))
|
||||
+ grpino / 2,
|
||||
(grpino % 2) * sizeof (struct grub_ufs2_inode),
|
||||
sizeof (struct grub_ufs2_inode),
|
||||
inode);
|
||||
inode = (char *) &data->inode;
|
||||
data->ino = ino;
|
||||
}
|
||||
|
||||
grub_disk_read (data->disk,
|
||||
((grub_le_to_cpu32 (sblock->inoblk_offs) + grpblk)
|
||||
<< grub_le_to_cpu32 (data->sblock.log2_blksz))
|
||||
+ grpino / UFS_INODE_PER_BLOCK,
|
||||
(grpino % UFS_INODE_PER_BLOCK)
|
||||
* sizeof (struct grub_ufs_inode),
|
||||
sizeof (struct grub_ufs_inode),
|
||||
inode);
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
@ -466,9 +462,11 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path)
|
|||
(char *) &dirent) < 0)
|
||||
return grub_errno;
|
||||
|
||||
namelen = (data->ufs_type == UFS2)
|
||||
? dirent.namelen_bsd : grub_le_to_cpu16 (dirent.namelen);
|
||||
|
||||
#ifdef MODE_UFS2
|
||||
namelen = dirent.namelen_bsd;
|
||||
#else
|
||||
namelen = grub_le_to_cpu16 (dirent.namelen);
|
||||
#endif
|
||||
{
|
||||
char filename[namelen + 1];
|
||||
|
||||
|
@ -530,8 +528,7 @@ grub_ufs_mount (grub_disk_t disk)
|
|||
if (!data)
|
||||
return 0;
|
||||
|
||||
/* Find a UFS1 or UFS2 sblock. */
|
||||
data->ufs_type = UNKNOWN;
|
||||
/* Find a UFS sblock. */
|
||||
while (*sblklist != -1)
|
||||
{
|
||||
grub_disk_read (disk, *sblklist, 0, sizeof (struct grub_ufs_sblock),
|
||||
|
@ -541,31 +538,25 @@ grub_ufs_mount (grub_disk_t disk)
|
|||
|
||||
if (grub_le_to_cpu32 (data->sblock.magic) == GRUB_UFS_MAGIC)
|
||||
{
|
||||
data->ufs_type = UFS1;
|
||||
break;
|
||||
}
|
||||
else if (grub_le_to_cpu32 (data->sblock.magic) == GRUB_UFS2_MAGIC)
|
||||
{
|
||||
data->ufs_type = UFS2;
|
||||
break;
|
||||
data->disk = disk;
|
||||
data->linknest = 0;
|
||||
return data;
|
||||
}
|
||||
sblklist++;
|
||||
}
|
||||
if (data->ufs_type == UNKNOWN)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FS, "not an ufs filesystem");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
data->disk = disk;
|
||||
data->linknest = 0;
|
||||
return data;
|
||||
|
||||
fail:
|
||||
grub_free (data);
|
||||
|
||||
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
|
||||
grub_error (GRUB_ERR_BAD_FS, "not a ufs filesystem");
|
||||
if (grub_errno == GRUB_ERR_NONE || grub_errno == GRUB_ERR_OUT_OF_RANGE)
|
||||
{
|
||||
#ifdef MODE_UFS2
|
||||
grub_error (GRUB_ERR_BAD_FS, "not an ufs2 filesystem");
|
||||
#else
|
||||
grub_error (GRUB_ERR_BAD_FS, "not an ufs1 filesystem");
|
||||
#endif
|
||||
}
|
||||
|
||||
grub_free (data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -615,12 +606,17 @@ grub_ufs_dir (grub_device_t device, const char *path,
|
|||
(char *) &dirent) < 0)
|
||||
break;
|
||||
|
||||
namelen = (data->ufs_type == UFS2)
|
||||
? dirent.namelen_bsd : grub_le_to_cpu16 (dirent.namelen);
|
||||
#ifdef MODE_UFS2
|
||||
namelen = dirent.namelen_bsd;
|
||||
#else
|
||||
namelen = grub_le_to_cpu16 (dirent.namelen);
|
||||
#endif
|
||||
|
||||
{
|
||||
char filename[namelen + 1];
|
||||
struct grub_dirhook_info info;
|
||||
struct grub_ufs_inode inode;
|
||||
|
||||
grub_memset (&info, 0, sizeof (info));
|
||||
|
||||
if (grub_ufs_read_file (data, 0, pos + sizeof (dirent),
|
||||
|
@ -628,24 +624,12 @@ grub_ufs_dir (grub_device_t device, const char *path,
|
|||
break;
|
||||
|
||||
filename[namelen] = '\0';
|
||||
if (data->ufs_type == UFS1)
|
||||
{
|
||||
struct grub_ufs_inode inode;
|
||||
grub_ufs_read_inode (data, dirent.ino, (char *) &inode);
|
||||
info.dir = ((grub_le_to_cpu16 (inode.mode) & GRUB_UFS_ATTR_TYPE)
|
||||
== GRUB_UFS_ATTR_DIR);
|
||||
info.mtime = grub_le_to_cpu64 (inode.mtime);
|
||||
info.mtimeset = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct grub_ufs2_inode inode;
|
||||
grub_ufs_read_inode (data, dirent.ino, (char *) &inode);
|
||||
info.dir = ((grub_le_to_cpu16 (inode.mode) & GRUB_UFS_ATTR_TYPE)
|
||||
== GRUB_UFS_ATTR_DIR);
|
||||
info.mtime = grub_le_to_cpu64 (inode.mtime);
|
||||
info.mtimeset = 1;
|
||||
}
|
||||
grub_ufs_read_inode (data, dirent.ino, (char *) &inode);
|
||||
|
||||
info.dir = ((grub_le_to_cpu16 (inode.mode) & GRUB_UFS_ATTR_TYPE)
|
||||
== GRUB_UFS_ATTR_DIR);
|
||||
info.mtime = grub_le_to_cpu64 (inode.mtime);
|
||||
info.mtimeset = 1;
|
||||
|
||||
if (hook (filename, &info))
|
||||
break;
|
||||
|
@ -716,6 +700,7 @@ grub_ufs_close (grub_file_t file)
|
|||
}
|
||||
|
||||
|
||||
#ifdef MODE_UFS2
|
||||
static grub_err_t
|
||||
grub_ufs_label (grub_device_t device, char **label)
|
||||
{
|
||||
|
@ -727,10 +712,7 @@ grub_ufs_label (grub_device_t device, char **label)
|
|||
|
||||
data = grub_ufs_mount (device->disk);
|
||||
if (data)
|
||||
{
|
||||
if (data->ufs_type == UFS2)
|
||||
*label = grub_strdup ((char *) data->sblock.volume_name);
|
||||
}
|
||||
*label = grub_strdup ((char *) data->sblock.volume_name);
|
||||
|
||||
grub_dl_unref (my_mod);
|
||||
|
||||
|
@ -738,6 +720,7 @@ grub_ufs_label (grub_device_t device, char **label)
|
|||
|
||||
return grub_errno;
|
||||
}
|
||||
#endif
|
||||
|
||||
static grub_err_t
|
||||
grub_ufs_uuid (grub_device_t device, char **uuid)
|
||||
|
@ -748,7 +731,7 @@ grub_ufs_uuid (grub_device_t device, char **uuid)
|
|||
grub_dl_ref (my_mod);
|
||||
|
||||
data = grub_ufs_mount (disk);
|
||||
if (data)
|
||||
if (data && (data->sblock.uuidhi != 0 || data->sblock.uuidlow != 0))
|
||||
{
|
||||
*uuid = grub_malloc (16 + sizeof ('\0'));
|
||||
grub_sprintf (*uuid, "%08x%08x",
|
||||
|
@ -777,10 +760,12 @@ grub_ufs_mtime (grub_device_t device, grub_int32_t *tm)
|
|||
data = grub_ufs_mount (device->disk);
|
||||
if (!data)
|
||||
*tm = 0;
|
||||
else if (data->ufs_type == UFS1)
|
||||
*tm = grub_le_to_cpu32 (data->sblock.mtime);
|
||||
else
|
||||
#ifdef MODE_UFS2
|
||||
*tm = grub_le_to_cpu64 (data->sblock.mtime2);
|
||||
#else
|
||||
*tm = grub_le_to_cpu32 (data->sblock.mtime);
|
||||
#endif
|
||||
|
||||
grub_dl_unref (my_mod);
|
||||
|
||||
|
@ -793,24 +778,38 @@ grub_ufs_mtime (grub_device_t device, grub_int32_t *tm)
|
|||
|
||||
static struct grub_fs grub_ufs_fs =
|
||||
{
|
||||
.name = "ufs",
|
||||
#ifdef MODE_UFS2
|
||||
.name = "ufs2",
|
||||
#else
|
||||
.name = "ufs1",
|
||||
#endif
|
||||
.dir = grub_ufs_dir,
|
||||
.open = grub_ufs_open,
|
||||
.read = grub_ufs_read,
|
||||
.close = grub_ufs_close,
|
||||
#ifdef MODE_UFS2
|
||||
.label = grub_ufs_label,
|
||||
#endif
|
||||
.uuid = grub_ufs_uuid,
|
||||
.mtime = grub_ufs_mtime,
|
||||
.next = 0
|
||||
};
|
||||
|
||||
GRUB_MOD_INIT(ufs)
|
||||
#ifdef MODE_UFS2
|
||||
GRUB_MOD_INIT(ufs2)
|
||||
#else
|
||||
GRUB_MOD_INIT(ufs1)
|
||||
#endif
|
||||
{
|
||||
grub_fs_register (&grub_ufs_fs);
|
||||
my_mod = mod;
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(ufs)
|
||||
#ifdef MODE_UFS2
|
||||
GRUB_MOD_FINI(ufs2)
|
||||
#else
|
||||
GRUB_MOD_FINI(ufs1)
|
||||
#endif
|
||||
{
|
||||
grub_fs_unregister (&grub_ufs_fs);
|
||||
}
|
||||
|
|
3
fs/ufs2.c
Normal file
3
fs/ufs2.c
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* ufs2.c - Unix File System 2 */
|
||||
#define MODE_UFS2 1
|
||||
#include "ufs.c"
|
134
include/grub/fbblit.h
Normal file
134
include/grub/fbblit.h
Normal file
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* 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_FBBLIT_HEADER
|
||||
#define GRUB_FBBLIT_HEADER 1
|
||||
|
||||
/* NOTE: This header is private header for fb driver and should not be used
|
||||
in other parts of the code. */
|
||||
|
||||
struct grub_video_fbblit_info;
|
||||
|
||||
void
|
||||
grub_video_fbblit_replace (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_replace_directN (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_replace_BGRX8888_RGBX8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_replace_BGRX8888_RGB888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_replace_BGR888_RGBX8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_replace_BGR888_RGB888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_replace_RGBX8888_RGB888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_replace_RGB888_RGBX8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_replace_index_RGBX8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_replace_index_RGB888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_blend (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_blend_BGRA8888_RGBA8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_blend_BGR888_RGBA8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_blend_RGBA8888_RGBA8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_blend_RGB888_RGBA8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_blend_index_RGBA8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
#endif /* ! GRUB_FBBLIT_HEADER */
|
75
include/grub/fbfill.h
Normal file
75
include/grub/fbfill.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* 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_FBFILL_HEADER
|
||||
#define GRUB_FBFILL_HEADER 1
|
||||
|
||||
/* NOTE: This header is private header for fb driver and should not be used
|
||||
in other parts of the code. */
|
||||
|
||||
struct grub_video_fbblit_info;
|
||||
|
||||
struct grub_video_fbrender_target
|
||||
{
|
||||
/* Copy of the screen's mode info structure, except that width, height and
|
||||
mode_type has been re-adjusted to requested render target settings. */
|
||||
struct grub_video_mode_info mode_info;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned int x;
|
||||
unsigned int y;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
} viewport;
|
||||
|
||||
/* Indicates whether the data has been allocated by us and must be freed
|
||||
when render target is destroyed. */
|
||||
int is_allocated;
|
||||
|
||||
/* Pointer to data. Can either be in video card memory or in local host's
|
||||
memory. */
|
||||
grub_uint8_t *data;
|
||||
};
|
||||
|
||||
void
|
||||
grub_video_fbfill (struct grub_video_fbblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
void
|
||||
grub_video_fbfill_direct32 (struct grub_video_fbblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
void
|
||||
grub_video_fbfill_direct24 (struct grub_video_fbblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
void
|
||||
grub_video_fbfill_direct16 (struct grub_video_fbblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
void
|
||||
grub_video_fbfill_direct8 (struct grub_video_fbblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
#endif /* ! GRUB_FBFILL_HEADER */
|
|
@ -25,19 +25,19 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/video.h>
|
||||
|
||||
struct grub_video_i386_vbeblit_info
|
||||
struct grub_video_fbblit_info
|
||||
{
|
||||
struct grub_video_mode_info *mode_info;
|
||||
void *data;
|
||||
grub_uint8_t *data;
|
||||
};
|
||||
|
||||
grub_uint8_t *get_data_ptr (struct grub_video_i386_vbeblit_info *source,
|
||||
grub_uint8_t *grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y);
|
||||
|
||||
grub_video_color_t get_pixel (struct grub_video_i386_vbeblit_info *source,
|
||||
grub_video_color_t get_pixel (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y);
|
||||
|
||||
void set_pixel (struct grub_video_i386_vbeblit_info *source,
|
||||
void set_pixel (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y, grub_video_color_t color);
|
||||
|
||||
#endif /* ! GRUB_VBEUTIL_MACHINE_HEADER */
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
* 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
|
||||
|
@ -21,10 +21,13 @@
|
|||
|
||||
#include <grub/types.h>
|
||||
|
||||
#define KERNEL_TYPE_NONE 0
|
||||
#define KERNEL_TYPE_FREEBSD 1
|
||||
#define KERNEL_TYPE_OPENBSD 2
|
||||
#define KERNEL_TYPE_NETBSD 3
|
||||
enum bsd_kernel_types
|
||||
{
|
||||
KERNEL_TYPE_NONE,
|
||||
KERNEL_TYPE_FREEBSD,
|
||||
KERNEL_TYPE_OPENBSD,
|
||||
KERNEL_TYPE_NETBSD,
|
||||
};
|
||||
|
||||
#define GRUB_BSD_TEMP_BUFFER 0x68000
|
||||
|
||||
|
|
|
@ -19,10 +19,7 @@
|
|||
#ifndef GRUB_VBE_MACHINE_HEADER
|
||||
#define GRUB_VBE_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/video.h>
|
||||
#include <grub/video_fb.h>
|
||||
|
||||
/* Default video mode to be used. */
|
||||
#define GRUB_VBE_DEFAULT_VIDEO_MODE 0x101
|
||||
|
@ -30,6 +27,8 @@
|
|||
/* VBE status codes. */
|
||||
#define GRUB_VBE_STATUS_OK 0x004f
|
||||
|
||||
#define GRUB_VBE_CAPABILITY_DACWIDTH (1 << 0)
|
||||
|
||||
/* Bits from the GRUB_VBE "mode_attributes" field in the mode info struct. */
|
||||
#define GRUB_VBE_MODEATTR_SUPPORTED (1 << 0)
|
||||
#define GRUB_VBE_MODEATTR_RESERVED_1 (1 << 1)
|
||||
|
@ -181,6 +180,11 @@ grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_get_controller_info) (struct grub_vb
|
|||
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_get_mode_info) (grub_uint32_t mode,
|
||||
struct grub_vbe_mode_info_block *mode_info);
|
||||
|
||||
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_getset_dac_palette_width) (int set, int *width);
|
||||
|
||||
#define grub_vbe_bios_get_dac_palette_width(width) grub_vbe_bios_getset_dac_palette_width(0, (width))
|
||||
#define grub_vbe_bios_set_dac_palette_width(width) grub_vbe_bios_getset_dac_palette_width(1, (width))
|
||||
|
||||
/* Call VESA BIOS 0x4f02 to set video mode, return status. */
|
||||
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_set_mode) (grub_uint32_t mode,
|
||||
struct grub_vbe_crtc_info_block *crtc_info);
|
||||
|
@ -224,54 +228,5 @@ grub_err_t grub_vbe_get_video_mode (grub_uint32_t *mode);
|
|||
grub_err_t grub_vbe_get_video_mode_info (grub_uint32_t mode,
|
||||
struct grub_vbe_mode_info_block *mode_info);
|
||||
|
||||
/* VBE module internal prototypes (should not be used from elsewhere). */
|
||||
struct grub_video_i386_vbeblit_info;
|
||||
|
||||
struct grub_video_render_target
|
||||
{
|
||||
/* Copy of the screen's mode info structure, except that width, height and
|
||||
mode_type has been re-adjusted to requested render target settings. */
|
||||
struct grub_video_mode_info mode_info;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned int x;
|
||||
unsigned int y;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
} viewport;
|
||||
|
||||
/* Indicates whether the data has been allocated by us and must be freed
|
||||
when render target is destroyed. */
|
||||
int is_allocated;
|
||||
|
||||
/* Pointer to data. Can either be in video card memory or in local host's
|
||||
memory. */
|
||||
void *data;
|
||||
};
|
||||
|
||||
grub_uint8_t * grub_video_vbe_get_video_ptr (struct grub_video_i386_vbeblit_info *source,
|
||||
grub_uint32_t x, grub_uint32_t y);
|
||||
|
||||
grub_video_color_t grub_video_vbe_map_rgb (grub_uint8_t red, grub_uint8_t green,
|
||||
grub_uint8_t blue);
|
||||
|
||||
grub_video_color_t grub_video_vbe_map_rgba (grub_uint8_t red,
|
||||
grub_uint8_t green,
|
||||
grub_uint8_t blue,
|
||||
grub_uint8_t alpha);
|
||||
|
||||
grub_err_t grub_video_vbe_unmap_color (grub_video_color_t color,
|
||||
grub_uint8_t *red,
|
||||
grub_uint8_t *green,
|
||||
grub_uint8_t *blue,
|
||||
grub_uint8_t *alpha);
|
||||
|
||||
void grub_video_vbe_unmap_color_int (struct grub_video_i386_vbeblit_info *source,
|
||||
grub_video_color_t color,
|
||||
grub_uint8_t *red,
|
||||
grub_uint8_t *green,
|
||||
grub_uint8_t *blue,
|
||||
grub_uint8_t *alpha);
|
||||
|
||||
#endif /* ! GRUB_VBE_MACHINE_HEADER */
|
||||
|
|
|
@ -1,134 +0,0 @@
|
|||
/*
|
||||
* 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_VBEBLIT_MACHINE_HEADER
|
||||
#define GRUB_VBEBLIT_MACHINE_HEADER 1
|
||||
|
||||
/* NOTE: This header is private header for vbe driver and should not be used
|
||||
in other parts of the code. */
|
||||
|
||||
struct grub_video_i386_vbeblit_info;
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_replace (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_directN (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_BGRX8888_RGBX8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_BGRX8888_RGB888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_BGR888_RGBX8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_BGR888_RGB888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_RGBX8888_RGB888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_RGB888_RGBX8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_index_RGBX8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_index_RGB888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_blend (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_blend_BGRA8888_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_blend_BGR888_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_blend_RGBA8888_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_blend_RGB888_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_i386_vbeblit_blend_index_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
#endif /* ! GRUB_VBEBLIT_MACHINE_HEADER */
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* 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_VBEFILL_MACHINE_HEADER
|
||||
#define GRUB_VBEFILL_MACHINE_HEADER 1
|
||||
|
||||
/* NOTE: This header is private header for vbe driver and should not be used
|
||||
in other parts of the code. */
|
||||
|
||||
struct grub_video_i386_vbeblit_info;
|
||||
|
||||
void
|
||||
grub_video_i386_vbefill (struct grub_video_i386_vbeblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
void
|
||||
grub_video_i386_vbefill_direct32 (struct grub_video_i386_vbeblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
void
|
||||
grub_video_i386_vbefill_direct24 (struct grub_video_i386_vbeblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
void
|
||||
grub_video_i386_vbefill_direct16 (struct grub_video_i386_vbeblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
void
|
||||
grub_video_i386_vbefill_direct8 (struct grub_video_i386_vbeblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
#endif /* ! GRUB_VBEFILL_MACHINE_HEADER */
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
void EXPORT_FUNC (memset) (void) __attribute__ ((weak));
|
||||
void EXPORT_FUNC (__ashldi3) (void) __attribute__ ((weak));
|
||||
void EXPORT_FUNC (__ashrdi3) (void) __attribute__ ((weak));
|
||||
void EXPORT_FUNC (__lshrdi3) (void) __attribute__ ((weak));
|
||||
void EXPORT_FUNC (__trampoline_setup) (void) __attribute__ ((weak));
|
||||
void EXPORT_FUNC (__ucmpdi2) (void) __attribute__ ((weak));
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
|
||||
#include <config.h>
|
||||
|
||||
/* Apple assembler requires local labels to start with a capital L */
|
||||
#define LOCAL(sym) L_ ## sym
|
||||
|
||||
/* Add an underscore to a C symbol in assembler code if needed. */
|
||||
#ifdef HAVE_ASM_USCORE
|
||||
# define EXT_C(sym) _ ## sym
|
||||
|
|
|
@ -48,10 +48,8 @@ struct grub_video_bitmap;
|
|||
#define GRUB_VIDEO_MODE_TYPE_DEPTH_MASK 0x0000ff00
|
||||
#define GRUB_VIDEO_MODE_TYPE_DEPTH_POS 8
|
||||
|
||||
/* Defined predefined render targets. */
|
||||
#define GRUB_VIDEO_RENDER_TARGET_DISPLAY ((struct grub_video_render_target *) 0)
|
||||
#define GRUB_VIDEO_RENDER_TARGET_FRONT_BUFFER ((struct grub_video_render_target *) 0)
|
||||
#define GRUB_VIDEO_RENDER_TARGET_BACK_BUFFER ((struct grub_video_render_target *) 1)
|
||||
#define GRUB_VIDEO_RENDER_TARGET_DISPLAY \
|
||||
((struct grub_video_render_target *) 0)
|
||||
|
||||
/* Defined blitting formats. */
|
||||
enum grub_video_blit_format
|
||||
|
@ -177,6 +175,9 @@ struct grub_video_adapter
|
|||
|
||||
grub_err_t (*get_info) (struct grub_video_mode_info *mode_info);
|
||||
|
||||
grub_err_t (*get_info_and_fini) (struct grub_video_mode_info *mode_info,
|
||||
void **framebuffer);
|
||||
|
||||
grub_err_t (*set_palette) (unsigned int start, unsigned int count,
|
||||
struct grub_video_palette_data *palette_data);
|
||||
|
||||
|
@ -241,6 +242,14 @@ grub_err_t grub_video_restore (void);
|
|||
|
||||
grub_err_t 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
|
||||
sure that framebuffer address doesn't change. To ensure this abstraction
|
||||
grub_video_get_info_and_fini is the only function supplying framebuffer
|
||||
address. */
|
||||
grub_err_t grub_video_get_info_and_fini (struct grub_video_mode_info *mode_info,
|
||||
void **framebuffer);
|
||||
|
||||
enum grub_video_blit_format grub_video_get_blit_format (struct grub_video_mode_info *mode_info);
|
||||
|
||||
grub_err_t grub_video_set_palette (unsigned int start, unsigned int count,
|
||||
|
@ -297,7 +306,7 @@ grub_err_t grub_video_set_active_render_target (struct grub_video_render_target
|
|||
|
||||
grub_err_t grub_video_get_active_render_target (struct grub_video_render_target **target);
|
||||
|
||||
grub_err_t grub_video_set_mode (char *modestring,
|
||||
grub_err_t grub_video_set_mode (const char *modestring,
|
||||
int NESTED_FUNC_ATTR (*hook) (grub_video_adapter_t p,
|
||||
struct grub_video_mode_info *mode_info));
|
||||
|
||||
|
|
118
include/grub/video_fb.h
Normal file
118
include/grub/video_fb.h
Normal file
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005,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_VIDEO_FB_HEADER
|
||||
#define GRUB_VIDEO_FB_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/video.h>
|
||||
|
||||
/* FB module internal prototype (should not be used from elsewhere). */
|
||||
|
||||
struct grub_video_fbblit_info;
|
||||
|
||||
struct grub_video_fbrender_target;
|
||||
|
||||
#define GRUB_VIDEO_FBSTD_NUMCOLORS 16
|
||||
extern struct grub_video_palette_data grub_video_fbstd_colors[GRUB_VIDEO_FBSTD_NUMCOLORS];
|
||||
|
||||
grub_err_t
|
||||
grub_video_fb_init (void);
|
||||
|
||||
grub_err_t
|
||||
grub_video_fb_fini (void);
|
||||
|
||||
grub_err_t
|
||||
grub_video_fb_get_info (struct grub_video_mode_info *mode_info);
|
||||
|
||||
grub_err_t
|
||||
grub_video_fb_get_palette (unsigned int start, unsigned int count,
|
||||
struct grub_video_palette_data *palette_data);
|
||||
grub_err_t
|
||||
grub_video_fb_set_palette (unsigned int start, unsigned int count,
|
||||
struct grub_video_palette_data *palette_data);
|
||||
grub_err_t
|
||||
grub_video_fb_set_viewport (unsigned int x, unsigned int y,
|
||||
unsigned int width, unsigned int height);
|
||||
grub_err_t
|
||||
grub_video_fb_get_viewport (unsigned int *x, unsigned int *y,
|
||||
unsigned int *width, unsigned int *height);
|
||||
|
||||
grub_video_color_t
|
||||
grub_video_fb_map_color (grub_uint32_t color_name);
|
||||
|
||||
grub_video_color_t
|
||||
grub_video_fb_map_rgb (grub_uint8_t red, grub_uint8_t green,
|
||||
grub_uint8_t blue);
|
||||
|
||||
grub_video_color_t
|
||||
grub_video_fb_map_rgba (grub_uint8_t red, grub_uint8_t green,
|
||||
grub_uint8_t blue, grub_uint8_t alpha);
|
||||
|
||||
grub_err_t
|
||||
grub_video_fb_unmap_color (grub_video_color_t color,
|
||||
grub_uint8_t *red, grub_uint8_t *green,
|
||||
grub_uint8_t *blue, grub_uint8_t *alpha);
|
||||
|
||||
void
|
||||
grub_video_fb_unmap_color_int (struct grub_video_fbblit_info * source,
|
||||
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_fb_fill_rect (grub_video_color_t color, int x, int y,
|
||||
unsigned int width, unsigned int height);
|
||||
|
||||
grub_err_t
|
||||
grub_video_fb_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_fb_blit_render_target (struct grub_video_fbrender_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_fb_scroll (grub_video_color_t color, int dx, int dy);
|
||||
|
||||
grub_err_t
|
||||
grub_video_fb_create_render_target (struct grub_video_fbrender_target **result,
|
||||
unsigned int width, unsigned int height,
|
||||
unsigned int mode_type __attribute__ ((unused)));
|
||||
|
||||
grub_err_t
|
||||
grub_video_fb_create_render_target_from_pointer (struct grub_video_fbrender_target **result,
|
||||
const struct grub_video_mode_info *mode_info,
|
||||
void *ptr);
|
||||
|
||||
grub_err_t
|
||||
grub_video_fb_delete_render_target (struct grub_video_fbrender_target *target);
|
||||
|
||||
grub_err_t
|
||||
grub_video_fb_get_active_render_target (struct grub_video_fbrender_target **target);
|
||||
|
||||
grub_err_t
|
||||
grub_video_fb_set_active_render_target (struct grub_video_fbrender_target *target);
|
||||
|
||||
#endif /* ! GRUB_VIDEO_FB_HEADER */
|
|
@ -1732,6 +1732,52 @@ FUNCTION(grub_vbe_bios_get_mode)
|
|||
popl %ebp
|
||||
ret
|
||||
|
||||
/*
|
||||
* grub_vbe_status_t grub_vbe_bios_getset_dac_palette_width (int set, int *dac_mask_size)
|
||||
*
|
||||
* Register allocations for parameters:
|
||||
* %eax set
|
||||
* %edx *dac_mask_size
|
||||
*/
|
||||
FUNCTION(grub_vbe_bios_getset_dac_palette_width)
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
|
||||
xorl %ebx, %ebx
|
||||
|
||||
/* If we only want to fetch the value, set %bl to 1. */
|
||||
testl %eax, %eax
|
||||
jne 1f
|
||||
incb %bl
|
||||
1:
|
||||
|
||||
/* Put desired width in %bh. */
|
||||
movl (%edx), %eax
|
||||
movb %al, %bh
|
||||
|
||||
call prot_to_real
|
||||
.code16
|
||||
|
||||
movw $0x4f08, %ax
|
||||
int $0x10
|
||||
|
||||
movw %ax, %dx /* real_to_prot destroys %eax. */
|
||||
|
||||
DATA32 call real_to_prot
|
||||
.code32
|
||||
|
||||
/* Move result back to *dac_mask_size. */
|
||||
movb %bh, %al
|
||||
movl %eax, (%edx)
|
||||
|
||||
/* Return value in %eax. */
|
||||
xorl %eax, %eax
|
||||
movw %dx, %ax
|
||||
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
|
||||
/*
|
||||
* grub_vbe_status_t grub_vbe_bios_set_memory_window (grub_uint32_t window,
|
||||
* grub_uint32_t position);
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
#define MOD_BUF_ALLOC_UNIT 4096
|
||||
|
||||
static int kernel_type;
|
||||
static int kernel_type = KERNEL_TYPE_NONE;
|
||||
static grub_dl_t my_mod;
|
||||
static grub_addr_t entry, entry_hi, kern_start, kern_end;
|
||||
static grub_uint32_t bootflags;
|
||||
|
@ -614,10 +614,10 @@ grub_bsd_load_aout (grub_file_t file)
|
|||
return grub_errno;
|
||||
|
||||
if (grub_file_read (file, &ah, sizeof (ah)) != sizeof (ah))
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "cannot read the a.out header");
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "Cannot read the a.out header");
|
||||
|
||||
if (grub_aout_get_type (&ah) != AOUT_TYPE_AOUT32)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "invalid a.out header");
|
||||
return grub_error (GRUB_ERR_BAD_OS, "Invalid a.out header");
|
||||
|
||||
entry = ah.aout32.a_entry & 0xFFFFFF;
|
||||
|
||||
|
@ -635,7 +635,7 @@ grub_bsd_load_aout (grub_file_t file)
|
|||
}
|
||||
|
||||
if (load_addr < 0x100000)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "load address below 1M");
|
||||
return grub_error (GRUB_ERR_BAD_OS, "Load address below 1M");
|
||||
|
||||
kern_start = load_addr;
|
||||
kern_end = load_addr + ah.aout32.a_text + ah.aout32.a_data;
|
||||
|
@ -738,7 +738,7 @@ grub_bsd_load_elf (grub_elf_t elf)
|
|||
return grub_elf64_load (elf, grub_bsd_elf64_hook, 0, 0);
|
||||
}
|
||||
else
|
||||
return grub_error (GRUB_ERR_BAD_OS, "invalid elf");
|
||||
return grub_error (GRUB_ERR_BAD_OS, "Invalid elf");
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
|
@ -753,7 +753,7 @@ grub_bsd_load (int argc, char *argv[])
|
|||
|
||||
if (argc == 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "No kernel specified");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -914,13 +914,17 @@ grub_cmd_freebsd_loadenv (grub_command_t cmd __attribute__ ((unused)),
|
|||
char *buf = 0, *curr, *next;
|
||||
int len;
|
||||
|
||||
if (kernel_type == KERNEL_TYPE_NONE)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"You need to load the kernel first.");
|
||||
|
||||
if (kernel_type != KERNEL_TYPE_FREEBSD)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"only freebsd support environment");
|
||||
"Only FreeBSD support environment");
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "no filename");
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "No filename");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -1004,13 +1008,17 @@ grub_cmd_freebsd_module (grub_command_t cmd __attribute__ ((unused)),
|
|||
char **modargv;
|
||||
char *type;
|
||||
|
||||
if (kernel_type == KERNEL_TYPE_NONE)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"You need to load the kernel first.");
|
||||
|
||||
if (kernel_type != KERNEL_TYPE_FREEBSD)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"only freebsd support module");
|
||||
"Only FreeBSD support module");
|
||||
|
||||
if (!is_elf_kernel)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"only elf kernel support module");
|
||||
"Only ELF kernel support module");
|
||||
|
||||
/* List the current modules if no parameter. */
|
||||
if (!argc)
|
||||
|
@ -1066,13 +1074,17 @@ grub_cmd_freebsd_module_elf (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_file_t file = 0;
|
||||
grub_err_t err;
|
||||
|
||||
if (kernel_type == KERNEL_TYPE_NONE)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"You need to load the kernel first.");
|
||||
|
||||
if (kernel_type != KERNEL_TYPE_FREEBSD)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"only freebsd support module");
|
||||
"Only FreeBSD support module");
|
||||
|
||||
if (! is_elf_kernel)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"only elf kernel support module");
|
||||
"Only ELF kernel support module");
|
||||
|
||||
/* List the current modules if no parameter. */
|
||||
if (! argc)
|
||||
|
@ -1108,22 +1120,22 @@ GRUB_MOD_INIT (bsd)
|
|||
{
|
||||
cmd_freebsd =
|
||||
grub_register_command ("freebsd", grub_cmd_freebsd,
|
||||
0, "load freebsd kernel");
|
||||
0, "load kernel of FreeBSD");
|
||||
cmd_openbsd =
|
||||
grub_register_command ("openbsd", grub_cmd_openbsd,
|
||||
0, "load openbsd kernel");
|
||||
0, "load kernel of OpenBSD");
|
||||
cmd_netbsd =
|
||||
grub_register_command ("netbsd", grub_cmd_netbsd,
|
||||
0, "load netbsd kernel");
|
||||
0, "load kernel of NetBSD");
|
||||
cmd_freebsd_loadenv =
|
||||
grub_register_command ("freebsd_loadenv", grub_cmd_freebsd_loadenv,
|
||||
0, "load freebsd env");
|
||||
0, "load FreeBSD env");
|
||||
cmd_freebsd_module =
|
||||
grub_register_command ("freebsd_module", grub_cmd_freebsd_module,
|
||||
0, "load freebsd module");
|
||||
0, "load FreeBSD kernel module");
|
||||
cmd_freebsd_module_elf =
|
||||
grub_register_command ("freebsd_module_elf", grub_cmd_freebsd_module_elf,
|
||||
0, "load freebsd ELF module");
|
||||
0, "load FreeBSD kernel module (ELF)");
|
||||
|
||||
my_mod = mod;
|
||||
}
|
||||
|
|
|
@ -31,24 +31,12 @@
|
|||
#include <grub/term.h>
|
||||
#include <grub/cpu/linux.h>
|
||||
#include <grub/video.h>
|
||||
/* FIXME: the definition of `struct grub_video_render_target' is
|
||||
VBE-specific. */
|
||||
#include <grub/i386/pc/vbe.h>
|
||||
#include <grub/video_fb.h>
|
||||
#include <grub/command.h>
|
||||
|
||||
#define GRUB_LINUX_CL_OFFSET 0x1000
|
||||
#define GRUB_LINUX_CL_END_OFFSET 0x2000
|
||||
|
||||
/* This macro is useful for distributors, who can be certain they built FB support
|
||||
into Linux, and therefore can benefit from seamless mode transition between
|
||||
GRUB and Linux (saving boot time and visual glitches). Official GRUB, OTOH,
|
||||
needs to be conservative. */
|
||||
#ifdef GRUB_ASSUME_LINUX_HAS_FB_SUPPORT
|
||||
#define DEFAULT_VIDEO_MODE "keep,1024x768,800x600,640x480"
|
||||
#else
|
||||
#define DEFAULT_VIDEO_MODE "text"
|
||||
#endif
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
static grub_size_t linux_mem_size;
|
||||
|
@ -403,14 +391,11 @@ static int
|
|||
grub_linux_setup_video (struct linux_kernel_params *params)
|
||||
{
|
||||
struct grub_video_mode_info mode_info;
|
||||
struct grub_video_render_target *render_target;
|
||||
void *framebuffer;
|
||||
int ret;
|
||||
|
||||
ret = grub_video_get_info (&mode_info);
|
||||
if (ret)
|
||||
return 1;
|
||||
ret = grub_video_get_info_and_fini (&mode_info, &framebuffer);
|
||||
|
||||
ret = grub_video_get_active_render_target (&render_target);
|
||||
if (ret)
|
||||
return 1;
|
||||
|
||||
|
@ -419,7 +404,7 @@ grub_linux_setup_video (struct linux_kernel_params *params)
|
|||
params->lfb_depth = mode_info.bpp;
|
||||
params->lfb_line_len = mode_info.pitch;
|
||||
|
||||
params->lfb_base = (grub_size_t) render_target->data;
|
||||
params->lfb_base = (grub_size_t) framebuffer;
|
||||
params->lfb_size = (params->lfb_line_len * params->lfb_height + 65535) >> 16;
|
||||
|
||||
params->red_mask_size = mode_info.red_mask_size;
|
||||
|
@ -449,41 +434,6 @@ grub_linux_boot (void)
|
|||
|
||||
params = real_mode_mem;
|
||||
|
||||
modevar = grub_env_get ("gfxpayload");
|
||||
|
||||
/* Now all graphical modes are acceptable.
|
||||
May change in future if we have modes without framebuffer. */
|
||||
if (modevar && *modevar != 0)
|
||||
{
|
||||
tmp = grub_malloc (grub_strlen (modevar)
|
||||
+ sizeof (DEFAULT_VIDEO_MODE) + 1);
|
||||
if (! tmp)
|
||||
return grub_errno;
|
||||
grub_sprintf (tmp, "%s;" DEFAULT_VIDEO_MODE, modevar);
|
||||
err = grub_video_set_mode (tmp, 0);
|
||||
grub_free (tmp);
|
||||
}
|
||||
#ifndef GRUB_ASSUME_LINUX_HAS_FB_SUPPORT
|
||||
else
|
||||
err = grub_video_set_mode (DEFAULT_VIDEO_MODE, 0);
|
||||
#endif
|
||||
|
||||
if (err)
|
||||
{
|
||||
grub_print_error ();
|
||||
grub_printf ("Booting however\n");
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
if (! grub_linux_setup_video (params))
|
||||
params->have_vga = GRUB_VIDEO_TYPE_VLFB;
|
||||
else
|
||||
{
|
||||
params->have_vga = GRUB_VIDEO_TYPE_TEXT;
|
||||
params->video_width = 80;
|
||||
params->video_height = 25;
|
||||
}
|
||||
|
||||
grub_dprintf ("linux", "code32_start = %x, idt_desc = %lx, gdt_desc = %lx\n",
|
||||
(unsigned) params->code32_start,
|
||||
(unsigned long) &(idt_desc.limit),
|
||||
|
@ -534,6 +484,39 @@ grub_linux_boot (void)
|
|||
grub_mmap_iterate (hook);
|
||||
params->mmap_size = e820_num;
|
||||
|
||||
modevar = grub_env_get ("gfxpayload");
|
||||
|
||||
/* Now all graphical modes are acceptable.
|
||||
May change in future if we have modes without framebuffer. */
|
||||
if (modevar && *modevar != 0)
|
||||
{
|
||||
tmp = grub_malloc (grub_strlen (modevar)
|
||||
+ sizeof (";text"));
|
||||
if (! tmp)
|
||||
return grub_errno;
|
||||
grub_sprintf (tmp, "%s;text", modevar);
|
||||
err = grub_video_set_mode (tmp, 0);
|
||||
grub_free (tmp);
|
||||
}
|
||||
else
|
||||
err = grub_video_set_mode ("text", 0);
|
||||
|
||||
if (err)
|
||||
{
|
||||
grub_print_error ();
|
||||
grub_printf ("Booting however\n");
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
if (! grub_linux_setup_video (params))
|
||||
params->have_vga = GRUB_VIDEO_TYPE_VLFB;
|
||||
else
|
||||
{
|
||||
params->have_vga = GRUB_VIDEO_TYPE_TEXT;
|
||||
params->video_width = 80;
|
||||
params->video_height = 25;
|
||||
}
|
||||
|
||||
/* Initialize these last, because terminal position could be affected by printfs above. */
|
||||
if (params->have_vga == GRUB_VIDEO_TYPE_TEXT)
|
||||
{
|
||||
|
|
|
@ -85,7 +85,7 @@ grub_multiboot_boot (void)
|
|||
static grub_err_t
|
||||
grub_multiboot_unload (void)
|
||||
{
|
||||
if (mbi)
|
||||
if (playground)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < mbi->mods_count; i++)
|
||||
|
@ -96,11 +96,11 @@ grub_multiboot_unload (void)
|
|||
((struct grub_mod_list *) mbi->mods_addr)[i].cmdline);
|
||||
}
|
||||
grub_free ((void *) mbi->mods_addr);
|
||||
grub_free ((void *) mbi->cmdline);
|
||||
grub_free (mbi);
|
||||
grub_free (playground);
|
||||
}
|
||||
|
||||
mbi = 0;
|
||||
mbi = NULL;
|
||||
playground = NULL;
|
||||
grub_dl_unref (my_mod);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
|
@ -218,6 +218,8 @@ grub_multiboot (int argc, char *argv[])
|
|||
grub_ssize_t len, cmdline_length, boot_loader_name_length;
|
||||
grub_uint32_t mmap_length;
|
||||
int i;
|
||||
int cmdline_argc;
|
||||
char **cmdline_argv;
|
||||
|
||||
grub_loader_unset ();
|
||||
|
||||
|
@ -271,8 +273,15 @@ grub_multiboot (int argc, char *argv[])
|
|||
mmap_length = grub_get_multiboot_mmap_len ();
|
||||
|
||||
/* Figure out cmdline length. */
|
||||
for (i = 0, cmdline_length = 0; i < argc; i++)
|
||||
cmdline_length += grub_strlen (argv[i]) + 1;
|
||||
/* Skip filename. */
|
||||
cmdline_argc = argc - 1;
|
||||
cmdline_argv = argv + 1;
|
||||
|
||||
for (i = 0, cmdline_length = 0; i < cmdline_argc; i++)
|
||||
cmdline_length += grub_strlen (cmdline_argv[i]) + 1;
|
||||
|
||||
if (cmdline_length == 0)
|
||||
cmdline_length = 1;
|
||||
|
||||
boot_loader_name_length = sizeof(PACKAGE_STRING);
|
||||
|
||||
|
@ -351,14 +360,16 @@ grub_multiboot (int argc, char *argv[])
|
|||
if (! cmdline)
|
||||
goto fail;
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
for (i = 0; i < cmdline_argc; i++)
|
||||
{
|
||||
p = grub_stpcpy (p, argv[i]);
|
||||
p = grub_stpcpy (p, cmdline_argv[i]);
|
||||
*(p++) = ' ';
|
||||
}
|
||||
|
||||
/* Remove the space after the last word. */
|
||||
*(--p) = '\0';
|
||||
if (p != cmdline)
|
||||
p--;
|
||||
*p = 0;
|
||||
|
||||
mbi->flags |= MULTIBOOT_INFO_CMDLINE;
|
||||
mbi->cmdline = (grub_uint32_t) cmdline_addr (grub_multiboot_payload_dest);
|
||||
|
@ -395,6 +406,8 @@ grub_module (int argc, char *argv[])
|
|||
grub_ssize_t size, len = 0;
|
||||
char *module = 0, *cmdline = 0, *p;
|
||||
int i;
|
||||
int cmdline_argc;
|
||||
char **cmdline_argv;
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
|
@ -424,21 +437,30 @@ grub_module (int argc, char *argv[])
|
|||
goto fail;
|
||||
}
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
len += grub_strlen (argv[i]) + 1;
|
||||
/* Skip module name. */
|
||||
cmdline_argc = argc - 1;
|
||||
cmdline_argv = argv + 1;
|
||||
|
||||
for (i = 0; i < cmdline_argc; i++)
|
||||
len += grub_strlen (cmdline_argv[i]) + 1;
|
||||
|
||||
if (len == 0)
|
||||
len = 1;
|
||||
|
||||
cmdline = p = grub_malloc (len);
|
||||
if (! cmdline)
|
||||
goto fail;
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
for (i = 0; i < cmdline_argc; i++)
|
||||
{
|
||||
p = grub_stpcpy (p, argv[i]);
|
||||
p = grub_stpcpy (p, cmdline_argv[i]);
|
||||
*(p++) = ' ';
|
||||
}
|
||||
|
||||
/* Remove the space after the last word. */
|
||||
*(--p) = '\0';
|
||||
if (p != cmdline)
|
||||
p--;
|
||||
*p = '\0';
|
||||
|
||||
if (mbi->flags & MULTIBOOT_INFO_MODS)
|
||||
{
|
||||
|
|
|
@ -21,8 +21,7 @@
|
|||
#include <grub/xnu.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/cpu/xnu.h>
|
||||
#include <grub/machine/vbe.h>
|
||||
#include <grub/machine/vga.h>
|
||||
#include <grub/video_fb.h>
|
||||
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
|
@ -43,10 +42,10 @@ grub_err_t
|
|||
grub_xnu_set_video (struct grub_xnu_boot_params *params)
|
||||
{
|
||||
struct grub_video_mode_info mode_info;
|
||||
struct grub_video_render_target *render_target;
|
||||
int ret;
|
||||
int x,y;
|
||||
char *tmp, *modevar;
|
||||
void *framebuffer;
|
||||
grub_err_t err;
|
||||
|
||||
modevar = grub_env_get ("gfxpayload");
|
||||
|
@ -67,11 +66,7 @@ grub_xnu_set_video (struct grub_xnu_boot_params *params)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
ret = grub_video_get_info (&mode_info);
|
||||
if (ret)
|
||||
return grub_error (GRUB_ERR_IO, "couldn't retrieve video parameters");
|
||||
|
||||
ret = grub_video_get_active_render_target (&render_target);
|
||||
ret = grub_video_get_info_and_fini (&mode_info, &framebuffer);
|
||||
if (ret)
|
||||
return grub_error (GRUB_ERR_IO, "couldn't retrieve video parameters");
|
||||
|
||||
|
@ -102,7 +97,7 @@ grub_xnu_set_video (struct grub_xnu_boot_params *params)
|
|||
params->lfb_depth = mode_info.bpp;
|
||||
params->lfb_line_len = mode_info.pitch;
|
||||
|
||||
params->lfb_base = PTR_TO_UINT32 (render_target->data);
|
||||
params->lfb_base = PTR_TO_UINT32 (framebuffer);
|
||||
params->lfb_mode = grub_xnu_bitmap
|
||||
? GRUB_XNU_VIDEO_SPLASH : GRUB_XNU_VIDEO_TEXT_IN_VIDEO;
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
echo "656669{ 6465766963652d70726f70657274696573:"
|
||||
ioreg -lw0 -p IODeviceTree -n efi -r -x |grep device-properties | sed 's/.*<//;s/>.*//;'
|
||||
echo ";}"
|
|
@ -24,6 +24,9 @@ sbindir=@sbindir@
|
|||
libdir=@libdir@
|
||||
sysconfdir=@sysconfdir@
|
||||
package_version=@PACKAGE_VERSION@
|
||||
datarootdir=@datarootdir@
|
||||
datadir=@datadir@
|
||||
pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`
|
||||
grub_prefix=`echo /boot/grub | sed ${transform}`
|
||||
grub_cfg=""
|
||||
grub_mkconfig_dir=${sysconfdir}/grub.d
|
||||
|
@ -138,43 +141,71 @@ if [ "x${GRUB_TERMINAL}" != "x" ] ; then
|
|||
fi
|
||||
|
||||
case x${GRUB_TERMINAL_OUTPUT} in
|
||||
x)
|
||||
# If this platform supports gfxterm, try to use it.
|
||||
if test -e ${grub_prefix}/gfxterm.mod ; then
|
||||
GRUB_TERMINAL_OUTPUT=gfxterm
|
||||
fi
|
||||
;;
|
||||
xconsole | xserial | xofconsole | xgfxterm) ;;
|
||||
x | xconsole | xserial | xofconsole | xgfxterm) ;;
|
||||
*) echo "Invalid output terminal \"${GRUB_TERMINAL_OUTPUT}\"" >&2 ; exit 1 ;;
|
||||
esac
|
||||
|
||||
# check for terminals that require fonts
|
||||
case ${GRUB_TERMINAL_OUTPUT} in
|
||||
gfxterm)
|
||||
if path=`font_path` ; then
|
||||
GRUB_FONT_PATH="${path}"
|
||||
if [ -n "$GRUB_FONT" ] ; then
|
||||
if is_path_readable_by_grub ${GRUB_FONT} > /dev/null ; then
|
||||
GRUB_FONT_PATH=${GRUB_FONT}
|
||||
else
|
||||
echo "No such font or not readable by grub: ${GRUB_FONT}" >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
for dir in ${pkgdatadir} /boot/grub /usr/share/grub ; do
|
||||
for basename in unicode unifont ascii; do
|
||||
path="${dir}/${basename}.pf2"
|
||||
if is_path_readable_by_grub ${path} > /dev/null ; then
|
||||
GRUB_FONT_PATH=${path}
|
||||
else
|
||||
continue
|
||||
fi
|
||||
if [ "${basename}" = "ascii" ] ; then
|
||||
# make sure all our children behave in conformance with ascii..
|
||||
export LANG=C
|
||||
fi
|
||||
break 2
|
||||
done
|
||||
done
|
||||
fi
|
||||
if [ -z "${GRUB_FONT_PATH}" ] ; then
|
||||
# fallback to the native terminal for this platform
|
||||
unset GRUB_TERMINAL_OUTPUT
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# does our terminal support utf-8 ?
|
||||
case ${GRUB_TERMINAL_OUTPUT} in
|
||||
gfxterm) ;;
|
||||
*)
|
||||
# make sure all our children behave in conformance with ascii..
|
||||
export LANG=C
|
||||
;;
|
||||
esac
|
||||
|
||||
# These are defined in this script, export them here so that user can
|
||||
# override them.
|
||||
export GRUB_DEVICE GRUB_DEVICE_UUID GRUB_DEVICE_BOOT GRUB_DEVICE_BOOT_UUID GRUB_FS GRUB_FONT_PATH GRUB_PRELOAD_MODULES
|
||||
export GRUB_DEVICE \
|
||||
GRUB_DEVICE_UUID \
|
||||
GRUB_DEVICE_BOOT \
|
||||
GRUB_DEVICE_BOOT_UUID \
|
||||
GRUB_FS \
|
||||
GRUB_FONT_PATH \
|
||||
GRUB_PRELOAD_MODULES
|
||||
|
||||
# These are optional, user-defined variables.
|
||||
export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_CMDLINE_LINUX_DEFAULT GRUB_TERMINAL_INPUT GRUB_TERMINAL_OUTPUT GRUB_SERIAL_COMMAND GRUB_DISABLE_LINUX_UUID GRUB_DISABLE_LINUX_RECOVERY GRUB_GFXMODE
|
||||
export GRUB_DEFAULT \
|
||||
GRUB_HIDDEN_TIMEOUT \
|
||||
GRUB_HIDDEN_TIMEOUT_QUIET \
|
||||
GRUB_TIMEOUT \
|
||||
GRUB_DISTRIBUTOR \
|
||||
GRUB_CMDLINE_LINUX \
|
||||
GRUB_CMDLINE_LINUX_DEFAULT \
|
||||
GRUB_TERMINAL_INPUT \
|
||||
GRUB_TERMINAL_OUTPUT \
|
||||
GRUB_SERIAL_COMMAND \
|
||||
GRUB_DISABLE_LINUX_UUID \
|
||||
GRUB_DISABLE_LINUX_RECOVERY \
|
||||
GRUB_GFXMODE
|
||||
|
||||
if test "x${grub_cfg}" != "x"; then
|
||||
rm -f ${grub_cfg}.new
|
||||
|
|
|
@ -136,9 +136,9 @@ prepare_grub_to_access_device ()
|
|||
|
||||
# Abstraction modules aren't auto-loaded.
|
||||
abstraction="`${grub_probe} --device ${device} --target=abstraction`"
|
||||
if [ "x${abstraction}" = "x" ] ; then : ; else
|
||||
echo "insmod ${abstraction}"
|
||||
fi
|
||||
for module in ${abstraction} ; do
|
||||
echo "insmod ${module}"
|
||||
done
|
||||
|
||||
# If there's a filesystem UUID that GRUB is capable of identifying, use it;
|
||||
# otherwise set root as per value in device.map.
|
||||
|
@ -148,23 +148,6 @@ prepare_grub_to_access_device ()
|
|||
fi
|
||||
}
|
||||
|
||||
font_path ()
|
||||
{
|
||||
for dir in ${pkgdatadir} /boot/grub /usr/share/grub ; do
|
||||
# FIXME: We prefer ascii because loading complete fonts is too slow (and
|
||||
# we don't yet provide the gettext magic that would make unicode useful).
|
||||
for basename in ascii unicode unifont ; do
|
||||
path="${dir}/${basename}.pf2"
|
||||
if is_path_readable_by_grub ${path} > /dev/null ; then
|
||||
echo "${path}"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
grub_file_is_not_garbage ()
|
||||
{
|
||||
if test -f "$1" ; then
|
||||
|
@ -176,3 +159,54 @@ grub_file_is_not_garbage ()
|
|||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
version_test_numeric ()
|
||||
{
|
||||
local a=$1
|
||||
local cmp=$2
|
||||
local b=$3
|
||||
if [ "$a" = "$b" ] ; then
|
||||
case $cmp in
|
||||
ge|eq|le) return 0 ;;
|
||||
gt|lt) return 1 ;;
|
||||
esac
|
||||
fi
|
||||
if [ "$cmp" = "lt" ] ; then
|
||||
c=$a
|
||||
a=$b
|
||||
b=$c
|
||||
fi
|
||||
if (echo $a ; echo $b) | sort -n | head -n 1 | grep -qx $b ; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
version_test_gt ()
|
||||
{
|
||||
local a=`echo $1 | sed -e "s/[^-]*-//"`
|
||||
local b=`echo $2 | sed -e "s/[^-]*-//"`
|
||||
local cmp=gt
|
||||
if [ "x$b" = "x" ] ; then
|
||||
return 0
|
||||
fi
|
||||
case $a:$b in
|
||||
*.old:*.old) ;;
|
||||
*.old:*) a=`echo -n $a | sed -e s/\.old$//` ; cmp=gt ;;
|
||||
*:*.old) b=`echo -n $b | sed -e s/\.old$//` ; cmp=ge ;;
|
||||
esac
|
||||
version_test_numeric $a $cmp $b
|
||||
return $?
|
||||
}
|
||||
|
||||
version_find_latest ()
|
||||
{
|
||||
local a=""
|
||||
for i in $@ ; do
|
||||
if version_test_gt "$i" "$a" ; then
|
||||
a="$i"
|
||||
fi
|
||||
done
|
||||
echo "$a"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
# update-grub helper script.
|
||||
# grub-mkconfig helper script.
|
||||
# Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# GRUB is free software: you can redistribute it and/or modify
|
||||
|
@ -37,7 +37,6 @@ if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=640x480 ; fi
|
|||
|
||||
cat << EOF
|
||||
set default=${GRUB_DEFAULT}
|
||||
set timeout=${GRUB_TIMEOUT}
|
||||
EOF
|
||||
|
||||
case ${GRUB_TERMINAL_INPUT}:${GRUB_TERMINAL_OUTPUT} in
|
||||
|
@ -112,3 +111,20 @@ fi
|
|||
EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then
|
||||
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
|
||||
verbose=
|
||||
else
|
||||
verbose=" --verbose"
|
||||
fi
|
||||
cat << EOF
|
||||
if sleep$verbose --interruptible ${GRUB_HIDDEN_TIMEOUT} ; then
|
||||
set timeout=${GRUB_TIMEOUT}
|
||||
fi
|
||||
EOF
|
||||
else
|
||||
cat << EOF
|
||||
set timeout=${GRUB_TIMEOUT}
|
||||
EOF
|
||||
fi
|
||||
|
|
|
@ -50,8 +50,6 @@ if [ "x$kfreebsd" != "x" ] ; then
|
|||
devices_rel_dirname=`make_system_path_relative_to_its_root $devices_dirname`
|
||||
fi
|
||||
|
||||
root_device=`basename ${GRUB_DEVICE}`
|
||||
|
||||
# For "ufs" it's the same. Do we care about the others?
|
||||
kfreebsd_fs=${GRUB_FS}
|
||||
|
||||
|
@ -69,7 +67,8 @@ EOF
|
|||
EOF
|
||||
fi
|
||||
cat << EOF
|
||||
set FreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${root_device}
|
||||
set FreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${GRUB_DEVICE}
|
||||
set FreeBSD.vfs.root.mountfrom.options=rw
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
# update-grub helper script.
|
||||
# grub-mkconfig helper script.
|
||||
# Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# GRUB is free software: you can redistribute it and/or modify
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
# update-grub helper script.
|
||||
# grub-mkconfig helper script.
|
||||
# Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# GRUB is free software: you can redistribute it and/or modify
|
||||
|
@ -42,57 +42,6 @@ else
|
|||
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
|
||||
fi
|
||||
|
||||
test_numeric ()
|
||||
{
|
||||
local a=$1
|
||||
local cmp=$2
|
||||
local b=$3
|
||||
if [ "$a" = "$b" ] ; then
|
||||
case $cmp in
|
||||
ge|eq|le) return 0 ;;
|
||||
gt|lt) return 1 ;;
|
||||
esac
|
||||
fi
|
||||
if [ "$cmp" = "lt" ] ; then
|
||||
c=$a
|
||||
a=$b
|
||||
b=$c
|
||||
fi
|
||||
if (echo $a ; echo $b) | sort -n | head -n 1 | grep -qx $b ; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
test_gt ()
|
||||
{
|
||||
local a=`echo $1 | sed -e "s/vmlinu[zx]-//g"`
|
||||
local b=`echo $2 | sed -e "s/vmlinu[zx]-//g"`
|
||||
local cmp=gt
|
||||
if [ "x$b" = "x" ] ; then
|
||||
return 0
|
||||
fi
|
||||
case $a:$b in
|
||||
*.old:*.old) ;;
|
||||
*.old:*) a=`echo -n $a | sed -e s/\.old$//g` ; cmp=gt ;;
|
||||
*:*.old) b=`echo -n $b | sed -e s/\.old$//g` ; cmp=ge ;;
|
||||
esac
|
||||
test_numeric $a $cmp $b
|
||||
return $?
|
||||
}
|
||||
|
||||
find_latest ()
|
||||
{
|
||||
local a=""
|
||||
for i in $@ ; do
|
||||
if test_gt "$i" "$a" ; then
|
||||
a="$i"
|
||||
fi
|
||||
done
|
||||
echo "$a"
|
||||
}
|
||||
|
||||
linux_entry ()
|
||||
{
|
||||
cat << EOF
|
||||
|
@ -117,7 +66,7 @@ list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
|
|||
done`
|
||||
|
||||
while [ "x$list" != "x" ] ; do
|
||||
linux=`find_latest $list`
|
||||
linux=`version_find_latest $list`
|
||||
echo "Found linux image: $linux" >&2
|
||||
basename=`basename $linux`
|
||||
dirname=`dirname $linux`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
# update-grub helper script.
|
||||
# grub-mkconfig helper script.
|
||||
# Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# GRUB is free software: you can redistribute it and/or modify
|
||||
|
|
25
util/i386/efi/grub-dumpdevtree
Normal file
25
util/i386/efi/grub-dumpdevtree
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 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/>.
|
||||
|
||||
hexify()
|
||||
{
|
||||
echo -n "$@" | od -A n -t x1 - | sed -e 's/ //g' | tr '\n' '\0'
|
||||
}
|
||||
|
||||
echo "`hexify efi`{ `hexify device-properties`:"
|
||||
ioreg -lw0 -p IODeviceTree -n efi -r -x |grep device-properties | sed 's/.*<//;s/>.*//;'
|
||||
echo ";}"
|
|
@ -30,7 +30,7 @@ target_cpu=@target_cpu@
|
|||
platform=@platform@
|
||||
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
|
||||
|
||||
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
|
||||
grub_mkimage=${bindir}/`echo grub-mkelfimage | sed ${transform}`
|
||||
|
||||
# Usage: usage
|
||||
# Print the usage.
|
||||
|
|
|
@ -27,19 +27,19 @@
|
|||
- Every function in this code assumes that bounds checking has been done in
|
||||
previous phase and they are opted out in here. */
|
||||
|
||||
#include <grub/machine/vbe.h>
|
||||
#include <grub/machine/vbeblit.h>
|
||||
#include <grub/machine/vbeutil.h>
|
||||
#include <grub/video_fb.h>
|
||||
#include <grub/fbblit.h>
|
||||
#include <grub/fbutil.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/video.h>
|
||||
|
||||
/* Generic replacing blitter (slow). Works for every supported format. */
|
||||
void
|
||||
grub_video_i386_vbeblit_replace (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
grub_video_fbblit_replace (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
@ -56,11 +56,11 @@ grub_video_i386_vbeblit_replace (struct grub_video_i386_vbeblit_info *dst,
|
|||
{
|
||||
src_color = get_pixel (src, i + offset_x, j + offset_y);
|
||||
|
||||
grub_video_vbe_unmap_color_int (src, src_color, &src_red, &src_green,
|
||||
&src_blue, &src_alpha);
|
||||
grub_video_fb_unmap_color_int (src, src_color, &src_red, &src_green,
|
||||
&src_blue, &src_alpha);
|
||||
|
||||
dst_color = grub_video_vbe_map_rgba (src_red, src_green,
|
||||
src_blue, src_alpha);
|
||||
dst_color = grub_video_fb_map_rgba (src_red, src_green,
|
||||
src_blue, src_alpha);
|
||||
|
||||
set_pixel (dst, x + i, y + j, dst_color);
|
||||
}
|
||||
|
@ -69,10 +69,10 @@ grub_video_i386_vbeblit_replace (struct grub_video_i386_vbeblit_info *dst,
|
|||
|
||||
/* Block copy replacing blitter. Works with modes multiple of 8 bits. */
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_directN (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
grub_video_fbblit_replace_directN (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
int j;
|
||||
grub_uint32_t *srcptr;
|
||||
|
@ -83,8 +83,8 @@ grub_video_i386_vbeblit_replace_directN (struct grub_video_i386_vbeblit_info *ds
|
|||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint32_t *)get_data_ptr (dst, x, y + j);
|
||||
srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (dst, x, y + j);
|
||||
|
||||
grub_memmove (dstptr, srcptr, width * bpp);
|
||||
}
|
||||
|
@ -92,11 +92,11 @@ grub_video_i386_vbeblit_replace_directN (struct grub_video_i386_vbeblit_info *ds
|
|||
|
||||
/* Optimized replacing blitter for RGBX8888 to BGRX8888. */
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_BGRX8888_RGBX8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
grub_video_fbblit_replace_BGRX8888_RGBX8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
@ -110,8 +110,8 @@ grub_video_i386_vbeblit_replace_BGRX8888_RGBX8888 (struct grub_video_i386_vbebli
|
|||
srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width;
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
|
||||
srcptr = (grub_uint8_t *) get_data_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) get_data_ptr (dst, x, y);
|
||||
srcptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
|
@ -135,11 +135,11 @@ grub_video_i386_vbeblit_replace_BGRX8888_RGBX8888 (struct grub_video_i386_vbebli
|
|||
|
||||
/* Optimized replacing blitter for RGB888 to BGRX8888. */
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_BGRX8888_RGB888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
grub_video_fbblit_replace_BGRX8888_RGB888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
@ -153,8 +153,8 @@ grub_video_i386_vbeblit_replace_BGRX8888_RGB888 (struct grub_video_i386_vbeblit_
|
|||
srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width;
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
|
||||
srcptr = (grub_uint8_t *) get_data_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) get_data_ptr (dst, x, y);
|
||||
srcptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
|
@ -179,11 +179,11 @@ grub_video_i386_vbeblit_replace_BGRX8888_RGB888 (struct grub_video_i386_vbeblit_
|
|||
|
||||
/* Optimized replacing blitter for RGBX8888 to BGR888. */
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_BGR888_RGBX8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
grub_video_fbblit_replace_BGR888_RGBX8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
grub_uint32_t *srcptr;
|
||||
grub_uint8_t *dstptr;
|
||||
|
@ -197,8 +197,8 @@ grub_video_i386_vbeblit_replace_BGR888_RGBX8888 (struct grub_video_i386_vbeblit_
|
|||
srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width;
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
|
||||
srcptr = (grub_uint32_t *) get_data_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) get_data_ptr (dst, x, y);
|
||||
srcptr = (grub_uint32_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
|
@ -227,11 +227,11 @@ grub_video_i386_vbeblit_replace_BGR888_RGBX8888 (struct grub_video_i386_vbeblit_
|
|||
|
||||
/* Optimized replacing blitter for RGB888 to BGR888. */
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_BGR888_RGB888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
grub_video_fbblit_replace_BGR888_RGB888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
@ -245,8 +245,8 @@ grub_video_i386_vbeblit_replace_BGR888_RGB888 (struct grub_video_i386_vbeblit_in
|
|||
srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width;
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
|
||||
srcptr = (grub_uint8_t *) get_data_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) get_data_ptr (dst, x, y);
|
||||
srcptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
|
@ -268,11 +268,11 @@ grub_video_i386_vbeblit_replace_BGR888_RGB888 (struct grub_video_i386_vbeblit_in
|
|||
|
||||
/* Optimized replacing blitter for RGB888 to RGBX8888. */
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_RGBX8888_RGB888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
grub_video_fbblit_replace_RGBX8888_RGB888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
grub_uint32_t color;
|
||||
int i;
|
||||
|
@ -285,8 +285,8 @@ grub_video_i386_vbeblit_replace_RGBX8888_RGB888 (struct grub_video_i386_vbeblit_
|
|||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
srcptr = (grub_uint8_t *)get_data_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint32_t *)get_data_ptr (dst, x, y + j);
|
||||
srcptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (dst, x, y + j);
|
||||
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
|
@ -304,11 +304,11 @@ grub_video_i386_vbeblit_replace_RGBX8888_RGB888 (struct grub_video_i386_vbeblit_
|
|||
|
||||
/* Optimized replacing blitter for RGBX8888 to RGB888. */
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_RGB888_RGBX8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
grub_video_fbblit_replace_RGB888_RGBX8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
grub_uint32_t color;
|
||||
int i;
|
||||
|
@ -321,8 +321,8 @@ grub_video_i386_vbeblit_replace_RGB888_RGBX8888 (struct grub_video_i386_vbeblit_
|
|||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)get_data_ptr (dst, x, y + j);
|
||||
srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (dst, x, y + j);
|
||||
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
|
@ -341,11 +341,11 @@ grub_video_i386_vbeblit_replace_RGB888_RGBX8888 (struct grub_video_i386_vbeblit_
|
|||
|
||||
/* Optimized replacing blitter for RGBX8888 to indexed color. */
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_index_RGBX8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
grub_video_fbblit_replace_index_RGBX8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
grub_uint32_t color;
|
||||
int i;
|
||||
|
@ -358,8 +358,8 @@ grub_video_i386_vbeblit_replace_index_RGBX8888 (struct grub_video_i386_vbeblit_i
|
|||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)get_data_ptr (dst, x, y + j);
|
||||
srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (dst, x, y + j);
|
||||
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
|
@ -369,7 +369,7 @@ grub_video_i386_vbeblit_replace_index_RGBX8888 (struct grub_video_i386_vbeblit_i
|
|||
sg = (color >> 8) & 0xFF;
|
||||
sb = (color >> 16) & 0xFF;
|
||||
|
||||
color = grub_video_vbe_map_rgb(sr, sg, sb);
|
||||
color = grub_video_fb_map_rgb(sr, sg, sb);
|
||||
*dstptr++ = color & 0xFF;
|
||||
}
|
||||
}
|
||||
|
@ -377,11 +377,11 @@ grub_video_i386_vbeblit_replace_index_RGBX8888 (struct grub_video_i386_vbeblit_i
|
|||
|
||||
/* Optimized replacing blitter for RGB888 to indexed color. */
|
||||
void
|
||||
grub_video_i386_vbeblit_replace_index_RGB888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
grub_video_fbblit_replace_index_RGB888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
grub_uint32_t color;
|
||||
int i;
|
||||
|
@ -394,8 +394,8 @@ grub_video_i386_vbeblit_replace_index_RGB888 (struct grub_video_i386_vbeblit_inf
|
|||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
srcptr = (grub_uint8_t *)get_data_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)get_data_ptr (dst, x, y + j);
|
||||
srcptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (dst, x, y + j);
|
||||
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
|
@ -403,7 +403,7 @@ grub_video_i386_vbeblit_replace_index_RGB888 (struct grub_video_i386_vbeblit_inf
|
|||
sg = *srcptr++;
|
||||
sb = *srcptr++;
|
||||
|
||||
color = grub_video_vbe_map_rgb(sr, sg, sb);
|
||||
color = grub_video_fb_map_rgb(sr, sg, sb);
|
||||
|
||||
*dstptr++ = color & 0xFF;
|
||||
}
|
||||
|
@ -412,10 +412,10 @@ grub_video_i386_vbeblit_replace_index_RGB888 (struct grub_video_i386_vbeblit_inf
|
|||
|
||||
/* Generic blending blitter. Works for every supported format. */
|
||||
void
|
||||
grub_video_i386_vbeblit_blend (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
grub_video_fbblit_blend (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y, int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
@ -436,24 +436,24 @@ grub_video_i386_vbeblit_blend (struct grub_video_i386_vbeblit_info *dst,
|
|||
grub_video_color_t dst_color;
|
||||
|
||||
src_color = get_pixel (src, i + offset_x, j + offset_y);
|
||||
grub_video_vbe_unmap_color_int (src, src_color, &src_red, &src_green,
|
||||
&src_blue, &src_alpha);
|
||||
grub_video_fb_unmap_color_int (src, src_color, &src_red, &src_green,
|
||||
&src_blue, &src_alpha);
|
||||
|
||||
if (src_alpha == 0)
|
||||
continue;
|
||||
|
||||
if (src_alpha == 255)
|
||||
{
|
||||
dst_color = grub_video_vbe_map_rgba (src_red, src_green,
|
||||
src_blue, src_alpha);
|
||||
dst_color = grub_video_fb_map_rgba (src_red, src_green,
|
||||
src_blue, src_alpha);
|
||||
set_pixel (dst, x + i, y + j, dst_color);
|
||||
continue;
|
||||
}
|
||||
|
||||
dst_color = get_pixel (dst, x + i, y + j);
|
||||
|
||||
grub_video_vbe_unmap_color_int (dst, dst_color, &dst_red,
|
||||
&dst_green, &dst_blue, &dst_alpha);
|
||||
grub_video_fb_unmap_color_int (dst, dst_color, &dst_red,
|
||||
&dst_green, &dst_blue, &dst_alpha);
|
||||
|
||||
dst_red = (((src_red * src_alpha)
|
||||
+ (dst_red * (255 - src_alpha))) / 255);
|
||||
|
@ -463,8 +463,8 @@ grub_video_i386_vbeblit_blend (struct grub_video_i386_vbeblit_info *dst,
|
|||
+ (dst_blue * (255 - src_alpha))) / 255);
|
||||
|
||||
dst_alpha = src_alpha;
|
||||
dst_color = grub_video_vbe_map_rgba (dst_red, dst_green, dst_blue,
|
||||
dst_alpha);
|
||||
dst_color = grub_video_fb_map_rgba (dst_red, dst_green, dst_blue,
|
||||
dst_alpha);
|
||||
|
||||
set_pixel (dst, x + i, y + j, dst_color);
|
||||
}
|
||||
|
@ -473,11 +473,11 @@ grub_video_i386_vbeblit_blend (struct grub_video_i386_vbeblit_info *dst,
|
|||
|
||||
/* Optimized blending blitter for RGBA8888 to BGRA8888. */
|
||||
void
|
||||
grub_video_i386_vbeblit_blend_BGRA8888_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
grub_video_fbblit_blend_BGRA8888_RGBA8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
grub_uint32_t *srcptr;
|
||||
grub_uint32_t *dstptr;
|
||||
|
@ -491,8 +491,8 @@ grub_video_i386_vbeblit_blend_BGRA8888_RGBA8888 (struct grub_video_i386_vbeblit_
|
|||
srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width;
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
|
||||
srcptr = (grub_uint32_t *) get_data_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint32_t *) get_data_ptr (dst, x, y);
|
||||
srcptr = (grub_uint32_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint32_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
|
@ -554,11 +554,11 @@ grub_video_i386_vbeblit_blend_BGRA8888_RGBA8888 (struct grub_video_i386_vbeblit_
|
|||
|
||||
/* Optimized blending blitter for RGBA8888 to BGR888. */
|
||||
void
|
||||
grub_video_i386_vbeblit_blend_BGR888_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
grub_video_fbblit_blend_BGR888_RGBA8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
grub_uint32_t *srcptr;
|
||||
grub_uint8_t *dstptr;
|
||||
|
@ -572,8 +572,8 @@ grub_video_i386_vbeblit_blend_BGR888_RGBA8888 (struct grub_video_i386_vbeblit_in
|
|||
srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width;
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
|
||||
srcptr = (grub_uint32_t *) get_data_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) get_data_ptr (dst, x, y);
|
||||
srcptr = (grub_uint32_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
|
@ -635,11 +635,11 @@ grub_video_i386_vbeblit_blend_BGR888_RGBA8888 (struct grub_video_i386_vbeblit_in
|
|||
|
||||
/* Optimized blending blitter for RGBA888 to RGBA8888. */
|
||||
void
|
||||
grub_video_i386_vbeblit_blend_RGBA8888_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
grub_video_fbblit_blend_RGBA8888_RGBA8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
grub_uint32_t color;
|
||||
int i;
|
||||
|
@ -656,8 +656,8 @@ grub_video_i386_vbeblit_blend_RGBA8888_RGBA8888 (struct grub_video_i386_vbeblit_
|
|||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint32_t *)get_data_ptr (dst, x, y + j);
|
||||
srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (dst, x, y + j);
|
||||
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
|
@ -700,11 +700,11 @@ grub_video_i386_vbeblit_blend_RGBA8888_RGBA8888 (struct grub_video_i386_vbeblit_
|
|||
|
||||
/* Optimized blending blitter for RGBA8888 to RGB888. */
|
||||
void
|
||||
grub_video_i386_vbeblit_blend_RGB888_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
grub_video_fbblit_blend_RGB888_RGBA8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
grub_uint32_t color;
|
||||
int i;
|
||||
|
@ -721,8 +721,8 @@ grub_video_i386_vbeblit_blend_RGB888_RGBA8888 (struct grub_video_i386_vbeblit_in
|
|||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)get_data_ptr (dst, x, y + j);
|
||||
srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (dst, x, y + j);
|
||||
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
|
@ -766,11 +766,11 @@ grub_video_i386_vbeblit_blend_RGB888_RGBA8888 (struct grub_video_i386_vbeblit_in
|
|||
|
||||
/* Optimized blending blitter for RGBA8888 to indexed color. */
|
||||
void
|
||||
grub_video_i386_vbeblit_blend_index_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
|
||||
struct grub_video_i386_vbeblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
grub_video_fbblit_blend_index_RGBA8888 (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
grub_uint32_t color;
|
||||
int i;
|
||||
|
@ -788,8 +788,8 @@ grub_video_i386_vbeblit_blend_index_RGBA8888 (struct grub_video_i386_vbeblit_inf
|
|||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)get_data_ptr (dst, x, y + j);
|
||||
srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y);
|
||||
dstptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (dst, x, y + j);
|
||||
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
|
@ -809,18 +809,18 @@ grub_video_i386_vbeblit_blend_index_RGBA8888 (struct grub_video_i386_vbeblit_inf
|
|||
|
||||
if (a == 255)
|
||||
{
|
||||
color = grub_video_vbe_map_rgb(sr, sg, sb);
|
||||
color = grub_video_fb_map_rgb(sr, sg, sb);
|
||||
*dstptr++ = color & 0xFF;
|
||||
continue;
|
||||
}
|
||||
|
||||
grub_video_vbe_unmap_color_int (dst, *dstptr, &dr, &dg, &db, &da);
|
||||
grub_video_fb_unmap_color_int (dst, *dstptr, &dr, &dg, &db, &da);
|
||||
|
||||
dr = (dr * (255 - a) + sr * a) / 255;
|
||||
dg = (dg * (255 - a) + sg * a) / 255;
|
||||
db = (db * (255 - a) + sb * a) / 255;
|
||||
|
||||
color = grub_video_vbe_map_rgb(dr, dg, db);
|
||||
color = grub_video_fb_map_rgb(dr, dg, db);
|
||||
|
||||
*dstptr++ = color & 0xFF;
|
||||
}
|
|
@ -27,32 +27,32 @@
|
|||
- Every function in this code assumes that bounds checking has been done in
|
||||
previous phase and they are opted out in here. */
|
||||
|
||||
#include <grub/machine/vbe.h>
|
||||
#include <grub/machine/vbefill.h>
|
||||
#include <grub/machine/vbeutil.h>
|
||||
#include <grub/video_fb.h>
|
||||
#include <grub/fbfill.h>
|
||||
#include <grub/fbutil.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/video.h>
|
||||
|
||||
/* Generic filler that works for every supported mode. */
|
||||
void
|
||||
grub_video_i386_vbefill (struct grub_video_i386_vbeblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height)
|
||||
grub_video_fbfill (struct grub_video_fbblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
for (i = 0; i < width; i++)
|
||||
set_pixel (dst, x+i, y+j, color);
|
||||
set_pixel (dst, x + i, y + j, color);
|
||||
}
|
||||
|
||||
/* Optimized filler for direct color 32 bit modes. It is assumed that color
|
||||
is already mapped to destination format. */
|
||||
void
|
||||
grub_video_i386_vbefill_direct32 (struct grub_video_i386_vbeblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height)
|
||||
grub_video_fbfill_direct32 (struct grub_video_fbblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
@ -64,7 +64,7 @@ grub_video_i386_vbefill_direct32 (struct grub_video_i386_vbeblit_info *dst,
|
|||
rowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
|
||||
/* Get the start address. */
|
||||
dstptr = (grub_uint32_t *) grub_video_vbe_get_video_ptr (dst, x, y);
|
||||
dstptr = (grub_uint32_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
|
@ -79,9 +79,9 @@ grub_video_i386_vbefill_direct32 (struct grub_video_i386_vbeblit_info *dst,
|
|||
/* Optimized filler for direct color 24 bit modes. It is assumed that color
|
||||
is already mapped to destination format. */
|
||||
void
|
||||
grub_video_i386_vbefill_direct24 (struct grub_video_i386_vbeblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height)
|
||||
grub_video_fbfill_direct24 (struct grub_video_fbblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
@ -96,7 +96,7 @@ grub_video_i386_vbefill_direct24 (struct grub_video_i386_vbeblit_info *dst,
|
|||
rowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
|
||||
/* Get the start address. */
|
||||
dstptr = (grub_uint8_t *) grub_video_vbe_get_video_ptr (dst, x, y);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
|
@ -115,9 +115,9 @@ grub_video_i386_vbefill_direct24 (struct grub_video_i386_vbeblit_info *dst,
|
|||
/* Optimized filler for direct color 16 bit modes. It is assumed that color
|
||||
is already mapped to destination format. */
|
||||
void
|
||||
grub_video_i386_vbefill_direct16 (struct grub_video_i386_vbeblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height)
|
||||
grub_video_fbfill_direct16 (struct grub_video_fbblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
@ -131,7 +131,7 @@ grub_video_i386_vbefill_direct16 (struct grub_video_i386_vbeblit_info *dst,
|
|||
rowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
|
||||
/* Get the start address. */
|
||||
dstptr = (grub_uint8_t *) grub_video_vbe_get_video_ptr (dst, x, y);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
|
@ -149,9 +149,9 @@ grub_video_i386_vbefill_direct16 (struct grub_video_i386_vbeblit_info *dst,
|
|||
/* Optimized filler for index color. It is assumed that color
|
||||
is already mapped to destination format. */
|
||||
void
|
||||
grub_video_i386_vbefill_direct8 (struct grub_video_i386_vbeblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height)
|
||||
grub_video_fbfill_direct8 (struct grub_video_fbblit_info *dst,
|
||||
grub_video_color_t color, int x, int y,
|
||||
int width, int height)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
@ -164,7 +164,7 @@ grub_video_i386_vbefill_direct8 (struct grub_video_i386_vbeblit_info *dst,
|
|||
rowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
|
||||
/* Get the start address. */
|
||||
dstptr = (grub_uint8_t *) grub_video_vbe_get_video_ptr (dst, x, y);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
|
@ -16,12 +16,23 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/machine/vbeutil.h>
|
||||
/* SPECIAL NOTES!
|
||||
|
||||
Please note following when reading the code below:
|
||||
|
||||
- In this driver we assume that every memory can be accessed by same memory
|
||||
bus. If there are different address spaces do not use this code as a base
|
||||
code for other archs.
|
||||
|
||||
- Every function in this code assumes that bounds checking has been done in
|
||||
previous phase and they are opted out in here. */
|
||||
|
||||
#include <grub/fbutil.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/video.h>
|
||||
|
||||
grub_uint8_t *
|
||||
get_data_ptr (struct grub_video_i386_vbeblit_info *source,
|
||||
grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y)
|
||||
{
|
||||
grub_uint8_t *ptr = 0;
|
||||
|
@ -29,28 +40,20 @@ get_data_ptr (struct grub_video_i386_vbeblit_info *source,
|
|||
switch (source->mode_info->bpp)
|
||||
{
|
||||
case 32:
|
||||
ptr = (grub_uint8_t *)source->data
|
||||
+ y * source->mode_info->pitch
|
||||
+ x * 4;
|
||||
ptr = source->data + y * source->mode_info->pitch + x * 4;
|
||||
break;
|
||||
|
||||
case 24:
|
||||
ptr = (grub_uint8_t *)source->data
|
||||
+ y * source->mode_info->pitch
|
||||
+ x * 3;
|
||||
ptr = source->data + y * source->mode_info->pitch + x * 3;
|
||||
break;
|
||||
|
||||
case 16:
|
||||
case 15:
|
||||
ptr = (grub_uint8_t *)source->data
|
||||
+ y * source->mode_info->pitch
|
||||
+ x * 2;
|
||||
ptr = source->data + y * source->mode_info->pitch + x * 2;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
ptr = (grub_uint8_t *)source->data
|
||||
+ y * source->mode_info->pitch
|
||||
+ x;
|
||||
ptr = source->data + y * source->mode_info->pitch + x;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
@ -64,7 +67,7 @@ get_data_ptr (struct grub_video_i386_vbeblit_info *source,
|
|||
}
|
||||
|
||||
grub_video_color_t
|
||||
get_pixel (struct grub_video_i386_vbeblit_info *source,
|
||||
get_pixel (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y)
|
||||
{
|
||||
grub_video_color_t color = 0;
|
||||
|
@ -72,32 +75,31 @@ get_pixel (struct grub_video_i386_vbeblit_info *source,
|
|||
switch (source->mode_info->bpp)
|
||||
{
|
||||
case 32:
|
||||
color = *(grub_uint32_t *)get_data_ptr (source, x, y);
|
||||
color = *(grub_uint32_t *)grub_video_fb_get_video_ptr (source, x, y);
|
||||
break;
|
||||
|
||||
case 24:
|
||||
{
|
||||
grub_uint8_t *ptr;
|
||||
ptr = get_data_ptr (source, x, y);
|
||||
ptr = grub_video_fb_get_video_ptr (source, x, y);
|
||||
color = ptr[0] | (ptr[1] << 8) | (ptr[2] << 16);
|
||||
}
|
||||
break;
|
||||
|
||||
case 16:
|
||||
case 15:
|
||||
color = *(grub_uint16_t *)get_data_ptr (source, x, y);
|
||||
color = *(grub_uint16_t *)grub_video_fb_get_video_ptr (source, x, y);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
color = *(grub_uint8_t *)get_data_ptr (source, x, y);
|
||||
color = *(grub_uint8_t *)grub_video_fb_get_video_ptr (source, x, y);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED)
|
||||
{
|
||||
int bit_index = y * source->mode_info->width + x;
|
||||
grub_uint8_t *ptr = (grub_uint8_t *)source->data
|
||||
+ bit_index / 8;
|
||||
grub_uint8_t *ptr = source->data + bit_index / 8;
|
||||
int bit_pos = 7 - bit_index % 8;
|
||||
color = (*ptr >> bit_pos) & 0x01;
|
||||
}
|
||||
|
@ -111,7 +113,7 @@ get_pixel (struct grub_video_i386_vbeblit_info *source,
|
|||
}
|
||||
|
||||
void
|
||||
set_pixel (struct grub_video_i386_vbeblit_info *source,
|
||||
set_pixel (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y, grub_video_color_t color)
|
||||
{
|
||||
switch (source->mode_info->bpp)
|
||||
|
@ -120,7 +122,7 @@ set_pixel (struct grub_video_i386_vbeblit_info *source,
|
|||
{
|
||||
grub_uint32_t *ptr;
|
||||
|
||||
ptr = (grub_uint32_t *)get_data_ptr (source, x, y);
|
||||
ptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (source, x, y);
|
||||
|
||||
*ptr = color;
|
||||
}
|
||||
|
@ -131,7 +133,7 @@ set_pixel (struct grub_video_i386_vbeblit_info *source,
|
|||
grub_uint8_t *ptr;
|
||||
grub_uint8_t *colorptr = (grub_uint8_t *)&color;
|
||||
|
||||
ptr = get_data_ptr (source, x, y);
|
||||
ptr = grub_video_fb_get_video_ptr (source, x, y);
|
||||
|
||||
ptr[0] = colorptr[0];
|
||||
ptr[1] = colorptr[1];
|
||||
|
@ -144,7 +146,7 @@ set_pixel (struct grub_video_i386_vbeblit_info *source,
|
|||
{
|
||||
grub_uint16_t *ptr;
|
||||
|
||||
ptr = (grub_uint16_t *)get_data_ptr (source, x, y);
|
||||
ptr = (grub_uint16_t *)grub_video_fb_get_video_ptr (source, x, y);
|
||||
|
||||
*ptr = (grub_uint16_t) (color & 0xFFFF);
|
||||
}
|
||||
|
@ -154,7 +156,7 @@ set_pixel (struct grub_video_i386_vbeblit_info *source,
|
|||
{
|
||||
grub_uint8_t *ptr;
|
||||
|
||||
ptr = (grub_uint8_t *)get_data_ptr (source, x, y);
|
||||
ptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (source, x, y);
|
||||
|
||||
*ptr = (grub_uint8_t) (color & 0xFF);
|
||||
}
|
||||
|
@ -164,8 +166,7 @@ set_pixel (struct grub_video_i386_vbeblit_info *source,
|
|||
if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED)
|
||||
{
|
||||
int bit_index = y * source->mode_info->width + x;
|
||||
grub_uint8_t *ptr = (grub_uint8_t *)source->data
|
||||
+ bit_index / 8;
|
||||
grub_uint8_t *ptr = source->data + bit_index / 8;
|
||||
int bit_pos = 7 - bit_index % 8;
|
||||
*ptr = (*ptr & ~(1 << bit_pos)) | ((color & 0x01) << bit_pos);
|
||||
}
|
1118
video/fb/video_fb.c
Normal file
1118
video/fb/video_fb.c
Normal file
File diff suppressed because it is too large
Load diff
1363
video/i386/pc/vbe.c
1363
video/i386/pc/vbe.c
File diff suppressed because it is too large
Load diff
|
@ -93,6 +93,24 @@ grub_video_get_info (struct grub_video_mode_info *mode_info)
|
|||
return grub_video_adapter_active->get_info (mode_info);
|
||||
}
|
||||
|
||||
/* Get information about active video mode. */
|
||||
grub_err_t
|
||||
grub_video_get_info_and_fini (struct grub_video_mode_info *mode_info,
|
||||
void **framebuffer)
|
||||
{
|
||||
grub_err_t err;
|
||||
|
||||
if (! grub_video_adapter_active)
|
||||
return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
|
||||
|
||||
err = grub_video_adapter_active->get_info_and_fini (mode_info, framebuffer);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
grub_video_adapter_active = 0;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
/* Determine optimized blitting formation for specified video mode info. */
|
||||
enum grub_video_blit_format
|
||||
grub_video_get_blit_format (struct grub_video_mode_info *mode_info)
|
||||
|
@ -380,7 +398,7 @@ grub_video_get_active_render_target (struct grub_video_render_target **target)
|
|||
}
|
||||
|
||||
grub_err_t
|
||||
grub_video_set_mode (char *modestring,
|
||||
grub_video_set_mode (const char *modestring,
|
||||
int NESTED_FUNC_ATTR (*hook) (grub_video_adapter_t p,
|
||||
struct grub_video_mode_info *mode_info))
|
||||
{
|
||||
|
@ -695,8 +713,6 @@ grub_video_set_mode (char *modestring,
|
|||
/* Initialize Video API module. */
|
||||
GRUB_MOD_INIT(video_video)
|
||||
{
|
||||
grub_video_adapter_active = 0;
|
||||
grub_video_adapter_list = 0;
|
||||
}
|
||||
|
||||
/* Finalize Video API module. */
|
||||
|
|
Loading…
Add table
Reference in a new issue