diff --git a/ChangeLog b/ChangeLog index 8b8647f40..eebe67f17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +1999-07-15 OKUJI Yoshinori + + * stage2/cmdline.c (skip_to): Don't increase CMDLINE if the + character to which CMDLINE points is NUL. + + * stage2/Makefile.am (EXTRA_DIST): Removed smp-imps.c. + (stage2_exec_SOURCES): Added smp-imps.c. + * stage2/cmdline.c [!GRUB_UTIL] (IMPS_DEBUG) (KERNEL_PRINT) + (CMOS_WRITE_BYTE) (CMOS_READ_BYTE) (PHYS_TO_VIRTUAL) + (VIRTUAL_TO_PHYS) (inb) (outb) (cmos_write_byte) + (cmos_read_byte): These are now defined in ... + * stage2/smp-imps.c (IMPS_DEBUG) (KERNEL_PRINT) + (CMOS_WRITE_BYTE) (CMOS_READ_BYTE) (PHYS_TO_VIRTUAL) + (VIRTUAL_TO_PHYS) (inb) (outb) (cmos_write_byte) + (cmos_read_byte): ... here. + * stage2/cmdline.c [!GRUB_UTIL]: Include apic.h and smp-imps.h. + 1999-07-14 OKUJI Yoshinori The function ungetch is simulated so that the user can use a diff --git a/stage2/Makefile.am b/stage2/Makefile.am index a91b65fa1..48d2c080b 100644 --- a/stage2/Makefile.am +++ b/stage2/Makefile.am @@ -6,7 +6,7 @@ noinst_SCRIPTS = $(TESTS) noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \ fat.h filesys.h freebsd.h fs.h i386-elf.h imgact_aout.h \ mb_header.h mb_info.h pc_slice.h shared.h smp-imps.h -EXTRA_DIST = smp-imps.c $(noinst_SCRIPTS) +EXTRA_DIST = $(noinst_SCRIPTS) # For . INCLUDES = -I$(top_srcdir)/stage1 @@ -36,7 +36,7 @@ STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 \ # For stage2 target. stage2_exec_SOURCES = asm.S boot.c common.c char_io.c cmdline.c \ disk_io.c gunzip.c fsys_ffs.c fsys_ext2fs.c fsys_fat.c stage2.c \ - bios.c + bios.c smp-imps.c stage2_exec_CFLAGS = $(STAGE2_COMPILE) stage2_exec_LDFLAGS = $(STAGE2_LINK) diff --git a/stage2/Makefile.in b/stage2/Makefile.in index 67217f814..55624dd41 100644 --- a/stage2/Makefile.in +++ b/stage2/Makefile.in @@ -85,7 +85,7 @@ noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \ fat.h filesys.h freebsd.h fs.h i386-elf.h imgact_aout.h \ mb_header.h mb_info.h pc_slice.h shared.h smp-imps.h -EXTRA_DIST = smp-imps.c $(noinst_SCRIPTS) +EXTRA_DIST = $(noinst_SCRIPTS) # For . INCLUDES = -I$(top_srcdir)/stage1 @@ -118,7 +118,7 @@ STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 \ # For stage2 target. stage2_exec_SOURCES = asm.S boot.c common.c char_io.c cmdline.c \ disk_io.c gunzip.c fsys_ffs.c fsys_ext2fs.c fsys_fat.c stage2.c \ - bios.c + bios.c smp-imps.c stage2_exec_CFLAGS = $(STAGE2_COMPILE) stage2_exec_LDFLAGS = $(STAGE2_LINK) @@ -193,7 +193,7 @@ am_stage2_exec_OBJECTS = stage2_exec-asm.o stage2_exec-boot.o \ stage2_exec-common.o stage2_exec-char_io.o stage2_exec-cmdline.o \ stage2_exec-disk_io.o stage2_exec-gunzip.o stage2_exec-fsys_ffs.o \ stage2_exec-fsys_ext2fs.o stage2_exec-fsys_fat.o stage2_exec-stage2.o \ -stage2_exec-bios.o +stage2_exec-bios.o stage2_exec-smp-imps.o stage2_exec_OBJECTS = $(am_stage2_exec_OBJECTS) stage2_exec_LDADD = $(LDADD) stage2_exec_DEPENDENCIES = @@ -218,8 +218,8 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) GZIP_ENV = --best DEP_FILES = .deps/asm.P .deps/bios.P .deps/boot.P .deps/char_io.P \ .deps/cmdline.P .deps/common.P .deps/disk_io.P .deps/fsys_ext2fs.P \ -.deps/fsys_fat.P .deps/fsys_ffs.P .deps/gunzip.P .deps/stage1_5.P \ -.deps/stage2.P +.deps/fsys_fat.P .deps/fsys_ffs.P .deps/gunzip.P .deps/smp-imps.P \ +.deps/stage1_5.P .deps/stage2.P SOURCES = $(libgrub_a_SOURCES) $(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) $(ffs_stage1_5_exec_SOURCES) $(stage2_exec_SOURCES) OBJECTS = $(am_libgrub_a_OBJECTS) $(am_e2fs_stage1_5_exec_OBJECTS) $(am_fat_stage1_5_exec_OBJECTS) $(am_ffs_stage1_5_exec_OBJECTS) $(am_stage2_exec_OBJECTS) @@ -325,6 +325,7 @@ stage2_exec-fsys_ext2fs.o: fsys_ext2fs.c stage2_exec-fsys_fat.o: fsys_fat.c stage2_exec-stage2.o: stage2.c stage2_exec-bios.o: bios.c +stage2_exec-smp-imps.o: smp-imps.c stage2.exec: $(stage2_exec_OBJECTS) $(stage2_exec_DEPENDENCIES) @rm -f stage2.exec @@ -1176,6 +1177,25 @@ stage2_exec-bios.lo: bios.c | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ >> .deps/$(*D)/$(*F).P; \ rm -f .deps/$(*D)/$(*F).pp + +stage2_exec-smp-imps.o: smp-imps.c + @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< + @-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \ + tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*D)/$(*F).P; \ + rm .deps/$(*D)/$(*F).pp + +stage2_exec-smp-imps.lo: smp-imps.c + @echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ + $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \ + tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*D)/$(*F).P; \ + rm -f .deps/$(*D)/$(*F).pp check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; \ srcdir=$(srcdir); export srcdir; \ diff --git a/stage2/cmdline.c b/stage2/cmdline.c index 1806c41cb..97a61a381 100644 --- a/stage2/cmdline.c +++ b/stage2/cmdline.c @@ -22,51 +22,9 @@ #include "shared.h" #ifndef GRUB_UTIL - -/* - * This is the Intel MultiProcessor Spec debugging/display code. - */ - -#define IMPS_DEBUG -#define KERNEL_PRINT(x) printf x -#define CMOS_WRITE_BYTE(x, y) cmos_write_byte(x, y) -#define CMOS_READ_BYTE(x) cmos_read_byte(x) -#define PHYS_TO_VIRTUAL(x) (x) -#define VIRTUAL_TO_PHYS(x) (x) - -static inline unsigned char -inb (unsigned short port) -{ - unsigned char data; - - __asm __volatile ("inb %1,%0":"=a" (data):"d" (port)); - return data; -} - -static inline void -outb (unsigned short port, unsigned char val) -{ - __asm __volatile ("outb %0,%1"::"a" (val), "d" (port)); -} - - -__inline__ static void -cmos_write_byte(int loc, int val) -{ - outb(0x70, loc); - outb(0x71, val); -} - -__inline__ static unsigned -cmos_read_byte(int loc) -{ - outb(0x70, loc); - return inb(0x71); -} - -#include "smp-imps.c" - -#endif /* ! GRUB_UTIL */ +# include "apic.h" +# include "smp-imps.h" +#endif /* * These are used for determining if the command-line should ask the user @@ -83,12 +41,12 @@ int normal_color; int highlight_color; char * -skip_to(int after_equal, char *cmdline) +skip_to (int after_equal, char *cmdline) { while (*cmdline && (*cmdline != (after_equal ? '=' : ' '))) cmdline++; - if (after_equal) + if (after_equal && *cmdline) cmdline++; while (*cmdline == ' ') @@ -99,15 +57,15 @@ skip_to(int after_equal, char *cmdline) void -init_cmdline(void) +init_cmdline (void) { - printf(" [ Minimal BASH-like line editing is supported. For the first word, TAB + printf (" [ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename. ESC at any time exits. ]\n"); } char commands[] = - " Possible commands are: \"pause= ...\", \"uppermem= \", \"root= \", +" Possible commands are: \"pause= ...\", \"uppermem= \", \"root= \", \"rootnoverify= \", \"chainloader= \", \"kernel= ...\", \"testload= \", \"read= \", \"displaymem\", \"impsprobe\", \"fstest\", \"debug\", \"module= ...\", \"modulenounzip= ...\", @@ -115,15 +73,15 @@ char commands[] = \"install= [d] [p] []\"\n"; static void -debug_fs_print_func(int sector) +debug_fs_print_func (int sector) { - printf("[%d]", sector); + printf ("[%d]", sector); } static int installaddr, installlist, installsect; static void -debug_fs_blocklist_func(int sector) +debug_fs_blocklist_func (int sector) { if (debug) printf("[%d]", sector); diff --git a/stage2/smp-imps.c b/stage2/smp-imps.c index 5d91525a9..3298c3580 100644 --- a/stage2/smp-imps.c +++ b/stage2/smp-imps.c @@ -1,3 +1,21 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999 Free Software Foundation, Inc. + * + * 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 of the License, 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ /* * @@ -40,10 +58,53 @@ #endif +/* + * This is the Intel MultiProcessor Spec debugging/display code. + */ + +#define IMPS_DEBUG +#define KERNEL_PRINT(x) printf x +#define CMOS_WRITE_BYTE(x, y) cmos_write_byte(x, y) +#define CMOS_READ_BYTE(x) cmos_read_byte(x) +#define PHYS_TO_VIRTUAL(x) (x) +#define VIRTUAL_TO_PHYS(x) (x) + +static inline unsigned char +inb (unsigned short port) +{ + unsigned char data; + + __asm __volatile ("inb %1,%0" :"=a" (data):"d" (port)); + return data; +} + +static inline void +outb (unsigned short port, unsigned char val) +{ + __asm __volatile ("outb %0,%1"::"a" (val), "d" (port)); +} + + +static inline void +cmos_write_byte (int loc, int val) +{ + outb (0x70, loc); + outb (0x71, val); +} + +static inline unsigned +cmos_read_byte (int loc) +{ + outb (0x70, loc); + return inb (0x71); +} + + /* * Includes here */ +#include "shared.h" #include "apic.h" #include "smp-imps.h"