2009-03-22 Vladimir Serbinenko <phcoder@gmail.com>
Move multiboot helper out of kernel * conf/i386-pc.rmk (multiboot_mod_SOURCES): Add `loader/i386/multiboot_helper.S'. * conf/i386-coreboot.rmk: Likewise * conf/i386-ieee1275.rmk: Likewise * kern/i386/loader.S: Move multiboot helpers from here... * loader/i386/multiboot_helper.S: ...moved here * include/grub/i386/loader.h: Move declarations of multiboot helpers from here... * include/grub/i386/multiboot.h: ...moved here * loader/i386/multiboot.c: Added include of grub/cpu/multiboot.h
This commit is contained in:
parent
42a5b3fcc7
commit
c04d6e0548
15 changed files with 260 additions and 134 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
2009-03-22 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Move multiboot helper out of kernel
|
||||
|
||||
* conf/i386-pc.rmk (multiboot_mod_SOURCES): Add
|
||||
`loader/i386/multiboot_helper.S'.
|
||||
* conf/i386-coreboot.rmk: Likewise
|
||||
* conf/i386-ieee1275.rmk: Likewise
|
||||
|
||||
* kern/i386/loader.S: Move multiboot helpers from here...
|
||||
* loader/i386/multiboot_helper.S: ...moved here
|
||||
* include/grub/i386/loader.h: Move declarations of multiboot
|
||||
helpers from here...
|
||||
* include/grub/i386/multiboot.h: ...moved here
|
||||
* loader/i386/multiboot.c: Added include of grub/cpu/multiboot.h
|
||||
|
||||
2009-03-22 Yoshinori K. Okuji <okuji@enbug.org>
|
||||
|
||||
* kern/env.c (grub_env_context_open): Added an argument to specify
|
||||
|
|
2
DISTLIST
2
DISTLIST
|
@ -214,6 +214,7 @@ include/grub/i386/io.h
|
|||
include/grub/i386/kernel.h
|
||||
include/grub/i386/linux.h
|
||||
include/grub/i386/loader.h
|
||||
include/grub/i386/multiboot.h
|
||||
include/grub/i386/pci.h
|
||||
include/grub/i386/pit.h
|
||||
include/grub/i386/reboot.h
|
||||
|
@ -393,6 +394,7 @@ loader/i386/bsd.c
|
|||
loader/i386/linux.c
|
||||
loader/i386/multiboot.c
|
||||
loader/i386/multiboot_elfxx.c
|
||||
loader/i386/multiboot_helper.S
|
||||
loader/i386/efi/linux.c
|
||||
loader/i386/ieee1275/linux.c
|
||||
loader/i386/pc/chainloader.c
|
||||
|
|
|
@ -1257,15 +1257,16 @@ serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|||
|
||||
# For multiboot.mod.
|
||||
multiboot_mod_SOURCES = loader/i386/multiboot.c \
|
||||
loader/i386/multiboot_helper.S \
|
||||
loader/i386/pc/multiboot2.c \
|
||||
loader/multiboot2.c \
|
||||
loader/multiboot_loader.c
|
||||
CLEANFILES += multiboot.mod mod-multiboot.o mod-multiboot.c pre-multiboot.o multiboot_mod-loader_i386_multiboot.o multiboot_mod-loader_i386_pc_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o und-multiboot.lst
|
||||
CLEANFILES += multiboot.mod mod-multiboot.o mod-multiboot.c pre-multiboot.o multiboot_mod-loader_i386_multiboot.o multiboot_mod-loader_i386_multiboot_helper.o multiboot_mod-loader_i386_pc_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o und-multiboot.lst
|
||||
ifneq ($(multiboot_mod_EXPORTS),no)
|
||||
CLEANFILES += def-multiboot.lst
|
||||
DEFSYMFILES += def-multiboot.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += multiboot_mod-loader_i386_multiboot.d multiboot_mod-loader_i386_pc_multiboot2.d multiboot_mod-loader_multiboot2.d multiboot_mod-loader_multiboot_loader.d
|
||||
MOSTLYCLEANFILES += multiboot_mod-loader_i386_multiboot.d multiboot_mod-loader_i386_multiboot_helper.d multiboot_mod-loader_i386_pc_multiboot2.d multiboot_mod-loader_multiboot2.d multiboot_mod-loader_multiboot_loader.d
|
||||
UNDSYMFILES += und-multiboot.lst
|
||||
|
||||
multiboot.mod: pre-multiboot.o mod-multiboot.o $(TARGET_OBJ2ELF)
|
||||
|
@ -1274,9 +1275,9 @@ multiboot.mod: pre-multiboot.o mod-multiboot.o $(TARGET_OBJ2ELF)
|
|||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-multiboot.o: $(multiboot_mod_DEPENDENCIES) multiboot_mod-loader_i386_multiboot.o multiboot_mod-loader_i386_pc_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o
|
||||
pre-multiboot.o: $(multiboot_mod_DEPENDENCIES) multiboot_mod-loader_i386_multiboot.o multiboot_mod-loader_i386_multiboot_helper.o multiboot_mod-loader_i386_pc_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(multiboot_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ multiboot_mod-loader_i386_multiboot.o multiboot_mod-loader_i386_pc_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o
|
||||
$(TARGET_CC) $(multiboot_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ multiboot_mod-loader_i386_multiboot.o multiboot_mod-loader_i386_multiboot_helper.o multiboot_mod-loader_i386_pc_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o
|
||||
|
||||
mod-multiboot.o: mod-multiboot.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1312,6 +1313,25 @@ partmap-multiboot_mod-loader_i386_multiboot.lst: loader/i386/multiboot.c $(loade
|
|||
set -e; $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh multiboot > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
multiboot_mod-loader_i386_multiboot_helper.o: loader/i386/multiboot_helper.S $(loader/i386/multiboot_helper.S_DEPENDENCIES)
|
||||
$(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) -DASM_FILE=1 $(TARGET_ASFLAGS) $(multiboot_mod_ASFLAGS) -MD -c -o $@ $<
|
||||
-include multiboot_mod-loader_i386_multiboot_helper.d
|
||||
|
||||
CLEANFILES += cmd-multiboot_mod-loader_i386_multiboot_helper.lst fs-multiboot_mod-loader_i386_multiboot_helper.lst partmap-multiboot_mod-loader_i386_multiboot_helper.lst
|
||||
COMMANDFILES += cmd-multiboot_mod-loader_i386_multiboot_helper.lst
|
||||
FSFILES += fs-multiboot_mod-loader_i386_multiboot_helper.lst
|
||||
PARTMAPFILES += partmap-multiboot_mod-loader_i386_multiboot_helper.lst
|
||||
|
||||
cmd-multiboot_mod-loader_i386_multiboot_helper.lst: loader/i386/multiboot_helper.S $(loader/i386/multiboot_helper.S_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) $(multiboot_mod_ASFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh multiboot > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-multiboot_mod-loader_i386_multiboot_helper.lst: loader/i386/multiboot_helper.S $(loader/i386/multiboot_helper.S_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) $(multiboot_mod_ASFLAGS) -E $< | sh $(srcdir)/genfslist.sh multiboot > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-multiboot_mod-loader_i386_multiboot_helper.lst: loader/i386/multiboot_helper.S $(loader/i386/multiboot_helper.S_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) $(multiboot_mod_ASFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh multiboot > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
multiboot_mod-loader_i386_pc_multiboot2.o: loader/i386/pc/multiboot2.c $(loader/i386/pc/multiboot2.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Iloader/i386/pc -I$(srcdir)/loader/i386/pc $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include multiboot_mod-loader_i386_pc_multiboot2.d
|
||||
|
@ -1371,6 +1391,7 @@ partmap-multiboot_mod-loader_multiboot_loader.lst: loader/multiboot_loader.c $(l
|
|||
|
||||
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
||||
# For aout.mod.
|
||||
aout_mod_SOURCES = loader/aout.c
|
||||
|
|
|
@ -145,11 +145,13 @@ serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|||
|
||||
# For multiboot.mod.
|
||||
multiboot_mod_SOURCES = loader/i386/multiboot.c \
|
||||
loader/i386/multiboot_helper.S \
|
||||
loader/i386/pc/multiboot2.c \
|
||||
loader/multiboot2.c \
|
||||
loader/multiboot_loader.c
|
||||
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
||||
# For aout.mod.
|
||||
aout_mod_SOURCES = loader/aout.c
|
||||
|
|
|
@ -1001,14 +1001,15 @@ normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|||
|
||||
# For multiboot.mod.
|
||||
multiboot_mod_SOURCES = loader/ieee1275/multiboot2.c \
|
||||
loader/i386/multiboot_helper.S \
|
||||
loader/multiboot2.c \
|
||||
loader/multiboot_loader.c
|
||||
CLEANFILES += multiboot.mod mod-multiboot.o mod-multiboot.c pre-multiboot.o multiboot_mod-loader_ieee1275_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o und-multiboot.lst
|
||||
CLEANFILES += multiboot.mod mod-multiboot.o mod-multiboot.c pre-multiboot.o multiboot_mod-loader_ieee1275_multiboot2.o multiboot_mod-loader_i386_multiboot_helper.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o und-multiboot.lst
|
||||
ifneq ($(multiboot_mod_EXPORTS),no)
|
||||
CLEANFILES += def-multiboot.lst
|
||||
DEFSYMFILES += def-multiboot.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += multiboot_mod-loader_ieee1275_multiboot2.d multiboot_mod-loader_multiboot2.d multiboot_mod-loader_multiboot_loader.d
|
||||
MOSTLYCLEANFILES += multiboot_mod-loader_ieee1275_multiboot2.d multiboot_mod-loader_i386_multiboot_helper.d multiboot_mod-loader_multiboot2.d multiboot_mod-loader_multiboot_loader.d
|
||||
UNDSYMFILES += und-multiboot.lst
|
||||
|
||||
multiboot.mod: pre-multiboot.o mod-multiboot.o $(TARGET_OBJ2ELF)
|
||||
|
@ -1017,9 +1018,9 @@ multiboot.mod: pre-multiboot.o mod-multiboot.o $(TARGET_OBJ2ELF)
|
|||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-multiboot.o: $(multiboot_mod_DEPENDENCIES) multiboot_mod-loader_ieee1275_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o
|
||||
pre-multiboot.o: $(multiboot_mod_DEPENDENCIES) multiboot_mod-loader_ieee1275_multiboot2.o multiboot_mod-loader_i386_multiboot_helper.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(multiboot_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ multiboot_mod-loader_ieee1275_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o
|
||||
$(TARGET_CC) $(multiboot_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ multiboot_mod-loader_ieee1275_multiboot2.o multiboot_mod-loader_i386_multiboot_helper.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o
|
||||
|
||||
mod-multiboot.o: mod-multiboot.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1055,6 +1056,25 @@ partmap-multiboot_mod-loader_ieee1275_multiboot2.lst: loader/ieee1275/multiboot2
|
|||
set -e; $(TARGET_CC) -Iloader/ieee1275 -I$(srcdir)/loader/ieee1275 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh multiboot > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
multiboot_mod-loader_i386_multiboot_helper.o: loader/i386/multiboot_helper.S $(loader/i386/multiboot_helper.S_DEPENDENCIES)
|
||||
$(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) -DASM_FILE=1 $(TARGET_ASFLAGS) $(multiboot_mod_ASFLAGS) -MD -c -o $@ $<
|
||||
-include multiboot_mod-loader_i386_multiboot_helper.d
|
||||
|
||||
CLEANFILES += cmd-multiboot_mod-loader_i386_multiboot_helper.lst fs-multiboot_mod-loader_i386_multiboot_helper.lst partmap-multiboot_mod-loader_i386_multiboot_helper.lst
|
||||
COMMANDFILES += cmd-multiboot_mod-loader_i386_multiboot_helper.lst
|
||||
FSFILES += fs-multiboot_mod-loader_i386_multiboot_helper.lst
|
||||
PARTMAPFILES += partmap-multiboot_mod-loader_i386_multiboot_helper.lst
|
||||
|
||||
cmd-multiboot_mod-loader_i386_multiboot_helper.lst: loader/i386/multiboot_helper.S $(loader/i386/multiboot_helper.S_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) $(multiboot_mod_ASFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh multiboot > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-multiboot_mod-loader_i386_multiboot_helper.lst: loader/i386/multiboot_helper.S $(loader/i386/multiboot_helper.S_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) $(multiboot_mod_ASFLAGS) -E $< | sh $(srcdir)/genfslist.sh multiboot > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-multiboot_mod-loader_i386_multiboot_helper.lst: loader/i386/multiboot_helper.S $(loader/i386/multiboot_helper.S_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) $(multiboot_mod_ASFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh multiboot > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
multiboot_mod-loader_multiboot2.o: loader/multiboot2.c $(loader/multiboot2.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Iloader -I$(srcdir)/loader $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include multiboot_mod-loader_multiboot2.d
|
||||
|
@ -1095,6 +1115,7 @@ partmap-multiboot_mod-loader_multiboot_loader.lst: loader/multiboot_loader.c $(l
|
|||
|
||||
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
||||
# For aout.mod.
|
||||
aout_mod_SOURCES = loader/aout.c
|
||||
|
|
|
@ -127,10 +127,12 @@ normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|||
|
||||
# For multiboot.mod.
|
||||
multiboot_mod_SOURCES = loader/ieee1275/multiboot2.c \
|
||||
loader/i386/multiboot_helper.S \
|
||||
loader/multiboot2.c \
|
||||
loader/multiboot_loader.c
|
||||
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
||||
# For aout.mod.
|
||||
aout_mod_SOURCES = loader/aout.c
|
||||
|
|
|
@ -1720,15 +1720,16 @@ serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|||
|
||||
# For multiboot.mod.
|
||||
multiboot_mod_SOURCES = loader/i386/multiboot.c \
|
||||
loader/i386/multiboot_helper.S \
|
||||
loader/i386/pc/multiboot2.c \
|
||||
loader/multiboot2.c \
|
||||
loader/multiboot_loader.c
|
||||
CLEANFILES += multiboot.mod mod-multiboot.o mod-multiboot.c pre-multiboot.o multiboot_mod-loader_i386_multiboot.o multiboot_mod-loader_i386_pc_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o und-multiboot.lst
|
||||
CLEANFILES += multiboot.mod mod-multiboot.o mod-multiboot.c pre-multiboot.o multiboot_mod-loader_i386_multiboot.o multiboot_mod-loader_i386_multiboot_helper.o multiboot_mod-loader_i386_pc_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o und-multiboot.lst
|
||||
ifneq ($(multiboot_mod_EXPORTS),no)
|
||||
CLEANFILES += def-multiboot.lst
|
||||
DEFSYMFILES += def-multiboot.lst
|
||||
endif
|
||||
MOSTLYCLEANFILES += multiboot_mod-loader_i386_multiboot.d multiboot_mod-loader_i386_pc_multiboot2.d multiboot_mod-loader_multiboot2.d multiboot_mod-loader_multiboot_loader.d
|
||||
MOSTLYCLEANFILES += multiboot_mod-loader_i386_multiboot.d multiboot_mod-loader_i386_multiboot_helper.d multiboot_mod-loader_i386_pc_multiboot2.d multiboot_mod-loader_multiboot2.d multiboot_mod-loader_multiboot_loader.d
|
||||
UNDSYMFILES += und-multiboot.lst
|
||||
|
||||
multiboot.mod: pre-multiboot.o mod-multiboot.o $(TARGET_OBJ2ELF)
|
||||
|
@ -1737,9 +1738,9 @@ multiboot.mod: pre-multiboot.o mod-multiboot.o $(TARGET_OBJ2ELF)
|
|||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-multiboot.o: $(multiboot_mod_DEPENDENCIES) multiboot_mod-loader_i386_multiboot.o multiboot_mod-loader_i386_pc_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o
|
||||
pre-multiboot.o: $(multiboot_mod_DEPENDENCIES) multiboot_mod-loader_i386_multiboot.o multiboot_mod-loader_i386_multiboot_helper.o multiboot_mod-loader_i386_pc_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(multiboot_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ multiboot_mod-loader_i386_multiboot.o multiboot_mod-loader_i386_pc_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o
|
||||
$(TARGET_CC) $(multiboot_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ multiboot_mod-loader_i386_multiboot.o multiboot_mod-loader_i386_multiboot_helper.o multiboot_mod-loader_i386_pc_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o
|
||||
|
||||
mod-multiboot.o: mod-multiboot.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1775,6 +1776,25 @@ partmap-multiboot_mod-loader_i386_multiboot.lst: loader/i386/multiboot.c $(loade
|
|||
set -e; $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh multiboot > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
multiboot_mod-loader_i386_multiboot_helper.o: loader/i386/multiboot_helper.S $(loader/i386/multiboot_helper.S_DEPENDENCIES)
|
||||
$(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) -DASM_FILE=1 $(TARGET_ASFLAGS) $(multiboot_mod_ASFLAGS) -MD -c -o $@ $<
|
||||
-include multiboot_mod-loader_i386_multiboot_helper.d
|
||||
|
||||
CLEANFILES += cmd-multiboot_mod-loader_i386_multiboot_helper.lst fs-multiboot_mod-loader_i386_multiboot_helper.lst partmap-multiboot_mod-loader_i386_multiboot_helper.lst
|
||||
COMMANDFILES += cmd-multiboot_mod-loader_i386_multiboot_helper.lst
|
||||
FSFILES += fs-multiboot_mod-loader_i386_multiboot_helper.lst
|
||||
PARTMAPFILES += partmap-multiboot_mod-loader_i386_multiboot_helper.lst
|
||||
|
||||
cmd-multiboot_mod-loader_i386_multiboot_helper.lst: loader/i386/multiboot_helper.S $(loader/i386/multiboot_helper.S_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) $(multiboot_mod_ASFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh multiboot > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-multiboot_mod-loader_i386_multiboot_helper.lst: loader/i386/multiboot_helper.S $(loader/i386/multiboot_helper.S_DEPENDENCIES) genfslist.sh
|
||||
set -e; $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) $(multiboot_mod_ASFLAGS) -E $< | sh $(srcdir)/genfslist.sh multiboot > $@ || (rm -f $@; exit 1)
|
||||
|
||||
partmap-multiboot_mod-loader_i386_multiboot_helper.lst: loader/i386/multiboot_helper.S $(loader/i386/multiboot_helper.S_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) $(multiboot_mod_ASFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh multiboot > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
multiboot_mod-loader_i386_pc_multiboot2.o: loader/i386/pc/multiboot2.c $(loader/i386/pc/multiboot2.c_DEPENDENCIES)
|
||||
$(TARGET_CC) -Iloader/i386/pc -I$(srcdir)/loader/i386/pc $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -MD -c -o $@ $<
|
||||
-include multiboot_mod-loader_i386_pc_multiboot2.d
|
||||
|
@ -1834,6 +1854,7 @@ partmap-multiboot_mod-loader_multiboot_loader.lst: loader/multiboot_loader.c $(l
|
|||
|
||||
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
||||
# For vbe.mod.
|
||||
vbe_mod_SOURCES = video/i386/pc/vbe.c video/i386/pc/vbeblit.c \
|
||||
|
|
|
@ -228,11 +228,13 @@ serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|||
|
||||
# For multiboot.mod.
|
||||
multiboot_mod_SOURCES = loader/i386/multiboot.c \
|
||||
loader/i386/multiboot_helper.S \
|
||||
loader/i386/pc/multiboot2.c \
|
||||
loader/multiboot2.c \
|
||||
loader/multiboot_loader.c
|
||||
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
||||
# For vbe.mod.
|
||||
vbe_mod_SOURCES = video/i386/pc/vbe.c video/i386/pc/vbeblit.c \
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,2007,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2003,2004,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -22,7 +22,6 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/multiboot.h>
|
||||
|
||||
extern grub_uint32_t EXPORT_VAR(grub_linux_prot_size);
|
||||
extern char *EXPORT_VAR(grub_linux_tmp_addr);
|
||||
|
@ -33,26 +32,7 @@ extern grub_size_t EXPORT_VAR(grub_os_area_size);
|
|||
|
||||
grub_err_t EXPORT_FUNC(grub_linux_boot) (void);
|
||||
|
||||
/* The asm part of the multiboot loader. */
|
||||
void EXPORT_FUNC(grub_multiboot_real_boot) (grub_addr_t entry,
|
||||
struct grub_multiboot_info *mbi)
|
||||
__attribute__ ((noreturn));
|
||||
void EXPORT_FUNC(grub_multiboot2_real_boot) (grub_addr_t entry,
|
||||
struct grub_multiboot_info *mbi)
|
||||
__attribute__ ((noreturn));
|
||||
void EXPORT_FUNC(grub_unix_real_boot) (grub_addr_t entry, ...)
|
||||
__attribute__ ((cdecl,noreturn));
|
||||
|
||||
extern grub_addr_t EXPORT_VAR(grub_multiboot_payload_orig);
|
||||
extern grub_addr_t EXPORT_VAR(grub_multiboot_payload_dest);
|
||||
extern grub_size_t EXPORT_VAR(grub_multiboot_payload_size);
|
||||
extern grub_uint32_t EXPORT_VAR(grub_multiboot_payload_entry_offset);
|
||||
|
||||
extern grub_uint8_t EXPORT_VAR(grub_multiboot_forward_relocator);
|
||||
extern grub_uint8_t EXPORT_VAR(grub_multiboot_forward_relocator_end);
|
||||
extern grub_uint8_t EXPORT_VAR(grub_multiboot_backward_relocator);
|
||||
extern grub_uint8_t EXPORT_VAR(grub_multiboot_backward_relocator_end);
|
||||
|
||||
#define RELOCATOR_SIZEOF(x) (&grub_multiboot_##x##_relocator_end - &grub_multiboot_##x##_relocator)
|
||||
|
||||
#endif /* ! GRUB_LOADER_CPU_HEADER */
|
||||
|
|
42
include/grub/i386/multiboot.h
Normal file
42
include/grub/i386/multiboot.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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_MULTIBOOT_CPU_HEADER
|
||||
#define GRUB_MULTIBOOT_CPU_HEADER 1
|
||||
|
||||
/* The asm part of the multiboot loader. */
|
||||
void grub_multiboot_real_boot (grub_addr_t entry,
|
||||
struct grub_multiboot_info *mbi)
|
||||
__attribute__ ((noreturn));
|
||||
void grub_multiboot2_real_boot (grub_addr_t entry,
|
||||
struct grub_multiboot_info *mbi)
|
||||
__attribute__ ((noreturn));
|
||||
|
||||
extern grub_addr_t grub_multiboot_payload_orig;
|
||||
extern grub_addr_t grub_multiboot_payload_dest;
|
||||
extern grub_size_t grub_multiboot_payload_size;
|
||||
extern grub_uint32_t grub_multiboot_payload_entry_offset;
|
||||
|
||||
extern grub_uint8_t grub_multiboot_forward_relocator;
|
||||
extern grub_uint8_t grub_multiboot_forward_relocator_end;
|
||||
extern grub_uint8_t grub_multiboot_backward_relocator;
|
||||
extern grub_uint8_t grub_multiboot_backward_relocator_end;
|
||||
|
||||
#define RELOCATOR_SIZEOF(x) (&grub_multiboot_##x##_relocator_end - &grub_multiboot_##x##_relocator)
|
||||
|
||||
#endif /* ! GRUB_MULTIBOOT_CPU_HEADER */
|
|
@ -146,6 +146,7 @@ grub_machine_fini (void)
|
|||
{
|
||||
grub_at_keyboard_fini ();
|
||||
grub_vga_text_fini ();
|
||||
grub_stop_floppy ();
|
||||
}
|
||||
|
||||
/* Return the end of the core image. */
|
||||
|
|
|
@ -118,106 +118,6 @@ linux_setup_seg:
|
|||
.word 0
|
||||
.code32
|
||||
|
||||
|
||||
/*
|
||||
* This starts the multiboot kernel.
|
||||
*/
|
||||
|
||||
VARIABLE(grub_multiboot_payload_size)
|
||||
.long 0
|
||||
VARIABLE(grub_multiboot_payload_orig)
|
||||
.long 0
|
||||
VARIABLE(grub_multiboot_payload_dest)
|
||||
.long 0
|
||||
VARIABLE(grub_multiboot_payload_entry_offset)
|
||||
.long 0
|
||||
|
||||
/*
|
||||
* The relocators below understand the following parameters:
|
||||
* ecx: Size of the block to be copied.
|
||||
* esi: Where to copy from (always lowest address, even if we're relocating
|
||||
* backwards).
|
||||
* edi: Where to copy to (likewise).
|
||||
* edx: Offset of the entry point (relative to the beginning of the block).
|
||||
*/
|
||||
VARIABLE(grub_multiboot_forward_relocator)
|
||||
/* Add entry offset. */
|
||||
addl %edi, %edx
|
||||
|
||||
/* Forward copy. */
|
||||
cld
|
||||
rep
|
||||
movsb
|
||||
|
||||
jmp *%edx
|
||||
VARIABLE(grub_multiboot_forward_relocator_end)
|
||||
|
||||
VARIABLE(grub_multiboot_backward_relocator)
|
||||
/* Add entry offset (before %edi is mangled). */
|
||||
addl %edi, %edx
|
||||
|
||||
/* Backward movsb is implicitly off-by-one. compensate that. */
|
||||
decl %esi
|
||||
decl %edi
|
||||
|
||||
/* Backward copy. */
|
||||
std
|
||||
addl %ecx, %esi
|
||||
addl %ecx, %edi
|
||||
rep
|
||||
movsb
|
||||
|
||||
jmp *%edx
|
||||
VARIABLE(grub_multiboot_backward_relocator_end)
|
||||
|
||||
FUNCTION(grub_multiboot_real_boot)
|
||||
/* Push the entry address on the stack. */
|
||||
pushl %eax
|
||||
/* Move the address of the multiboot information structure to ebx. */
|
||||
movl %edx,%ebx
|
||||
|
||||
/* Unload all modules and stop the floppy driver. */
|
||||
call EXT_C(grub_dl_unload_all)
|
||||
call EXT_C(grub_stop_floppy)
|
||||
|
||||
/* Interrupts should be disabled. */
|
||||
cli
|
||||
|
||||
/* Where do we copy what from. */
|
||||
movl EXT_C(grub_multiboot_payload_size), %ecx
|
||||
movl EXT_C(grub_multiboot_payload_orig), %esi
|
||||
movl EXT_C(grub_multiboot_payload_dest), %edi
|
||||
movl EXT_C(grub_multiboot_payload_entry_offset), %edx
|
||||
|
||||
/* Move the magic value into eax. */
|
||||
movl $MULTIBOOT_MAGIC2, %eax
|
||||
|
||||
/* Jump to the relocator. */
|
||||
popl %ebp
|
||||
jmp *%ebp
|
||||
|
||||
/*
|
||||
* This starts the multiboot 2 kernel.
|
||||
*/
|
||||
|
||||
FUNCTION(grub_multiboot2_real_boot)
|
||||
/* Push the entry address on the stack. */
|
||||
pushl %eax
|
||||
/* Move the address of the multiboot information structure to ebx. */
|
||||
movl %edx,%ebx
|
||||
|
||||
/* Unload all modules and stop the floppy driver. */
|
||||
call EXT_C(grub_dl_unload_all)
|
||||
call EXT_C(grub_stop_floppy)
|
||||
|
||||
/* Interrupts should be disabled. */
|
||||
cli
|
||||
|
||||
/* Move the magic value into eax and jump to the kernel. */
|
||||
movl $MULTIBOOT2_BOOTLOADER_MAGIC,%eax
|
||||
popl %ecx
|
||||
jmp *%ecx
|
||||
|
||||
/*
|
||||
* Use cdecl calling convention for *BSD kernels.
|
||||
*/
|
||||
|
@ -225,7 +125,6 @@ FUNCTION(grub_multiboot2_real_boot)
|
|||
FUNCTION(grub_unix_real_boot)
|
||||
|
||||
call EXT_C(grub_dl_unload_all)
|
||||
call EXT_C(grub_stop_floppy)
|
||||
|
||||
/* Interrupts should be disabled. */
|
||||
cli
|
||||
|
|
|
@ -223,6 +223,7 @@ void
|
|||
grub_machine_fini (void)
|
||||
{
|
||||
grub_console_fini ();
|
||||
grub_stop_floppy ();
|
||||
}
|
||||
|
||||
/* Return the end of the core image. */
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <grub/multiboot.h>
|
||||
#include <grub/machine/init.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/cpu/multiboot.h>
|
||||
#include <grub/elf.h>
|
||||
#include <grub/aout.h>
|
||||
#include <grub/file.h>
|
||||
|
|
115
loader/i386/multiboot_helper.S
Normal file
115
loader/i386/multiboot_helper.S
Normal file
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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/symbol.h>
|
||||
#include <multiboot.h>
|
||||
#include <multiboot2.h>
|
||||
|
||||
.p2align 2 /* force 4-byte alignment */
|
||||
|
||||
/*
|
||||
* This starts the multiboot kernel.
|
||||
*/
|
||||
|
||||
VARIABLE(grub_multiboot_payload_size)
|
||||
.long 0
|
||||
VARIABLE(grub_multiboot_payload_orig)
|
||||
.long 0
|
||||
VARIABLE(grub_multiboot_payload_dest)
|
||||
.long 0
|
||||
VARIABLE(grub_multiboot_payload_entry_offset)
|
||||
.long 0
|
||||
|
||||
/*
|
||||
* The relocators below understand the following parameters:
|
||||
* ecx: Size of the block to be copied.
|
||||
* esi: Where to copy from (always lowest address, even if we're relocating
|
||||
* backwards).
|
||||
* edi: Where to copy to (likewise).
|
||||
* edx: Offset of the entry point (relative to the beginning of the block).
|
||||
*/
|
||||
|
||||
VARIABLE(grub_multiboot_forward_relocator)
|
||||
/* Add entry offset. */
|
||||
addl %edi, %edx
|
||||
|
||||
/* Forward copy. */
|
||||
cld
|
||||
rep
|
||||
movsb
|
||||
|
||||
jmp *%edx
|
||||
VARIABLE(grub_multiboot_forward_relocator_end)
|
||||
|
||||
VARIABLE(grub_multiboot_backward_relocator)
|
||||
/* Add entry offset (before %edi is mangled). */
|
||||
addl %edi, %edx
|
||||
|
||||
/* Backward movsb is implicitly off-by-one. compensate that. */
|
||||
decl %esi
|
||||
decl %edi
|
||||
|
||||
/* Backward copy. */
|
||||
std
|
||||
addl %ecx, %esi
|
||||
addl %ecx, %edi
|
||||
rep
|
||||
movsb
|
||||
|
||||
jmp *%edx
|
||||
VARIABLE(grub_multiboot_backward_relocator_end)
|
||||
|
||||
FUNCTION(grub_multiboot_real_boot)
|
||||
/* Push the entry address on the stack. */
|
||||
pushl %eax
|
||||
/* Move the address of the multiboot information structure to ebx. */
|
||||
movl %edx,%ebx
|
||||
|
||||
/* Interrupts should be disabled. */
|
||||
cli
|
||||
|
||||
/* Where do we copy what from. */
|
||||
movl EXT_C(grub_multiboot_payload_size), %ecx
|
||||
movl EXT_C(grub_multiboot_payload_orig), %esi
|
||||
movl EXT_C(grub_multiboot_payload_dest), %edi
|
||||
movl EXT_C(grub_multiboot_payload_entry_offset), %edx
|
||||
|
||||
/* Move the magic value into eax. */
|
||||
movl $MULTIBOOT_MAGIC2, %eax
|
||||
|
||||
/* Jump to the relocator. */
|
||||
popl %ebp
|
||||
jmp *%ebp
|
||||
|
||||
/*
|
||||
* This starts the multiboot 2 kernel.
|
||||
*/
|
||||
|
||||
FUNCTION(grub_multiboot2_real_boot)
|
||||
/* Push the entry address on the stack. */
|
||||
pushl %eax
|
||||
/* Move the address of the multiboot information structure to ebx. */
|
||||
movl %edx,%ebx
|
||||
|
||||
/* Interrupts should be disabled. */
|
||||
cli
|
||||
|
||||
/* Move the magic value into eax and jump to the kernel. */
|
||||
movl $MULTIBOOT2_BOOTLOADER_MAGIC,%eax
|
||||
popl %ecx
|
||||
jmp *%ecx
|
Loading…
Reference in a new issue