2008-11-12 Robert Millan <rmh@aybabtu.com>

* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
        * conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
        (vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
        variables.
        * conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
        `term/i386/pc/console.c' with `term/i386/vga_common.c'.

        * kern/i386/coreboot/init.c (grub_machine_init): Replace call to
        grub_console_init() with call to grub_vga_text_init().
        (grub_machine_fini): Replace call to
        grub_console_fini() with call to grub_vga_text_fini() and
        grub_at_keyboard_fini().

        * include/grub/i386/pc/console.h: Include `<grub/term.h>'.
        (grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
        (grub_console_setcolorstate, grub_console_setcolor)
        (grub_console_getcolor): New function prototypes.

        * term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
        (grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
        (grub_vga_text_setcursor): Static-ize.
        (grub_vga_text_term): New structure.
        (GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.

        * term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
        (grub_console_cur_color, grub_console_standard_color)
        (grub_console_normal_color, grub_console_highlight_color)
        (map_char, grub_console_putchar, grub_console_getcharwidth)
        (grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
        (grub_console_getcolor): Move from here ...
        * term/i386/vga_common.c: ... to here (same function names).
This commit is contained in:
robertmh 2008-11-12 15:02:17 +00:00
parent 95b841d37b
commit 76679cd3a4
13 changed files with 315 additions and 145 deletions

View file

@ -1,3 +1,37 @@
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 Robert Millan <rmh@aybabtu.com>
Use newly-added Multiboot support in coreboot.

View file

@ -403,6 +403,7 @@ term/gfxterm.c
term/terminfo.c
term/tparm.c
term/efi/console.c
term/i386/vga_common.c
term/i386/pc/at_keyboard.c
term/i386/pc/console.c
term/i386/pc/serial.c

View file

@ -24,14 +24,14 @@ kernel_elf_SOURCES = kern/i386/coreboot/startup.S \
kern/generic/rtc_get_time_ms.c \
kern/generic/millisleep.c \
kern/env.c \
term/i386/pc/console.c \
term/i386/pc/at_keyboard.c term/i386/pc/vga_text.c \
term/i386/pc/vga_text.c term/i386/vga_common.c \
term/i386/pc/at_keyboard.c \
symlist.c
CLEANFILES += kernel.elf kernel_elf-kern_i386_coreboot_startup.o kernel_elf-kern_i386_coreboot_init.o kernel_elf-kern_i386_multiboot_mmap.o kernel_elf-kern_main.o kernel_elf-kern_device.o kernel_elf-kern_disk.o kernel_elf-kern_dl.o kernel_elf-kern_file.o kernel_elf-kern_fs.o kernel_elf-kern_err.o kernel_elf-kern_misc.o kernel_elf-kern_mm.o kernel_elf-kern_loader.o kernel_elf-kern_rescue.o kernel_elf-kern_term.o kernel_elf-kern_time.o kernel_elf-kern_i386_dl.o kernel_elf-kern_parser.o kernel_elf-kern_partition.o kernel_elf-kern_i386_tsc.o kernel_elf-kern_i386_pit.o kernel_elf-kern_generic_rtc_get_time_ms.o kernel_elf-kern_generic_millisleep.o kernel_elf-kern_env.o kernel_elf-term_i386_pc_console.o kernel_elf-term_i386_pc_at_keyboard.o kernel_elf-term_i386_pc_vga_text.o kernel_elf-symlist.o
MOSTLYCLEANFILES += kernel_elf-kern_i386_coreboot_startup.d kernel_elf-kern_i386_coreboot_init.d kernel_elf-kern_i386_multiboot_mmap.d kernel_elf-kern_main.d kernel_elf-kern_device.d kernel_elf-kern_disk.d kernel_elf-kern_dl.d kernel_elf-kern_file.d kernel_elf-kern_fs.d kernel_elf-kern_err.d kernel_elf-kern_misc.d kernel_elf-kern_mm.d kernel_elf-kern_loader.d kernel_elf-kern_rescue.d kernel_elf-kern_term.d kernel_elf-kern_time.d kernel_elf-kern_i386_dl.d kernel_elf-kern_parser.d kernel_elf-kern_partition.d kernel_elf-kern_i386_tsc.d kernel_elf-kern_i386_pit.d kernel_elf-kern_generic_rtc_get_time_ms.d kernel_elf-kern_generic_millisleep.d kernel_elf-kern_env.d kernel_elf-term_i386_pc_console.d kernel_elf-term_i386_pc_at_keyboard.d kernel_elf-term_i386_pc_vga_text.d kernel_elf-symlist.d
CLEANFILES += kernel.elf kernel_elf-kern_i386_coreboot_startup.o kernel_elf-kern_i386_coreboot_init.o kernel_elf-kern_i386_multiboot_mmap.o kernel_elf-kern_main.o kernel_elf-kern_device.o kernel_elf-kern_disk.o kernel_elf-kern_dl.o kernel_elf-kern_file.o kernel_elf-kern_fs.o kernel_elf-kern_err.o kernel_elf-kern_misc.o kernel_elf-kern_mm.o kernel_elf-kern_loader.o kernel_elf-kern_rescue.o kernel_elf-kern_term.o kernel_elf-kern_time.o kernel_elf-kern_i386_dl.o kernel_elf-kern_parser.o kernel_elf-kern_partition.o kernel_elf-kern_i386_tsc.o kernel_elf-kern_i386_pit.o kernel_elf-kern_generic_rtc_get_time_ms.o kernel_elf-kern_generic_millisleep.o kernel_elf-kern_env.o kernel_elf-term_i386_pc_vga_text.o kernel_elf-term_i386_vga_common.o kernel_elf-term_i386_pc_at_keyboard.o kernel_elf-symlist.o
MOSTLYCLEANFILES += kernel_elf-kern_i386_coreboot_startup.d kernel_elf-kern_i386_coreboot_init.d kernel_elf-kern_i386_multiboot_mmap.d kernel_elf-kern_main.d kernel_elf-kern_device.d kernel_elf-kern_disk.d kernel_elf-kern_dl.d kernel_elf-kern_file.d kernel_elf-kern_fs.d kernel_elf-kern_err.d kernel_elf-kern_misc.d kernel_elf-kern_mm.d kernel_elf-kern_loader.d kernel_elf-kern_rescue.d kernel_elf-kern_term.d kernel_elf-kern_time.d kernel_elf-kern_i386_dl.d kernel_elf-kern_parser.d kernel_elf-kern_partition.d kernel_elf-kern_i386_tsc.d kernel_elf-kern_i386_pit.d kernel_elf-kern_generic_rtc_get_time_ms.d kernel_elf-kern_generic_millisleep.d kernel_elf-kern_env.d kernel_elf-term_i386_pc_vga_text.d kernel_elf-term_i386_vga_common.d kernel_elf-term_i386_pc_at_keyboard.d kernel_elf-symlist.d
kernel.elf: $(kernel_elf_DEPENDENCIES) kernel_elf-kern_i386_coreboot_startup.o kernel_elf-kern_i386_coreboot_init.o kernel_elf-kern_i386_multiboot_mmap.o kernel_elf-kern_main.o kernel_elf-kern_device.o kernel_elf-kern_disk.o kernel_elf-kern_dl.o kernel_elf-kern_file.o kernel_elf-kern_fs.o kernel_elf-kern_err.o kernel_elf-kern_misc.o kernel_elf-kern_mm.o kernel_elf-kern_loader.o kernel_elf-kern_rescue.o kernel_elf-kern_term.o kernel_elf-kern_time.o kernel_elf-kern_i386_dl.o kernel_elf-kern_parser.o kernel_elf-kern_partition.o kernel_elf-kern_i386_tsc.o kernel_elf-kern_i386_pit.o kernel_elf-kern_generic_rtc_get_time_ms.o kernel_elf-kern_generic_millisleep.o kernel_elf-kern_env.o kernel_elf-term_i386_pc_console.o kernel_elf-term_i386_pc_at_keyboard.o kernel_elf-term_i386_pc_vga_text.o kernel_elf-symlist.o
$(TARGET_CC) -o $@ kernel_elf-kern_i386_coreboot_startup.o kernel_elf-kern_i386_coreboot_init.o kernel_elf-kern_i386_multiboot_mmap.o kernel_elf-kern_main.o kernel_elf-kern_device.o kernel_elf-kern_disk.o kernel_elf-kern_dl.o kernel_elf-kern_file.o kernel_elf-kern_fs.o kernel_elf-kern_err.o kernel_elf-kern_misc.o kernel_elf-kern_mm.o kernel_elf-kern_loader.o kernel_elf-kern_rescue.o kernel_elf-kern_term.o kernel_elf-kern_time.o kernel_elf-kern_i386_dl.o kernel_elf-kern_parser.o kernel_elf-kern_partition.o kernel_elf-kern_i386_tsc.o kernel_elf-kern_i386_pit.o kernel_elf-kern_generic_rtc_get_time_ms.o kernel_elf-kern_generic_millisleep.o kernel_elf-kern_env.o kernel_elf-term_i386_pc_console.o kernel_elf-term_i386_pc_at_keyboard.o kernel_elf-term_i386_pc_vga_text.o kernel_elf-symlist.o $(TARGET_LDFLAGS) $(kernel_elf_LDFLAGS)
kernel.elf: $(kernel_elf_DEPENDENCIES) kernel_elf-kern_i386_coreboot_startup.o kernel_elf-kern_i386_coreboot_init.o kernel_elf-kern_i386_multiboot_mmap.o kernel_elf-kern_main.o kernel_elf-kern_device.o kernel_elf-kern_disk.o kernel_elf-kern_dl.o kernel_elf-kern_file.o kernel_elf-kern_fs.o kernel_elf-kern_err.o kernel_elf-kern_misc.o kernel_elf-kern_mm.o kernel_elf-kern_loader.o kernel_elf-kern_rescue.o kernel_elf-kern_term.o kernel_elf-kern_time.o kernel_elf-kern_i386_dl.o kernel_elf-kern_parser.o kernel_elf-kern_partition.o kernel_elf-kern_i386_tsc.o kernel_elf-kern_i386_pit.o kernel_elf-kern_generic_rtc_get_time_ms.o kernel_elf-kern_generic_millisleep.o kernel_elf-kern_env.o kernel_elf-term_i386_pc_vga_text.o kernel_elf-term_i386_vga_common.o kernel_elf-term_i386_pc_at_keyboard.o kernel_elf-symlist.o
$(TARGET_CC) -o $@ kernel_elf-kern_i386_coreboot_startup.o kernel_elf-kern_i386_coreboot_init.o kernel_elf-kern_i386_multiboot_mmap.o kernel_elf-kern_main.o kernel_elf-kern_device.o kernel_elf-kern_disk.o kernel_elf-kern_dl.o kernel_elf-kern_file.o kernel_elf-kern_fs.o kernel_elf-kern_err.o kernel_elf-kern_misc.o kernel_elf-kern_mm.o kernel_elf-kern_loader.o kernel_elf-kern_rescue.o kernel_elf-kern_term.o kernel_elf-kern_time.o kernel_elf-kern_i386_dl.o kernel_elf-kern_parser.o kernel_elf-kern_partition.o kernel_elf-kern_i386_tsc.o kernel_elf-kern_i386_pit.o kernel_elf-kern_generic_rtc_get_time_ms.o kernel_elf-kern_generic_millisleep.o kernel_elf-kern_env.o kernel_elf-term_i386_pc_vga_text.o kernel_elf-term_i386_vga_common.o kernel_elf-term_i386_pc_at_keyboard.o kernel_elf-symlist.o $(TARGET_LDFLAGS) $(kernel_elf_LDFLAGS)
kernel_elf-kern_i386_coreboot_startup.o: kern/i386/coreboot/startup.S $(kern/i386/coreboot/startup.S_DEPENDENCIES)
$(TARGET_CC) -Ikern/i386/coreboot -I$(srcdir)/kern/i386/coreboot $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(kernel_elf_CFLAGS) -MD -c -o $@ $<
@ -129,18 +129,18 @@ kernel_elf-kern_env.o: kern/env.c $(kern/env.c_DEPENDENCIES)
$(TARGET_CC) -Ikern -I$(srcdir)/kern $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(kernel_elf_CFLAGS) -MD -c -o $@ $<
-include kernel_elf-kern_env.d
kernel_elf-term_i386_pc_console.o: term/i386/pc/console.c $(term/i386/pc/console.c_DEPENDENCIES)
kernel_elf-term_i386_pc_vga_text.o: term/i386/pc/vga_text.c $(term/i386/pc/vga_text.c_DEPENDENCIES)
$(TARGET_CC) -Iterm/i386/pc -I$(srcdir)/term/i386/pc $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(kernel_elf_CFLAGS) -MD -c -o $@ $<
-include kernel_elf-term_i386_pc_console.d
-include kernel_elf-term_i386_pc_vga_text.d
kernel_elf-term_i386_vga_common.o: term/i386/vga_common.c $(term/i386/vga_common.c_DEPENDENCIES)
$(TARGET_CC) -Iterm/i386 -I$(srcdir)/term/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(kernel_elf_CFLAGS) -MD -c -o $@ $<
-include kernel_elf-term_i386_vga_common.d
kernel_elf-term_i386_pc_at_keyboard.o: term/i386/pc/at_keyboard.c $(term/i386/pc/at_keyboard.c_DEPENDENCIES)
$(TARGET_CC) -Iterm/i386/pc -I$(srcdir)/term/i386/pc $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(kernel_elf_CFLAGS) -MD -c -o $@ $<
-include kernel_elf-term_i386_pc_at_keyboard.d
kernel_elf-term_i386_pc_vga_text.o: term/i386/pc/vga_text.c $(term/i386/pc/vga_text.c_DEPENDENCIES)
$(TARGET_CC) -Iterm/i386/pc -I$(srcdir)/term/i386/pc $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(kernel_elf_CFLAGS) -MD -c -o $@ $<
-include kernel_elf-term_i386_pc_vga_text.d
kernel_elf-symlist.o: symlist.c $(symlist.c_DEPENDENCIES)
$(TARGET_CC) -I. -I$(srcdir)/. $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(kernel_elf_CFLAGS) -MD -c -o $@ $<
-include kernel_elf-symlist.d

View file

@ -23,8 +23,8 @@ kernel_elf_SOURCES = kern/i386/coreboot/startup.S \
kern/generic/rtc_get_time_ms.c \
kern/generic/millisleep.c \
kern/env.c \
term/i386/pc/console.c \
term/i386/pc/at_keyboard.c term/i386/pc/vga_text.c \
term/i386/pc/vga_text.c term/i386/vga_common.c \
term/i386/pc/at_keyboard.c \
symlist.c
kernel_elf_HEADERS = arg.h 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 \

View file

@ -115,15 +115,15 @@ kernel_img_SOURCES = kern/i386/pc/startup.S kern/main.c kern/device.c \
kern/generic/rtc_get_time_ms.c \
kern/generic/millisleep.c \
kern/env.c \
term/i386/pc/console.c \
term/i386/pc/console.c term/i386/vga_common.c \
symlist.c
CLEANFILES += kernel.img kernel.exec kernel_img-kern_i386_pc_startup.o kernel_img-kern_main.o kernel_img-kern_device.o kernel_img-kern_disk.o kernel_img-kern_dl.o kernel_img-kern_file.o kernel_img-kern_fs.o kernel_img-kern_err.o kernel_img-kern_misc.o kernel_img-kern_mm.o kernel_img-kern_loader.o kernel_img-kern_rescue.o kernel_img-kern_term.o kernel_img-kern_time.o kernel_img-kern_i386_dl.o kernel_img-kern_i386_pc_init.o kernel_img-kern_i386_pc_mmap.o kernel_img-kern_parser.o kernel_img-kern_partition.o kernel_img-kern_i386_tsc.o kernel_img-kern_i386_pit.o kernel_img-kern_generic_rtc_get_time_ms.o kernel_img-kern_generic_millisleep.o kernel_img-kern_env.o kernel_img-term_i386_pc_console.o kernel_img-symlist.o
MOSTLYCLEANFILES += kernel_img-kern_i386_pc_startup.d kernel_img-kern_main.d kernel_img-kern_device.d kernel_img-kern_disk.d kernel_img-kern_dl.d kernel_img-kern_file.d kernel_img-kern_fs.d kernel_img-kern_err.d kernel_img-kern_misc.d kernel_img-kern_mm.d kernel_img-kern_loader.d kernel_img-kern_rescue.d kernel_img-kern_term.d kernel_img-kern_time.d kernel_img-kern_i386_dl.d kernel_img-kern_i386_pc_init.d kernel_img-kern_i386_pc_mmap.d kernel_img-kern_parser.d kernel_img-kern_partition.d kernel_img-kern_i386_tsc.d kernel_img-kern_i386_pit.d kernel_img-kern_generic_rtc_get_time_ms.d kernel_img-kern_generic_millisleep.d kernel_img-kern_env.d kernel_img-term_i386_pc_console.d kernel_img-symlist.d
CLEANFILES += kernel.img kernel.exec kernel_img-kern_i386_pc_startup.o kernel_img-kern_main.o kernel_img-kern_device.o kernel_img-kern_disk.o kernel_img-kern_dl.o kernel_img-kern_file.o kernel_img-kern_fs.o kernel_img-kern_err.o kernel_img-kern_misc.o kernel_img-kern_mm.o kernel_img-kern_loader.o kernel_img-kern_rescue.o kernel_img-kern_term.o kernel_img-kern_time.o kernel_img-kern_i386_dl.o kernel_img-kern_i386_pc_init.o kernel_img-kern_i386_pc_mmap.o kernel_img-kern_parser.o kernel_img-kern_partition.o kernel_img-kern_i386_tsc.o kernel_img-kern_i386_pit.o kernel_img-kern_generic_rtc_get_time_ms.o kernel_img-kern_generic_millisleep.o kernel_img-kern_env.o kernel_img-term_i386_pc_console.o kernel_img-term_i386_vga_common.o kernel_img-symlist.o
MOSTLYCLEANFILES += kernel_img-kern_i386_pc_startup.d kernel_img-kern_main.d kernel_img-kern_device.d kernel_img-kern_disk.d kernel_img-kern_dl.d kernel_img-kern_file.d kernel_img-kern_fs.d kernel_img-kern_err.d kernel_img-kern_misc.d kernel_img-kern_mm.d kernel_img-kern_loader.d kernel_img-kern_rescue.d kernel_img-kern_term.d kernel_img-kern_time.d kernel_img-kern_i386_dl.d kernel_img-kern_i386_pc_init.d kernel_img-kern_i386_pc_mmap.d kernel_img-kern_parser.d kernel_img-kern_partition.d kernel_img-kern_i386_tsc.d kernel_img-kern_i386_pit.d kernel_img-kern_generic_rtc_get_time_ms.d kernel_img-kern_generic_millisleep.d kernel_img-kern_env.d kernel_img-term_i386_pc_console.d kernel_img-term_i386_vga_common.d kernel_img-symlist.d
kernel.img: kernel.exec
$(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
kernel.exec: kernel_img-kern_i386_pc_startup.o kernel_img-kern_main.o kernel_img-kern_device.o kernel_img-kern_disk.o kernel_img-kern_dl.o kernel_img-kern_file.o kernel_img-kern_fs.o kernel_img-kern_err.o kernel_img-kern_misc.o kernel_img-kern_mm.o kernel_img-kern_loader.o kernel_img-kern_rescue.o kernel_img-kern_term.o kernel_img-kern_time.o kernel_img-kern_i386_dl.o kernel_img-kern_i386_pc_init.o kernel_img-kern_i386_pc_mmap.o kernel_img-kern_parser.o kernel_img-kern_partition.o kernel_img-kern_i386_tsc.o kernel_img-kern_i386_pit.o kernel_img-kern_generic_rtc_get_time_ms.o kernel_img-kern_generic_millisleep.o kernel_img-kern_env.o kernel_img-term_i386_pc_console.o kernel_img-symlist.o
kernel.exec: kernel_img-kern_i386_pc_startup.o kernel_img-kern_main.o kernel_img-kern_device.o kernel_img-kern_disk.o kernel_img-kern_dl.o kernel_img-kern_file.o kernel_img-kern_fs.o kernel_img-kern_err.o kernel_img-kern_misc.o kernel_img-kern_mm.o kernel_img-kern_loader.o kernel_img-kern_rescue.o kernel_img-kern_term.o kernel_img-kern_time.o kernel_img-kern_i386_dl.o kernel_img-kern_i386_pc_init.o kernel_img-kern_i386_pc_mmap.o kernel_img-kern_parser.o kernel_img-kern_partition.o kernel_img-kern_i386_tsc.o kernel_img-kern_i386_pit.o kernel_img-kern_generic_rtc_get_time_ms.o kernel_img-kern_generic_millisleep.o kernel_img-kern_env.o kernel_img-term_i386_pc_console.o kernel_img-term_i386_vga_common.o kernel_img-symlist.o
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(kernel_img_LDFLAGS)
kernel_img-kern_i386_pc_startup.o: kern/i386/pc/startup.S $(kern/i386/pc/startup.S_DEPENDENCIES)
@ -226,6 +226,10 @@ kernel_img-term_i386_pc_console.o: term/i386/pc/console.c $(term/i386/pc/console
$(TARGET_CC) -Iterm/i386/pc -I$(srcdir)/term/i386/pc $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(kernel_img_CFLAGS) -MD -c -o $@ $<
-include kernel_img-term_i386_pc_console.d
kernel_img-term_i386_vga_common.o: term/i386/vga_common.c $(term/i386/vga_common.c_DEPENDENCIES)
$(TARGET_CC) -Iterm/i386 -I$(srcdir)/term/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(kernel_img_CFLAGS) -MD -c -o $@ $<
-include kernel_img-term_i386_vga_common.d
kernel_img-symlist.o: symlist.c $(symlist.c_DEPENDENCIES)
$(TARGET_CC) -I. -I$(srcdir)/. $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(kernel_img_CFLAGS) -MD -c -o $@ $<
-include kernel_img-symlist.d

View file

@ -49,7 +49,7 @@ kernel_img_SOURCES = kern/i386/pc/startup.S kern/main.c kern/device.c \
kern/generic/rtc_get_time_ms.c \
kern/generic/millisleep.c \
kern/env.c \
term/i386/pc/console.c \
term/i386/pc/console.c term/i386/vga_common.c \
symlist.c
kernel_img_HEADERS = arg.h 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 \

View file

@ -114,3 +114,79 @@ partmap-at_keyboard_mod-term_i386_pc_at_keyboard.lst: term/i386/pc/at_keyboard.c
at_keyboard_mod_CFLAGS = $(COMMON_CFLAGS)
at_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += vga_text.mod
vga_text_mod_SOURCES = term/i386/pc/vga_text.c term/i386/vga_common.c
CLEANFILES += vga_text.mod mod-vga_text.o mod-vga_text.c pre-vga_text.o vga_text_mod-term_i386_pc_vga_text.o vga_text_mod-term_i386_vga_common.o und-vga_text.lst
ifneq ($(vga_text_mod_EXPORTS),no)
CLEANFILES += def-vga_text.lst
DEFSYMFILES += def-vga_text.lst
endif
MOSTLYCLEANFILES += vga_text_mod-term_i386_pc_vga_text.d vga_text_mod-term_i386_vga_common.d
UNDSYMFILES += und-vga_text.lst
vga_text.mod: pre-vga_text.o mod-vga_text.o $(TARGET_OBJ2ELF)
-rm -f $@
$(TARGET_CC) $(vga_text_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-vga_text.o mod-vga_text.o
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-vga_text.o: $(vga_text_mod_DEPENDENCIES) vga_text_mod-term_i386_pc_vga_text.o vga_text_mod-term_i386_vga_common.o
-rm -f $@
$(TARGET_CC) $(vga_text_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ vga_text_mod-term_i386_pc_vga_text.o vga_text_mod-term_i386_vga_common.o
mod-vga_text.o: mod-vga_text.c
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(vga_text_mod_CFLAGS) -c -o $@ $<
mod-vga_text.c: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh
sh $(srcdir)/genmodsrc.sh 'vga_text' $< > $@ || (rm -f $@; exit 1)
ifneq ($(vga_text_mod_EXPORTS),no)
def-vga_text.lst: pre-vga_text.o
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 vga_text/' > $@
endif
und-vga_text.lst: pre-vga_text.o
echo 'vga_text' > $@
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
vga_text_mod-term_i386_pc_vga_text.o: term/i386/pc/vga_text.c $(term/i386/pc/vga_text.c_DEPENDENCIES)
$(TARGET_CC) -Iterm/i386/pc -I$(srcdir)/term/i386/pc $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(vga_text_mod_CFLAGS) -MD -c -o $@ $<
-include vga_text_mod-term_i386_pc_vga_text.d
CLEANFILES += cmd-vga_text_mod-term_i386_pc_vga_text.lst fs-vga_text_mod-term_i386_pc_vga_text.lst partmap-vga_text_mod-term_i386_pc_vga_text.lst
COMMANDFILES += cmd-vga_text_mod-term_i386_pc_vga_text.lst
FSFILES += fs-vga_text_mod-term_i386_pc_vga_text.lst
PARTMAPFILES += partmap-vga_text_mod-term_i386_pc_vga_text.lst
cmd-vga_text_mod-term_i386_pc_vga_text.lst: term/i386/pc/vga_text.c $(term/i386/pc/vga_text.c_DEPENDENCIES) gencmdlist.sh
set -e; $(TARGET_CC) -Iterm/i386/pc -I$(srcdir)/term/i386/pc $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(vga_text_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh vga_text > $@ || (rm -f $@; exit 1)
fs-vga_text_mod-term_i386_pc_vga_text.lst: term/i386/pc/vga_text.c $(term/i386/pc/vga_text.c_DEPENDENCIES) genfslist.sh
set -e; $(TARGET_CC) -Iterm/i386/pc -I$(srcdir)/term/i386/pc $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(vga_text_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh vga_text > $@ || (rm -f $@; exit 1)
partmap-vga_text_mod-term_i386_pc_vga_text.lst: term/i386/pc/vga_text.c $(term/i386/pc/vga_text.c_DEPENDENCIES) genpartmaplist.sh
set -e; $(TARGET_CC) -Iterm/i386/pc -I$(srcdir)/term/i386/pc $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(vga_text_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh vga_text > $@ || (rm -f $@; exit 1)
vga_text_mod-term_i386_vga_common.o: term/i386/vga_common.c $(term/i386/vga_common.c_DEPENDENCIES)
$(TARGET_CC) -Iterm/i386 -I$(srcdir)/term/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(vga_text_mod_CFLAGS) -MD -c -o $@ $<
-include vga_text_mod-term_i386_vga_common.d
CLEANFILES += cmd-vga_text_mod-term_i386_vga_common.lst fs-vga_text_mod-term_i386_vga_common.lst partmap-vga_text_mod-term_i386_vga_common.lst
COMMANDFILES += cmd-vga_text_mod-term_i386_vga_common.lst
FSFILES += fs-vga_text_mod-term_i386_vga_common.lst
PARTMAPFILES += partmap-vga_text_mod-term_i386_vga_common.lst
cmd-vga_text_mod-term_i386_vga_common.lst: term/i386/vga_common.c $(term/i386/vga_common.c_DEPENDENCIES) gencmdlist.sh
set -e; $(TARGET_CC) -Iterm/i386 -I$(srcdir)/term/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(vga_text_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh vga_text > $@ || (rm -f $@; exit 1)
fs-vga_text_mod-term_i386_vga_common.lst: term/i386/vga_common.c $(term/i386/vga_common.c_DEPENDENCIES) genfslist.sh
set -e; $(TARGET_CC) -Iterm/i386 -I$(srcdir)/term/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(vga_text_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh vga_text > $@ || (rm -f $@; exit 1)
partmap-vga_text_mod-term_i386_vga_common.lst: term/i386/vga_common.c $(term/i386/vga_common.c_DEPENDENCIES) genpartmaplist.sh
set -e; $(TARGET_CC) -Iterm/i386 -I$(srcdir)/term/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(vga_text_mod_CFLAGS) -E $< | sh $(srcdir)/genpartmaplist.sh vga_text > $@ || (rm -f $@; exit 1)
vga_text_mod_CFLAGS = $(COMMON_CFLAGS)
vga_text_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -9,3 +9,8 @@ pkglib_MODULES += at_keyboard.mod
at_keyboard_mod_SOURCES = term/i386/pc/at_keyboard.c
at_keyboard_mod_CFLAGS = $(COMMON_CFLAGS)
at_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += vga_text.mod
vga_text_mod_SOURCES = term/i386/pc/vga_text.c term/i386/vga_common.c
vga_text_mod_CFLAGS = $(COMMON_CFLAGS)
vga_text_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2005,2007 Free Software Foundation, Inc.
* Copyright (C) 2002,2005,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
@ -36,6 +36,7 @@
#include <grub/types.h>
#include <grub/symbol.h>
#include <grub/term.h>
/* These are global to share code between C and asm. */
extern grub_uint8_t grub_console_cur_color;
@ -47,6 +48,14 @@ void grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y);
void grub_console_cls (void);
void grub_console_setcursor (int on);
/* Provided by vga_common.c. */
void grub_console_putchar (grub_uint32_t c);
grub_ssize_t grub_console_getcharwidth (grub_uint32_t c);
grub_uint16_t grub_console_getwh (void);
void grub_console_setcolorstate (grub_term_color_state state);
void grub_console_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color);
void grub_console_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color);
/* Initialize the console system. */
void grub_console_init (void);

View file

@ -77,7 +77,7 @@ void
grub_machine_init (void)
{
/* Initialize the console as early as possible. */
grub_console_init ();
grub_vga_text_init ();
grub_at_keyboard_init ();
auto int NESTED_FUNC_ATTR heap_init (grub_uint64_t, grub_uint64_t, grub_uint32_t);
@ -148,7 +148,8 @@ grub_machine_set_prefix (void)
void
grub_machine_fini (void)
{
grub_console_fini ();
grub_at_keyboard_fini ();
grub_vga_text_fini ();
}
/* Return the end of the core image. */

View file

@ -16,125 +16,16 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/machine/machine.h>
#include <grub/machine/console.h>
#include <grub/term.h>
#include <grub/types.h>
grub_uint8_t grub_console_cur_color = 0x7;
static grub_uint8_t grub_console_standard_color = 0x7;
static grub_uint8_t grub_console_normal_color = 0x7;
static grub_uint8_t grub_console_highlight_color = 0x70;
static grub_uint32_t
map_char (grub_uint32_t c)
{
if (c > 0x7f)
{
/* Map some unicode characters to the VGA font, if possible. */
switch (c)
{
case 0x2190: /* left arrow */
c = 0x1b;
break;
case 0x2191: /* up arrow */
c = 0x18;
break;
case 0x2192: /* right arrow */
c = 0x1a;
break;
case 0x2193: /* down arrow */
c = 0x19;
break;
case 0x2501: /* horizontal line */
c = 0xc4;
break;
case 0x2503: /* vertical line */
c = 0xb3;
break;
case 0x250F: /* upper-left corner */
c = 0xda;
break;
case 0x2513: /* upper-right corner */
c = 0xbf;
break;
case 0x2517: /* lower-left corner */
c = 0xc0;
break;
case 0x251B: /* lower-right corner */
c = 0xd9;
break;
default:
c = '?';
break;
}
}
return c;
}
static void
grub_console_putchar (grub_uint32_t c)
{
grub_console_real_putchar (map_char (c));
}
static grub_ssize_t
grub_console_getcharwidth (grub_uint32_t c __attribute__ ((unused)))
{
/* For now, every printable character has the width 1. */
return 1;
}
static grub_uint16_t
grub_console_getwh (void)
{
return (80 << 8) | 25;
}
static void
grub_console_setcolorstate (grub_term_color_state state)
{
switch (state) {
case GRUB_TERM_COLOR_STANDARD:
grub_console_cur_color = grub_console_standard_color;
break;
case GRUB_TERM_COLOR_NORMAL:
grub_console_cur_color = grub_console_normal_color;
break;
case GRUB_TERM_COLOR_HIGHLIGHT:
grub_console_cur_color = grub_console_highlight_color;
break;
default:
break;
}
}
static void
grub_console_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color)
{
grub_console_normal_color = normal_color;
grub_console_highlight_color = highlight_color;
}
static void
grub_console_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
{
*normal_color = grub_console_normal_color;
*highlight_color = grub_console_highlight_color;
}
/* On non-BIOS platforms, console.c is used in combination with vga_text.c
(only to handle output). */
#ifdef GRUB_MACHINE_PCBIOS
static struct grub_term_input grub_console_term_input =
{
.name = "console",
.checkkey = grub_console_checkkey,
.getkey = grub_console_getkey,
};
#endif
static struct grub_term_output grub_console_term_output =
{
@ -156,9 +47,7 @@ void
grub_console_init (void)
{
grub_term_register_output (&grub_console_term_output);
#ifdef GRUB_MACHINE_PCBIOS
grub_term_register_input (&grub_console_term_input);
#endif
}
void
@ -168,8 +57,6 @@ grub_console_fini (void)
we boot. */
grub_term_set_current_output (&grub_console_term_output);
#ifdef GRUB_MACHINE_PCBIOS
grub_term_unregister_input (&grub_console_term_input);
#endif
grub_term_unregister_output (&grub_console_term_output);
}

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007 Free Software Foundation, Inc.
* Copyright (C) 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
@ -16,6 +16,7 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/dl.h>
#include <grub/machine/console.h>
#include <grub/cpu/io.h>
#include <grub/types.h>
@ -106,31 +107,31 @@ grub_console_real_putchar (int c)
update_cursor ();
}
grub_uint16_t
grub_console_getxy (void)
static grub_uint16_t
grub_vga_text_getxy (void)
{
return (grub_curr_x << 8) | grub_curr_y;
}
void
grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y)
static void
grub_vga_text_gotoxy (grub_uint8_t x, grub_uint8_t y)
{
grub_curr_x = x;
grub_curr_y = y;
update_cursor ();
}
void
grub_console_cls (void)
static void
grub_vga_text_cls (void)
{
int i;
for (i = 0; i < ROWS * COLS; i++)
((short *) VGA_TEXT_SCREEN)[i] = ' ' | (grub_console_cur_color << 8);
grub_console_gotoxy (0, 0);
grub_vga_text_gotoxy (0, 0);
}
void
grub_console_setcursor (int on)
static void
grub_vga_text_setcursor (int on)
{
grub_uint8_t old;
grub_outb (CRTC_CURSOR, CRTC_ADDR_PORT);
@ -140,3 +141,30 @@ grub_console_setcursor (int on)
else
grub_outb (old | CRTC_CURSOR_DISABLE, CRTC_DATA_PORT);
}
static struct grub_term_output grub_vga_text_term =
{
.name = "vga_text",
.init = grub_vga_text_cls,
.fini = grub_vga_text_cls,
.putchar = grub_console_putchar,
.getcharwidth = grub_console_getcharwidth,
.getwh = grub_console_getwh,
.getxy = grub_vga_text_getxy,
.gotoxy = grub_vga_text_gotoxy,
.cls = grub_vga_text_cls,
.setcolorstate = grub_console_setcolorstate,
.setcolor = grub_console_setcolor,
.getcolor = grub_console_getcolor,
.setcursor = grub_vga_text_setcursor,
};
GRUB_MOD_INIT(vga_text)
{
grub_term_register_output (&grub_vga_text_term);
}
GRUB_MOD_FINI(vga_text)
{
grub_term_unregister_output (&grub_vga_text_term);
}

125
term/i386/vga_common.c Normal file
View file

@ -0,0 +1,125 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2005,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/>.
*/
#include <grub/machine/console.h>
#include <grub/term.h>
#include <grub/types.h>
grub_uint8_t grub_console_cur_color = 0x7;
static grub_uint8_t grub_console_standard_color = 0x7;
static grub_uint8_t grub_console_normal_color = 0x7;
static grub_uint8_t grub_console_highlight_color = 0x70;
static grub_uint32_t
map_char (grub_uint32_t c)
{
if (c > 0x7f)
{
/* Map some unicode characters to the VGA font, if possible. */
switch (c)
{
case 0x2190: /* left arrow */
c = 0x1b;
break;
case 0x2191: /* up arrow */
c = 0x18;
break;
case 0x2192: /* right arrow */
c = 0x1a;
break;
case 0x2193: /* down arrow */
c = 0x19;
break;
case 0x2501: /* horizontal line */
c = 0xc4;
break;
case 0x2503: /* vertical line */
c = 0xb3;
break;
case 0x250F: /* upper-left corner */
c = 0xda;
break;
case 0x2513: /* upper-right corner */
c = 0xbf;
break;
case 0x2517: /* lower-left corner */
c = 0xc0;
break;
case 0x251B: /* lower-right corner */
c = 0xd9;
break;
default:
c = '?';
break;
}
}
return c;
}
void
grub_console_putchar (grub_uint32_t c)
{
grub_console_real_putchar (map_char (c));
}
grub_ssize_t
grub_console_getcharwidth (grub_uint32_t c __attribute__ ((unused)))
{
/* For now, every printable character has the width 1. */
return 1;
}
grub_uint16_t
grub_console_getwh (void)
{
return (80 << 8) | 25;
}
void
grub_console_setcolorstate (grub_term_color_state state)
{
switch (state) {
case GRUB_TERM_COLOR_STANDARD:
grub_console_cur_color = grub_console_standard_color;
break;
case GRUB_TERM_COLOR_NORMAL:
grub_console_cur_color = grub_console_normal_color;
break;
case GRUB_TERM_COLOR_HIGHLIGHT:
grub_console_cur_color = grub_console_highlight_color;
break;
default:
break;
}
}
void
grub_console_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color)
{
grub_console_normal_color = normal_color;
grub_console_highlight_color = highlight_color;
}
void
grub_console_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
{
*normal_color = grub_console_normal_color;
*highlight_color = grub_console_highlight_color;
}