merge mainline into yeeloongfw
This commit is contained in:
commit
e34b610d49
231 changed files with 20569 additions and 15101 deletions
35
Makefile.in
35
Makefile.in
|
@ -35,6 +35,7 @@ sysconfdir = @sysconfdir@
|
|||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
localedir = @localedir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
|
@ -43,6 +44,10 @@ pkglibdir = $(libdir)/`echo @PACKAGE_TARNAME@/$(target_cpu)-$(platform) | sed '
|
|||
|
||||
# Internationalization library.
|
||||
LIBINTL = @LIBINTL@
|
||||
TARGET_NO_MODULES = @TARGET_NO_MODULES@
|
||||
|
||||
# Util library.
|
||||
LIBUTIL = @LIBUTIL@
|
||||
|
||||
XGETTEXT = @XGETTEXT@
|
||||
MSGMERGE = @MSGMERGE@
|
||||
|
@ -75,15 +80,17 @@ MKDIR_P = @MKDIR_P@
|
|||
|
||||
mkinstalldirs = $(srcdir)/mkinstalldirs
|
||||
|
||||
LIBS = @LIBS@ $(LIBINTL)
|
||||
LIBS = @LIBS@ $(LIBINTL) $(LIBUTIL)
|
||||
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
GNULIB_CFLAGS = -Wno-undef -D_GL_UNUSED="__attribute__ ((unused))"
|
||||
POSIX_CFLAGS = -I$(srcdir)/lib/posix_wrap
|
||||
GNULIB_UTIL_CFLAGS = -Wno-undef -Wno-sign-compare -Wno-unused -D_GL_UNUSED="__attribute__ ((unused))" -I$(srcdir)/gnulib
|
||||
GNULIB_CFLAGS = $(GNULIB_UTIL_CFLAGS) $(POSIX_CFLAGS)
|
||||
ASFLAGS = @ASFLAGS@
|
||||
LDFLAGS = @LDFLAGS@ $(LIBS)
|
||||
CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \
|
||||
-DGRUB_LIBDIR=\"$(pkglibdir)\" -DLOCALEDIR=\"$(localedir)\"
|
||||
-DGRUB_PKGLIBROOTDIR=\"$(libdir)/`echo @PACKAGE_TARNAME@ | sed '$(transform)'`\" -DLOCALEDIR=\"$(localedir)\"
|
||||
TARGET_CC = @TARGET_CC@
|
||||
TARGET_CFLAGS = -ffreestanding @TARGET_CFLAGS@
|
||||
TARGET_ASFLAGS = -nostdinc -fno-builtin @TARGET_ASFLAGS@
|
||||
|
@ -92,11 +99,12 @@ TARGET_APPLE_CC = @TARGET_APPLE_CC@
|
|||
OBJCONV = @OBJCONV@
|
||||
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
|
||||
-Wall -W
|
||||
TARGET_LDFLAGS = -nostdlib @TARGET_LDFLAGS@
|
||||
TARGET_LDFLAGS = -nostdlib -static-libgcc @TARGET_LDFLAGS@
|
||||
TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
|
||||
TARGET_IMG_LDFLAGS = -nostdlib @TARGET_IMG_LDFLAGS@
|
||||
TARGET_IMG_CFLAGS = @TARGET_IMG_CFLAGS@
|
||||
TARGET_OBJ2ELF = @TARGET_OBJ2ELF@
|
||||
kernel_img_LDFLAGS = -lgcc
|
||||
EXEEXT = @EXEEXT@
|
||||
OBJCOPY = @OBJCOPY@
|
||||
STRIP = @STRIP@
|
||||
|
@ -134,7 +142,7 @@ enable_efiemu = @enable_efiemu@
|
|||
|
||||
### General variables.
|
||||
|
||||
RMKFILES = $(wildcard conf/*.rmk)
|
||||
RMKFILES = $(wildcard $(srcdir)/conf/*.rmk)
|
||||
|
||||
MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES))
|
||||
|
||||
|
@ -153,7 +161,9 @@ DISTCLEANFILES = config.status config.cache config.log config.h \
|
|||
gensymlist.sh genkernsyms.sh build_env.mk \
|
||||
docs/grub.info docs/version.texi docs/stamp-vti
|
||||
|
||||
MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES)) \
|
||||
MAINTAINER_CLEANFILES = $(srcdir)/configure $(srcdir)/aclocal.m4 \
|
||||
$(MKFILES) $(srcdir)/config.guess \
|
||||
$(srcdir)/config.sub $(srcdir)/install-sh $(srcdir)/missing \
|
||||
$(srcdir)/DISTLIST $(srcdir)/config.h.in $(srcdir)/stamp-h.in $(INFOS)
|
||||
|
||||
# The default target.
|
||||
|
@ -177,10 +187,15 @@ include $(srcdir)/conf/tests.mk
|
|||
-include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk)
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_NO_MODULES), yes)
|
||||
TARGET_CFLAGS += -DGRUB_TARGET_NO_MODULES=1
|
||||
CFLAGS += -DGRUB_TARGET_NO_MODULES=1
|
||||
endif
|
||||
|
||||
### General targets.
|
||||
|
||||
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) po/*.mo
|
||||
ifneq ($(platform), emu)
|
||||
ifneq ($(TARGET_NO_MODULES), yes)
|
||||
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst
|
||||
endif
|
||||
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep.awk
|
||||
|
@ -425,6 +440,8 @@ distclean: mostlyclean
|
|||
|
||||
maintainer-clean: distclean
|
||||
-test -z "$(MAINTAINER_CLEANFILES)" || rm -f $(MAINTAINER_CLEANFILES)
|
||||
-rmdir $(srcdir)/lib/libgcrypt-grub/cipher
|
||||
-rmdir $(srcdir)/lib/libgcrypt-grub
|
||||
|
||||
info:
|
||||
|
||||
|
@ -528,8 +545,8 @@ genkernsyms.sh: genkernsyms.sh.in config.status
|
|||
$(SHELL) ./config.status
|
||||
|
||||
$(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell
|
||||
cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o $@ -f $< --keyword=_ --keyword=N_
|
||||
cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell
|
||||
cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o po/$(PACKAGE).pot -f po/POTFILES --keyword=_ --keyword=N_
|
||||
cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o po/$(PACKAGE).pot -f po/POTFILES-shell -j --language=Shell
|
||||
|
||||
$(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): po/$(PACKAGE).pot
|
||||
$(MSGMERGE) -U $@ $^
|
||||
|
|
|
@ -93,7 +93,7 @@ else
|
|||
fi
|
||||
grub_cv_prog_objcopy_absolute=yes
|
||||
for link_addr in 0x2000 0x8000 0x7C00; do
|
||||
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib ${TARGET_IMG_LDFLAGS_AC} -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then :
|
||||
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib ${TARGET_IMG_LDFLAGS_AC}$link_addr conftest.o -o conftest.exec]); then :
|
||||
else
|
||||
AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
|
||||
fi
|
||||
|
|
|
@ -31,7 +31,7 @@ _start:
|
|||
|
||||
jmp 1f
|
||||
|
||||
. = _start + GRUB_BOOT_MACHINE_CORE_ENTRY_ADDR
|
||||
. = _start + GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR
|
||||
VARIABLE(grub_core_entry_addr)
|
||||
.long 0
|
||||
1:
|
||||
|
@ -63,5 +63,8 @@ VARIABLE(grub_core_entry_addr)
|
|||
*right here* and this is why we need this kludge. */
|
||||
|
||||
. = GRUB_BOOT_MACHINE_SIZE - 16
|
||||
|
||||
.code16
|
||||
|
||||
jmp _start
|
||||
. = GRUB_BOOT_MACHINE_SIZE
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include <grub/mips/yeeloong/serial.h>
|
||||
#include <grub/mips/yeeloong/pci.h>
|
||||
#include <grub/mips/yeeloong/boot.h>
|
||||
#include <grub/mips/loongson.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/serial.h>
|
||||
|
@ -132,7 +131,7 @@ __start:
|
|||
|
||||
b continue
|
||||
|
||||
. = start + GRUB_MACHINE_FLASH_TLB_REFILL - GRUB_MACHINE_FLASH_START
|
||||
. = start + GRUB_CPU_LOONGSON_FLASH_TLB_REFILL - GRUB_CPU_LOONGSON_FLASH_START
|
||||
tlb_refill:
|
||||
mfc0 $s1, GRUB_CPU_LOONGSON_COP0_EPC
|
||||
mfc0 $s2, GRUB_CPU_LOONGSON_COP0_BADVADDR
|
||||
|
@ -166,13 +165,13 @@ tlb_refill:
|
|||
b fatal
|
||||
addiu $a0, $a0, %lo(unhandled_tlb_refill)
|
||||
|
||||
. = start + GRUB_MACHINE_FLASH_CACHE_ERROR - GRUB_MACHINE_FLASH_START
|
||||
. = start + GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR - GRUB_CPU_LOONGSON_FLASH_START
|
||||
cache_error:
|
||||
lui $a0, %hi(unhandled_cache_error)
|
||||
b fatal
|
||||
addiu $a0, $a0, %lo(unhandled_cache_error)
|
||||
|
||||
. = start + GRUB_MACHINE_FLASH_OTHER_EXCEPTION - GRUB_MACHINE_FLASH_START
|
||||
. = start + GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION - GRUB_CPU_LOONGSON_FLASH_START
|
||||
other_exception:
|
||||
mfc0 $s0, GRUB_CPU_LOONGSON_COP0_CAUSE
|
||||
mfc0 $s1, GRUB_CPU_LOONGSON_COP0_EPC
|
||||
|
@ -432,13 +431,13 @@ regdump:
|
|||
write_dumpreg:
|
||||
ld $t2, 0($t6)
|
||||
sd $t2, 0($t4)
|
||||
addiu $t4, $t4, GRUB_MACHINE_DDR2_REG_STEP
|
||||
addiu $t4, $t4, GRUB_CPU_LOONGSON_DDR2_REG_STEP
|
||||
jr $ra
|
||||
addiu $t6, $t6, GRUB_MACHINE_DDR2_REG_SIZE
|
||||
addiu $t6, $t6, GRUB_CPU_LOONGSON_DDR2_REG_SIZE
|
||||
|
||||
continue:
|
||||
lui $t4, %hi(GRUB_MACHINE_DDR2_BASE)
|
||||
addiu $t4, $t4, %lo(GRUB_MACHINE_DDR2_BASE)
|
||||
lui $t4, %hi(GRUB_CPU_LOONGSON_DDR2_BASE)
|
||||
addiu $t4, $t4, %lo(GRUB_CPU_LOONGSON_DDR2_BASE)
|
||||
lui $t6, %hi(regdump)
|
||||
|
||||
/* 0 */
|
||||
|
@ -454,12 +453,12 @@ continue:
|
|||
ori $t7, $zero, 8
|
||||
bne $v0, $t7, 1f
|
||||
ori $t5, $t5, 0x0001
|
||||
ori $t8, $t8, GRUB_MACHINE_DDR2_REG1_HI_8BANKS
|
||||
ori $t8, $t8, GRUB_CPU_LOONGSON_DDR2_REG1_HI_8BANKS
|
||||
1:
|
||||
dsll $t8, $t8, 32
|
||||
or $t5, $t5, $t8
|
||||
sd $t5, 0 ($t4)
|
||||
addiu $t4, $t4, GRUB_MACHINE_DDR2_REG_STEP
|
||||
addiu $t4, $t4, GRUB_CPU_LOONGSON_DDR2_REG_STEP
|
||||
|
||||
/* 2 */
|
||||
bal write_dumpreg
|
||||
|
@ -513,24 +512,24 @@ continue:
|
|||
or $t5, $t5, $v0
|
||||
sd $t5, 0 ($t4)
|
||||
|
||||
addiu $t4, $t4, GRUB_MACHINE_DDR2_REG_STEP
|
||||
addiu $t4, $t4, GRUB_CPU_LOONGSON_DDR2_REG_STEP
|
||||
|
||||
ori $t7, $zero, 0x16
|
||||
|
||||
1:
|
||||
ld $t2, 0($t6)
|
||||
sd $t2, 0($t4)
|
||||
addiu $t4, $t4, GRUB_MACHINE_DDR2_REG_STEP
|
||||
addiu $t4, $t4, GRUB_CPU_LOONGSON_DDR2_REG_STEP
|
||||
addiu $t7, $t7, -1
|
||||
bne $t7, $zero, 1b
|
||||
addiu $t6, $t6, GRUB_MACHINE_DDR2_REG_SIZE
|
||||
addiu $t6, $t6, GRUB_CPU_LOONGSON_DDR2_REG_SIZE
|
||||
|
||||
lui $t4, %hi(GRUB_MACHINE_DDR2_BASE)
|
||||
ld $t5, (%lo(GRUB_MACHINE_DDR2_BASE) + 0x30) ($t4)
|
||||
lui $t4, %hi(GRUB_CPU_LOONGSON_DDR2_BASE)
|
||||
ld $t5, (%lo(GRUB_CPU_LOONGSON_DDR2_BASE) + 0x30) ($t4)
|
||||
ori $t0, $zero, 1
|
||||
dsll $t0, $t0, 40
|
||||
or $t5, $t5, $t0
|
||||
sd $t5, (%lo(GRUB_MACHINE_DDR2_BASE) + 0x30) ($t4)
|
||||
sd $t5, (%lo(GRUB_CPU_LOONGSON_DDR2_BASE) + 0x30) ($t4)
|
||||
|
||||
/* Desactivate DDR2 registers. */
|
||||
lui $t0, %hi (GRUB_CPU_LOONGSON_CORECFG)
|
||||
|
|
|
@ -45,8 +45,9 @@ boot_version: .byte GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR
|
|||
* load address plus the size of the prepended A.OUT header (32 bytes).
|
||||
*/
|
||||
boot_path:
|
||||
. = _start + GRUB_BOOT_MACHINE_KERNEL_SECTOR
|
||||
kernel_sector: .xword 2
|
||||
. = _start + GRUB_BOOT_MACHINE_KERNEL_BYTE
|
||||
boot_path_end:
|
||||
kernel_byte: .xword (2 << 9)
|
||||
kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR
|
||||
|
||||
prom_finddev_name: .asciz "finddevice"
|
||||
|
@ -77,11 +78,23 @@ prom_error:
|
|||
/* %o0: OF call name
|
||||
* %o1: input arg 1
|
||||
*/
|
||||
prom_call_1_1:
|
||||
mov 1, %g1
|
||||
ba prom_call
|
||||
mov 1, %o5
|
||||
prom_call_1_1_o2:
|
||||
clr %o2
|
||||
ba prom_call_x_1
|
||||
mov 1, %g1
|
||||
|
||||
prom_call_getprop:
|
||||
mov 4, %g1
|
||||
stx %g1, [%l1 + 256]
|
||||
mov CHOSEN_NODE_REG, %o1
|
||||
ba prom_call_x_1
|
||||
GET_ABS(prom_getprop_name, %o0)
|
||||
|
||||
prom_call_3_1_o1:
|
||||
ba prom_call_3_1
|
||||
mov BOOTDEV_REG, %o1
|
||||
|
||||
|
||||
/* %o2: message string
|
||||
* %o3: message length
|
||||
*/
|
||||
|
@ -95,8 +108,9 @@ console_write:
|
|||
* %o2: input arg 2
|
||||
* %o3: input arg 3
|
||||
*/
|
||||
prom_call_3_1:
|
||||
prom_call_3_1:
|
||||
mov 3, %g1
|
||||
prom_call_x_1:
|
||||
mov 1, %o5
|
||||
/* fallthru */
|
||||
|
||||
|
@ -126,23 +140,17 @@ boot_continue:
|
|||
* chosen_node = prom_finddevice("/chosen")
|
||||
*/
|
||||
GET_ABS(prom_finddev_name, %o0)
|
||||
GET_ABS(prom_chosen_path, %o1)
|
||||
call prom_call_1_1
|
||||
clr %o2
|
||||
call prom_call_1_1_o2
|
||||
GET_ABS(prom_chosen_path, %o1)
|
||||
|
||||
ldx [%l1 + 0x20], CHOSEN_NODE_REG
|
||||
brz CHOSEN_NODE_REG, prom_error
|
||||
|
||||
/* getprop(chosen_node, "stdout", &buffer, buffer_size) */
|
||||
GET_ABS(prom_getprop_name, %o0)
|
||||
mov 4, %g1
|
||||
mov 1, %o5
|
||||
mov CHOSEN_NODE_REG, %o1
|
||||
GET_ABS(prom_stdout_name, %o2)
|
||||
GET_ABS(prom_stdout_name, %o2)
|
||||
add %l1, 256, %o3
|
||||
mov 1024, %o4
|
||||
call prom_call
|
||||
stx %g1, [%l1 + 256]
|
||||
call prom_call_getprop
|
||||
mov 1024, %o4
|
||||
|
||||
lduw [%l1 + 256], STDOUT_NODE_REG
|
||||
brz,pn STDOUT_NODE_REG, prom_error
|
||||
|
@ -152,15 +160,25 @@ boot_continue:
|
|||
call console_write
|
||||
mov GRUB_NAME_LEN, %o3
|
||||
|
||||
GET_ABS(boot_path, %o3)
|
||||
ldub [%o3], %o1
|
||||
brnz,pn %o1, bootpath_known
|
||||
|
||||
/* getprop(chosen_node, "bootpath", &buffer, buffer_size) */
|
||||
GET_ABS(prom_bootpath_name, %o2)
|
||||
call prom_call_getprop
|
||||
mov (boot_path_end - boot_path), %o4
|
||||
|
||||
bootpath_known:
|
||||
|
||||
/* Open up the boot_path, and use that handle to read the
|
||||
* first block of the GRUB kernel image.
|
||||
*
|
||||
* bootdev_handle = open(boot_path)
|
||||
*/
|
||||
GET_ABS(prom_open_name, %o0)
|
||||
GET_ABS(boot_path, %o1)
|
||||
call prom_call_1_1
|
||||
clr %o2
|
||||
call prom_call_1_1_o2
|
||||
GET_ABS(boot_path, %o1)
|
||||
|
||||
ldx [%l1 + 0x20], BOOTDEV_REG
|
||||
brz,pn BOOTDEV_REG, prom_open_error
|
||||
|
@ -168,28 +186,23 @@ boot_continue:
|
|||
/* Since we have 64-bit cells, the high cell of the seek offset
|
||||
* is zero and the low cell is the entire value.
|
||||
*
|
||||
* seek(bootdev, 0, *kernel_sector << 9)
|
||||
* seek(bootdev, 0, *kernel_byte)
|
||||
*/
|
||||
GET_ABS(prom_seek_name, %o0)
|
||||
mov BOOTDEV_REG, %o1
|
||||
clr %o2
|
||||
LDX_ABS(kernel_sector, 0x00, %o3)
|
||||
call prom_call_3_1
|
||||
sllx %o3, 9, %o3
|
||||
call prom_call_3_1_o1
|
||||
LDX_ABS(kernel_byte, 0x00, %o3)
|
||||
|
||||
/* read(bootdev, *kernel_address, 512) */
|
||||
GET_ABS(prom_read_name, %o0)
|
||||
mov BOOTDEV_REG, %o1
|
||||
LDUW_ABS(kernel_address, 0x00, %o2)
|
||||
call prom_call_3_1
|
||||
call prom_call_3_1_o1
|
||||
mov 512, %o3
|
||||
|
||||
LDUW_ABS(kernel_address, 0x00, %o2)
|
||||
jmpl %o2, %o7
|
||||
nop
|
||||
|
||||
1: ba,a 1b
|
||||
|
||||
. = _start + GRUB_BOOT_MACHINE_CODE_END
|
||||
|
||||
/* the last 4 bytes in the sector 0 contain the signature */
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <grub/boot.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/offsets.h>
|
||||
|
||||
.text
|
||||
.align 4
|
||||
|
@ -87,8 +88,8 @@ after_info_block:
|
|||
call console_write
|
||||
mov NOTIFICATION_STRING_LEN, %o3
|
||||
|
||||
GET_ABS(firstlist - GRUB_BOOT_MACHINE_LIST_SIZE, %l2)
|
||||
set GRUB_BOOT_MACHINE_IMAGE_ADDRESS, %l3
|
||||
GET_ABS(firstlist - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2)
|
||||
set GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS, %l3
|
||||
bootloop:
|
||||
lduw [%l2 + 0x08], %o0
|
||||
brz %o0, bootit
|
||||
|
@ -115,7 +116,7 @@ bootloop:
|
|||
mov NOTIFICATION_STEP_LEN, %o3
|
||||
|
||||
ba bootloop
|
||||
sub %l2, GRUB_BOOT_MACHINE_LIST_SIZE, %l2
|
||||
sub %l2, GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2
|
||||
|
||||
bootit:
|
||||
GET_ABS(prom_close_name, %o0)
|
||||
|
@ -127,8 +128,8 @@ bootit:
|
|||
GET_ABS(notification_done, %o2)
|
||||
call console_write
|
||||
mov NOTIFICATION_DONE_LEN, %o3
|
||||
sethi %hi(GRUB_BOOT_MACHINE_IMAGE_ADDRESS), %o2
|
||||
jmpl %o2 + %lo(GRUB_BOOT_MACHINE_IMAGE_ADDRESS), %o7
|
||||
sethi %hi(GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o2
|
||||
jmpl %o2 + %lo(GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o7
|
||||
mov CIF_REG, %o4
|
||||
1: ba,a 1b
|
||||
|
||||
|
@ -136,7 +137,7 @@ lastlist:
|
|||
.word 0
|
||||
.word 0
|
||||
|
||||
. = _start + (0x200 - GRUB_BOOT_MACHINE_LIST_SIZE)
|
||||
. = _start + (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE)
|
||||
blocklist_default_start:
|
||||
.word 0
|
||||
.word 2
|
||||
|
|
|
@ -105,14 +105,14 @@ grub_usb_root_hub (grub_usb_controller_t controller __attribute__((unused)))
|
|||
grub_usb_err_t
|
||||
grub_usb_control_msg (grub_usb_device_t dev, grub_uint8_t reqtype,
|
||||
grub_uint8_t request, grub_uint16_t value,
|
||||
grub_uint16_t index, grub_size_t size, char *data)
|
||||
grub_uint16_t idx, grub_size_t size, char *data)
|
||||
{
|
||||
usb_dev_handle *devh;
|
||||
struct usb_device *d = dev->data;
|
||||
|
||||
devh = usb_open (d);
|
||||
if (usb_control_msg (devh, reqtype, request,
|
||||
value, index, data, size, 20) < 0)
|
||||
value, idx, data, size, 20) < 0)
|
||||
{
|
||||
usb_close (devh);
|
||||
return GRUB_USB_ERR_STALL;
|
|
@ -24,13 +24,14 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/crypto.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
static const struct grub_arg_option options[] = {
|
||||
{"hash", 'h', 0, "Specify hash to use.", "HASH", ARG_TYPE_STRING},
|
||||
{"check", 'c', 0, "Check hash list file.", "FILE", ARG_TYPE_STRING},
|
||||
{"prefix", 'p', 0, "Base directory for hash list.", "DIRECTORY",
|
||||
{"hash", 'h', 0, N_("Specify hash to use."), N_("HASH"), ARG_TYPE_STRING},
|
||||
{"check", 'c', 0, N_("Check hash list file."), N_("FILE"), ARG_TYPE_STRING},
|
||||
{"prefix", 'p', 0, N_("Base directory for hash list."), N_("DIRECTORY"),
|
||||
ARG_TYPE_STRING},
|
||||
{"keep-going", 'k', 0, "Don't stop after first error.", 0, 0},
|
||||
{"keep-going", 'k', 0, N_("Don't stop after first error."), 0, 0},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -249,21 +250,21 @@ GRUB_MOD_INIT(hashsum)
|
|||
options);
|
||||
cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"md5sum [-c FILE [-p PREFIX]] "
|
||||
"[FILE1 [FILE2 ...]]",
|
||||
"Compute or check hash checksum.",
|
||||
N_("[-c FILE [-p PREFIX]] "
|
||||
"[FILE1 [FILE2 ...]]"),
|
||||
N_("Compute or check hash checksum."),
|
||||
options);
|
||||
cmd_sha256 = grub_register_extcmd ("sha256sum", grub_cmd_hashsum,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"sha256sum [-c FILE [-p PREFIX]] "
|
||||
"[FILE1 [FILE2 ...]]",
|
||||
N_("[-c FILE [-p PREFIX]] "
|
||||
"[FILE1 [FILE2 ...]]"),
|
||||
"Compute or check hash checksum.",
|
||||
options);
|
||||
cmd_sha512 = grub_register_extcmd ("sha512sum", grub_cmd_hashsum,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"sha512sum [-c FILE [-p PREFIX]] "
|
||||
"[FILE1 [FILE2 ...]]",
|
||||
"Compute or check hash checksum.",
|
||||
N_("[-c FILE [-p PREFIX]] "
|
||||
"[FILE1 [FILE2 ...]]"),
|
||||
N_("Compute or check hash checksum."),
|
||||
options);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
|
|||
if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD)
|
||||
grub_arg_show_help ((grub_extcmd_t) cmd->data);
|
||||
else
|
||||
grub_printf ("%s %s %s\n%s\b", _("Usage:"), cmd->name, _(cmd->summary),
|
||||
grub_printf ("%s %s %s\n%s\n", _("Usage:"), cmd->name, _(cmd->summary),
|
||||
_(cmd->description));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -402,11 +402,10 @@ GRUB_MOD_INIT (drivemap)
|
|||
grub_get_root_biosnumber_saved = grub_get_root_biosnumber;
|
||||
grub_get_root_biosnumber = grub_get_root_biosnumber_drivemap;
|
||||
cmd = grub_register_extcmd ("drivemap", grub_cmd_drivemap,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"drivemap"
|
||||
N_("-l | -r | [-s] grubdev osdisk."),
|
||||
N_("Manage the BIOS drive mappings."),
|
||||
options);
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
N_("-l | -r | [-s] grubdev osdisk."),
|
||||
N_("Manage the BIOS drive mappings."),
|
||||
options);
|
||||
drivemap_hook =
|
||||
grub_loader_register_preboot_hook (&install_int13_handler,
|
||||
&uninstall_int13_handler,
|
||||
|
|
|
@ -177,16 +177,20 @@ static grub_err_t
|
|||
grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
{
|
||||
grub_file_t file;
|
||||
|
||||
if (argc < 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name or tempo and notes required");
|
||||
|
||||
file = grub_file_open (args[0]);
|
||||
if (file)
|
||||
if (argc == 1)
|
||||
{
|
||||
struct note buf;
|
||||
grub_uint32_t tempo;
|
||||
grub_file_t file;
|
||||
|
||||
file = grub_file_open (args[0]);
|
||||
|
||||
if (! file)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
|
||||
|
||||
if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo))
|
||||
{
|
||||
|
|
150
commands/iorw.c
Normal file
150
commands/iorw.c
Normal file
|
@ -0,0 +1,150 @@
|
|||
/* memrw.c - command to read / write physical memory */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
static grub_extcmd_t cmd_read_byte, cmd_read_word, cmd_read_dword;
|
||||
static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword;
|
||||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{0, 'v', 0, N_("Save read value into variable VARNAME."),
|
||||
N_("VARNAME"), ARG_TYPE_STRING},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_read (grub_extcmd_t cmd, int argc, char **argv)
|
||||
{
|
||||
grub_target_addr_t addr;
|
||||
grub_uint32_t value = 0;
|
||||
char buf[sizeof ("XXXXXXXX")];
|
||||
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
|
||||
|
||||
addr = grub_strtoul (argv[0], 0, 0);
|
||||
switch (cmd->cmd->name[sizeof ("in") - 1])
|
||||
{
|
||||
case 'l':
|
||||
value = grub_inl (addr);
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
value = grub_inw (addr);
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
value = grub_inb (addr);
|
||||
break;
|
||||
}
|
||||
|
||||
if (cmd->state[0].set)
|
||||
{
|
||||
grub_snprintf (buf, sizeof (buf), "%x", value);
|
||||
grub_env_set (cmd->state[0].arg, buf);
|
||||
}
|
||||
else
|
||||
grub_printf ("0x%x\n", value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_write (grub_command_t cmd, int argc, char **argv)
|
||||
{
|
||||
grub_target_addr_t addr;
|
||||
grub_uint32_t value;
|
||||
grub_uint32_t mask = 0xffffffff;
|
||||
|
||||
if (argc != 2 && argc != 3)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
|
||||
|
||||
addr = grub_strtoul (argv[0], 0, 0);
|
||||
value = grub_strtoul (argv[1], 0, 0);
|
||||
if (argc == 3)
|
||||
mask = grub_strtoul (argv[2], 0, 0);
|
||||
value &= mask;
|
||||
switch (cmd->name[sizeof ("out") - 1])
|
||||
{
|
||||
case 'l':
|
||||
if (mask != 0xffffffff)
|
||||
grub_outl ((grub_inl (addr) & ~mask) | value, addr);
|
||||
else
|
||||
grub_outl (value, addr);
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
if ((mask & 0xffff) != 0xffff)
|
||||
grub_outw ((grub_inw (addr) & ~mask) | value, addr);
|
||||
else
|
||||
grub_outw (value, addr);
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
if ((mask & 0xff) != 0xff)
|
||||
grub_outb ((grub_inb (addr) & ~mask) | value, addr);
|
||||
else
|
||||
grub_outb (value, addr);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
GRUB_MOD_INIT(memrw)
|
||||
{
|
||||
cmd_read_byte =
|
||||
grub_register_extcmd ("inb", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
||||
N_("PORT"), N_("Read byte from PORT."), options);
|
||||
cmd_read_word =
|
||||
grub_register_extcmd ("inw", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
||||
N_("PORT"), N_("Read word from PORT."), options);
|
||||
cmd_read_dword =
|
||||
grub_register_extcmd ("inl", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
||||
N_("PORT"), N_("Read dword from PORT."), options);
|
||||
cmd_write_byte =
|
||||
grub_register_command ("outb", grub_cmd_write,
|
||||
N_("PORT VALUE [MASK]"),
|
||||
N_("Write byte VALUE to PORT."));
|
||||
cmd_write_word =
|
||||
grub_register_command ("outw", grub_cmd_write,
|
||||
N_("PORT VALUE [MASK]"),
|
||||
N_("Write word VALUE to PORT."));
|
||||
cmd_write_dword =
|
||||
grub_register_command ("outl", grub_cmd_write,
|
||||
N_("ADDR VALUE [MASK]"),
|
||||
N_("Write dword VALUE to PORT."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(memrw)
|
||||
{
|
||||
grub_unregister_extcmd (cmd_read_byte);
|
||||
grub_unregister_extcmd (cmd_read_word);
|
||||
grub_unregister_extcmd (cmd_read_dword);
|
||||
grub_unregister_command (cmd_write_byte);
|
||||
grub_unregister_command (cmd_write_word);
|
||||
grub_unregister_command (cmd_write_dword);
|
||||
}
|
|
@ -175,7 +175,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
/* Load modules. */
|
||||
#if GRUB_NO_MODULES
|
||||
#if !GRUB_NO_MODULES
|
||||
{
|
||||
const char *prefix;
|
||||
prefix = grub_env_get ("prefix");
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <grub/env.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
|
@ -186,8 +187,8 @@ GRUB_MOD_INIT(password_pbkdf2)
|
|||
{
|
||||
my_mod = mod;
|
||||
cmd = grub_register_command ("password_pbkdf2", grub_cmd_password,
|
||||
"password_pbkdf2 USER PBKDF2_PASSWORD",
|
||||
"Set user password (PBKDF2). ");
|
||||
N_("USER PBKDF2_PASSWORD"),
|
||||
N_("Set user password (PBKDF2). "));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(password_pbkdf2)
|
||||
|
|
80
commands/regexp.c
Normal file
80
commands/regexp.c
Normal file
|
@ -0,0 +1,80 @@
|
|||
/* regexp.c -- The regexp command. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005,2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <regex.h>
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_regexp (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
{
|
||||
int argn = 0;
|
||||
int matches = 0;
|
||||
regex_t regex;
|
||||
int ret;
|
||||
grub_size_t s;
|
||||
char *comperr;
|
||||
grub_err_t err;
|
||||
|
||||
if (argc != 2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "2 arguments expected");
|
||||
|
||||
ret = regcomp (®ex, args[0], RE_SYNTAX_GNU_AWK);
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
ret = regexec (®ex, args[1], 0, 0, 0);
|
||||
if (!ret)
|
||||
{
|
||||
regfree (®ex);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
fail:
|
||||
s = regerror (ret, ®ex, 0, 0);
|
||||
comperr = grub_malloc (s);
|
||||
if (!comperr)
|
||||
{
|
||||
regfree (®ex);
|
||||
return grub_errno;
|
||||
}
|
||||
regerror (ret, ®ex, comperr, s);
|
||||
err = grub_error (GRUB_ERR_TEST_FAILURE, "%s", comperr);
|
||||
regfree (®ex);
|
||||
grub_free (comperr);
|
||||
return err;
|
||||
}
|
||||
|
||||
static grub_command_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(regexp)
|
||||
{
|
||||
cmd = grub_register_command ("regexp", grub_cmd_regexp,
|
||||
N_("REGEXP STRING"),
|
||||
N_("Test if REGEXP matches STRING."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(regexp)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
}
|
|
@ -23,6 +23,7 @@
|
|||
#include <grub/extcmd.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
struct pci_register
|
||||
{
|
||||
|
@ -329,9 +330,9 @@ static grub_extcmd_t cmd;
|
|||
GRUB_MOD_INIT(setpci)
|
||||
{
|
||||
cmd = grub_register_extcmd ("setpci", grub_cmd_setpci, GRUB_COMMAND_FLAG_BOTH,
|
||||
"setpci [-s POSITION] [-d DEVICE] [-v VAR] "
|
||||
"[REGISTER][=VALUE[:MASK]]",
|
||||
"Manipulate PCI devices.", options);
|
||||
N_("[-s POSITION] [-d DEVICE] [-v VAR] "
|
||||
"[REGISTER][=VALUE[:MASK]]"),
|
||||
N_("Manipulate PCI devices."), options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(setpci)
|
||||
|
|
|
@ -26,37 +26,48 @@
|
|||
struct grub_term_autoload *grub_term_input_autoload = NULL;
|
||||
struct grub_term_autoload *grub_term_output_autoload = NULL;
|
||||
|
||||
struct abstract_terminal
|
||||
{
|
||||
struct abstract_terminal *next;
|
||||
const char *name;
|
||||
grub_err_t (*init) (void);
|
||||
grub_err_t (*fini) (void);
|
||||
};
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
handle_command (int argc, char **args, struct abstract_terminal **enabled,
|
||||
struct abstract_terminal **disabled,
|
||||
struct grub_term_autoload *autoloads,
|
||||
const char *active_str,
|
||||
const char *available_str)
|
||||
{
|
||||
int i;
|
||||
grub_term_input_t term;
|
||||
struct abstract_terminal *term;
|
||||
struct grub_term_autoload *aut;
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
grub_puts_ (N_ ("Active input terminals:"));
|
||||
FOR_ACTIVE_TERM_INPUTS(term)
|
||||
grub_printf ("%s ", term->name);
|
||||
grub_puts_ (active_str);
|
||||
for (term = *enabled; term; term = term->next)
|
||||
grub_printf ("%s ", term->name);
|
||||
grub_printf ("\n");
|
||||
grub_puts_ (N_ ("Available input terminals:"));
|
||||
FOR_DISABLED_TERM_INPUTS(term)
|
||||
grub_printf ("%s ", term->name);
|
||||
grub_puts_ (available_str);
|
||||
for (term = *disabled; term; term = term->next)
|
||||
grub_printf ("%s ", term->name);
|
||||
/* This is quadratic but we don't expect mode than 30 terminal
|
||||
modules ever. */
|
||||
for (aut = grub_term_input_autoload; aut; aut = aut->next)
|
||||
{
|
||||
FOR_DISABLED_TERM_INPUTS(term)
|
||||
if (grub_strcmp (term->name, aut->name) == 0)
|
||||
break;
|
||||
if (!term)
|
||||
FOR_ACTIVE_TERM_INPUTS(term)
|
||||
if (grub_strcmp (term->name, aut->name) == 0)
|
||||
break;
|
||||
if (!term)
|
||||
grub_printf ("%s ", aut->name);
|
||||
}
|
||||
modules ever. */
|
||||
for (aut = autoloads; aut; aut = aut->next)
|
||||
{
|
||||
for (term = *disabled; term; term = term->next)
|
||||
if (grub_strcmp (term->name, aut->name) == 0)
|
||||
break;
|
||||
if (!term)
|
||||
for (term = *enabled; term; term = term->next)
|
||||
if (grub_strcmp (term->name, aut->name) == 0)
|
||||
break;
|
||||
if (!term)
|
||||
grub_printf ("%s ", aut->name);
|
||||
}
|
||||
grub_printf ("\n");
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -73,112 +84,108 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
|||
{
|
||||
int again = 0;
|
||||
while (1)
|
||||
{
|
||||
FOR_DISABLED_TERM_INPUTS(term)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (term == 0)
|
||||
FOR_ACTIVE_TERM_INPUTS(term)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (term)
|
||||
break;
|
||||
if (again)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
||||
args[i]);
|
||||
for (aut = grub_term_input_autoload; aut; aut = aut->next)
|
||||
if (grub_strcmp (args[i], aut->name) == 0)
|
||||
{
|
||||
grub_dl_t mod;
|
||||
mod = grub_dl_load (aut->modname);
|
||||
if (mod)
|
||||
grub_dl_ref (mod);
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
break;
|
||||
}
|
||||
if (!aut)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
||||
args[i]);
|
||||
again = 1;
|
||||
}
|
||||
{
|
||||
for (term = *disabled; term; term = term->next)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (term == 0)
|
||||
for (term = *enabled; term; term = term->next)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (term)
|
||||
break;
|
||||
if (again)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
||||
args[i]);
|
||||
for (aut = autoloads; aut; aut = aut->next)
|
||||
if (grub_strcmp (args[i], aut->name) == 0)
|
||||
{
|
||||
grub_dl_t mod;
|
||||
mod = grub_dl_load (aut->modname);
|
||||
if (mod)
|
||||
grub_dl_ref (mod);
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
break;
|
||||
}
|
||||
if (!aut)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
||||
args[i]);
|
||||
again = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (grub_strcmp (args[0], "--append") == 0)
|
||||
{
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
FOR_DISABLED_TERM_INPUTS(term)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (term)
|
||||
{
|
||||
{
|
||||
for (term = *disabled; term; term = term->next)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (term)
|
||||
{
|
||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
|
||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
|
||||
GRUB_AS_LIST (term));
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
}
|
||||
grub_list_remove (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
|
||||
grub_list_push (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
|
||||
}
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
if (grub_strcmp (args[0], "--remove") == 0)
|
||||
{
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
FOR_ACTIVE_TERM_INPUTS(term)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (term)
|
||||
{
|
||||
if (!term->next && term == grub_term_inputs)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"can't remove the last terminal");
|
||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs)),
|
||||
GRUB_AS_LIST (term));
|
||||
if (term->fini)
|
||||
term->fini ();
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
}
|
||||
{
|
||||
for (term = *enabled; term; term = term->next)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (term)
|
||||
{
|
||||
if (!term->next && term == *enabled)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"can't remove the last terminal");
|
||||
grub_list_remove (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
|
||||
if (term->fini)
|
||||
term->fini ();
|
||||
grub_list_push (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
|
||||
}
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
FOR_DISABLED_TERM_INPUTS(term)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
for (term = *disabled; term; term = term->next)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (term)
|
||||
{
|
||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
{
|
||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
|
||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
|
||||
GRUB_AS_LIST (term));
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
grub_list_remove (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
|
||||
grub_list_push (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
|
||||
}
|
||||
}
|
||||
|
||||
FOR_ACTIVE_TERM_INPUTS(term)
|
||||
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (i == argc)
|
||||
struct abstract_terminal *next;
|
||||
for (term = *enabled; term; term = next)
|
||||
{
|
||||
if (!term->next && term == grub_term_inputs)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"can't remove the last terminal");
|
||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs)),
|
||||
GRUB_AS_LIST (term));
|
||||
if (term->fini)
|
||||
term->fini ();
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
|
||||
GRUB_AS_LIST (term));
|
||||
next = term->next;
|
||||
for (i = 0; i < argc; i++)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (i == argc)
|
||||
{
|
||||
if (!term->next && term == *enabled)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"can't remove the last terminal");
|
||||
grub_list_remove (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
|
||||
if (term->fini)
|
||||
term->fini ();
|
||||
grub_list_push (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,163 +193,34 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
|
||||
grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
{
|
||||
int i;
|
||||
grub_term_output_t term;
|
||||
struct grub_term_autoload *aut;
|
||||
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, next);
|
||||
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, name);
|
||||
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, init);
|
||||
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, fini);
|
||||
return handle_command (argc, args,
|
||||
(struct abstract_terminal **) &grub_term_inputs,
|
||||
(struct abstract_terminal **) &grub_term_inputs_disabled,
|
||||
grub_term_input_autoload,
|
||||
N_ ("Active input terminals:"),
|
||||
N_ ("Available input terminals:"));
|
||||
}
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
grub_puts_ (N_ ("Active output terminals:"));
|
||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||
grub_printf ("%s ", term->name);
|
||||
grub_printf ("\n");
|
||||
grub_puts_ (N_ ("Available output terminals:"));
|
||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
||||
grub_printf ("%s ", term->name);
|
||||
/* This is quadratic but we don't expect mode than 30 terminal
|
||||
modules ever. */
|
||||
for (aut = grub_term_output_autoload; aut; aut = aut->next)
|
||||
{
|
||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
||||
if (grub_strcmp (term->name, aut->name) == 0)
|
||||
break;
|
||||
if (!term)
|
||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||
if (grub_strcmp (term->name, aut->name) == 0)
|
||||
break;
|
||||
if (!term)
|
||||
grub_printf ("%s ", aut->name);
|
||||
}
|
||||
grub_printf ("\n");
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
i = 0;
|
||||
|
||||
if (grub_strcmp (args[0], "--append") == 0
|
||||
|| grub_strcmp (args[0], "--remove") == 0)
|
||||
i++;
|
||||
|
||||
if (i == argc)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_ ("no terminal specified"));
|
||||
|
||||
for (; i < argc; i++)
|
||||
{
|
||||
int again = 0;
|
||||
while (1)
|
||||
{
|
||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (term == 0)
|
||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (term)
|
||||
break;
|
||||
if (again)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
||||
args[i]);
|
||||
for (aut = grub_term_output_autoload; aut; aut = aut->next)
|
||||
if (grub_strcmp (args[i], aut->name) == 0)
|
||||
{
|
||||
grub_dl_t mod;
|
||||
mod = grub_dl_load (aut->modname);
|
||||
if (mod)
|
||||
grub_dl_ref (mod);
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
break;
|
||||
}
|
||||
if (!aut)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
||||
args[i]);
|
||||
again = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (grub_strcmp (args[0], "--append") == 0)
|
||||
{
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (term)
|
||||
{
|
||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
|
||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
|
||||
GRUB_AS_LIST (term));
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
if (grub_strcmp (args[0], "--remove") == 0)
|
||||
{
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (term)
|
||||
{
|
||||
if (!term->next && term == grub_term_outputs)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"can't remove the last terminal");
|
||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs)),
|
||||
GRUB_AS_LIST (term));
|
||||
if (term->fini)
|
||||
term->fini ();
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (term)
|
||||
{
|
||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
|
||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
|
||||
GRUB_AS_LIST (term));
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
}
|
||||
|
||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
if (grub_strcmp (args[i], term->name) == 0)
|
||||
break;
|
||||
if (i == argc)
|
||||
{
|
||||
if (!term->next && term == grub_term_outputs)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"can't remove the last terminal");
|
||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs)),
|
||||
GRUB_AS_LIST (term));
|
||||
if (term->fini)
|
||||
term->fini ();
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
static grub_err_t
|
||||
grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
{
|
||||
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, next);
|
||||
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, name);
|
||||
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, init);
|
||||
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, fini);
|
||||
return handle_command (argc, args, (struct abstract_terminal **) &grub_term_outputs,
|
||||
(struct abstract_terminal **) &grub_term_outputs_disabled,
|
||||
grub_term_output_autoload,
|
||||
N_ ("Active output terminals:"),
|
||||
N_ ("Available output terminals:"));
|
||||
}
|
||||
|
||||
static grub_command_t cmd_terminal_input, cmd_terminal_output;
|
||||
|
@ -351,14 +229,14 @@ GRUB_MOD_INIT(terminal)
|
|||
{
|
||||
cmd_terminal_input =
|
||||
grub_register_command ("terminal_input", grub_cmd_terminal_input,
|
||||
"[--append|--remove] "
|
||||
"[TERMINAL1] [TERMINAL2] ...",
|
||||
"List or select an input terminal.");
|
||||
N_("[--append|--remove] "
|
||||
"[TERMINAL1] [TERMINAL2] ..."),
|
||||
N_("List or select an input terminal."));
|
||||
cmd_terminal_output =
|
||||
grub_register_command ("terminal_output", grub_cmd_terminal_output,
|
||||
"[--append|--remove] "
|
||||
"[TERMINAL1] [TERMINAL2] ...",
|
||||
"List or select an output terminal.");
|
||||
N_("[--append|--remove] "
|
||||
"[TERMINAL1] [TERMINAL2] ..."),
|
||||
N_("List or select an output terminal."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(terminal)
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
# -*- makefile -*-
|
||||
|
||||
COMMON_LDFLAGS += -nostdlib
|
||||
COMMON_CFLAGS += -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include) -fno-builtin
|
||||
COMMON_CFLAGS += -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include)
|
||||
|
||||
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
|
||||
kernel_img_RELOCATABLE = yes
|
||||
pkglib_PROGRAMS = kernel.img
|
||||
kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
|
||||
|
@ -12,14 +10,26 @@ kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
|
|||
kern/parser.c kern/partition.c kern/term.c \
|
||||
kern/rescue_reader.c kern/rescue_parser.c \
|
||||
\
|
||||
util/console.c util/grub-emu.c util/misc.c util/hostdisk.c \
|
||||
util/getroot.c util/time.c \
|
||||
kern/emu/main.c kern/emu/mm.c kern/emu/misc.c \
|
||||
kern/emu/getroot.c kern/emu/time.c kern/emu/hostdisk.c \
|
||||
kern/emu/hostfs.c kern/emu/console.c \
|
||||
\
|
||||
grub_emu_init.c gnulib/progname.c util/hostfs.c disk/host.c
|
||||
kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-undef -I$(srcdir)/gnulib
|
||||
gnulib/progname.c disk/host.c
|
||||
kernel_img_HEADERS += datetime.h emu/misc.h
|
||||
kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-char-subscripts -Wno-unused -Wno-deprecated-declarations -Wno-undef -I$(srcdir)/gnulib
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
TARGET_NO_STRIP = yes
|
||||
TARGET_NO_DYNAMIC_MODULES = yes
|
||||
|
||||
ifneq ($(TARGET_NO_MODULES), yes)
|
||||
kernel_img_SOURCES += symlist.c kern/$(target_cpu)/dl.c
|
||||
ifneq ($(target_cpu), i386)
|
||||
ifneq ($(target_cpu), x86_64)
|
||||
kernel_img_SOURCES += kern/$(target_cpu)/cache.S
|
||||
endif
|
||||
endif
|
||||
else
|
||||
kernel_img_SOURCES += grub_emu_init.c
|
||||
endif
|
||||
|
||||
# For halt.mod.
|
||||
pkglib_MODULES += halt.mod
|
||||
|
@ -37,8 +47,10 @@ endif
|
|||
grub_emu_LDFLAGS = $(LIBCURSES)
|
||||
|
||||
ifeq ($(enable_grub_emu_usb), yes)
|
||||
kernel_img_HEADERS += libusb.h
|
||||
|
||||
pkglib_MODULES += libusb.mod
|
||||
libusb_mod_SOURCES = util/usb.c
|
||||
libusb_mod_SOURCES = bus/usb/emu/usb.c
|
||||
libusb_mod_CFLAGS =
|
||||
libusb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
|
@ -65,17 +77,19 @@ endif
|
|||
|
||||
ifeq ($(enable_grub_emu_sdl), yes)
|
||||
pkglib_MODULES += sdl.mod
|
||||
sdl_mod_SOURCES = util/sdl.c
|
||||
sdl_mod_SOURCES = video/emu/sdl.c
|
||||
sdl_mod_CFLAGS =
|
||||
sdl_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
grub_emu_LDFLAGS += $(LIBSDL)
|
||||
kernel_img_HEADERS += sdl.h
|
||||
endif
|
||||
|
||||
ifeq ($(enable_grub_emu_pci), yes)
|
||||
pkglib_MODULES += pci.mod
|
||||
pci_mod_SOURCES = util/pci.c commands/lspci.c
|
||||
pci_mod_SOURCES = bus/emu/pci.c commands/lspci.c
|
||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
grub_emu_LDFLAGS += $(LIBPCIACCESS)
|
||||
kernel_img_HEADERS += libpciaccess.h
|
||||
endif
|
||||
|
||||
include $(srcdir)/conf/common.mk
|
||||
|
@ -84,12 +98,17 @@ grub_emu_init.h: genemuinitheader.sh $(pkglib_MODULES)
|
|||
rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinitheader.sh $(NM) > $@
|
||||
DISTCLEANFILES += grub_emu_init.h
|
||||
|
||||
grub_emu_init.c: genemuinit.sh $(pkglib_MODULES)
|
||||
grub_emu_init.c: genemuinit.sh $(pkglib_MODULES) grub_emu_init.h
|
||||
rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinit.sh $(NM) > $@
|
||||
DISTCLEANFILES += grub_emu_init.c
|
||||
|
||||
CLEANFILES += grub-emu
|
||||
ifneq ($(TARGET_NO_MODULES), yes)
|
||||
grub-emu: $(pkglib_PROGRAMS)
|
||||
$(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS)
|
||||
else
|
||||
grub-emu: $(pkglib_MODULES) $(pkglib_PROGRAMS)
|
||||
$(CC) -o $@ $(pkglib_MODULES) $(pkglib_PROGRAMS) $(grub_emu_LDFLAGS) $(LDFLAGS)
|
||||
$(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS)
|
||||
endif
|
||||
GRUB_EMU=grub-emu
|
||||
|
||||
|
|
|
@ -6,7 +6,8 @@ script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|||
sbin_UTILITIES += grub-mkdevicemap
|
||||
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
|
||||
util/deviceiter.c \
|
||||
util/misc.c
|
||||
util/misc.c kern/emu/misc.c \
|
||||
kern/env.c kern/err.c kern/list.c kern/misc.c kern/emu/mm.c
|
||||
|
||||
ifeq ($(target_cpu)-$(platform), sparc64-ieee1275)
|
||||
grub_mkdevicemap_SOURCES += util/ieee1275/ofpath.c util/ieee1275/devicemap.c
|
||||
|
@ -14,26 +15,25 @@ else
|
|||
grub_mkdevicemap_SOURCES += util/devicemap.c
|
||||
endif
|
||||
|
||||
# For grub-mkelfimage.
|
||||
bin_UTILITIES += grub-mkelfimage
|
||||
grub_mkelfimage_SOURCES = gnulib/progname.c \
|
||||
util/elf/grub-mkimage.c util/misc.c \
|
||||
util/resolve.c
|
||||
util/elf/grub-mkimage.c_DEPENDENCIES = Makefile
|
||||
# For grub-mkimage.
|
||||
bin_UTILITIES += grub-mkimage
|
||||
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkimage.c util/misc.c \
|
||||
util/resolve.c kern/emu/misc.c lib/LzmaEnc.c lib/LzFind.c
|
||||
util/grub-mkimage.c_DEPENDENCIES = Makefile
|
||||
|
||||
# For grub-probe.
|
||||
sbin_UTILITIES += grub-probe
|
||||
util/grub-probe.c_DEPENDENCIES = grub_probe_init.h
|
||||
grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
|
||||
util/hostdisk.c util/misc.c util/getroot.c \
|
||||
kern/emu/hostdisk.c util/misc.c kern/emu/misc.c kern/emu/getroot.c kern/emu/mm.c \
|
||||
kern/device.c kern/disk.c kern/err.c kern/misc.c \
|
||||
kern/parser.c kern/partition.c kern/file.c kern/list.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/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
||||
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \
|
||||
fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
|
||||
fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \
|
||||
\
|
||||
partmap/msdos.c partmap/bsdlabel.c partmap/apple.c \
|
||||
partmap/sun.c partmap/sunpc.c partmap/gpt.c \
|
||||
|
@ -44,24 +44,10 @@ ifeq ($(enable_grub_fstest), yes)
|
|||
bin_UTILITIES += grub-fstest
|
||||
endif
|
||||
|
||||
bin_UTILITIES += grub-mkisofs
|
||||
grub_mkisofs_SOURCES = util/mkisofs/eltorito.c \
|
||||
util/mkisofs/hash.c util/mkisofs/joliet.c \
|
||||
util/mkisofs/match.c util/mkisofs/mkisofs.c \
|
||||
util/mkisofs/multi.c util/mkisofs/name.c \
|
||||
util/mkisofs/rock.c util/mkisofs/tree.c \
|
||||
util/mkisofs/write.c \
|
||||
\
|
||||
gnulib/fnmatch.c gnulib/getopt1.c gnulib/getopt.c \
|
||||
gnulib/error.c gnulib/progname.c
|
||||
grub_mkisofs_CFLAGS = -D_FILE_OFFSET_BITS=64 \
|
||||
-I$(srcdir)/util/mkisofs/include \
|
||||
-Wno-all -Werror $(GNULIB_CFLAGS)
|
||||
|
||||
# For grub-fstest.
|
||||
util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h
|
||||
grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.c \
|
||||
util/misc.c \
|
||||
grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c kern/emu/hostfs.c \
|
||||
util/misc.c kern/emu/misc.c kern/emu/mm.c \
|
||||
kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c \
|
||||
disk/host.c disk/loopback.c kern/list.c kern/command.c \
|
||||
lib/arg.c commands/extcmd.c normal/datetime.c normal/misc.c \
|
||||
|
@ -69,7 +55,7 @@ grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.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/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c \
|
||||
fs/befs_be.c fs/tar.c \
|
||||
\
|
||||
|
@ -83,14 +69,14 @@ grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.c \
|
|||
# For grub-mkfont.
|
||||
ifeq ($(enable_grub_mkfont), yes)
|
||||
bin_UTILITIES += grub-mkfont
|
||||
grub_mkfont_SOURCES = gnulib/progname.c util/grub-mkfont.c util/misc.c
|
||||
grub_mkfont_SOURCES = gnulib/progname.c util/grub-mkfont.c util/misc.c kern/emu/misc.c
|
||||
grub_mkfont_CFLAGS = $(freetype_cflags)
|
||||
grub_mkfont_LDFLAGS = $(freetype_libs)
|
||||
endif
|
||||
|
||||
# For grub-mkrelpath.
|
||||
bin_UTILITIES += grub-mkrelpath
|
||||
grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c
|
||||
grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c kern/emu/misc.c
|
||||
|
||||
bin_UTILITIES += grub-bin2h
|
||||
grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.c
|
||||
|
@ -98,28 +84,29 @@ grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.c
|
|||
# For the lexer.
|
||||
grub_script.yy.c grub_script.yy.h: script/yylex.l
|
||||
$(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(srcdir)/script/yylex.l
|
||||
sed -i 's/^#include.*\(<stdio\.h>\|<string\.h>\|<errno\.h>\|<stdlib\.h>\|<unistd\.h>\)//g' grub_script.yy.h
|
||||
sed -i 's/^#include.*\(<stdio\.h>\|<string\.h>\|<errno\.h>\|<stdlib\.h>\|<unistd\.h>\)//g' grub_script.yy.c
|
||||
DISTCLEANFILES += grub_script.yy.c grub_script.yy.h
|
||||
|
||||
# For grub-script-check.
|
||||
bin_UTILITIES += grub-script-check
|
||||
util/grub-script-check.c_DEPENDENCIES = grub_script_check_init.h
|
||||
grub_script_check_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c \
|
||||
util/grub-script-check.c util/misc.c \
|
||||
util/grub-script-check.c util/misc.c kern/emu/misc.c kern/emu/mm.c \
|
||||
script/main.c script/script.c script/function.c script/lexer.c \
|
||||
kern/handler.c kern/err.c kern/parser.c kern/list.c \
|
||||
kern/misc.c kern/env.c grub_script_check_init.c grub_script.tab.c \
|
||||
grub_script.yy.c
|
||||
grub_script_check_CFLAGS = $(GNULIB_CFLAGS)
|
||||
grub_script_check_CFLAGS = $(GNULIB_UTIL_CFLAGS)
|
||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
||||
DEFSYMFILES += kernel_syms.lst
|
||||
|
||||
kernel_img_HEADERS += boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
machine/memory.h machine/loader.h machine/kernel.h \
|
||||
list.h handler.h command.h i18n.h env_private.h
|
||||
list.h handler.h command.h i18n.h env_private.h libgcc.h
|
||||
|
||||
ifneq ($(platform), emu)
|
||||
kernel_img_HEADERS += machine/memory.h machine/loader.h
|
||||
endif
|
||||
|
||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
||||
|
@ -186,7 +173,7 @@ DISTCLEANFILES += grub_fstest_init.c
|
|||
|
||||
# for grub-editenv
|
||||
bin_UTILITIES += grub-editenv
|
||||
grub_editenv_SOURCES = gnulib/progname.c util/grub-editenv.c lib/envblk.c util/misc.c kern/misc.c kern/err.c
|
||||
grub_editenv_SOURCES = gnulib/progname.c util/grub-editenv.c lib/envblk.c util/misc.c kern/emu/misc.c kern/emu/mm.c kern/misc.c kern/err.c
|
||||
CLEANFILES += grub-editenv
|
||||
|
||||
# Needed for genmk.rb to work
|
||||
|
@ -194,7 +181,7 @@ ifeq (0,1)
|
|||
bin_UTILITIES += grub-macho2img grub-pe2elf
|
||||
endif
|
||||
|
||||
grub_pe2elf_SOURCES = gnulib/progname.c util/grub-pe2elf.c util/misc.c
|
||||
grub_pe2elf_SOURCES = gnulib/progname.c util/grub-pe2elf.c util/misc.c kern/emu/misc.c
|
||||
CLEANFILES += grub-pe2elf
|
||||
|
||||
grub_macho2img_SOURCES = util/grub-macho2img.c
|
||||
|
@ -297,6 +284,12 @@ minix_mod_SOURCES = fs/minix.c
|
|||
minix_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
minix_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For nilfs2.mod.
|
||||
pkglib_MODULES += nilfs2.mod
|
||||
nilfs2_mod_SOURCES = fs/nilfs2.c
|
||||
nilfs2_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
nilfs2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For hfs.mod.
|
||||
hfs_mod_SOURCES = fs/hfs.c
|
||||
hfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
@ -655,7 +648,7 @@ normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|||
# For sh.mod.
|
||||
sh_mod_SOURCES = script/main.c script/script.c script/execute.c \
|
||||
script/function.c script/lexer.c grub_script.tab.c grub_script.yy.c
|
||||
sh_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
sh_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS) -Wno-error
|
||||
sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
ifneq (, $(FONT_SOURCE))
|
||||
|
@ -786,6 +779,11 @@ charset_mod_SOURCES = lib/charset.c
|
|||
charset_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
charset_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += regexp.mod
|
||||
regexp_mod_SOURCES = gnulib/regex.c commands/regexp.c
|
||||
regexp_mod_CFLAGS = $(COMMON_CFLAGS) $(GNULIB_CFLAGS)
|
||||
regexp_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += terminal.mod
|
||||
terminal_mod_SOURCES = commands/terminal.c
|
||||
terminal_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
@ -849,7 +847,7 @@ boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
bin_UTILITIES += grub-mkpasswd-pbkdf2
|
||||
grub_mkpasswd_pbkdf2_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c util/grub-mkpasswd-pbkdf2.c lib/crypto.c lib/libgcrypt-grub/cipher/sha512.c lib/pbkdf2.c util/misc.c kern/err.c
|
||||
grub_mkpasswd_pbkdf2_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c util/grub-mkpasswd-pbkdf2.c lib/crypto.c lib/libgcrypt-grub/cipher/sha512.c lib/pbkdf2.c util/misc.c kern/emu/misc.c kern/emu/mm.c kern/err.c
|
||||
grub_mkpasswd_pbkdf2_CFLAGS += -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap -DGRUB_MKPASSWD=1
|
||||
|
||||
include $(srcdir)/conf/gcry.mk
|
||||
|
|
|
@ -4,13 +4,11 @@ COMMON_CFLAGS = -mrtd -mregparm=3
|
|||
|
||||
# Images.
|
||||
|
||||
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
||||
|
||||
pkglib_PROGRAMS += kernel.img
|
||||
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
||||
kern/i386/misc.S \
|
||||
kern/i386/coreboot/init.c \
|
||||
kern/i386/multiboot_mmap.c \
|
||||
kern/i386/coreboot/mmap.c \
|
||||
kern/i386/halt.c \
|
||||
kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
|
@ -26,7 +24,7 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
|||
symlist.c
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
|
||||
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x8200,-Bstatic
|
||||
|
||||
sbin_SCRIPTS += grub-install
|
||||
grub_install_SOURCES = util/grub-install.in
|
||||
|
|
|
@ -27,7 +27,7 @@ kernel_img_SOURCES = kern/i386/ieee1275/startup.S \
|
|||
kernel_img_HEADERS += ieee1275/ieee1275.h
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x10000,-Bstatic
|
||||
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x10000,-Bstatic
|
||||
|
||||
# Scripts.
|
||||
sbin_SCRIPTS = grub-install
|
||||
|
|
74
conf/i386-multiboot.rmk
Normal file
74
conf/i386-multiboot.rmk
Normal file
|
@ -0,0 +1,74 @@
|
|||
# -*- makefile -*-
|
||||
|
||||
COMMON_CFLAGS = -mrtd -mregparm=3
|
||||
|
||||
# Images.
|
||||
|
||||
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
||||
|
||||
pkglib_PROGRAMS += kernel.img
|
||||
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
||||
kern/i386/misc.S \
|
||||
kern/i386/coreboot/init.c \
|
||||
kern/i386/multiboot_mmap.c \
|
||||
kern/i386/halt.c \
|
||||
kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||
kern/i386/tsc.c kern/i386/pit.c \
|
||||
kern/generic/rtc_get_time_ms.c \
|
||||
kern/generic/millisleep.c \
|
||||
kern/env.c \
|
||||
term/i386/pc/vga_text.c term/i386/vga_common.c \
|
||||
symlist.c
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
|
||||
|
||||
sbin_SCRIPTS += grub-install
|
||||
grub_install_SOURCES = util/grub-install.in
|
||||
|
||||
bin_SCRIPTS += grub-mkrescue
|
||||
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
||||
|
||||
# Modules.
|
||||
pkglib_MODULES = linux.mod aout.mod halt.mod datetime.mod mmap.mod
|
||||
|
||||
# For mmap.mod.
|
||||
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
|
||||
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
||||
# For linux.mod.
|
||||
linux_mod_SOURCES = loader/i386/linux.c
|
||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For halt.mod.
|
||||
halt_mod_SOURCES = commands/halt.c
|
||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For aout.mod.
|
||||
aout_mod_SOURCES = loader/aout.c
|
||||
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For bsd.mod
|
||||
pkglib_MODULES += bsd.mod
|
||||
bsd_mod_SOURCES = loader/i386/bsd.c loader/i386/bsd32.c loader/i386/bsd64.c loader/i386/bsd_helper.S loader/i386/bsd_trampoline.S
|
||||
bsd_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
||||
# For datetime.mod
|
||||
datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
include $(srcdir)/conf/i386.mk
|
||||
include $(srcdir)/conf/common.mk
|
|
@ -1,12 +1,9 @@
|
|||
# -*- makefile -*-
|
||||
|
||||
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
||||
|
||||
COMMON_CFLAGS = -mrtd -mregparm=3
|
||||
|
||||
# Images.
|
||||
pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \
|
||||
pxeboot.img
|
||||
pkglib_IMAGES = boot.img cdboot.img diskboot.img lnxboot.img pxeboot.img
|
||||
|
||||
# For boot.img.
|
||||
boot_img_SOURCES = boot/i386/pc/boot.S
|
||||
|
@ -39,6 +36,7 @@ cdboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x7C00
|
|||
cdboot_img_FORMAT = binary
|
||||
|
||||
# For kernel.img.
|
||||
pkglib_PROGRAMS = kernel.img
|
||||
kernel_img_SOURCES = kern/i386/pc/startup.S \
|
||||
kern/i386/misc.S \
|
||||
kern/main.c kern/device.c \
|
||||
|
@ -55,42 +53,33 @@ kernel_img_SOURCES = kern/i386/pc/startup.S \
|
|||
term/i386/pc/console.c term/i386/vga_common.c \
|
||||
symlist.c
|
||||
kernel_img_HEADERS += machine/biosdisk.h machine/vga.h machine/vbe.h \
|
||||
machine/pxe.h i386/pit.h
|
||||
machine/pxe.h i386/pit.h machine/kernel.h
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
|
||||
kernel_img_FORMAT = binary
|
||||
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x8200 $(COMMON_CFLAGS)
|
||||
|
||||
# Utilities.
|
||||
bin_UTILITIES = grub-mkimage
|
||||
sbin_UTILITIES = grub-setup
|
||||
|
||||
# For grub-mkimage.
|
||||
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkrawimage.c util/misc.c \
|
||||
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
|
||||
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
||||
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
||||
|
||||
# For grub-setup.
|
||||
util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
||||
grub_setup_SOURCES = gnulib/progname.c \
|
||||
util/i386/pc/grub-setup.c util/hostdisk.c \
|
||||
util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
||||
kern/err.c kern/misc.c kern/parser.c kern/partition.c \
|
||||
kern/file.c kern/fs.c kern/env.c kern/list.c \
|
||||
fs/fshelp.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/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
||||
\
|
||||
partmap/msdos.c partmap/bsdlabel.c partmap/sunpc.c \
|
||||
partmap/gpt.c \
|
||||
\
|
||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
||||
util/raid.c util/lvm.c \
|
||||
grub_setup_SOURCES = gnulib/progname.c util/i386/pc/grub-setup.c \
|
||||
util/misc.c kern/emu/misc.c kern/emu/getroot.c \
|
||||
kern/emu/hostdisk.c kern/device.c kern/disk.c kern/err.c \
|
||||
kern/misc.c kern/parser.c kern/partition.c kern/file.c \
|
||||
kern/emu/mm.c kern/fs.c kern/env.c kern/list.c fs/fshelp.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/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \
|
||||
fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
|
||||
fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \
|
||||
\
|
||||
partmap/msdos.c partmap/bsdlabel.c partmap/sunpc.c \
|
||||
partmap/gpt.c \
|
||||
\
|
||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
||||
util/raid.c util/lvm.c \
|
||||
grub_setup_init.c
|
||||
|
||||
sbin_SCRIPTS += grub-install
|
||||
|
@ -185,7 +174,7 @@ vbetest_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
vbetest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For vga.mod.
|
||||
vga_mod_SOURCES = term/i386/pc/vga.c
|
||||
vga_mod_SOURCES = video/i386/pc/vga.c
|
||||
vga_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
vga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
|
|
|
@ -13,13 +13,7 @@ boot_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_M
|
|||
boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
||||
boot_img_FORMAT = binary
|
||||
|
||||
bin_UTILITIES += grub-mkimage
|
||||
grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
|
||||
util/resolve.c gnulib/progname.c
|
||||
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
||||
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
||||
|
||||
pkglib_IMAGES += kernel.img
|
||||
pkglib_PROGRAMS += kernel.img
|
||||
kernel_img_SOURCES = kern/i386/qemu/startup.S \
|
||||
kern/i386/misc.S \
|
||||
kern/i386/coreboot/init.c \
|
||||
|
@ -39,7 +33,7 @@ kernel_img_SOURCES = kern/i386/qemu/startup.S \
|
|||
symlist.c
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
||||
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
||||
kernel_img_FORMAT = binary
|
||||
|
||||
sbin_SCRIPTS += grub-install
|
||||
|
|
|
@ -74,3 +74,8 @@ play_mod_SOURCES = commands/i386/pc/play.c
|
|||
play_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For iorw.mod.
|
||||
pkglib_MODULES += iorw.mod
|
||||
iorw_mod_SOURCES = commands/iorw.c
|
||||
iorw_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
iorw_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
|
|
@ -5,7 +5,7 @@ COMMON_CFLAGS += -march=mips3
|
|||
COMMON_ASFLAGS += -march=mips3
|
||||
include $(srcdir)/conf/mips.mk
|
||||
|
||||
pkglib_IMAGES = kernel.img
|
||||
pkglib_PROGRAMS = kernel.img
|
||||
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
||||
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
|
||||
kern/$(target_cpu)/$(target_machine)/init.c \
|
||||
|
@ -18,6 +18,5 @@ kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
|||
symlist.c kern/$(target_cpu)/cache.S
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
|
||||
-Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
|
||||
kernel_img_FORMAT = binary
|
||||
|
|
|
@ -9,7 +9,7 @@ kernel_img_HEADERS += pci.h bitmap.h video.h gfxterm.h font.h \
|
|||
|
||||
include $(srcdir)/conf/mips.mk
|
||||
|
||||
pkglib_IMAGES = kernel.img
|
||||
pkglib_PROGRAMS = kernel.img
|
||||
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
||||
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
|
||||
kern/$(target_cpu)/$(target_machine)/init.c \
|
||||
|
@ -31,8 +31,7 @@ kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
|||
symlist.c
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DUSE_ASCII_FAILBACK
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
|
||||
-Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
|
||||
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
|
||||
kernel_img_FORMAT = binary
|
||||
|
||||
pkglib_IMAGES += fwstart.img
|
||||
|
|
|
@ -4,19 +4,12 @@
|
|||
COMMON_CFLAGS += -mexplicit-relocs -mflush-func=grub_cpu_flush_cache
|
||||
|
||||
# Images.
|
||||
kernel_img_HEADERS += cpu/libgcc.h cpu/cache.h
|
||||
kernel_img_HEADERS += cpu/cache.h
|
||||
|
||||
# Scripts.
|
||||
sbin_SCRIPTS =
|
||||
bin_SCRIPTS =
|
||||
|
||||
# For grub-mkimage.
|
||||
bin_UTILITIES += grub-mkimage
|
||||
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkrawimage.c util/misc.c \
|
||||
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
|
||||
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(LINK_BASE)
|
||||
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
||||
|
||||
# For serial.mod.
|
||||
pkglib_MODULES += serial.mod
|
||||
serial_mod_SOURCES = term/serial.c
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
# Images.
|
||||
|
||||
kernel_img_HEADERS += cpu/libgcc.h ieee1275/ieee1275.h
|
||||
kernel_img_HEADERS += ieee1275/ieee1275.h
|
||||
|
||||
# Programs
|
||||
pkglib_PROGRAMS = kernel.img
|
||||
|
@ -23,8 +23,7 @@ kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \
|
|||
symlist.c kern/$(target_cpu)/cache.S
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
|
||||
-Wl,-N,-S,-Ttext,0x200000,-Bstatic
|
||||
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x200000,-Bstatic
|
||||
|
||||
# Scripts.
|
||||
sbin_SCRIPTS = grub-install
|
||||
|
|
|
@ -5,7 +5,8 @@ COMMON_CFLAGS = -mno-app-regs
|
|||
COMMON_LDFLAGS = -melf64_sparc -mno-relax
|
||||
|
||||
# Images.
|
||||
pkglib_IMAGES = boot.img diskboot.img kernel.img
|
||||
pkglib_IMAGES = boot.img diskboot.img
|
||||
pkglib_PROGRAMS = kernel.img
|
||||
|
||||
# For boot.img.
|
||||
boot_img_SOURCES = boot/sparc64/ieee1275/boot.S
|
||||
|
@ -19,7 +20,7 @@ diskboot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|||
diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-Ttext,0x4200
|
||||
diskboot_img_FORMAT = binary
|
||||
|
||||
kernel_img_HEADERS += cpu/libgcc.h ieee1275/ieee1275.h cpu/ieee1275/ieee1275.h
|
||||
kernel_img_HEADERS += ieee1275/ieee1275.h cpu/ieee1275/ieee1275.h
|
||||
kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
|
||||
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||
|
@ -36,41 +37,37 @@ kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
|
|||
symlist.c kern/$(target_cpu)/cache.S
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,0x4400,-Bstatic,-melf64_sparc -static-libgcc -lgcc
|
||||
kernel_img_LDFLAGS += -nostdlib -Wl,-N,-Ttext,0x4400,-Bstatic,-melf64_sparc
|
||||
kernel_img_FORMAT = binary
|
||||
|
||||
# Utilities.
|
||||
bin_UTILITIES = grub-mkimage
|
||||
sbin_UTILITIES = grub-setup grub-ofpathname
|
||||
|
||||
# For grub-mkimage.
|
||||
grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
|
||||
util/resolve.c gnulib/progname.c
|
||||
|
||||
# For grub-setup.
|
||||
util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
||||
grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
|
||||
util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
||||
kern/err.c kern/misc.c kern/parser.c kern/partition.c \
|
||||
kern/file.c kern/fs.c kern/env.c kern/list.c \
|
||||
fs/fshelp.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/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
||||
\
|
||||
partmap/amiga.c partmap/apple.c partmap/msdos.c \
|
||||
partmap/bsdlabel.c partmap/sun.c partmap/acorn.c \
|
||||
\
|
||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
||||
util/raid.c util/lvm.c gnulib/progname.c \
|
||||
grub_setup_init.c
|
||||
grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c \
|
||||
util/ieee1275/ofpath.c util/misc.c kern/emu/hostdisk.c \
|
||||
kern/emu/misc.c kern/emu/getroot.c kern/emu/mm.c kern/device.c \
|
||||
kern/disk.c kern/err.c kern/misc.c kern/parser.c \
|
||||
kern/partition.c kern/file.c kern/fs.c kern/env.c kern/list.c \
|
||||
fs/fshelp.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/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \
|
||||
fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
|
||||
fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \
|
||||
\
|
||||
partmap/amiga.c partmap/apple.c partmap/msdos.c \
|
||||
partmap/bsdlabel.c partmap/sun.c partmap/acorn.c \
|
||||
\
|
||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c util/raid.c \
|
||||
util/lvm.c gnulib/progname.c grub_setup_init.c
|
||||
|
||||
# For grub-ofpathname.
|
||||
grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \
|
||||
util/ieee1275/ofpath.c util/misc.c gnulib/progname.c
|
||||
grub_ofpathname_SOURCES = util/ieee1275/grub-ofpathname.c \
|
||||
util/ieee1275/ofpath.c util/misc.c kern/emu/misc.c \
|
||||
gnulib/progname.c
|
||||
|
||||
# Scripts.
|
||||
sbin_SCRIPTS = grub-install
|
||||
|
|
|
@ -53,12 +53,24 @@ grub_script_vars1_SOURCES = tests/grub_script_vars1.in
|
|||
check_SCRIPTS += grub_script_for1
|
||||
grub_script_for1_SOURCES = tests/grub_script_for1.in
|
||||
|
||||
check_SCRIPTS += grub_script_while1
|
||||
grub_script_while1_SOURCES = tests/grub_script_while1.in
|
||||
|
||||
check_SCRIPTS += grub_script_if
|
||||
grub_script_if_SOURCES = tests/grub_script_if.in
|
||||
|
||||
check_SCRIPTS += grub_script_blanklines
|
||||
grub_script_blanklines_SOURCES = tests/grub_script_blanklines.in
|
||||
|
||||
check_SCRIPTS += grub_script_final_semicolon
|
||||
grub_script_final_semicolon_SOURCES = tests/grub_script_final_semicolon.in
|
||||
|
||||
check_SCRIPTS += grub_script_dollar
|
||||
grub_script_dollar_SOURCES = tests/grub_script_dollar.in
|
||||
|
||||
check_SCRIPTS += grub_script_comments
|
||||
grub_script_comments_SOURCES = tests/grub_script_comments.in
|
||||
|
||||
# List of tests to execute on "make check"
|
||||
# SCRIPTED_TESTS = example_scripted_test
|
||||
# SCRIPTED_TESTS += example_grub_script_test
|
||||
|
@ -69,8 +81,12 @@ SCRIPTED_TESTS = grub_script_echo1
|
|||
SCRIPTED_TESTS += grub_script_echo_keywords
|
||||
SCRIPTED_TESTS += grub_script_vars1
|
||||
SCRIPTED_TESTS += grub_script_for1
|
||||
SCRIPTED_TESTS += grub_script_while1
|
||||
SCRIPTED_TESTS += grub_script_if
|
||||
SCRIPTED_TESTS += grub_script_blanklines
|
||||
SCRIPTED_TESTS += grub_script_final_semicolon
|
||||
SCRIPTED_TESTS += grub_script_dollar
|
||||
SCRIPTED_TESTS += grub_script_comments
|
||||
|
||||
# dependencies between tests and testing-tools
|
||||
$(SCRIPTED_TESTS): grub-shell grub-shell-tester
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
# -*- makefile -*-
|
||||
|
||||
# Utilities.
|
||||
bin_UTILITIES = grub-mkimage
|
||||
|
||||
# For grub-mkimage.
|
||||
grub_mkimage_SOURCES = gnulib/progname.c util/i386/efi/grub-mkimage.c \
|
||||
util/misc.c util/resolve.c
|
||||
util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile
|
||||
|
||||
# Scripts.
|
||||
sbin_SCRIPTS = grub-install
|
||||
|
||||
# For grub-install.
|
||||
grub_install_SOURCES = util/i386/efi/grub-install.in
|
||||
|
||||
bin_SCRIPTS += grub-mkrescue
|
||||
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
||||
|
||||
# Modules.
|
||||
pkglib_PROGRAMS = kernel.img
|
||||
pkglib_MODULES = chain.mod appleldr.mod \
|
||||
|
@ -40,7 +35,7 @@ endif
|
|||
kernel_img_HEADERS += efi/efi.h efi/time.h efi/disk.h i386/pit.h
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
kernel_img_LDFLAGS += $(COMMON_LDFLAGS)
|
||||
|
||||
# For acpi.mod.
|
||||
acpi_mod_SOURCES = commands/acpi.c commands/efi/acpi.c
|
||||
|
@ -64,13 +59,17 @@ appleldr_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
appleldr_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For linux.mod.
|
||||
linux_mod_SOURCES = loader/i386/efi/linux.c
|
||||
ifeq ($(target_cpu), x86_64)
|
||||
linux_mod_SOURCES += loader/i386/linux_trampoline.S
|
||||
endif
|
||||
linux_mod_SOURCES = loader/i386/efi/linux.c loader/i386/linux_trampoline.S
|
||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
else
|
||||
linux_mod_SOURCES = loader/i386/efi/linux.c
|
||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
endif
|
||||
|
||||
# For halt.mod.
|
||||
halt_mod_SOURCES = commands/halt.c
|
||||
|
|
105
configure.ac
105
configure.ac
|
@ -102,6 +102,7 @@ case "$target_cpu"-"$platform" in
|
|||
i386-efi) ;;
|
||||
x86_64-efi) ;;
|
||||
i386-pc) ;;
|
||||
i386-multiboot) ;;
|
||||
i386-coreboot) ;;
|
||||
i386-linuxbios) platform=coreboot ;;
|
||||
i386-ieee1275) ;;
|
||||
|
@ -130,11 +131,13 @@ case "$host_os" in
|
|||
gnu*) host_kernel=hurd ;;
|
||||
linux*) host_kernel=linux ;;
|
||||
freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
|
||||
netbsd*) host_kernel=netbsd ;;
|
||||
cygwin) host_kernel=windows ;;
|
||||
esac
|
||||
|
||||
case "$platform" in
|
||||
coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
|
||||
multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;;
|
||||
efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
|
||||
ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
|
||||
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
|
||||
|
@ -147,6 +150,7 @@ case "$target_cpu" in
|
|||
mips) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_MIPS=1" ;;
|
||||
sparc64) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
|
||||
esac
|
||||
machine_CFLAGS="$machine_CFLAGS -DMACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
|
||||
|
||||
CFLAGS="$CFLAGS $machine_CFLAGS"
|
||||
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
|
||||
|
@ -170,11 +174,6 @@ if test "x$CMP" = x; then
|
|||
AC_MSG_ERROR([cmp is not found])
|
||||
fi
|
||||
|
||||
AC_CHECK_PROGS([LEX], [flex])
|
||||
if test "x$LEX" = x; then
|
||||
AC_MSG_ERROR([flex is not found])
|
||||
fi
|
||||
|
||||
AC_CHECK_PROGS([YACC], [bison])
|
||||
if test "x$YACC" = x; then
|
||||
AC_MSG_ERROR([bison is not found])
|
||||
|
@ -189,9 +188,21 @@ done
|
|||
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_AWK
|
||||
AC_PROG_LEX
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_MKDIR_P
|
||||
|
||||
if test "x$LEX" = x; then
|
||||
AC_MSG_ERROR([flex is not found])
|
||||
else
|
||||
version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
|
||||
if test -n "$version" -a "$version" -ge 20535; then
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
|
||||
fi
|
||||
fi
|
||||
|
||||
# These are not a "must".
|
||||
AC_PATH_PROG(RUBY, ruby)
|
||||
AC_PATH_PROG(MAKEINFO, makeinfo)
|
||||
|
@ -235,6 +246,20 @@ AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid)
|
|||
AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h)
|
||||
AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h limits.h)
|
||||
|
||||
# For opendisk() and getrawpartition() on NetBSD.
|
||||
# Used in util/deviceiter.c and in util/hostdisk.c.
|
||||
AC_CHECK_HEADER([util.h], [
|
||||
AC_CHECK_LIB([util], [opendisk], [
|
||||
LIBUTIL="-lutil"
|
||||
AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
|
||||
])
|
||||
AC_CHECK_LIB([util], [getrawpartition], [
|
||||
LIBUTIL="-lutil"
|
||||
AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
|
||||
])
|
||||
])
|
||||
AC_SUBST([LIBUTIL])
|
||||
|
||||
#
|
||||
# Check for target programs.
|
||||
#
|
||||
|
@ -338,7 +363,7 @@ else
|
|||
if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
|
||||
TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
|
||||
TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext,"
|
||||
TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
|
||||
TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc -Wl,-Ttext,"
|
||||
else
|
||||
TARGET_IMG_LDSCRIPT=
|
||||
TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,'
|
||||
|
@ -354,7 +379,11 @@ AC_SUBST(TARGET_IMG_CFLAGS)
|
|||
# For platforms where ELF is not the default link format.
|
||||
AC_MSG_CHECKING([for command to convert module to ELF format])
|
||||
case "${host_os}" in
|
||||
cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;;
|
||||
cygwin) TARGET_OBJ2ELF='grub-pe2elf';
|
||||
# FIXME: put proper test here
|
||||
AC_DEFINE([NEED_REGISTER_FRAME_INFO], 1,
|
||||
[Define to 1 if GCC generates calls to __register_frame_info()])
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
AC_SUBST(TARGET_OBJ2ELF)
|
||||
|
@ -387,9 +416,7 @@ if test "$target_cpu"-"$platform" = x86_64-efi; then
|
|||
[grub_cv_cc_mcmodel=no])
|
||||
])
|
||||
if test "x$grub_cv_cc_mcmodel" = xno; then
|
||||
CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1"
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1"
|
||||
AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the memory over 4GiB. Upgrade your gcc])
|
||||
AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
|
||||
else
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
|
||||
fi
|
||||
|
@ -457,12 +484,19 @@ CC="$TARGET_CC"
|
|||
if test "x$TARGET_APPLE_CC" = x1 ; then
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
|
||||
else
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wl,--defsym,abort=main -Wno-error"
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
|
||||
fi
|
||||
CPPFLAGS="$TARGET_CPPFLAGS"
|
||||
LDFLAGS="$TARGET_LDFLAGS"
|
||||
LIBS=-lgcc
|
||||
|
||||
grub_ASM_USCORE
|
||||
if test x$grub_cv_asm_uscore = xyes; then
|
||||
CFLAGS="$CFLAGS -Wl,--defsym,_abort=_main"
|
||||
else
|
||||
CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
|
||||
fi
|
||||
|
||||
# Check for libgcc symbols
|
||||
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
|
||||
|
||||
|
@ -479,13 +513,12 @@ if test "x$TARGET_APPLE_CC" != x1 ; then
|
|||
grub_PROG_OBJCOPY_ABSOLUTE
|
||||
fi
|
||||
grub_PROG_LD_BUILD_ID_NONE
|
||||
grub_ASM_USCORE
|
||||
if test "x$target_cpu" = xi386; then
|
||||
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
|
||||
# Check symbols provided by linker script.
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib $TARGET_IMG_LDFLAGS_AC -Wl,-Ttext,8000,--defsym,___main=0x8100"
|
||||
fi
|
||||
if test "x$TARGET_APPLE_CC" != x1 ; then
|
||||
if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then
|
||||
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
|
||||
# Check symbols provided by linker script.
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC}8000 -Wl,--defsym,___main=0x8100"
|
||||
fi
|
||||
grub_CHECK_BSS_START_SYMBOL
|
||||
grub_CHECK_END_SYMBOL
|
||||
fi
|
||||
|
@ -576,6 +609,10 @@ AC_ARG_ENABLE([grub-emu-pci],
|
|||
[AS_HELP_STRING([--enable-grub-emu-pci],
|
||||
[build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
|
||||
|
||||
AC_ARG_ENABLE([grub-emu-modules],
|
||||
[AS_HELP_STRING([--enable-grub-emu-modules],
|
||||
[Support module loading in `grub-emu' debugging utility (default=no)])])
|
||||
|
||||
if test "$platform" = emu; then
|
||||
missing_ncurses=
|
||||
[# Check for curses libraries.]
|
||||
|
@ -594,6 +631,19 @@ if test x"$missing_ncurses" = xtrue ; then
|
|||
AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
|
||||
fi
|
||||
|
||||
if test x"$enable_grub_emu_modules" = xyes ; then
|
||||
TARGET_NO_MODULES=no
|
||||
else
|
||||
TARGET_NO_MODULES=yes
|
||||
fi
|
||||
AC_SUBST(TARGET_NO_MODULES)
|
||||
|
||||
if test "$TARGET_NO_MODULES" = yes ; then
|
||||
# Do not convert modules, otherwise linkage may fail (Cygwin only).
|
||||
# FIXME: Should be checked above before TARGET_OBJ2ELF is set first.
|
||||
TARGET_OBJ2ELF=
|
||||
fi
|
||||
|
||||
if test x"$enable_grub_emu_usb" = xno ; then
|
||||
grub_emu_usb_excuse="explicitly disabled"
|
||||
fi
|
||||
|
@ -730,6 +780,22 @@ AC_SUBST([enable_grub_mkfont])
|
|||
AC_SUBST([freetype_cflags])
|
||||
AC_SUBST([freetype_libs])
|
||||
|
||||
AC_ARG_ENABLE([device-mapper],
|
||||
[AS_HELP_STRING([--enable-device-mapper],
|
||||
[enable Linux device-mapper support (default=guessed)])])
|
||||
if test x"$enable_device_mapper" = xno ; then
|
||||
device_mapper_excuse="explicitly disabled"
|
||||
fi
|
||||
|
||||
if test x"$device_mapper_excuse" = x ; then
|
||||
# Check for device-mapper library.
|
||||
AC_CHECK_LIB([devmapper], [dm_task_create],
|
||||
[LDFLAGS="$LDFLAGS -ldevmapper"
|
||||
AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
|
||||
[Define to 1 if you have the devmapper library.])],
|
||||
[device_mapper_excuse="need devmapper library"])
|
||||
fi
|
||||
|
||||
AC_SUBST(ASFLAGS)
|
||||
|
||||
# Output files.
|
||||
|
@ -771,6 +837,11 @@ echo PCI support for grub-emu: Yes
|
|||
else
|
||||
echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
|
||||
fi
|
||||
if [ x"$TARGET_NO_MODULES" = xno ]; then
|
||||
echo Module support for grub-emu: Yes
|
||||
else
|
||||
echo Module support for grub-emu: No
|
||||
fi
|
||||
fi
|
||||
if [ x"$enable_mm_debug" = xyes ]; then
|
||||
echo With memory debugging: Yes
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/lvm.h>
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
#include <grub/emu/misc.h>
|
||||
#endif
|
||||
|
||||
static struct grub_lvm_vg *vg_list;
|
||||
static int lv_count;
|
||||
|
||||
|
@ -68,6 +72,9 @@ grub_lvm_memberlist (grub_disk_t disk)
|
|||
if (lv->vg->pvs)
|
||||
for (pv = lv->vg->pvs; pv; pv = pv->next)
|
||||
{
|
||||
if (!pv->disk)
|
||||
grub_util_error ("Couldn't find PV %s. Check your device.map",
|
||||
pv->name);
|
||||
tmp = grub_malloc (sizeof (*tmp));
|
||||
tmp->disk = pv->disk;
|
||||
tmp->next = list;
|
||||
|
|
|
@ -1379,7 +1379,8 @@ pitch and duration pairs.
|
|||
If the arguments are a series of numbers, play the inline tune.
|
||||
|
||||
The tempo is the base for all note durations. 60 gives a 1-second base, 120
|
||||
gives a half-second base, etc. Pitches are Hz.
|
||||
gives a half-second base, etc. Pitches are Hz. Set pitch to 0 to produce
|
||||
a rest.
|
||||
@end deffn
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <grub/efiemu/efiemu.h>
|
||||
#include <grub/machine/efiemu.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* System table. Two version depending on mode */
|
||||
grub_efi_system_table32_t *grub_efiemu_system_table32 = 0;
|
||||
|
@ -327,15 +328,15 @@ GRUB_MOD_INIT(efiemu)
|
|||
{
|
||||
cmd_loadcore = grub_register_command ("efiemu_loadcore",
|
||||
grub_cmd_efiemu_load,
|
||||
"FILE",
|
||||
"Load and initialize EFI emulator.");
|
||||
N_("FILE"),
|
||||
N_("Load and initialize EFI emulator."));
|
||||
cmd_prepare = grub_register_command ("efiemu_prepare",
|
||||
grub_cmd_efiemu_prepare,
|
||||
0,
|
||||
"Finalize loading of EFI emulator.");
|
||||
N_("Finalize loading of EFI emulator."));
|
||||
cmd_unload = grub_register_command ("efiemu_unload", grub_cmd_efiemu_unload,
|
||||
0,
|
||||
"Unload EFI emulator.");
|
||||
N_("Unload EFI emulator."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(efiemu)
|
||||
|
|
462
font/font.c
462
font/font.c
|
@ -91,25 +91,24 @@ struct font_file_section
|
|||
};
|
||||
|
||||
/* Replace unknown glyphs with a rounded question mark. */
|
||||
static grub_uint8_t unknown_glyph_bitmap[] =
|
||||
{
|
||||
/* 76543210 */
|
||||
0x7C, /* ooooo */
|
||||
0x82, /* o o */
|
||||
0xBA, /* o ooo o */
|
||||
0xAA, /* o o o o */
|
||||
0xAA, /* o o o o */
|
||||
0x8A, /* o o o */
|
||||
0x9A, /* o oo o */
|
||||
0x92, /* o o o */
|
||||
0x92, /* o o o */
|
||||
0x92, /* o o o */
|
||||
0x92, /* o o o */
|
||||
0x82, /* o o */
|
||||
0x92, /* o o o */
|
||||
0x82, /* o o */
|
||||
0x7C, /* ooooo */
|
||||
0x00 /* */
|
||||
static grub_uint8_t unknown_glyph_bitmap[] = {
|
||||
/* 76543210 */
|
||||
0x7C, /* ooooo */
|
||||
0x82, /* o o */
|
||||
0xBA, /* o ooo o */
|
||||
0xAA, /* o o o o */
|
||||
0xAA, /* o o o o */
|
||||
0x8A, /* o o o */
|
||||
0x9A, /* o oo o */
|
||||
0x92, /* o o o */
|
||||
0x92, /* o o o */
|
||||
0x92, /* o o o */
|
||||
0x92, /* o o o */
|
||||
0x82, /* o o */
|
||||
0x92, /* o o o */
|
||||
0x82, /* o o */
|
||||
0x7C, /* ooooo */
|
||||
0x00 /* */
|
||||
};
|
||||
|
||||
/* The "unknown glyph" glyph, used as a last resort. */
|
||||
|
@ -130,7 +129,7 @@ static struct grub_font_glyph *ascii_font_glyph[0x80];
|
|||
static struct grub_font_glyph *
|
||||
ascii_glyph_lookup (grub_uint32_t code)
|
||||
{
|
||||
#ifdef USE_ASCII_FAILBACK
|
||||
#ifdef USE_ASCII_FAILBACK
|
||||
static int ascii_failback_initialized = 0;
|
||||
|
||||
if (code >= 0x80)
|
||||
|
@ -140,14 +139,14 @@ ascii_glyph_lookup (grub_uint32_t code)
|
|||
{
|
||||
int current;
|
||||
for (current = 0; current < 0x80; current++)
|
||||
{
|
||||
ascii_font_glyph[current] = grub_malloc(sizeof(struct grub_font_glyph)
|
||||
+ ASCII_BITMAP_SIZE);
|
||||
{
|
||||
ascii_font_glyph[current] =
|
||||
grub_malloc (sizeof (struct grub_font_glyph) + ASCII_BITMAP_SIZE);
|
||||
|
||||
ascii_font_glyph[current]->width = 8;
|
||||
ascii_font_glyph[current]->height = 16;
|
||||
ascii_font_glyph[current]->offset_x = 0;
|
||||
ascii_font_glyph[current]->offset_y = -2;
|
||||
ascii_font_glyph[current]->width = 8;
|
||||
ascii_font_glyph[current]->height = 16;
|
||||
ascii_font_glyph[current]->offset_x = 0;
|
||||
ascii_font_glyph[current]->offset_y = -2;
|
||||
ascii_font_glyph[current]->device_width = 8;
|
||||
|
||||
grub_memcpy (ascii_font_glyph[current]->bitmap,
|
||||
|
@ -173,9 +172,9 @@ grub_font_loader_init (void)
|
|||
return;
|
||||
|
||||
/* Make glyph for unknown glyph. */
|
||||
unknown_glyph = grub_malloc(sizeof(struct grub_font_glyph)
|
||||
+ sizeof(unknown_glyph_bitmap));
|
||||
if (! unknown_glyph)
|
||||
unknown_glyph = grub_malloc (sizeof (struct grub_font_glyph)
|
||||
+ sizeof (unknown_glyph_bitmap));
|
||||
if (!unknown_glyph)
|
||||
return;
|
||||
|
||||
unknown_glyph->width = 8;
|
||||
|
@ -183,13 +182,13 @@ grub_font_loader_init (void)
|
|||
unknown_glyph->offset_x = 0;
|
||||
unknown_glyph->offset_y = -3;
|
||||
unknown_glyph->device_width = 8;
|
||||
grub_memcpy(unknown_glyph->bitmap,
|
||||
unknown_glyph_bitmap, sizeof(unknown_glyph_bitmap));
|
||||
grub_memcpy (unknown_glyph->bitmap,
|
||||
unknown_glyph_bitmap, sizeof (unknown_glyph_bitmap));
|
||||
|
||||
/* Initialize the null font. */
|
||||
font_init (&null_font);
|
||||
null_font.name = "<No Font>";
|
||||
null_font.ascent = unknown_glyph->height-3;
|
||||
null_font.ascent = unknown_glyph->height - 3;
|
||||
null_font.descent = 3;
|
||||
null_font.max_char_width = unknown_glyph->width;
|
||||
null_font.max_char_height = unknown_glyph->height;
|
||||
|
@ -247,7 +246,7 @@ open_section (grub_file_t file, struct font_file_section *section)
|
|||
else if (retval < 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FONT,
|
||||
"font format error: can't read section name");
|
||||
"font format error: can't read section name");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -262,7 +261,7 @@ open_section (grub_file_t file, struct font_file_section *section)
|
|||
else if (retval < 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FONT,
|
||||
"font format error: can't read section length");
|
||||
"font format error: can't read section length");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -283,22 +282,22 @@ open_section (grub_file_t file, struct font_file_section *section)
|
|||
grub_errno is set appropriately). */
|
||||
static int
|
||||
load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
|
||||
grub_font *font)
|
||||
grub_font *font)
|
||||
{
|
||||
unsigned i;
|
||||
grub_uint32_t last_code;
|
||||
|
||||
#if FONT_DEBUG >= 2
|
||||
grub_printf("load_font_index(sect_length=%d)\n", sect_length);
|
||||
grub_printf ("load_font_index(sect_length=%d)\n", sect_length);
|
||||
#endif
|
||||
|
||||
/* Sanity check: ensure section length is divisible by the entry size. */
|
||||
if ((sect_length % FONT_CHAR_INDEX_ENTRY_SIZE) != 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FONT,
|
||||
"font file format error: character index length %d "
|
||||
"is not a multiple of the entry size %d",
|
||||
sect_length, FONT_CHAR_INDEX_ENTRY_SIZE);
|
||||
"font file format error: character index length %d "
|
||||
"is not a multiple of the entry size %d",
|
||||
sect_length, FONT_CHAR_INDEX_ENTRY_SIZE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -307,11 +306,11 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
|
|||
|
||||
/* Allocate the character index array. */
|
||||
font->char_index = grub_malloc (font->num_chars
|
||||
* sizeof (struct char_index_entry));
|
||||
if (! font->char_index)
|
||||
* sizeof (struct char_index_entry));
|
||||
if (!font->char_index)
|
||||
return 1;
|
||||
font->bmp_idx = grub_malloc (0x10000 * sizeof (grub_uint16_t));
|
||||
if (! font->bmp_idx)
|
||||
if (!font->bmp_idx)
|
||||
{
|
||||
grub_free (font->char_index);
|
||||
return 1;
|
||||
|
@ -320,7 +319,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
|
|||
|
||||
|
||||
#if FONT_DEBUG >= 2
|
||||
grub_printf("num_chars=%d)\n", font->num_chars);
|
||||
grub_printf ("num_chars=%d)\n", font->num_chars);
|
||||
#endif
|
||||
|
||||
last_code = 0;
|
||||
|
@ -332,17 +331,17 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
|
|||
|
||||
/* Read code point value; convert to native byte order. */
|
||||
if (grub_file_read (file, &entry->code, 4) != 4)
|
||||
return 1;
|
||||
return 1;
|
||||
entry->code = grub_be_to_cpu32 (entry->code);
|
||||
|
||||
/* Verify that characters are in ascending order. */
|
||||
if (i != 0 && entry->code <= last_code)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FONT,
|
||||
"font characters not in ascending order: %u <= %u",
|
||||
entry->code, last_code);
|
||||
return 1;
|
||||
}
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FONT,
|
||||
"font characters not in ascending order: %u <= %u",
|
||||
entry->code, last_code);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (entry->code < 0x10000)
|
||||
font->bmp_idx[entry->code] = i;
|
||||
|
@ -351,11 +350,11 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
|
|||
|
||||
/* Read storage flags byte. */
|
||||
if (grub_file_read (file, &entry->storage_flags, 1) != 1)
|
||||
return 1;
|
||||
return 1;
|
||||
|
||||
/* Read glyph data offset; convert to native byte order. */
|
||||
if (grub_file_read (file, &entry->offset, 4) != 4)
|
||||
return 1;
|
||||
return 1;
|
||||
entry->offset = grub_be_to_cpu32 (entry->offset);
|
||||
|
||||
/* No glyph loaded. Will be loaded on demand and cached thereafter. */
|
||||
|
@ -364,7 +363,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
|
|||
#if FONT_DEBUG >= 5
|
||||
/* Print the 1st 10 characters. */
|
||||
if (i < 10)
|
||||
grub_printf("c=%d o=%d\n", entry->code, entry->offset);
|
||||
grub_printf ("c=%d o=%d\n", entry->code, entry->offset);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -380,7 +379,7 @@ read_section_as_string (struct font_file_section *section)
|
|||
grub_ssize_t ret;
|
||||
|
||||
str = grub_malloc (section->length + 1);
|
||||
if (! str)
|
||||
if (!str)
|
||||
return 0;
|
||||
|
||||
ret = grub_file_read (section->file, str, section->length);
|
||||
|
@ -398,18 +397,18 @@ read_section_as_string (struct font_file_section *section)
|
|||
which is stored into *VALUE.
|
||||
Returns 0 upon success, nonzero upon failure. */
|
||||
static int
|
||||
read_section_as_short (struct font_file_section *section, grub_int16_t *value)
|
||||
read_section_as_short (struct font_file_section *section,
|
||||
grub_int16_t * value)
|
||||
{
|
||||
grub_uint16_t raw_value;
|
||||
|
||||
if (section->length != 2)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FONT,
|
||||
"font file format error: section %c%c%c%c length "
|
||||
"is %d but should be 2",
|
||||
section->name[0], section->name[1],
|
||||
section->name[2], section->name[3],
|
||||
section->length);
|
||||
"font file format error: section %c%c%c%c length "
|
||||
"is %d but should be 2",
|
||||
section->name[0], section->name[1],
|
||||
section->name[2], section->name[3], section->length);
|
||||
return 1;
|
||||
}
|
||||
if (grub_file_read (section->file, &raw_value, 2) != 2)
|
||||
|
@ -430,7 +429,7 @@ grub_font_load (const char *filename)
|
|||
grub_font_t font = 0;
|
||||
|
||||
#if FONT_DEBUG >= 1
|
||||
grub_printf("add_font(%s)\n", filename);
|
||||
grub_printf ("add_font(%s)\n", filename);
|
||||
#endif
|
||||
|
||||
file = grub_buffile_open (filename, 1024);
|
||||
|
@ -438,7 +437,7 @@ grub_font_load (const char *filename)
|
|||
goto fail;
|
||||
|
||||
#if FONT_DEBUG >= 3
|
||||
grub_printf("file opened\n");
|
||||
grub_printf ("file opened\n");
|
||||
#endif
|
||||
|
||||
/* Read the FILE section. It indicates the file format. */
|
||||
|
@ -446,159 +445,166 @@ grub_font_load (const char *filename)
|
|||
goto fail;
|
||||
|
||||
#if FONT_DEBUG >= 3
|
||||
grub_printf("opened FILE section\n");
|
||||
grub_printf ("opened FILE section\n");
|
||||
#endif
|
||||
if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_FILE,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_FILE) - 1) != 0)
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_FILE) - 1) != 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FONT,
|
||||
"font file format error: 1st section must be FILE");
|
||||
"font file format error: 1st section must be FILE");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
#if FONT_DEBUG >= 3
|
||||
grub_printf("section name ok\n");
|
||||
grub_printf ("section name ok\n");
|
||||
#endif
|
||||
if (section.length != 4)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FONT,
|
||||
"font file format error (file type ID length is %d "
|
||||
"but should be 4)", section.length);
|
||||
"font file format error (file type ID length is %d "
|
||||
"but should be 4)", section.length);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
#if FONT_DEBUG >= 3
|
||||
grub_printf("section length ok\n");
|
||||
grub_printf ("section length ok\n");
|
||||
#endif
|
||||
/* Check the file format type code. */
|
||||
if (grub_file_read (file, magic, 4) != 4)
|
||||
goto fail;
|
||||
|
||||
#if FONT_DEBUG >= 3
|
||||
grub_printf("read magic ok\n");
|
||||
grub_printf ("read magic ok\n");
|
||||
#endif
|
||||
|
||||
if (grub_memcmp (magic, FONT_FORMAT_PFF2_MAGIC, 4) != 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FONT, "invalid font magic %x %x %x %x",
|
||||
magic[0], magic[1], magic[2], magic[3]);
|
||||
magic[0], magic[1], magic[2], magic[3]);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
#if FONT_DEBUG >= 3
|
||||
grub_printf("compare magic ok\n");
|
||||
grub_printf ("compare magic ok\n");
|
||||
#endif
|
||||
|
||||
/* Allocate the font object. */
|
||||
font = (grub_font_t) grub_malloc (sizeof (struct grub_font));
|
||||
if (! font)
|
||||
if (!font)
|
||||
goto fail;
|
||||
|
||||
font_init (font);
|
||||
font->file = file;
|
||||
|
||||
#if FONT_DEBUG >= 3
|
||||
grub_printf("allocate font ok; loading font info\n");
|
||||
grub_printf ("allocate font ok; loading font info\n");
|
||||
#endif
|
||||
|
||||
/* Load the font information. */
|
||||
while (1)
|
||||
{
|
||||
if (open_section (file, §ion) != 0)
|
||||
{
|
||||
if (section.eof)
|
||||
break; /* Done reading the font file. */
|
||||
else
|
||||
goto fail;
|
||||
}
|
||||
{
|
||||
if (section.eof)
|
||||
break; /* Done reading the font file. */
|
||||
else
|
||||
goto fail;
|
||||
}
|
||||
|
||||
#if FONT_DEBUG >= 2
|
||||
grub_printf("opened section %c%c%c%c ok\n",
|
||||
section.name[0], section.name[1],
|
||||
section.name[2], section.name[3]);
|
||||
grub_printf ("opened section %c%c%c%c ok\n",
|
||||
section.name[0], section.name[1],
|
||||
section.name[2], section.name[3]);
|
||||
#endif
|
||||
|
||||
if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_FONT_NAME,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_FONT_NAME) - 1) == 0)
|
||||
{
|
||||
font->name = read_section_as_string (§ion);
|
||||
if (!font->name)
|
||||
goto fail;
|
||||
}
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_FONT_NAME) - 1) == 0)
|
||||
{
|
||||
font->name = read_section_as_string (§ion);
|
||||
if (!font->name)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name,
|
||||
FONT_FORMAT_SECTION_NAMES_POINT_SIZE,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_POINT_SIZE) - 1) == 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->point_size) != 0)
|
||||
goto fail;
|
||||
}
|
||||
FONT_FORMAT_SECTION_NAMES_POINT_SIZE,
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_POINT_SIZE) -
|
||||
1) == 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->point_size) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_WEIGHT,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_WEIGHT) - 1) == 0)
|
||||
{
|
||||
char *wt;
|
||||
wt = read_section_as_string (§ion);
|
||||
if (!wt)
|
||||
continue;
|
||||
/* Convert the weight string 'normal' or 'bold' into a number. */
|
||||
if (grub_strcmp (wt, "normal") == 0)
|
||||
font->weight = FONT_WEIGHT_NORMAL;
|
||||
else if (grub_strcmp (wt, "bold") == 0)
|
||||
font->weight = FONT_WEIGHT_BOLD;
|
||||
grub_free (wt);
|
||||
}
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_WEIGHT) - 1)
|
||||
== 0)
|
||||
{
|
||||
char *wt;
|
||||
wt = read_section_as_string (§ion);
|
||||
if (!wt)
|
||||
continue;
|
||||
/* Convert the weight string 'normal' or 'bold' into a number. */
|
||||
if (grub_strcmp (wt, "normal") == 0)
|
||||
font->weight = FONT_WEIGHT_NORMAL;
|
||||
else if (grub_strcmp (wt, "bold") == 0)
|
||||
font->weight = FONT_WEIGHT_BOLD;
|
||||
grub_free (wt);
|
||||
}
|
||||
else if (grub_memcmp (section.name,
|
||||
FONT_FORMAT_SECTION_NAMES_MAX_CHAR_WIDTH,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_MAX_CHAR_WIDTH) - 1) == 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->max_char_width) != 0)
|
||||
goto fail;
|
||||
}
|
||||
FONT_FORMAT_SECTION_NAMES_MAX_CHAR_WIDTH,
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_MAX_CHAR_WIDTH)
|
||||
- 1) == 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->max_char_width) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name,
|
||||
FONT_FORMAT_SECTION_NAMES_MAX_CHAR_HEIGHT,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_MAX_CHAR_HEIGHT) - 1) == 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->max_char_height) != 0)
|
||||
goto fail;
|
||||
}
|
||||
FONT_FORMAT_SECTION_NAMES_MAX_CHAR_HEIGHT,
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_MAX_CHAR_HEIGHT)
|
||||
- 1) == 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->max_char_height) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name,
|
||||
FONT_FORMAT_SECTION_NAMES_ASCENT,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_ASCENT) - 1) == 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->ascent) != 0)
|
||||
goto fail;
|
||||
}
|
||||
FONT_FORMAT_SECTION_NAMES_ASCENT,
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_ASCENT) - 1)
|
||||
== 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->ascent) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_DESCENT,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_DESCENT) - 1) == 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->descent) != 0)
|
||||
goto fail;
|
||||
}
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_DESCENT) - 1)
|
||||
== 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->descent) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name,
|
||||
FONT_FORMAT_SECTION_NAMES_CHAR_INDEX,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_CHAR_INDEX) - 1) == 0)
|
||||
{
|
||||
if (load_font_index (file, section.length, font) != 0)
|
||||
goto fail;
|
||||
}
|
||||
FONT_FORMAT_SECTION_NAMES_CHAR_INDEX,
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_CHAR_INDEX) -
|
||||
1) == 0)
|
||||
{
|
||||
if (load_font_index (file, section.length, font) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_DATA,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_DATA) - 1) == 0)
|
||||
{
|
||||
/* When the DATA section marker is reached, we stop reading. */
|
||||
break;
|
||||
}
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_DATA) - 1) == 0)
|
||||
{
|
||||
/* When the DATA section marker is reached, we stop reading. */
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Unhandled section type, simply skip past it. */
|
||||
{
|
||||
/* Unhandled section type, simply skip past it. */
|
||||
#if FONT_DEBUG >= 3
|
||||
grub_printf("Unhandled section type, skipping.\n");
|
||||
grub_printf ("Unhandled section type, skipping.\n");
|
||||
#endif
|
||||
grub_off_t section_end = grub_file_tell (file) + section.length;
|
||||
if ((int) grub_file_seek (file, section_end) == -1)
|
||||
goto fail;
|
||||
}
|
||||
grub_off_t section_end = grub_file_tell (file) + section.length;
|
||||
if ((int) grub_file_seek (file, section_end) == -1)
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
if (! font->name)
|
||||
if (!font->name)
|
||||
{
|
||||
grub_printf ("Note: Font has no name.\n");
|
||||
font->name = grub_strdup ("Unknown");
|
||||
|
@ -606,22 +612,19 @@ grub_font_load (const char *filename)
|
|||
|
||||
#if FONT_DEBUG >= 1
|
||||
grub_printf ("Loaded font `%s'.\n"
|
||||
"Ascent=%d Descent=%d MaxW=%d MaxH=%d Number of characters=%d.\n",
|
||||
font->name,
|
||||
font->ascent, font->descent,
|
||||
font->max_char_width, font->max_char_height,
|
||||
font->num_chars);
|
||||
"Ascent=%d Descent=%d MaxW=%d MaxH=%d Number of characters=%d.\n",
|
||||
font->name,
|
||||
font->ascent, font->descent,
|
||||
font->max_char_width, font->max_char_height, font->num_chars);
|
||||
#endif
|
||||
|
||||
if (font->max_char_width == 0
|
||||
|| font->max_char_height == 0
|
||||
|| font->num_chars == 0
|
||||
|| font->char_index == 0
|
||||
|| font->ascent == 0
|
||||
|| font->descent == 0)
|
||||
|| font->char_index == 0 || font->ascent == 0 || font->descent == 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FONT,
|
||||
"invalid font file: missing some required data");
|
||||
"invalid font file: missing some required data");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -679,18 +682,18 @@ find_glyph (const grub_font_t font, grub_uint32_t code)
|
|||
lo = 0;
|
||||
hi = font->num_chars - 1;
|
||||
|
||||
if (! table)
|
||||
if (!table)
|
||||
return 0;
|
||||
|
||||
while (lo <= hi)
|
||||
{
|
||||
mid = lo + (hi - lo) / 2;
|
||||
if (code < table[mid].code)
|
||||
hi = mid - 1;
|
||||
hi = mid - 1;
|
||||
else if (code > table[mid].code)
|
||||
lo = mid + 1;
|
||||
lo = mid + 1;
|
||||
else
|
||||
return &table[mid];
|
||||
return &table[mid];
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -716,12 +719,12 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code)
|
|||
int len;
|
||||
|
||||
if (index_entry->glyph)
|
||||
/* Return cached glyph. */
|
||||
return index_entry->glyph;
|
||||
/* Return cached glyph. */
|
||||
return index_entry->glyph;
|
||||
|
||||
if (! font->file)
|
||||
/* No open file, can't load any glyphs. */
|
||||
return 0;
|
||||
if (!font->file)
|
||||
/* No open file, can't load any glyphs. */
|
||||
return 0;
|
||||
|
||||
/* Make sure we can find glyphs for error messages. Push active
|
||||
error message to error stack and reset error message. */
|
||||
|
@ -730,23 +733,23 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code)
|
|||
grub_file_seek (font->file, index_entry->offset);
|
||||
|
||||
/* Read the glyph width, height, and baseline. */
|
||||
if (read_be_uint16(font->file, &width) != 0
|
||||
|| read_be_uint16(font->file, &height) != 0
|
||||
|| read_be_int16(font->file, &xoff) != 0
|
||||
|| read_be_int16(font->file, &yoff) != 0
|
||||
|| read_be_int16(font->file, &dwidth) != 0)
|
||||
{
|
||||
remove_font (font);
|
||||
return 0;
|
||||
}
|
||||
if (read_be_uint16 (font->file, &width) != 0
|
||||
|| read_be_uint16 (font->file, &height) != 0
|
||||
|| read_be_int16 (font->file, &xoff) != 0
|
||||
|| read_be_int16 (font->file, &yoff) != 0
|
||||
|| read_be_int16 (font->file, &dwidth) != 0)
|
||||
{
|
||||
remove_font (font);
|
||||
return 0;
|
||||
}
|
||||
|
||||
len = (width * height + 7) / 8;
|
||||
glyph = grub_malloc (sizeof (struct grub_font_glyph) + len);
|
||||
if (! glyph)
|
||||
{
|
||||
remove_font (font);
|
||||
return 0;
|
||||
}
|
||||
if (!glyph)
|
||||
{
|
||||
remove_font (font);
|
||||
return 0;
|
||||
}
|
||||
|
||||
glyph->font = font;
|
||||
glyph->width = width;
|
||||
|
@ -757,13 +760,13 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code)
|
|||
|
||||
/* Don't try to read empty bitmaps (e.g., space characters). */
|
||||
if (len != 0)
|
||||
{
|
||||
if (grub_file_read (font->file, glyph->bitmap, len) != len)
|
||||
{
|
||||
remove_font (font);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
{
|
||||
if (grub_file_read (font->file, glyph->bitmap, len) != len)
|
||||
{
|
||||
remove_font (font);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Restore old error message. */
|
||||
grub_error_pop ();
|
||||
|
@ -787,7 +790,7 @@ free_font (grub_font_t font)
|
|||
if (font)
|
||||
{
|
||||
if (font->file)
|
||||
grub_file_close (font->file);
|
||||
grub_file_close (font->file);
|
||||
grub_free (font->name);
|
||||
grub_free (font->family);
|
||||
grub_free (font->char_index);
|
||||
|
@ -804,7 +807,7 @@ register_font (grub_font_t font)
|
|||
struct grub_font_node *node = 0;
|
||||
|
||||
node = grub_malloc (sizeof (struct grub_font_node));
|
||||
if (! node)
|
||||
if (!node)
|
||||
return 1;
|
||||
|
||||
node->value = font;
|
||||
|
@ -822,18 +825,17 @@ remove_font (grub_font_t font)
|
|||
struct grub_font_node **nextp, *cur;
|
||||
|
||||
for (nextp = &grub_font_list, cur = *nextp;
|
||||
cur;
|
||||
nextp = &cur->next, cur = cur->next)
|
||||
cur; nextp = &cur->next, cur = cur->next)
|
||||
{
|
||||
if (cur->value == font)
|
||||
{
|
||||
*nextp = cur->next;
|
||||
{
|
||||
*nextp = cur->next;
|
||||
|
||||
/* Free the node, but not the font itself. */
|
||||
grub_free (cur);
|
||||
/* Free the node, but not the font itself. */
|
||||
grub_free (cur);
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -850,7 +852,7 @@ grub_font_get (const char *font_name)
|
|||
{
|
||||
grub_font_t font = node->value;
|
||||
if (grub_strcmp (font->name, font_name) == 0)
|
||||
return font;
|
||||
return font;
|
||||
}
|
||||
|
||||
/* If no font by that name is found, return the first font in the list
|
||||
|
@ -927,7 +929,7 @@ grub_font_get_string_width (grub_font_t font, const char *str)
|
|||
const grub_uint8_t *ptr;
|
||||
|
||||
for (ptr = (const grub_uint8_t *) str, width = 0;
|
||||
grub_utf8_to_ucs4 (&code, 1, ptr, -1, &ptr) > 0; )
|
||||
grub_utf8_to_ucs4 (&code, 1, ptr, -1, &ptr) > 0;)
|
||||
{
|
||||
glyph = grub_font_get_glyph_with_fallback (font, code);
|
||||
width += glyph->device_width;
|
||||
|
@ -961,7 +963,7 @@ grub_font_get_glyph (grub_font_t font, grub_uint32_t code)
|
|||
sizes are used so that tiny 8 point glyphs are not mixed into a string
|
||||
of 24 point text unless there is no other choice. */
|
||||
static int
|
||||
get_font_diversity(grub_font_t a, grub_font_t b)
|
||||
get_font_diversity (grub_font_t a, grub_font_t b)
|
||||
{
|
||||
int d;
|
||||
|
||||
|
@ -1011,7 +1013,7 @@ grub_font_get_glyph_with_fallback (grub_font_t font, grub_uint32_t code)
|
|||
/* First try to get the glyph from the specified font. */
|
||||
glyph = grub_font_get_glyph_internal (font, code);
|
||||
if (glyph)
|
||||
return glyph;
|
||||
return glyph;
|
||||
}
|
||||
|
||||
/* Otherwise, search all loaded fonts for the glyph and use the one from
|
||||
|
@ -1028,16 +1030,16 @@ grub_font_get_glyph_with_fallback (grub_font_t font, grub_uint32_t code)
|
|||
|
||||
glyph = grub_font_get_glyph_internal (curfont, code);
|
||||
if (glyph)
|
||||
{
|
||||
int d;
|
||||
{
|
||||
int d;
|
||||
|
||||
d = get_font_diversity (curfont, font);
|
||||
if (d < best_diversity)
|
||||
{
|
||||
best_diversity = d;
|
||||
best_glyph = glyph;
|
||||
}
|
||||
}
|
||||
d = get_font_diversity (curfont, font);
|
||||
if (d < best_diversity)
|
||||
{
|
||||
best_diversity = d;
|
||||
best_glyph = glyph;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (best_glyph)
|
||||
|
@ -1052,9 +1054,8 @@ grub_font_get_glyph_with_fallback (grub_font_t font, grub_uint32_t code)
|
|||
baseline of the character, while the x coordinate designates the left
|
||||
side location of the character. */
|
||||
grub_err_t
|
||||
grub_font_draw_glyph (struct grub_font_glyph *glyph,
|
||||
grub_video_color_t color,
|
||||
int left_x, int baseline_y)
|
||||
grub_font_draw_glyph (struct grub_font_glyph * glyph,
|
||||
grub_video_color_t color, int left_x, int baseline_y)
|
||||
{
|
||||
struct grub_video_bitmap glyph_bitmap;
|
||||
|
||||
|
@ -1065,8 +1066,7 @@ grub_font_draw_glyph (struct grub_font_glyph *glyph,
|
|||
glyph_bitmap.mode_info.width = glyph->width;
|
||||
glyph_bitmap.mode_info.height = glyph->height;
|
||||
glyph_bitmap.mode_info.mode_type =
|
||||
(1 << GRUB_VIDEO_MODE_TYPE_DEPTH_POS)
|
||||
| GRUB_VIDEO_MODE_TYPE_1BIT_BITMAP;
|
||||
(1 << GRUB_VIDEO_MODE_TYPE_DEPTH_POS) | GRUB_VIDEO_MODE_TYPE_1BIT_BITMAP;
|
||||
glyph_bitmap.mode_info.blit_format = GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED;
|
||||
glyph_bitmap.mode_info.bpp = 1;
|
||||
|
||||
|
@ -1081,11 +1081,11 @@ grub_font_draw_glyph (struct grub_font_glyph *glyph,
|
|||
glyph_bitmap.mode_info.bg_green = 0;
|
||||
glyph_bitmap.mode_info.bg_blue = 0;
|
||||
glyph_bitmap.mode_info.bg_alpha = 0;
|
||||
grub_video_unmap_color(color,
|
||||
&glyph_bitmap.mode_info.fg_red,
|
||||
&glyph_bitmap.mode_info.fg_green,
|
||||
&glyph_bitmap.mode_info.fg_blue,
|
||||
&glyph_bitmap.mode_info.fg_alpha);
|
||||
grub_video_unmap_color (color,
|
||||
&glyph_bitmap.mode_info.fg_red,
|
||||
&glyph_bitmap.mode_info.fg_green,
|
||||
&glyph_bitmap.mode_info.fg_blue,
|
||||
&glyph_bitmap.mode_info.fg_alpha);
|
||||
glyph_bitmap.data = glyph->bitmap;
|
||||
|
||||
int bitmap_left = left_x + glyph->offset_x;
|
||||
|
@ -1093,9 +1093,8 @@ grub_font_draw_glyph (struct grub_font_glyph *glyph,
|
|||
int bitmap_top = bitmap_bottom - glyph->height;
|
||||
|
||||
return grub_video_blit_bitmap (&glyph_bitmap, GRUB_VIDEO_BLIT_BLEND,
|
||||
bitmap_left, bitmap_top,
|
||||
0, 0,
|
||||
glyph->width, glyph->height);
|
||||
bitmap_left, bitmap_top,
|
||||
0, 0, glyph->width, glyph->height);
|
||||
}
|
||||
|
||||
/* Draw a UTF-8 string of text on the current video render target.
|
||||
|
@ -1105,8 +1104,7 @@ grub_font_draw_glyph (struct grub_font_glyph *glyph,
|
|||
a glyph from another loaded font may be used instead. */
|
||||
grub_err_t
|
||||
grub_font_draw_string (const char *str, grub_font_t font,
|
||||
grub_video_color_t color,
|
||||
int left_x, int baseline_y)
|
||||
grub_video_color_t color, int left_x, int baseline_y)
|
||||
{
|
||||
int x;
|
||||
struct grub_font_glyph *glyph;
|
||||
|
@ -1114,15 +1112,13 @@ grub_font_draw_string (const char *str, grub_font_t font,
|
|||
const grub_uint8_t *ptr;
|
||||
|
||||
for (ptr = (const grub_uint8_t *) str, x = left_x;
|
||||
grub_utf8_to_ucs4 (&code, 1, ptr, -1, &ptr) > 0; )
|
||||
grub_utf8_to_ucs4 (&code, 1, ptr, -1, &ptr) > 0;)
|
||||
{
|
||||
glyph = grub_font_get_glyph_with_fallback (font, code);
|
||||
if (grub_font_draw_glyph (glyph, color, x, baseline_y)
|
||||
!= GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
if (grub_font_draw_glyph (glyph, color, x, baseline_y) != GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
x += glyph->device_width;
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
static grub_err_t
|
||||
loadfont_command (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
@ -62,11 +63,11 @@ GRUB_MOD_INIT(font)
|
|||
|
||||
cmd_loadfont =
|
||||
grub_register_command ("loadfont", loadfont_command,
|
||||
"FILE...",
|
||||
"Specify one or more font files to load.");
|
||||
N_("FILE..."),
|
||||
N_("Specify one or more font files to load."));
|
||||
cmd_lsfonts =
|
||||
grub_register_command ("lsfonts", lsfonts_command,
|
||||
0, "List the loaded fonts.");
|
||||
0, N_("List the loaded fonts."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(font)
|
||||
|
|
1133
fs/nilfs2.c
Normal file
1133
fs/nilfs2.c
Normal file
File diff suppressed because it is too large
Load diff
33
fs/udf.c
33
fs/udf.c
|
@ -25,6 +25,7 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/fshelp.h>
|
||||
#include <grub/charset.h>
|
||||
|
||||
#define GRUB_UDF_MAX_PDS 2
|
||||
#define GRUB_UDF_MAX_PMS 6
|
||||
|
@ -745,19 +746,41 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir,
|
|||
else
|
||||
{
|
||||
enum grub_fshelp_filetype type;
|
||||
char filename[dirent.file_ident_length + 1];
|
||||
grub_uint8_t raw[dirent.file_ident_length];
|
||||
grub_uint16_t utf16[dirent.file_ident_length - 1];
|
||||
grub_uint8_t filename[dirent.file_ident_length * 2];
|
||||
grub_size_t utf16len = 0;
|
||||
|
||||
type = ((dirent.characteristics & GRUB_UDF_FID_CHAR_DIRECTORY) ?
|
||||
(GRUB_FSHELP_DIR) : (GRUB_FSHELP_REG));
|
||||
|
||||
if ((grub_udf_read_file (dir, 0, offset,
|
||||
dirent.file_ident_length, filename))
|
||||
dirent.file_ident_length,
|
||||
(char *) raw))
|
||||
!= dirent.file_ident_length)
|
||||
return 0;
|
||||
|
||||
filename[dirent.file_ident_length] = 0;
|
||||
if (hook (&filename[1], type, child))
|
||||
return 1;
|
||||
if (raw[0] == 8)
|
||||
{
|
||||
unsigned i;
|
||||
utf16len = dirent.file_ident_length - 1;
|
||||
for (i = 0; i < utf16len; i++)
|
||||
utf16[i] = raw[i + 1];
|
||||
}
|
||||
if (raw[0] == 16)
|
||||
{
|
||||
unsigned i;
|
||||
utf16len = (dirent.file_ident_length - 1) / 2;
|
||||
for (i = 0; i < utf16len; i++)
|
||||
utf16[i] = (raw[2 * i + 1] << 8) | raw[2*i + 2];
|
||||
}
|
||||
if (raw[0] == 8 || raw[0] == 16)
|
||||
{
|
||||
*grub_utf16_to_utf8 (filename, utf16, utf16len) = '\0';
|
||||
|
||||
if (hook ((char *) filename, type, child))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Align to dword boundary. */
|
||||
|
|
34
genmk.rb
34
genmk.rb
|
@ -143,7 +143,7 @@ mostlyclean-module-#{@name}.#{@rule_count}:
|
|||
MOSTLYCLEAN_MODULE_TARGETS += mostlyclean-module-#{@name}.#{@rule_count}
|
||||
UNDSYMFILES += #{undsym}
|
||||
|
||||
ifeq ($(TARGET_NO_DYNAMIC_MODULES), yes)
|
||||
ifeq ($(TARGET_NO_MODULES), yes)
|
||||
#{@name}: #{pre_obj} $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj}
|
||||
|
@ -322,28 +322,32 @@ class Program
|
|||
end
|
||||
attr_reader :dir, :name
|
||||
|
||||
def print_tail()
|
||||
prefix = @name.to_var
|
||||
print "CLEANFILES += #{@name} $(#{prefix}_OBJECTS)
|
||||
ifeq ($(#{prefix}_RELOCATABLE),yes)
|
||||
#{@name}: $(#{prefix}_DEPENDENCIES) $(#{prefix}_OBJECTS)
|
||||
$(TARGET_CC) -Wl,-r,-d -o $@ $(#{prefix}_OBJECTS) $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
|
||||
if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) --strip-unneeded -K start -R .note -R .comment $@; fi
|
||||
else
|
||||
#{@name}: $(#{prefix}_DEPENDENCIES) $(#{prefix}_OBJECTS)
|
||||
$(TARGET_CC) -o $@ $(#{prefix}_OBJECTS) $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
|
||||
if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) -R .rel.dyn -R .reginfo -R .note -R .comment $@; fi
|
||||
endif
|
||||
|
||||
"
|
||||
end
|
||||
|
||||
def rule(sources)
|
||||
prefix = @name.to_var
|
||||
objs = sources.collect do |src|
|
||||
raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
|
||||
prefix + '-' + src.to_obj
|
||||
end
|
||||
objs_str = objs.join(' ');
|
||||
deps = objs.collect {|obj| obj.suffix('d')}
|
||||
deps_str = deps.join(' ');
|
||||
|
||||
"CLEANFILES += #{@name} #{objs_str}
|
||||
MOSTLYCLEANFILES += #{deps_str}
|
||||
|
||||
ifeq ($(#{prefix}_RELOCATABLE),yes)
|
||||
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
||||
$(TARGET_CC) -Wl,-r,-d -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
|
||||
if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) --strip-unneeded -K start -R .note -R .comment $@; fi
|
||||
else
|
||||
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
||||
$(TARGET_CC) -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
|
||||
if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) -R .rel.dyn -R .reginfo -R .note -R .comment $@; fi
|
||||
endif
|
||||
"MOSTLYCLEANFILES += #{deps_str}
|
||||
|
||||
" + objs.collect_with_index do |obj, i|
|
||||
src = sources[i]
|
||||
|
@ -358,6 +362,7 @@ endif
|
|||
|
||||
-include #{dep}
|
||||
|
||||
#{prefix}_OBJECTS += #{obj}
|
||||
"
|
||||
end.join('')
|
||||
end
|
||||
|
@ -466,4 +471,5 @@ while l = gets
|
|||
|
||||
end
|
||||
utils.each {|util| util.print_tail()}
|
||||
programs.each {|program| program.print_tail()}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ static void
|
|||
circprog_destroy (void *vself)
|
||||
{
|
||||
circular_progress_t self = vself;
|
||||
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
|
||||
grub_free (self);
|
||||
}
|
||||
|
||||
|
@ -211,6 +212,17 @@ circprog_get_bounds (void *vself, grub_video_rect_t *bounds)
|
|||
*bounds = self->bounds;
|
||||
}
|
||||
|
||||
static void
|
||||
circprog_set_state (void *vself, int visible, int start,
|
||||
int current, int end)
|
||||
{
|
||||
circular_progress_t self = vself;
|
||||
self->visible = visible;
|
||||
self->start = start;
|
||||
self->value = current;
|
||||
self->end = end;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
circprog_set_property (void *vself, const char *name, const char *value)
|
||||
{
|
||||
|
@ -247,26 +259,20 @@ circprog_set_property (void *vself, const char *name, const char *value)
|
|||
}
|
||||
else if (grub_strcmp (name, "id") == 0)
|
||||
{
|
||||
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
|
||||
grub_free (self->id);
|
||||
if (value)
|
||||
self->id = grub_strdup (value);
|
||||
else
|
||||
self->id = 0;
|
||||
if (self->id && grub_strcmp (self->id, GRUB_GFXMENU_TIMEOUT_COMPONENT_ID)
|
||||
== 0)
|
||||
grub_gfxmenu_timeout_register ((grub_gui_component_t) self,
|
||||
circprog_set_state);
|
||||
}
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
static void
|
||||
circprog_set_state (void *vself, int visible, int start,
|
||||
int current, int end)
|
||||
{
|
||||
circular_progress_t self = vself;
|
||||
self->visible = visible;
|
||||
self->start = start;
|
||||
self->value = current;
|
||||
self->end = end;
|
||||
}
|
||||
|
||||
static struct grub_gui_component_ops circprog_ops =
|
||||
{
|
||||
.destroy = circprog_destroy,
|
||||
|
|
|
@ -46,8 +46,10 @@ struct grub_gui_label
|
|||
char *id;
|
||||
int visible;
|
||||
char *text;
|
||||
char *template;
|
||||
grub_font_t font;
|
||||
grub_gui_color_t color;
|
||||
int value;
|
||||
enum align_mode align;
|
||||
};
|
||||
|
||||
|
@ -57,7 +59,9 @@ static void
|
|||
label_destroy (void *vself)
|
||||
{
|
||||
grub_gui_label_t self = vself;
|
||||
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
|
||||
grub_free (self->text);
|
||||
grub_free (self->template);
|
||||
grub_free (self);
|
||||
}
|
||||
|
||||
|
@ -146,6 +150,17 @@ label_get_minimal_size (void *vself, unsigned *width, unsigned *height)
|
|||
+ grub_font_get_descent (self->font));
|
||||
}
|
||||
|
||||
static void
|
||||
label_set_state (void *vself, int visible, int start __attribute__ ((unused)),
|
||||
int current, int end __attribute__ ((unused)))
|
||||
{
|
||||
grub_gui_label_t self = vself;
|
||||
self->value = -current;
|
||||
self->visible = visible;
|
||||
grub_free (self->text);
|
||||
self->text = grub_xasprintf (self->template ? : "%d", self->value);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
label_set_property (void *vself, const char *name, const char *value)
|
||||
{
|
||||
|
@ -153,9 +168,17 @@ label_set_property (void *vself, const char *name, const char *value)
|
|||
if (grub_strcmp (name, "text") == 0)
|
||||
{
|
||||
grub_free (self->text);
|
||||
grub_free (self->template);
|
||||
if (! value)
|
||||
value = "";
|
||||
self->text = grub_strdup (value);
|
||||
{
|
||||
self->template = NULL;
|
||||
self->text = grub_strdup ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
self->template = grub_strdup (value);
|
||||
self->text = grub_xasprintf (value, self->value);
|
||||
}
|
||||
}
|
||||
else if (grub_strcmp (name, "font") == 0)
|
||||
{
|
||||
|
@ -183,11 +206,16 @@ label_set_property (void *vself, const char *name, const char *value)
|
|||
}
|
||||
else if (grub_strcmp (name, "id") == 0)
|
||||
{
|
||||
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
|
||||
grub_free (self->id);
|
||||
if (value)
|
||||
self->id = grub_strdup (value);
|
||||
else
|
||||
self->id = 0;
|
||||
if (self->id && grub_strcmp (self->id, GRUB_GFXMENU_TIMEOUT_COMPONENT_ID)
|
||||
== 0)
|
||||
grub_gfxmenu_timeout_register ((grub_gui_component_t) self,
|
||||
label_set_state);
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ static void
|
|||
progress_bar_destroy (void *vself)
|
||||
{
|
||||
grub_gui_progress_bar_t self = vself;
|
||||
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
|
||||
grub_free (self);
|
||||
}
|
||||
|
||||
|
@ -333,11 +334,16 @@ progress_bar_set_property (void *vself, const char *name, const char *value)
|
|||
}
|
||||
else if (grub_strcmp (name, "id") == 0)
|
||||
{
|
||||
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
|
||||
grub_free (self->id);
|
||||
if (value)
|
||||
self->id = grub_strdup (value);
|
||||
else
|
||||
self->id = 0;
|
||||
/* if (self->id && grub_strcmp (self->id, GRUB_GFXMENU_TIMEOUT_COMPONENT_ID)
|
||||
== 0)*/
|
||||
grub_gfxmenu_timeout_register ((grub_gui_component_t) self,
|
||||
progress_bar_set_state);
|
||||
}
|
||||
return grub_errno;
|
||||
}
|
||||
|
@ -368,6 +374,7 @@ grub_gui_progress_bar_new (void)
|
|||
self = grub_zalloc (sizeof (*self));
|
||||
if (! self)
|
||||
return 0;
|
||||
|
||||
self->progress.ops = &progress_bar_pb_ops;
|
||||
self->progress.component.ops = &progress_bar_ops;
|
||||
self->visible = 1;
|
||||
|
|
|
@ -37,10 +37,6 @@
|
|||
#include <grub/gui_string_util.h>
|
||||
#include <grub/icon_manager.h>
|
||||
|
||||
/* The component ID identifying GUI components to be updated as the timeout
|
||||
status changes. */
|
||||
#define TIMEOUT_COMPONENT_ID "__timeout__"
|
||||
|
||||
static void
|
||||
init_terminal (grub_gfxmenu_view_t view);
|
||||
static grub_video_rect_t term_rect;
|
||||
|
@ -166,16 +162,28 @@ struct progress_value_data
|
|||
int value;
|
||||
};
|
||||
|
||||
static void
|
||||
update_timeout_visit (grub_gui_component_t component,
|
||||
void *userdata)
|
||||
{
|
||||
struct progress_value_data *pv;
|
||||
pv = (struct progress_value_data *) userdata;
|
||||
struct grub_gfxmenu_timeout_notify *grub_gfxmenu_timeout_notifications;
|
||||
|
||||
((struct grub_gui_progress *) component)->ops
|
||||
->set_state ((struct grub_gui_progress *) component,
|
||||
pv->visible, pv->start, pv->value, pv->end);
|
||||
static void
|
||||
update_timeouts (int visible, int start, int value, int end)
|
||||
{
|
||||
struct grub_gfxmenu_timeout_notify *cur;
|
||||
|
||||
for (cur = grub_gfxmenu_timeout_notifications; cur; cur = cur->next)
|
||||
cur->set_state (cur->self, visible, start, value, end);
|
||||
}
|
||||
|
||||
static void
|
||||
redraw_timeouts (struct grub_gfxmenu_view *view)
|
||||
{
|
||||
struct grub_gfxmenu_timeout_notify *cur;
|
||||
|
||||
for (cur = grub_gfxmenu_timeout_notifications; cur; cur = cur->next)
|
||||
{
|
||||
grub_video_rect_t bounds;
|
||||
cur->self->ops->get_bounds (cur->self, &bounds);
|
||||
grub_gfxmenu_view_redraw (view, &bounds);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -183,67 +191,26 @@ grub_gfxmenu_print_timeout (int timeout, void *data)
|
|||
{
|
||||
struct grub_gfxmenu_view *view = data;
|
||||
|
||||
struct progress_value_data pv;
|
||||
|
||||
auto void redraw_timeout_visit (grub_gui_component_t component,
|
||||
void *userdata __attribute__ ((unused)));
|
||||
|
||||
auto void redraw_timeout_visit (grub_gui_component_t component,
|
||||
void *userdata __attribute__ ((unused)))
|
||||
{
|
||||
grub_video_rect_t bounds;
|
||||
component->ops->get_bounds (component, &bounds);
|
||||
grub_gfxmenu_view_redraw (view, &bounds);
|
||||
}
|
||||
|
||||
if (view->first_timeout == -1)
|
||||
view->first_timeout = timeout;
|
||||
|
||||
pv.visible = 1;
|
||||
pv.start = -(view->first_timeout + 1);
|
||||
pv.end = 0;
|
||||
pv.value = -timeout;
|
||||
|
||||
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
|
||||
TIMEOUT_COMPONENT_ID, update_timeout_visit, &pv);
|
||||
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
|
||||
TIMEOUT_COMPONENT_ID, redraw_timeout_visit, &pv);
|
||||
update_timeouts (1, -(view->first_timeout + 1), -timeout, 0);
|
||||
redraw_timeouts (view);
|
||||
grub_video_swap_buffers ();
|
||||
if (view->double_repaint)
|
||||
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
|
||||
TIMEOUT_COMPONENT_ID, redraw_timeout_visit, &pv);
|
||||
redraw_timeouts (view);
|
||||
}
|
||||
|
||||
void
|
||||
grub_gfxmenu_clear_timeout (void *data)
|
||||
{
|
||||
struct progress_value_data pv;
|
||||
struct grub_gfxmenu_view *view = data;
|
||||
|
||||
auto void redraw_timeout_visit (grub_gui_component_t component,
|
||||
void *userdata __attribute__ ((unused)));
|
||||
|
||||
auto void redraw_timeout_visit (grub_gui_component_t component,
|
||||
void *userdata __attribute__ ((unused)))
|
||||
{
|
||||
grub_video_rect_t bounds;
|
||||
component->ops->get_bounds (component, &bounds);
|
||||
grub_gfxmenu_view_redraw (view, &bounds);
|
||||
}
|
||||
|
||||
pv.visible = 0;
|
||||
pv.start = 1;
|
||||
pv.end = 0;
|
||||
pv.value = 0;
|
||||
|
||||
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
|
||||
TIMEOUT_COMPONENT_ID, update_timeout_visit, &pv);
|
||||
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
|
||||
TIMEOUT_COMPONENT_ID, redraw_timeout_visit, &pv);
|
||||
update_timeouts (0, 1, 0, 0);
|
||||
redraw_timeouts (view);
|
||||
grub_video_swap_buffers ();
|
||||
if (view->double_repaint)
|
||||
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
|
||||
TIMEOUT_COMPONENT_ID, redraw_timeout_visit, &pv);
|
||||
redraw_timeouts (view);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
3877
gnulib/regcomp.c
Normal file
3877
gnulib/regcomp.c
Normal file
File diff suppressed because it is too large
Load diff
72
gnulib/regex.c
Normal file
72
gnulib/regex.c
Normal file
|
@ -0,0 +1,72 @@
|
|||
/* Extended regular expression matching and search library.
|
||||
Copyright (C) 2002, 2003, 2005, 2006, 2009, 2010 Free Software Foundation,
|
||||
Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Make sure noone compiles this code with a C++ compiler. */
|
||||
#if defined __cplusplus && defined _LIBC
|
||||
# error "This is C code, use a C compiler"
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
/* We have to keep the namespace clean. */
|
||||
# define regfree(preg) __regfree (preg)
|
||||
# define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef)
|
||||
# define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
|
||||
# define regerror(errcode, preg, errbuf, errbuf_size) \
|
||||
__regerror(errcode, preg, errbuf, errbuf_size)
|
||||
# define re_set_registers(bu, re, nu, st, en) \
|
||||
__re_set_registers (bu, re, nu, st, en)
|
||||
# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
|
||||
__re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
|
||||
# define re_match(bufp, string, size, pos, regs) \
|
||||
__re_match (bufp, string, size, pos, regs)
|
||||
# define re_search(bufp, string, size, startpos, range, regs) \
|
||||
__re_search (bufp, string, size, startpos, range, regs)
|
||||
# define re_compile_pattern(pattern, length, bufp) \
|
||||
__re_compile_pattern (pattern, length, bufp)
|
||||
# define re_set_syntax(syntax) __re_set_syntax (syntax)
|
||||
# define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \
|
||||
__re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
|
||||
# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
|
||||
|
||||
# include "../locale/localeinfo.h"
|
||||
#endif
|
||||
|
||||
/* On some systems, limits.h sets RE_DUP_MAX to a lower value than
|
||||
GNU regex allows. Include it before <regex.h>, which correctly
|
||||
#undefs RE_DUP_MAX and sets it to the right value. */
|
||||
#include <limits.h>
|
||||
|
||||
#include <regex.h>
|
||||
#include "regex_internal.h"
|
||||
|
||||
#include "regex_internal.c"
|
||||
#include "regcomp.c"
|
||||
#include "regexec.c"
|
||||
|
||||
/* Binary backward compatibility. */
|
||||
#if _LIBC
|
||||
# include <shlib-compat.h>
|
||||
# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
|
||||
link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.")
|
||||
int re_max_failures = 2000;
|
||||
# endif
|
||||
#endif
|
676
gnulib/regex.h
Normal file
676
gnulib/regex.h
Normal file
|
@ -0,0 +1,676 @@
|
|||
/* Definitions for data structures and routines for the regular
|
||||
expression library.
|
||||
Copyright (C) 1985, 1989, 1990, 1991, 1992, 1993, 1995, 1996, 1997, 1998,
|
||||
2000, 2001, 2002, 2003, 2005, 2006, 2009, 2010 Free Software Foundation,
|
||||
Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _REGEX_H
|
||||
#define _REGEX_H 1
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Allow the use in C++ code. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Define __USE_GNU_REGEX to declare GNU extensions that violate the
|
||||
POSIX name space rules. */
|
||||
#undef __USE_GNU_REGEX
|
||||
#if (defined _GNU_SOURCE \
|
||||
|| (!defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE \
|
||||
&& !defined _XOPEN_SOURCE))
|
||||
# define __USE_GNU_REGEX 1
|
||||
#endif
|
||||
|
||||
#ifdef _REGEX_LARGE_OFFSETS
|
||||
|
||||
/* Use types and values that are wide enough to represent signed and
|
||||
unsigned byte offsets in memory. This currently works only when
|
||||
the regex code is used outside of the GNU C library; it is not yet
|
||||
supported within glibc itself, and glibc users should not define
|
||||
_REGEX_LARGE_OFFSETS. */
|
||||
|
||||
/* The type of the offset of a byte within a string.
|
||||
For historical reasons POSIX 1003.1-2004 requires that regoff_t be
|
||||
at least as wide as off_t. However, many common POSIX platforms set
|
||||
regoff_t to the more-sensible ssize_t and the Open Group has
|
||||
signalled its intention to change the requirement to be that
|
||||
regoff_t be at least as wide as ptrdiff_t and ssize_t; see XBD ERN
|
||||
60 (2005-08-25). We don't know of any hosts where ssize_t or
|
||||
ptrdiff_t is wider than ssize_t, so ssize_t is safe. */
|
||||
typedef ssize_t regoff_t;
|
||||
|
||||
/* The type of nonnegative object indexes. Traditionally, GNU regex
|
||||
uses 'int' for these. Code that uses __re_idx_t should work
|
||||
regardless of whether the type is signed. */
|
||||
typedef size_t __re_idx_t;
|
||||
|
||||
/* The type of object sizes. */
|
||||
typedef size_t __re_size_t;
|
||||
|
||||
/* The type of object sizes, in places where the traditional code
|
||||
uses unsigned long int. */
|
||||
typedef size_t __re_long_size_t;
|
||||
|
||||
#else
|
||||
|
||||
/* Use types that are binary-compatible with the traditional GNU regex
|
||||
implementation, which mishandles strings longer than INT_MAX. */
|
||||
|
||||
typedef int regoff_t;
|
||||
typedef int __re_idx_t;
|
||||
typedef unsigned int __re_size_t;
|
||||
typedef unsigned long int __re_long_size_t;
|
||||
|
||||
#endif
|
||||
|
||||
/* The following two types have to be signed and unsigned integer type
|
||||
wide enough to hold a value of a pointer. For most ANSI compilers
|
||||
ptrdiff_t and size_t should be likely OK. Still size of these two
|
||||
types is 2 for Microsoft C. Ugh... */
|
||||
typedef long int s_reg_t;
|
||||
typedef unsigned long int active_reg_t;
|
||||
|
||||
/* The following bits are used to determine the regexp syntax we
|
||||
recognize. The set/not-set meanings are chosen so that Emacs syntax
|
||||
remains the value 0. The bits are given in alphabetical order, and
|
||||
the definitions shifted by one from the previous bit; thus, when we
|
||||
add or remove a bit, only one other definition need change. */
|
||||
typedef unsigned long int reg_syntax_t;
|
||||
|
||||
#ifdef __USE_GNU_REGEX
|
||||
|
||||
/* If this bit is not set, then \ inside a bracket expression is literal.
|
||||
If set, then such a \ quotes the following character. */
|
||||
# define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
|
||||
|
||||
/* If this bit is not set, then + and ? are operators, and \+ and \? are
|
||||
literals.
|
||||
If set, then \+ and \? are operators and + and ? are literals. */
|
||||
# define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
|
||||
|
||||
/* If this bit is set, then character classes are supported. They are:
|
||||
[:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
|
||||
[:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
|
||||
If not set, then character classes are not supported. */
|
||||
# define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
|
||||
|
||||
/* If this bit is set, then ^ and $ are always anchors (outside bracket
|
||||
expressions, of course).
|
||||
If this bit is not set, then it depends:
|
||||
^ is an anchor if it is at the beginning of a regular
|
||||
expression or after an open-group or an alternation operator;
|
||||
$ is an anchor if it is at the end of a regular expression, or
|
||||
before a close-group or an alternation operator.
|
||||
|
||||
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
|
||||
POSIX draft 11.2 says that * etc. in leading positions is undefined.
|
||||
We already implemented a previous draft which made those constructs
|
||||
invalid, though, so we haven't changed the code back. */
|
||||
# define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
|
||||
|
||||
/* If this bit is set, then special characters are always special
|
||||
regardless of where they are in the pattern.
|
||||
If this bit is not set, then special characters are special only in
|
||||
some contexts; otherwise they are ordinary. Specifically,
|
||||
* + ? and intervals are only special when not after the beginning,
|
||||
open-group, or alternation operator. */
|
||||
# define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
|
||||
|
||||
/* If this bit is set, then *, +, ?, and { cannot be first in an re or
|
||||
immediately after an alternation or begin-group operator. */
|
||||
# define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
|
||||
|
||||
/* If this bit is set, then . matches newline.
|
||||
If not set, then it doesn't. */
|
||||
# define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
|
||||
|
||||
/* If this bit is set, then . doesn't match NUL.
|
||||
If not set, then it does. */
|
||||
# define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
|
||||
|
||||
/* If this bit is set, nonmatching lists [^...] do not match newline.
|
||||
If not set, they do. */
|
||||
# define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
|
||||
|
||||
/* If this bit is set, either \{...\} or {...} defines an
|
||||
interval, depending on RE_NO_BK_BRACES.
|
||||
If not set, \{, \}, {, and } are literals. */
|
||||
# define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
|
||||
|
||||
/* If this bit is set, +, ? and | aren't recognized as operators.
|
||||
If not set, they are. */
|
||||
# define RE_LIMITED_OPS (RE_INTERVALS << 1)
|
||||
|
||||
/* If this bit is set, newline is an alternation operator.
|
||||
If not set, newline is literal. */
|
||||
# define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
|
||||
|
||||
/* If this bit is set, then `{...}' defines an interval, and \{ and \}
|
||||
are literals.
|
||||
If not set, then `\{...\}' defines an interval. */
|
||||
# define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
|
||||
|
||||
/* If this bit is set, (...) defines a group, and \( and \) are literals.
|
||||
If not set, \(...\) defines a group, and ( and ) are literals. */
|
||||
# define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
|
||||
|
||||
/* If this bit is set, then \<digit> matches <digit>.
|
||||
If not set, then \<digit> is a back-reference. */
|
||||
# define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
|
||||
|
||||
/* If this bit is set, then | is an alternation operator, and \| is literal.
|
||||
If not set, then \| is an alternation operator, and | is literal. */
|
||||
# define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
|
||||
|
||||
/* If this bit is set, then an ending range point collating higher
|
||||
than the starting range point, as in [z-a], is invalid.
|
||||
If not set, then when ending range point collates higher than the
|
||||
starting range point, the range is ignored. */
|
||||
# define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
|
||||
|
||||
/* If this bit is set, then an unmatched ) is ordinary.
|
||||
If not set, then an unmatched ) is invalid. */
|
||||
# define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
|
||||
|
||||
/* If this bit is set, succeed as soon as we match the whole pattern,
|
||||
without further backtracking. */
|
||||
# define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
|
||||
|
||||
/* If this bit is set, do not process the GNU regex operators.
|
||||
If not set, then the GNU regex operators are recognized. */
|
||||
# define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
|
||||
|
||||
/* If this bit is set, turn on internal regex debugging.
|
||||
If not set, and debugging was on, turn it off.
|
||||
This only works if regex.c is compiled -DDEBUG.
|
||||
We define this bit always, so that all that's needed to turn on
|
||||
debugging is to recompile regex.c; the calling code can always have
|
||||
this bit set, and it won't affect anything in the normal case. */
|
||||
# define RE_DEBUG (RE_NO_GNU_OPS << 1)
|
||||
|
||||
/* If this bit is set, a syntactically invalid interval is treated as
|
||||
a string of ordinary characters. For example, the ERE 'a{1' is
|
||||
treated as 'a\{1'. */
|
||||
# define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
|
||||
|
||||
/* If this bit is set, then ignore case when matching.
|
||||
If not set, then case is significant. */
|
||||
# define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
|
||||
|
||||
/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only
|
||||
for ^, because it is difficult to scan the regex backwards to find
|
||||
whether ^ should be special. */
|
||||
# define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
|
||||
|
||||
/* If this bit is set, then \{ cannot be first in an bre or
|
||||
immediately after an alternation or begin-group operator. */
|
||||
# define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)
|
||||
|
||||
/* If this bit is set, then no_sub will be set to 1 during
|
||||
re_compile_pattern. */
|
||||
# define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
|
||||
|
||||
#endif /* defined __USE_GNU_REGEX */
|
||||
|
||||
/* This global variable defines the particular regexp syntax to use (for
|
||||
some interfaces). When a regexp is compiled, the syntax used is
|
||||
stored in the pattern buffer, so changing this does not affect
|
||||
already-compiled regexps. */
|
||||
extern reg_syntax_t re_syntax_options;
|
||||
|
||||
#ifdef __USE_GNU_REGEX
|
||||
/* Define combinations of the above bits for the standard possibilities.
|
||||
(The [[[ comments delimit what gets put into the Texinfo file, so
|
||||
don't delete them!) */
|
||||
/* [[[begin syntaxes]]] */
|
||||
# define RE_SYNTAX_EMACS 0
|
||||
|
||||
# define RE_SYNTAX_AWK \
|
||||
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
|
||||
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
|
||||
| RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
|
||||
|
||||
# define RE_SYNTAX_GNU_AWK \
|
||||
((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \
|
||||
& ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS \
|
||||
| RE_CONTEXT_INVALID_OPS ))
|
||||
|
||||
# define RE_SYNTAX_POSIX_AWK \
|
||||
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
|
||||
| RE_INTERVALS | RE_NO_GNU_OPS)
|
||||
|
||||
# define RE_SYNTAX_GREP \
|
||||
(RE_BK_PLUS_QM | RE_CHAR_CLASSES \
|
||||
| RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
|
||||
| RE_NEWLINE_ALT)
|
||||
|
||||
# define RE_SYNTAX_EGREP \
|
||||
(RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
|
||||
| RE_NEWLINE_ALT | RE_NO_BK_PARENS \
|
||||
| RE_NO_BK_VBAR)
|
||||
|
||||
# define RE_SYNTAX_POSIX_EGREP \
|
||||
(RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES \
|
||||
| RE_INVALID_INTERVAL_ORD)
|
||||
|
||||
/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
|
||||
# define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
|
||||
|
||||
# define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
|
||||
|
||||
/* Syntax bits common to both basic and extended POSIX regex syntax. */
|
||||
# define _RE_SYNTAX_POSIX_COMMON \
|
||||
(RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
|
||||
| RE_INTERVALS | RE_NO_EMPTY_RANGES)
|
||||
|
||||
# define RE_SYNTAX_POSIX_BASIC \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP)
|
||||
|
||||
/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
|
||||
RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
|
||||
isn't minimal, since other operators, such as \`, aren't disabled. */
|
||||
# define RE_SYNTAX_POSIX_MINIMAL_BASIC \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
|
||||
|
||||
# define RE_SYNTAX_POSIX_EXTENDED \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_VBAR \
|
||||
| RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||
|
||||
/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is
|
||||
removed and RE_NO_BK_REFS is added. */
|
||||
# define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
|
||||
| RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||
/* [[[end syntaxes]]] */
|
||||
|
||||
#endif /* defined __USE_GNU_REGEX */
|
||||
|
||||
#ifdef __USE_GNU_REGEX
|
||||
|
||||
/* Maximum number of duplicates an interval can allow. POSIX-conforming
|
||||
systems might define this in <limits.h>, but we want our
|
||||
value, so remove any previous define. */
|
||||
# ifdef RE_DUP_MAX
|
||||
# undef RE_DUP_MAX
|
||||
# endif
|
||||
|
||||
/* RE_DUP_MAX is 2**15 - 1 because an earlier implementation stored
|
||||
the counter as a 2-byte signed integer. This is no longer true, so
|
||||
RE_DUP_MAX could be increased to (INT_MAX / 10 - 1), or to
|
||||
((SIZE_MAX - 2) / 10 - 1) if _REGEX_LARGE_OFFSETS is defined.
|
||||
However, there would be a huge performance problem if someone
|
||||
actually used a pattern like a\{214748363\}, so RE_DUP_MAX retains
|
||||
its historical value. */
|
||||
# define RE_DUP_MAX (0x7fff)
|
||||
|
||||
#endif /* defined __USE_GNU_REGEX */
|
||||
|
||||
|
||||
/* POSIX `cflags' bits (i.e., information for `regcomp'). */
|
||||
|
||||
/* If this bit is set, then use extended regular expression syntax.
|
||||
If not set, then use basic regular expression syntax. */
|
||||
#define REG_EXTENDED 1
|
||||
|
||||
/* If this bit is set, then ignore case when matching.
|
||||
If not set, then case is significant. */
|
||||
#define REG_ICASE (1 << 1)
|
||||
|
||||
/* If this bit is set, then anchors do not match at newline
|
||||
characters in the string.
|
||||
If not set, then anchors do match at newlines. */
|
||||
#define REG_NEWLINE (1 << 2)
|
||||
|
||||
/* If this bit is set, then report only success or fail in regexec.
|
||||
If not set, then returns differ between not matching and errors. */
|
||||
#define REG_NOSUB (1 << 3)
|
||||
|
||||
|
||||
/* POSIX `eflags' bits (i.e., information for regexec). */
|
||||
|
||||
/* If this bit is set, then the beginning-of-line operator doesn't match
|
||||
the beginning of the string (presumably because it's not the
|
||||
beginning of a line).
|
||||
If not set, then the beginning-of-line operator does match the
|
||||
beginning of the string. */
|
||||
#define REG_NOTBOL 1
|
||||
|
||||
/* Like REG_NOTBOL, except for the end-of-line. */
|
||||
#define REG_NOTEOL (1 << 1)
|
||||
|
||||
/* Use PMATCH[0] to delimit the start and end of the search in the
|
||||
buffer. */
|
||||
#define REG_STARTEND (1 << 2)
|
||||
|
||||
|
||||
/* If any error codes are removed, changed, or added, update the
|
||||
`__re_error_msgid' table in regcomp.c. */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
_REG_ENOSYS = -1, /* This will never happen for this implementation. */
|
||||
_REG_NOERROR = 0, /* Success. */
|
||||
_REG_NOMATCH, /* Didn't find a match (for regexec). */
|
||||
|
||||
/* POSIX regcomp return error codes. (In the order listed in the
|
||||
standard.) */
|
||||
_REG_BADPAT, /* Invalid pattern. */
|
||||
_REG_ECOLLATE, /* Invalid collating element. */
|
||||
_REG_ECTYPE, /* Invalid character class name. */
|
||||
_REG_EESCAPE, /* Trailing backslash. */
|
||||
_REG_ESUBREG, /* Invalid back reference. */
|
||||
_REG_EBRACK, /* Unmatched left bracket. */
|
||||
_REG_EPAREN, /* Parenthesis imbalance. */
|
||||
_REG_EBRACE, /* Unmatched \{. */
|
||||
_REG_BADBR, /* Invalid contents of \{\}. */
|
||||
_REG_ERANGE, /* Invalid range end. */
|
||||
_REG_ESPACE, /* Ran out of memory. */
|
||||
_REG_BADRPT, /* No preceding re for repetition op. */
|
||||
|
||||
/* Error codes we've added. */
|
||||
_REG_EEND, /* Premature end. */
|
||||
_REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
|
||||
_REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
|
||||
} reg_errcode_t;
|
||||
|
||||
#ifdef _XOPEN_SOURCE
|
||||
# define REG_ENOSYS _REG_ENOSYS
|
||||
#endif
|
||||
#define REG_NOERROR _REG_NOERROR
|
||||
#define REG_NOMATCH _REG_NOMATCH
|
||||
#define REG_BADPAT _REG_BADPAT
|
||||
#define REG_ECOLLATE _REG_ECOLLATE
|
||||
#define REG_ECTYPE _REG_ECTYPE
|
||||
#define REG_EESCAPE _REG_EESCAPE
|
||||
#define REG_ESUBREG _REG_ESUBREG
|
||||
#define REG_EBRACK _REG_EBRACK
|
||||
#define REG_EPAREN _REG_EPAREN
|
||||
#define REG_EBRACE _REG_EBRACE
|
||||
#define REG_BADBR _REG_BADBR
|
||||
#define REG_ERANGE _REG_ERANGE
|
||||
#define REG_ESPACE _REG_ESPACE
|
||||
#define REG_BADRPT _REG_BADRPT
|
||||
#define REG_EEND _REG_EEND
|
||||
#define REG_ESIZE _REG_ESIZE
|
||||
#define REG_ERPAREN _REG_ERPAREN
|
||||
|
||||
/* struct re_pattern_buffer normally uses member names like `buffer'
|
||||
that POSIX does not allow. In POSIX mode these members have names
|
||||
with leading `re_' (e.g., `re_buffer'). */
|
||||
#ifdef __USE_GNU_REGEX
|
||||
# define _REG_RE_NAME(id) id
|
||||
# define _REG_RM_NAME(id) id
|
||||
#else
|
||||
# define _REG_RE_NAME(id) re_##id
|
||||
# define _REG_RM_NAME(id) rm_##id
|
||||
#endif
|
||||
|
||||
/* The user can specify the type of the re_translate member by
|
||||
defining the macro RE_TRANSLATE_TYPE, which defaults to unsigned
|
||||
char *. This pollutes the POSIX name space, so in POSIX mode just
|
||||
use unsigned char *. */
|
||||
#ifdef __USE_GNU_REGEX
|
||||
# ifndef RE_TRANSLATE_TYPE
|
||||
# define RE_TRANSLATE_TYPE unsigned char *
|
||||
# endif
|
||||
# define REG_TRANSLATE_TYPE RE_TRANSLATE_TYPE
|
||||
#else
|
||||
# define REG_TRANSLATE_TYPE unsigned char *
|
||||
#endif
|
||||
|
||||
/* This data structure represents a compiled pattern. Before calling
|
||||
the pattern compiler, the fields `buffer', `allocated', `fastmap',
|
||||
`translate', and `no_sub' can be set. After the pattern has been
|
||||
compiled, the `re_nsub' field is available. All other fields are
|
||||
private to the regex routines. */
|
||||
|
||||
struct re_pattern_buffer
|
||||
{
|
||||
/* Space that holds the compiled pattern. It is declared as
|
||||
`unsigned char *' because its elements are sometimes used as
|
||||
array indexes. */
|
||||
unsigned char *_REG_RE_NAME (buffer);
|
||||
|
||||
/* Number of bytes to which `buffer' points. */
|
||||
__re_long_size_t _REG_RE_NAME (allocated);
|
||||
|
||||
/* Number of bytes actually used in `buffer'. */
|
||||
__re_long_size_t _REG_RE_NAME (used);
|
||||
|
||||
/* Syntax setting with which the pattern was compiled. */
|
||||
reg_syntax_t _REG_RE_NAME (syntax);
|
||||
|
||||
/* Pointer to a fastmap, if any, otherwise zero. re_search uses the
|
||||
fastmap, if there is one, to skip over impossible starting points
|
||||
for matches. */
|
||||
char *_REG_RE_NAME (fastmap);
|
||||
|
||||
/* Either a translate table to apply to all characters before
|
||||
comparing them, or zero for no translation. The translation is
|
||||
applied to a pattern when it is compiled and to a string when it
|
||||
is matched. */
|
||||
REG_TRANSLATE_TYPE _REG_RE_NAME (translate);
|
||||
|
||||
/* Number of subexpressions found by the compiler. */
|
||||
size_t re_nsub;
|
||||
|
||||
/* Zero if this pattern cannot match the empty string, one else.
|
||||
Well, in truth it's used only in `re_search_2', to see whether or
|
||||
not we should use the fastmap, so we don't set this absolutely
|
||||
perfectly; see `re_compile_fastmap' (the `duplicate' case). */
|
||||
unsigned int _REG_RE_NAME (can_be_null) : 1;
|
||||
|
||||
/* If REGS_UNALLOCATED, allocate space in the `regs' structure
|
||||
for `max (RE_NREGS, re_nsub + 1)' groups.
|
||||
If REGS_REALLOCATE, reallocate space if necessary.
|
||||
If REGS_FIXED, use what's there. */
|
||||
#ifdef __USE_GNU_REGEX
|
||||
# define REGS_UNALLOCATED 0
|
||||
# define REGS_REALLOCATE 1
|
||||
# define REGS_FIXED 2
|
||||
#endif
|
||||
unsigned int _REG_RE_NAME (regs_allocated) : 2;
|
||||
|
||||
/* Set to zero when `regex_compile' compiles a pattern; set to one
|
||||
by `re_compile_fastmap' if it updates the fastmap. */
|
||||
unsigned int _REG_RE_NAME (fastmap_accurate) : 1;
|
||||
|
||||
/* If set, `re_match_2' does not return information about
|
||||
subexpressions. */
|
||||
unsigned int _REG_RE_NAME (no_sub) : 1;
|
||||
|
||||
/* If set, a beginning-of-line anchor doesn't match at the beginning
|
||||
of the string. */
|
||||
unsigned int _REG_RE_NAME (not_bol) : 1;
|
||||
|
||||
/* Similarly for an end-of-line anchor. */
|
||||
unsigned int _REG_RE_NAME (not_eol) : 1;
|
||||
|
||||
/* If true, an anchor at a newline matches. */
|
||||
unsigned int _REG_RE_NAME (newline_anchor) : 1;
|
||||
|
||||
/* [[[end pattern_buffer]]] */
|
||||
};
|
||||
|
||||
typedef struct re_pattern_buffer regex_t;
|
||||
|
||||
/* This is the structure we store register match data in. See
|
||||
regex.texinfo for a full description of what registers match. */
|
||||
struct re_registers
|
||||
{
|
||||
__re_size_t _REG_RM_NAME (num_regs);
|
||||
regoff_t *_REG_RM_NAME (start);
|
||||
regoff_t *_REG_RM_NAME (end);
|
||||
};
|
||||
|
||||
|
||||
/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
|
||||
`re_match_2' returns information about at least this many registers
|
||||
the first time a `regs' structure is passed. */
|
||||
#if !defined RE_NREGS && defined __USE_GNU_REGEX
|
||||
# define RE_NREGS 30
|
||||
#endif
|
||||
|
||||
|
||||
/* POSIX specification for registers. Aside from the different names than
|
||||
`re_registers', POSIX uses an array of structures, instead of a
|
||||
structure of arrays. */
|
||||
typedef struct
|
||||
{
|
||||
regoff_t rm_so; /* Byte offset from string's start to substring's start. */
|
||||
regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
|
||||
} regmatch_t;
|
||||
|
||||
/* Declarations for routines. */
|
||||
|
||||
/* Sets the current default syntax to SYNTAX, and return the old syntax.
|
||||
You can also simply assign to the `re_syntax_options' variable. */
|
||||
extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
|
||||
|
||||
/* Compile the regular expression PATTERN, with length LENGTH
|
||||
and syntax given by the global `re_syntax_options', into the buffer
|
||||
BUFFER. Return NULL if successful, and an error string if not. */
|
||||
extern const char *re_compile_pattern (const char *__pattern, size_t __length,
|
||||
struct re_pattern_buffer *__buffer);
|
||||
|
||||
|
||||
/* Compile a fastmap for the compiled pattern in BUFFER; used to
|
||||
accelerate searches. Return 0 if successful and -2 if was an
|
||||
internal error. */
|
||||
extern int re_compile_fastmap (struct re_pattern_buffer *__buffer);
|
||||
|
||||
|
||||
/* Search in the string STRING (with length LENGTH) for the pattern
|
||||
compiled into BUFFER. Start searching at position START, for RANGE
|
||||
characters. Return the starting position of the match, -1 for no
|
||||
match, or -2 for an internal error. Also return register
|
||||
information in REGS (if REGS and BUFFER->no_sub are nonzero). */
|
||||
extern regoff_t re_search (struct re_pattern_buffer *__buffer,
|
||||
const char *__string, __re_idx_t __length,
|
||||
__re_idx_t __start, regoff_t __range,
|
||||
struct re_registers *__regs);
|
||||
|
||||
|
||||
/* Like `re_search', but search in the concatenation of STRING1 and
|
||||
STRING2. Also, stop searching at index START + STOP. */
|
||||
extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer,
|
||||
const char *__string1, __re_idx_t __length1,
|
||||
const char *__string2, __re_idx_t __length2,
|
||||
__re_idx_t __start, regoff_t __range,
|
||||
struct re_registers *__regs,
|
||||
__re_idx_t __stop);
|
||||
|
||||
|
||||
/* Like `re_search', but return how many characters in STRING the regexp
|
||||
in BUFFER matched, starting at position START. */
|
||||
extern regoff_t re_match (struct re_pattern_buffer *__buffer,
|
||||
const char *__string, __re_idx_t __length,
|
||||
__re_idx_t __start, struct re_registers *__regs);
|
||||
|
||||
|
||||
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
|
||||
extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer,
|
||||
const char *__string1, __re_idx_t __length1,
|
||||
const char *__string2, __re_idx_t __length2,
|
||||
__re_idx_t __start, struct re_registers *__regs,
|
||||
__re_idx_t __stop);
|
||||
|
||||
|
||||
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
|
||||
ENDS. Subsequent matches using BUFFER and REGS will use this memory
|
||||
for recording register information. STARTS and ENDS must be
|
||||
allocated with malloc, and must each be at least `NUM_REGS * sizeof
|
||||
(regoff_t)' bytes long.
|
||||
|
||||
If NUM_REGS == 0, then subsequent matches should allocate their own
|
||||
register data.
|
||||
|
||||
Unless this function is called, the first search or match using
|
||||
PATTERN_BUFFER will allocate its own register data, without
|
||||
freeing the old data. */
|
||||
extern void re_set_registers (struct re_pattern_buffer *__buffer,
|
||||
struct re_registers *__regs,
|
||||
__re_size_t __num_regs,
|
||||
regoff_t *__starts, regoff_t *__ends);
|
||||
|
||||
#if defined _REGEX_RE_COMP || defined _LIBC
|
||||
# ifndef _CRAY
|
||||
/* 4.2 bsd compatibility. */
|
||||
extern char *re_comp (const char *);
|
||||
extern int re_exec (const char *);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* GCC 2.95 and later have "__restrict"; C99 compilers have
|
||||
"restrict", and "configure" may have defined "restrict".
|
||||
Other compilers use __restrict, __restrict__, and _Restrict, and
|
||||
'configure' might #define 'restrict' to those words, so pick a
|
||||
different name. */
|
||||
#ifndef _Restrict_
|
||||
# if 199901L <= __STDC_VERSION__
|
||||
# define _Restrict_ restrict
|
||||
# elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
|
||||
# define _Restrict_ __restrict
|
||||
# else
|
||||
# define _Restrict_
|
||||
# endif
|
||||
#endif
|
||||
/* gcc 3.1 and up support the [restrict] syntax. Don't trust
|
||||
sys/cdefs.h's definition of __restrict_arr, though, as it
|
||||
mishandles gcc -ansi -pedantic. */
|
||||
#ifndef _Restrict_arr_
|
||||
# if ((199901L <= __STDC_VERSION__ \
|
||||
|| ((3 < __GNUC__ || (3 == __GNUC__ && 1 <= __GNUC_MINOR__)) \
|
||||
&& !__STRICT_ANSI__)) \
|
||||
&& !defined __GNUG__)
|
||||
# define _Restrict_arr_ _Restrict_
|
||||
# else
|
||||
# define _Restrict_arr_
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* POSIX compatibility. */
|
||||
extern int regcomp (regex_t *_Restrict_ __preg,
|
||||
const char *_Restrict_ __pattern,
|
||||
int __cflags);
|
||||
|
||||
extern int regexec (const regex_t *_Restrict_ __preg,
|
||||
const char *_Restrict_ __string, size_t __nmatch,
|
||||
regmatch_t __pmatch[_Restrict_arr_],
|
||||
int __eflags);
|
||||
|
||||
extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg,
|
||||
char *_Restrict_ __errbuf, size_t __errbuf_size);
|
||||
|
||||
extern void regfree (regex_t *__preg);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* C++ */
|
||||
|
||||
#endif /* regex.h */
|
1740
gnulib/regex_internal.c
Normal file
1740
gnulib/regex_internal.c
Normal file
File diff suppressed because it is too large
Load diff
871
gnulib/regex_internal.h
Normal file
871
gnulib/regex_internal.h
Normal file
|
@ -0,0 +1,871 @@
|
|||
/* Extended regular expression matching and search library.
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
|
||||
Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _REGEX_INTERNAL_H
|
||||
#define _REGEX_INTERNAL_H 1
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <langinfo.h>
|
||||
#ifndef _LIBC
|
||||
# include "localcharset.h"
|
||||
#endif
|
||||
#if defined HAVE_LOCALE_H || defined _LIBC
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
#include <wchar.h>
|
||||
#include <wctype.h>
|
||||
#include <stdint.h>
|
||||
#if defined _LIBC
|
||||
# include <bits/libc-lock.h>
|
||||
#else
|
||||
# define __libc_lock_init(NAME) do { } while (0)
|
||||
# define __libc_lock_lock(NAME) do { } while (0)
|
||||
# define __libc_lock_unlock(NAME) do { } while (0)
|
||||
#endif
|
||||
|
||||
/* In case that the system doesn't have isblank(). */
|
||||
#if !defined _LIBC && ! (defined isblank || (HAVE_ISBLANK && HAVE_DECL_ISBLANK))
|
||||
# define isblank(ch) ((ch) == ' ' || (ch) == '\t')
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# ifndef _RE_DEFINE_LOCALE_FUNCTIONS
|
||||
# define _RE_DEFINE_LOCALE_FUNCTIONS 1
|
||||
# include <locale/localeinfo.h>
|
||||
# include <locale/elem-hash.h>
|
||||
# include <locale/coll-lookup.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* This is for other GNU distributions with internationalized messages. */
|
||||
#if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
|
||||
# include <libintl.h>
|
||||
# ifdef _LIBC
|
||||
# undef gettext
|
||||
# define gettext(msgid) \
|
||||
INTUSE(__dcgettext) (_libc_intl_domainname, msgid, LC_MESSAGES)
|
||||
# endif
|
||||
#else
|
||||
# define gettext(msgid) (msgid)
|
||||
#endif
|
||||
|
||||
#ifndef gettext_noop
|
||||
/* This define is so xgettext can find the internationalizable
|
||||
strings. */
|
||||
# define gettext_noop(String) String
|
||||
#endif
|
||||
|
||||
/* For loser systems without the definition. */
|
||||
#ifndef SIZE_MAX
|
||||
# define SIZE_MAX ((size_t) -1)
|
||||
#endif
|
||||
|
||||
#if (defined MB_CUR_MAX && HAVE_LOCALE_H && HAVE_WCTYPE_H && HAVE_ISWCTYPE && HAVE_WCSCOLL) || _LIBC
|
||||
# define RE_ENABLE_I18N
|
||||
#endif
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
# define BE(expr, val) __builtin_expect (expr, val)
|
||||
#else
|
||||
# define BE(expr, val) (expr)
|
||||
# ifdef _LIBC
|
||||
# define inline
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Number of ASCII characters. */
|
||||
#define ASCII_CHARS 0x80
|
||||
|
||||
/* Number of single byte characters. */
|
||||
#define SBC_MAX (UCHAR_MAX + 1)
|
||||
|
||||
#define COLL_ELEM_LEN_MAX 8
|
||||
|
||||
/* The character which represents newline. */
|
||||
#define NEWLINE_CHAR '\n'
|
||||
#define WIDE_NEWLINE_CHAR L'\n'
|
||||
|
||||
/* Rename to standard API for using out of glibc. */
|
||||
#ifndef _LIBC
|
||||
# define __wctype wctype
|
||||
# define __iswctype iswctype
|
||||
# define __btowc btowc
|
||||
# define __wcrtomb wcrtomb
|
||||
# define __mbrtowc mbrtowc
|
||||
# define __regfree regfree
|
||||
# define attribute_hidden
|
||||
#endif /* not _LIBC */
|
||||
|
||||
#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
||||
# define __attribute(arg) __attribute__ (arg)
|
||||
#else
|
||||
# define __attribute(arg)
|
||||
#endif
|
||||
|
||||
typedef __re_idx_t Idx;
|
||||
|
||||
/* Special return value for failure to match. */
|
||||
#define REG_MISSING ((Idx) -1)
|
||||
|
||||
/* Special return value for internal error. */
|
||||
#define REG_ERROR ((Idx) -2)
|
||||
|
||||
/* Test whether N is a valid index, and is not one of the above. */
|
||||
#ifdef _REGEX_LARGE_OFFSETS
|
||||
# define REG_VALID_INDEX(n) ((Idx) (n) < REG_ERROR)
|
||||
#else
|
||||
# define REG_VALID_INDEX(n) (0 <= (n))
|
||||
#endif
|
||||
|
||||
/* Test whether N is a valid nonzero index. */
|
||||
#ifdef _REGEX_LARGE_OFFSETS
|
||||
# define REG_VALID_NONZERO_INDEX(n) ((Idx) ((n) - 1) < (Idx) (REG_ERROR - 1))
|
||||
#else
|
||||
# define REG_VALID_NONZERO_INDEX(n) (0 < (n))
|
||||
#endif
|
||||
|
||||
/* A hash value, suitable for computing hash tables. */
|
||||
typedef __re_size_t re_hashval_t;
|
||||
|
||||
/* An integer used to represent a set of bits. It must be unsigned,
|
||||
and must be at least as wide as unsigned int. */
|
||||
typedef unsigned long int bitset_word_t;
|
||||
/* All bits set in a bitset_word_t. */
|
||||
#define BITSET_WORD_MAX ULONG_MAX
|
||||
|
||||
/* Number of bits in a bitset_word_t. For portability to hosts with
|
||||
padding bits, do not use '(sizeof (bitset_word_t) * CHAR_BIT)';
|
||||
instead, deduce it directly from BITSET_WORD_MAX. Avoid
|
||||
greater-than-32-bit integers and unconditional shifts by more than
|
||||
31 bits, as they're not portable. */
|
||||
#if BITSET_WORD_MAX == 0xffffffffUL
|
||||
# define BITSET_WORD_BITS 32
|
||||
#elif BITSET_WORD_MAX >> 31 >> 4 == 1
|
||||
# define BITSET_WORD_BITS 36
|
||||
#elif BITSET_WORD_MAX >> 31 >> 16 == 1
|
||||
# define BITSET_WORD_BITS 48
|
||||
#elif BITSET_WORD_MAX >> 31 >> 28 == 1
|
||||
# define BITSET_WORD_BITS 60
|
||||
#elif BITSET_WORD_MAX >> 31 >> 31 >> 1 == 1
|
||||
# define BITSET_WORD_BITS 64
|
||||
#elif BITSET_WORD_MAX >> 31 >> 31 >> 9 == 1
|
||||
# define BITSET_WORD_BITS 72
|
||||
#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 3 == 1
|
||||
# define BITSET_WORD_BITS 128
|
||||
#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 7 == 1
|
||||
# define BITSET_WORD_BITS 256
|
||||
#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 7 > 1
|
||||
# define BITSET_WORD_BITS 257 /* any value > SBC_MAX will do here */
|
||||
# if BITSET_WORD_BITS <= SBC_MAX
|
||||
# error "Invalid SBC_MAX"
|
||||
# endif
|
||||
#else
|
||||
# error "Add case for new bitset_word_t size"
|
||||
#endif
|
||||
|
||||
/* Number of bitset_word_t values in a bitset_t. */
|
||||
#define BITSET_WORDS ((SBC_MAX + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS)
|
||||
|
||||
typedef bitset_word_t bitset_t[BITSET_WORDS];
|
||||
typedef bitset_word_t *re_bitset_ptr_t;
|
||||
typedef const bitset_word_t *re_const_bitset_ptr_t;
|
||||
|
||||
#define PREV_WORD_CONSTRAINT 0x0001
|
||||
#define PREV_NOTWORD_CONSTRAINT 0x0002
|
||||
#define NEXT_WORD_CONSTRAINT 0x0004
|
||||
#define NEXT_NOTWORD_CONSTRAINT 0x0008
|
||||
#define PREV_NEWLINE_CONSTRAINT 0x0010
|
||||
#define NEXT_NEWLINE_CONSTRAINT 0x0020
|
||||
#define PREV_BEGBUF_CONSTRAINT 0x0040
|
||||
#define NEXT_ENDBUF_CONSTRAINT 0x0080
|
||||
#define WORD_DELIM_CONSTRAINT 0x0100
|
||||
#define NOT_WORD_DELIM_CONSTRAINT 0x0200
|
||||
|
||||
typedef enum
|
||||
{
|
||||
INSIDE_WORD = PREV_WORD_CONSTRAINT | NEXT_WORD_CONSTRAINT,
|
||||
WORD_FIRST = PREV_NOTWORD_CONSTRAINT | NEXT_WORD_CONSTRAINT,
|
||||
WORD_LAST = PREV_WORD_CONSTRAINT | NEXT_NOTWORD_CONSTRAINT,
|
||||
INSIDE_NOTWORD = PREV_NOTWORD_CONSTRAINT | NEXT_NOTWORD_CONSTRAINT,
|
||||
LINE_FIRST = PREV_NEWLINE_CONSTRAINT,
|
||||
LINE_LAST = NEXT_NEWLINE_CONSTRAINT,
|
||||
BUF_FIRST = PREV_BEGBUF_CONSTRAINT,
|
||||
BUF_LAST = NEXT_ENDBUF_CONSTRAINT,
|
||||
WORD_DELIM = WORD_DELIM_CONSTRAINT,
|
||||
NOT_WORD_DELIM = NOT_WORD_DELIM_CONSTRAINT
|
||||
} re_context_type;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Idx alloc;
|
||||
Idx nelem;
|
||||
Idx *elems;
|
||||
} re_node_set;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NON_TYPE = 0,
|
||||
|
||||
/* Node type, These are used by token, node, tree. */
|
||||
CHARACTER = 1,
|
||||
END_OF_RE = 2,
|
||||
SIMPLE_BRACKET = 3,
|
||||
OP_BACK_REF = 4,
|
||||
OP_PERIOD = 5,
|
||||
#ifdef RE_ENABLE_I18N
|
||||
COMPLEX_BRACKET = 6,
|
||||
OP_UTF8_PERIOD = 7,
|
||||
#endif /* RE_ENABLE_I18N */
|
||||
|
||||
/* We define EPSILON_BIT as a macro so that OP_OPEN_SUBEXP is used
|
||||
when the debugger shows values of this enum type. */
|
||||
#define EPSILON_BIT 8
|
||||
OP_OPEN_SUBEXP = EPSILON_BIT | 0,
|
||||
OP_CLOSE_SUBEXP = EPSILON_BIT | 1,
|
||||
OP_ALT = EPSILON_BIT | 2,
|
||||
OP_DUP_ASTERISK = EPSILON_BIT | 3,
|
||||
ANCHOR = EPSILON_BIT | 4,
|
||||
|
||||
/* Tree type, these are used only by tree. */
|
||||
CONCAT = 16,
|
||||
SUBEXP = 17,
|
||||
|
||||
/* Token type, these are used only by token. */
|
||||
OP_DUP_PLUS = 18,
|
||||
OP_DUP_QUESTION,
|
||||
OP_OPEN_BRACKET,
|
||||
OP_CLOSE_BRACKET,
|
||||
OP_CHARSET_RANGE,
|
||||
OP_OPEN_DUP_NUM,
|
||||
OP_CLOSE_DUP_NUM,
|
||||
OP_NON_MATCH_LIST,
|
||||
OP_OPEN_COLL_ELEM,
|
||||
OP_CLOSE_COLL_ELEM,
|
||||
OP_OPEN_EQUIV_CLASS,
|
||||
OP_CLOSE_EQUIV_CLASS,
|
||||
OP_OPEN_CHAR_CLASS,
|
||||
OP_CLOSE_CHAR_CLASS,
|
||||
OP_WORD,
|
||||
OP_NOTWORD,
|
||||
OP_SPACE,
|
||||
OP_NOTSPACE,
|
||||
BACK_SLASH
|
||||
|
||||
} re_token_type_t;
|
||||
|
||||
#ifdef RE_ENABLE_I18N
|
||||
typedef struct
|
||||
{
|
||||
/* Multibyte characters. */
|
||||
wchar_t *mbchars;
|
||||
|
||||
/* Collating symbols. */
|
||||
# ifdef _LIBC
|
||||
int32_t *coll_syms;
|
||||
# endif
|
||||
|
||||
/* Equivalence classes. */
|
||||
# ifdef _LIBC
|
||||
int32_t *equiv_classes;
|
||||
# endif
|
||||
|
||||
/* Range expressions. */
|
||||
# ifdef _LIBC
|
||||
uint32_t *range_starts;
|
||||
uint32_t *range_ends;
|
||||
# else /* not _LIBC */
|
||||
wchar_t *range_starts;
|
||||
wchar_t *range_ends;
|
||||
# endif /* not _LIBC */
|
||||
|
||||
/* Character classes. */
|
||||
wctype_t *char_classes;
|
||||
|
||||
/* If this character set is the non-matching list. */
|
||||
unsigned int non_match : 1;
|
||||
|
||||
/* # of multibyte characters. */
|
||||
Idx nmbchars;
|
||||
|
||||
/* # of collating symbols. */
|
||||
Idx ncoll_syms;
|
||||
|
||||
/* # of equivalence classes. */
|
||||
Idx nequiv_classes;
|
||||
|
||||
/* # of range expressions. */
|
||||
Idx nranges;
|
||||
|
||||
/* # of character classes. */
|
||||
Idx nchar_classes;
|
||||
} re_charset_t;
|
||||
#endif /* RE_ENABLE_I18N */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
union
|
||||
{
|
||||
unsigned char c; /* for CHARACTER */
|
||||
re_bitset_ptr_t sbcset; /* for SIMPLE_BRACKET */
|
||||
#ifdef RE_ENABLE_I18N
|
||||
re_charset_t *mbcset; /* for COMPLEX_BRACKET */
|
||||
#endif /* RE_ENABLE_I18N */
|
||||
Idx idx; /* for BACK_REF */
|
||||
re_context_type ctx_type; /* for ANCHOR */
|
||||
} opr;
|
||||
#if __GNUC__ >= 2 && !__STRICT_ANSI__
|
||||
re_token_type_t type : 8;
|
||||
#else
|
||||
re_token_type_t type;
|
||||
#endif
|
||||
unsigned int constraint : 10; /* context constraint */
|
||||
unsigned int duplicated : 1;
|
||||
unsigned int opt_subexp : 1;
|
||||
#ifdef RE_ENABLE_I18N
|
||||
unsigned int accept_mb : 1;
|
||||
/* These 2 bits can be moved into the union if needed (e.g. if running out
|
||||
of bits; move opr.c to opr.c.c and move the flags to opr.c.flags). */
|
||||
unsigned int mb_partial : 1;
|
||||
#endif
|
||||
unsigned int word_char : 1;
|
||||
} re_token_t;
|
||||
|
||||
#define IS_EPSILON_NODE(type) ((type) & EPSILON_BIT)
|
||||
|
||||
struct re_string_t
|
||||
{
|
||||
/* Indicate the raw buffer which is the original string passed as an
|
||||
argument of regexec(), re_search(), etc.. */
|
||||
const unsigned char *raw_mbs;
|
||||
/* Store the multibyte string. In case of "case insensitive mode" like
|
||||
REG_ICASE, upper cases of the string are stored, otherwise MBS points
|
||||
the same address that RAW_MBS points. */
|
||||
unsigned char *mbs;
|
||||
#ifdef RE_ENABLE_I18N
|
||||
/* Store the wide character string which is corresponding to MBS. */
|
||||
wint_t *wcs;
|
||||
Idx *offsets;
|
||||
mbstate_t cur_state;
|
||||
#endif
|
||||
/* Index in RAW_MBS. Each character mbs[i] corresponds to
|
||||
raw_mbs[raw_mbs_idx + i]. */
|
||||
Idx raw_mbs_idx;
|
||||
/* The length of the valid characters in the buffers. */
|
||||
Idx valid_len;
|
||||
/* The corresponding number of bytes in raw_mbs array. */
|
||||
Idx valid_raw_len;
|
||||
/* The length of the buffers MBS and WCS. */
|
||||
Idx bufs_len;
|
||||
/* The index in MBS, which is updated by re_string_fetch_byte. */
|
||||
Idx cur_idx;
|
||||
/* length of RAW_MBS array. */
|
||||
Idx raw_len;
|
||||
/* This is RAW_LEN - RAW_MBS_IDX + VALID_LEN - VALID_RAW_LEN. */
|
||||
Idx len;
|
||||
/* End of the buffer may be shorter than its length in the cases such
|
||||
as re_match_2, re_search_2. Then, we use STOP for end of the buffer
|
||||
instead of LEN. */
|
||||
Idx raw_stop;
|
||||
/* This is RAW_STOP - RAW_MBS_IDX adjusted through OFFSETS. */
|
||||
Idx stop;
|
||||
|
||||
/* The context of mbs[0]. We store the context independently, since
|
||||
the context of mbs[0] may be different from raw_mbs[0], which is
|
||||
the beginning of the input string. */
|
||||
unsigned int tip_context;
|
||||
/* The translation passed as a part of an argument of re_compile_pattern. */
|
||||
RE_TRANSLATE_TYPE trans;
|
||||
/* Copy of re_dfa_t's word_char. */
|
||||
re_const_bitset_ptr_t word_char;
|
||||
/* true if REG_ICASE. */
|
||||
unsigned char icase;
|
||||
unsigned char is_utf8;
|
||||
unsigned char map_notascii;
|
||||
unsigned char mbs_allocated;
|
||||
unsigned char offsets_needed;
|
||||
unsigned char newline_anchor;
|
||||
unsigned char word_ops_used;
|
||||
int mb_cur_max;
|
||||
};
|
||||
typedef struct re_string_t re_string_t;
|
||||
|
||||
|
||||
struct re_dfa_t;
|
||||
typedef struct re_dfa_t re_dfa_t;
|
||||
|
||||
#ifndef _LIBC
|
||||
# if defined __i386__ && !defined __EMX__
|
||||
# define internal_function __attribute ((regparm (3), stdcall))
|
||||
# else
|
||||
# define internal_function
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr,
|
||||
Idx new_buf_len)
|
||||
internal_function;
|
||||
#ifdef RE_ENABLE_I18N
|
||||
static void build_wcs_buffer (re_string_t *pstr) internal_function;
|
||||
static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr)
|
||||
internal_function;
|
||||
#endif /* RE_ENABLE_I18N */
|
||||
static void build_upper_buffer (re_string_t *pstr) internal_function;
|
||||
static void re_string_translate_buffer (re_string_t *pstr) internal_function;
|
||||
static unsigned int re_string_context_at (const re_string_t *input, Idx idx,
|
||||
int eflags)
|
||||
internal_function __attribute ((pure));
|
||||
#define re_string_peek_byte(pstr, offset) \
|
||||
((pstr)->mbs[(pstr)->cur_idx + offset])
|
||||
#define re_string_fetch_byte(pstr) \
|
||||
((pstr)->mbs[(pstr)->cur_idx++])
|
||||
#define re_string_first_byte(pstr, idx) \
|
||||
((idx) == (pstr)->valid_len || (pstr)->wcs[idx] != WEOF)
|
||||
#define re_string_is_single_byte_char(pstr, idx) \
|
||||
((pstr)->wcs[idx] != WEOF && ((pstr)->valid_len == (idx) + 1 \
|
||||
|| (pstr)->wcs[(idx) + 1] != WEOF))
|
||||
#define re_string_eoi(pstr) ((pstr)->stop <= (pstr)->cur_idx)
|
||||
#define re_string_cur_idx(pstr) ((pstr)->cur_idx)
|
||||
#define re_string_get_buffer(pstr) ((pstr)->mbs)
|
||||
#define re_string_length(pstr) ((pstr)->len)
|
||||
#define re_string_byte_at(pstr,idx) ((pstr)->mbs[idx])
|
||||
#define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx))
|
||||
#define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx))
|
||||
|
||||
#include <alloca.h>
|
||||
|
||||
#ifndef _LIBC
|
||||
# if HAVE_ALLOCA
|
||||
/* The OS usually guarantees only one guard page at the bottom of the stack,
|
||||
and a page size can be as small as 4096 bytes. So we cannot safely
|
||||
allocate anything larger than 4096 bytes. Also care for the possibility
|
||||
of a few compiler-allocated temporary stack slots. */
|
||||
# define __libc_use_alloca(n) ((n) < 4032)
|
||||
# else
|
||||
/* alloca is implemented with malloc, so just use malloc. */
|
||||
# define __libc_use_alloca(n) 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
# define MAX(a,b) ((a) < (b) ? (b) : (a))
|
||||
#endif
|
||||
|
||||
#define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t)))
|
||||
#define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t)))
|
||||
#define re_free(p) free (p)
|
||||
|
||||
struct bin_tree_t
|
||||
{
|
||||
struct bin_tree_t *parent;
|
||||
struct bin_tree_t *left;
|
||||
struct bin_tree_t *right;
|
||||
struct bin_tree_t *first;
|
||||
struct bin_tree_t *next;
|
||||
|
||||
re_token_t token;
|
||||
|
||||
/* `node_idx' is the index in dfa->nodes, if `type' == 0.
|
||||
Otherwise `type' indicate the type of this node. */
|
||||
Idx node_idx;
|
||||
};
|
||||
typedef struct bin_tree_t bin_tree_t;
|
||||
|
||||
#define BIN_TREE_STORAGE_SIZE \
|
||||
((1024 - sizeof (void *)) / sizeof (bin_tree_t))
|
||||
|
||||
struct bin_tree_storage_t
|
||||
{
|
||||
struct bin_tree_storage_t *next;
|
||||
bin_tree_t data[BIN_TREE_STORAGE_SIZE];
|
||||
};
|
||||
typedef struct bin_tree_storage_t bin_tree_storage_t;
|
||||
|
||||
#define CONTEXT_WORD 1
|
||||
#define CONTEXT_NEWLINE (CONTEXT_WORD << 1)
|
||||
#define CONTEXT_BEGBUF (CONTEXT_NEWLINE << 1)
|
||||
#define CONTEXT_ENDBUF (CONTEXT_BEGBUF << 1)
|
||||
|
||||
#define IS_WORD_CONTEXT(c) ((c) & CONTEXT_WORD)
|
||||
#define IS_NEWLINE_CONTEXT(c) ((c) & CONTEXT_NEWLINE)
|
||||
#define IS_BEGBUF_CONTEXT(c) ((c) & CONTEXT_BEGBUF)
|
||||
#define IS_ENDBUF_CONTEXT(c) ((c) & CONTEXT_ENDBUF)
|
||||
#define IS_ORDINARY_CONTEXT(c) ((c) == 0)
|
||||
|
||||
#define IS_WORD_CHAR(ch) (isalnum (ch) || (ch) == '_')
|
||||
#define IS_NEWLINE(ch) ((ch) == NEWLINE_CHAR)
|
||||
#define IS_WIDE_WORD_CHAR(ch) (iswalnum (ch) || (ch) == L'_')
|
||||
#define IS_WIDE_NEWLINE(ch) ((ch) == WIDE_NEWLINE_CHAR)
|
||||
|
||||
#define NOT_SATISFY_PREV_CONSTRAINT(constraint,context) \
|
||||
((((constraint) & PREV_WORD_CONSTRAINT) && !IS_WORD_CONTEXT (context)) \
|
||||
|| ((constraint & PREV_NOTWORD_CONSTRAINT) && IS_WORD_CONTEXT (context)) \
|
||||
|| ((constraint & PREV_NEWLINE_CONSTRAINT) && !IS_NEWLINE_CONTEXT (context))\
|
||||
|| ((constraint & PREV_BEGBUF_CONSTRAINT) && !IS_BEGBUF_CONTEXT (context)))
|
||||
|
||||
#define NOT_SATISFY_NEXT_CONSTRAINT(constraint,context) \
|
||||
((((constraint) & NEXT_WORD_CONSTRAINT) && !IS_WORD_CONTEXT (context)) \
|
||||
|| (((constraint) & NEXT_NOTWORD_CONSTRAINT) && IS_WORD_CONTEXT (context)) \
|
||||
|| (((constraint) & NEXT_NEWLINE_CONSTRAINT) && !IS_NEWLINE_CONTEXT (context)) \
|
||||
|| (((constraint) & NEXT_ENDBUF_CONSTRAINT) && !IS_ENDBUF_CONTEXT (context)))
|
||||
|
||||
struct re_dfastate_t
|
||||
{
|
||||
re_hashval_t hash;
|
||||
re_node_set nodes;
|
||||
re_node_set non_eps_nodes;
|
||||
re_node_set inveclosure;
|
||||
re_node_set *entrance_nodes;
|
||||
struct re_dfastate_t **trtable, **word_trtable;
|
||||
unsigned int context : 4;
|
||||
unsigned int halt : 1;
|
||||
/* If this state can accept `multi byte'.
|
||||
Note that we refer to multibyte characters, and multi character
|
||||
collating elements as `multi byte'. */
|
||||
unsigned int accept_mb : 1;
|
||||
/* If this state has backreference node(s). */
|
||||
unsigned int has_backref : 1;
|
||||
unsigned int has_constraint : 1;
|
||||
};
|
||||
typedef struct re_dfastate_t re_dfastate_t;
|
||||
|
||||
struct re_state_table_entry
|
||||
{
|
||||
Idx num;
|
||||
Idx alloc;
|
||||
re_dfastate_t **array;
|
||||
};
|
||||
|
||||
/* Array type used in re_sub_match_last_t and re_sub_match_top_t. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Idx next_idx;
|
||||
Idx alloc;
|
||||
re_dfastate_t **array;
|
||||
} state_array_t;
|
||||
|
||||
/* Store information about the node NODE whose type is OP_CLOSE_SUBEXP. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Idx node;
|
||||
Idx str_idx; /* The position NODE match at. */
|
||||
state_array_t path;
|
||||
} re_sub_match_last_t;
|
||||
|
||||
/* Store information about the node NODE whose type is OP_OPEN_SUBEXP.
|
||||
And information about the node, whose type is OP_CLOSE_SUBEXP,
|
||||
corresponding to NODE is stored in LASTS. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Idx str_idx;
|
||||
Idx node;
|
||||
state_array_t *path;
|
||||
Idx alasts; /* Allocation size of LASTS. */
|
||||
Idx nlasts; /* The number of LASTS. */
|
||||
re_sub_match_last_t **lasts;
|
||||
} re_sub_match_top_t;
|
||||
|
||||
struct re_backref_cache_entry
|
||||
{
|
||||
Idx node;
|
||||
Idx str_idx;
|
||||
Idx subexp_from;
|
||||
Idx subexp_to;
|
||||
char more;
|
||||
char unused;
|
||||
unsigned short int eps_reachable_subexps_map;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* The string object corresponding to the input string. */
|
||||
re_string_t input;
|
||||
#if defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
|
||||
const re_dfa_t *const dfa;
|
||||
#else
|
||||
const re_dfa_t *dfa;
|
||||
#endif
|
||||
/* EFLAGS of the argument of regexec. */
|
||||
int eflags;
|
||||
/* Where the matching ends. */
|
||||
Idx match_last;
|
||||
Idx last_node;
|
||||
/* The state log used by the matcher. */
|
||||
re_dfastate_t **state_log;
|
||||
Idx state_log_top;
|
||||
/* Back reference cache. */
|
||||
Idx nbkref_ents;
|
||||
Idx abkref_ents;
|
||||
struct re_backref_cache_entry *bkref_ents;
|
||||
int max_mb_elem_len;
|
||||
Idx nsub_tops;
|
||||
Idx asub_tops;
|
||||
re_sub_match_top_t **sub_tops;
|
||||
} re_match_context_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
re_dfastate_t **sifted_states;
|
||||
re_dfastate_t **limited_states;
|
||||
Idx last_node;
|
||||
Idx last_str_idx;
|
||||
re_node_set limits;
|
||||
} re_sift_context_t;
|
||||
|
||||
struct re_fail_stack_ent_t
|
||||
{
|
||||
Idx idx;
|
||||
Idx node;
|
||||
regmatch_t *regs;
|
||||
re_node_set eps_via_nodes;
|
||||
};
|
||||
|
||||
struct re_fail_stack_t
|
||||
{
|
||||
Idx num;
|
||||
Idx alloc;
|
||||
struct re_fail_stack_ent_t *stack;
|
||||
};
|
||||
|
||||
struct re_dfa_t
|
||||
{
|
||||
re_token_t *nodes;
|
||||
size_t nodes_alloc;
|
||||
size_t nodes_len;
|
||||
Idx *nexts;
|
||||
Idx *org_indices;
|
||||
re_node_set *edests;
|
||||
re_node_set *eclosures;
|
||||
re_node_set *inveclosures;
|
||||
struct re_state_table_entry *state_table;
|
||||
re_dfastate_t *init_state;
|
||||
re_dfastate_t *init_state_word;
|
||||
re_dfastate_t *init_state_nl;
|
||||
re_dfastate_t *init_state_begbuf;
|
||||
bin_tree_t *str_tree;
|
||||
bin_tree_storage_t *str_tree_storage;
|
||||
re_bitset_ptr_t sb_char;
|
||||
int str_tree_storage_idx;
|
||||
|
||||
/* number of subexpressions `re_nsub' is in regex_t. */
|
||||
re_hashval_t state_hash_mask;
|
||||
Idx init_node;
|
||||
Idx nbackref; /* The number of backreference in this dfa. */
|
||||
|
||||
/* Bitmap expressing which backreference is used. */
|
||||
bitset_word_t used_bkref_map;
|
||||
bitset_word_t completed_bkref_map;
|
||||
|
||||
unsigned int has_plural_match : 1;
|
||||
/* If this dfa has "multibyte node", which is a backreference or
|
||||
a node which can accept multibyte character or multi character
|
||||
collating element. */
|
||||
unsigned int has_mb_node : 1;
|
||||
unsigned int is_utf8 : 1;
|
||||
unsigned int map_notascii : 1;
|
||||
unsigned int word_ops_used : 1;
|
||||
int mb_cur_max;
|
||||
bitset_t word_char;
|
||||
reg_syntax_t syntax;
|
||||
Idx *subexp_map;
|
||||
#ifdef DEBUG
|
||||
char* re_str;
|
||||
#endif
|
||||
#ifdef _LIBC
|
||||
__libc_lock_define (, lock)
|
||||
#endif
|
||||
};
|
||||
|
||||
#define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set))
|
||||
#define re_node_set_remove(set,id) \
|
||||
(re_node_set_remove_at (set, re_node_set_contains (set, id) - 1))
|
||||
#define re_node_set_empty(p) ((p)->nelem = 0)
|
||||
#define re_node_set_free(set) re_free ((set)->elems)
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SB_CHAR,
|
||||
MB_CHAR,
|
||||
EQUIV_CLASS,
|
||||
COLL_SYM,
|
||||
CHAR_CLASS
|
||||
} bracket_elem_type;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bracket_elem_type type;
|
||||
union
|
||||
{
|
||||
unsigned char ch;
|
||||
unsigned char *name;
|
||||
wchar_t wch;
|
||||
} opr;
|
||||
} bracket_elem_t;
|
||||
|
||||
|
||||
/* Inline functions for bitset_t operation. */
|
||||
|
||||
static inline void
|
||||
bitset_set (bitset_t set, Idx i)
|
||||
{
|
||||
set[i / BITSET_WORD_BITS] |= (bitset_word_t) 1 << i % BITSET_WORD_BITS;
|
||||
}
|
||||
|
||||
static inline void
|
||||
bitset_clear (bitset_t set, Idx i)
|
||||
{
|
||||
set[i / BITSET_WORD_BITS] &= ~ ((bitset_word_t) 1 << i % BITSET_WORD_BITS);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
bitset_contain (const bitset_t set, Idx i)
|
||||
{
|
||||
return (set[i / BITSET_WORD_BITS] >> i % BITSET_WORD_BITS) & 1;
|
||||
}
|
||||
|
||||
static inline void
|
||||
bitset_empty (bitset_t set)
|
||||
{
|
||||
memset (set, '\0', sizeof (bitset_t));
|
||||
}
|
||||
|
||||
static inline void
|
||||
bitset_set_all (bitset_t set)
|
||||
{
|
||||
memset (set, -1, sizeof (bitset_word_t) * (SBC_MAX / BITSET_WORD_BITS));
|
||||
if (SBC_MAX % BITSET_WORD_BITS != 0)
|
||||
set[BITSET_WORDS - 1] =
|
||||
((bitset_word_t) 1 << SBC_MAX % BITSET_WORD_BITS) - 1;
|
||||
}
|
||||
|
||||
static inline void
|
||||
bitset_copy (bitset_t dest, const bitset_t src)
|
||||
{
|
||||
memcpy (dest, src, sizeof (bitset_t));
|
||||
}
|
||||
|
||||
static inline void
|
||||
bitset_not (bitset_t set)
|
||||
{
|
||||
int bitset_i;
|
||||
for (bitset_i = 0; bitset_i < SBC_MAX / BITSET_WORD_BITS; ++bitset_i)
|
||||
set[bitset_i] = ~set[bitset_i];
|
||||
if (SBC_MAX % BITSET_WORD_BITS != 0)
|
||||
set[BITSET_WORDS - 1] =
|
||||
((((bitset_word_t) 1 << SBC_MAX % BITSET_WORD_BITS) - 1)
|
||||
& ~set[BITSET_WORDS - 1]);
|
||||
}
|
||||
|
||||
static inline void
|
||||
bitset_merge (bitset_t dest, const bitset_t src)
|
||||
{
|
||||
int bitset_i;
|
||||
for (bitset_i = 0; bitset_i < BITSET_WORDS; ++bitset_i)
|
||||
dest[bitset_i] |= src[bitset_i];
|
||||
}
|
||||
|
||||
static inline void
|
||||
bitset_mask (bitset_t dest, const bitset_t src)
|
||||
{
|
||||
int bitset_i;
|
||||
for (bitset_i = 0; bitset_i < BITSET_WORDS; ++bitset_i)
|
||||
dest[bitset_i] &= src[bitset_i];
|
||||
}
|
||||
|
||||
#ifdef RE_ENABLE_I18N
|
||||
/* Inline functions for re_string. */
|
||||
static inline int
|
||||
internal_function __attribute ((pure))
|
||||
re_string_char_size_at (const re_string_t *pstr, Idx idx)
|
||||
{
|
||||
int byte_idx;
|
||||
if (pstr->mb_cur_max == 1)
|
||||
return 1;
|
||||
for (byte_idx = 1; idx + byte_idx < pstr->valid_len; ++byte_idx)
|
||||
if (pstr->wcs[idx + byte_idx] != WEOF)
|
||||
break;
|
||||
return byte_idx;
|
||||
}
|
||||
|
||||
static inline wint_t
|
||||
internal_function __attribute ((pure))
|
||||
re_string_wchar_at (const re_string_t *pstr, Idx idx)
|
||||
{
|
||||
if (pstr->mb_cur_max == 1)
|
||||
return (wint_t) pstr->mbs[idx];
|
||||
return (wint_t) pstr->wcs[idx];
|
||||
}
|
||||
|
||||
static int
|
||||
internal_function __attribute ((pure))
|
||||
re_string_elem_size_at (const re_string_t *pstr, Idx idx)
|
||||
{
|
||||
# ifdef _LIBC
|
||||
const unsigned char *p, *extra;
|
||||
const int32_t *table, *indirect;
|
||||
int32_t tmp;
|
||||
# include <locale/weight.h>
|
||||
uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
|
||||
|
||||
if (nrules != 0)
|
||||
{
|
||||
table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
|
||||
extra = (const unsigned char *)
|
||||
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
|
||||
indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE,
|
||||
_NL_COLLATE_INDIRECTMB);
|
||||
p = pstr->mbs + idx;
|
||||
tmp = findidx (&p);
|
||||
return p - pstr->mbs - idx;
|
||||
}
|
||||
else
|
||||
# endif /* _LIBC */
|
||||
return 1;
|
||||
}
|
||||
#endif /* RE_ENABLE_I18N */
|
||||
|
||||
#ifndef __GNUC_PREREQ
|
||||
# if defined __GNUC__ && defined __GNUC_MINOR__
|
||||
# define __GNUC_PREREQ(maj, min) \
|
||||
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||
# else
|
||||
# define __GNUC_PREREQ(maj, min) 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ (3,4)
|
||||
# undef __attribute_warn_unused_result__
|
||||
# define __attribute_warn_unused_result__ \
|
||||
__attribute__ ((__warn_unused_result__))
|
||||
#else
|
||||
# define __attribute_warn_unused_result__ /* empty */
|
||||
#endif
|
||||
|
||||
#endif /* _REGEX_INTERNAL_H */
|
4416
gnulib/regexec.c
Normal file
4416
gnulib/regexec.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -91,28 +91,13 @@ grub_dl_t grub_dl_load_core (void *addr, grub_size_t size);
|
|||
int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod);
|
||||
void grub_dl_unload_unneeded (void);
|
||||
void grub_dl_unload_all (void);
|
||||
#if defined (GRUB_MACHINE_EMU) || defined (GRUB_UTIL)
|
||||
#if defined (GRUB_UTIL) || defined (GRUB_TARGET_NO_MODULES)
|
||||
#define GRUB_NO_MODULES 1
|
||||
#else
|
||||
#define GRUB_NO_MODULES 0
|
||||
#endif
|
||||
#if GRUB_NO_MODULES
|
||||
static inline int
|
||||
grub_dl_ref (grub_dl_t mod)
|
||||
{
|
||||
(void) mod;
|
||||
return 0;
|
||||
}
|
||||
static inline int
|
||||
grub_dl_unref (grub_dl_t mod)
|
||||
{
|
||||
(void) mod;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
|
||||
int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
|
||||
#endif
|
||||
void EXPORT_FUNC(grub_dl_iterate) (int (*hook) (grub_dl_t mod));
|
||||
grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name);
|
||||
grub_err_t grub_dl_register_symbol (const char *name, void *addr,
|
||||
|
@ -121,7 +106,7 @@ grub_err_t grub_dl_register_symbol (const char *name, void *addr,
|
|||
grub_err_t grub_arch_dl_check_header (void *ehdr);
|
||||
grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
|
||||
|
||||
#if defined (_mips) && ! defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)
|
||||
#if defined (_mips) && ! GRUB_NO_MODULES
|
||||
#define GRUB_LINKER_HAVE_INIT 1
|
||||
void grub_arch_dl_init_linker (void);
|
||||
#endif
|
||||
|
|
|
@ -34,9 +34,9 @@
|
|||
by firmware. */
|
||||
#define GRUB_MACHINE_MEMORY_HOLE 6
|
||||
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
|
||||
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
|
||||
grub_err_t grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
|
||||
grub_uint64_t,
|
||||
grub_uint32_t));
|
||||
grub_err_t grub_machine_mmap_register (grub_uint64_t start, grub_uint64_t size,
|
||||
int type, int handle);
|
||||
grub_err_t grub_machine_mmap_unregister (int handle);
|
||||
|
|
|
@ -99,12 +99,8 @@ struct grub_pe32_optional_header
|
|||
grub_uint32_t entry_addr;
|
||||
grub_uint32_t code_base;
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 4
|
||||
grub_uint32_t data_base;
|
||||
grub_uint32_t image_base;
|
||||
#else
|
||||
grub_uint64_t image_base;
|
||||
#endif
|
||||
|
||||
grub_uint32_t section_alignment;
|
||||
grub_uint32_t file_alignment;
|
||||
|
@ -121,22 +117,11 @@ struct grub_pe32_optional_header
|
|||
grub_uint16_t subsystem;
|
||||
grub_uint16_t dll_characteristics;
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 4
|
||||
|
||||
grub_uint32_t stack_reserve_size;
|
||||
grub_uint32_t stack_commit_size;
|
||||
grub_uint32_t heap_reserve_size;
|
||||
grub_uint32_t heap_commit_size;
|
||||
|
||||
#else
|
||||
|
||||
grub_uint64_t stack_reserve_size;
|
||||
grub_uint64_t stack_commit_size;
|
||||
grub_uint64_t heap_reserve_size;
|
||||
grub_uint64_t heap_commit_size;
|
||||
|
||||
#endif
|
||||
|
||||
grub_uint32_t loader_flags;
|
||||
grub_uint32_t num_data_directories;
|
||||
|
||||
|
@ -159,15 +144,63 @@ struct grub_pe32_optional_header
|
|||
struct grub_pe32_data_directory reserved_entry;
|
||||
};
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 4
|
||||
struct grub_pe64_optional_header
|
||||
{
|
||||
grub_uint16_t magic;
|
||||
grub_uint8_t major_linker_version;
|
||||
grub_uint8_t minor_linker_version;
|
||||
grub_uint32_t code_size;
|
||||
grub_uint32_t data_size;
|
||||
grub_uint32_t bss_size;
|
||||
grub_uint32_t entry_addr;
|
||||
grub_uint32_t code_base;
|
||||
|
||||
grub_uint64_t image_base;
|
||||
|
||||
grub_uint32_t section_alignment;
|
||||
grub_uint32_t file_alignment;
|
||||
grub_uint16_t major_os_version;
|
||||
grub_uint16_t minor_os_version;
|
||||
grub_uint16_t major_image_version;
|
||||
grub_uint16_t minor_image_version;
|
||||
grub_uint16_t major_subsystem_version;
|
||||
grub_uint16_t minor_subsystem_version;
|
||||
grub_uint32_t reserved;
|
||||
grub_uint32_t image_size;
|
||||
grub_uint32_t header_size;
|
||||
grub_uint32_t checksum;
|
||||
grub_uint16_t subsystem;
|
||||
grub_uint16_t dll_characteristics;
|
||||
|
||||
grub_uint64_t stack_reserve_size;
|
||||
grub_uint64_t stack_commit_size;
|
||||
grub_uint64_t heap_reserve_size;
|
||||
grub_uint64_t heap_commit_size;
|
||||
|
||||
grub_uint32_t loader_flags;
|
||||
grub_uint32_t num_data_directories;
|
||||
|
||||
/* Data directories. */
|
||||
struct grub_pe32_data_directory export_table;
|
||||
struct grub_pe32_data_directory import_table;
|
||||
struct grub_pe32_data_directory resource_table;
|
||||
struct grub_pe32_data_directory exception_table;
|
||||
struct grub_pe32_data_directory certificate_table;
|
||||
struct grub_pe32_data_directory base_relocation_table;
|
||||
struct grub_pe32_data_directory debug;
|
||||
struct grub_pe32_data_directory architecture;
|
||||
struct grub_pe32_data_directory global_ptr;
|
||||
struct grub_pe32_data_directory tls_table;
|
||||
struct grub_pe32_data_directory load_config_table;
|
||||
struct grub_pe32_data_directory bound_import;
|
||||
struct grub_pe32_data_directory iat;
|
||||
struct grub_pe32_data_directory delay_import_descriptor;
|
||||
struct grub_pe32_data_directory com_runtime_header;
|
||||
struct grub_pe32_data_directory reserved_entry;
|
||||
};
|
||||
|
||||
#define GRUB_PE32_PE32_MAGIC 0x10b
|
||||
|
||||
#else
|
||||
|
||||
#define GRUB_PE32_PE32_MAGIC 0x20b
|
||||
|
||||
#endif
|
||||
#define GRUB_PE32_PE64_MAGIC 0x20b
|
||||
|
||||
#define GRUB_PE32_SUBSYSTEM_EFI_APPLICATION 10
|
||||
|
||||
|
@ -205,6 +238,7 @@ struct grub_pe32_section_table
|
|||
#define GRUB_PE32_SCN_ALIGN_SHIFT 20
|
||||
#define GRUB_PE32_SCN_ALIGN_MASK 7
|
||||
|
||||
#define GRUB_PE32_SIGNATURE_SIZE 4
|
||||
|
||||
struct grub_pe32_header
|
||||
{
|
||||
|
@ -212,13 +246,18 @@ struct grub_pe32_header
|
|||
grub_uint8_t msdos_stub[GRUB_PE32_MSDOS_STUB_SIZE];
|
||||
|
||||
/* This is always PE\0\0. */
|
||||
char signature[4];
|
||||
char signature[GRUB_PE32_SIGNATURE_SIZE];
|
||||
|
||||
/* The COFF file header. */
|
||||
struct grub_pe32_coff_header coff_header;
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 8
|
||||
/* The Optional header. */
|
||||
struct grub_pe64_optional_header optional_header;
|
||||
#else
|
||||
/* The Optional header. */
|
||||
struct grub_pe32_optional_header optional_header;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct grub_pe32_fixup_block
|
||||
|
|
|
@ -555,6 +555,7 @@ typedef struct
|
|||
#define PT_NUM 8 /* Number of defined types */
|
||||
#define PT_LOOS 0x60000000 /* Start of OS-specific */
|
||||
#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
|
||||
#define PT_GNU_STACK 0x6474e551 /* GCC stack segment */
|
||||
#define PT_LOSUNW 0x6ffffffa
|
||||
#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
|
||||
#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
|
||||
|
|
|
@ -26,7 +26,6 @@ enum grub_dev_abstraction_types {
|
|||
};
|
||||
|
||||
char *grub_guess_root_device (const char *dir);
|
||||
char *grub_get_prefix (const char *dir);
|
||||
int grub_util_get_dev_abstraction (const char *os_dev);
|
||||
char *grub_util_get_grub_dev (const char *os_dev);
|
||||
const char *grub_util_check_block_device (const char *blk_dev);
|
|
@ -20,8 +20,11 @@
|
|||
#ifndef GRUB_BIOSDISK_MACHINE_UTIL_HEADER
|
||||
#define GRUB_BIOSDISK_MACHINE_UTIL_HEADER 1
|
||||
|
||||
#include <grub/disk.h>
|
||||
|
||||
void grub_util_biosdisk_init (const char *dev_map);
|
||||
void grub_util_biosdisk_fini (void);
|
||||
char *grub_util_biosdisk_get_grub_dev (const char *os_dev);
|
||||
const char *grub_util_biosdisk_get_osdev (grub_disk_t disk);
|
||||
|
||||
#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */
|
50
include/grub/emu/misc.h
Normal file
50
include/grub/emu/misc.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
#ifndef GRUB_EMU_MISC_H
|
||||
#define GRUB_EMU_MISC_H 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# include <sys/fcntl.h>
|
||||
# include <sys/cygwin.h>
|
||||
# include <limits.h>
|
||||
# define DEV_CYGDRIVE_MAJOR 98
|
||||
#endif
|
||||
|
||||
#ifdef __NetBSD__
|
||||
/* NetBSD uses /boot for its boot block. */
|
||||
# define DEFAULT_DIRECTORY "/grub"
|
||||
#else
|
||||
# define DEFAULT_DIRECTORY "/boot/grub"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
|
||||
|
||||
extern int verbosity;
|
||||
extern const char *program_name;
|
||||
|
||||
void grub_init_all (void);
|
||||
void grub_fini_all (void);
|
||||
|
||||
char *grub_make_system_path_relative_to_its_root (const char *path);
|
||||
|
||||
void * EXPORT_FUNC(xmalloc) (grub_size_t size);
|
||||
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size);
|
||||
char * EXPORT_FUNC(xstrdup) (const char *str);
|
||||
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...);
|
||||
|
||||
void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...);
|
||||
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...);
|
||||
void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((noreturn));
|
||||
|
||||
#ifndef HAVE_VASPRINTF
|
||||
int EXPORT_FUNC(vasprintf) (char **buf, const char *fmt, va_list ap);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ASPRINTF
|
||||
int EXPORT_FUNC(asprintf) (char **buf, const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...);
|
||||
|
||||
#endif /* GRUB_EMU_MISC_H */
|
|
@ -22,10 +22,15 @@
|
|||
#include <grub/video.h>
|
||||
#include <grub/bitmap.h>
|
||||
#include <grub/gfxmenu_view.h>
|
||||
#include <grub/mm.h>
|
||||
|
||||
#ifndef GRUB_GUI_H
|
||||
#define GRUB_GUI_H 1
|
||||
|
||||
/* The component ID identifying GUI components to be updated as the timeout
|
||||
status changes. */
|
||||
#define GRUB_GFXMENU_TIMEOUT_COMPONENT_ID "__timeout__"
|
||||
|
||||
/* A representation of a color. Unlike grub_video_color_t, this
|
||||
representation is independent of any video mode specifics. */
|
||||
typedef struct grub_gui_color
|
||||
|
@ -79,6 +84,46 @@ struct grub_gui_progress_ops
|
|||
void (*set_state) (void *self, int visible, int start, int current, int end);
|
||||
};
|
||||
|
||||
typedef void (*grub_gfxmenu_set_state_t) (void *self, int visible, int start,
|
||||
int current, int end);
|
||||
|
||||
struct grub_gfxmenu_timeout_notify
|
||||
{
|
||||
struct grub_gfxmenu_timeout_notify *next;
|
||||
grub_gfxmenu_set_state_t set_state;
|
||||
grub_gui_component_t self;
|
||||
};
|
||||
|
||||
extern struct grub_gfxmenu_timeout_notify *grub_gfxmenu_timeout_notifications;
|
||||
|
||||
static inline grub_err_t
|
||||
grub_gfxmenu_timeout_register (grub_gui_component_t self,
|
||||
grub_gfxmenu_set_state_t set_state)
|
||||
{
|
||||
struct grub_gfxmenu_timeout_notify *ne = grub_malloc (sizeof (*ne));
|
||||
if (!ne)
|
||||
return grub_errno;
|
||||
ne->set_state = set_state;
|
||||
ne->self = self;
|
||||
ne->next = grub_gfxmenu_timeout_notifications;
|
||||
grub_gfxmenu_timeout_notifications = ne;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_gfxmenu_timeout_unregister (grub_gui_component_t self)
|
||||
{
|
||||
struct grub_gfxmenu_timeout_notify **p, *q;
|
||||
|
||||
for (p = &grub_gfxmenu_timeout_notifications, q = *p;
|
||||
q; p = &(q->next), q = q->next)
|
||||
if (q->self == self)
|
||||
{
|
||||
*p = q->next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
typedef signed grub_fixed_signed_t;
|
||||
#define GRUB_FIXED_1 0x10000
|
||||
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
#include <config.h>
|
||||
#include <grub/symbol.h>
|
||||
|
||||
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
||||
|
||||
/* NLS can be disabled through the configure --disable-nls option. */
|
||||
#if (defined(ENABLE_NLS) && ENABLE_NLS)
|
||||
#if (defined(ENABLE_NLS) && ENABLE_NLS) || !defined (GRUB_UTIL)
|
||||
|
||||
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
||||
|
||||
# ifdef GRUB_UTIL
|
||||
|
||||
|
@ -41,18 +41,26 @@ extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
|||
for invalid uses of the value returned from these functions.
|
||||
On pre-ANSI systems without 'const', the config.h file is supposed to
|
||||
contain "#define const". */
|
||||
# ifdef GRUB_UTIL
|
||||
# define gettext(Msgid) ((const char *) (Msgid))
|
||||
# else
|
||||
# define grub_gettext(str) ((const char *) (str))
|
||||
# endif /* GRUB_UTIL */
|
||||
static inline const char * __attribute__ ((always_inline))
|
||||
gettext (const char *str)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
#endif /* (defined(ENABLE_NLS) && ENABLE_NLS) */
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
# define _(str) gettext(str)
|
||||
static inline const char * __attribute__ ((always_inline))
|
||||
_ (const char *str)
|
||||
{
|
||||
return gettext(str);
|
||||
}
|
||||
#else
|
||||
# define _(str) grub_gettext(str)
|
||||
static inline const char * __attribute__ ((always_inline))
|
||||
_ (const char *str)
|
||||
{
|
||||
return grub_gettext(str);
|
||||
}
|
||||
#endif /* GRUB_UTIL */
|
||||
|
||||
#define N_(str) str
|
||||
|
|
|
@ -44,8 +44,9 @@ typedef struct grub_linuxbios_table_header *grub_linuxbios_table_header_t;
|
|||
|
||||
struct grub_linuxbios_table_item
|
||||
{
|
||||
#define GRUB_LINUXBIOS_MEMBER_UNUSED 0
|
||||
#define GRUB_LINUXBIOS_MEMBER_MEMORY 1
|
||||
#define GRUB_LINUXBIOS_MEMBER_UNUSED 0x00
|
||||
#define GRUB_LINUXBIOS_MEMBER_MEMORY 0x01
|
||||
#define GRUB_LINUXBIOS_MEMBER_LINK 0x11
|
||||
grub_uint32_t tag;
|
||||
grub_uint32_t size;
|
||||
};
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MACHINE_KERNEL_HEADER
|
||||
#define GRUB_MACHINE_KERNEL_HEADER 1
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x8
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
|
||||
|
||||
#endif /* ! GRUB_MACHINE_KERNEL_HEADER */
|
||||
|
|
@ -1 +0,0 @@
|
|||
#include <grub/powerpc/ieee1275/kernel.h>
|
1
include/grub/i386/multiboot/boot.h
Normal file
1
include/grub/i386/multiboot/boot.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/i386/coreboot/boot.h>
|
1
include/grub/i386/multiboot/console.h
Normal file
1
include/grub/i386/multiboot/console.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/i386/coreboot/console.h>
|
1
include/grub/i386/multiboot/init.h
Normal file
1
include/grub/i386/multiboot/init.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/i386/coreboot/init.h>
|
1
include/grub/i386/multiboot/kernel.h
Normal file
1
include/grub/i386/multiboot/kernel.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/i386/coreboot/kernel.h>
|
1
include/grub/i386/multiboot/loader.h
Normal file
1
include/grub/i386/multiboot/loader.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/i386/coreboot/loader.h>
|
1
include/grub/i386/multiboot/memory.h
Normal file
1
include/grub/i386/multiboot/memory.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/i386/coreboot/memory.h>
|
1
include/grub/i386/multiboot/serial.h
Normal file
1
include/grub/i386/multiboot/serial.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/i386/coreboot/serial.h>
|
1
include/grub/i386/multiboot/time.h
Normal file
1
include/grub/i386/multiboot/time.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/i386/coreboot/time.h>
|
|
@ -19,6 +19,8 @@
|
|||
#ifndef GRUB_BOOT_MACHINE_HEADER
|
||||
#define GRUB_BOOT_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/offsets.h>
|
||||
|
||||
/* The signature for bootloader. */
|
||||
#define GRUB_BOOT_MACHINE_SIGNATURE 0xaa55
|
||||
|
||||
|
@ -57,9 +59,6 @@
|
|||
floppy. */
|
||||
#define GRUB_BOOT_MACHINE_BIOS_HD_FLAG 0x80
|
||||
|
||||
/* The segment where the kernel is loaded. */
|
||||
#define GRUB_BOOT_MACHINE_KERNEL_SEG 0x800
|
||||
|
||||
/* The address where the kernel is loaded. */
|
||||
#define GRUB_BOOT_MACHINE_KERNEL_ADDR (GRUB_BOOT_MACHINE_KERNEL_SEG << 4)
|
||||
|
||||
|
@ -68,16 +67,7 @@
|
|||
|
||||
#define GRUB_BOOT_MACHINE_PXE_DL 0x7f
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
/* This is the blocklist used in the diskboot image. */
|
||||
struct grub_boot_blocklist
|
||||
{
|
||||
grub_uint64_t start;
|
||||
grub_uint16_t len;
|
||||
grub_uint16_t segment;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
#define grub_boot_blocklist grub_pc_bios_boot_blocklist
|
||||
|
||||
#endif /* ! BOOT_MACHINE_HEADER */
|
||||
|
|
|
@ -19,29 +19,7 @@
|
|||
#ifndef KERNEL_MACHINE_HEADER
|
||||
#define KERNEL_MACHINE_HEADER 1
|
||||
|
||||
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE 0x10
|
||||
|
||||
/* The offset of GRUB_INSTALL_DOS_PART. */
|
||||
#define GRUB_KERNEL_MACHINE_INSTALL_DOS_PART 0x14
|
||||
|
||||
/* The offset of GRUB_INSTALL_BSD_PART. */
|
||||
#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART 0x18
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x1c
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x5c
|
||||
|
||||
/* The size of the first region which won't be compressed. */
|
||||
#define GRUB_KERNEL_MACHINE_RAW_SIZE (GRUB_KERNEL_MACHINE_DATA_END + 0x5F0)
|
||||
#include <grub/offsets.h>
|
||||
|
||||
/* Enable LZMA compression */
|
||||
#define ENABLE_LZMA 1
|
||||
|
@ -63,10 +41,6 @@ extern grub_int32_t grub_install_dos_part;
|
|||
/* The BSD partition number of the installed partition. */
|
||||
extern grub_int32_t grub_install_bsd_part;
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
/* The boot BIOS drive number. */
|
||||
extern grub_uint8_t EXPORT_VAR(grub_boot_drive);
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
#include <grub/i386/memory.h>
|
||||
|
||||
#include <grub/offsets.h>
|
||||
|
||||
/* The scratch buffer used in real mode code. */
|
||||
#define GRUB_MEMORY_MACHINE_SCRATCH_ADDR 0x68000
|
||||
#define GRUB_MEMORY_MACHINE_SCRATCH_SEG (GRUB_MEMORY_MACHINE_SCRATCH_ADDR >> 4)
|
||||
|
@ -40,9 +42,6 @@
|
|||
/* The size of the protect mode stack. */
|
||||
#define GRUB_MEMORY_MACHINE_PROT_STACK_SIZE 0x8000
|
||||
|
||||
/* The upper memory area (starting at 640 kiB). */
|
||||
#define GRUB_MEMORY_MACHINE_UPPER 0xa0000
|
||||
|
||||
/* The protected mode stack. */
|
||||
#define GRUB_MEMORY_MACHINE_PROT_STACK \
|
||||
(GRUB_MEMORY_MACHINE_SCRATCH_ADDR + GRUB_MEMORY_MACHINE_SCRATCH_SIZE \
|
||||
|
|
|
@ -22,7 +22,4 @@
|
|||
/* The size of boot.img. */
|
||||
#define GRUB_BOOT_MACHINE_SIZE (0x100000 - GRUB_BOOT_MACHINE_LINK_ADDR)
|
||||
|
||||
/* The offset of GRUB_CORE_ENTRY_ADDR. */
|
||||
#define GRUB_BOOT_MACHINE_CORE_ENTRY_ADDR 0x4
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,17 +19,7 @@
|
|||
#ifndef GRUB_KERNEL_MACHINE_HEADER
|
||||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
/* The offset of GRUB_CORE_ENTRY_ADDR. */
|
||||
#define GRUB_KERNEL_MACHINE_CORE_ENTRY_ADDR 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x10
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
|
||||
#include <grub/offsets.h>
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
|
@ -44,10 +34,6 @@ extern grub_int32_t grub_kernel_image_size;
|
|||
/* The total size of module images following the kernel. */
|
||||
extern grub_int32_t grub_total_module_size;
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
||||
|
|
|
@ -100,6 +100,9 @@ enum grub_ieee1275_flag
|
|||
|
||||
/* Open Hack'Ware don't support the ANSI sequence. */
|
||||
GRUB_IEEE1275_FLAG_NO_ANSI,
|
||||
|
||||
/* OpenFirmware hangs on qemu if one requests any memory below 1.5 MiB. */
|
||||
GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM,
|
||||
};
|
||||
|
||||
extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);
|
||||
|
|
|
@ -42,19 +42,33 @@ struct grub_module_header
|
|||
/* "gmim" (GRUB Module Info Magic). */
|
||||
#define GRUB_MODULE_MAGIC 0x676d696d
|
||||
|
||||
struct grub_module_info
|
||||
struct grub_module_info32
|
||||
{
|
||||
/* Magic number so we know we have modules present. */
|
||||
grub_uint32_t magic;
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 8
|
||||
grub_uint32_t padding;
|
||||
#endif
|
||||
/* The offset of the modules. */
|
||||
grub_target_off_t offset;
|
||||
grub_uint32_t offset;
|
||||
/* The size of all modules plus this header. */
|
||||
grub_target_size_t size;
|
||||
grub_uint32_t size;
|
||||
};
|
||||
|
||||
struct grub_module_info64
|
||||
{
|
||||
/* Magic number so we know we have modules present. */
|
||||
grub_uint32_t magic;
|
||||
grub_uint32_t padding;
|
||||
/* The offset of the modules. */
|
||||
grub_uint64_t offset;
|
||||
/* The size of all modules plus this header. */
|
||||
grub_uint64_t size;
|
||||
};
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 8
|
||||
#define grub_module_info grub_module_info64
|
||||
#else
|
||||
#define grub_module_info grub_module_info32
|
||||
#endif
|
||||
|
||||
extern grub_addr_t grub_arch_modules_addr (void);
|
||||
|
||||
extern void EXPORT_FUNC(grub_module_iterate) (int (*hook) (struct grub_module_header *));
|
||||
|
@ -76,4 +90,8 @@ void grub_machine_set_prefix (void);
|
|||
/* Register all the exported symbols. This is automatically generated. */
|
||||
void grub_register_exported_symbols (void);
|
||||
|
||||
#if ! defined (ASM_FILE) && !defined (GRUB_MACHINE_EMU)
|
||||
extern char grub_prefix[];
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_KERNEL_HEADER */
|
||||
|
|
|
@ -18,21 +18,31 @@
|
|||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef HAVE___ASHLDI3
|
||||
/* On x86 these functions aren't really needed. Save some space. */
|
||||
#if !defined (__i386__) && !defined (__x86_64__)
|
||||
# ifdef HAVE___ASHLDI3
|
||||
void EXPORT_FUNC (__ashldi3) (void);
|
||||
#endif
|
||||
#ifdef HAVE___ASHRDI3
|
||||
# endif
|
||||
# ifdef HAVE___ASHRDI3
|
||||
void EXPORT_FUNC (__ashrdi3) (void);
|
||||
#endif
|
||||
#ifdef HAVE___LSHRDI3
|
||||
# endif
|
||||
# ifdef HAVE___LSHRDI3
|
||||
void EXPORT_FUNC (__lshrdi3) (void);
|
||||
# endif
|
||||
# ifdef HAVE___UCMPDI2
|
||||
void EXPORT_FUNC (__ucmpdi2) (void);
|
||||
# endif
|
||||
# ifdef HAVE___BSWAPSI2
|
||||
void EXPORT_FUNC (__bswapsi2) (void);
|
||||
# endif
|
||||
# ifdef HAVE___BSWAPDI2
|
||||
void EXPORT_FUNC (__bswapdi2) (void);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE___TRAMPOLINE_SETUP
|
||||
void EXPORT_FUNC (__trampoline_setup) (void);
|
||||
#endif
|
||||
#ifdef HAVE___UCMPDI2
|
||||
void EXPORT_FUNC (__ucmpdi2) (void);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__RESTGPR_14_X
|
||||
void EXPORT_FUNC (_restgpr_14_x) (void);
|
26
include/grub/libpciaccess.h
Normal file
26
include/grub/libpciaccess.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
void EXPORT_FUNC (pci_slot_match_iterator_create) (void);
|
||||
void EXPORT_FUNC (pci_system_cleanup) (void);
|
||||
void EXPORT_FUNC (pci_device_unmap_range) (void);
|
||||
void EXPORT_FUNC (pci_iterator_destroy) (void);
|
||||
void EXPORT_FUNC (pci_device_map_range) (void);
|
||||
void EXPORT_FUNC (pci_device_cfg_read_u32) (void);
|
||||
void EXPORT_FUNC (pci_device_next) (void);
|
||||
void EXPORT_FUNC (pci_system_init) (void);
|
|
@ -16,17 +16,14 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_BOOT_MACHINE_HEADER
|
||||
#define GRUB_BOOT_MACHINE_HEADER 1
|
||||
|
||||
#define GRUB_MACHINE_FLASH_START 0xbfc00000
|
||||
#define GRUB_MACHINE_FLASH_TLB_REFILL 0xbfc00200
|
||||
#define GRUB_MACHINE_FLASH_CACHE_ERROR 0xbfc00300
|
||||
#define GRUB_MACHINE_FLASH_OTHER_EXCEPTION 0xbfc00380
|
||||
|
||||
#define GRUB_MACHINE_DDR2_BASE 0xaffffe00
|
||||
#define GRUB_MACHINE_DDR2_REG1_HI_8BANKS 0x00000001
|
||||
#define GRUB_MACHINE_DDR2_REG_SIZE 0x8
|
||||
#define GRUB_MACHINE_DDR2_REG_STEP 0x10
|
||||
|
||||
#endif
|
||||
void EXPORT_FUNC (usb_bulk_write) (void);
|
||||
void EXPORT_FUNC (usb_find_busses) (void);
|
||||
void EXPORT_FUNC (usb_init) (void);
|
||||
void EXPORT_FUNC (usb_find_devices) (void);
|
||||
void EXPORT_FUNC (usb_open) (void);
|
||||
void EXPORT_FUNC (usb_get_busses) (void);
|
||||
void EXPORT_FUNC (usb_control_msg) (void);
|
||||
void EXPORT_FUNC (usb_release_interface) (void);
|
||||
void EXPORT_FUNC (usb_close) (void);
|
||||
void EXPORT_FUNC (usb_bulk_read) (void);
|
||||
void EXPORT_FUNC (usb_claim_interface) (void);
|
|
@ -47,6 +47,8 @@ struct grub_menu_entry
|
|||
/* The sourcecode of the menu entry, used by the editor. */
|
||||
const char *sourcecode;
|
||||
|
||||
int hotkey;
|
||||
|
||||
/* The next element. */
|
||||
struct grub_menu_entry *next;
|
||||
};
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* 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_KERNEL_CPU_HEADER
|
||||
#define GRUB_KERNEL_CPU_HEADER 1
|
||||
|
||||
#define GRUB_MOD_ALIGN 0x1
|
||||
/* Non-zero value is only needed for PowerMacs. */
|
||||
#define GRUB_MOD_GAP 0x0
|
||||
|
||||
#define GRUB_KERNEL_MACHINE_LINK_ALIGN 32
|
||||
|
||||
#define GRUB_KERNEL_CPU_RAW_SIZE 0x200
|
||||
#define GRUB_KERNEL_CPU_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_CPU_TOTAL_MODULE_SIZE 0xc
|
||||
#define GRUB_KERNEL_CPU_KERNEL_IMAGE_SIZE 0x10
|
||||
|
||||
#define GRUB_KERNEL_CPU_PREFIX GRUB_KERNEL_CPU_RAW_SIZE
|
||||
#define GRUB_KERNEL_CPU_DATA_END GRUB_KERNEL_CPU_RAW_SIZE + 0x48
|
||||
|
||||
#define GRUB_KERNEL_MACHINE_RAW_SIZE GRUB_KERNEL_CPU_RAW_SIZE
|
||||
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX GRUB_KERNEL_CPU_PREFIX
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END GRUB_KERNEL_CPU_DATA_END
|
||||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE GRUB_KERNEL_CPU_KERNEL_IMAGE_SIZE
|
||||
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE GRUB_KERNEL_CPU_TOTAL_MODULE_SIZE
|
||||
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE GRUB_KERNEL_CPU_COMPRESSED_SIZE
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2004,2007,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef HAVE___ASHLDI3
|
||||
void EXPORT_FUNC (__ashldi3) (void);
|
||||
#endif
|
||||
#ifdef HAVE___ASHRDI3
|
||||
void EXPORT_FUNC (__ashrdi3) (void);
|
||||
#endif
|
||||
#ifdef HAVE___LSHRDI3
|
||||
void EXPORT_FUNC (__lshrdi3) (void);
|
||||
#endif
|
||||
#ifdef HAVE___UCMPDI2
|
||||
void EXPORT_FUNC (__ucmpdi2) (void);
|
||||
#endif
|
||||
#ifdef HAVE___BSWAPSI2
|
||||
void EXPORT_FUNC (__bswapsi2) (void);
|
||||
#endif
|
||||
#ifdef HAVE___BSWAPDI2
|
||||
void EXPORT_FUNC (__bswapdi2) (void);
|
||||
#endif
|
|
@ -25,6 +25,16 @@
|
|||
#define GRUB_CPU_REGISTER_WRAP(x) #x
|
||||
#endif
|
||||
|
||||
#define GRUB_CPU_LOONGSON_FLASH_START 0xbfc00000
|
||||
#define GRUB_CPU_LOONGSON_FLASH_TLB_REFILL 0xbfc00200
|
||||
#define GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR 0xbfc00300
|
||||
#define GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION 0xbfc00380
|
||||
|
||||
#define GRUB_CPU_LOONGSON_DDR2_BASE 0xaffffe00
|
||||
#define GRUB_CPU_LOONGSON_DDR2_REG1_HI_8BANKS 0x00000001
|
||||
#define GRUB_CPU_LOONGSON_DDR2_REG_SIZE 0x8
|
||||
#define GRUB_CPU_LOONGSON_DDR2_REG_STEP 0x10
|
||||
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG GRUB_CPU_REGISTER_WRAP($16)
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG_ILINESIZE 0x10
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG_DLINESIZE 0x8
|
||||
|
|
|
@ -27,25 +27,6 @@
|
|||
void EXPORT_FUNC (grub_reboot) (void);
|
||||
void EXPORT_FUNC (grub_halt) (void);
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
#define GRUB_PLATFORM_IMAGE_FORMATS "raw, elf"
|
||||
#define GRUB_PLATFORM_IMAGE_DEFAULT_FORMAT "raw"
|
||||
|
||||
#define GRUB_PLATFORM_IMAGE_DEFAULT GRUB_PLATFORM_IMAGE_RAW
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
typedef enum {
|
||||
GRUB_PLATFORM_IMAGE_RAW,
|
||||
GRUB_PLATFORM_IMAGE_ELF
|
||||
}
|
||||
grub_platform_image_format_t;
|
||||
#define GRUB_PLATFORM_IMAGE_RAW GRUB_PLATFORM_IMAGE_RAW
|
||||
#define GRUB_PLATFORM_IMAGE_ELF GRUB_PLATFORM_IMAGE_ELF
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/cpu/kernel.h>
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
|
|
|
@ -265,6 +265,11 @@ grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
|
|||
void EXPORT_FUNC(__enable_execute_stack) (void *addr);
|
||||
#endif
|
||||
|
||||
#if defined (NEED_REGISTER_FRAME_INFO) && !defined(GRUB_UTIL)
|
||||
void EXPORT_FUNC (__register_frame_info) (void);
|
||||
void EXPORT_FUNC (__deregister_frame_info) (void);
|
||||
#endif
|
||||
|
||||
/* Inline functions. */
|
||||
|
||||
static inline unsigned int
|
||||
|
|
|
@ -49,7 +49,7 @@ void grub_multiboot_set_bootdev (void);
|
|||
grub_uint32_t grub_get_multiboot_mmap_count (void);
|
||||
grub_err_t grub_multiboot_set_video_mode (void);
|
||||
|
||||
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
|
||||
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
|
||||
#include <grub/i386/pc/vbe.h>
|
||||
#define GRUB_MACHINE_HAS_VGA_TEXT 1
|
||||
#else
|
||||
|
|
|
@ -96,17 +96,17 @@ void read_handler_list (void);
|
|||
void free_handler_list (void);
|
||||
|
||||
/* Defined in `dyncmd.c'. */
|
||||
void read_command_list (void);
|
||||
void read_command_list (const char *prefix);
|
||||
|
||||
/* Defined in `autofs.c'. */
|
||||
void read_fs_list (void);
|
||||
void read_fs_list (const char *prefix);
|
||||
|
||||
void grub_context_init (void);
|
||||
void grub_context_fini (void);
|
||||
|
||||
void read_crypto_list (void);
|
||||
void read_crypto_list (const char *prefix);
|
||||
|
||||
void read_terminal_list (void);
|
||||
void read_terminal_list (const char *prefix);
|
||||
|
||||
void grub_set_more (int onoff);
|
||||
|
||||
|
|
173
include/grub/offsets.h
Normal file
173
include/grub/offsets.h
Normal file
|
@ -0,0 +1,173 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,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 OFFSETS_HEADER
|
||||
#define OFFSETS_HEADER 1
|
||||
|
||||
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
|
||||
#define GRUB_KERNEL_I386_PC_TOTAL_MODULE_SIZE 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_I386_PC_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
||||
#define GRUB_KERNEL_I386_PC_COMPRESSED_SIZE 0x10
|
||||
|
||||
/* The offset of GRUB_INSTALL_DOS_PART. */
|
||||
#define GRUB_KERNEL_I386_PC_INSTALL_DOS_PART 0x14
|
||||
|
||||
/* The offset of GRUB_INSTALL_BSD_PART. */
|
||||
#define GRUB_KERNEL_I386_PC_INSTALL_BSD_PART 0x18
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_PC_PREFIX 0x1c
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_I386_PC_DATA_END 0x5c
|
||||
|
||||
/* The size of the first region which won't be compressed. */
|
||||
#define GRUB_KERNEL_I386_PC_RAW_SIZE (GRUB_KERNEL_I386_PC_DATA_END + 0x5F0)
|
||||
|
||||
/* The segment where the kernel is loaded. */
|
||||
#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800
|
||||
|
||||
#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x8200
|
||||
|
||||
/* The upper memory area (starting at 640 kiB). */
|
||||
#define GRUB_MEMORY_I386_PC_UPPER 0xa0000
|
||||
#define GRUB_MEMORY_I386_QEMU_UPPER GRUB_MEMORY_I386_PC_UPPER
|
||||
|
||||
/* The offset of GRUB_CORE_ENTRY_ADDR. */
|
||||
#define GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR 0x4
|
||||
|
||||
/* The offset of GRUB_CORE_ENTRY_ADDR. */
|
||||
#define GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_I386_QEMU_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_QEMU_PREFIX 0x10
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_I386_QEMU_DATA_END 0x50
|
||||
|
||||
#define GRUB_KERNEL_I386_QEMU_LINK_ADDR 0x8200
|
||||
|
||||
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_TOTAL_MODULE_SIZE 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_COMPRESSED_SIZE 0x10
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_PREFIX 0x14
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_DATA_END 0x114
|
||||
|
||||
#define GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE 12
|
||||
|
||||
#define GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS 0x4400
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_RAW_SIZE 0
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR 0x4400
|
||||
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_PREFIX 0x4
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_DATA_END 0x44
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ALIGN 4
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR 0x200000
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_LINK_ADDR 0x80200000
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_LINK_ALIGN 32
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE 0x200
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE 0xc
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_KERNEL_IMAGE_SIZE 0x10
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_DATA_END GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE + 0x48
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_EFI_PREFIX 0x8
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_I386_EFI_DATA_END 0x50
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_X86_64_EFI_PREFIX 0x8
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_X86_64_EFI_DATA_END 0x50
|
||||
|
||||
#define GRUB_KERNEL_I386_COREBOOT_PREFIX 0x2
|
||||
#define GRUB_KERNEL_I386_COREBOOT_DATA_END 0x42
|
||||
#define GRUB_KERNEL_I386_COREBOOT_LINK_ADDR 0x8200
|
||||
|
||||
#define GRUB_KERNEL_I386_IEEE1275_PREFIX 0x2
|
||||
#define GRUB_KERNEL_I386_IEEE1275_DATA_END 0x42
|
||||
#define GRUB_KERNEL_I386_IEEE1275_LINK_ADDR 0x10000
|
||||
|
||||
#define GRUB_KERNEL_I386_IEEE1275_MOD_ALIGN 0x1000
|
||||
#define GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN 0x1
|
||||
|
||||
/* Non-zero value is only needed for PowerMacs. */
|
||||
#define GRUB_KERNEL_I386_IEEE1275_MOD_GAP 0x0
|
||||
#define GRUB_KERNEL_I386_COREBOOT_MOD_GAP 0x0
|
||||
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_MOD_ALIGN 0x1
|
||||
|
||||
/* Minimal gap between _end and the start of the modules. It's a hack
|
||||
for PowerMac to prevent "CLAIM failed" error. The real fix is to
|
||||
rewrite grub-mkimage to generate valid ELF files. */
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_GAP 0x8000
|
||||
|
||||
#ifdef MACHINE
|
||||
#define GRUB_OFFSETS_CONCAT_(a,b,c) a ## b ## c
|
||||
#define GRUB_OFFSETS_CONCAT(a,b,c) GRUB_OFFSETS_CONCAT_(a,b,c)
|
||||
#define GRUB_KERNEL_MACHINE_MOD_ALIGN GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _MOD_ALIGN)
|
||||
#define GRUB_KERNEL_MACHINE_MOD_GAP GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _MOD_GAP)
|
||||
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _TOTAL_MODULE_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _KERNEL_IMAGE_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _COMPRESSED_SIZE)
|
||||
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _PREFIX)
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _DATA_END)
|
||||
#define GRUB_BOOT_MACHINE_KERNEL_SEG GRUB_OFFSETS_CONCAT (GRUB_BOOT_, MACHINE, _KERNEL_SEG)
|
||||
#define GRUB_MEMORY_MACHINE_UPPER GRUB_OFFSETS_CONCAT (GRUB_MEMORY_, MACHINE, _UPPER)
|
||||
#define GRUB_KERNEL_MACHINE_RAW_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _RAW_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _INSTALL_BSD_PART)
|
||||
#define GRUB_KERNEL_MACHINE_INSTALL_DOS_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _INSTALL_DOS_PART)
|
||||
#endif
|
||||
|
||||
#ifndef ASM_FILE
|
||||
struct grub_pc_bios_boot_blocklist
|
||||
{
|
||||
grub_uint64_t start;
|
||||
grub_uint16_t len;
|
||||
grub_uint16_t segment;
|
||||
} __attribute__ ((packed));
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -19,14 +19,4 @@
|
|||
#ifndef GRUB_KERNEL_CPU_HEADER
|
||||
#define GRUB_KERNEL_CPU_HEADER 1
|
||||
|
||||
#define GRUB_MOD_ALIGN 0x1000
|
||||
|
||||
/* Minimal gap between _end and the start of the modules. It's a hack
|
||||
for PowerMac to prevent "CLAIM failed" error. The real fix is to
|
||||
rewrite grub-mkimage to generate valid ELF files. */
|
||||
#define GRUB_MOD_GAP 0x8000
|
||||
|
||||
#define GRUB_KERNEL_CPU_PREFIX 0x4
|
||||
#define GRUB_KERNEL_CPU_DATA_END 0x44
|
||||
|
||||
#endif
|
||||
|
|
|
@ -121,6 +121,21 @@ struct grub_script_cmdfor
|
|||
struct grub_script_cmd *list;
|
||||
};
|
||||
|
||||
/* A while/until command. */
|
||||
struct grub_script_cmdwhile
|
||||
{
|
||||
struct grub_script_cmd cmd;
|
||||
|
||||
/* The command list used as condition. */
|
||||
struct grub_script_cmd *cond;
|
||||
|
||||
/* The command list executed in each loop. */
|
||||
struct grub_script_cmd *list;
|
||||
|
||||
/* The flag to indicate this as "until" loop. */
|
||||
int until;
|
||||
};
|
||||
|
||||
/* A menu entry generate statement. */
|
||||
struct grub_script_cmd_menuentry
|
||||
{
|
||||
|
@ -234,6 +249,12 @@ grub_script_create_cmdfor (struct grub_parser_param *state,
|
|||
struct grub_script_arglist *words,
|
||||
struct grub_script_cmd *list);
|
||||
|
||||
struct grub_script_cmd *
|
||||
grub_script_create_cmdwhile (struct grub_parser_param *state,
|
||||
struct grub_script_cmd *cond,
|
||||
struct grub_script_cmd *list,
|
||||
int is_an_until_loop);
|
||||
|
||||
struct grub_script_cmd *
|
||||
grub_script_create_cmdmenu (struct grub_parser_param *state,
|
||||
struct grub_script_arglist *arglist,
|
||||
|
@ -283,6 +304,7 @@ grub_err_t grub_script_execute_cmdline (struct grub_script_cmd *cmd);
|
|||
grub_err_t grub_script_execute_cmdblock (struct grub_script_cmd *cmd);
|
||||
grub_err_t grub_script_execute_cmdif (struct grub_script_cmd *cmd);
|
||||
grub_err_t grub_script_execute_cmdfor (struct grub_script_cmd *cmd);
|
||||
grub_err_t grub_script_execute_cmdwhile (struct grub_script_cmd *cmd);
|
||||
grub_err_t grub_script_execute_menuentry (struct grub_script_cmd *cmd);
|
||||
|
||||
/* Execute any GRUB pre-parsed command or script. */
|
||||
|
|
24
include/grub/sdl.h
Normal file
24
include/grub/sdl.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
void EXPORT_FUNC (SDL_Quit) (void);
|
||||
void EXPORT_FUNC (SDL_SetColors) (void);
|
||||
void EXPORT_FUNC (SDL_Init) (void);
|
||||
void EXPORT_FUNC (SDL_GetError) (void);
|
||||
void EXPORT_FUNC (SDL_Flip) (void);
|
||||
void EXPORT_FUNC (SDL_SetVideoMode) (void);
|
|
@ -45,15 +45,11 @@
|
|||
|
||||
#define GRUB_BOOT_MACHINE_BOOT_DEVPATH_END 0x80
|
||||
|
||||
#define GRUB_BOOT_MACHINE_KERNEL_SECTOR 0x88
|
||||
#define GRUB_BOOT_MACHINE_KERNEL_BYTE 0x80
|
||||
|
||||
#define GRUB_BOOT_MACHINE_CODE_END \
|
||||
(0x1fc - GRUB_BOOT_AOUT_HEADER_SIZE)
|
||||
|
||||
#define GRUB_BOOT_MACHINE_LIST_SIZE 12
|
||||
|
||||
#define GRUB_BOOT_MACHINE_IMAGE_ADDRESS 0x4400
|
||||
|
||||
#define GRUB_BOOT_MACHINE_KERNEL_ADDR 0x4200
|
||||
|
||||
#endif /* ! BOOT_MACHINE_HEADER */
|
||||
|
|
|
@ -19,44 +19,10 @@
|
|||
#ifndef GRUB_KERNEL_MACHINE_HEADER
|
||||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
#define GRUB_MOD_ALIGN 0x2000
|
||||
|
||||
/* Non-zero value is only needed for PowerMacs. */
|
||||
#define GRUB_MOD_GAP 0x0
|
||||
|
||||
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE 0x10
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x14
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x114
|
||||
|
||||
#define GRUB_KERNEL_MACHINE_RAW_SIZE 0
|
||||
#define GRUB_KERNEL_MACHINE_STACK_SIZE 0x40000
|
||||
|
||||
#define GRUB_PLATFORM_IMAGE_FORMATS "raw, aout"
|
||||
#define GRUB_PLATFORM_IMAGE_DEFAULT_FORMAT "raw"
|
||||
|
||||
#define GRUB_PLATFORM_IMAGE_DEFAULT GRUB_PLATFORM_IMAGE_RAW
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
typedef enum {
|
||||
GRUB_PLATFORM_IMAGE_RAW,
|
||||
GRUB_PLATFORM_IMAGE_AOUT
|
||||
}
|
||||
grub_platform_image_format_t;
|
||||
#define GRUB_PLATFORM_IMAGE_RAW GRUB_PLATFORM_IMAGE_RAW
|
||||
#define GRUB_PLATFORM_IMAGE_AOUT GRUB_PLATFORM_IMAGE_AOUT
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
|
@ -66,10 +32,6 @@ extern grub_int32_t grub_kernel_image_size;
|
|||
/* The total size of module images following the kernel. */
|
||||
extern grub_int32_t grub_total_module_size;
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
||||
|
|
|
@ -178,21 +178,6 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
|
|||
# define grub_be_to_cpu16(x) ((grub_uint16_t) (x))
|
||||
# define grub_be_to_cpu32(x) ((grub_uint32_t) (x))
|
||||
# define grub_be_to_cpu64(x) ((grub_uint64_t) (x))
|
||||
# ifdef GRUB_TARGET_WORDS_BIGENDIAN
|
||||
# define grub_target_to_host16(x) ((grub_uint16_t) (x))
|
||||
# define grub_target_to_host32(x) ((grub_uint32_t) (x))
|
||||
# define grub_target_to_host64(x) ((grub_uint64_t) (x))
|
||||
# define grub_host_to_target16(x) ((grub_uint16_t) (x))
|
||||
# define grub_host_to_target32(x) ((grub_uint32_t) (x))
|
||||
# define grub_host_to_target64(x) ((grub_uint64_t) (x))
|
||||
# else /* ! GRUB_TARGET_WORDS_BIGENDIAN */
|
||||
# define grub_target_to_host16(x) grub_swap_bytes16(x)
|
||||
# define grub_target_to_host32(x) grub_swap_bytes32(x)
|
||||
# define grub_target_to_host64(x) grub_swap_bytes64(x)
|
||||
# define grub_host_to_target16(x) grub_swap_bytes16(x)
|
||||
# define grub_host_to_target32(x) grub_swap_bytes32(x)
|
||||
# define grub_host_to_target64(x) grub_swap_bytes64(x)
|
||||
# endif
|
||||
#else /* ! WORDS_BIGENDIAN */
|
||||
# define grub_cpu_to_le16(x) ((grub_uint16_t) (x))
|
||||
# define grub_cpu_to_le32(x) ((grub_uint32_t) (x))
|
||||
|
@ -206,27 +191,6 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
|
|||
# define grub_be_to_cpu16(x) grub_swap_bytes16(x)
|
||||
# define grub_be_to_cpu32(x) grub_swap_bytes32(x)
|
||||
# define grub_be_to_cpu64(x) grub_swap_bytes64(x)
|
||||
# ifdef GRUB_TARGET_WORDS_BIGENDIAN
|
||||
# define grub_target_to_host16(x) grub_swap_bytes16(x)
|
||||
# define grub_target_to_host32(x) grub_swap_bytes32(x)
|
||||
# define grub_target_to_host64(x) grub_swap_bytes64(x)
|
||||
# define grub_host_to_target16(x) grub_swap_bytes16(x)
|
||||
# define grub_host_to_target32(x) grub_swap_bytes32(x)
|
||||
# define grub_host_to_target64(x) grub_swap_bytes64(x)
|
||||
# else /* ! GRUB_TARGET_WORDS_BIGENDIAN */
|
||||
# define grub_target_to_host16(x) ((grub_uint16_t) (x))
|
||||
# define grub_target_to_host32(x) ((grub_uint32_t) (x))
|
||||
# define grub_target_to_host64(x) ((grub_uint64_t) (x))
|
||||
# define grub_host_to_target16(x) ((grub_uint16_t) (x))
|
||||
# define grub_host_to_target32(x) ((grub_uint32_t) (x))
|
||||
# define grub_host_to_target64(x) ((grub_uint64_t) (x))
|
||||
# endif
|
||||
#endif /* ! WORDS_BIGENDIAN */
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 8
|
||||
# define grub_host_to_target_addr(x) grub_host_to_target64(x)
|
||||
#else
|
||||
# define grub_host_to_target_addr(x) grub_host_to_target32(x)
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_TYPES_HEADER */
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue