(2006-08-06) rescue-bootcd

This commit is contained in:
2006-08-06 00:00:00 +02:00
parent 2f796b816a
commit decb062d20
21091 changed files with 7076462 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
syslxmod.o: syslxmod.c syslinux.h
gethostip.o: gethostip.c
copybs.bin: copybs.asm
extlinux.bin: extlinux.asm macros.inc config.inc kernel.inc bios.inc tracers.inc \
layout.inc ext2_fs.inc init.inc cpuinit.inc ui.inc runkernel.inc \
comboot.inc com32.inc cmdline.inc bootsect.inc getc.inc conio.inc \
writestr.inc parseconfig.inc rllpack.inc parsecmd.inc bcopy32.inc \
loadhigh.inc font.inc graphics.inc highmem.inc strcpy.inc cache.inc \
keywords.inc
isolinux.bin: isolinux.asm macros.inc config.inc kernel.inc bios.inc tracers.inc \
layout.inc writestr.inc writehex.inc init.inc cpuinit.inc ui.inc \
runkernel.inc comboot.inc com32.inc cmdline.inc bootsect.inc getc.inc \
conio.inc parseconfig.inc rllpack.inc parsecmd.inc bcopy32.inc \
loadhigh.inc font.inc graphics.inc highmem.inc strcpy.inc rawcon.inc \
keywords.inc
ldlinux.bin: ldlinux.asm macros.inc config.inc kernel.inc bios.inc tracers.inc \
layout.inc cpuinit.inc init.inc ui.inc runkernel.inc comboot.inc \
com32.inc cmdline.inc bootsect.inc getc.inc conio.inc writestr.inc \
parseconfig.inc rllpack.inc parsecmd.inc bcopy32.inc loadhigh.inc font.inc \
graphics.inc highmem.inc strcpy.inc cache.inc keywords.inc
mbr.bin: mbr.asm bios.inc
pxelinux.bin: pxelinux.asm macros.inc config.inc kernel.inc bios.inc tracers.inc pxe.inc \
layout.inc init.inc cpuinit.inc ui.inc runkernel.inc comboot.inc \
com32.inc cmdline.inc bootsect.inc getc.inc conio.inc writestr.inc \
writehex.inc parseconfig.inc rllpack.inc parsecmd.inc bcopy32.inc \
loadhigh.inc font.inc graphics.inc highmem.inc strcpy.inc rawcon.inc \
dnsresolv.inc keywords.inc

Binary file not shown.

4
extra/syslinux-3.09/BUGS Normal file
View File

@@ -0,0 +1,4 @@
Known bugs that have not yet been fixed:
- PXELINUX: Some PXE stacks fail with routing enabled, some with
routing disabled. Try both?

340
extra/syslinux-3.09/COPYING Normal file
View File

@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -0,0 +1,257 @@
## $Id: Makefile,v 1.120 2005/04/02 21:48:47 hpa Exp $
## -----------------------------------------------------------------------
##
## Copyright 1998-2005 H. Peter Anvin - All Rights Reserved
##
## 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, Inc., 53 Temple Place Ste 330,
## Boston MA 02111-1307, USA; either version 2 of the License, or
## (at your option) any later version; incorporated herein by reference.
##
## -----------------------------------------------------------------------
#
# Main Makefile for SYSLINUX
#
OSTYPE = $(shell uname -msr)
CC = gcc
INCLUDE =
CFLAGS = -W -Wall -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
PIC = -fPIC
LDFLAGS = -O2 -s
AR = ar
RANLIB = ranlib
NASM = nasm -O99
NINCLUDE =
BINDIR = /usr/bin
SBINDIR = /sbin
LIBDIR = /usr/lib
AUXDIR = $(LIBDIR)/syslinux
INCDIR = /usr/include
PERL = perl
VERSION = $(shell cat version)
.c.o:
$(CC) $(INCLUDE) $(CFLAGS) -c $<
#
# The BTARGET refers to objects that are derived from ldlinux.asm; we
# like to keep those uniform for debugging reasons; however, distributors
# want to recompile the installers (ITARGET).
#
# BOBJECTS and IOBJECTS are the same thing, except used for
# installation, so they include objects that may be in subdirectories
# with their own Makefiles. Finally, there is a list of those
# directories.
#
CSRC = syslxmod.c gethostip.c
NASMSRC = $(wildcard *.asm)
SOURCES = $(CSRC) *.h $(NASMSRC) *.inc
# _bin.c files required by both BTARGET and ITARGET installers
BINFILES = bootsect_bin.c ldlinux_bin.c mbr_bin.c \
extlinux_bss_bin.c extlinux_sys_bin.c
# syslinux.exe is BTARGET so as to not require everyone to have the
# mingw suite installed
BTARGET = kwdhash.gen version.gen version.h \
ldlinux.bss ldlinux.sys ldlinux.bin \
pxelinux.0 mbr.bin isolinux.bin isolinux-debug.bin \
extlinux.bin extlinux.bss extlinux.sys
BOBJECTS = $(BTARGET) dos/syslinux.com win32/syslinux.exe memdisk/memdisk
BSUBDIRS = memdisk dos win32
ITARGET = copybs.com gethostip mkdiskimage
IOBJECTS = $(ITARGET) mtools/syslinux unix/syslinux extlinux/extlinux
ISUBDIRS = mtools unix extlinux sample com32
DOCS = COPYING NEWS README TODO BUGS *.doc sample menu com32
OTHER = Makefile bin2c.pl now.pl genhash.pl keywords findpatch.pl \
keytab-lilo.pl version version.pl sys2ansi.pl \
ppmtolss16 lss16toppm memdisk bin2hex.pl mkdiskimage.in
OBSOLETE = pxelinux.bin
# Things to install in /usr/bin
INSTALL_BIN = mtools/syslinux gethostip ppmtolss16 lss16toppm
# Things to install in /sbin
INSTALL_SBIN = extlinux/extlinux
# Things to install in /usr/lib/syslinux
INSTALL_AUX = pxelinux.0 isolinux.bin isolinux-debug.bin \
dos/syslinux.com copybs.com memdisk/memdisk mbr.bin
INSTALL_AUX_OPT = win32/syslinux.exe
# The DATE is set on the make command line when building binaries for
# official release. Otherwise, substitute a hex string that is pretty much
# guaranteed to be unique to be unique from build to build.
ifndef HEXDATE
HEXDATE := $(shell $(PERL) now.pl ldlinux.asm pxelinux.asm isolinux.asm)
endif
ifndef DATE
DATE := $(HEXDATE)
endif
MAKE += DATE=$(DATE) HEXDATE=$(HEXDATE)
#
# NOTE: If you don't have the mingw compiler suite installed, you probably
# want to remove win32 from this list; otherwise you're going to get an
# error every time you try to build.
#
all: all-local
set -e ; for i in $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
$(MAKE) all-local
-ls -l $(BOBJECTS) $(IOBJECTS)
all-local: $(BTARGET) $(ITARGET) $(BINFILES)
installer: installer-local
set -e ; for i in $(ISUBDIRS); do $(MAKE) -C $$i all ; done
-ls -l $(BOBJECTS) $(IOBJECTS)
installer-local: $(ITARGET) $(BINFILES)
version.gen: version version.pl
$(PERL) version.pl $< $@ '%define'
version.h: version version.pl
$(PERL) version.pl $< $@ '#define'
kwdhash.gen: keywords genhash.pl
$(PERL) genhash.pl < keywords > kwdhash.gen
ldlinux.bin: ldlinux.asm kwdhash.gen version.gen
$(NASM) -f bin -DDATE_STR="'$(DATE)'" -DHEXDATE="$(HEXDATE)" \
-DMAP=ldlinux.map -l ldlinux.lst -o ldlinux.bin ldlinux.asm
pxelinux.bin: pxelinux.asm kwdhash.gen version.gen
$(NASM) -f bin -DDATE_STR="'$(DATE)'" -DHEXDATE="$(HEXDATE)" \
-DMAP=pxelinux.map -l pxelinux.lst -o pxelinux.bin pxelinux.asm
isolinux.bin: isolinux.asm kwdhash.gen version.gen checksumiso.pl
$(NASM) -f bin -DDATE_STR="'$(DATE)'" -DHEXDATE="$(HEXDATE)" \
-DMAP=isolinux.map -l isolinux.lst -o isolinux.bin isolinux.asm
$(PERL) checksumiso.pl isolinux.bin
# Special verbose version of isolinux.bin
isolinux-debug.bin: isolinux.asm kwdhash.gen version.gen checksumiso.pl
$(NASM) -f bin -DDATE_STR="'$(DATE)'" -DHEXDATE="$(HEXDATE)" \
-DDEBUG_MESSAGES \
-DMAP=isolinux-debug.map -l isolinux-debug.lst \
-o isolinux-debug.bin isolinux.asm
$(PERL) checksumiso.pl $@
extlinux.bin: extlinux.asm kwdhash.gen version.gen
$(NASM) -f bin -DDATE_STR="'$(DATE)'" -DHEXDATE="$(HEXDATE)" \
-DMAP=extlinux.map -l extlinux.lst -o extlinux.bin extlinux.asm
pxelinux.0: pxelinux.bin
cp pxelinux.bin pxelinux.0
ldlinux.bss: ldlinux.bin
dd if=$< of=$@ bs=512 count=1
ldlinux.sys: ldlinux.bin
dd if=$< of=$@ bs=512 skip=1
extlinux.bss: extlinux.bin
dd if=$< of=$@ bs=512 count=1
extlinux.sys: extlinux.bin
dd if=$< of=$@ bs=512 skip=1
mbr.bin: mbr.asm
$(NASM) -f bin -l mbr.lst -o mbr.bin mbr.asm
mbr_bin.c: mbr.bin bin2c.pl
$(PERL) bin2c.pl syslinux_mbr < $< > $@
copybs.com: copybs.asm
$(NASM) -f bin -l copybs.lst -o copybs.com copybs.asm
bootsect_bin.c: ldlinux.bss bin2c.pl
$(PERL) bin2c.pl syslinux_bootsect < $< > $@
ldlinux_bin.c: ldlinux.sys bin2c.pl
$(PERL) bin2c.pl syslinux_ldlinux < $< > $@
extlinux_bss_bin.c: extlinux.bss bin2c.pl
$(PERL) bin2c.pl extlinux_bootsect < $< > $@
extlinux_sys_bin.c: extlinux.sys bin2c.pl
$(PERL) bin2c.pl extlinux_image < $< > $@
libsyslinux.a: bootsect_bin.o ldlinux_bin.o mbr_bin.o syslxmod.o
rm -f $@
$(AR) cq $@ $^
$(RANLIB) $@
$(LIB_SO): bootsect_bin.o ldlinux_bin.o syslxmod.o
$(CC) $(LDFLAGS) -shared -Wl,-soname,$(LIB_SONAME) -o $@ $^
gethostip.o: gethostip.c
gethostip: gethostip.o
mkdiskimage: mkdiskimage.in mbr.bin bin2hex.pl
$(PERL) bin2hex.pl < mbr.bin | cat mkdiskimage.in - > $@
chmod a+x $@
install: installer
mkdir -m 755 -p $(INSTALLROOT)$(BINDIR)
install -m 755 -c $(INSTALL_BIN) $(INSTALLROOT)$(BINDIR)
mkdir -m 755 -p $(INSTALLROOT)$(SBINDIR)
install -m 755 -c $(INSTALL_SBIN) $(INSTALLROOT)$(SBINDIR)
mkdir -m 755 -p $(INSTALLROOT)$(AUXDIR)
install -m 644 -c $(INSTALL_AUX) $(INSTALLROOT)$(AUXDIR)
-install -m 644 -c $(INSTALL_AUX_OPT) $(INSTALLROOT)$(AUXDIR)
$(MAKE) -C com32 install
install-lib: installer
install-all: install install-lib
local-tidy:
rm -f *.o *_bin.c stupid.* patch.offset
rm -f *.lst *.map
rm -f $(OBSOLETE)
tidy: local-tidy
set -e ; for i in $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
local-clean:
rm -f $(ITARGET)
clean: local-tidy local-clean
set -e ; for i in $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
dist: tidy
for dir in . sample memdisk ; do \
( cd $$dir && rm -f *~ \#* core ) ; \
done
local-spotless:
rm -f $(BTARGET) .depend *.so.*
spotless: local-clean dist local-spotless
set -e ; for i in $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
.depend:
rm -f .depend
for csrc in $(CSRC) ; do $(CC) $(INCLUDE) -MM $$csrc >> .depend ; done
for nsrc in $(NASMSRC) ; do $(NASM) -DDEPEND $(NINCLUDE) -o `echo $$nsrc | sed -e 's/\.asm/\.bin/'` -M $$nsrc >> .depend ; done
local-depend:
rm -f .depend
$(MAKE) .depend
depend: local-depend
$(MAKE) -C memdisk depend
# Hook to add private Makefile targets for the maintainer.
-include Makefile.private
# Include dependencies file
-include .depend

750
extra/syslinux-3.09/NEWS Normal file
View File

@@ -0,0 +1,750 @@
Starting with 1.47, changes marked with SYSLINUX/PXELINUX/ISOLINUX
apply to that specific program only; other changes apply to all of
them.
Changes in 3.09:
* gcc4 compilation fix.
* <BEL> (Ctrl-G) in message files now causes a beep.
* Reduce the command line to 511 characters; 1023 caused
memory overflows.
Changes in 3.08:
* SYSLINUX: Fix performance regression (-s mode always
enabled.)
* Add API function for idle loop.
* libutil: Add do_idle() function for idle loop, make
get_key() use it.
* libutil: Add SHA-1 and base64 functions.
* Simple menu system: add password support.
* EXTLINUX: Sparse files now handled correctly.
* EXTLINUX: Large directories now handled correctly.
* ALL: At the prompt, Ctrl-X now forces text mode.
* Fix configuration file parsing error, that could cause
hangs.
* Rewritten advanced menuing system from Murali Ganapathy.
* MEMDISK: New "bigraw" mode to work around certain broken
BIOS flash programs.
* COM32 module to boot Multiboot systems, including Xen. See
com32/modules/mboot.doc.
* Max command line changed to 1023 characters. Note that the
kernel proper still can only handle 255 characters without
patching, and COM16 binaries can only handle 125 characters.
Changes in 3.07:
* Fix chainloading (chain.c32).
* Fix zlib build problem.
* Use a private copy of <linux/ext2_fs.h>.
Changes in 3.06:
* Fix typo that caused the ramdisk to load in the wrong place.
Changes in 3.05:
* New API function "shuffle and boot"; allows COM32 modules to
load or construct (almost) arbitrarily complex objects,
e.g. a kernel and its initrd/initramfs in pieces, and have
the API core reorganize memory for booting. (A library API
for this function will be introduced in a later version.)
* The initrd= option now supports multiple filenames separated
by commas. This is mostly useful for initramfs, which can
be composed of multiple separate cpio or cpio.gz archives.
(Note: all files except the last one are zero-padded to a 4K
page boundary. This should not affect initramfs.)
* EXTLINUX: Fix API function 000Ah (get derivative-specific
info).
* libcom32/ethersel: Support PCI Config Mechanism #2 on
machines still infested with that hideous old hack.
* SYSLINUX: Fix directory-parsing bug.
Changes in 3.02:
* SYSLINUX: The "unix" installer now sets the MS-DOS
attributes (hidden, system, readonly.)
* COM32 library: build the .lnx (test modules for running
under Linux) as architecture native modules, in case
i386 devel libraries aren't installed.
* EXTLINUX: Hack for systems which don't have BLKGETSIZE64
defined in the standard header files.
* Simple menu system: minor aestetic improvements, and try to
work better over a serial console (speed, and readability on
monochrome terminal emulators.)
* New CONSOLE directive to control output on the video console
(useful for dealing with some broken serial-forwarding
BIOSes.)
* New com32 module "ethersel" for searching for an Ethernet
card and selecting the proper version of Etherboot.
* EXTLINUX: Allow the user to override the detected geometry.
Add help.
Changes in 3.01:
* EXTLINUX, SYSLINUX: Fix compile errors on some systems.
* EXTLINUX: Default to zipdrive geometry (64 heads, 32
sectors) if no other geometry can be detected.
Changes in 3.00:
* SYSLINUX: Support FAT32 and EDD. As an unfortunate
consequence, LDLINUX.SYS is no longer an ordinary file; it
is block-mapped at install time, which means it can only be
written using the syslinux installers.
* SYSLINUX: Reorganize the source code for the installers;
each one of the installers (dos, win32, unix, mtools) is now
built in its own subdirectory. In particular, "mtools" is
the unprivileged installer which uses mtools; "unix" is the
privileged installer which uses system calls.
* SYSLINUX: Completely rewritten DOS installer in C.
* ALL: "label" statement information is now stored in a
compressed format, which means that a lot more labels are
permitted (500-1000 in a typical configuration, but depends
on the complexity.)
* EXTLINUX: New derivative, which boots from an ext2/ext3
filesystem.
* SYSLINUX: The DOS and Win32 installers can now optionally
write the boot sector to a file instead of the real boot
sector. This is not supported in the Linux installers,
however.
* ALL: New NOESCAPE command, disables the "hold down the Shift
key to display the prompt" behaviour.
* New simple menu system, as an alternative to the advanced
menu system already present. See README.menu for details.
* PXELINUX: Filenames can now be prefixed with an IP address
or DNS name plus :: (e.g. 192.0.2.1::filename or
server.domain.com::filename), which downloads a file from an
alternate TFTP server, or just a :: (e.g. ::filename), which
suppresses the common pathname prefix. See pxelinux.doc.
* SYSLINUX: Add an -m option to the DOS and Win32 installers
to write an MBR and -a to mark the partition SYSLINUX is
being installed on active.
* MEMDISK: Give a way to query the boot loader type while
running MEMDISK; see memdisk/memdisk.doc and
sample/mdiskchk.c.
* mkdiskimage: substantially improved mkdiskimage which, among
other things, can now be used to initialize USB keys as
zipdrives; see README.usbkey for more information.
Changes in 2.13:
* MEMDISK: Fix command-line parsing "brown paper bag" class
bug.
* MEMDISK: Add "raw" mode to support the DOS boot disk from
WinME/XP, which seems to deliberately crash the system
when someone uses the "INT 15h mover" highmem API.
* Make "make install" do something sane for the com32
development environment.
* In the spec file, create a separate -devel RPM for the com32
development environment.
Changes in 2.12:
* Simple C library, based on klibc, for writing COM32
programs.
* Fix the handling of file length in loading of COM32
programs.
* MEMDISK: Work around a linker bug by rearranging the code to
not use the linker for the 16-bit code.
* SYSLINUX: If we're building on a machine without a Win32
(mingw) compiler, just skip building syslinux.exe.
* ISOLINUX: Support non-mkisofs mastering programs, at least
as long as the image is single-session. For best results,
ISOLINUX should be the only boot loader installed.
* MEMDISK: Allow the user to specify that the simulated disk
should be write-protected.
Changes in 2.11:
* ALL: Add an API call to get the configuration file name.
* SYSLINUX: Fix bug in 2.10 that prevented it from working
correctly for a lot of people.
* SYSLINUX: In the installer, make mtools a bit less fussy.
* Make the menu system compile with newer gcc's.
Changes in 2.10:
* MEMDISK: Handle images compressed with zip as well as with
gzip. Some Windows-based image tools apparently generate
these kinds of images by default. Patch by Patrick
LoPresti.
* Major menu improvement from Murali Ganapathy.
* ISOLINUX: Wonderfully sick and brilliant workaround for
severe bugs in certain Award BIOSes; from Knut Petersen.
* SYSLINUX: Fix for the nomtools installed, from Frederic
Pasteleurs.
* PXELINUX: Fix handling of IP numbers in the ranges
100-109 and 200-209.
* ALL: New option "allowoptions" (defaults to 1), which
controls if options are allowed on the command line or not.
* SYSLINUX: Support building under klibc (see the klibc
distribution for details.)
Changes in 2.09:
* SYSLINUX: Remove residual setuid crap from
syslinux-nomtools.
* Handle video pages correctly when using the API functions.
* Handle compiling on an x86-64 platform correctly.
* Menu system from Murali Krishnan Ganapathy; see the menu
directory for information.
* COMBOOT: Allow COMBOOT programs to change screen text mode.
* COMBOOT: Correct the documentation of how to detect
SYSLINUX from COMBOOT!!!!
* COMBOOT: Fix "get key without echo" API function.
* SYSLINUX: Fix bug that affected the API open function.
* ALL: Improve the E820 memory parser, to work around some
buggy BIOSes.
Changes in 2.08:
* Add new configuration command "ontimeout" to allow timeout
to have a different action than just pressing Enter.
* Add new configuration command "onerror" to allow a custom
command to be executed in case the kernel image is not found.
* Fix bugs in the COMBOOT/COM32 command-line parsing. APPEND
now works with COMBOOT/COM32 images.
* PXELINUX: Poll for ARP requests while sitting at the
prompt. This makes some boot servers a lot less unhappy.
* PXELINUX: Actually free sockets when we get a failure
(including file not found.) This bug would cause us to run
out of sockets and thus "go deaf" after a while.
* MEMDISK: Add an API to query for the existence of MEMDISK.
* SYSLINUX: Fix loading boot sectors (.bs/.bss) from floppy
disk.
* .c32 is now one of the extensions searched for
automatically.
* PXELINUX: RFBG.exe seems to randomly overwrite memory
location 0x5700. Thus, don't use it!
* PXELINUX: Change pathname length max from 63 to 127; change
max vkernels from 128 to 64.
* Support Ctrl-U -> kill entire command line input.
* The "samples" directory contains a (barely at all tested)
chain loading example, chain.c32, which may be used to
chainload local floppy disks and hard disks. Use with
"chain fdN" or "chain hdN [partition]"; N = 0 for the first
drive of each type.
Changes in 2.07:
* MEMDISK: Workaround for BIOSes which go into a snit when
they get a RESET command for the floppy system when there is
no floppy in the system.
* PXELINUX: Add "ipappend 2", which passes the hardware
address of the boot interface to the kernel as a
command-line option.
* mkdiskimage: fix the generation of the end limit.
* PXELINUX: Fix multiple bugs in chainloading of other NBPs.
* MEMDISK: Fix bug that would occationally cause "ran out of
input data" when using compressed disk images.
* SYSLINUX: Updates for the win32 installer (from Lars Munch.)
* PXELINUX: PXELINUX-specific options are now recognized both
in a vendor-option-space (a.k.a. type 43 encapsulated) as
well as in a site-option-space (unencapsulated.)
* COM32: Don't crash when DS != 0.
* COMBOOT/COM32: Make file reading work correctly. Thanks to
Phung Chi Kien for submitting a test program.
Changes in 2.06:
* ALL: Fix problem that would occationally cause a
boot failure, depending on the length of the kernel.
* ISOLINUX: Fix problem that would occationally cause a
boot failure, depending on the length of directories.
* SYSLINUX: Win32 installer now flushes buffers.
* ppmtolss16: Be fully compliant with the PNM spec;
actually process comments in the header and odd
alignments of the various parameters, as well as
"plain" (not raw) files and PBM and PGM files.
* PXELINUX: Lower the default MTU to 1472 in order to deal
with systems with slightly nonstandard MTUs, and PXE
stacks which don't defragment correctly. Unfortunately this
is very hard to test dynamically.
Changes in 2.05:
* PXELINUX: Add a default query based on the hardware address
of the boot device. This is in lower case hexadecimal form
separated by dashes and including the hardware type, for
example, the Ethernet (type 1) address 88:99:AA:BB:CC:DD
would query the file pxelinux.cfg/01-88-99-aa-bb-cc-dd.
* PXELINUX: Fix bug involving non-IP-based config file names.
* SYSLINUX: New installer for WinNT-based systems, from Lars
Munch.
* MEMDISK: Fix handling of memory region overlap when
decompressing. Thanks to Mikhail Kupchik for identifying
the problem.
Changes in 2.04:
* ALL: Reclaim even more low memory by observing that
comboot_seg == real_mode_seg is perfectly fine, and by the
fact that the 1000h segment managed to get unused in all
derivatives...
* PXELINUX: Attempt to negotiate full Ethernet-sized blocks
(1468 bytes) using the blksize option.
* SYSLINUX: Resurrect the old no-mtools version of the
installer, although as a root-only tool. Some distributors
have indicated that they need a small standalone installer.
* MEMDISK: Fix a memory offset computation error when
installing compressed disks which generally would cause
1 MB of memory to be wasted.
* MEMDISK: Fix installing the E820 memory map. Calling
INT 15h AX=0E820h with MEMDISK 2.03 loaded would give a
completely corrupt memory map.
* SYSLINUX: Make libsyslinux a dynamic library, so that it can
be updated separately from client programs. The whole idea,
after all, is to enable alternate programs to become
syslinux installers.
* Include an rpm spec file in the distribution, so rpmbuild
-ta works.
Changes in 2.03:
* Actually support comment lines in the configuration file.
* PXELINUX: Try to resolve some problems with stack switches.
* PXELINUX: Handle PXE stacks with broken routing.
With these workarounds, the remote install PXE boot floppy
(rbfg.exe) from Argon Technologies should work correctly.
* Fix problems with Perl scripts in UTF-8 locales.
* You probably need NASM 0.98.34 or later to compile this
version. 0.98.36 is recommended.
* MEMDISK: Now supports gzip compressed images.
Changes in 2.02:
* SYSLINUX: Security flaws have been found in the SYSLINUX
installer when running setuid root. Rewrite the SYSLINUX
installer so it uses mtools instead. It therefore now
requires mtools (specifically mcopy and mattrib) to exist on
your system, but it will not require root privileges and
SHOULD NOT be setuid.
Changes in 2.01:
* MEMDISK: Fix memory sizing bug when the ramdisk crosses the
16 MB boundary.
* MEMDISK: Add a "pause" option to stop immediately before
booting, to read off the messages.
* MEMDISK: Support disk images with DOSEMU headers.
* Update the mkdiskimage script to handle newer mtools
versions, and be able to generate disk images with DOSEMU
headers (controlled by the -d option).
* Fix the COM32 sample program.
* PXELINUX, ISOLINUX: Fix some COMBOOT API calls.
* PXELINUX: Doc fix.
* Build SYSLINUX into a small library for encapsulation into
other programs (however, please keep in mind this is a GPL'd
library.)
* SYSLINUX: Make installer work with "owner" in /etc/fstab.
* SYSLINUX: Fix issue with working on nonpartitioned hard disk
devices. THIS CONFIGURATION IS NOT RECOMMENDED.
Changes in 2.00:
* ALL: Add support for "COM32" (32-bit COMBOOT) images.
* ALL: Add an API for COMBOOT/COM32 images. See comboot.doc
for details. There is a C development environment for
COM32 being created; it should be ready at some point in
the future.
* Fix mbr.asm so that it actually works.
* SYSLINUX: The syslinux installer *SHOULD* now be safe to
run setuid root.
* PXELINUX: Fix bug where PXELINUX would override random
chunks of the UNDI code segment! Thanks to Kevin Tran for
finding this bug.
* ISOLINUX: Fix a bug related to slashes in pathnames.
* ISOLINUX: Fix a bug in handling initrds over 128 MB.
* ALL: Make the <Ctrl-V> key print out the version; this is
to help debugging.
* Add a small script, mkdiskimage, to create a DOS-formatted
hard disk image using mtools. This may be useful in
conjunction with MEMDISK.
* ISOLINUX: Search for a /boot/isolinux directory as well as
/isolinux.
* ALL: Fix a bug related to very long configuration files.
* PXELINUX: Work around a NASM bug which would result in no
delay before reset if an error occurs.
Changes in 1.76:
* ISOLINUX: Remove code no longer used which caused hangs on
some Toshiba laptops.
Changes in 1.75:
* ALL: NASM 0.98.32 or later is now required to build
SYSLINUX from sources.
* SYSLINUX: put back in the workaround for the BIOS floppy
table. This seems to be a requirement for "extended" floppy
formats to work correctly.
* SYSLINUX: No longer warn if one is trying to boot on a 286
or older. The above BIOS workaround no longer fits if the
requirement to use only 8086-compatible code in the early
boot is maintained. It made sense in 1994, but in 2002 a
286 or older is a museum object.
* SYSLINUX: Use a downright bizarre, stateful algorithm to try
to guess the maximum transfer size. I am *hoping* this will
cut down on the number of systems for which -s is required
to work at any acceptable speed.
* ISOLINUX: Add a few more workarounds for various broken El
Torito BIOSes.
* Make sure .depend files aren't accidentally packed...
* ALL: Fix bugs in the extension-detect code; this caused
files like COMBOOT images and CD boot sectors to be
mis-identified as Linux kernels and rejected.
* ALL: Fix the return from COMBOOT.
* ALL: Do some of the early groundwork for supporting DOS
system calls in COMBOOT.
* Get rid of unnecessary "near" directives, making the code
bigger.
* PXELINUX: Put the PXE stack back in the init state before
invoking a chain-loaded NBP.
* PXELINUX: Actually found the combination of calls that
allows some (most?) PXE 2+ stacks to be unloaded from memory
properly.
* PXELINUX: Add "keeppxe" command-line option to disable
the standard unloading of the PXE stack.
Changes in 1.74:
* SYSLINUX: fix bug that would cause valid kernel images to be
labelled "invalid".
Changes in 1.73:
* Work on removing gratuitous differences between modules.
* Break up the source in common and module-specific files.
* PXELINUX: Allow chaining of other PXE NBPs.
* ISOLINUX: Allow loading "CD-ROM boot sectors".
* ALL: generalize the definition of a boot sector/NBP.
Changes in 1.72:
* PXELINUX, ISOLINUX: Fix bugs in the new core code.
Changes in 1.71:
* Fix a "brown paper bag" class bug in the new core code.
Changes in 1.70:
* Major code restructuring.
* Relax the conventional memory limits somewhat.
* MEMDISK: Set up the "version number string" pointer in the
header correctly.
* SYSLINUX: Fix, again, "the bug that won't die": the use of
the offset parameter with the SYSLINUX installer.
* SYSLINUX: Fix possible superblock corruption problem in the
SYSLINUX installer.
Changes in 1.67:
* Handle bug in the location of initrd.
Changes in 1.66:
* MEMDISK: Make compile with newer versions of gcc.
Changes in 1.65:
* ISOLINUX: Support booting disk image files (to boot DOS or
other non-Linux operating systems), *IF* the BIOS works
correctly; unfortunately many BIOSes apparently don't.
* Support Linux boot protocol version 2.03 (explicitly
specify the initrd address limit.)
* Handle small "pseudo-kernels"; images that use the Linux
kernel boot protocols but are less than 64K in size.
* MEMDISK: New subsystem; this is a driver which allows
legacy OSes to boot using an in-memory simulated disk.
See memdisk/memdisk.doc for more info.
* PXELINUX, ISOLINUX: Correctly handle files larger than 65535
blocks (32 MB for PXELINUX, 128 MB for ISOLINUX.)
* PXELINUX: Make a best-effort attempt at freeing all memory
claimed. From the looks of it, it will fail on most PXE
stacks.
Changes in 1.64:
* Limited support for hardware flow control when using a
serial port console.
* Support specifying the serial port I/O address explicitly.
* Make DOS installer hopefully behave more nicely when used on
recent Windows versions.
* Fix returning to text mode when a font has been specified.
* Attempt to detect missing serial port hardware and disable
the serial port if there is nothing there.
Changes in 1.63:
* Make the ppmtolss16 program handle color conversion more
correctly.
* Clean up "make install" target, honour INSTALLROOT if it
exists.
* SYSLINUX: Fix stack-smash bug identified by Steffen
Winterfeldt.
* Hopefully fix return-to-text-mode on some graphics cards.
* ISOLINUX: Bug workaround for Award BIOS 4.51, and perhaps
other buggy BIOSes as well.
Changes in 1.62:
* PXELINUX: Allow the DHCP server to override the
configuration file name and pathname prefix, using
"site-specific" DHCP options.
* PXELINUX: Documentation fixes.
* PXELINUX: Fix the "ipappend" option; the last two values
were reversed vs. what the kernel expected.
* Introduce a way to return to text mode once we are already
in graphics mode. This may be useful for F-key help
screens.
* Fix several bugs in the way return to text mode was handled.
Changes in 1.61:
* ISOLINUX: Support full pathname searches. Max length for a
pathname is 255 characters. As a result, only 64 "label"
statements are supported in ISOLINUX.
* PXELINUX: Max filename length extended to 63 characters.
Changes in 1.60:
* Add support for graphical splash screens.
* Add mode control characters, which allows you to control
message display output depending on output mode (text,
graphics, or serial port.)
* ISOLINUX: New program, which boots Linux from a CD-ROM
without using floppy emulation mode. See isolinux.doc for
more details.
* PXELINUX: Don't search for boot sector file types, since
they don't work anyway.
* SYSLINUX: Document the LOCK command for Win9x, and the error
dialog box for WinNT/2K.
Changes in 1.54:
* PXELINUX: Fix code for finding !PXE from PXENV+. This was
due to a spec bug; match the most recent spec since that
seems to be what implementations actually do.
* SYSLINUX: Add some smarts to the boot sector, which
hopefully should reduce the number of systems which require
stupid mode ("syslinux -s").
* PXELINUX: Document further some of the pathologies with old
PXE stacks.
* When specifying a "default" command line, no longer
automatically appent "auto". See the "DEFAULT" command in
syslinux.doc for more information.
* PXELINUX: Clean up the allocation of local socket numbers.
Changes in 1.53:
* PXELINUX: Rename pxelinux.bin to pxelinux.0, to match what
most PXE servers seem to expect.
* PXELINUX: Update the DHCP/boot server setup documentation.
* PXELINUX: Support new "localboot" option for "label"
sections.
* PXELINUX: More robust parsing of DHCP/boot server packets.
* PXELINUX: Include a small utility program "gethostip" to
compute hexadecimal IP addresses.
Changes in 1.52:
* PXELINUX: Fix bugs introduced by new A20 code. (SYSLINUX
has also been changed for code consistency reasons, but I'm
pretty sure the changes are don't care on SYSLINUX.)
* Documentation updates.
* PXELINUX: Add "ipappend" option to generate an ip= option to
the kernel.
Changes in 1.51:
* PXELINUX: Not all PXE stacks fill in the IP address for a
type 3 cached info query. Use a type 2 cached info query
for this information (only.)
* Yet another attempt at A20 coding. Now support BIOS call
15:2401 as well, and handle machines which always have A20
on separately.
* Support memory detection using INT 15h, AX=0E820h. BIOS
manufacturers have apparently gotten sloppy about keeping
INT 15h, AX=0E801h working properly.
* Don't issue <CR><LF> onto the serial port when we're doing
screen wraparound.
Changes in 1.50:
* Yet another A20-code update. It seems some "legacy-free"
machines and embedded gear simply don't have a KBC to talk
to, and that waiting for one will wait forever. Sigh.
Changes in 1.49:
* SYSLINUX: Implement a hack for BIOS drivers which hog significant
chunks of low memory during boot. (Note: PXELINUX already
had this modification. SYSLINUX does still require that the
low 512K is available; PXELINUX requires 384K. Machines
with a physical memory hole in the low 640K cannot boot
Linux no matter what.) Depending what the reason is for the
memory hole, a new kernel (2.4.0-test3-pre3 or later) may be
required.
* SYSLINUX: Default installer binary now compiled against
glibc 2.1. If this is inappropriate for your system and you
still want to use the offical version of SYSLINUX, please
follow the instructions in "distrib.doc" to rebuild the
installer.
* SYSLINUX: Linux installer program now supports -o <offset>
option which does a loopback mount with the
-o loop,offset=<> option. Useful to run SYSLINUX on an
individual partition of a whole-harddisk image.
* Include the source code to a Master Boot Record (MBR)
functionally equivalent to the one installed DOS except it
includes EBIOS support, and should be resistant to geometry
changes. The MBR code is public domain.
* PXELINUX: Fix "double p" bug: if the tftp prefix was null,
all filenames would get a "p" preprended, e.g.
"ppxelinux.cfg" and "pvmlinux".
Changes in 1.48:
* PXELINUX: Workaround for PXE ROMs based on the Intel PXE PDK
3.0 build 071 and earlier: missing !PXE structure pointer.
* PXELINUX: Handle larger BOOTP/DHCP packages.
* PXELINUX: The command line passing was broken; fix.
* PXELINUX: Make COMBOOT images work.
* PXELINUX: Documentation on how to make booting work using
the PDK 3.0-derived clients, which aren't so generous as to
allow booting with only "PXEClient" specified.
Changes in 1.47:
* PXELINUX: RFC 1123 states that a TFTP implementation MUST
use adaptive timeout, "at least an exponential backoff of
retransmission timeout is necessary." Implement a very
simple exponential backoff for retransmits.
* PXELINUX: Updated documentation, including pointer to new
TFTP server.
* PXELINUX: When sending ERROR due to bad OACK, use the proper
destination port number (why are TFTP port numbers so odd?)
* PXELINUX: If the boot dies in the middle somewhere,
eventually give up and reset the machine (unattended
operation.)
Changes in 1.46:
* New program PXELINUX to do network booting using a
PXE-compliant (Pre-Execution Environment) network booting
PROM. See pxelinux.doc for details.
Changes in 1.45:
* Serial console support. See syslinux.doc for details.
Changes in 1.44:
* Change HIGHMEM_MAX to 38000000h to (hopefully) avoid the
kernel stepping on it; 3f000000h was apparently a higher
limit than the kernel used!
Changes in 1.43:
* Add sys2ansi.pl script to display the contents of a
colorized SYSLINUX file.
* Changed the io_delay once again, after a report that the
old delay port causes hangs on some systems.
Changes in 1.42:
* Frob the "fast A20 gate" port as well as the keyboard
controller; will this help systems with problems?
* Be even more paranoid about A20, unfortunately even this
seems to be not paranoid enough... what I don't understand
is that if there is hardware out there *this broken*, how
can it run Linux at all? Report an error message rather
than hang forever if A20 is stuck.
* Include some intermediate files in the distribution, plus
provide a "make installer" target for distributors to relink
the install programs only. I would prefer the syslinux boot
loader proper to be "binary clean" for debuggablity -- use
"make clean ; make installer" to rebuild the installers only.
Changes in 1.41:
* Don't get confused by directories, volume labels, or VFAT
long names.
* Use INT 15h, AX=0E801h to query memory size before trying
INT 15h, AH=88h. This not only provides more headroom
between the kernel and the initrd on large-memory machines,
but it appears some recent BIOSes actually have started
returning garbage for the AH=88h (older) call.
* Trust high memory beyond the 15 MB mark if the user has
specified it, or if obtained with INT 15h, AH=0E801h (with
no memory holes above 1 MB.)
Changes in 1.40:
* Increase A20M delay and put in a test to avoid problems on
certain IBM Thinkpads (thanks to Donnie Barnes of RedHat
for vital info on this one.)
* Support COMBOOT style boot command images.
* Support chain loading (foreign operating systems, e.g. DOS).
* Include a new "copybs" DOS utility to copy a boot sector to
a file (under Linux, use "dd".)
* Fix the DOS installer to work for disks over 32 MB.
* SYSLINUX should now handle disks with more than 65536 tracks.
Changes in 1.37:
* Fix a bug that caused "label" statements in syslinux.cfg to
not be handled properly.
* Updated the documentation. Among other things, we now allow
up to 128 "label" statements.
Changes in 1.36:
* Fix for booting old (pre-initrd) kernels.
* It seems at least some versions of OS/2 doesn't set up all
the fields in the superblock correctly. Account for that.
* Fix bug that caused boot failure when using the mem= option.
Changes in 1.35:
* Loading from partitions now should work properly. (Actually
tested, this time. You should even be able to dd a floppy
to a partition and boot from it.)
* Removed large workaround code for an alleged ancient BIOS
bug I have never actually seen. The -s option should work
on those machines, anyway.
* Support for simple keyboard remappings, same as used by
LILO (once again to support localization.) The program
keytab-lilo.pl from the LILO distribution included to
generate such maps.
* Added a "safe, slow and stupid" (-s) option to the
installers. This option will lobotomize the boot sector to
hopefully work on even very buggy BIOSes.
Changes in 1.34:
* Ability to load a VGA font on bootup (for localized Linux
distributions.)
Changes in 1.33:
* Bug fix in the Linux installer.
* Added a workaround for a bug in certain AMI/Intel BIOSes
when booting from CD-ROM.
* Documentation changes.
Changes in 1.32:
* FAT16 filesystems are now supported.
Changes in 1.31:
* Now compiles under Linux, using NASM, rather than using
Turbo Assembler under DOS. See http://www.cryogen.com/Nasm
for information about NASM.
* Linux-hosted SYSLINUX installer, as well as a
rewritten DOS installer (now is written in assembler, so we
don't need Turbo C.)
Changes in 1.30:
* Added support for loading bzImage and initrd loading, and made
SYSLINUX new-setup-code aware (SYSLINUX 1.30 id=0x31).
* Added LILO-style kernel labels; see the LABEL and IMPLICIT
keywords in README file.
* Added support for colorization of intro and help screens.
* The vga= option is now handled correctly.
* Massive rewrite of large chunks of the code in order to
support the first two new features.
Changes in 1.20:
* Added simple online help at the "boot:" prompt.
* Removed 2880K image as I no longer have access to such a
floppy drive. (Donations accepted!!)
* Decided to distribute the source in a subdirectory rather
than in a nested zipfile.
Changes in 1.11:
* Removed a sanity check which would cause booting to fail on
Phoenix BIOS version 4.03. Apparently this BIOS is buggy.
Changes in 1.10:
* Added configuration file SYSLINUX.CFG. This file contains all
configurable options, and can be edited from any OS which can
access an MS-DOS filesystem; there is no longer a need to run
SYSLINUX.EXE except to write the boot sector.
* Default command line now given by "default" line in config
file.
* LINUXMSG.TXT and BOOTMSG.TXT hard-coded file names replaced by
"display" and "prompt" lines in config file.
* LILO-style option appending now supported ("append" line in
config file).
* Prompt timeout is now supported ("timeout" line in config
file). The timeout is cancelled when anything is typed on the
command line.
* Pressing <ESC> or <Ctrl-C> at the Loading... stage now aborts
the kernel loading in progress and returns the user to the
boot: prompt.
* The installer now automatically sets the READONLY flag on
LDLINUX.SYS.
* Added 2880K disk image.
Changes in 1.03:
* Fixed bug that would prevent booting from double-density
floppies and other DOS filesystems with multiple sectors per
cluster.
* Added 720K disk image.
* Changed default kernel name on disk images to LINUX.
Changes in 1.02:
* Fixed bug that would garble the command line on recent kernels
with more than 4 sectors of setup code (this wasn't really a
*bug*; rather, a kernel change broke the code. Unfortunately
the Linux boot interface is still sorely undocumented).
* Added BOOTMSG.TXT file support (message file which does not
force display of the boot prompt).
Changes in 1.01:
* Fixed bug on some (most?) 386 BIOSes would require two boot
attempts.

View File

@@ -0,0 +1,31 @@
See the following files for documentation about SYSLINUX:
syslinux.doc - Usage instructions; manual.
distrib.doc - For creators of Linux distributions.
pxelinux.doc - Documentation specific to PXELINUX.
isolinux.doc - Documentation specific to ISOLINUX.
extlinux.doc - Documentation specific to EXTLINUX.
README.menu - About the menu systems.
README.usbkey - About using SYSLINUX on USB keys.
comboot.doc - About the extension API.
memdisk/memdisk.doc - Documentation about MEMDISK.
NEWS - List of changes from previous releases.
TODO - About features planned for future releases.
COPYING - For the license terms of this software.
SYSLINUX now builds in a Linux environment, using nasm. You need nasm
version 0.98.38 or later to build SYSLINUX from source. See
http://nasm.sf.net/ for information about nasm.
There is now a mailing list for SYSLINUX. See the end of syslinux.doc
for details.
SYSLINUX is:
Copyright 1994-2005 H. Peter Anvin - All Rights Reserved
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, Inc., 53 Temple Place Ste 330,
Boston MA 02111-1307, USA; either version 2 of the License, or
(at your option) any later version; incorporated herein by reference.

View File

@@ -0,0 +1,119 @@
$Id: README.menu,v 1.5 2005/01/21 01:35:33 hpa Exp $
There are two menu systems included with SYSLINUX, the advanced menu
system, and the simple menu system.
+++ THE ADVANCED MENU SYSTEM +++
The advanced menu system, written by Murali Krishnan Ganapathy, is
located in the menu/ subdirectly. It allows the user to create
hierarchial submenus, dynamic options, checkboxes, and just about
anything you want. It requires that the menu is compiled from a
simple C file, see menu/simple.c and menu/complex.c for examples.
The advanced menu system doesn't support serial console at this time.
See menu/README for more information.
+++ THE SIMPLE MENU SYSTEM +++
The simple menu system is a single module located at
com32/modules/menu.c32. It uses the same configuration file as the
regular SYSLINUX command line, and displays all the LABEL statements.
To use the menu system, simply make sure menu.c32 is in the
appropriate location for your boot medium (the same directory as the
configuration file for SYSLINUX, EXTLINUX and ISOLINUX, and the same
directory as pxelinux.0 for PXELINUX), and put the following options
in your configuration file:
DEFAULT menu.c32
PROMPT 0
There are a few menu additions to the command line, all starting with
the keyword MENU; like the rest of the SYSLINUX config file
language, it is case insensitive:
MENU TITLE title
Give the menu a title. The title is presented at the top of
the menu.
MENU LABEL label
(Only valid after a LABEL statement.)
Changes the label displayed for a specific entry. This allows
you to have a label that isn't suitable for the command line,
for example:
# Soft Cap Linux
LABEL softcap
MENU LABEL Soft Cap ^Linux 9.6.36
KERNEL softcap-9.6.36.bzi
APPEND whatever
# A very dense operating system
LABEL brick
MENU LABEL ^Windows CE/ME/NT
KERNEL chain.c32
APPEND hd0 2
The ^ symbol in a MENU LABEL statement defines a hotkey.
The hotkey will be highlighted in the menu and will move the
menu cursor immediately to that entry.
MENU HIDE
(Only valid after a LABEL statement.)
Suppresses a particular LABEL entry from the menu.
MENU DEFAULT
(Only valid after a LABEL statement.)
Indicates that this entry should be the default. If no
default is specified, use the first one.
MENU PASSWD passwd
(Only valid after a LABEL statement.)
Sets a password on this menu entry. "passwd" can be either a
cleartext password or a SHA-1 encrypted password; use the
included Perl script "sha1pass" to encrypt passwords.
(Obviously, if you don't encrypt your passwords they will not
be very secure at all.)
If you are using passwords, you want to make sure you also use
the settings "NOESCAPE 1", "PROMPT 0", and either set
"ALLOWOPTIONS 0" or use a master password (see below.)
If passwd is an empty string, this menu entry can only be
unlocked with the master password.
MENU MASTER PASSWD passwd
Sets a master password. This password can be used to boot any
menu entry, and is required for the [Tab] and [Esc] keys to
work.
The menu system honours the TIMEOUT command; if TIMEOUT is specified
it will execute the ONTIMEOUT command if one exists, otherwise it will
pick the default menu option.
Normally, the user can press [Tab] to edit the menu entry, and [Esc]
to return to the SYSLINUX command line. However, if the configuration
file specifies ALLOWOPTIONS 0, these keys will be disabled, and if
MENU MASTER PASSWD is set, they require the master password.
The simple menu system supports serial console, using the normal
SERIAL directive. However, it can be quite slow over a slow serial
link; you probably want to set your baudrate to 38400 or higher if
possible. It requires a Linux/VT220/ANSI-compatible terminal on the
other end.

View File

@@ -0,0 +1,49 @@
$Id: README.usbkey,v 1.2 2004/12/30 23:31:14 hpa Exp $
The proper mode to boot a USB key drive in is "USB-HDD". That is the
ONLY mode in which the C/H/S geometry encoded on the disk itself
doesn't have to match what the BIOS thinks it is. Since geometry on
USB drives is completely arbitrary, and can vary from BIOS to BIOS,
this is the only mode which will work in general.
Some BIOSes have been reported (in particular, certain versions of the
Award BIOS) that cannot boot USB keys in "USB-HDD" mode. This is a
very serious BIOS bug, but it is unfortunately rather typical of the
kind of quality we're seeing out of major BIOS vendors these days. On
these BIOSes, you're generally stuck booting them in USB-ZIP mode.
THIS MEANS THE FILESYSTEM IMAGE ON THE DISK HAS TO HAVE A CORRECT
ZIPDRIVE-COMPATIBLE GEOMETRY.
A standard zipdrive (both the 100 MB and the 250 MB varieties) have a
"geometry" of 64 heads, 32 sectors, and are partitioned devices with a
single partition 4 (unlike most other media of this type which uses
partition 1.) The 100 MB variety has 96 cylinders, and the 250 MB
variety has 239 cylinders; but any number of cylinders will do as
appropriate for the size device you have. For example, if your device
reports when inserted into a Linux system:
usb-storage: device found at 4
Vendor: 32MB Model: HardDrive Rev: 1.88
Type: Direct-Access ANSI SCSI revision: 02
SCSI device sda: 64000 512-byte hdwr sectors (33 MB)
... you would have 64000/(64*32) = 31.25 cylinders; round down to 31.
The script "mkdiskimage" which is supplied with the syslinux
distribution can be used to initialize USB keys in a Zip-like fashion.
To do that, calculate the correct number of cylinders (31 in the
example above), and, if your USB key is /dev/sda (CHECK THE KERNEL
MESSAGES CAREFULLY - IF YOU ENTER THE WRONG DISK DRIVE IT CANNOT BE
RECOVERED), run:
mkdiskimage -4 /dev/sda 0 64 32
(The 0 means automatically determine the size of the device, and -4
means mimic a zipdisk by using partition 4.)
Then you should be able to run
syslinux /dev/sda4
... and mount /dev/sda4 and put your files on it as needed.

30
extra/syslinux-3.09/TODO Normal file
View File

@@ -0,0 +1,30 @@
$Id: TODO,v 1.29 2005/01/05 09:21:07 hpa Exp $
*** To do in the short term:
- PXELINUX: Support changing the default server and boot file prefix?
- Support loading a new configuration file.
- "Shuffle and boot" extension, with the appropriate com32 library
support.
- Library support for all the comboot system calls.
*** Future projects:
- Clean up the command-line parsing.
- Cleaned up documentation, with a real man page.
- Subdirectory support in SYSLINUX.
- Support files that span multiple input media (SYSLINUX)
-> Seems to be getting less important; floppies are dying?
- Clean up the handling of sections
- Add "localboot" support to SYSLINUX (using the ISOLINUX feature
set.)
OBSOLETE: chain.c32 is probably better.

View File

@@ -0,0 +1,458 @@
;; $Id: bcopy32.inc,v 1.16 2005/01/06 22:34:06 hpa Exp $
;; -----------------------------------------------------------------------
;;
;; Copyright 1994-2005 H. Peter Anvin - All Rights Reserved
;;
;; 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, Inc., 53 Temple Place Ste 330,
;; Boston MA 02111-1307, USA; either version 2 of the License, or
;; (at your option) any later version; incorporated herein by reference.
;;
;; -----------------------------------------------------------------------
;;
;; bcopy32.inc
;;
;; 32-bit bcopy routine for real mode
;;
;
; 32-bit bcopy routine for real mode
;
; We enter protected mode, set up a flat 32-bit environment, run rep movsd
; and then exit. IMPORTANT: This code assumes cs == 0.
;
; This code is probably excessively anal-retentive in its handling of
; segments, but this stuff is painful enough as it is without having to rely
; on everything happening "as it ought to."
;
; NOTE: this code is relocated into low memory, just after the .earlybss
; segment, in order to support to "bcopy over self" operation.
;
section .bcopy32
align 8
__bcopy_start:
; This is in the .text segment since it needs to be
; contiguous with the rest of the bcopy stuff
bcopy_gdt: dw bcopy_gdt_size-1 ; Null descriptor - contains GDT
dd bcopy_gdt ; pointer for LGDT instruction
dw 0
dd 0000ffffh ; Code segment, use16, readable,
dd 00009b00h ; present, dpl 0, cover 64K
dd 0000ffffh ; Data segment, use16, read/write,
dd 008f9300h ; present, dpl 0, cover all 4G
dd 0000ffffh ; Data segment, use16, read/write,
dd 00009300h ; present, dpl 0, cover 64K
; The rest are used for COM32 only
dd 0000ffffh ; Code segment, use32, readable,
dd 00cf9b00h ; present, dpl 0, cover all 4G
dd 0000ffffh ; Data segment, use32, read/write,
dd 00cf9300h ; present, dpl 0, cover all 4G
bcopy_gdt_size: equ $-bcopy_gdt
;
; bcopy:
; 32-bit copy, overlap safe
;
; Inputs:
; ESI - source pointer
; EDI - target pointer
; ECX - byte count
; DF - zero
;
; Outputs:
; ESI - first byte after source
; EDI - first byte after target
; ECX - zero
;
bcopy: push eax
push esi
push edi
push ecx
pushf ; Saves, among others, the IF flag
push ds
push es
cli
call enable_a20
o32 lgdt [cs:bcopy_gdt]
mov eax,cr0
or al,1
mov cr0,eax ; Enter protected mode
jmp 08h:.in_pm
.in_pm: mov ax,10h ; Data segment selector
mov es,ax
mov ds,ax
; Don't mess with ss, fs, and gs. They are never changed
; and should be able to make it back out of protected mode.
; This works because (and only because) we don't take
; interrupt in protected mode.
cmp esi,edi ; If source > destination, we might
ja .reverse ; have to copy backwards
.forward:
mov al,cl ; Save low bits
and al,3
shr ecx,2 ; Convert to dwords
a32 rep movsd ; Do our business
; At this point ecx == 0
mov cl,al ; Copy any fractional dword
a32 rep movsb
jmp .exit
.reverse:
std ; Reverse copy
lea esi,[esi+ecx-1] ; Point to final byte
lea edi,[edi+ecx-1]
mov eax,ecx
and ecx,3
shr eax,2
a32 rep movsb
; Change ESI/EDI to point to the last dword, instead
; of the last byte.
sub esi,3
sub edi,3
mov ecx,eax
a32 rep movsd
cld
.exit:
mov ax,18h ; "Real-mode-like" data segment
mov es,ax
mov ds,ax
mov eax,cr0
and al,~1
mov cr0,eax ; Disable protected mode
jmp 0:.in_rm
.in_rm: ; Back in real mode
pop es
pop ds
call disable_a20
popf ; Re-enables interrupts
pop eax
pop edi
pop esi
add edi,eax
add esi,eax
pop eax
ret
;
; Routines to enable and disable (yuck) A20. These routines are gathered
; from tips from a couple of sources, including the Linux kernel and
; http://www.x86.org/. The need for the delay to be as large as given here
; is indicated by Donnie Barnes of RedHat, the problematic system being an
; IBM ThinkPad 760EL.
;
; We typically toggle A20 twice for every 64K transferred.
;
%define io_delay call _io_delay
%define IO_DELAY_PORT 80h ; Invalid port (we hope!)
%define disable_wait 32 ; How long to wait for a disable
; Note the skip of 2 here
%define A20_DUNNO 0 ; A20 type unknown
%define A20_NONE 2 ; A20 always on?
%define A20_BIOS 4 ; A20 BIOS enable
%define A20_KBC 6 ; A20 through KBC
%define A20_FAST 8 ; A20 through port 92h
slow_out: out dx, al ; Fall through
_io_delay: out IO_DELAY_PORT,al
out IO_DELAY_PORT,al
ret
enable_a20:
pushad
mov byte [cs:A20Tries],255 ; Times to try to make this work
try_enable_a20:
;
; Flush the caches
;
%if DO_WBINVD
call try_wbinvd
%endif
;
; If the A20 type is known, jump straight to type
;
mov bp,[cs:A20Type]
jmp word [cs:bp+A20List]
;
; First, see if we are on a system with no A20 gate
;
a20_dunno:
a20_none:
mov byte [cs:A20Type], A20_NONE
call a20_test
jnz a20_done
;
; Next, try the BIOS (INT 15h AX=2401h)
;
a20_bios:
mov byte [cs:A20Type], A20_BIOS
mov ax,2401h
pushf ; Some BIOSes muck with IF
int 15h
popf
call a20_test
jnz a20_done
;
; Enable the keyboard controller A20 gate
;
a20_kbc:
mov dl, 1 ; Allow early exit
call empty_8042
jnz a20_done ; A20 live, no need to use KBC
mov byte [cs:A20Type], A20_KBC ; Starting KBC command sequence
mov al,0D1h ; Command write
out 064h, al
call empty_8042_uncond
mov al,0DFh ; A20 on
out 060h, al
call empty_8042_uncond
; Verify that A20 actually is enabled. Do that by
; observing a word in low memory and the same word in
; the HMA until they are no longer coherent. Note that
; we don't do the same check in the disable case, because
; we don't want to *require* A20 masking (SYSLINUX should
; work fine without it, if the BIOS does.)
.kbc_wait: push cx
xor cx,cx
.kbc_wait_loop:
call a20_test
jnz a20_done_pop
loop .kbc_wait_loop
pop cx
;
; Running out of options here. Final attempt: enable the "fast A20 gate"
;
a20_fast:
mov byte [cs:A20Type], A20_FAST ; Haven't used the KBC yet
in al, 092h
or al,02h
and al,~01h ; Don't accidentally reset the machine!
out 092h, al
.fast_wait: push cx
xor cx,cx
.fast_wait_loop:
call a20_test
jnz a20_done_pop
loop .fast_wait_loop
pop cx
;
; Oh bugger. A20 is not responding. Try frobbing it again; eventually give up
; and report failure to the user.
;
dec byte [cs:A20Tries]
jnz try_enable_a20
mov si, err_a20
jmp abort_load
;
; A20 unmasked, proceed...
;
a20_done_pop: pop cx
a20_done: popad
ret
;
; This routine tests if A20 is enabled (ZF = 0). This routine
; must not destroy any register contents.
;
a20_test:
push es
push cx
push ax
mov cx,0FFFFh ; HMA = segment 0FFFFh
mov es,cx
mov cx,32 ; Loop count
mov ax,[cs:A20Test]
.a20_wait: inc ax
mov [cs:A20Test],ax
io_delay ; Serialize, and fix delay
cmp ax,[es:A20Test+10h]
loopz .a20_wait
.a20_done: pop ax
pop cx
pop es
ret
disable_a20:
pushad
;
; Flush the caches
;
%if DO_WBINVD
call try_wbinvd
%endif
mov bp,[cs:A20Type]
jmp word [cs:bp+A20DList]
a20d_bios:
mov ax,2400h
pushf ; Some BIOSes muck with IF
int 15h
popf
jmp short a20d_snooze
;
; Disable the "fast A20 gate"
;
a20d_fast:
in al, 092h
and al,~03h
out 092h, al
jmp short a20d_snooze
;
; Disable the keyboard controller A20 gate
;
a20d_kbc:
call empty_8042_uncond
mov al,0D1h
out 064h, al ; Command write
call empty_8042_uncond
mov al,0DDh ; A20 off
out 060h, al
call empty_8042_uncond
; Wait a bit for it to take effect
a20d_snooze:
push cx
mov cx, disable_wait
.delayloop: call a20_test
jz .disabled
loop .delayloop
.disabled: pop cx
a20d_dunno:
a20d_none:
popad
ret
;
; Routine to empty the 8042 KBC controller. If dl != 0
; then we will test A20 in the loop and exit if A20 is
; suddenly enabled.
;
empty_8042_uncond:
xor dl,dl
empty_8042:
call a20_test
jz .a20_on
and dl,dl
jnz .done
.a20_on: io_delay
in al, 064h ; Status port
test al,1
jz .no_output
io_delay
in al, 060h ; Read input
jmp short empty_8042
.no_output:
test al,2
jnz empty_8042
io_delay
.done: ret
;
; Execute a WBINVD instruction if possible on this CPU
;
%if DO_WBINVD
try_wbinvd:
wbinvd
ret
%endif
;
; bcopy_over_self:
;
; This routine is used to shuffle memory around, followed by
; invoking an entry point somewhere in low memory. This routine
; can clobber any memory above 7C00h, we therefore have to move
; necessary code into the trackbuf area before doing the copy,
; and do adjustments to anything except BSS area references.
;
; NOTE: Since PXELINUX relocates itself, put all these
; references in the ".earlybss" segment.
;
; After performing the copy, this routine resets the stack and
; jumps to the specified entrypoint.
;
; IMPORTANT: This routine does not canonicalize the stack or the
; SS register. That is the responsibility of the caller.
;
; Inputs:
; DS:BX -> Pointer to list of (dst, src, len) pairs
; AX -> Number of list entries
; [CS:EntryPoint] -> CS:IP to jump to
; On stack - initial state (fd, ad, ds, es, fs, gs)
;
shuffle_and_boot:
and ax,ax
jz .done
.loop:
mov edi,[bx]
mov esi,[bx+4]
mov ecx,[bx+8]
call bcopy
add bx,12
dec ax
jnz .loop
.done:
pop gs
pop fs
pop es
pop ds
popad
popfd
jmp far [cs:EntryPoint]
align 2
A20List dw a20_dunno, a20_none, a20_bios, a20_kbc, a20_fast
A20DList dw a20d_dunno, a20d_none, a20d_bios, a20d_kbc, a20d_fast
a20_adjust_cnt equ ($-A20List)/2
A20Type dw A20_NONE ; A20 type
; Total size of .bcopy32 section
alignb 4, db 0 ; Even number of dwords
__bcopy_size equ $-__bcopy_start
section .earlybss
alignb 2
EntryPoint resd 1 ; CS:IP for shuffle_and_boot
SavedSSSP resd 1 ; Saved real mode SS:SP
A20Test resw 1 ; Counter for testing status of A20
A20Tries resb 1 ; Times until giving up on A20

View File

@@ -0,0 +1,59 @@
#!/usr/bin/perl
## $Id: bin2c.pl,v 1.6 2004/12/14 23:03:28 hpa Exp $
## -----------------------------------------------------------------------
##
## Copyright 1998-2004 H. Peter Anvin - All Rights Reserved
##
## 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, Inc., 53 Temple Place Ste 330,
## Boston MA 02111-1307, USA; either version 2 of the License, or
## (at your option) any later version; incorporated herein by reference.
##
## -----------------------------------------------------------------------
#
# bin2c.pl: binary file to C source converter
#
eval { use bytes; };
eval { binmode STDIN; };
if ( $#ARGV != 0 ) {
print STDERR "Usage: $0 table_name < input_file > output_file\n";
exit 1;
}
($table_name) = @ARGV;
printf "unsigned char %s[] = {\n", $table_name;
$pos = 0;
$linelen = 8;
$total_len = 0;
while ( ($n = read(STDIN, $data, 4096)) > 0 ) {
$total_len += $n;
for ( $i = 0 ; $i < $n ; $i++ ) {
$byte = substr($data, $i, 1);
if ( $pos >= $linelen ) {
print ",\n\t";
$pos = 0;
} elsif ( $pos > 0 ) {
print ", ";
} else {
print "\t";
}
printf("0x%02x", unpack("C", $byte));
$pos++;
}
}
printf "\n};\n\nunsigned int %s_len = %u;\n", $table_name, $total_len;
@st = stat STDIN;
printf "\nint %s_mtime = %d;\n", $table_name, $st[9];
exit 0;

46
extra/syslinux-3.09/bin2hex.pl Executable file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/perl
## "$Id: bin2hex.pl,v 1.3 2003/07/01 00:49:31 hpa Exp $"
## -----------------------------------------------------------------------
##
## Copyright 2003 H. Peter Anvin - All Rights Reserved
##
## Permission is hereby granted, free of charge, to any person
## obtaining a copy of this software and associated documentation
## files (the "Software"), to deal in the Software without
## restriction, including without limitation the rights to use,
## copy, modify, merge, publish, distribute, sublicense, and/or
## sell copies of the Software, and to permit persons to whom
## the Software is furnished to do so, subject to the following
## conditions:
##
## The above copyright notice and this permission notice shall
## be included in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
## OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
## HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
## WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
## FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
## OTHER DEALINGS IN THE SOFTWARE.
##
## -----------------------------------------------------------------------
eval { use bytes; }; eval { binmode STDIN; };
$len = 0;
while ( read(STDIN,$ch,1) ) {
$cc = ord($ch);
$len += printf ("%x", $cc);
if ( $len > 72 ) {
print "\n";
$len = 0;
} else {
print " ";
$len++;
}
}
print "\n" if ( $len );
exit 0;

View File

@@ -0,0 +1,40 @@
;; $Id: bios.inc,v 1.3 2004/12/14 22:46:24 hpa Exp $
;; -----------------------------------------------------------------------
;;
;; Copyright 1994-2004 H. Peter Anvin - All Rights Reserved
;;
;; 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, Inc., 53 Temple Place Ste 330,
;; Boston MA 02111-1307, USA; either version 2 of the License, or
;; (at your option) any later version; incorporated herein by reference.
;;
;; -----------------------------------------------------------------------
;;
;; bios.inc
;;
;; Header file for the BIOS data structures etc.
;;
%ifndef _BIOS_INC
%define _BIOS_INC
absolute 4*1Eh ; In the interrupt table
fdctab equ $
fdctab1 resw 1
fdctab2 resw 1
absolute 0400h
serial_base resw 4 ; Base addresses for 4 serial ports
absolute 0413h
BIOS_fbm resw 1 ; Free Base Memory (kilobytes)
absolute 0462h
BIOS_page resb 1 ; Current video page
absolute 046Ch
BIOS_timer resw 1 ; Timer ticks
absolute 0472h
BIOS_magic resw 1 ; BIOS reset magic
absolute 0484h
BIOS_vidrows resb 1 ; Number of screen rows
%endif ; _BIOS_INC

View File

@@ -0,0 +1,157 @@
;; $Id: bootsect.inc,v 1.15 2005/01/12 00:34:54 hpa Exp $
;; -----------------------------------------------------------------------
;;
;; Copyright 1994-2005 H. Peter Anvin - All Rights Reserved
;;
;; 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, Inc., 53 Temple Place Ste 330,
;; Boston MA 02111-1307, USA; either version 2 of the License, or
;; (at your option) any later version; incorporated herein by reference.
;;
;; -----------------------------------------------------------------------
;;
;; bootsect.inc
;;
;; Load a boot sector (or other bootstrap program.)
;;
;; Unlike previous versions of this software, this doesn't require that
;; the length is 512 bytes. This allows PXE bootstraps and WinNT
;; "CD boot sectors" to be invoked.
;;
;
; Load a boot sector
;
is_bootsector:
%if IS_SYSLINUX || IS_MDSLINUX
; Transfer zero bytes
mov byte [CopySuper],0
jmp short load_bootsec
is_bss_sector:
; Transfer the superblock
mov byte [CopySuper],superblock_len
%endif
load_bootsec:
xchg dx,ax
shl eax,16
xchg dx,ax ; Now EAX = file length
mov edi, 100000h
mov [trackbuf+4],edi ; Copy from this address
push edi ; Save load address
xor dx,dx ; No padding
call load_high
call crlf
sub edi,100000h
mov [trackbuf+8],edi ; Save length
mov eax,7C00h ; Entry point
mov [trackbuf],eax ; Copy to this address
mov [EntryPoint],eax ; Jump to this address when done
%if IS_SYSLINUX || IS_MDSLINUX
movzx ecx,byte [CopySuper]
jcxz .not_bss
; For a BSS boot sector we have to patch.
mov esi,superblock
mov edi,100000h+(superblock-bootsec)
call bcopy
.not_bss:
%endif
xor edx,edx
xor esi,esi
%if IS_SYSLINUX || IS_MDSLINUX || IS_EXTLINUX
; Restore original FDC table
mov eax,[OrigFDCTabPtr]
mov [fdctab],eax
mov dl,[DriveNumber]
mov si,PartInfo ; Partition info buffer
mov di,800h-18 ; Put partition info here
push di
mov cx,8 ; 16 bytes
xor ax,ax
rep movsw
pop si ; DS:SI points to partition info
%elif IS_ISOLINUX
mov dl,[DriveNo]
%elif IS_PXELINUX
mov byte [KeepPXE],1 ; Chainloading another NBP
call reset_pxe
%endif
xor bx,bx
;
; replace_bootstrap for the special case where we have exactly one
; descriptor, and it's the first entry in the trackbuf
;
replace_bootstrap_one:
push word trackbuf ; Address of descriptor list
push word 1 ; Length of descriptor list
; Fall through
;
; Entrypoint for "shut down and replace bootstrap" -- also invoked by
; the COMBOOT API. This routine expects two words on the stack:
; address of the copy list (versus DS) and count. Additionally,
; the values of ESI and EDX are passed on to the new bootstrap;
; the value of BX becomes the new DS.
;
replace_bootstrap:
;
; Prepare for shutting down
;
call vgaclearmode
;
; Set up initial stack frame (not used by PXE if keeppxe is
; set - we use the PXE stack then.)
; AFTER THIS POINT ONLY .earlybss IS AVAILABLE, NOT .bss
;
xor ax,ax
mov ds,ax
mov es,ax
%if IS_PXELINUX
test byte [KeepPXE],01h
jz .stdstack
les di,[InitStack] ; Reset stack to PXE original
jmp .stackok
%endif
.stdstack:
mov di,7C00h-44
push di
mov cx,22 ; 44 bytes
rep stosw
pop di
.stackok:
mov [es:di+28],edx
mov [es:di+12],esi
mov [es:di+6],bx
pop ax ; Copy list count
pop bx ; Copy from...
cli
mov cx,es
mov ss,cx
movzx esp,di
jmp shuffle_and_boot
%if IS_SYSLINUX || IS_MDSLINUX
; Nothing
%else
is_bss_sector:
mov si,err_bssimage
call cwritestr
jmp enter_command
%endif

View File

@@ -0,0 +1,70 @@
unsigned char syslinux_bootsect[] = {
0xeb, 0x58, 0x90, 0x53, 0x59, 0x53, 0x4c, 0x49,
0x4e, 0x55, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfa, 0xfc, 0x31, 0xc0, 0x8e, 0xd0,
0xbc, 0xb4, 0x7b, 0x8e, 0xc0, 0xb9, 0x08, 0x00,
0x89, 0xe7, 0xf3, 0xa5, 0x8e, 0xd8, 0xbb, 0x78,
0x00, 0x0f, 0xb4, 0x37, 0x0f, 0xa0, 0x56, 0x88,
0x16, 0xa5, 0x4b, 0x20, 0xd2, 0x78, 0x15, 0xb1,
0x06, 0x89, 0x3f, 0x89, 0x47, 0x02, 0x64, 0xf3,
0xa5, 0x8a, 0x0e, 0x18, 0x7c, 0x88, 0x4d, 0xf8,
0xcd, 0x13, 0xeb, 0x27, 0xf6, 0x45, 0xf0, 0x7f,
0x75, 0x08, 0x66, 0x8b, 0x45, 0xf8, 0x66, 0xa3,
0x1c, 0x7c, 0xb4, 0x08, 0xcd, 0x13, 0x72, 0x13,
0x20, 0xe4, 0x75, 0x0f, 0xc1, 0xea, 0x08, 0x42,
0x89, 0x16, 0x1a, 0x7c, 0x83, 0xe1, 0x3f, 0x89,
0x0e, 0x18, 0x7c, 0xfb, 0xbb, 0xaa, 0x55, 0xb4,
0x41, 0x8a, 0x16, 0xa5, 0x4b, 0xcd, 0x13, 0x72,
0x10, 0x81, 0xfb, 0x55, 0xaa, 0x75, 0x0a, 0xf6,
0xc1, 0x01, 0x74, 0x05, 0xc6, 0x06, 0x40, 0x7d,
0x00, 0x66, 0xa1, 0xf8, 0x7d, 0xbb, 0x00, 0x7e,
0xe8, 0x54, 0x00, 0x66, 0x81, 0x3e, 0x20, 0x7e,
0xfe, 0x02, 0xb2, 0x3e, 0x75, 0x0e, 0x66, 0x81,
0x3e, 0x24, 0x7e, 0xca, 0xfb, 0xef, 0x41, 0x75,
0x03, 0xe9, 0x34, 0x02, 0x31, 0xf6, 0x8e, 0xd6,
0xbc, 0xb0, 0x7b, 0x8e, 0xde, 0x66, 0x8f, 0x06,
0x78, 0x00, 0xbe, 0xd8, 0x7d, 0xe8, 0x07, 0x00,
0x98, 0xcd, 0x16, 0xcd, 0x19, 0xeb, 0xfe, 0xac,
0x20, 0xc0, 0x74, 0x09, 0xb4, 0x0e, 0xbb, 0x07,
0x00, 0xcd, 0x10, 0xeb, 0xf2, 0xc3, 0xbd, 0x06,
0x00, 0x66, 0x60, 0xcd, 0x13, 0x66, 0x61, 0x73,
0xf4, 0x4d, 0x75, 0xf5, 0xe9, 0xc5, 0xff, 0xbd,
0x01, 0x00, 0x66, 0x03, 0x06, 0x1c, 0x7c, 0xeb,
0x3b, 0xbe, 0xe8, 0x7d, 0x89, 0x5c, 0x04, 0x8c,
0x44, 0x06, 0x66, 0x89, 0x44, 0x08, 0x55, 0xe8,
0x7b, 0x00, 0x89, 0x6c, 0x02, 0x8a, 0x16, 0xa5,
0x4b, 0xb4, 0x42, 0xe8, 0xc8, 0xff, 0x5d, 0x66,
0x0f, 0xb7, 0x44, 0x02, 0x66, 0x01, 0x44, 0x08,
0x29, 0xc5, 0xc1, 0xe0, 0x09, 0x01, 0x44, 0x04,
0x21, 0xed, 0x75, 0xda, 0x66, 0x8b, 0x44, 0x08,
0x8b, 0x5c, 0x04, 0xc3, 0x66, 0x50, 0x55, 0x53,
0x66, 0x0f, 0xb7, 0x36, 0x18, 0x7c, 0x66, 0x0f,
0xb7, 0x3e, 0x1a, 0x7c, 0x66, 0x31, 0xd2, 0x66,
0xf7, 0xf6, 0x31, 0xc9, 0x87, 0xca, 0x66, 0xf7,
0xf7, 0xe8, 0x31, 0x00, 0x29, 0xce, 0x39, 0xf5,
0x76, 0x02, 0x89, 0xf5, 0xc0, 0xe4, 0x06, 0x41,
0x08, 0xe1, 0x88, 0xc5, 0x88, 0xd6, 0x8a, 0x16,
0xa5, 0x4b, 0x95, 0xb4, 0x02, 0xe8, 0x6e, 0xff,
0x66, 0x0f, 0xb6, 0xc8, 0xc1, 0xe0, 0x09, 0x5b,
0x01, 0xc3, 0x5d, 0x66, 0x58, 0x66, 0x01, 0xc8,
0x29, 0xcd, 0x75, 0xb0, 0xc3, 0x3b, 0x2e, 0xfc,
0x7d, 0x76, 0x04, 0x8b, 0x2e, 0xfc, 0x7d, 0xc3,
0x42, 0x6f, 0x6f, 0x74, 0x20, 0x66, 0x61, 0x69,
0x6c, 0x65, 0x64, 0x0d, 0x0a, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xef, 0xbe, 0xad, 0xde, 0x7f, 0x00, 0x55, 0xaa
};
unsigned int syslinux_bootsect_len = 512;
int syslinux_bootsect_mtime = 1119044950;

View File

@@ -0,0 +1,83 @@
; -*- fundamental -*- ---------------------------------------------------
;
; Copyright 2004 H. Peter Anvin - All Rights Reserved
;
; 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, Inc., 53 Temple Place Ste 330,
; Boston MA 02111-1307, USA; either version 2 of the License, or
; (at your option) any later version; incorporated herein by reference.
;
; -----------------------------------------------------------------------
; $Id: cache.inc,v 1.3 2005/01/25 07:15:21 hpa Exp $
section .text
;
; initcache: Initialize the cache data structures
;
initcache:
xor eax,eax ; We don't care about sector 0
mov di,CachePtrs
mov cx,65536/SECTOR_SIZE
rep stosd
ret
;
; getcachesector: Check for a particular sector (EAX) in the sector cache,
; and if it is already there, return a pointer in GS:SI
; otherwise load it and return said pointer.
;
; Assumes CS == DS.
;
getcachesector:
push cx
mov si,cache_seg
mov gs,si
mov si,CachePtrs ; Sector cache pointers
mov cx,65536/SECTOR_SIZE
.search:
cmp eax,[si]
jz .hit
add si,4
loop .search
.miss:
TRACER 'M'
; Need to load it. Highly inefficient cache replacement
; algorithm: Least Recently Written (LRW)
push bx
push es
push gs
pop es
mov bx,[NextCacheSlot]
inc bx
and bx,(1 << (16-SECTOR_SHIFT))-1
mov [NextCacheSlot],bx
shl bx,2
mov [CachePtrs+bx],eax
shl bx,SECTOR_SHIFT-2
mov si,bx
pushad
%if IS_EXTLINUX
call getonesec_ext
%else
call getonesec
%endif
popad
pop es
pop bx
pop cx
ret
.hit: ; We have it; get the pointer
TRACER 'H'
sub si,CachePtrs
shl si,SECTOR_SHIFT-2
pop cx
ret
section .bss
alignb 4
CachePtrs resd 65536/SECTOR_SIZE ; Cached sector pointers
NextCacheSlot resw 1 ; Next cache slot to occupy

View File

@@ -0,0 +1,36 @@
#!/usr/bin/perl
#
# Construct a checksum for isolinux*.bin, compatible
# with an mkisofs boot-info-table
#
use bytes;
use integer;
($file) = @ARGV;
open(FILE, '+<', $file) or die "$0: Cannot open $file: $!\n";
binmode FILE;
if ( !seek(FILE,64,0) ) {
die "$0: Cannot seek past header\n";
}
$csum = 0;
$bytes = 64;
while ( ($n = read(FILE, $dw, 4)) > 0 ) {
$dw .= "\0\0\0\0"; # Pad to at least 32 bits
($v) = unpack("V", $dw);
$csum = ($csum + $v) & 0xffffffff;
$bytes += $n;
}
if ( !seek(FILE,16,0) ) {
die "$0: Cannot seek to header\n";
}
print FILE pack("VV", $bytes, $csum);
close(FILE);
exit 0;

View File

@@ -0,0 +1,44 @@
;; $Id: cmdline.inc,v 1.2 2004/12/14 22:46:24 hpa Exp $
;; -----------------------------------------------------------------------
;;
;; Copyright 2003 H. Peter Anvin - All Rights Reserved
;;
;; 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, Inc., 53 Temple Place Ste 330,
;; Boston MA 02111-1307, USA; either version 2 of the License, or
;; (at your option) any later version; incorporated herein by reference.
;;
;; -----------------------------------------------------------------------
;;
;; cmdline.inc
;;
;; Common routine to assemble [null-terminated] command line into
;; real_mode_seg:cmd_line_here.
;; Not used by plain kernel due to BOOT_IMAGE= etc.
;;
;
; Assumes DS == CS
make_plain_cmdline:
push es
; ui.inc has already copied the actual command line
mov ax,real_mode_seg
mov es,ax
mov si,[CmdOptPtr]
mov di,[CmdLinePtr]
.loop: lodsb
stosb
and al,al
jnz .loop
dec di
mov [CmdLinePtr],di
pop es
ret

View File

@@ -0,0 +1,359 @@
;; $Id: com32.inc,v 1.9 2005/01/06 22:34:06 hpa Exp $
;; -----------------------------------------------------------------------
;;
;; Copyright 1994-2003 H. Peter Anvin - All Rights Reserved
;;
;; 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, Inc., 53 Temple Place Ste 330,
;; Boston MA 02111-1307, USA; either version 2 of the License, or
;; (at your option) any later version; incorporated herein by reference.
;;
;; -----------------------------------------------------------------------
;;
;; com32.inc
;;
;; Common code for running a COM32 image
;;
;
; Load a COM32 image. A COM32 image is the 32-bit analogue to a DOS
; .com file. A COM32 image is loaded at address 0x101000, with %esp
; set to the high end of usable memory.
;
; A COM32 image should begin with the magic bytes:
; B8 FF 4C CD 21, which is "mov eax,0x21cd4cff" in 32-bit mode and
; "mov ax,0x4cff; int 0x21" in 16-bit mode. This will abort the
; program with an error if run in 16-bit mode.
;
pm_idt: equ 0x100000
pm_entry: equ 0x101000
bits 16
section .data
align 2, db 0
com32_pmidt:
dw 8*256 ; Limit
dd pm_idt ; Address
com32_rmidt:
dw 0ffffh ; Limit
dd 0 ; Address
section .text
is_com32_image:
push si ; Save file handle
push dx ; File length held in DX:AX
push ax
call make_plain_cmdline
; Copy the command line into the low cmdline buffer
mov ax,real_mode_seg
mov fs,ax
mov si,cmd_line_here
mov di,command_line
mov cx,[CmdLinePtr]
inc cx ; Include final null
sub cx,si
fs rep movsb
call highmemsize ; We need the high memory size...
call comboot_setup_api ; Set up the COMBOOT-style API
mov edi,pm_entry ; Load address
pop eax ; File length
pop si ; File handle
xor dx,dx ; No padding
call load_high
call crlf
com32_start:
mov ebx,com32_call_start ; Where to go in PM
com32_enter_pm:
cli
mov ax,cs
mov ds,ax
mov [SavedSSSP],sp
mov [SavedSSSP+2],ss
cld
call a20_test
jnz .a20ok
call enable_a20
.a20ok:
lgdt [bcopy_gdt] ; We can use the same GDT just fine
lidt [com32_pmidt] ; Set up the IDT
mov eax,cr0
or al,1
mov cr0,eax ; Enter protected mode
jmp 20h:.in_pm
bits 32
.in_pm:
xor eax,eax ; Available for future use...
mov fs,eax
mov gs,eax
mov al,28h ; Set up data segments
mov es,eax
mov ds,eax
mov ss,eax
mov esp,[PMESP] ; Load protmode %esp if available
jmp ebx ; Go to where we need to go
;
; This is invoked right before the actually starting the COM32
; progam, in 32-bit mode...
;
com32_call_start:
;
; Point the stack to the end of high memory
;
mov esp,[word HighMemSize]
;
; Set up the protmode IDT and the interrupt jump buffers
; We set these up in the system area at 0x100000,
; but we could also put them beyond the stack.
;
mov edi,pm_idt
; Form an interrupt gate descriptor
mov eax,0x00200000+((pm_idt+8*256)&0x0000ffff)
mov ebx,0x0000ee00+((pm_idt+8*256)&0xffff0000)
xor ecx,ecx
inc ch ; ecx <- 256
push ecx
.make_idt:
stosd
add eax,8
xchg eax,ebx
stosd
xchg eax,ebx
loop .make_idt
pop ecx
; Each entry in the interrupt jump buffer contains
; the following instructions:
;
; 00000000 60 pushad
; 00000001 B0xx mov al,<interrupt#>
; 00000003 E9xxxxxxxx jmp com32_handle_interrupt
mov eax,0e900b060h
mov ebx,com32_handle_interrupt-(pm_idt+8*256+8)
.make_ijb:
stosd
sub [edi-2],cl ; Interrupt #
xchg eax,ebx
stosd
sub eax,8
xchg eax,ebx
loop .make_ijb
; Now everything is set up for interrupts...
push dword com32_farcall ; Farcall entry point
push dword (1 << 16) ; 64K bounce buffer
push dword (comboot_seg << 4) ; Bounce buffer address
push dword com32_intcall ; Intcall entry point
push dword command_line ; Command line pointer
push dword 5 ; Argument count
sti ; Interrupts OK now
call pm_entry ; Run the program...
; ... on return, fall through to com32_exit ...
com32_exit:
mov bx,com32_done ; Return to command loop
com32_enter_rm:
cli
cld
mov [PMESP],esp ; Save exit %esp
xor esp,esp ; Make sure the high bits are zero
jmp 08h:.in_pm16 ; Return to 16-bit mode first
bits 16
.in_pm16:
mov ax,18h ; Real-mode-like segment
mov es,ax
mov ds,ax
mov ss,ax
mov fs,ax
mov gs,ax
lidt [com32_rmidt] ; Real-mode IDT (rm needs no GDT)
mov eax,cr0
and al,~1
mov cr0,eax
jmp 0:.in_rm
.in_rm: ; Back in real mode
mov ax,cs ; Set up sane segments
mov ds,ax
mov es,ax
mov fs,ax
mov gs,ax
lss sp,[SavedSSSP] ; Restore stack
jmp bx ; Go to whereever we need to go...
com32_done:
call disable_a20
sti
jmp enter_command
;
; 16-bit support code
;
bits 16
;
; 16-bit interrupt-handling code
;
com32_int_rm:
pushf ; Flags on stack
push cs ; Return segment
push word .cont ; Return address
push dword edx ; Segment:offset of IVT entry
retf ; Invoke IVT routine
.cont: ; ... on resume ...
mov ebx,com32_int_resume
jmp com32_enter_pm ; Go back to PM
;
; 16-bit system call handling code
;
com32_sys_rm:
pop gs
pop fs
pop es
pop ds
popad
popfd
mov [cs:Com32SysSP],sp
retf ; Invoke routine
.return:
; We clean up SP here because we don't know if the
; routine returned with RET, RETF or IRET
mov sp,[cs:Com32SysSP]
pushfd
pushad
push ds
push es
push fs
push gs
mov ebx,com32_sys_resume
jmp com32_enter_pm
;
; 32-bit support code
;
bits 32
;
; This is invoked on getting an interrupt in protected mode. At
; this point, we need to context-switch to real mode and invoke
; the interrupt routine.
;
; When this gets invoked, the registers are saved on the stack and
; AL contains the register number.
;
com32_handle_interrupt:
movzx eax,al
xor ebx,ebx ; Actually makes the code smaller
mov edx,[ebx+eax*4] ; Get the segment:offset of the routine
mov bx,com32_int_rm
jmp com32_enter_rm ; Go to real mode
com32_int_resume:
popad
iret
;
; Intcall/farcall invocation. We manifest a structure on the real-mode stack,
; containing the com32sys_t structure from <com32.h> as well as
; the following entries (from low to high address):
; - Target offset
; - Target segment
; - Return offset
; - Return segment (== real mode cs == 0)
; - Return flags
;
com32_farcall:
pushfd ; Save IF among other things...
pushad ; We only need to save some, but...
mov eax,[esp+10*4] ; CS:IP
jmp com32_syscall
com32_intcall:
pushfd ; Save IF among other things...
pushad ; We only need to save some, but...
movzx eax,byte [esp+10*4] ; INT number
mov eax,[eax*4] ; Get CS:IP from low memory
com32_syscall:
cld
movzx edi,word [word SavedSSSP]
movzx ebx,word [word SavedSSSP+2]
sub edi,54 ; Allocate 54 bytes
mov [word SavedSSSP],di
shl ebx,4
add edi,ebx ; Create linear address
mov esi,[esp+11*4] ; Source regs
xor ecx,ecx
mov cl,11 ; 44 bytes to copy
rep movsd
; EAX is already set up to be CS:IP
stosd ; Save in stack frame
mov eax,com32_sys_rm.return ; Return seg:offs
stosd ; Save in stack frame
mov eax,[edi-12] ; Return flags
and eax,0x200cd7 ; Mask (potentially) unsafe flags
mov [edi-12],eax ; Primary flags entry
stosw ; Return flags
mov bx,com32_sys_rm
jmp com32_enter_rm ; Go to real mode
; On return, the 44-byte return structure is on the
; real-mode stack, plus the 10 additional bytes used
; by the target address (see above.)
com32_sys_resume:
movzx esi,word [word SavedSSSP]
movzx eax,word [word SavedSSSP+2]
mov edi,[esp+12*4] ; Dest regs
shl eax,4
add esi,eax ; Create linear address
and edi,edi ; NULL pointer?
jnz .do_copy
.no_copy: mov edi,esi ; Do a dummy copy-to-self
.do_copy: xor ecx,ecx
mov cl,11 ; 44 bytes
rep movsd ; Copy register block
add dword [word SavedSSSP],54 ; Remove from stack
popad
popfd
ret ; Return to 32-bit program
bits 16
section .bss
alignb 4
PMESP resd 1 ; Protected-mode ESP
Com32SysSP resw 1 ; SP saved during COM32 syscall
section .text

View File

@@ -0,0 +1,31 @@
libcom32 and libutil are licensed under the MIT license:
## -----------------------------------------------------------------------
##
## Copyright 2004 H. Peter Anvin - All Rights Reserved
##
## Permission is hereby granted, free of charge, to any person
## obtaining a copy of this software and associated documentation
## files (the "Software"), to deal in the Software without
## restriction, including without limitation the rights to use,
## copy, modify, merge, publish, distribute, sublicense, and/or
## sell copies of the Software, and to permit persons to whom
## the Software is furnished to do so, subject to the following
## conditions:
##
## The above copyright notice and this permission notice shall
## be included in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
## OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
## HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
## WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
## FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
## OTHER DEALINGS IN THE SOFTWARE.
##
## -----------------------------------------------------------------------
The files in the samples and modules directories are mostly under the
GNU GPL (see the file COPYING in the directory above.)

View File

@@ -0,0 +1,4 @@
SUBDIRS = lib libutil modules samples
all tidy clean spotless install:
for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done

View File

@@ -0,0 +1,14 @@
/*
* bits32/limits.h
*/
#ifndef _BITSIZE_LIMITS_H
#define _BITSIZE_LIMITS_H
#define LONG_BIT 32
#define LONG_MIN (-2147483647L-1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
#endif /* _BITSIZE_LIMITS_H */

View File

@@ -0,0 +1,18 @@
/*
* bits32/stddef.h
*/
#ifndef _BITSIZE_STDDEF_H
#define _BITSIZE_STDDEF_H
#define _SIZE_T
#if defined(__s390__) || defined(__hppa__) || defined(__cris__)
typedef unsigned long size_t;
#else
typedef unsigned int size_t;
#endif
#define _PTRDIFF_T
typedef signed int ptrdiff_t;
#endif /* _BITSIZE_STDDEF_H */

View File

@@ -0,0 +1,34 @@
/*
* bits32/stdint.h
*/
#ifndef _BITSIZE_STDINT_H
#define _BITSIZE_STDINT_H
typedef signed char int8_t;
typedef short int int16_t;
typedef int int32_t;
typedef long long int int64_t;
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long int uint64_t;
typedef int int_fast16_t;
typedef int int_fast32_t;
typedef unsigned int uint_fast16_t;
typedef unsigned int uint_fast32_t;
typedef int intptr_t;
typedef unsigned int uintptr_t;
#define __INT64_C(c) c ## LL
#define __UINT64_C(c) c ## ULL
#define __PRI64_RANK "ll"
#define __PRIFAST_RANK ""
#define __PRIPTR_RANK ""
#endif /* _BITSIZE_STDINT_H */

View File

@@ -0,0 +1,18 @@
/*
* bits32/stdintconst.h
*/
#ifndef _BITSIZE_STDINTCONST_H
#define _BITSIZE_STDINTCONST_H
#define INT_FAST16_C(c) INT32_C(c)
#define INT_FAST32_C(c) INT32_C(c)
#define UINT_FAST16_C(c) UINT32_C(c)
#define UINT_FAST32_C(c) UINT32_C(c)
#define INTPTR_C(c) INT32_C(c)
#define UINTPTR_C(c) UINT32_C(c)
#define PTRDIFF_C(c) INT32_C(c)
#endif /* _BITSIZE_STDINTCONST_H */

View File

@@ -0,0 +1,22 @@
/*
* bits32/stdintlimits.h
*/
#ifndef _BITSIZE_STDINTLIMITS_H
#define _BITSIZE_STDINTLIMITS_H
#define INT_FAST16_MIN INT32_MIN
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST16_MAX INT32_MAX
#define INT_FAST32_MAX INT32_MAX
#define UINT_FAST16_MAX UINT32_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define INTPTR_MIN INT32_MIN
#define INTPTR_MAX INT32_MAX
#define UINTPTR_MAX UINT32_MAX
#define PTRDIFF_MIN INT32_MIN
#define PTRDIFF_MAX INT32_MAX
#endif /* _BITSIZE_STDINTLIMITS_H */

View File

@@ -0,0 +1,117 @@
/* ----------------------------------------------------------------------- *
* Not Copyright 2002 H. Peter Anvin
* This file is in the public domain.
* ----------------------------------------------------------------------- */
/*
* com32.h
*
* Common declarations for com32 programs.
*/
#ifndef _COM32_H
#define _COM32_H
#include <stdint.h>
#include <klibc/compiler.h> /* For __cdecl */
/*
* This structure defines the register frame used by the
* system call interface.
*
* The syscall interface is:
*
* __intcall(interrupt_#, source_regs, return_regs)
* __farcall(seg, offs, source_regs, return_regs)
*/
typedef union {
uint32_t l;
uint16_t w[2];
uint8_t b[4];
} reg32_t;
typedef struct {
uint16_t gs; /* Offset 0 */
uint16_t fs; /* Offset 2 */
uint16_t es; /* Offset 4 */
uint16_t ds; /* Offset 6 */
reg32_t edi; /* Offset 8 */
reg32_t esi; /* Offset 12 */
reg32_t ebp; /* Offset 16 */
reg32_t _unused; /* Offset 20 */
reg32_t ebx; /* Offset 24 */
reg32_t edx; /* Offset 28 */
reg32_t ecx; /* Offset 32 */
reg32_t eax; /* Offset 36 */
reg32_t eflags; /* Offset 40 */
} com32sys_t;
/* EFLAGS definitions */
#define EFLAGS_CF 0x00000001
#define EFLAGS_PF 0x00000004
#define EFLAGS_AF 0x00000010
#define EFLAGS_ZF 0x00000040
#define EFLAGS_SF 0x00000080
#define EFLAGS_TF 0x00000100
#define EFLAGS_IF 0x00000200
#define EFLAGS_DF 0x00000400
#define EFLAGS_OF 0x00000800
#define EFLAGS_IOPL 0x00003000
#define EFLAGS_NT 0x00004000
#define EFLAGS_RF 0x00010000
#define EFLAGS_VM 0x00020000
#define EFLAGS_AC 0x00040000
#define EFLAGS_VIF 0x00080000
#define EFLAGS_VIP 0x00100000
#define EFLAGS_ID 0x00200000
extern struct com32_sys_args {
uint32_t cs_sysargs;
char *cs_cmdline;
void __cdecl (*cs_intcall)(uint8_t, const com32sys_t *, com32sys_t *);
void *cs_bounce;
uint32_t cs_bounce_size;
void __cdecl (*cs_farcall)(uint32_t, const com32sys_t *, com32sys_t *);
} __com32;
/*
* System call macros
*/
static inline void
__intcall(uint8_t __i, const com32sys_t *__sr, com32sys_t *__dr)
{
__com32.cs_intcall(__i, __sr, __dr);
}
static inline void
__farcall(uint16_t __es, uint16_t __eo,
const com32sys_t *__sr, com32sys_t *__dr)
{
__com32.cs_farcall((__es << 16) + __eo, __sr, __dr);
}
/*
* These functions convert between linear pointers in the range
* 0..0xFFFFF and real-mode style SEG:OFFS pointers. Note that a
* 32-bit linear pointer is not compatible with a SEG:OFFS pointer
* stored in two consecutive 16-bit words.
*/
static inline uint16_t SEG(void *__p)
{
return (uint16_t)(((uintptr_t)__p) >> 4);
}
static inline uint16_t OFFS(void *__p)
{
/* The double cast here is to shut up gcc */
return (uint16_t)(uintptr_t)__p & 0x000F;
}
static inline void *MK_PTR(uint16_t __seg, uint16_t __offs)
{
return (void *)((__seg << 4) + __offs);
}
#endif /* _COM32_H */

View File

@@ -0,0 +1,60 @@
#ident "$Id: console.h,v 1.4 2004/11/30 22:09:56 hpa Exp $"
/* ----------------------------------------------------------------------- *
*
* Copyright 2004 H. Peter Anvin - All Rights Reserved
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall
* be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* ----------------------------------------------------------------------- */
/*
* console.h
*
* Alternative consoles
*/
#ifndef _CONSOLE_H
#define _CONSOLE_H
#include <klibc/extern.h>
#include <dev.h>
__extern int openconsole(const struct input_dev *, const struct output_dev *);
/* Standard line-oriented console */
extern const struct input_dev dev_stdcon_r;
extern const struct output_dev dev_stdcon_w;
/* Raw character-oriented console */
extern const struct input_dev dev_rawcon_r;
extern const struct output_dev dev_rawcon_w;
/* These are output-only consoles; combine with one of the input methods */
/* Serial port only */
extern const struct output_dev dev_serial_w;
/* ANSI console (output only; combine with one of the input methods) */
extern const struct output_dev dev_ansicon_w;
/* ANSI plus serial port */
extern const struct output_dev dev_ansiserial_w;
#endif /* _CONSOLE_H */

View File

@@ -0,0 +1,119 @@
/*
* ctype.h
*
* This assumes ISO 8859-1, being a reasonable superset of ASCII.
*/
#ifndef _CTYPE_H
#define _CTYPE_H
#ifndef __CTYPE_NO_INLINE
# define __ctype_inline extern __inline__
#else
# define __ctype_inline
#endif
/*
* This relies on the following definitions:
*
* cntrl = !print
* alpha = upper|lower
* graph = punct|alpha|digit
* blank = '\t' || ' ' (per POSIX requirement)
*/
enum {
__ctype_upper = (1 << 0),
__ctype_lower = (1 << 1),
__ctype_digit = (1 << 2),
__ctype_xdigit = (1 << 3),
__ctype_space = (1 << 4),
__ctype_print = (1 << 5),
__ctype_punct = (1 << 6),
__ctype_cntrl = (1 << 7),
};
extern const unsigned char __ctypes[];
__ctype_inline int isalnum(int __c)
{
return __ctypes[__c+1] &
(__ctype_upper|__ctype_lower|__ctype_digit);
}
__ctype_inline int isalpha(int __c)
{
return __ctypes[__c+1] &
(__ctype_upper|__ctype_lower);
}
__ctype_inline int isascii(int __c)
{
return !(__c & ~0x7f);
}
__ctype_inline int isblank(int __c)
{
return (__c == '\t') || (__c == ' ');
}
__ctype_inline int iscntrl(int __c)
{
return __ctypes[__c+1] & __ctype_cntrl;
}
__ctype_inline int isdigit(int __c)
{
return ((unsigned)__c - '0') <= 9;
}
__ctype_inline int isgraph(int __c)
{
return __ctypes[__c+1] &
(__ctype_upper|__ctype_lower|__ctype_digit|__ctype_punct);
}
__ctype_inline int islower(int __c)
{
return __ctypes[__c+1] & __ctype_lower;
}
__ctype_inline int isprint(int __c)
{
return __ctypes[__c+1] & __ctype_print;
}
__ctype_inline int ispunct(int __c)
{
return __ctypes[__c+1] & __ctype_punct;
}
__ctype_inline int isspace(int __c)
{
return __ctypes[__c+1] & __ctype_space;
}
__ctype_inline int isupper(int __c)
{
return __ctypes[__c+1] & __ctype_upper;
}
__ctype_inline int isxdigit(int __c)
{
return __ctypes[__c+1] & __ctype_xdigit;
}
/* Note: this is decimal, not hex, to avoid accidental promotion to unsigned */
#define _toupper(__c) ((__c) & ~32)
#define _tolower(__c) ((__c) | 32)
__ctype_inline int toupper(int __c)
{
return islower(__c) ? _toupper(__c) : __c;
}
__ctype_inline int tolower(int __c)
{
return isupper(__c) ? _tolower(__c) : __c;
}
#endif /* _CTYPE_H */

View File

@@ -0,0 +1,57 @@
#ident "$Id: dev.h,v 1.2 2004/11/30 22:09:56 hpa Exp $"
/* ----------------------------------------------------------------------- *
*
* Copyright 2004 H. Peter Anvin - All Rights Reserved
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall
* be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* ----------------------------------------------------------------------- */
/*
* console.h
*
* Alternative consoles
*/
#ifndef _DEV_H
#define _DEV_H
#include <klibc/extern.h>
#include <stdint.h>
struct input_dev;
struct output_dev;
__extern int opendev(const struct input_dev *, const struct output_dev *, int);
/* Common generic devices */
/* Null device */
extern const struct input_dev dev_null_r;
extern const struct output_dev dev_null_w;
/* Error device */
extern const struct input_dev dev_error_r;
extern const struct output_dev dev_error_w;
#endif /* _DEV_H */

View File

@@ -0,0 +1,135 @@
#ifndef _ERRNO_H
#define _ERRNO_H
extern int errno;
#define EPERM 1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
#define EIO 5 /* I/O error */
#define ENXIO 6 /* No such device or address */
#define E2BIG 7 /* Arg list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file number */
#define ECHILD 10 /* No child processes */
#define EAGAIN 11 /* Try again */
#define ENOMEM 12 /* Out of memory */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
#define ENOTBLK 15 /* Block device required */
#define EBUSY 16 /* Device or resource busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* No such device */
#define ENOTDIR 20 /* Not a directory */
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENFILE 23 /* File table overflow */
#define EMFILE 24 /* Too many open files */
#define ENOTTY 25 /* Not a typewriter */
#define ETXTBSY 26 /* Text file busy */
#define EFBIG 27 /* File too large */
#define ENOSPC 28 /* No space left on device */
#define ESPIPE 29 /* Illegal seek */
#define EROFS 30 /* Read-only file system */
#define EMLINK 31 /* Too many links */
#define EPIPE 32 /* Broken pipe */
#define EDOM 33 /* Math argument out of domain of func */
#define ERANGE 34 /* Math result not representable */
#define EDEADLK 35 /* Resource deadlock would occur */
#define ENAMETOOLONG 36 /* File name too long */
#define ENOLCK 37 /* No record locks available */
#define ENOSYS 38 /* Function not implemented */
#define ENOTEMPTY 39 /* Directory not empty */
#define ELOOP 40 /* Too many symbolic links encountered */
#define EWOULDBLOCK EAGAIN /* Operation would block */
#define ENOMSG 42 /* No message of desired type */
#define EIDRM 43 /* Identifier removed */
#define ECHRNG 44 /* Channel number out of range */
#define EL2NSYNC 45 /* Level 2 not synchronized */
#define EL3HLT 46 /* Level 3 halted */
#define EL3RST 47 /* Level 3 reset */
#define ELNRNG 48 /* Link number out of range */
#define EUNATCH 49 /* Protocol driver not attached */
#define ENOCSI 50 /* No CSI structure available */
#define EL2HLT 51 /* Level 2 halted */
#define EBADE 52 /* Invalid exchange */
#define EBADR 53 /* Invalid request descriptor */
#define EXFULL 54 /* Exchange full */
#define ENOANO 55 /* No anode */
#define EBADRQC 56 /* Invalid request code */
#define EBADSLT 57 /* Invalid slot */
#define EDEADLOCK EDEADLK
#define EBFONT 59 /* Bad font file format */
#define ENOSTR 60 /* Device not a stream */
#define ENODATA 61 /* No data available */
#define ETIME 62 /* Timer expired */
#define ENOSR 63 /* Out of streams resources */
#define ENONET 64 /* Machine is not on the network */
#define ENOPKG 65 /* Package not installed */
#define EREMOTE 66 /* Object is remote */
#define ENOLINK 67 /* Link has been severed */
#define EADV 68 /* Advertise error */
#define ESRMNT 69 /* Srmount error */
#define ECOMM 70 /* Communication error on send */
#define EPROTO 71 /* Protocol error */
#define EMULTIHOP 72 /* Multihop attempted */
#define EDOTDOT 73 /* RFS specific error */
#define EBADMSG 74 /* Not a data message */
#define EOVERFLOW 75 /* Value too large for defined data type */
#define ENOTUNIQ 76 /* Name not unique on network */
#define EBADFD 77 /* File descriptor in bad state */
#define EREMCHG 78 /* Remote address changed */
#define ELIBACC 79 /* Can not access a needed shared library */
#define ELIBBAD 80 /* Accessing a corrupted shared library */
#define ELIBSCN 81 /* .lib section in a.out corrupted */
#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
#define ELIBEXEC 83 /* Cannot exec a shared library directly */
#define EILSEQ 84 /* Illegal byte sequence */
#define ERESTART 85 /* Interrupted system call should be restarted */
#define ESTRPIPE 86 /* Streams pipe error */
#define EUSERS 87 /* Too many users */
#define ENOTSOCK 88 /* Socket operation on non-socket */
#define EDESTADDRREQ 89 /* Destination address required */
#define EMSGSIZE 90 /* Message too long */
#define EPROTOTYPE 91 /* Protocol wrong type for socket */
#define ENOPROTOOPT 92 /* Protocol not available */
#define EPROTONOSUPPORT 93 /* Protocol not supported */
#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
#define EPFNOSUPPORT 96 /* Protocol family not supported */
#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
#define EADDRINUSE 98 /* Address already in use */
#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
#define ENETDOWN 100 /* Network is down */
#define ENETUNREACH 101 /* Network is unreachable */
#define ENETRESET 102 /* Network dropped connection because of reset */
#define ECONNABORTED 103 /* Software caused connection abort */
#define ECONNRESET 104 /* Connection reset by peer */
#define ENOBUFS 105 /* No buffer space available */
#define EISCONN 106 /* Transport endpoint is already connected */
#define ENOTCONN 107 /* Transport endpoint is not connected */
#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
#define ETOOMANYREFS 109 /* Too many references: cannot splice */
#define ETIMEDOUT 110 /* Connection timed out */
#define ECONNREFUSED 111 /* Connection refused */
#define EHOSTDOWN 112 /* Host is down */
#define EHOSTUNREACH 113 /* No route to host */
#define EALREADY 114 /* Operation already in progress */
#define EINPROGRESS 115 /* Operation now in progress */
#define ESTALE 116 /* Stale NFS file handle */
#define EUCLEAN 117 /* Structure needs cleaning */
#define ENOTNAM 118 /* Not a XENIX named type file */
#define ENAVAIL 119 /* No XENIX semaphores available */
#define EISNAM 120 /* Is a named type file */
#define EREMOTEIO 121 /* Remote I/O error */
#define EDQUOT 122 /* Quota exceeded */
#define ENOMEDIUM 123 /* No medium found */
#define EMEDIUMTYPE 124 /* Wrong medium type */
#endif /* _ERRNO_H */

View File

@@ -0,0 +1,24 @@
/*
* fcntl.h
*/
#ifndef _FCNTL_H
#define _FCNTL_H
#include <klibc/extern.h>
#include <klibc/compiler.h>
#include <sys/types.h>
/* None of these are actually supported, although O_RDONLY works */
/* Note this is different from the classical Unix way of doing it */
#define O_RDONLY 1
#define O_WRONLY 2
#define O_RDWR 3
#define O_CREAT 0100
#define O_EXCL 0200
#define O_TRUNC 01000
#define O_APPEND 02000
__extern int open(const char *, int, ...);
#endif /* _FCNTL_H */

View File

@@ -0,0 +1,226 @@
/*
* inttypes.h
*/
#ifndef _INTTYPES_H
#define _INTTYPES_H
#include <klibc/extern.h>
#include <stdint.h>
#include <stddef.h>
static __inline__ intmax_t imaxabs(intmax_t __n)
{
return (__n < (intmax_t)0) ? -__n : __n;
}
__extern intmax_t strtoimax(const char *, char **, int);
__extern uintmax_t strtoumax(const char *, char **, int);
/* extensions */
__extern intmax_t strntoimax(const char *, char **, int, size_t);
__extern uintmax_t strntoumax(const char *, char **, int, size_t);
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)
#define PRId8 "d"
#define PRId16 "d"
#define PRId32 "d"
#define PRId64 __PRI64_RANK "d"
#define PRIdLEAST8 "d"
#define PRIdLEAST16 "d"
#define PRIdLEAST32 "d"
#define PRIdLEAST64 __PRI64_RANK "d"
#define PRIdFAST8 "d"
#define PRIdFAST16 __PRIFAST_RANK "d"
#define PRIdFAST32 __PRIFAST_RANK "d"
#define PRIdFAST64 __PRI64_RANK "d"
#define PRIdMAX __PRI64_RANK "d"
#define PRIdPTR __PRIPTR_RANK "d"
#define PRIi8 "i"
#define PRIi16 "i"
#define PRIi32 "i"
#define PRIi64 __PRI64_RANK "i"
#define PRIiLEAST8 "i"
#define PRIiLEAST16 "i"
#define PRIiLEAST32 "i"
#define PRIiLEAST64 __PRI64_RANK "i"
#define PRIiFAST8 "i"
#define PRIiFAST16 __PRIFAST_RANK "i"
#define PRIiFAST32 __PRIFAST_RANK "i"
#define PRIiFAST64 __PRI64_RANK "i"
#define PRIiMAX __PRI64_RANK "i"
#define PRIiPTR __PRIPTR_RANK "i"
#define PRIo8 "o"
#define PRIo16 "o"
#define PRIo32 "o"
#define PRIo64 __PRI64_RANK "o"
#define PRIoLEAST8 "o"
#define PRIoLEAST16 "o"
#define PRIoLEAST32 "o"
#define PRIoLEAST64 __PRI64_RANK "o"
#define PRIoFAST8 "o"
#define PRIoFAST16 __PRIFAST_RANK "o"
#define PRIoFAST32 __PRIFAST_RANK "o"
#define PRIoFAST64 __PRI64_RANK "o"
#define PRIoMAX __PRI64_RANK "o"
#define PRIoPTR __PRIPTR_RANK "o"
#define PRIu8 "u"
#define PRIu16 "u"
#define PRIu32 "u"
#define PRIu64 __PRI64_RANK "u"
#define PRIuLEAST8 "u"
#define PRIuLEAST16 "u"
#define PRIuLEAST32 "u"
#define PRIuLEAST64 __PRI64_RANK "u"
#define PRIuFAST8 "u"
#define PRIuFAST16 __PRIFAST_RANK "u"
#define PRIuFAST32 __PRIFAST_RANK "u"
#define PRIuFAST64 __PRI64_RANK "u"
#define PRIuMAX __PRI64_RANK "u"
#define PRIuPTR __PRIPTR_RANK "u"
#define PRIx8 "x"
#define PRIx16 "x"
#define PRIx32 "x"
#define PRIx64 __PRI64_RANK "x"
#define PRIxLEAST8 "x"
#define PRIxLEAST16 "x"
#define PRIxLEAST32 "x"
#define PRIxLEAST64 __PRI64_RANK "x"
#define PRIxFAST8 "x"
#define PRIxFAST16 __PRIFAST_RANK "x"
#define PRIxFAST32 __PRIFAST_RANK "x"
#define PRIxFAST64 __PRI64_RANK "x"
#define PRIxMAX __PRI64_RANK "x"
#define PRIxPTR __PRIPTR_RANK "x"
#define PRIX8 "X"
#define PRIX16 "X"
#define PRIX32 "X"
#define PRIX64 __PRI64_RANK "X"
#define PRIXLEAST8 "X"
#define PRIXLEAST16 "X"
#define PRIXLEAST32 "X"
#define PRIXLEAST64 __PRI64_RANK "X"
#define PRIXFAST8 "X"
#define PRIXFAST16 __PRIFAST_RANK "X"
#define PRIXFAST32 __PRIFAST_RANK "X"
#define PRIXFAST64 __PRI64_RANK "X"
#define PRIXMAX __PRI64_RANK "X"
#define PRIXPTR __PRIPTR_RANK "X"
#define SCNd8 "hhd"
#define SCNd16 "hd"
#define SCNd32 "d"
#define SCNd64 __PRI64_RANK "d"
#define SCNdLEAST8 "hhd"
#define SCNdLEAST16 "hd"
#define SCNdLEAST32 "d"
#define SCNdLEAST64 __PRI64_RANK "d"
#define SCNdFAST8 "hhd"
#define SCNdFAST16 __PRIFAST_RANK "d"
#define SCNdFAST32 __PRIFAST_RANK "d"
#define SCNdFAST64 __PRI64_RANK "d"
#define SCNdMAX __PRI64_RANK "d"
#define SCNdPTR __PRIPTR_RANK "d"
#define SCNi8 "hhi"
#define SCNi16 "hi"
#define SCNi32 "i"
#define SCNi64 __PRI64_RANK "i"
#define SCNiLEAST8 "hhi"
#define SCNiLEAST16 "hi"
#define SCNiLEAST32 "i"
#define SCNiLEAST64 __PRI64_RANK "i"
#define SCNiFAST8 "hhi"
#define SCNiFAST16 __PRIFAST_RANK "i"
#define SCNiFAST32 __PRIFAST_RANK "i"
#define SCNiFAST64 __PRI64_RANK "i"
#define SCNiMAX __PRI64_RANK "i"
#define SCNiPTR __PRIPTR_RANK "i"
#define SCNo8 "hho"
#define SCNo16 "ho"
#define SCNo32 "o"
#define SCNo64 __PRI64_RANK "o"
#define SCNoLEAST8 "hho"
#define SCNoLEAST16 "ho"
#define SCNoLEAST32 "o"
#define SCNoLEAST64 __PRI64_RANK "o"
#define SCNoFAST8 "hho"
#define SCNoFAST16 __PRIFAST_RANK "o"
#define SCNoFAST32 __PRIFAST_RANK "o"
#define SCNoFAST64 __PRI64_RANK "o"
#define SCNoMAX __PRI64_RANK "o"
#define SCNoPTR __PRIPTR_RANK "o"
#define SCNu8 "hhu"
#define SCNu16 "hu"
#define SCNu32 "u"
#define SCNu64 __PRI64_RANK "u"
#define SCNuLEAST8 "hhu"
#define SCNuLEAST16 "hu"
#define SCNuLEAST32 "u"
#define SCNuLEAST64 __PRI64_RANK "u"
#define SCNuFAST8 "hhu"
#define SCNuFAST16 __PRIFAST_RANK "u"
#define SCNuFAST32 __PRIFAST_RANK "u"
#define SCNuFAST64 __PRI64_RANK "u"
#define SCNuMAX __PRI64_RANK "u"
#define SCNuPTR __PRIPTR_RANK "u"
#define SCNx8 "hhx"
#define SCNx16 "hx"
#define SCNx32 "x"
#define SCNx64 __PRI64_RANK "x"
#define SCNxLEAST8 "hhx"
#define SCNxLEAST16 "hx"
#define SCNxLEAST32 "x"
#define SCNxLEAST64 __PRI64_RANK "x"
#define SCNxFAST8 "hhx"
#define SCNxFAST16 __PRIFAST_RANK "x"
#define SCNxFAST32 __PRIFAST_RANK "x"
#define SCNxFAST64 __PRI64_RANK "x"
#define SCNxMAX __PRI64_RANK "x"
#define SCNxPTR __PRIPTR_RANK "x"
#endif
#endif /* _INTTYPES_H */

View File

@@ -0,0 +1,115 @@
/*
* klibc/compiler.h
*
* Various compiler features
*/
#ifndef _KLIBC_COMPILER_H
#define _KLIBC_COMPILER_H
#define __user
/* Specific calling conventions */
/* __cdecl is used when we want varadic and non-varadic functions to have
the same binary calling convention. */
#ifdef __i386__
# ifdef __GNUC__
# define __cdecl __attribute__((cdecl,regparm(0)))
# else
/* Most other C compilers have __cdecl as a keyword */
# endif
#else
# define __cdecl /* Meaningless on non-i386 */
#endif
/* How to declare a function that *must* be inlined */
#ifdef __GNUC__
# if __GNUC_MAJOR__ >= 3
# define __must_inline static __inline__ __attribute__((always_inline))
# else
# define __must_inline extern __inline__
# endif
#else
# define __must_inline inline /* Just hope this works... */
#endif
/* How to declare a function that does not return */
#ifdef __GNUC__
# define __noreturn void __attribute__((noreturn))
#else
# define __noreturn void
#endif
/* "const" function:
Many functions do not examine any values except their arguments,
and have no effects except the return value. Basically this is
just slightly more strict class than the `pure' attribute above,
since function is not allowed to read global memory.
Note that a function that has pointer arguments and examines the
data pointed to must _not_ be declared `const'. Likewise, a
function that calls a non-`const' function usually must not be
`const'. It does not make sense for a `const' function to return
`void'.
*/
#ifdef __GNUC__
# define __constfunc __attribute__((const))
#else
# define __constfunc
#endif
#undef __attribute_const__
#define __attribute_const__ __constfunc
/* "pure" function:
Many functions have no effects except the return value and their
return value depends only on the parameters and/or global
variables. Such a function can be subject to common subexpression
elimination and loop optimization just as an arithmetic operator
would be. These functions should be declared with the attribute
`pure'.
*/
#ifdef __GNUC__
# define __purefunc __attribute__((pure))
#else
# define __purefunc
#endif
#undef __attribute_pure__
#define __attribute_pure__ __purefunc
/* Format attribute */
#ifdef __GNUC__
# define __formatfunc(t,f,a) __attribute__((format(t,f,a)))
#else
# define __formatfunc(t,f,a)
#endif
/* malloc() function (returns unaliased pointer) */
#if defined(__GNUC__) && (__GNUC_MAJOR__ >= 3)
# define __mallocfunc __attribute__((malloc))
#else
# define __mallocfunc
#endif
/* likely/unlikely */
#if defined(__GNUC__) && (__GNUC_MAJOR__ > 2 || (__GNUC_MAJOR__ == 2 && __GNUC_MINOR__ >= 95))
# define __likely(x) __builtin_expect((x), 1)
# define __unlikely(x) __builtin_expect((x), 0)
#else
# define __likely(x) (x)
# define __unlikely(x) (x)
#endif
/* Possibly unused function */
#ifdef __GNUC__
# define __unusedfunc __attribute__((unused))
#else
# define __unusedfunc
#endif
/* Constructors and destructors */
#define __constructor __attribute__((constructor))
#define __destructor __attribute__((destructor))
#endif

View File

@@ -0,0 +1,4 @@
static inline void __divide_error(void)
{
asm volatile("int $0"); /* Divide by zero */
}

View File

@@ -0,0 +1,14 @@
/*
* klibc/extern.h
*/
#ifndef _KLIBC_EXTERN_H
#define _KLIBC_EXTERN_H
#ifdef __cplusplus
#define __extern extern "C"
#else
#define __extern extern
#endif
#endif /* _KLIBC_EXTERN_H */

View File

@@ -0,0 +1,34 @@
/*
* klibc/sysconfig.h
*
* Allows for definitions of some things which may be system-dependent
*/
#ifndef _KLIBC_SYSCONFIG_H
#define _KLIBC_SYSCONFIG_H
/*
* Define this to obtain memory using sbrk() instead
* of mmap(). This should make it friendlier on
* non-MMU architectures. This should become a
* per-architecture configurable.
*/
#define MALLOC_USING_SBRK
/*
* This is the minimum chunk size we will ask the kernel for using
* malloc(); this should be a multiple of the page size on all
* architectures.
*/
#define MALLOC_CHUNK_SIZE 4096
#define MALLOC_CHUNK_MASK (MALLOC_CHUNK_SIZE-1)
/*
* This is the minimum alignment for the memory returned by sbrk().
* It must be a power of 2. If MALLOC_USING_SBRK is defined it should
* be no smaller than the size of struct arena_header in malloc.h (4
* pointers.)
*/
#define SBRK_ALIGNMENT 32
#endif /* _KLIBC_SYSCONFIG_H */

View File

@@ -0,0 +1,39 @@
/*
* limits.h
*/
#ifndef _LIMITS_H
#define _LIMITS_H
#define CHAR_BIT 8
#define SHRT_BIT 16
#define INT_BIT 32
#define LONGLONG_BIT 64
#define SCHAR_MIN (-128)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
#ifdef __CHAR_UNSIGNED__
# define CHAR_MIN 0
# define CHAR_MAX UCHAR_MAX
#else
# define CHAR_MIN SCHAR_MIN
# define CHAR_MAX SCHAR_MAX
#endif
#define SHRT_MIN (-32768)
#define SHRT_MAX 32767
#define USHRT_MAX 65535
#define INT_MIN (-2147483647-1)
#define INT_MAX 2147483647
#define UINT_MAX 4294967295U
#define LONGLONG_MIN (-9223372036854775807LL-1)
#define LONGLONG_MAX 9223372036854775807LL
#define ULONGLONG_MAX 18446744073709551615ULL
#include <bitsize/limits.h>
#endif /* _LIMITS_H */

View File

@@ -0,0 +1,44 @@
#ident "$Id: minmax.h,v 1.1 2004/11/10 22:31:50 hpa Exp $"
/* ----------------------------------------------------------------------- *
*
* Copyright 2004 H. Peter Anvin - All Rights Reserved
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall
* be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* ----------------------------------------------------------------------- */
#ifndef _MINMAX_H
#define _MINMAX_H
/*
* minmax.h: Type-independent safe min/max macros
*/
#define min(x,y) ({ __typeof(x) xx = (x); \
__typeof(y) yy = (y); \
xx < yy ? xx : yy; })
#define max(x,y) ({ __typeof(x) xx = (x); \
__typeof(y) yy = (y); \
xx > yy ? xx : yy; })
#endif /* _MINMAX_H */

View File

@@ -0,0 +1,43 @@
#ifndef _NETINET_IN_H
#define _NETINET_IN_H
/* COM32 will be running on an i386 platform */
#include <stdint.h>
static inline uint16_t __htons(uint16_t v)
{
return ((v) << 8) | ((v) >> 8);
}
#define htons(x) __htons(x)
#define ntohs(x) __htons(x)
static inline uint32_t __htonl(uint32_t v)
{
if ( __builtin_constant_p(v) ) {
return (((v) & 0x000000ff) << 24) |
(((v) & 0x0000ff00) << 8) |
(((v) & 0x00ff0000) >> 8) |
(((v) & 0xff000000) >> 24);
} else {
asm("xchgb %h0,%b0 ; roll $16,%0 ; xchgb %h0,%b0" : "+abcd" (v));
return v;
}
}
#define htonl(x) __htonl(x)
#define ntohl(x) __htonl(x)
static inline uint64_t __htonq(uint64_t v)
{
return ((uint64_t) __htonl(v) << 32) | __htonl(v >> 32);
}
#define htonq(x) __htonq(x)
#define ntohq(x) __htonq(x)
#endif /* _NETINET_IN_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,14 @@
/*
* stdarg.h
*
* This is just a wrapper for the gcc one, but defines va_copy()
* even if gcc doesn't.
*/
/* Note: the _STDARG_H macro belongs to the gcc header... */
#include_next <stdarg.h>
/* Older gcc considers this an extension, so it's double underbar only */
#ifndef va_copy
#define va_copy(d,s) __va_copy(d,s)
#endif

View File

@@ -0,0 +1,33 @@
/*
* $Id: stdbool.h,v 1.1 2003/04/16 06:32:31 hpa Exp $
*
* stdbool.h
*/
#ifndef _STDBOOL_H
#define _STDBOOL_H
#ifndef __cplusplus
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
# if !defined(__GNUC__) ||(__GNUC__ < 3)
typedef char _Bool; /* For C compilers without _Bool */
# endif
#endif
#define bool _Bool
#define true 1
#define false 0
#else
/* C++ */
#define bool bool
#define true true
#define false false
#endif
#define __bool_true_false_are_defined 1
#endif /* _STDBOOL_H */

View File

@@ -0,0 +1,24 @@
/*
* stddef.h
*/
#ifndef _STDDEF_H
#define _STDDEF_H
#ifndef __KLIBC__
# define __KLIBC__ 1
#endif
#include <bitsize/stddef.h>
#undef NULL
#ifdef __cplusplus
# define NULL 0
#else
# define NULL ((void *)0)
#endif
#undef offsetof
#define offsetof(t,m) ((size_t)&((t *)0)->m)
#endif /* _STDDEF_H */

View File

@@ -0,0 +1,146 @@
/*
* stdint.h
*/
#ifndef _STDINT_H
#define _STDINT_H
/* Exact types */
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef signed long long int64_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
/* Small types */
typedef signed char int_least8_t;
typedef signed short int_least16_t;
typedef signed int int_least32_t;
typedef signed long long int_least64_t;
typedef unsigned char uint_least8_t;
typedef unsigned short uint_least16_t;
typedef unsigned int uint_least32_t;
typedef unsigned long long uint_least64_t;
/* Fast types */
typedef signed char int_fast8_t;
typedef signed short int_fast16_t;
typedef signed int int_fast32_t;
typedef signed long long int_fast64_t;
typedef unsigned char uint_fast8_t;
typedef unsigned short uint_fast16_t;
typedef unsigned int uint_fast32_t;
typedef unsigned long long uint_fast64_t;
/* Pointer types */
typedef int32_t intptr_t;
typedef uint32_t uintptr_t;
/* Maximal types */
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
/*
* To be strictly correct...
*/
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
# define INT8_MIN (-128)
# define INT16_MIN (-32767-1)
# define INT32_MIN (-2147483647-1)
# define INT64_MIN (-9223372036854775807LL-1)
# define INT8_MAX (127)
# define INT16_MAX (32767)
# define INT32_MAX (2147483647)
# define INT64_MAX (9223372036854775807LL)
# define UINT8_MAX (255U)
# define UINT16_MAX (65535U)
# define UINT32_MAX (4294967295U)
# define UINT64_MAX (18446744073709551615ULL)
# define INT_LEAST8_MIN (-128)
# define INT_LEAST16_MIN (-32767-1)
# define INT_LEAST32_MIN (-2147483647-1)
# define INT_LEAST64_MIN (-9223372036854775807LL-1)
# define INT_LEAST8_MAX (127)
# define INT_LEAST16_MAX (32767)
# define INT_LEAST32_MAX (2147483647)
# define INT_LEAST64_MAX (9223372036854775807LL)
# define UINT_LEAST8_MAX (255U)
# define UINT_LEAST16_MAX (65535U)
# define UINT_LEAST32_MAX (4294967295U)
# define UINT_LEAST64_MAX (18446744073709551615ULL)
# define INT_FAST8_MIN (-128)
# define INT_FAST16_MIN (-32767-1)
# define INT_FAST32_MIN (-2147483647-1)
# define INT_FAST64_MIN (-9223372036854775807LL-1)
# define INT_FAST8_MAX (127)
# define INT_FAST16_MAX (32767)
# define INT_FAST32_MAX (2147483647)
# define INT_FAST64_MAX (9223372036854775807LL)
# define UINT_FAST8_MAX (255U)
# define UINT_FAST16_MAX (65535U)
# define UINT_FAST32_MAX (4294967295U)
# define UINT_FAST64_MAX (18446744073709551615ULL)
# define INTPTR_MIN (-2147483647-1)
# define INTPTR_MAX (2147483647)
# define UINTPTR_MAX (4294967295U)
# define INTMAX_MIN (-9223372036854775807LL-1)
# define INTMAX_MAX (9223372036854775807LL)
# define UINTMAX_MAX (18446744073709551615ULL)
/* ptrdiff_t limit */
# define PTRDIFF_MIN (-2147483647-1)
# define PTRDIFF_MAX (2147483647)
/* sig_atomic_t limit */
# define SIG_ATOMIC_MIN (-2147483647-1)
# define SIG_ATOMIC_MAX (2147483647)
/* size_t limit */
# define SIZE_MAX (4294967295U)
#endif /* STDC_LIMIT_MACROS */
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
# define INT8_C(n) n
# define INT16_C(n) n
# define INT32_C(n) n
# define INT64_C(n) n ## LL
# define UINT8_C(n) n ## U
# define UINT16_C(n) n ## U
# define UINT32_C(n) n ## U
# define UINT64_C(n) n ## ULL
# define INTMAX_C(n) n ## LL
# define UINTMAX_C(n) n ## ULL
#endif /* STDC_CONSTANT_MACROS */
#endif /* _STDINT_H */

View File

@@ -0,0 +1,120 @@
/*
* stdio.h
*/
#ifndef _STDIO_H
#define _STDIO_H
#include <klibc/extern.h>
#include <stdarg.h>
#include <stddef.h>
/* This structure doesn't really exist, but it gives us something
to define FILE * with */
struct _IO_file;
typedef struct _IO_file FILE;
#ifndef EOF
# define EOF (-1)
#endif
#ifndef BUFSIZ
# define BUFSIZ 4096
#endif
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
/*
* Convert between a FILE * and a file descriptor. We don't actually
* have any in-memory data, so we just abuse the pointer itself to
* hold the data. Note, however, that for file descriptors, -1 is
* error and 0 is a valid value; for FILE *, NULL (0) is error and
* non-NULL are valid.
*/
static __inline__ int fileno(FILE *__f)
{
/* This should really be intptr_t, but size_t should be the same size */
return (int)(size_t)__f - 1;
}
/* This is a macro so it can be used as initializer */
#define __create_file(__fd) ((FILE *)(size_t)((__fd) + 1))
#define stdin __create_file(0)
#define stdout __create_file(1)
#define stderr __create_file(2)
__extern FILE *fopen(const char *, const char *);
struct dev_info;
__extern FILE *fopendev(const struct dev_info *, const char *);
static __inline__ FILE *fdopen(int __fd, const char *__m)
{
(void)__m; return __create_file(__fd);
}
static __inline__ int fclose(FILE *__f)
{
extern int close(int);
return close(fileno(__f));
}
__extern int fputs(const char *, FILE *);
__extern int puts(const char *);
__extern int fputc(int, FILE *);
#define putc(c,f) fputc((c),(f))
#define putchar(c) fputc((c),stdout)
__extern int fgetc(FILE *);
__extern char * fgets(char *, int, FILE *);
#define getc(f) fgetc(f)
__extern size_t _fread(void *, size_t, FILE *);
__extern size_t _fwrite(const void *, size_t, FILE *);
#ifndef __NO_FREAD_FWRITE_INLINES
extern __inline__ size_t
fread(void *__p, size_t __s, size_t __n, FILE *__f)
{
return _fread(__p, __s*__n, __f)/__s;
}
extern __inline__ size_t
fwrite(void *__p, size_t __s, size_t __n, FILE *__f)
{
return _fwrite(__p, __s*__n, __f)/__s;
}
#endif
/* No seek, but we can tell */
__extern long ftell(FILE *);
__extern int printf(const char *, ...);
__extern int vprintf(const char *, va_list);
__extern int fprintf(FILE *, const char *, ...);
__extern int vfprintf(FILE *, const char *, va_list);
__extern int sprintf(char *, const char *, ...);
__extern int vsprintf(char *, const char *, va_list);
__extern int snprintf(char *, size_t n, const char *, ...);
__extern int vsnprintf(char *, size_t n, const char *, va_list);
__extern int asprintf(char **, const char *, ...);
__extern int vasprintf(char **, const char *, va_list);
/* No buffering, so no flushing needed */
extern __inline__ int
fflush(FILE *__f)
{
(void)__f;
return 0;
}
__extern int sscanf(const char *, const char *, ...);
__extern int vsscanf(const char *, const char *, va_list);
__extern void perror(const char *);
__extern int rename(const char *, const char *);
#endif /* _STDIO_H */

View File

@@ -0,0 +1,90 @@
/*
* stdlib.h
*/
#ifndef _STDLIB_H
#define _STDLIB_H
#include <klibc/extern.h>
#include <klibc/compiler.h>
#include <stddef.h>
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
static __inline__ __noreturn _Exit(int __n) {
__extern __noreturn _exit(int);
_exit(__n);
for(;;); /* Some gcc versions are stupid */
}
__extern __noreturn abort(void);
static __inline__ int abs(int __n) {
return (__n < 0) ? -__n : __n;
}
__extern int atexit(void (*)(void));
__extern int on_exit(void (*)(int, void *), void *);
__extern int atoi(const char *);
__extern long atol(const char *);
__extern long long atoll(const char *);
__extern __noreturn exit(int);
__extern void free(void *);
static __inline__ long labs(long __n) {
return (__n < 0L) ? -__n : __n;
}
static __inline__ long long llabs(long long __n) {
return (__n < 0LL) ? -__n : __n;
}
__extern __mallocfunc void *malloc(size_t);
__extern __mallocfunc void *calloc(size_t, size_t);
__extern __mallocfunc void *realloc(void *, size_t);
__extern long strtol(const char *, char **, int);
__extern long long strtoll(const char *, char **, int);
__extern unsigned long strtoul(const char *, char **, int);
__extern unsigned long long strtoull(const char *, char **, int);
__extern char *getenv(const char *);
__extern int putenv(const char *);
__extern int setenv(const char *, const char *, int);
__extern int unsetenv(const char *);
__extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
__extern long jrand48(unsigned short *);
__extern long mrand48(void);
__extern long nrand48(unsigned short *);
__extern long lrand48(void);
__extern unsigned short *seed48(const unsigned short *);
__extern void srand48(long);
#define RAND_MAX 0x7fffffff
static __inline__ int rand(void) {
return (int)lrand48();
}
static __inline__ void srand(unsigned int __s) {
srand48(__s);
}
static __inline__ long random(void)
{
return lrand48();
}
static __inline__ void srandom(unsigned int __s)
{
srand48(__s);
}
/* Basic PTY functions. These only work if devpts is mounted! */
__extern int unlockpt(int);
__extern char *ptsname(int);
__extern int getpt(void);
static __inline__ int grantpt(int __fd)
{
(void)__fd;
return 0; /* devpts does this all for us! */
}
#endif /* _STDLIB_H */

View File

@@ -0,0 +1,43 @@
/*
* string.h
*/
#ifndef _STRING_H
#define _STRING_H
#include <klibc/extern.h>
#include <stddef.h>
__extern void *memccpy(void *, const void *, int, size_t);
__extern void *memchr(const void *, int, size_t);
__extern int memcmp(const void *, const void *, size_t);
__extern void *memcpy(void *, const void *, size_t);
__extern void *memmove(void *, const void *, size_t);
__extern void *memset(void *, int, size_t);
__extern void *memmem(const void *, size_t, const void *, size_t);
__extern void memswap(void *, void *, size_t);
__extern int strcasecmp(const char *, const char *);
__extern int strncasecmp(const char *, const char *, size_t);
__extern char *strcat(char *, const char *);
__extern char *strchr(const char *, int);
__extern int strcmp(const char *, const char *);
__extern char *strcpy(char *, const char *);
__extern size_t strcspn(const char *, const char *);
__extern char *strdup(const char *);
__extern char *strndup(const char *, size_t);
__extern char *strerror(int);
__extern size_t strlen(const char *);
__extern size_t strnlen(const char *, size_t);
__extern char *strncat(char *, const char *, size_t);
__extern size_t strlcat(char *, const char *, size_t);
__extern int strncmp(const char *, const char *, size_t);
__extern char *strncpy(char *, const char *, size_t);
__extern size_t strlcpy(char *, const char *, size_t);
__extern char *strpbrk(const char *, const char *);
__extern char *strrchr(const char *, int);
__extern char *strsep(char **, const char *);
__extern size_t strspn(const char *, const char *);
__extern char *strstr(const char *, const char *);
__extern char *strtok(char *, const char *);
#endif /* _STRING_H */

View File

@@ -0,0 +1,78 @@
#ifndef _CPU_H
#define _CPU_H
#include <inttypes.h>
static inline uint64_t rdtsc(void)
{
uint64_t v;
asm volatile("rdtsc" : "=A" (v));
return v;
}
static inline uint32_t rdtscl(void)
{
uint32_t v;
asm volatile("rdtsc" : "=a" (v) : : "edx");
return v;
}
static inline uint32_t cpuid_eax(uint32_t level)
{
uint32_t v;
asm("cpuid" : "=a" (v) : "a" (level) : "ebx", "ecx", "edx");
return v;
}
static inline uint32_t cpuid_ebx(uint32_t level)
{
uint32_t v;
asm("cpuid" : "=b" (v), "+a" (level) : : "ecx", "edx");
return v;
}
static inline uint32_t cpuid_ecx(uint32_t level)
{
uint32_t v;
asm("cpuid" : "=c" (v), "+a" (level) : : "ebx", "edx");
return v;
}
static inline uint32_t cpuid_edx(uint32_t level)
{
uint32_t v;
asm("cpuid" : "=d" (v), "+a" (level) : : "ebx", "ecx");
return v;
}
static inline uint64_t rdmsr(uint32_t msr)
{
uint64_t v;
asm volatile("rdmsr" : "=A" (v) : "c" (msr));
return v;
}
static inline void wrmsr(uint64_t v, uint32_t msr)
{
asm volatile("wrmsr" : : "A" (v), "c" (msr));
}
static inline void cpu_relax(void)
{
asm volatile("rep ; nop");
}
/* These are local cli/sti; not SMP-safe!!! */
static inline void cli(void)
{
asm volatile("cli");
}
static inline void sti(void)
{
asm volatile("sti");
}
#endif

View File

@@ -0,0 +1,42 @@
#ifndef _SYS_IO_H
#define _SYS_IO_H
#include <inttypes.h>
static inline uint8_t inb(uint16_t p)
{
uint8_t v;
asm volatile("inb %1,%0" : "=a" (v) : "Nd" (p));
return v;
}
static inline uint16_t inw(uint16_t p)
{
uint16_t v;
asm volatile("inw %1,%0" : "=a" (v) : "Nd" (p));
return v;
}
static inline uint32_t inl(uint16_t p)
{
uint32_t v;
asm volatile("inl %1,%0" : "=a" (v) : "Nd" (p));
return v;
}
static inline void outb(uint8_t v, uint16_t p)
{
asm volatile("outb %0,%1" : : "a" (v), "Nd" (p));
}
static inline void outw(uint16_t v, uint16_t p)
{
asm volatile("outw %0,%1" : : "a" (v), "Nd" (p));
}
static inline void outl(uint32_t v, uint16_t p)
{
asm volatile("outl %0,%1" : : "a" (v), "Nd" (p));
}
#endif /* _SYS_IO_H */

View File

@@ -0,0 +1,31 @@
#ifndef _SYS_PCI_H
#define _SYS_PCI_H
#include <inttypes.h>
#include <sys/io.h>
typedef uint32_t pciaddr_t;
static inline pciaddr_t pci_mkaddr(uint32_t bus, uint32_t dev,
uint32_t func, uint32_t reg)
{
return 0x80000000 | ((bus & 0xff) << 16) | ((dev & 0x1f) << 11) |
((func & 0x07) << 8) | (reg & 0xff);
}
enum pci_config_type {
PCI_CFG_AUTO = 0, /* autodetect */
PCI_CFG_TYPE1 = 1,
PCI_CFG_TYPE2 = 2,
};
void pci_set_config_type(enum pci_config_type);
uint8_t pci_readb(pciaddr_t);
uint16_t pci_readw(pciaddr_t);
uint32_t pci_readl(pciaddr_t);
void pci_writeb(uint8_t, pciaddr_t);
void pci_writew(uint16_t, pciaddr_t);
void pci_writel(uint32_t, pciaddr_t);
#endif /* _SYS_PCI_H */

View File

@@ -0,0 +1,43 @@
/*
* sys/stat.h
*/
#ifndef _SYS_STAT_H
#define _SYS_STAT_H
#include <sys/types.h>
/* We don't use this, but it's there for compatibility */
#define S_IFMT 00170000
#define S_IFSOCK 0140000
#define S_IFLNK 0120000
#define S_IFREG 0100000
#define S_IFBLK 0060000
#define S_IFDIR 0040000
#define S_IFCHR 0020000
#define S_IFIFO 0010000
#define S_ISUID 0004000
#define S_ISGID 0002000
#define S_ISVTX 0001000
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
#define S_IRWXU 00700
#define S_IRUSR 00400
#define S_IWUSR 00200
#define S_IXUSR 00100
#define S_IRWXG 00070
#define S_IRGRP 00040
#define S_IWGRP 00020
#define S_IXGRP 00010
#define S_IRWXO 00007
#define S_IROTH 00004
#define S_IWOTH 00002
#define S_IXOTH 00001
#endif /* _SYS_STAT_H */

View File

@@ -0,0 +1,21 @@
/*
* sys/times.h
*/
#ifndef _SYS_TIMES_H
#define _SYS_TIMES_H
#include <stdint.h>
struct tms {
/* Empty */
};
#define HZ 18 /* Piddly resolution... */
#define CLK_TCK HZ
typedef uint16_t clock_t;
clock_t times(struct tms *);
#endif /* _SYS_TIMES_H */

View File

@@ -0,0 +1,16 @@
/*
* sys/types.h
*/
#ifndef _SYS_TYPES_H
#define _SYS_TYPES_H
#include <klibc/compiler.h>
#include <stddef.h>
#include <stdint.h>
typedef ptrdiff_t ssize_t;
typedef int mode_t;
typedef int64_t off_t;
#endif

View File

@@ -0,0 +1,40 @@
#ident "$Id: syslinux.h,v 1.1 2005/01/20 18:41:12 hpa Exp $"
/* ----------------------------------------------------------------------- *
*
* Copyright 2005 H. Peter Anvin - All Rights Reserved
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall
* be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* ----------------------------------------------------------------------- */
/*
* syslinux.h
*
* SYSLINUX-specific functions
*/
#ifndef _SYSLINUX_H
#define _SYSLINUX_H
void syslinux_idle(void);
#endif

View File

View File

@@ -0,0 +1,29 @@
/*
* unistd.h
*/
#ifndef _UNISTD_H
#define _UNISTD_H
#include <klibc/extern.h>
#include <klibc/compiler.h>
#include <stddef.h>
#include <sys/types.h>
__extern __noreturn _exit(int);
__extern int open(const char *, int, ...);
__extern int close(int);
__extern ssize_t read(int, void *, size_t);
__extern ssize_t write(int, const void *, size_t);
__extern int isatty(int);
/* Standard file descriptor numbers. */
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
#endif /* _UNISTD_H */

View File

@@ -0,0 +1,323 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2003 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id: zconf.h,v 1.1 2005/01/12 04:56:23 hpa Exp $ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
*/
#ifdef Z_PREFIX
# define deflateInit_ z_deflateInit_
# define deflate z_deflate
# define deflateEnd z_deflateEnd
# define inflateInit_ z_inflateInit_
# define inflate z_inflate
# define inflateEnd z_inflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateSetDictionary z_deflateSetDictionary
# define deflateCopy z_deflateCopy
# define deflateReset z_deflateReset
# define deflatePrime z_deflatePrime
# define deflateParams z_deflateParams
# define deflateBound z_deflateBound
# define inflateInit2_ z_inflateInit2_
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateCopy z_inflateCopy
# define inflateReset z_inflateReset
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# define uncompress z_uncompress
# define adler32 z_adler32
# define crc32 z_crc32
# define get_crc_table z_get_crc_table
# define Byte z_Byte
# define uInt z_uInt
# define uLong z_uLong
# define Bytef z_Bytef
# define charf z_charf
# define intf z_intf
# define uIntf z_uIntf
# define uLongf z_uLongf
# define voidpf z_voidpf
# define voidp z_voidp
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
# define WIN32
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
# include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# define z_off_t off_t
#endif
#ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if defined(__OS400__)
#define NO_vsnprintf
#endif
#if defined(__MVS__)
# define NO_vsnprintf
# ifdef FAR
# undef FAR
# endif
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
# pragma map(deflateInit_,"DEIN")
# pragma map(deflateInit2_,"DEIN2")
# pragma map(deflateEnd,"DEEND")
# pragma map(deflateBound,"DEBND")
# pragma map(inflateInit_,"ININ")
# pragma map(inflateInit2_,"ININ2")
# pragma map(inflateEnd,"INEND")
# pragma map(inflateSync,"INSY")
# pragma map(inflateSetDictionary,"INSEDI")
# pragma map(compressBound,"CMBND")
# pragma map(inflate_table,"INTABL")
# pragma map(inflate_fast,"INFA")
# pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
abort.o: abort.c ../include/stdlib.h ../include/klibc/extern.h \
../include/klibc/compiler.h ../include/stddef.h \
../include/bitsize/stddef.h ../include/unistd.h ../include/sys/types.h \
../include/stdint.h

View File

@@ -0,0 +1,5 @@
asprintf.o: asprintf.c ../include/stdio.h ../include/klibc/extern.h \
../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h \
../include/stddef.h ../include/bitsize/stddef.h ../include/stdlib.h \
../include/klibc/compiler.h

View File

@@ -0,0 +1,3 @@
atexit.o: atexit.c ../include/stdlib.h ../include/klibc/extern.h \
../include/klibc/compiler.h ../include/stddef.h \
../include/bitsize/stddef.h

View File

@@ -0,0 +1,5 @@
atoi.o: atoi.c atox.c ../include/inttypes.h ../include/klibc/extern.h \
../include/stdint.h ../include/stddef.h ../include/bitsize/stddef.h \
../include/stdlib.h ../include/klibc/compiler.h ../include/stdio.h \
../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h

View File

@@ -0,0 +1,5 @@
atol.o: atol.c atox.c ../include/inttypes.h ../include/klibc/extern.h \
../include/stdint.h ../include/stddef.h ../include/bitsize/stddef.h \
../include/stdlib.h ../include/klibc/compiler.h ../include/stdio.h \
../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h

View File

@@ -0,0 +1,5 @@
atoll.o: atoll.c atox.c ../include/inttypes.h ../include/klibc/extern.h \
../include/stdint.h ../include/stddef.h ../include/bitsize/stddef.h \
../include/stdlib.h ../include/klibc/compiler.h ../include/stdio.h \
../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h

View File

@@ -0,0 +1,3 @@
calloc.o: calloc.c ../include/stdlib.h ../include/klibc/extern.h \
../include/klibc/compiler.h ../include/stddef.h \
../include/bitsize/stddef.h ../include/string.h

View File

@@ -0,0 +1,3 @@
creat.o: creat.c ../include/sys/types.h ../include/klibc/compiler.h \
../include/stddef.h ../include/bitsize/stddef.h ../include/stdint.h \
../include/sys/stat.h ../include/fcntl.h ../include/klibc/extern.h

View File

@@ -0,0 +1 @@
ctypes.o: ctypes.c ../include/ctype.h

View File

@@ -0,0 +1 @@
errno.o: errno.c ../include/errno.h

View File

@@ -0,0 +1,3 @@
exit.o: exit.c ../include/stdlib.h ../include/klibc/extern.h \
../include/klibc/compiler.h ../include/stddef.h \
../include/bitsize/stddef.h

View File

@@ -0,0 +1,6 @@
fgetc.o: fgetc.c ../include/stdio.h ../include/klibc/extern.h \
../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h \
../include/stddef.h ../include/bitsize/stddef.h ../include/unistd.h \
../include/klibc/compiler.h ../include/sys/types.h ../include/stdint.h \
../include/stdlib.h ../include/errno.h

View File

@@ -0,0 +1,4 @@
fgets.o: fgets.c ../include/stdio.h ../include/klibc/extern.h \
../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h \
../include/stddef.h ../include/bitsize/stddef.h

View File

@@ -0,0 +1,6 @@
fopen.o: fopen.c ../include/stdio.h ../include/klibc/extern.h \
../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h \
../include/stddef.h ../include/bitsize/stddef.h ../include/unistd.h \
../include/klibc/compiler.h ../include/sys/types.h ../include/stdint.h \
../include/fcntl.h

View File

@@ -0,0 +1,4 @@
fprintf.o: fprintf.c ../include/stdio.h ../include/klibc/extern.h \
../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h \
../include/stddef.h ../include/bitsize/stddef.h

View File

@@ -0,0 +1,4 @@
fputc.o: fputc.c ../include/stdio.h ../include/klibc/extern.h \
../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h \
../include/stddef.h ../include/bitsize/stddef.h

View File

@@ -0,0 +1,4 @@
fputs.o: fputs.c ../include/stdio.h ../include/klibc/extern.h \
../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h \
../include/stddef.h ../include/bitsize/stddef.h ../include/string.h

View File

@@ -0,0 +1,5 @@
fread.o: fread.c ../include/errno.h ../include/unistd.h \
../include/klibc/extern.h ../include/klibc/compiler.h \
../include/stddef.h ../include/bitsize/stddef.h ../include/sys/types.h \
../include/stdint.h ../include/stdio.h ../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h

View File

@@ -0,0 +1,4 @@
fread2.o: fread2.c ../include/stdio.h ../include/klibc/extern.h \
../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h \
../include/stddef.h ../include/bitsize/stddef.h

View File

@@ -0,0 +1,3 @@
free.o: free.c ../include/stdlib.h ../include/klibc/extern.h \
../include/klibc/compiler.h ../include/stddef.h \
../include/bitsize/stddef.h malloc.h ../include/stdint.h

View File

@@ -0,0 +1,5 @@
fwrite.o: fwrite.c ../include/errno.h ../include/unistd.h \
../include/klibc/extern.h ../include/klibc/compiler.h \
../include/stddef.h ../include/bitsize/stddef.h ../include/sys/types.h \
../include/stdint.h ../include/stdio.h ../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h

View File

@@ -0,0 +1,4 @@
fwrite2.o: fwrite2.c ../include/stdio.h ../include/klibc/extern.h \
../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h \
../include/stddef.h ../include/bitsize/stddef.h

View File

@@ -0,0 +1,4 @@
getopt.o: getopt.c ../include/stdint.h ../include/unistd.h \
../include/klibc/extern.h ../include/klibc/compiler.h \
../include/stddef.h ../include/bitsize/stddef.h ../include/sys/types.h \
../include/string.h

View File

@@ -0,0 +1,3 @@
lrand48.o: lrand48.c ../include/stdlib.h ../include/klibc/extern.h \
../include/klibc/compiler.h ../include/stddef.h \
../include/bitsize/stddef.h ../include/stdint.h

View File

@@ -0,0 +1,4 @@
malloc.o: malloc.c ../include/stdlib.h ../include/klibc/extern.h \
../include/klibc/compiler.h ../include/stddef.h \
../include/bitsize/stddef.h init.h ../include/inttypes.h \
../include/stdint.h malloc.h

View File

@@ -0,0 +1,2 @@
memccpy.o: memccpy.c ../include/stddef.h ../include/bitsize/stddef.h \
../include/string.h ../include/klibc/extern.h

View File

@@ -0,0 +1,2 @@
memchr.o: memchr.c ../include/stddef.h ../include/bitsize/stddef.h \
../include/string.h ../include/klibc/extern.h

View File

@@ -0,0 +1,2 @@
memcmp.o: memcmp.c ../include/string.h ../include/klibc/extern.h \
../include/stddef.h ../include/bitsize/stddef.h

View File

@@ -0,0 +1,2 @@
memcpy.o: memcpy.c ../include/string.h ../include/klibc/extern.h \
../include/stddef.h ../include/bitsize/stddef.h ../include/stdint.h

View File

@@ -0,0 +1,2 @@
memmem.o: memmem.c ../include/string.h ../include/klibc/extern.h \
../include/stddef.h ../include/bitsize/stddef.h

View File

@@ -0,0 +1,2 @@
memmove.o: memmove.c ../include/string.h ../include/klibc/extern.h \
../include/stddef.h ../include/bitsize/stddef.h

View File

@@ -0,0 +1,2 @@
memset.o: memset.c ../include/string.h ../include/klibc/extern.h \
../include/stddef.h ../include/bitsize/stddef.h ../include/stdint.h

View File

@@ -0,0 +1,2 @@
memswap.o: memswap.c ../include/string.h ../include/klibc/extern.h \
../include/stddef.h ../include/bitsize/stddef.h

View File

@@ -0,0 +1,4 @@
onexit.o: onexit.c ../include/stdlib.h ../include/klibc/extern.h \
../include/klibc/compiler.h ../include/stddef.h \
../include/bitsize/stddef.h ../include/unistd.h ../include/sys/types.h \
../include/stdint.h atexit.h

View File

@@ -0,0 +1,4 @@
perror.o: perror.c ../include/errno.h ../include/stdio.h \
../include/klibc/extern.h ../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h \
../include/stddef.h ../include/bitsize/stddef.h ../include/string.h

View File

@@ -0,0 +1,4 @@
printf.o: printf.c ../include/stdio.h ../include/klibc/extern.h \
../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h \
../include/stddef.h ../include/bitsize/stddef.h

View File

@@ -0,0 +1,4 @@
putchar.o: putchar.c ../include/stdio.h ../include/klibc/extern.h \
../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h \
../include/stddef.h ../include/bitsize/stddef.h

View File

@@ -0,0 +1,4 @@
puts.o: puts.c ../include/stdio.h ../include/klibc/extern.h \
../include/stdarg.h \
/usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/stdarg.h \
../include/stddef.h ../include/bitsize/stddef.h

View File

@@ -0,0 +1,2 @@
qsort.o: qsort.c ../include/stddef.h ../include/bitsize/stddef.h \
../include/string.h ../include/klibc/extern.h

Some files were not shown because too many files have changed in this diff Show More