do not include smp-imps.c but link smp-imps.o instead.

This commit is contained in:
okuji 1999-07-15 11:22:19 +00:00
parent edec404c96
commit 5cbce8e5a6
5 changed files with 116 additions and 60 deletions

View file

@ -1,3 +1,20 @@
1999-07-15 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
* 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 <okuji@kuicr.kyoto-u.ac.jp> 1999-07-14 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
The function ungetch is simulated so that the user can use a The function ungetch is simulated so that the user can use a

View file

@ -6,7 +6,7 @@ noinst_SCRIPTS = $(TESTS)
noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \ 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 \ 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 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 <stage1.h>. # For <stage1.h>.
INCLUDES = -I$(top_srcdir)/stage1 INCLUDES = -I$(top_srcdir)/stage1
@ -36,7 +36,7 @@ STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 \
# For stage2 target. # For stage2 target.
stage2_exec_SOURCES = asm.S boot.c common.c char_io.c cmdline.c \ 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 \ 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_CFLAGS = $(STAGE2_COMPILE)
stage2_exec_LDFLAGS = $(STAGE2_LINK) stage2_exec_LDFLAGS = $(STAGE2_LINK)

View file

@ -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 \ 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 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 <stage1.h>. # For <stage1.h>.
INCLUDES = -I$(top_srcdir)/stage1 INCLUDES = -I$(top_srcdir)/stage1
@ -118,7 +118,7 @@ STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 \
# For stage2 target. # For stage2 target.
stage2_exec_SOURCES = asm.S boot.c common.c char_io.c cmdline.c \ 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 \ 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_CFLAGS = $(STAGE2_COMPILE)
stage2_exec_LDFLAGS = $(STAGE2_LINK) 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-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-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-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_OBJECTS = $(am_stage2_exec_OBJECTS)
stage2_exec_LDADD = $(LDADD) stage2_exec_LDADD = $(LDADD)
stage2_exec_DEPENDENCIES = stage2_exec_DEPENDENCIES =
@ -218,8 +218,8 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
GZIP_ENV = --best GZIP_ENV = --best
DEP_FILES = .deps/asm.P .deps/bios.P .deps/boot.P .deps/char_io.P \ 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/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/fsys_fat.P .deps/fsys_ffs.P .deps/gunzip.P .deps/smp-imps.P \
.deps/stage2.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) 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) 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-fsys_fat.o: fsys_fat.c
stage2_exec-stage2.o: stage2.c stage2_exec-stage2.o: stage2.c
stage2_exec-bios.o: bios.c stage2_exec-bios.o: bios.c
stage2_exec-smp-imps.o: smp-imps.c
stage2.exec: $(stage2_exec_OBJECTS) $(stage2_exec_DEPENDENCIES) stage2.exec: $(stage2_exec_OBJECTS) $(stage2_exec_DEPENDENCIES)
@rm -f stage2.exec @rm -f stage2.exec
@ -1176,6 +1177,25 @@ stage2_exec-bios.lo: bios.c
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp 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) check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \ @failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \ srcdir=$(srcdir); export srcdir; \

View file

@ -22,51 +22,9 @@
#include "shared.h" #include "shared.h"
#ifndef GRUB_UTIL #ifndef GRUB_UTIL
# include "apic.h"
/* # include "smp-imps.h"
* This is the Intel MultiProcessor Spec debugging/display code. #endif
*/
#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 */
/* /*
* These are used for determining if the command-line should ask the user * These are used for determining if the command-line should ask the user
@ -83,12 +41,12 @@ int normal_color;
int highlight_color; int highlight_color;
char * char *
skip_to(int after_equal, char *cmdline) skip_to (int after_equal, char *cmdline)
{ {
while (*cmdline && (*cmdline != (after_equal ? '=' : ' '))) while (*cmdline && (*cmdline != (after_equal ? '=' : ' ')))
cmdline++; cmdline++;
if (after_equal) if (after_equal && *cmdline)
cmdline++; cmdline++;
while (*cmdline == ' ') while (*cmdline == ' ')
@ -99,15 +57,15 @@ skip_to(int after_equal, char *cmdline)
void 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 lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename. ESC at any time exits. ]\n"); completions of a device/filename. ESC at any time exits. ]\n");
} }
char commands[] = char commands[] =
" Possible commands are: \"pause= ...\", \"uppermem= <kbytes>\", \"root= <device>\", " Possible commands are: \"pause= ...\", \"uppermem= <kbytes>\", \"root= <device>\",
\"rootnoverify= <device>\", \"chainloader= <file>\", \"kernel= <file> ...\", \"rootnoverify= <device>\", \"chainloader= <file>\", \"kernel= <file> ...\",
\"testload= <file>\", \"read= <addr>\", \"displaymem\", \"impsprobe\", \"testload= <file>\", \"read= <addr>\", \"displaymem\", \"impsprobe\",
\"fstest\", \"debug\", \"module= <file> ...\", \"modulenounzip= <file> ...\", \"fstest\", \"debug\", \"module= <file> ...\", \"modulenounzip= <file> ...\",
@ -115,15 +73,15 @@ char commands[] =
\"install= <stage1_file> [d] <dest_dev> <file> <addr> [p] [<config_file>]\"\n"; \"install= <stage1_file> [d] <dest_dev> <file> <addr> [p] [<config_file>]\"\n";
static void 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 int installaddr, installlist, installsect;
static void static void
debug_fs_blocklist_func(int sector) debug_fs_blocklist_func (int sector)
{ {
if (debug) if (debug)
printf("[%d]", sector); printf("[%d]", sector);

View file

@ -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.
*/
/* /*
* <Insert copyright here : it must be BSD-like so anyone can use it> * <Insert copyright here : it must be BSD-like so anyone can use it>
@ -40,10 +58,53 @@
#endif #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 * Includes here
*/ */
#include "shared.h"
#include "apic.h" #include "apic.h"
#include "smp-imps.h" #include "smp-imps.h"