Importing mkelfimage from

ftp://ftp.lnxi.com/pub/mkelfImage/mkelfImage-2.7.tar.gz

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3103 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Stefan Reinauer 2008-02-15 18:16:06 +00:00 committed by Stefan Reinauer
parent 46fc14dcc8
commit b34eea348c
63 changed files with 17472 additions and 0 deletions

4
util/mkelfImage/AUTHORS Normal file
View File

@ -0,0 +1,4 @@
Eric Biederman <ebiederman@lnxi.com>
Joshua Aune <luken@lnxi.com>
Jake Page <jake@CS.Stanford.EDU>
Andrew Ip <aip@cwlinux.com>

341
util/mkelfImage/COPYING Normal file
View File

@ -0,0 +1,341 @@
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.

118
util/mkelfImage/Makefile Normal file
View File

@ -0,0 +1,118 @@
include Makefile.conf
VERSION:=2.7
RELEASE_DATE:=27 March 2006
PACKAGE:=mkelfImage
# You can specify DESTDIR on the command line to do a add
# a prefix to the install so it doesn't really happen
# Useful for building binary packages
DESTDIR =
CWD:=$(shell pwd)
OBJDIR:=objdir
pkgdatadir = $(datadir)/$(PACKAGE)
pkglibdir = $(libdir)/$(PACKAGE)
pkgincludedir = $(includedir)/$(PACKAGE)
CPPFLAGS=-DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(RELEASE_DATE)"' -I include
HOST_CPPFLAGS=$(CPPFLAGS)
I386_CPPFLAGS=$(CPPFLAGS) -I arch/i386/include
IA64_CPPFLAGS=$(CPPFLAGS) -I arch/ia64/include
GENERATED_SRCS:=\
./configure \
./linux-i386/convert.bin.c\
./linux-ia64/convert.bin.c
SPEC=$(OBJDIR)/mkelfImage-$(VERSION).spec
TARBALL=$(OBJDIR)/mkelfImage-$(VERSION).tar.gz
SRCS:=$(shell find ./AUTHORS ./COPYING ./Makefile ./Makefile.conf.in ./News \
./configure.ac \
./mkelfImage.spec.in \
./config \
./kunzip_src \
./main ./util ./include ./arch \
./linux-i386 \
./linux-ia64 \
! -path '*CVS*' ! -name '*~' ! -name '.*' -type f -print )
SRCS+=$(GENERATED_SRCS)
PSRCS:=$(patsubst ./%,mkelfImage-$(VERSION)/%,$(SRCS))
PSRCS+=./mkelfImage-$(VERSION).spec
SBIN_TARGETS=$(OBJDIR)/sbin/mkelfImage
MAN8_TARGETS=$(OBJDIR)/man/man8/mkelfImage.8
TARGETS:=$(SBIN_TARGETS) $(MAN8_TARGETS)
DEPS:= Makefile Makefile.conf
all: $(TARGETS)
include main/Makefile
include util/Makefile
include linux-i386/Makefile
include linux-ia64/Makefile
clean::
@$(RM) -rf objdir
@$(RM) -rf rpm
@$(RM) -f config.log config.status config.cache
@$(RM) -f $(SBIN_TARGETS) $(MAN1_TARGETS)
@$(RM) -f mkelfImage-$(VERSION) $(TARBALL)
dist-clean:: clean
@$(FIND) . -type f -name '*~' | xargs $(RM) -f
@$(RM) Makefile.conf
maintainer-clean:: dist-clean
@$(RM) -f $(SPEC) $(GENERATED_SRCS)
install: $(TARGETS)
$(MKDIR) -p $(DESTDIR)/$(pkgdatadir)/elf32-i386/ $(DESTDIR)/$(sbindir) $(DESTDIR)/$(mandir)/man8
$(CP) -ar $(SBIN_TARGETS) $(DESTDIR)/$(sbindir)/
$(CP) -ar $(MAN8_TARGETS) $(DESTDIR)/$(mandir)/man8/
#%.1 : %.pl Makefile
# mkdir -p $(@D)
# pod2man --date="$(RELEASE_DATE)" --release="$(VERSION)" $*.pl > $@
tarball: $(TARBALL)
$(TARBALL): $(SRCS) $(SPEC)
$(MKDIR) -p $(OBJDIR)
$(RM) -f $(OBJDIR)/mkelfImage-$(VERSION)
$(LN) -s .. $(OBJDIR)/mkelfImage-$(VERSION)
(cd $(OBJDIR); $(TAR) -cf - $(PSRCS) | gzip -9) > $@
rpm: $(TARBALL)
$(MKDIR) -p $(OBJDIR)/RPM $(OBJDIR)/SRPM $(OBJDIR)/BUILD $(OBJDIR)/SPECS $(OBJDIR)/TMP
unset MAKEFLAGS MAKELEVEL; \
$(RPM) -ta \
--define '_rpmdir $(CWD)/$(OBJDIR)/RPM' \
--define '_srcrpmdir $(CWD)/$(OBJDIR)/SRPM' \
--define '_builddir $(CWD)/$(OBJDIR)/BUILD' \
--define '_specdir $(CWD)/$(OBJDIR)/SPECS' \
--define '_tmppath $(CWD)/$(OBJDIR)/TMP' \
$(TARBALL)
Makefile.conf: Makefile.conf.in configure
/bin/sh ./configure
configure: configure.ac
autoconf
$(RM) -rf autom4te.cache
$(SPEC): mkelfImage.spec.in Makefile
$(SED) -e 's,^Version: $$,Version: $(VERSION),' $< > $@
.PHONY: echo install realinstall
echo:
echo $(SRCS)

View File

@ -0,0 +1,46 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
sbindir=@sbindir@
libexecdir=@libexecdir@
datadir=@datadir@
sysconfdir=@sysconfdir@
sharedstatedir=@sharedstatedir@
localstatedir=@localstatedir@
libdir=@libdir@
infodir=@infodir@
mandir=@mandir@
includedir=@includedir@
DEFS=@DEFS@
LIBS=@LIBS@
HOST_CC=@HOST_CC@
HOST_CFLAGS=@HOST_CFLAGS@ $(DEFS)
I386_CC =@I386_CC@
I386_LD =@I386_LD@
I386_AS =@I386_AS@
I386_CPP =@I386_CPP@
I386_OBJCOPY=@I386_OBJCOPY@
I386_CFLAGS =@I386_CFLAGS@
I386_ASFLAGS=@I386_ASFLAGS@
I386_LDFLAGS=@I386_LDFLAGS@
IA64_CC =@IA64_CC@
IA64_LD =@IA64_LD@
IA64_AS =@IA64_AS@
IA64_CPP =@IA64_CPP@
IA64_OBJCOPY=@IA64_OBJCOPY@
IA64_CFLAGS =@IA64_CFLAGS@
IA64_ASFLAGS=@IA64_ASFLAGS@
IA64_LDFLAGS=@IA64_LDFLAGS@
MKDIR=@MKDIR@
RM=@RM@
CP=@CP@
LN=@LN@
TAR=@TAR@
RPM=@RPM@
SED=@SED@
FIND=@FIND@

123
util/mkelfImage/News Normal file
View File

@ -0,0 +1,123 @@
* 2.6 14 March 2006
- Fix the i386-linux probe code so it does not get confused by
bzImages that are also ELF executables.
- Changed value of GDTLOC and REAL_MODE_DATA_LOC to be below
512kb. This allows for booting on machines whose BIOS reports
only 512kb of memory below 1MB.
* 2.5 24 April 2003
- Fix the checksum code so that it checksums the bss sections as well.
How I missed the checksum code was broken in 2.4 I don't know.
* 2.4 22 April 2003
- Fix code that failed to write more than the first ELF note.
Resulting in checksums and other information not being present
in the generated ELF image.
This bug has been present since mkelfImage-2.0
* 2.3 7 Febuary 2003
- Disable debugging code on the itanium that is not always safe.
* 2.2 6 Febuary 2003
- Always read the correct pointer when an ELF boot header is found.
- Add a printf implementation to i386-linux/convert_param.c
- Minor man page updates.
* 2.1 27 January 2003
- Allow an arbitrary number of kernel headers in mkelf-linux-ia64.c
- Remove unused entries from Makefile.conf.in
- Correctly report the elf note size.
- Check for broken binutils when we run, so mkelfImage does not generate incorrect images.
- Add automatic decompress of kernel images
* 2.0 13 January 2003
- Convert everything to C
- Add itanium support
* 1.19 20 December 2002
- Update to handle a Bhdr passed via the C calling conventions.
* 1.18 9 November 2002
- Update to work with binutils 2.13.x
* 1.17 17 October 2002
- Add an rpm target
- Fix Source0 in the rpm spec file
- Linux 2.5.x support
* 1.16 29 August 2002
- Include the source for my spec file in the tarball.
- Fix the make install target
* 1.15 23 August 2002
- Rewrote the perl ip checksum code to be reasonably fast
- Fixes to the initial parameter passing in head.S thanks to Jake Page <jake@CS.Stanford.EDU>
- Initial cross compiling support thanks to Jake Page <jake@CS.Stanford.EDU>
- Official specfile thanks to Andrew Ip <aip@cwlinux.com>
- Autoconf support Josh Aune <lunke@linuxnetworx.com>
* 1.14 28 June 2002
- Use much less complex ld magic (removed the use of PHDRS directive)
- Fix a small bug in the LinuxBIOS checksum verification code (only affected odd length tables)
* 1.13 10 May 2002
Include the version number in mkelfImage.
* 1.12 26 January 2002
Better firmware detection, and stripping excess symbols from the
generated object.
* 1.11 24 January 2002
Bug fix to command line processing.
* 1.10 21 January 2002
Starting using the PHDRS directive which many versions of ld cannot
handle correctly. The symptom is generally a file that is 9MB in
size.
Start computing a checksum on the Image.
Include an ELF note section in the image for out of band
information (checksum, program name, etc).
* 1.9 7 January 2002
I changed LinuxBIOS (in LinuxBIOS) from passing it's information
locally, to passing it in a global table that is always present.
So that whoever needs that information can get it unfiltered. And
because it isn't being passed around it has less chance of
becomming corrupt. Globals for global information are good :)
Version 1.9 goes out and finds that table.
* 1.8 10 December 2001
Move the ramdisk up even higher in memory.
Better debugging of multiboot parameters
Pass the correct values for a vga screen instead of telling the
kernel we have EGA...
* 1.7 18 May 2001
Warn when I don't have information about the bootloader.
Include a ELF compreressor that works on alpha && x86
There is no good way to apply it though.
* 1.6 1 Febuary 2001
Code cleanup in bzImage support.
* 1.5 1 Febuary 2001
Add support for bzImage
* 1.4 ???
???
* 1.3 27 December 2000
Minor bug fixes for working with the e820 memory map.
* 1.2 18 December 2000
Work around for some versions of ld not treating /dev/null and an
empty file the same
* 1.1 30 November 2000
Fix for ramdisks and large amounts of memory with 2.2 series
kernels.
* 1.0 7 November 2000
Initial release (supports vmlinux && bvmlinux)

View File

@ -0,0 +1,64 @@
#ifndef ARCH_IO_H
#define ARCH_IO_H
#include <stdint.h>
/* Helper functions for directly doing I/O */
extern inline uint8_t inb(uint16_t port)
{
uint8_t result;
__asm__ __volatile__ (
"inb %w1,%0"
:"=a" (result)
:"Nd" (port));
return result;
}
extern inline uint16_t inw(uint16_t port)
{
uint16_t result;
__asm__ __volatile__ (
"inw %w1,%0"
:"=a" (result)
:"Nd" (port));
return result;
}
extern inline uint32_t inl(uint32_t port)
{
uint32_t result;
__asm__ __volatile__ (
"inl %w1,%0"
:"=a" (result)
:"Nd" (port));
return result;
}
extern inline void outb (uint8_t value, uint16_t port)
{
__asm__ __volatile__ (
"outb %b0,%w1"
:
:"a" (value), "Nd" (port));
}
extern inline void outw (uint16_t value, uint16_t port)
{
__asm__ __volatile__ (
"outw %w0,%w1"
:
:"a" (value), "Nd" (port));
}
extern inline void outl (uint32_t value, uint16_t port)
{
__asm__ __volatile__ (
"outl %0,%w1"
:
:"a" (value), "Nd" (port));
}
#endif /* ARCH_IO_H */

View File

@ -0,0 +1,58 @@
#ifndef LIMITS_H
#define LIMITS_H 1
/* Number of bits in a `char' */
#define CHAR_BIT 8
/* Minimum and maximum values a `signed char' can hold */
#define SCHAR_MIN (-128)
#define SCHAR_MAX 127
/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
#define UCHAR_MAX 255
/* Minimum and maximum values a `char' can hold */
#define CHAR_MIN SCHAR_MIN
#define CHAR_MAX SCHAR_MAX
/* Minimum and maximum values a `signed short int' can hold */
#define SHRT_MIN (-32768)
#define SHRT_MAX 32767
/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */
#define USHRT_MAX 65535
/* Minimum and maximum values a `signed int' can hold */
#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 2147483647
/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
#define UINT_MAX 4294967295U
/* Minimum and maximum values a `signed int' can hold */
#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 2147483647
/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
#define UINT_MAX 4294967295U
/* Minimum and maximum values a `signed long' can hold */
#define LONG_MAX 2147483647L
#define LONG_MIN (-LONG_MAX - 1L)
/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */
#define ULONG_MAX 4294967295UL
/* Minimum and maximum values a `signed long long' can hold */
#define LLONG_MAX 9223372036854775807LL
#define LLONG_MIN (-LONG_MAX - 1LL)
/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */
#define ULLONG_MAX 18446744073709551615ULL
#endif /* LIMITS_H */

View File

@ -0,0 +1,16 @@
#ifndef STDINT_H
#define STDINT_H
typedef unsigned long size_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef signed long long int64_t;
#endif /* STDINT_H */

View File

@ -0,0 +1,57 @@
#ifndef LIMITS_H
#define LIMITS_H 1
/* Number of bits in a `char' */
#define CHAR_BIT 8
/* Minimum and maximum values a `signed char' can hold */
#define SCHAR_MIN (-128)
#define SCHAR_MAX 127
/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
#define UCHAR_MAX 255
/* Minimum and maximum values a `char' can hold */
#define CHAR_MIN SCHAR_MIN
#define CHAR_MAX SCHAR_MAX
/* Minimum and maximum values a `signed short int' can hold */
#define SHRT_MIN (-32768)
#define SHRT_MAX 32767
/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */
#define USHRT_MAX 65535
/* Minimum and maximum values a `signed int' can hold */
#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 2147483647
/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
#define UINT_MAX 4294967295U
/* Minimum and maximum values a `signed int' can hold */
#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 2147483647
/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
#define UINT_MAX 4294967295U
/* Minimum and maximum values a `signed long' can hold */
#define LONG_MAX 9223372036854775807L
#define LONG_MIN (-LONG_MAX - 1L)
/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */
#define ULONG_MAX 18446744073709551615UL
/* Minimum and maximum values a `signed long long' can hold */
#define LLONG_MAX 9223372036854775807LL
#define LLONG_MIN (-LONG_MAX - 1LL)
/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */
#define ULLONG_MAX 18446744073709551615ULL
#endif /* LIMITS_H */

View File

@ -0,0 +1,16 @@
#ifndef STDINT_H
#define STDINT_H
typedef unsigned long size_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long uint64_t;
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef signed long int64_t;
#endif /* STDINT_H */

1321
util/mkelfImage/config/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

1443
util/mkelfImage/config/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

251
util/mkelfImage/config/install-sh Executable file
View File

@ -0,0 +1,251 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

5276
util/mkelfImage/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,212 @@
dnl
dnl configure.ac for mkelfImage
dnl
dnl
dnl ---Required
AC_INIT(Makefile.conf.in)
AC_CONFIG_AUX_DIR(./config)
dnl --Options
dnl -- Compilation platform configuration
AC_CANONICAL_HOST
#AC_CANONICAL_TARGET
dnl Compute target cpu
case $host_cpu in
i?86 )
target_cpu="i386"
;;
* )
target_cpu="$host_cpu"
;;
esac
dnl ---Options
targets=""
AC_ARG_WITH([i386], AC_HELP_STRING([--with-i386],[enable building i386 code]),
[ if test "withval" = "yes" ; then with_i386="i386"; else with_i386="$withval"; fi],
[ with_i386="no"])
AC_ARG_WITH([ia64], AC_HELP_STRING([--with-ia64],[enable building ia64 code]),
[ if test "withval" = "yes" ; then with_ia64="ia64"; else with_ia64="$withval"; fi],
[ with_ia64="no"])
dnl If no targets are specified use a default
with_default="no"
if test "$with_i386" = "no" &&
test "$with_ia64" = "no" ; then
with_default=`echo $target_cpu | tr [a-z] [A-Z]`
fi
AC_MSG_NOTICE([with_default=$with_default])
AC_MSG_NOTICE([with_i386=$with_i386])
AC_MSG_NOTICE([with_ia64=$with_ia64])
dnl ---Programs
dnl To specify a different compiler, just 'export CC=/path/to/compiler'
AC_PROG_CC
AC_CHECK_PROG([MKDIR], mkdir, mkdir, [], [$PATH])
AC_CHECK_PROG([RM], rm, rm, [], [$PATH])
AC_CHECK_PROG([CP], cp, cp, [], [$PATH])
AC_CHECK_PROG([LN], ln, ln, [], [$PATH])
AC_CHECK_PROG([TAR], tar, tar, [], [$PATH])
AC_CHECK_PROG([RPM], rpm, rpm, [], [$PATH])
AC_CHECK_PROG([SED], sed, sed, [], [$PATH])
AC_CHECK_PROG([FIND], find, find, [], [$PATH])
AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, inflateInit_, [AC_DEFINE(HAVE_ZLIB_H, 1) LIBS="$LIBS -lz"]))
dnl Find the default programs
if test "with_default" != no ; then
if test "$CC" = no; then
AC_MSG_ERROR([cc not found])
fi
eval "${with_default}_CC='$CC'"
AC_PROG_CPP
if test "$CPP" = no; then
AC_MSG_ERROR([cpp not found])
fi
eval "${with_default}_CPP='$CPP'"
AC_CHECK_TOOL([LD], ld, no)
if test "$LD" = no; then
AC_MSG_ERROR([ld not found])
fi
eval "${with_default}_LD='$LD'"
AC_CHECK_TOOL([AS], as, no)
if test "$AS" = no; then
AC_MSG_ERROR([as not found])
fi
eval "${with_default}_AS='$AS'"
AC_CHECK_TOOL([OBJCOPY], objcopy, no)
if test "$OBJCOPY" = no; then
AC_MSG_ERROR([objcopy not found])
fi
eval "${with_default}_OBJCOPY='$OBJCOPY'"
if test "$with_default" = "X86_64" ; then
with_i386=yes
fi
fi
dnl Find the programs for compiling i386 targets
if test "$with_i386" != "no" ; then
cc="gcc -m32"
cpp=cpp
ld=ld
as="as -32"
objcopy=objcopy
if test "$with_i386" != "" -a "$with_i386" != "yes" ; then
cc="$with_i386-$cc"
cpp="$with_i386-$cpp"
ld="$with_i386-$ld"
as="$with_i386-$as"
objcopy="$with_i386-$objcopy"
fi
AC_CHECK_PROG([I386_CC], [$cc], [$cc], [""], [$PATH])
if test "$I386_CC" = no; then
AC_MSG_ERROR([$cc not found])
fi
AC_CHECK_PROG([I386_CPP], [$cpp], [$cpp], [""], [$PATH])
if test "$I386_CPP" = no; then
AC_MSG_ERROR([$cpp not found])
fi
AC_CHECK_PROG([I386_LD], [$ld], [$ld], [""], [$PATH])
if test "$I386_AS" = no; then
AC_MSG_ERROR([$ld not found])
fi
AC_CHECK_PROG([I386_AS], [$as], [$as], [""], [$PATH])
if test "$I386_AS" = no; then
AC_MSG_ERROR([$as not found])
fi
AC_CHECK_PROG([I386_OBJCOPY], [$objcopy], [$objcopy],[""], [$PATH])
if test "$I386_OBJCOPY" = no; then
AC_MSG_ERROR([$objcopy not found])
fi
fi
dnl Find the programs for compiling ia64 targets
if test "$with_ia64" != "no" ; then
cc=gcc
cpp=cpp
ld=ld
as=as
objcopy=objcopy
if test "$with_ia64" != "" -a "$with_ia64" != "yes" ; then
cc="$with_ia64-$cc"
cpp="$with_ia64-$cpp"
ld="$with_ia64-$ld"
as="$with_ia64-$as"
objcopy="$with_ia64-$objcopy"
fi
AC_CHECK_PROG([IA64_CC], [$cc], [$cc], [""], [$PATH])
if test "$IA64_CC" = no; then
AC_MSG_ERROR([$cc not found])
fi
AC_CHECK_PROG([IA64_CPP], [$cpp], [$cpp], [""], [$PATH])
if test "$IA64_CPP" = no; then
AC_MSG_ERROR([$cpp not found])
fi
AC_CHECK_PROG([IA64_LD], [$ld], [$ld], [""], [$PATH])
if test "$IA64_AS" = no; then
AC_MSG_ERROR([$ld not found])
fi
AC_CHECK_PROG([IA64_AS], [$as], [$as], [""], [$PATH])
if test "$IA64_AS" = no; then
AC_MSG_ERROR([$as not found])
fi
AC_CHECK_PROG([IA64_OBJCOPY], [$objcopy], [$objcopy],[""], [$PATH])
if test "$IA64_OBJCOPY" = no; then
AC_MSG_ERROR([$objcopy not found])
fi
fi
dnl ---Output variables...
HOST_CC=$CC
HOST_CFLAGS='-O2 -Wall $(HOST_CPPFLAGS)'
dnl TODO: figure out how to set these appropriately for compilers other than gcc
I386_CFLAGS='-Os -ffreestanding -Wall -W -Wno-format $(I386_CPPFLAGS)'
I386_ASFLAGS=''
I386_LDFLAGS='-static --warn-multiple-gp --warn-common'
dnl TODO: figure out how to set these appropriately for compilers other than gcc
IA64_CFLAGS='-Os -ffreestanding -Wall -W -Wno-format -fpic -mconstant-gp -mauto-pic -fno-unwind-tables $(IA64_CPPFLAGS)'
IA64_ASFLAGS='-mconstant-gp -mauto-pic'
IA64_LDFLAGS='-static --warn-multiple-gp --warn-common'
AC_SUBST([HOST_CC])
AC_SUBST([HOST_CFLAGS])
AC_SUBST([I386_CC])
AC_SUBST([I386_LD])
AC_SUBST([I386_AS])
AC_SUBST([I386_CPP])
AC_SUBST([I386_OBJCOPY])
AC_SUBST([I386_CFLAGS])
AC_SUBST([I386_ASFLAGS])
AC_SUBST([I386_LDFLAGS])
AC_SUBST([IA64_CC])
AC_SUBST([IA64_LD])
AC_SUBST([IA64_AS])
AC_SUBST([IA64_CPP])
AC_SUBST([IA64_OBJCOPY])
AC_SUBST([IA64_CFLAGS])
AC_SUBST([IA64_ASFLAGS])
AC_SUBST([IA64_LDFLAGS])
dnl ---Output
AC_OUTPUT([Makefile.conf])

View File

@ -0,0 +1,226 @@
#ifndef ELF_H
#define ELF_H
#define EI_NIDENT 16 /* Size of e_ident array. */
/* Values for e_type. */
#define ET_NONE 0 /* No file type */
#define ET_REL 1 /* Relocatable file */
#define ET_EXEC 2 /* Executable file */
#define ET_DYN 3 /* Shared object file */
#define ET_CORE 4 /* Core file */
/* Values for e_machine (architecute). */
#define EM_NONE 0 /* No machine */
#define EM_M32 1 /* AT&T WE 32100 */
#define EM_SPARC 2 /* SUN SPARC */
#define EM_386 3 /* Intel 80386+ */
#define EM_68K 4 /* Motorola m68k family */
#define EM_88K 5 /* Motorola m88k family */
#define EM_486 6 /* Perhaps disused */
#define EM_860 7 /* Intel 80860 */
#define EM_MIPS 8 /* MIPS R3000 big-endian */
#define EM_S370 9 /* IBM System/370 */
#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */
#define EM_PARISC 15 /* HPPA */
#define EM_VPP500 17 /* Fujitsu VPP500 */
#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
#define EM_960 19 /* Intel 80960 */
#define EM_PPC 20 /* PowerPC */
#define EM_PPC64 21 /* PowerPC 64-bit */
#define EM_S390 22 /* IBM S390 */
#define EM_V800 36 /* NEC V800 series */
#define EM_FR20 37 /* Fujitsu FR20 */
#define EM_RH32 38 /* TRW RH-32 */
#define EM_RCE 39 /* Motorola RCE */
#define EM_ARM 40 /* ARM */
#define EM_FAKE_ALPHA 41 /* Digital Alpha */
#define EM_SH 42 /* Hitachi SH */
#define EM_SPARCV9 43 /* SPARC v9 64-bit */
#define EM_TRICORE 44 /* Siemens Tricore */
#define EM_ARC 45 /* Argonaut RISC Core */
#define EM_H8_300 46 /* Hitachi H8/300 */
#define EM_H8_300H 47 /* Hitachi H8/300H */
#define EM_H8S 48 /* Hitachi H8S */
#define EM_H8_500 49 /* Hitachi H8/500 */
#define EM_IA_64 50 /* Intel Merced */
#define EM_MIPS_X 51 /* Stanford MIPS-X */
#define EM_COLDFIRE 52 /* Motorola Coldfire */
#define EM_68HC12 53 /* Motorola M68HC12 */
#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/
#define EM_PCP 55 /* Siemens PCP */
#define EM_NCPU 56 /* Sony nCPU embeeded RISC */
#define EM_NDR1 57 /* Denso NDR1 microprocessor */
#define EM_STARCORE 58 /* Motorola Start*Core processor */
#define EM_ME16 59 /* Toyota ME16 processor */
#define EM_ST100 60 /* STMicroelectronic ST100 processor */
#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/
#define EM_X86_64 62 /* AMD x86-64 architecture */
#define EM_PDSP 63 /* Sony DSP Processor */
#define EM_FX66 66 /* Siemens FX66 microcontroller */
#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */
#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */
#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */
#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */
#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */
#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */
#define EM_SVX 73 /* Silicon Graphics SVx */
#define EM_AT19 74 /* STMicroelectronics ST19 8 bit mc */
#define EM_VAX 75 /* Digital VAX */
#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */
#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */
#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */
#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */
#define EM_HUANY 81 /* Harvard University machine-independent object files */
#define EM_PRISM 82 /* SiTera Prism */
#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */
#define EM_FR30 84 /* Fujitsu FR30 */
#define EM_D10V 85 /* Mitsubishi D10V */
#define EM_D30V 86 /* Mitsubishi D30V */
#define EM_V850 87 /* NEC v850 */
#define EM_M32R 88 /* Mitsubishi M32R */
#define EM_MN10300 89 /* Matsushita MN10300 */
#define EM_MN10200 90 /* Matsushita MN10200 */
#define EM_PJ 91 /* picoJava */
#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */
#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
#define EM_NUM 95
/* Values for p_type. */
#define PT_NULL 0 /* Unused entry. */
#define PT_LOAD 1 /* Loadable segment. */
#define PT_DYNAMIC 2 /* Dynamic linking information segment. */
#define PT_INTERP 3 /* Pathname of interpreter. */
#define PT_NOTE 4 /* Auxiliary information. */
#define PT_SHLIB 5 /* Reserved (not used). */
#define PT_PHDR 6 /* Location of program header itself. */
/* Values for p_flags. */
#define PF_X 0x1 /* Executable. */
#define PF_W 0x2 /* Writable. */
#define PF_R 0x4 /* Readable. */
#define ELF_PROGRAM_RETURNS_BIT 0x8000000 /* e_flags bit 31 */
#define EI_MAG0 0
#define ELFMAG0 0x7f
#define EI_MAG1 1
#define ELFMAG1 'E'
#define EI_MAG2 2
#define ELFMAG2 'L'
#define EI_MAG3 3
#define ELFMAG3 'F'
#define ELFMAG "\177ELF"
#define EI_CLASS 4 /* File class byte index */
#define ELFCLASSNONE 0 /* Invalid class */
#define ELFCLASS32 1 /* 32-bit objects */
#define ELFCLASS64 2 /* 64-bit objects */
#define EI_DATA 5 /* Data encodeing byte index */
#define ELFDATANONE 0 /* Invalid data encoding */
#define ELFDATA2LSB 1 /* 2's complement little endian */
#define ELFDATA2MSB 2 /* 2's complement big endian */
#define EI_VERSION 6 /* File version byte index */
/* Value must be EV_CURRENT */
#define EV_NONE 0 /* Invalid ELF Version */
#define EV_CURRENT 1 /* Current version */
#define ELF32_PHDR_SIZE (8*4) /* Size of an elf program header */
#ifndef ASSEMBLY
/*
* ELF definitions common to all 32-bit architectures.
*/
typedef uint32_t Elf32_Addr;
typedef uint16_t Elf32_Half;
typedef uint32_t Elf32_Off;
typedef int32_t Elf32_Sword;
typedef uint32_t Elf32_Word;
typedef uint32_t Elf32_Size;
typedef uint64_t Elf64_Addr;
typedef uint16_t Elf64_Half;
typedef uint64_t Elf64_Off;
typedef int32_t Elf64_Sword;
typedef uint32_t Elf64_Word;
typedef uint64_t Elf64_Size;
/*
* ELF header.
*/
typedef struct {
unsigned char e_ident[EI_NIDENT]; /* File identification. */
Elf32_Half e_type; /* File type. */
Elf32_Half e_machine; /* Machine architecture. */
Elf32_Word e_version; /* ELF format version. */
Elf32_Addr e_entry; /* Entry point. */
Elf32_Off e_phoff; /* Program header file offset. */
Elf32_Off e_shoff; /* Section header file offset. */
Elf32_Word e_flags; /* Architecture-specific flags. */
Elf32_Half e_ehsize; /* Size of ELF header in bytes. */
Elf32_Half e_phentsize; /* Size of program header entry. */
Elf32_Half e_phnum; /* Number of program header entries. */
Elf32_Half e_shentsize; /* Size of section header entry. */
Elf32_Half e_shnum; /* Number of section header entries. */
Elf32_Half e_shstrndx; /* Section name strings section. */
} Elf32_Ehdr;
typedef struct {
unsigned char e_ident[EI_NIDENT]; /* File identification. */
Elf64_Half e_type; /* File type. */
Elf64_Half e_machine; /* Machine architecture. */
Elf64_Word e_version; /* ELF format version. */
Elf64_Addr e_entry; /* Entry point. */
Elf64_Off e_phoff; /* Program header file offset. */
Elf64_Off e_shoff; /* Section header file offset. */
Elf64_Word e_flags; /* Architecture-specific flags. */
Elf64_Half e_ehsize; /* Size of ELF header in bytes. */
Elf64_Half e_phentsize; /* Size of program header entry. */
Elf64_Half e_phnum; /* Number of program header entries. */
Elf64_Half e_shentsize; /* Size of section header entry. */
Elf64_Half e_shnum; /* Number of section header entries. */
Elf64_Half e_shstrndx; /* Section name strings section. */
} Elf64_Ehdr;
/*
* Program header.
*/
typedef struct {
Elf32_Word p_type; /* Entry type. */
Elf32_Off p_offset; /* File offset of contents. */
Elf32_Addr p_vaddr; /* Virtual address (not used). */
Elf32_Addr p_paddr; /* Physical address. */
Elf32_Size p_filesz; /* Size of contents in file. */
Elf32_Size p_memsz; /* Size of contents in memory. */
Elf32_Word p_flags; /* Access permission flags. */
Elf32_Size p_align; /* Alignment in memory and file. */
} Elf32_Phdr;
typedef struct {
Elf64_Word p_type; /* Entry type. */
Elf64_Word p_flags; /* Access permission flags. */
Elf64_Off p_offset; /* File offset of contents. */
Elf64_Addr p_vaddr; /* Virtual address (not used). */
Elf64_Addr p_paddr; /* Physical address. */
Elf64_Size p_filesz; /* Size of contents in file. */
Elf64_Size p_memsz; /* Size of contents in memory. */
Elf64_Size p_align; /* Alignment in memory and file. */
} Elf64_Phdr;
#endif /* ASSEMBLY */
#endif /* ELF_H */

View File

@ -0,0 +1,105 @@
#ifndef ELF_BOOT_H
#define ELF_BOOT_H
/* This defines the structure of a table of parameters useful for ELF
* bootable images. These parameters are all passed and generated
* by the bootloader to the booted image. For simplicity and
* consistency the Elf Note format is reused.
*
* All of the information must be Position Independent Data.
* That is it must be safe to relocate the whole ELF boot parameter
* block without changing the meaning or correctnes of the data.
* Additionally it must be safe to permute the order of the ELF notes
* to any possible permutation without changing the meaning or correctness
* of the data.
*
*/
#define ELF_BHDR_MAGIC 0x0E1FB007
#ifndef ASSEMBLY
#include <stdint.h>
typedef uint16_t Elf_Half;
typedef uint32_t Elf_Word;
/*
* Elf boot notes...
*/
typedef struct Elf_Bhdr
{
Elf_Word b_signature; /* "0x0E1FB007" */
Elf_Word b_size;
Elf_Half b_checksum;
Elf_Half b_records;
} Elf_Bhdr;
/*
* ELF Notes.
*/
typedef struct Elf_Nhdr
{
Elf_Word n_namesz; /* Length of the note's name. */
Elf_Word n_descsz; /* Length of the note's descriptor. */
Elf_Word n_type; /* Type of the note. */
} Elf_Nhdr;
#endif /* ASSEMBLY */
/* Standardized Elf image notes for booting... The name for all of these is ELFBoot */
#define ELF_NOTE_BOOT "ELFBoot"
#define EIN_PROGRAM_NAME 0x00000001
/* The program in this ELF file */
#define EIN_PROGRAM_VERSION 0x00000002
/* The version of the program in this ELF file */
#define EIN_PROGRAM_CHECKSUM 0x00000003
/* ip style checksum of the memory image. */
/* Linux image notes for booting... The name for all of these is Linux */
#define LIN_COMMAND_LINE 0x00000001
/* The command line to pass to the loaded kernel. */
#define LIN_ROOT_DEV 0x00000002
/* The root dev to pass to the loaded kernel. */
#define LIN_RAMDISK_FLAGS 0x00000003
/* Various old ramdisk flags */
#define LIN_INITRD_START 0x00000004
/* Start of the ramdisk in bytes */
#define LIN_INITRD_SIZE 0x00000005
/* Size of the ramdisk in bytes */
/* Notes that are passed to a loaded image */
/* For the standard elf boot notes n_namesz must be zero */
#define EBN_FIRMWARE_TYPE 0x00000001
/* ASCIZ name of the platform firmware. */
#define EBN_BOOTLOADER_NAME 0x00000002
/* This specifies just the ASCIZ name of the bootloader */
#define EBN_BOOTLOADER_VERSION 0x00000003
/* This specifies the version of the bootloader as an ASCIZ string */
#define EBN_COMMAND_LINE 0x00000004
/* This specifies a command line that can be set by user interaction,
* and is provided as a free form ASCIZ string to the loaded image.
*/
#define EBN_NOP 0x00000005
/* A note nop note has no meaning, useful for inserting explicit padding */
#define EBN_LOADED_IMAGE 0x00000006
/* An ASCIZ string naming the loaded image */
/* Etherboot specific notes */
#define EB_PARAM_NOTE "Etherboot"
#define EB_IA64_SYSTAB 0x00000001
#define EB_IA64_MEMMAP 0x00000002
#define EB_IA64_FPSWA 0x00000003
#define EB_IA64_CONINFO 0x00000004
#define EB_BOOTP_DATA 0x00000005
#define EB_HEADER 0x00000006
#define EB_IA64_IMAGE_HANDLE 0x00000007
#define EB_I386_MEMMAP 0x00000008
#endif /* ELF_BOOT_H */

View File

@ -0,0 +1,82 @@
#ifndef LINUXBIOS_TABLES_H
#define LINUXBIOS_TABLES_H
#include <stdint.h>
/* The linuxbios table information is for conveying information
* from the firmware to the loaded OS image. Primarily this
* is expected to be information that cannot be discovered by
* other means, such as quering the hardware directly.
*
* All of the information should be Position Independent Data.
* That is it should be safe to relocated any of the information
* without it's meaning/correctnes changing. For table that
* can reasonably be used on multiple architectures the data
* size should be fixed. This should ease the transition between
* 32 bit and 64 bit architectures etc.
*
* The completeness test for the information in this table is:
* - Can all of the hardware be detected?
* - Are the per motherboard constants available?
* - Is there enough to allow a kernel to run that was written before
* a particular motherboard is constructed? (Assuming the kernel
* has drivers for all of the hardware but it does not have
* assumptions on how the hardware is connected together).
*
* With this test it should be straight forward to determine if a
* table entry is required or not. This should remove much of the
* long term compatibility burden as table entries which are
* irrelevant or have been replaced by better alternatives may be
* dropped. Of course it is polite and expidite to include extra
* table entries and be backwards compatible, but it is not required.
*/
struct lb_header
{
uint8_t signature[4]; /* LBIO */
uint32_t header_bytes;
uint32_t header_checksum;
uint32_t table_bytes;
uint32_t table_checksum;
uint32_t table_entries;
};
/* Every entry in the boot enviroment list will correspond to a boot
* info record. Encoding both type and size. The type is obviously
* so you can tell what it is. The size allows you to skip that
* boot enviroment record if you don't know what it easy. This allows
* forward compatibility with records not yet defined.
*/
struct lb_record {
uint32_t tag; /* tag ID */
uint32_t size; /* size of record (in bytes) */
};
#define LB_TAG_UNUSED 0x0000
#define LB_TAG_MEMORY 0x0001
struct lb_memory_range {
uint64_t start;
uint64_t size;
uint32_t type;
#define LB_MEM_RAM 1
#define LB_MEM_RESERVED 2
};
struct lb_memory {
uint32_t tag;
uint32_t size;
struct lb_memory_range map[0];
};
#define LB_TAG_HWRPB 0x0002
struct lb_hwrpb {
uint32_t tag;
uint32_t size;
uint64_t hwrpb;
};
#endif /* LINUXBIOS_TABLES_H */

View File

@ -0,0 +1,125 @@
#ifndef MKELFIMAGE_H
#define MKELFIMAGE_H
#include <sys/types.h>
#include <stdint.h>
#include <byteswap.h>
#define USE_BSD
#include <endian.h>
#define _GNU_SOURCE
struct memelfheader;
struct memelfphdr;
struct memelfnote;
extern void die(char *fmt, ...);
extern void usage(void);
extern void error(char *fmt, ...);
extern uint16_t ipchksum(const void *data, unsigned long length);
extern uint16_t add_ipchksums(unsigned long offset, uint16_t sum, uint16_t new);
extern void *xmalloc(size_t size, const char *name);
extern void *xrealloc(void *ptr, size_t size, const char *name);
extern char *slurp_file(const char *filename, off_t *r_size);
extern char *slurp_decompress_file(const char *filename, off_t *r_size);
extern struct memelfphdr *add_program_headers(struct memelfheader *ehdr, int count);
extern struct memelfnote *add_notes(struct memelfheader *ehdr, int count);
typedef char *(probe_t)(char *kernel_buf, off_t kernel_size);
typedef int (mkelf_t)(int argc, char **argv,
struct memelfheader *hdr, char *kernel_buf, off_t kernel_size);
typedef void (usage_t)(void);
struct file_type {
const char *name;
probe_t *probe;
mkelf_t *mkelf;
usage_t *usage;
};
#if BYTE_ORDER == LITTLE_ENDIAN
#define cpu_to_le16(val) (val)
#define cpu_to_le32(val) (val)
#define cpu_to_le64(val) (val)
#define cpu_to_be16(val) bswap_16(val)
#define cpu_to_be32(val) bswap_32(val)
#define cpu_to_be64(val) bswap_64(val)
#define le16_to_cpu(val) (val)
#define le32_to_cpu(val) (val)
#define le64_to_cpu(val) (val)
#define be16_to_cpu(val) bswap_16(val)
#define be32_to_cpu(val) bswap_32(val)
#define be64_to_cpu(val) bswap_64(val)
#endif
#if BYTE_ORDER == BIG_ENDIAN
#define cpu_to_le16(val) bswap_16(val)
#define cpu_to_le32(val) bswap_32(val)
#define cpu_to_le64(val) bswap_64(val)
#define cpu_to_be16(val) (val)
#define cpu_to_be32(val) (val)
#define cpu_to_be64(val) (val)
#define le16_to_cpu(val) bswap_16(val)
#define le32_to_cpu(val) bswap_32(val)
#define le64_to_cpu(val) bswap_64(val)
#define be16_to_cpu(val) (val)
#define be32_to_cpu(val) (val)
#define be64_to_cpu(val) (val)
#endif
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
struct memelfheader {
unsigned ei_class;
unsigned ei_data;
unsigned e_type;
unsigned e_machine;
unsigned e_flags;
unsigned e_phnum;
unsigned e_notenum;
unsigned long e_entry;
struct memelfphdr *e_phdr;
struct memelfnote *e_notes;
};
struct memelfphdr {
uint64_t p_vaddr;
uint64_t p_paddr;
uint64_t p_filesz;
uint64_t p_memsz;
void *p_data;
unsigned p_type;
unsigned p_flags;
};
struct memelfnote {
unsigned n_type;
char *n_name;
void *n_desc;
unsigned n_descsz;
};
#define OPT_HELP 'h'
#define OPT_VERSION 'v'
#define OPT_TYPE 't'
#define OPT_KERNEL 256
#define OPT_OUTPUT 257
#define OPT_MAX 258
#define MKELF_OPTIONS \
{ "help", 0, 0, OPT_HELP }, \
{ "version", 0, 0, OPT_VERSION }, \
{ "kernel", 1, 0, OPT_KERNEL }, \
{ "output", 1, 0, OPT_OUTPUT }, \
{ "type", 1, 0, OPT_TYPE },
#define MKELF_OPT_STR "hvt:"
extern probe_t vmlinux_i386_probe;
extern probe_t bzImage_i386_probe;
extern probe_t linux_i386_probe;
extern mkelf_t linux_i386_mkelf;
extern usage_t linux_i386_usage;
extern probe_t linux_ia64_probe;
extern mkelf_t linux_ia64_mkelf;
extern usage_t linux_ia64_usage;
#endif /* MKELFIMAGE_H */

View File

@ -0,0 +1,15 @@
#ifndef ALPHA_STDDEF_H
#define ALPHA_STDDEF_H
typedef long ptrdiff_t;
typedef unsigned long size_t;
typedef long ssize_t;
typedef int wchar_t;
typedef unsigned int wint_t;
#define NULL 0
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif /* ALPHA_STDDEF_H */

View File

@ -0,0 +1,53 @@
#ifndef ALPHA_STDINT_H
#define ALPHA_STDINT_H
/* Exact integral types */
typedef unsigned char uint8_t;
typedef signed char int8_t;
typedef unsigned short uint16_t;
typedef signed short int16_t;
typedef unsigned int uint32_t;
typedef signed int int32_t;
typedef unsigned long uint64_t;
typedef signed long int64_t;
/* Small types */
typedef unsigned char uint_least8_t;
typedef signed char int_least8_t;
typedef unsigned short uint_least16_t;
typedef signed short int_least16_t;
typedef unsigned int uint_least32_t;
typedef signed int int_least32_t;
typedef unsigned long uint_least64_t;
typedef signed long int_least64_t;
/* Fast Types */
typedef unsigned char uint_fast8_t;
typedef signed char int_fast8_t;
typedef unsigned long uint_fast16_t;
typedef signed long int_fast16_t;
typedef unsigned long uint_fast32_t;
typedef signed long int_fast32_t;
typedef unsigned long uint_fast64_t;
typedef signed long int_fast64_t;
/* Types for `void *' pointers. */
typedef long intptr_t;
typedef unsigned long uintptr_t;
/* Largest integral types */
typedef long intmax_t;
typedef unsigned long uintmax_t;
#endif /* ALPHA_STDINT_H */

View File

@ -0,0 +1,128 @@
/* GNU C varargs and stdargs support for the DEC Alpha. */
/* Note: We must use the name __builtin_savregs. GCC attaches special
significance to that name. In particular, regardless of where in a
function __builtin_saveregs is called, GCC moves the call up to the
very start of the function. */
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
/* In VMS, __gnuc_va_list is simply char *; on OSF, it's a structure. */
#ifdef __VMS__
typedef char *__gnuc_va_list;
#else
typedef struct {
char *__base; /* Pointer to first integer register. */
int __offset; /* Byte offset of args so far. */
} __gnuc_va_list;
#endif
#endif /* __GNUC_VA_LIST */
/* If this is for internal libc use, don't define anything but
__gnuc_va_list. */
#if !defined(__GNUC_VA_LIST_1) && (defined (_STDARG_H) || defined (_VARARGS_H))
#define __GNUC_VA_LIST_1
#define _VA_LIST
#define _VA_LIST_
typedef __gnuc_va_list va_list;
#if !defined(_STDARG_H)
/* varargs support */
#define va_alist __builtin_va_alist
#define va_dcl int __builtin_va_alist;...
#ifdef __VMS__
#define va_start(pvar) ((pvar) = __builtin_saveregs ())
#else
#define va_start(pvar) ((pvar) = * (__gnuc_va_list *) __builtin_saveregs ())
#endif
#else /* STDARG.H */
/* ANSI alternative. */
/* Call __builtin_next_arg even though we aren't using its value, so that
we can verify that firstarg is correct. */
#ifdef __VMS__
#define va_start(pvar, firstarg) \
(__builtin_next_arg (firstarg), \
(pvar) = __builtin_saveregs ())
#else
#define va_start(pvar, firstarg) \
(__builtin_next_arg (firstarg), \
(pvar) = *(__gnuc_va_list *) __builtin_saveregs ())
#endif
#endif /* _STDARG_H */
#define va_end(__va) ((void) 0)
/* Values returned by __builtin_classify_type. */
enum {
__no_type_class = -1,
__void_type_class,
__integer_type_class,
__char_type_class,
__enumeral_type_class,
__boolean_type_class,
__pointer_type_class,
__reference_type_class,
__offset_type_class,
__real_type_class,
__complex_type_class,
__function_type_class,
__method_type_class,
__record_type_class,
__union_type_class,
__array_type_class,
__string_type_class,
__set_type_class,
__file_type_class,
__lang_type_class
};
/* Note that parameters are always aligned at least to a word boundary
(when passed) regardless of what GCC's __alignof__ operator says. */
/* Avoid errors if compiling GCC v2 with GCC v1. */
#if __GNUC__ == 1
#define __extension__
#endif
/* Get the size of a type in bytes, rounded up to an integral number
of words. */
#define __va_tsize(__type) \
(((sizeof (__type) + __extension__ sizeof (long long) - 1) \
/ __extension__ sizeof (long long)) * __extension__ sizeof (long long))
#ifdef __VMS__
#define va_arg(__va, __type) \
(*(((__va) += __va_tsize (__type)), \
(__type *)(void *)((__va) - __va_tsize (__type))))
#else
#define va_arg(__va, __type) \
(*(((__va).__offset += __va_tsize (__type)), \
(__type *)(void *)((__va).__base + (__va).__offset \
- (((__builtin_classify_type (* (__type *) 0) \
== __real_type_class) && (__va).__offset <= (6 * 8)) \
? (6 * 8) + 8 : __va_tsize (__type)))))
#endif
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#endif /* __GNUC_VA_LIST_1 */

View File

@ -0,0 +1,17 @@
ARCH_OPTIONS=
OBJECTS += __divqu.o __remqu.o __divlu.o __remlu.o
$(OBJDIR)/__divqu.o: $(SRC)/arch/alpha/lib/divide.S
$(CC) $(CFLAGS) -DDIV -c -o $@ $^
$(OBJDIR)/__remqu.o: $(SRC)/arch/alpha/lib/divide.S
$(CC) $(CFLAGS) -DREM -c -o $@ $^
$(OBJDIR)/__divlu.o: $(SRC)/arch/alpha/lib/divide.S
$(CC) $(CFLAGS) -DDIV -DINTSIZE -c -o $@ $^
$(OBJDIR)/__remlu.o: $(SRC)/arch/alpha/lib/divide.S
$(CC) $(CFLAGS) -DREM -DINTSIZE -c -o $@ $^

View File

@ -0,0 +1,195 @@
/*
* cpu/ev6/divide.S
*
* (C) 1995 Linus Torvalds
*
* Alpha division..
*/
/*
* The alpha chip doesn't provide hardware division, so we have to do it
* by hand. The compiler expects the functions
*
* __divqu: 64-bit unsigned long divide
* __remqu: 64-bit unsigned long remainder
* __divqs/__remqs: signed 64-bit
* __divlu/__remlu: unsigned 32-bit
* __divls/__remls: signed 32-bit
*
* These are not normal C functions: instead of the normal
* calling sequence, these expect their arguments in registers
* $24 and $25, and return the result in $27. Register $28 may
* be clobbered (assembly temporary), anything else must be saved.
*
* In short: painful.
*
* This is a rather simple bit-at-a-time algorithm: it's very good
* at dividing random 64-bit numbers, but the more usual case where
* the divisor is small is handled better by the DEC algorithm
* using lookup tables. This uses much less memory, though, and is
* nicer on the cache.. Besides, I don't know the copyright status
* of the DEC code.
*/
/*
* My temporaries:
* $0 - current bit
* $1 - shifted divisor
* $2 - modulus/quotient
*
* $23 - return address
* $24 - dividend
* $25 - divisor
*
* $27 - quotient/modulus
* $28 - compare status
*/
#define halt .long 0
/*
* Select function type and registers
*/
#define mask $0
#define divisor $1
#define compare $28
#define tmp1 $3
#define tmp2 $4
#ifdef DIV
#define DIV_ONLY(x,y...) x,##y
#define MOD_ONLY(x,y...)
#define func(x) __div##x
#define modulus $2
#define quotient $27
#define GETSIGN(x) xor $24,$25,x
#define STACK 48
#else
#define DIV_ONLY(x,y...)
#define MOD_ONLY(x,y...) x,##y
#define func(x) __rem##x
#define modulus $27
#define quotient $2
#define GETSIGN(x) bis $24,$24,x
#define STACK 32
#endif
/*
* For 32-bit operations, we need to extend to 64-bit
*/
#ifdef INTSIZE
#define ufunction func(lu)
#define sfunction func(l)
#define LONGIFY(x) zapnot x,15,x
#define SLONGIFY(x) addl x,0,x
#else
#define ufunction func(qu)
#define sfunction func(q)
#define LONGIFY(x)
#define SLONGIFY(x)
#endif
.set noat
.align 3
.globl ufunction
.ent ufunction
ufunction:
subq $30,STACK,$30
.frame $30,STACK,$23
.prologue 0
7: stq $1, 0($30)
bis $25,$25,divisor
stq $2, 8($30)
bis $24,$24,modulus
stq $0,16($30)
bis $31,$31,quotient
LONGIFY(divisor)
stq tmp1,24($30)
LONGIFY(modulus)
bis $31,1,mask
DIV_ONLY(stq tmp2,32($30))
beq divisor, 9f /* div by zero */
#ifdef INTSIZE
/*
* shift divisor left, using 3-bit shifts for
* 32-bit divides as we can't overflow. Three-bit
* shifts will result in looping three times less
* here, but can result in two loops more later.
* Thus using a large shift isn't worth it (and
* s8add pairs better than a sll..)
*/
1: cmpult divisor,modulus,compare
s8addq divisor,$31,divisor
s8addq mask,$31,mask
bne compare,1b
#else
1: cmpult divisor,modulus,compare
blt divisor, 2f
addq divisor,divisor,divisor
addq mask,mask,mask
bne compare,1b
unop
#endif
/* ok, start to go right again.. */
2: DIV_ONLY(addq quotient,mask,tmp2)
srl mask,1,mask
cmpule divisor,modulus,compare
subq modulus,divisor,tmp1
DIV_ONLY(cmovne compare,tmp2,quotient)
srl divisor,1,divisor
cmovne compare,tmp1,modulus
bne mask,2b
9: ldq $1, 0($30)
ldq $2, 8($30)
ldq $0,16($30)
ldq tmp1,24($30)
DIV_ONLY(ldq tmp2,32($30))
addq $30,STACK,$30
ret $31,($23),1
.end ufunction
/*
* Uhh.. Ugly signed division. I'd rather not have it at all, but
* it's needed in some circumstances. There are different ways to
* handle this, really. This does:
* -a / b = a / -b = -(a / b)
* -a % b = -(a % b)
* a % -b = a % b
* which is probably not the best solution, but at least should
* have the property that (x/y)*y + (x%y) = x.
*/
.align 3
.globl sfunction
.ent sfunction
sfunction:
subq $30,STACK,$30
.frame $30,STACK,$23
.prologue 0
bis $24,$25,$28
SLONGIFY($28)
bge $28,7b
stq $24,0($30)
subq $31,$24,$28
stq $25,8($30)
cmovlt $24,$28,$24 /* abs($24) */
stq $23,16($30)
subq $31,$25,$28
stq tmp1,24($30)
cmovlt $25,$28,$25 /* abs($25) */
unop
bsr $23,ufunction
ldq $24,0($30)
ldq $25,8($30)
GETSIGN($28)
subq $31,$27,tmp1
SLONGIFY($28)
ldq $23,16($30)
cmovlt $28,tmp1,$27
ldq tmp1,24($30)
addq $30,STACK,$30
ret $31,($23),1
.end sfunction

View File

@ -0,0 +1,50 @@
PAGE_SIZE = 65536;
BASIC_ALIGN = 8;
OUTPUT_FORMAT("elf64-alpha")
ENTRY(__start)
SECTIONS
{
. = PAGE_SIZE;
_start = .;
/*
* First we place the code and read only data (typically const declared).
* This get placed in rom.
*/
.text : {
_text = .;
*(.text)
_etext = .;
_rodata = .;
*(.rodata);
_erodata = .;
}
/* Global data */
.data : {
_data = .;
*(.data)
CONSTRUCTORS
*(.got)
*(.sdata)
_edata = .;
}
/* Important align _bss so bss may be zeroed with quadword access */
. = ALIGN(BASIC_ALIGN);
.bss : {
_bss = .;
*(.sbss)
*(.scommon)
*(.bss)
*(COMMON)
*(.heap)
*(.stack)
/* Important align _ebss so bss may be zeroed with quadword access */
. = ALIGN(BASIC_ALIGN);
_ebss = .;
}
_end = .;
/DISCARD/ : {
*(*)
}
}

View File

@ -0,0 +1,89 @@
.set noat
.set noreorder
.text
__original_registers:
.quad 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
__entry:
.quad entry
.globl __start
__start:
br $27, __save_registers
__save_registers:
lda $27, (__original_registers - __save_registers)($27)
stq $0, 0($27)
stq $1, 8($27)
stq $2, 16($27)
stq $3, 24($27)
stq $4, 32($27)
stq $5, 40($27)
stq $6, 48($27)
stq $7, 56($27)
stq $8, 64($27)
stq $9, 72($27)
stq $10, 80($27)
stq $11, 88($27)
stq $12, 96($27)
stq $13, 104($27)
stq $14, 112($27)
stq $15, 120($27)
stq $16, 128($27)
stq $17, 136($27)
stq $18, 144($27)
stq $19, 152($27)
stq $20, 160($27)
stq $21, 168($27)
stq $22, 176($27)
stq $23, 184($27)
stq $24, 192($27)
stq $25, 200($27)
stq $26, 208($27)
stq $28, 224($27)
stq $29, 232($27)
stq $30, 240($27)
__normal_start:
ldgp $29, (__normal_start - __original_registers)($27)
lda $30, _estack
jsr $26, kunzip
.globl jmp_to_program_entry
jmp_to_program_entry:
br $27, __restore_registers
__restore_registers:
lda $27,(__original_registers - __restore_registers)($27)
stq $16, (__entry - __original_registers)($27)
ldq $0, 0($27)
ldq $1, 8($27)
ldq $2, 16($27)
ldq $3, 24($27)
ldq $4, 32($27)
ldq $5, 40($27)
ldq $6, 48($27)
ldq $7, 56($27)
ldq $8, 64($27)
ldq $9, 72($27)
ldq $10, 80($27)
ldq $11, 88($27)
ldq $12, 96($27)
ldq $13, 104($27)
ldq $14, 112($27)
ldq $15, 120($27)
ldq $16, 128($27)
ldq $17, 136($27)
ldq $18, 144($27)
ldq $19, 152($27)
ldq $20, 160($27)
ldq $21, 168($27)
ldq $22, 176($27)
ldq $23, 184($27)
ldq $24, 192($27)
ldq $25, 200($27)
ldq $26, 208($27)
ldq $28, 224($27)
ldq $29, 232($27)
ldq $30, 240($27)
ldq $27, (__entry - __original_registers)($27)
jsr $31, ($27)

View File

@ -0,0 +1,15 @@
#ifndef I386_STDDEF_H
#define I386_STDDEF_H
typedef long ptrdiff_t;
typedef unsigned long size_t;
typedef long ssize_t;
typedef int wchar_t;
typedef unsigned int wint_t;
#define NULL 0
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif I386_STDDEF_H

View File

@ -0,0 +1,52 @@
#ifndef I386_STDINT_H
#define I386_STDINT_H
/* Exact integral types */
typedef unsigned char uint8_t;
typedef signed char int8_t;
typedef unsigned short uint16_t;
typedef signed short int16_t;
typedef unsigned int uint32_t;
typedef signed int int32_t;
typedef unsigned long long uint64_t;
typedef signed long long int64_t;
/* Small types */
typedef unsigned char uint_least8_t;
typedef signed char int_least8_t;
typedef unsigned short uint_least16_t;
typedef signed short int_least16_t;
typedef unsigned int uint_least32_t;
typedef signed int int_least32_t;
typedef unsigned long long uint_least64_t;
typedef signed long long int_least64_t;
/* Fast Types */
typedef unsigned char uint_fast8_t;
typedef signed char int_fast8_t;
typedef unsigned int uint_fast16_t;
typedef signed int int_fast16_t;
typedef unsigned int uint_fast32_t;
typedef signed int int_fast32_t;
typedef unsigned long long uint_fast64_t;
typedef signed long long int_fast64_t;
/* Types for `void *' pointers. */
typedef int intptr_t;
typedef unsigned int uintptr_t;
/* Largest integral types */
typedef long long int intmax_t;
typedef unsigned long long uintmax_t;
#endif /* I386_STDINT_H */

View File

@ -0,0 +1 @@
ARCH_OPTIONS=

View File

@ -0,0 +1,50 @@
PAGE_SIZE = 4096;
BASIC_ALIGN = 8;
OUTPUT_FORMAT("elf32-i386")
ENTRY(__start)
SECTIONS
{
. = PAGE_SIZE;
_start = .;
/*
* First we place the code and read only data (typically const declared).
* This get placed in rom.
*/
.text : {
_text = .;
*(.text)
_etext = .;
_rodata = .;
*(.rodata);
_erodata = .;
}
/* Global data */
.data : {
_data = .;
*(.data)
CONSTRUCTORS
*(.got)
*(.sdata)
_edata = .;
}
/* Important align _bss so bss may be zeroed with quadword access */
. = ALIGN(BASIC_ALIGN);
.bss : {
_bss = .;
*(.sbss)
*(.scommon)
*(.bss)
*(COMMON)
*(.heap)
*(.stack)
/* Important align _ebss so bss may be zeroed with quadword access */
. = ALIGN(BASIC_ALIGN);
_ebss = .;
}
_end = .;
/DISCARD/ : {
*(*)
}
}

View File

@ -0,0 +1,36 @@
.text
__original_registers:
.long 0, 0, 0, 0, 0, 0 , 0 , 0
__entry:
.long entry
.globl __start
__start:
movl %eax, 0+__original_registers
movl %ebx, 4+__original_registers
movl %ecx, 8+__original_registers
movl %edx, 12+__original_registers
movl %esi, 16+__original_registers
movl %edi, 20+__original_registers
movl %esp, 24+__original_registers
movl %ebp, 28+__original_registers
__normal_start:
movl $_estack, %esp
call kunzip
.globl jmp_to_program_entry
jmp_to_program_entry:
movl 4(%esp), %eax
movl %eax, __entry
movl 0+__original_registers, %eax
movl 4+__original_registers, %ebx
movl 8+__original_registers, %ecx
movl 12+__original_registers, %edx
movl 16+__original_registers, %esi
movl 20+__original_registers, %edi
movl 24+__original_registers, %esp
movl 28+__original_registers, %ebp
jmp *__entry

View File

@ -0,0 +1,205 @@
/* stdarg.h for GNU.
Note that the type used in va_arg is supposed to match the
actual type **after default promotions**.
Thus, va_arg (..., short) is not valid. */
#ifndef _STDARG_H
#ifndef _ANSI_STDARG_H_
#ifndef __need___va_list
#define _STDARG_H
#define _ANSI_STDARG_H_
#endif /* not __need___va_list */
#undef __need___va_list
#ifdef __clipper__
#include "va-clipper.h"
#else
#ifdef __m88k__
#include "va-m88k.h"
#else
#ifdef __i860__
#include "va-i860.h"
#else
#ifdef __hppa__
#include "va-pa.h"
#else
#ifdef __mips__
#include "va-mips.h"
#else
#ifdef __sparc__
#include "va-sparc.h"
#else
#ifdef __i960__
#include "va-i960.h"
#else
#ifdef __alpha__
#include "va-alpha.h"
#else
#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
#include "va-h8300.h"
#else
#if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
#include "va-ppc.h"
#else
#ifdef __arc__
#include "va-arc.h"
#else
#ifdef __M32R__
#include "va-m32r.h"
#else
#ifdef __sh__
#include "va-sh.h"
#else
#ifdef __mn10300__
#include "va-mn10300.h"
#else
#ifdef __mn10200__
#include "va-mn10200.h"
#else
#ifdef __v850__
#include "va-v850.h"
#else
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__)
typedef char *__gnuc_va_list;
#else
typedef void *__gnuc_va_list;
#endif
#endif
/* Define the standard macros for the user,
if this invocation was from the user program. */
#ifdef _STDARG_H
/* Amount of space required in an argument list for an arg of type TYPE.
TYPE may alternatively be an expression whose type is used. */
#if defined(sysV68)
#define __va_rounded_size(TYPE) \
(((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
#else
#define __va_rounded_size(TYPE) \
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#endif
#define va_start(AP, LASTARG) \
(AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
#undef va_end
void va_end (__gnuc_va_list); /* Defined in libgcc.a */
#define va_end(AP) ((void)0)
/* We cast to void * and then to TYPE * because this avoids
a warning about increasing the alignment requirement. */
#if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
/* This is for little-endian machines; small args are padded upward. */
#define va_arg(AP, TYPE) \
(AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
*((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
#else /* big-endian */
/* This is for big-endian machines; small args are padded downward. */
#define va_arg(AP, TYPE) \
(AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
*((TYPE *) (void *) ((char *) (AP) \
- ((sizeof (TYPE) < __va_rounded_size (char) \
? sizeof (TYPE) : __va_rounded_size (TYPE))))))
#endif /* big-endian */
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#endif /* _STDARG_H */
#endif /* not v850 */
#endif /* not mn10200 */
#endif /* not mn10300 */
#endif /* not sh */
#endif /* not m32r */
#endif /* not arc */
#endif /* not powerpc with V.4 calling sequence */
#endif /* not h8300 */
#endif /* not alpha */
#endif /* not i960 */
#endif /* not sparc */
#endif /* not mips */
#endif /* not hppa */
#endif /* not i860 */
#endif /* not m88k */
#endif /* not clipper */
#ifdef _STDARG_H
/* Define va_list, if desired, from __gnuc_va_list. */
/* We deliberately do not define va_list when called from
stdio.h, because ANSI C says that stdio.h is not supposed to define
va_list. stdio.h needs to have access to that data type,
but must not use that name. It should use the name __gnuc_va_list,
which is safe because it is reserved for the implementation. */
#ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
#undef _VA_LIST
#endif
#ifdef _BSD_VA_LIST
#undef _BSD_VA_LIST
#endif
#if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
/* SVR4.2 uses _VA_LIST for an internal alias for va_list,
so we must avoid testing it and setting it here.
SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
have no conflict with that. */
#ifndef _VA_LIST_
#define _VA_LIST_
#ifdef __i860__
#ifndef _VA_LIST
#define _VA_LIST va_list
#endif
#endif /* __i860__ */
typedef __gnuc_va_list va_list;
#ifdef _SCO_DS
#define __VA_LIST
#endif
#endif /* _VA_LIST_ */
#else /* not __svr4__ || _SCO_DS */
/* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
But on BSD NET2 we must not test or define or undef it.
(Note that the comments in NET 2's ansi.h
are incorrect for _VA_LIST_--see stdio.h!) */
#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
#ifndef _VA_LIST_DEFINED
/* The macro _VA_LIST is used in SCO Unix 3.2. */
#ifndef _VA_LIST
/* The macro _VA_LIST_T_H is used in the Bull dpx2 */
#ifndef _VA_LIST_T_H
typedef __gnuc_va_list va_list;
#endif /* not _VA_LIST_T_H */
#endif /* not _VA_LIST */
#endif /* not _VA_LIST_DEFINED */
#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
#define _VA_LIST_
#endif
#ifndef _VA_LIST
#define _VA_LIST
#endif
#ifndef _VA_LIST_DEFINED
#define _VA_LIST_DEFINED
#endif
#ifndef _VA_LIST_T_H
#define _VA_LIST_T_H
#endif
#endif /* not _VA_LIST_, except on certain systems */
#endif /* not __svr4__ */
#endif /* _STDARG_H */
#endif /* not _ANSI_STDARG_H_ */
#endif /* not _STDARG_H */

View File

@ -0,0 +1,14 @@
#ifndef STDLIB_H
#define STDLIB_H
#include <stddef.h>
extern void *malloc(size_t size);
void free(void *ptr);
/* Extensions to malloc... */
typedef size_t malloc_mark_t;
void malloc_mark(malloc_mark_t *place);
void malloc_release(malloc_mark_t *place);
#endif /* STDLIB_H */

View File

@ -0,0 +1,31 @@
#ifndef STRING_H
#define STRING_H
#include <stddef.h>
// yes, linux has fancy ones. We don't care. This stuff gets used
// hardly at all. And the pain of including those files is just too high.
//extern inline void strcpy(char *dst, char *src) {while (*src) *dst++ = *src++;}
//extern inline int strlen(char *src) { int i = 0; while (*src++) i++; return i;}
static inline size_t strnlen(const char *src, size_t max) {
int i = 0;
if (max<0) {
while (*src++)
i++;
return i;
}
else {
while ((*src++) && (i < max))
i++;
return i;
}
}
extern void *memcpy(void *dest, const void *src, size_t n);
extern void *memset(void *s, int c, size_t n);
extern int memcmp(const void *s1, const void *s2, size_t n);
#endif /* STRING_H */

View File

@ -0,0 +1,18 @@
#ifndef TYPES_H
#define TYPES_H
#include <stdint.h>
#include <stddef.h>
typedef uint8_t u8;
typedef int8_t s8;
typedef uint16_t u16;
typedef int16_t s16;
typedef uint32_t u32;
typedef int32_t s32;
typedef uint64_t u64;
typedef int64_t s64;
/* FIXME is BITS_PER_LONG needed? */
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,170 @@
#include <string.h>
#include <stdlib.h>
/*
* gzip support routine declartions..
* =========================================================
*/
#ifdef DEBUG
# define Trace(x)
# define Tracev(x)
# define Tracevv(x)
# define Tracec(c,x)
# define Tracecv(c,x)
# define DBG(x) printf x
#else
# define Trace(x)
# define Tracev(x)
# define Tracevv(x)
# define Tracec(c,x)
# define Tracecv(c,x)
# define DBG(x)
#endif
void error(char *str)
{
DBG(("%s\n", str));
}
static unsigned char *inbuf; /* input buffer */
static unsigned int insize; /* valid bytes in inbuf */
static unsigned int inptr; /* index of next byte to be processed in inbuf */
#if !defined(DEBUG)
#define get_byte() (inptr < insize ? inbuf[inptr++] : 0)
#else
static unsigned char get_byte(void)
{
static int count;
unsigned char byte = (inptr < insize ? inbuf[inptr++] : 0);
#if 0
printf("%02x ", byte);
if ((++count & 0x0f) == 0) {
printf("\n");
}
#endif
return byte;
}
#endif
static void flush_window(void);
static long bytes_out; /* total bytes compressed */
static unsigned outcnt; /* bytes in output buffer */
#define WSIZE 0x8000 /* Window size must be at least 32k, and a power of two */
static unsigned char window[WSIZE]; /* Sliding window buffer */
/*
* gzip declarations
*/
#define OF(args) args
#define STATIC static
#define memzero(s, n) memset ((s), 0, (n))
typedef unsigned char uch;
typedef unsigned short ush;
typedef unsigned long ulg;
#include "inflate.c"
/* Variables that gunzip doesn't need to see... */
static unsigned char *output_ptr;
static unsigned long end_offset;
static struct unzip_region {
unsigned long start;
unsigned long end_offset;
} unzip_region;
/* Data provided by the header */
extern unsigned char zipped_data[];
extern unsigned char zipped_data_end[];
extern unsigned char entry;
/* Assembly language routines */
extern void jmp_to_program_entry(void *);
/* ===========================================================================
* Write the output window window[0..outcnt-1] and update crc and bytes_out.
* (Used for the decompressed data only.)
*/
static void flush_window(void)
{
ulg c = crc; /* temporary variable */
unsigned n;
unsigned long limit;
uch *in, *out, ch;
limit = outcnt;
n = 0;
in = window;
while (n < outcnt) {
limit = end_offset - bytes_out +n;
if (limit > outcnt) {
limit = outcnt;
}
out = output_ptr;
DBG(("flush 0x%08lx start 0x%08lx limit 0x%08lx\n",
(unsigned long) out, (unsigned long)n, limit));
for (; n < limit; n++) {
ch = *out++ = *in++;
c = crc_32_tab[((int) c ^ ch) & 0xff] ^ (c >> 8);
}
crc = c;
bytes_out += (out - output_ptr);
output_ptr = out;
if (bytes_out == end_offset) {
if (output_ptr == (unsigned char *)(&unzip_region+1)) {
output_ptr = (unsigned char *)(unzip_region.start);
end_offset = unzip_region.end_offset;
} else {
output_ptr = (unsigned char *)&unzip_region;
end_offset += sizeof(unzip_region);
}
}
}
outcnt = 0;
}
void gunzip_setup(void)
{
DBG(("gunzip_setup\n"));
outcnt = 0;
bytes_out = 0;
end_offset = sizeof(unzip_region);
output_ptr = (unsigned char *)&unzip_region;
inbuf = &zipped_data[0];
insize = zipped_data_end - zipped_data;
inptr = 0;
makecrc();
DBG(("gunzip_setup_done\n"));
}
int kunzip(int argc, char **argv)
{
DBG(("kunzip\n"));
gunzip_setup();
DBG(("pre_gunzip\n"));
if (gunzip() != 0) {
error("gunzip failed");
while(1) {}
return -1;
}
DBG(("pre_jmp_to_program_entry: %p\n", &entry ));
jmp_to_program_entry(&entry);
return 0;
}

View File

@ -0,0 +1,42 @@
#include <stdlib.h>
extern unsigned char _heap, _eheap;
static size_t free_mem_ptr = (size_t)&_heap; /* Start of heap */
static size_t free_mem_end_ptr = (size_t)&_eheap; /* End of heap */
void malloc_mark(malloc_mark_t *place)
{
*place = free_mem_ptr;
}
void malloc_release(malloc_mark_t *ptr)
{
free_mem_ptr = *ptr;
}
void *malloc(size_t size)
{
void *p;
if (size < 0)
error("Error! malloc: Size < 0");
if (free_mem_ptr <= 0)
error("Error! malloc: Free_mem_ptr <= 0");
free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
p = (void *) free_mem_ptr;
free_mem_ptr += size;
if (free_mem_ptr >= free_mem_end_ptr)
error("Error! malloc: Free_mem_ptr >= free_mem_end_ptr");
return p;
}
void free(void *where)
{
/* Don't care */
}

View File

@ -0,0 +1,17 @@
#include <string.h>
int memcmp(const void *src1, const void *src2, size_t bytes)
{
const unsigned char *s1, *s2;
int result;
s1 = src1;
s2 = src2;
result = 0;
while((bytes > 0) && (result == 0)) {
result = *s1 - *s2;
bytes--;
s1++;
s2++;
}
return result;
}

View File

@ -0,0 +1,11 @@
#include <string.h>
void *memcpy(void *__dest, __const void *__src, size_t __n)
{
int i;
char *d = (char *) __dest, *s = (char *) __src;
for (i = 0; i < __n; i++)
d[i] = s[i];
return __dest;
}

View File

@ -0,0 +1,12 @@
#include <string.h>
void *memset(void *s, int c, size_t n)
{
int i;
char *ss = (char *) s;
for (i = 0; i < n; i++)
ss[i] = c;
return s;
}

View File

@ -0,0 +1,35 @@
LI386_DIR:=linux-i386
LI386_OBJ:=$(OBJDIR)/$(LI386_DIR)
LI386_DEP=Makefile Makefile.conf $(LI386_DIR)/Makefile
$(LI386_OBJ)/mkelf-linux-i386.o: $(LI386_DIR)/mkelf-linux-i386.c $(LI386_DIR)/convert.bin.c $(LI386_DEP)
$(MKDIR) -p $(@D)
$(HOST_CC) $(HOST_CFLAGS) -c -g $< -o $@
ifdef I386_CC
$(LI386_DIR)/convert.bin.c: $(LI386_OBJ)/convert.bin $(OBJDIR)/bin/bin-to-hex $(LI386_DEP)
$(MKDIR) -p $(@D)
$(OBJDIR)/bin/bin-to-hex < $(LI386_OBJ)/convert.bin > $@
$(LI386_OBJ)/convert.bin: $(LI386_OBJ)/convert $(LI386_DEP)
$(MKDIR) -p $(@D)
$(I386_OBJCOPY) -O binary $< $@
CONVERT_LI386_OBJS=$(LI386_OBJ)/head.o $(LI386_OBJ)/convert_params.o
$(LI386_OBJ)/convert: $(LI386_DIR)/convert.lds $(CONVERT_LI386_OBJS) $(LI386_DEP)
$(MKDIR) -p $(@D)
$(I386_LD) $(I386_LDFLAGS) -T $(LI386_DIR)/convert.lds -o $@ $(CONVERT_LI386_OBJS)
$(LI386_OBJ)/head.o: $(LI386_DIR)/head.S $(LI386_DIR)/convert.h
$(MKDIR) -p $(@D)
$(I386_CPP) $(I386_CPPFLAGS) -DASSEMBLY $< | $(I386_AS) $(I386_ASFLAGS) -o $@
$(LI386_OBJ)/convert_params.o: $(LI386_DIR)/convert_params.c $(LI386_DIR)/convert.h $(LI386_DEP)
$(MKDIR) -p $(@D)
$(I386_CC) $(I386_CFLAGS) -c -o $@ $<
endif

View File

@ -0,0 +1,284 @@
0xfc, 0xfa, 0xa3, 0xee, 0x01, 0x01, 0x00, 0x89, 0x1d, 0xf2, 0x01, 0x01, 0x00, 0x83, 0xfc, 0x00,
0x74, 0x09, 0x8b, 0x44, 0x24, 0x04, 0xa3, 0xf6, 0x01, 0x01, 0x00, 0x8b, 0x25, 0x8c, 0x10, 0x01,
0x00, 0x6a, 0x00, 0x9d, 0x31, 0xc0, 0xbf, 0xbc, 0x11, 0x01, 0x00, 0xb9, 0x44, 0x54, 0x01, 0x00,
0x29, 0xf9, 0xfc, 0xf3, 0xaa, 0xbe, 0x0c, 0x02, 0x01, 0x00, 0xbf, 0x00, 0x10, 0x02, 0x00, 0xb9,
0x70, 0x00, 0x00, 0x00, 0xf3, 0xa4, 0x0f, 0x01, 0x15, 0x06, 0x02, 0x01, 0x00, 0x0f, 0x01, 0x1d,
0x00, 0x02, 0x01, 0x00, 0xb8, 0x18, 0x00, 0x00, 0x00, 0x8e, 0xd8, 0x8e, 0xc0, 0x8e, 0xe0, 0x8e,
0xe8, 0x8e, 0xd0, 0x68, 0xa0, 0x10, 0x01, 0x00, 0xff, 0x35, 0xf6, 0x01, 0x01, 0x00, 0xff, 0x35,
0xf2, 0x01, 0x01, 0x00, 0xff, 0x35, 0xee, 0x01, 0x01, 0x00, 0xe8, 0x50, 0x08, 0x00, 0x00, 0x89,
0xc6, 0x83, 0xc4, 0x10, 0x6a, 0x00, 0x9d, 0x31, 0xdb, 0x31, 0xc0, 0x31, 0xc9, 0x31, 0xd2, 0x31,
0xff, 0x31, 0xe4, 0x31, 0xed, 0xea, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x55, 0x89, 0xe5, 0x53,
0x56, 0x57, 0x8b, 0x7d, 0x08, 0x81, 0xef, 0x00, 0x00, 0x01, 0x00, 0x8b, 0x75, 0x0c, 0x56, 0xe8,
0xfc, 0x00, 0x00, 0x00, 0x66, 0x31, 0xdb, 0x66, 0xb8, 0x20, 0xe8, 0x00, 0x00, 0x66, 0xba, 0x50,
0x41, 0x4d, 0x53, 0x66, 0xb9, 0x14, 0x00, 0x00, 0x00, 0xcd, 0x15, 0x72, 0x18, 0x66, 0x3d, 0x50,
0x41, 0x4d, 0x53, 0x75, 0x10, 0x66, 0x4e, 0x66, 0x85, 0xf6, 0x74, 0x09, 0x83, 0xc7, 0x14, 0x66,
0x83, 0xfb, 0x00, 0x75, 0xd2, 0x66, 0xe8, 0x82, 0x00, 0x00, 0x00, 0x58, 0x29, 0xf0, 0x5f, 0x5e,
0x5b, 0x89, 0xec, 0x5d, 0xc3, 0x53, 0x56, 0x57, 0xe8, 0xb3, 0x00, 0x00, 0x00, 0xf9, 0x31, 0xc9,
0x31, 0xd2, 0xb8, 0x01, 0xe8, 0xcd, 0x15, 0x72, 0x28, 0x83, 0xf9, 0x00, 0x75, 0x09, 0x83, 0xfa,
0x00, 0x75, 0x04, 0x89, 0xc1, 0x89, 0xda, 0x66, 0x81, 0xe2, 0xff, 0xff, 0x00, 0x00, 0x66, 0xc1,
0xe2, 0x06, 0x66, 0x89, 0xd0, 0x66, 0x81, 0xe1, 0xff, 0xff, 0x00, 0x00, 0x66, 0x01, 0xc8, 0xeb,
0x03, 0x66, 0x31, 0xc0, 0x66, 0xe8, 0x33, 0x00, 0x00, 0x00, 0x5f, 0x5e, 0x5b, 0xc3, 0x53, 0x56,
0x57, 0xe8, 0x6a, 0x00, 0x00, 0x00, 0xb4, 0x88, 0xcd, 0x15, 0x66, 0x25, 0xff, 0xff, 0x00, 0x00,
0x66, 0xe8, 0x17, 0x00, 0x00, 0x00, 0x5f, 0x5e, 0x5b, 0xc3, 0xe8, 0x51, 0x00, 0x00, 0x00, 0xcd,
0x12, 0x89, 0xc1, 0x66, 0xe8, 0x04, 0x00, 0x00, 0x00, 0x66, 0x89, 0xc8, 0xc3, 0xfa, 0x2e, 0x67,
0x0f, 0x01, 0x15, 0x06, 0x02, 0x00, 0x00, 0x0f, 0x20, 0xc0, 0x66, 0x83, 0xc8, 0x01, 0x0f, 0x22,
0xc0, 0x66, 0xea, 0x89, 0x01, 0x01, 0x00, 0x10, 0x00, 0xb8, 0x18, 0x00, 0x00, 0x00, 0x8e, 0xd8,
0x8e, 0xc0, 0x8e, 0xd0, 0x81, 0xc4, 0x00, 0x00, 0x01, 0x00, 0x31, 0xc0, 0x8e, 0xe0, 0x8e, 0xe8,
0x58, 0x05, 0x00, 0x00, 0x01, 0x00, 0x50, 0x2e, 0x0f, 0x01, 0x1d, 0x00, 0x02, 0x01, 0x00, 0xc3,
0x58, 0x2d, 0x00, 0x00, 0x01, 0x00, 0x50, 0x81, 0xec, 0x00, 0x00, 0x01, 0x00, 0xea, 0xc4, 0x01,
0x00, 0x00, 0x08, 0x00, 0x0f, 0x20, 0xc0, 0x66, 0x83, 0xe0, 0xfe, 0x0f, 0x22, 0xc0, 0x66, 0xea,
0xd6, 0x01, 0x00, 0x00, 0x00, 0x10, 0x8c, 0xc8, 0x8e, 0xd8, 0x8e, 0xc0, 0x8e, 0xd0, 0x8e, 0xe0,
0x8e, 0xe8, 0x2e, 0x67, 0x0f, 0x01, 0x1d, 0xfa, 0x01, 0x00, 0x00, 0xfb, 0x66, 0xc3, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x01, 0x9b, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
0x00, 0x9a, 0xcf, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x92, 0xcf, 0x00, 0xff, 0xff, 0x00, 0x00,
0x01, 0x93, 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, 0xff, 0xff, 0x00, 0x00,
0x00, 0x9a, 0xcf, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x92, 0xcf, 0x00, 0x55, 0x89, 0xe5, 0x89,
0xc1, 0xba, 0xfd, 0x03, 0x00, 0x00, 0xec, 0xa8, 0x20, 0x74, 0xf6, 0xb2, 0xf8, 0x88, 0xc8, 0xee,
0xba, 0xfd, 0x03, 0x00, 0x00, 0xec, 0xa8, 0x40, 0x74, 0xf6, 0xc9, 0xc3, 0x55, 0x83, 0xf8, 0x0a,
0x89, 0xe5, 0x53, 0x89, 0xc3, 0x75, 0x0a, 0xb8, 0x0d, 0x00, 0x00, 0x00, 0xe8, 0xcb, 0xff, 0xff,
0xff, 0x89, 0xd8, 0x5b, 0xc9, 0xeb, 0xc5, 0x55, 0x89, 0xe5, 0x57, 0x56, 0x53, 0x83, 0xec, 0x44,
0x8d, 0x45, 0x0c, 0x8b, 0x75, 0x08, 0x89, 0x45, 0xc0, 0x80, 0x3e, 0x00, 0x0f, 0x84, 0x5b, 0x01,
0x00, 0x00, 0x8a, 0x06, 0x3c, 0x25, 0x74, 0x0d, 0x0f, 0xbe, 0xc0, 0xe8, 0xbc, 0xff, 0xff, 0xff,
0xe9, 0x42, 0x01, 0x00, 0x00, 0x46, 0x8a, 0x06, 0x3c, 0x73, 0x75, 0x1d, 0x8b, 0x45, 0xc0, 0x8b,
0x18, 0x83, 0x45, 0xc0, 0x04, 0x80, 0x3b, 0x00, 0x0f, 0x84, 0x29, 0x01, 0x00, 0x00, 0x0f, 0xbe,
0x03, 0xe8, 0x96, 0xff, 0xff, 0xff, 0x43, 0xeb, 0xec, 0x3c, 0x4c, 0x8d, 0x7d, 0xc4, 0xc7, 0x45,
0xbc, 0x1c, 0x00, 0x00, 0x00, 0x75, 0x09, 0xc7, 0x45, 0xbc, 0x3c, 0x00, 0x00, 0x00, 0xeb, 0x1c,
0x3c, 0x6c, 0x74, 0x18, 0x3c, 0x68, 0x75, 0x15, 0xc7, 0x45, 0xbc, 0x0c, 0x00, 0x00, 0x00, 0x46,
0x80, 0x3e, 0x68, 0x75, 0x08, 0xc7, 0x45, 0xbc, 0x04, 0x00, 0x00, 0x00, 0x46, 0x8a, 0x16, 0x88,
0xd0, 0x83, 0xc8, 0x20, 0x3c, 0x78, 0x75, 0x61, 0x83, 0x7d, 0xbc, 0x1c, 0x7e, 0x0e, 0x8b, 0x45,
0xc0, 0x8b, 0x08, 0x83, 0x45, 0xc0, 0x08, 0x8b, 0x58, 0x04, 0xeb, 0x0b, 0x8b, 0x45, 0xc0, 0x8b,
0x08, 0x83, 0x45, 0xc0, 0x04, 0x31, 0xdb, 0x89, 0x5d, 0xb4, 0x89, 0xd3, 0x83, 0xe3, 0x20, 0x89,
0x4d, 0xb0, 0x89, 0x5d, 0xb8, 0x83, 0x7d, 0xbc, 0x00, 0x0f, 0x88, 0x96, 0x00, 0x00, 0x00, 0x8a,
0x4d, 0xbc, 0x8b, 0x55, 0xb4, 0x8b, 0x45, 0xb0, 0x0f, 0xad, 0xd0, 0xd3, 0xea, 0x80, 0xe1, 0x20,
0x74, 0x02, 0x89, 0xd0, 0x83, 0xe0, 0x0f, 0x8a, 0x5d, 0xb8, 0x0a, 0x98, 0x48, 0x0f, 0x01, 0x00,
0x88, 0x1f, 0x47, 0x83, 0x6d, 0xbc, 0x04, 0xeb, 0xd0, 0x80, 0xfa, 0x64, 0x75, 0x4e, 0x83, 0x7d,
0xbc, 0x1c, 0x7e, 0x09, 0x8b, 0x45, 0xc0, 0x83, 0x45, 0xc0, 0x08, 0xeb, 0x07, 0x8b, 0x45, 0xc0,
0x83, 0x45, 0xc0, 0x04, 0x8b, 0x10, 0x85, 0xd2, 0x79, 0x06, 0xc6, 0x07, 0x2d, 0xf7, 0xda, 0x47,
0x89, 0xfb, 0x89, 0xd0, 0x99, 0xb9, 0x0a, 0x00, 0x00, 0x00, 0xf7, 0xf9, 0x83, 0xc2, 0x30, 0x88,
0x17, 0x47, 0x85, 0xc0, 0x89, 0xc2, 0x75, 0xea, 0x8d, 0x4f, 0xff, 0x39, 0xd9, 0x76, 0x26, 0x0f,
0xbe, 0x11, 0x8a, 0x03, 0x88, 0x01, 0x88, 0x13, 0x49, 0x43, 0xeb, 0xef, 0x80, 0xfa, 0x63, 0x8d,
0x4f, 0x01, 0x75, 0x0d, 0x8b, 0x45, 0xc0, 0x8b, 0x00, 0x83, 0x45, 0xc0, 0x04, 0x88, 0x07, 0xeb,
0x02, 0x88, 0x17, 0x89, 0xcf, 0x8d, 0x5d, 0xc4, 0x39, 0xfb, 0x73, 0x0b, 0x0f, 0xbe, 0x03, 0xe8,
0x78, 0xfe, 0xff, 0xff, 0x43, 0xeb, 0xf1, 0x46, 0xe9, 0x9c, 0xfe, 0xff, 0xff, 0x83, 0xc4, 0x44,
0x5b, 0x5e, 0x5f, 0xc9, 0xc3, 0x55, 0x89, 0xe5, 0x8b, 0x55, 0x08, 0x8b, 0x4d, 0x0c, 0x31, 0xc0,
0xeb, 0x07, 0x80, 0x3a, 0x00, 0x74, 0x06, 0x40, 0x42, 0x39, 0xc8, 0x72, 0xf5, 0xc9, 0xc3, 0x55,
0x89, 0xe5, 0x8b, 0x45, 0x08, 0x53, 0x8b, 0x4d, 0x10, 0x8b, 0x5d, 0x0c, 0x31, 0xd2, 0x39, 0xca,
0x73, 0x06, 0x88, 0x1c, 0x10, 0x42, 0xeb, 0xf6, 0x5b, 0xc9, 0xc3, 0x55, 0x89, 0xe5, 0x56, 0x53,
0x8b, 0x4d, 0x08, 0x8b, 0x75, 0x0c, 0x8b, 0x5d, 0x10, 0x31, 0xd2, 0x39, 0xda, 0x73, 0x09, 0x8a,
0x04, 0x16, 0x88, 0x04, 0x11, 0x42, 0xeb, 0xf3, 0x5b, 0x89, 0xc8, 0x5e, 0xc9, 0xc3, 0x55, 0x89,
0xe5, 0x57, 0x56, 0x53, 0x8b, 0x7d, 0x08, 0x8b, 0x75, 0x0c, 0x8b, 0x5d, 0x10, 0x31, 0xd2, 0x39,
0xda, 0x73, 0x15, 0x8a, 0x0f, 0x8a, 0x06, 0x38, 0xc1, 0x74, 0x0a, 0x0f, 0xb6, 0xd0, 0x0f, 0xb6,
0xc1, 0x29, 0xc2, 0xeb, 0x05, 0x42, 0xeb, 0xe7, 0x31, 0xd2, 0x5b, 0x5e, 0x89, 0xd0, 0x5f, 0xc9,
0xc3, 0x55, 0x89, 0xe5, 0x56, 0x53, 0x89, 0xd3, 0x51, 0x31, 0xc9, 0x31, 0xd2, 0x89, 0xc6, 0x39,
0xd9, 0x73, 0x26, 0xf6, 0xc2, 0x01, 0x0f, 0xb6, 0x04, 0x16, 0x74, 0x03, 0xc1, 0xe0, 0x08, 0x01,
0xc1, 0x81, 0xf9, 0xff, 0xff, 0x00, 0x00, 0x76, 0x0b, 0x89, 0xc8, 0xc1, 0xe8, 0x10, 0x8d, 0x04,
0x01, 0x0f, 0xb7, 0xc8, 0x42, 0x39, 0xda, 0xeb, 0xd8, 0x88, 0x4d, 0xf6, 0xc1, 0xe9, 0x08, 0x88,
0x4d, 0xf7, 0x66, 0x8b, 0x45, 0xf6, 0x5a, 0x5b, 0xf7, 0xd0, 0x0f, 0xb7, 0xc0, 0x5e, 0xc9, 0xc3,
0x55, 0x89, 0xe5, 0x57, 0x56, 0x53, 0x8b, 0x5d, 0x08, 0x68, 0x00, 0x01, 0x00, 0x00, 0x8d, 0x83,
0x00, 0x08, 0x00, 0x00, 0x50, 0x8b, 0x7d, 0x10, 0xe8, 0x08, 0xff, 0xff, 0xff, 0x01, 0xc3, 0x5e,
0xb8, 0xff, 0x00, 0x00, 0x00, 0x5a, 0xc6, 0x83, 0x00, 0x08, 0x00, 0x00, 0x20, 0x81, 0xc3, 0x01,
0x08, 0x00, 0x00, 0x39, 0xf8, 0x7e, 0x02, 0x89, 0xf8, 0x50, 0xff, 0x75, 0x0c, 0xe8, 0xe3, 0xfe,
0xff, 0xff, 0x50, 0xff, 0x75, 0x0c, 0x89, 0xc6, 0x53, 0xe8, 0x0d, 0xff, 0xff, 0xff, 0xc6, 0x04,
0x33, 0x00, 0x8d, 0x65, 0xf4, 0x5b, 0x5e, 0x5f, 0xc9, 0xc3, 0x55, 0x81, 0xfa, 0xff, 0xff, 0x3f,
0x00, 0x89, 0xe5, 0x89, 0xd1, 0x53, 0x89, 0xc3, 0x76, 0x05, 0xb9, 0xff, 0xff, 0x3f, 0x00, 0x8b,
0x83, 0xe0, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x00, 0x39, 0xc1, 0x76, 0x24, 0x8d, 0x91,
0x00, 0xfc, 0xff, 0xff, 0x8d, 0x81, 0x00, 0xfc, 0xff, 0xff, 0x81, 0xfa, 0xff, 0xff, 0x00, 0x00,
0x89, 0x93, 0xe0, 0x01, 0x00, 0x00, 0x66, 0x89, 0x43, 0x02, 0x76, 0x06, 0x66, 0xc7, 0x43, 0x02,
0x00, 0xfc, 0x5b, 0xc9, 0xc3, 0x55, 0x89, 0xe5, 0x56, 0x53, 0x83, 0xec, 0x10, 0x89, 0xc1, 0x8b,
0x55, 0x0c, 0x8b, 0x45, 0x08, 0x8b, 0x5d, 0x10, 0x8b, 0x75, 0x14, 0x89, 0x55, 0xf4, 0x89, 0x45,
0xf0, 0x89, 0x5d, 0xe8, 0x89, 0x75, 0xec, 0x0f, 0xb6, 0x81, 0xe8, 0x01, 0x00, 0x00, 0x83, 0xf8,
0x1f, 0x8b, 0x55, 0x18, 0x7f, 0x35, 0x6b, 0xc0, 0x14, 0x01, 0xc8, 0x8b, 0x5d, 0xf0, 0x8b, 0x75,
0xf4, 0x89, 0x98, 0xd0, 0x02, 0x00, 0x00, 0x89, 0xb0, 0xd4, 0x02, 0x00, 0x00, 0x8b, 0x5d, 0xe8,
0x8b, 0x75, 0xec, 0x89, 0x98, 0xd8, 0x02, 0x00, 0x00, 0x89, 0xb0, 0xdc, 0x02, 0x00, 0x00, 0x89,
0x90, 0xe0, 0x02, 0x00, 0x00, 0xfe, 0x81, 0xe8, 0x01, 0x00, 0x00, 0x4a, 0x75, 0x2e, 0x8b, 0x45,
0xf0, 0x03, 0x45, 0xe8, 0x8b, 0x55, 0xf4, 0x13, 0x55, 0xec, 0x81, 0xfa, 0xff, 0x03, 0x00, 0x00,
0x72, 0x07, 0x76, 0x05, 0x83, 0xca, 0xff, 0xeb, 0x06, 0x0f, 0xac, 0xd0, 0x0a, 0x89, 0xc2, 0x83,
0xc4, 0x10, 0x5b, 0x5e, 0x89, 0xc8, 0xc9, 0xe9, 0x1e, 0xff, 0xff, 0xff, 0x83, 0xc4, 0x10, 0x5b,
0x5e, 0xc9, 0xc3, 0x55, 0x89, 0xe5, 0x8b, 0x45, 0x0c, 0x8b, 0x55, 0x10, 0x89, 0x45, 0x10, 0x8b,
0x45, 0x08, 0x8b, 0x40, 0x10, 0x89, 0x55, 0x0c, 0x89, 0x45, 0x08, 0xc9, 0xe9, 0x9f, 0xfe, 0xff,
0xff, 0x55, 0x89, 0xe5, 0x57, 0x56, 0x53, 0x39, 0xd0, 0x56, 0x56, 0x89, 0xc7, 0x89, 0x55, 0xf0,
0x73, 0x77, 0x8d, 0x58, 0x18, 0x81, 0x7b, 0xe8, 0x4c, 0x42, 0x49, 0x4f, 0x75, 0x60, 0x83, 0x7b,
0xec, 0x18, 0x75, 0x5a, 0xba, 0x18, 0x00, 0x00, 0x00, 0x89, 0xf8, 0xe8, 0x21, 0xfe, 0xff, 0xff,
0x85, 0xc0, 0x75, 0x4a, 0x8b, 0x53, 0xf4, 0x89, 0xd8, 0xe8, 0x13, 0xfe, 0xff, 0xff, 0x3b, 0x43,
0xf8, 0x75, 0x3b, 0x89, 0xde, 0x03, 0x73, 0xf4, 0x39, 0xf3, 0xc7, 0x45, 0xec, 0x00, 0x00, 0x00,
0x00, 0x89, 0xd9, 0x73, 0x1d, 0x89, 0xf0, 0x29, 0xd8, 0x8b, 0x53, 0x04, 0x39, 0xc2, 0x77, 0x12,
0x01, 0xd1, 0xff, 0x45, 0xec, 0x39, 0xf1, 0x73, 0x09, 0x89, 0xf0, 0x29, 0xc8, 0x8b, 0x51, 0x04,
0xeb, 0xea, 0x8b, 0x45, 0xec, 0x3b, 0x43, 0xfc, 0x75, 0x04, 0x89, 0xf8, 0xeb, 0x0d, 0x83, 0xc7,
0x10, 0x83, 0xc3, 0x10, 0x3b, 0x7d, 0xf0, 0x72, 0x8c, 0x31, 0xc0, 0x59, 0x5b, 0x5b, 0x5e, 0x5f,
0xc9, 0xc3, 0x55, 0x89, 0xe5, 0xba, 0x00, 0x10, 0x00, 0x00, 0x53, 0x89, 0xc3, 0x31, 0xc0, 0xe8,
0x5d, 0xff, 0xff, 0xff, 0x85, 0xc0, 0x75, 0x15, 0xba, 0x00, 0x00, 0x10, 0x00, 0xb8, 0x00, 0x00,
0x0f, 0x00, 0xe8, 0x4a, 0xff, 0xff, 0xff, 0x31, 0xd2, 0x85, 0xc0, 0x74, 0x0f, 0xc7, 0x43, 0x24,
0x01, 0x00, 0x00, 0x00, 0x89, 0x43, 0x28, 0xba, 0x01, 0x00, 0x00, 0x00, 0x89, 0xd0, 0x5b, 0xc9,
0xc3, 0x55, 0x89, 0xe5, 0x56, 0x53, 0x68, 0x00, 0x10, 0x00, 0x00, 0x8b, 0x75, 0x08, 0x6a, 0x00,
0xff, 0x76, 0x10, 0xe8, 0xf7, 0xfc, 0xff, 0xff, 0x8b, 0x46, 0x10, 0xc6, 0x00, 0x00, 0x8b, 0x46,
0x10, 0xc6, 0x40, 0x01, 0x19, 0x8b, 0x46, 0x10, 0xc6, 0x40, 0x06, 0x00, 0x66, 0xc7, 0x40, 0x04,
0x00, 0x00, 0x8b, 0x46, 0x10, 0xc6, 0x40, 0x07, 0x50, 0x8b, 0x46, 0x10, 0xc6, 0x40, 0x0e, 0x19,
0x8b, 0x46, 0x10, 0xc6, 0x40, 0x0f, 0x01, 0x66, 0xc7, 0x40, 0x0a, 0x00, 0x00, 0x8b, 0x46, 0x10,
0xc6, 0x80, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x66, 0xc7, 0x40, 0x10, 0x10, 0x00, 0x66, 0xc7, 0x40,
0x02, 0x00, 0x00, 0x8b, 0x46, 0x10, 0x8d, 0x90, 0x00, 0x08, 0x00, 0x00, 0x89, 0x90, 0x28, 0x02,
0x00, 0x00, 0x66, 0xc7, 0x40, 0x20, 0x3f, 0xa3, 0x66, 0xc7, 0x40, 0x22, 0x00, 0x08, 0x68, 0xff,
0x00, 0x00, 0x00, 0x8b, 0x46, 0x0c, 0x83, 0xc0, 0x1c, 0x50, 0xe8, 0x66, 0xfc, 0xff, 0xff, 0x50,
0x89, 0xc3, 0x8b, 0x46, 0x0c, 0x83, 0xc0, 0x1c, 0x50, 0x8b, 0x46, 0x10, 0x05, 0x00, 0x08, 0x00,
0x00, 0x50, 0xe8, 0x84, 0xfc, 0xff, 0xff, 0x83, 0xc4, 0x20, 0x8b, 0x46, 0x10, 0xc6, 0x84, 0x03,
0x00, 0x08, 0x00, 0x00, 0x00, 0x6a, 0x40, 0x6a, 0x00, 0x8b, 0x46, 0x10, 0x83, 0xc0, 0x40, 0x50,
0xe8, 0x4a, 0xfc, 0xff, 0xff, 0x6a, 0x20, 0x6a, 0x00, 0x8b, 0x46, 0x10, 0x83, 0xe8, 0x80, 0x50,
0xe8, 0x3a, 0xfc, 0xff, 0xff, 0x8b, 0x46, 0x10, 0x8b, 0x4e, 0x0c, 0x66, 0xc7, 0x80, 0xa0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x66, 0xc7, 0x40, 0x02, 0x00, 0x00, 0x66, 0xc7, 0x80, 0xf2, 0x01, 0x00,
0x00, 0xff, 0xff, 0x66, 0x8b, 0x51, 0x0c, 0x66, 0x89, 0x90, 0xf8, 0x01, 0x00, 0x00, 0x66, 0x8b,
0x51, 0x0e, 0x66, 0x89, 0x90, 0xfc, 0x01, 0x00, 0x00, 0xc7, 0x80, 0xe0, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xc6, 0x80, 0xff, 0x01, 0x00, 0x00, 0x00, 0x6a, 0x04, 0x68, 0x59, 0x0f, 0x01,
0x00, 0x8b, 0x46, 0x10, 0x05, 0x02, 0x02, 0x00, 0x00, 0x50, 0xe8, 0xfc, 0xfb, 0xff, 0xff, 0x8b,
0x46, 0x10, 0xc6, 0x80, 0x10, 0x02, 0x00, 0x00, 0x50, 0x66, 0xc7, 0x80, 0x06, 0x02, 0x00, 0x00,
0x01, 0x02, 0x8b, 0x46, 0x10, 0xc6, 0x80, 0x11, 0x02, 0x00, 0x00, 0x00, 0x8b, 0x4e, 0x10, 0xc7,
0x81, 0x18, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x81, 0x1c, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x8b, 0x56, 0x0c, 0x83, 0xc4, 0x24, 0x83, 0x7a, 0x18, 0x00, 0x74, 0x12, 0x8b,
0x42, 0x14, 0x89, 0x81, 0x18, 0x02, 0x00, 0x00, 0x8b, 0x42, 0x18, 0x89, 0x81, 0x1c, 0x02, 0x00,
0x00, 0xc7, 0x46, 0x2c, 0x01, 0x00, 0x00, 0x00, 0x8d, 0x65, 0xf8, 0x5b, 0x5e, 0xc9, 0xc3, 0x55,
0x89, 0xe5, 0x57, 0x56, 0x53, 0x83, 0xec, 0x60, 0xa1, 0x90, 0x10, 0x01, 0x00, 0x89, 0x45, 0xd4,
0x8b, 0x45, 0x08, 0x89, 0x45, 0xc4, 0x8b, 0x45, 0x0c, 0x89, 0x45, 0xc8, 0x8b, 0x45, 0x10, 0x89,
0x45, 0xcc, 0x8b, 0x45, 0x14, 0x89, 0x45, 0xd0, 0x8d, 0x45, 0xc4, 0x50, 0xe8, 0x40, 0xfe, 0xff,
0xff, 0x58, 0x8b, 0x45, 0xc4, 0x31, 0xdb, 0x31, 0xf6, 0x3d, 0x02, 0xb0, 0xad, 0x2b, 0x75, 0x0b,
0xb3, 0x01, 0xc7, 0x45, 0xd8, 0x01, 0x00, 0x00, 0x00, 0xeb, 0x2e, 0x3d, 0x07, 0xb0, 0x11, 0x0a,
0x75, 0x27, 0x8b, 0x45, 0xc8, 0x8b, 0x10, 0xe8, 0x95, 0xfb, 0xff, 0xff, 0x85, 0xc0, 0x75, 0x0e,
0xbb, 0x01, 0x00, 0x00, 0x00, 0xc7, 0x45, 0xdc, 0x01, 0x00, 0x00, 0x00, 0xeb, 0x0b, 0x68, 0x5e,
0x0f, 0x01, 0x00, 0xe8, 0x6f, 0xf9, 0xff, 0xff, 0x5f, 0x81, 0x7d, 0xc4, 0x07, 0xb0, 0x1f, 0x0e,
0x75, 0x03, 0x8b, 0x75, 0xc8, 0x8b, 0x45, 0xcc, 0x85, 0xc0, 0x74, 0x0a, 0x81, 0x38, 0x07, 0xb0,
0x1f, 0x0e, 0x75, 0x02, 0x89, 0xc6, 0x85, 0xdb, 0x0f, 0x85, 0x11, 0x01, 0x00, 0x00, 0x85, 0xf6,
0x0f, 0x84, 0xd1, 0x00, 0x00, 0x00, 0x66, 0x83, 0x7e, 0x08, 0x00, 0xc7, 0x45, 0xc0, 0x00, 0x00,
0x00, 0x00, 0x74, 0x0d, 0x8b, 0x56, 0x04, 0x89, 0xf0, 0xe8, 0x33, 0xfb, 0xff, 0xff, 0x89, 0x45,
0xc0, 0x89, 0xf3, 0x31, 0xff, 0x8d, 0x4e, 0x0c, 0x03, 0x5e, 0x04, 0x39, 0xd9, 0x73, 0x21, 0x8b,
0x01, 0x83, 0xc0, 0x03, 0x83, 0xe0, 0xfc, 0x8d, 0x54, 0x01, 0x0c, 0x8b, 0x41, 0x04, 0x83, 0xc0,
0x03, 0x83, 0xe0, 0xfc, 0x8d, 0x04, 0x02, 0x39, 0xd8, 0x77, 0x05, 0x47, 0x89, 0xc1, 0xeb, 0xdb,
0x81, 0x3e, 0x07, 0xb0, 0x1f, 0x0e, 0x75, 0x1d, 0x83, 0x7d, 0xc0, 0x00, 0x75, 0x17, 0x0f, 0xb7,
0x46, 0x0a, 0x39, 0xf8, 0x75, 0x0f, 0xc7, 0x45, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x89, 0x75, 0xcc,
0xe9, 0x9a, 0x00, 0x00, 0x00, 0x68, 0x81, 0x0f, 0x01, 0x00, 0xe8, 0xc8, 0xf8, 0xff, 0xff, 0x59,
0xff, 0x75, 0xc0, 0x68, 0x9b, 0x0f, 0x01, 0x00, 0xe8, 0xba, 0xf8, 0xff, 0xff, 0x58, 0x5a, 0x57,
0x68, 0xad, 0x0f, 0x01, 0x00, 0xe8, 0xad, 0xf8, 0xff, 0xff, 0x5f, 0x58, 0x56, 0x68, 0xbf, 0x0f,
0x01, 0x00, 0xe8, 0xa0, 0xf8, 0xff, 0xff, 0x59, 0x5b, 0xff, 0x76, 0x04, 0x68, 0xd1, 0x0f, 0x01,
0x00, 0xe8, 0x91, 0xf8, 0xff, 0xff, 0x58, 0x5a, 0xff, 0x36, 0x68, 0xe3, 0x0f, 0x01, 0x00, 0xe8,
0x83, 0xf8, 0xff, 0xff, 0x5f, 0x58, 0x0f, 0xb7, 0x46, 0x0a, 0x50, 0x68, 0xf5, 0x0f, 0x01, 0x00,
0xe8, 0x72, 0xf8, 0xff, 0xff, 0x5b, 0x5e, 0x68, 0x07, 0x10, 0x01, 0x00, 0xe8, 0x66, 0xf8, 0xff,
0xff, 0x59, 0xff, 0x75, 0xc4, 0x68, 0x22, 0x10, 0x01, 0x00, 0xe8, 0x58, 0xf8, 0xff, 0xff, 0x58,
0x5a, 0xff, 0x75, 0xc8, 0x68, 0x2b, 0x10, 0x01, 0x00, 0xe8, 0x49, 0xf8, 0xff, 0xff, 0x5e, 0x5f,
0xff, 0x75, 0xcc, 0x68, 0x34, 0x10, 0x01, 0x00, 0xe8, 0x3a, 0xf8, 0xff, 0xff, 0x59, 0x5b, 0x31,
0xc0, 0x83, 0x7d, 0xe0, 0x00, 0xc7, 0x45, 0xe4, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x45, 0xe8, 0x00,
0x00, 0x00, 0x00, 0x0f, 0x84, 0x22, 0x01, 0x00, 0x00, 0x8b, 0x45, 0xcc, 0x89, 0xc6, 0xc7, 0x45,
0xb8, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x45, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x58, 0x0c, 0x03,
0x70, 0x04, 0x39, 0xf3, 0x73, 0x41, 0x8b, 0x0b, 0x8d, 0x51, 0x03, 0x8b, 0x43, 0x04, 0x83, 0xe2,
0xfc, 0x83, 0xc0, 0x03, 0x8d, 0x7b, 0x0c, 0x83, 0xe0, 0xfc, 0x8d, 0x14, 0x17, 0x8d, 0x04, 0x02,
0x39, 0xf0, 0x89, 0x45, 0xb4, 0x77, 0x20, 0x83, 0x7b, 0x08, 0x01, 0x75, 0x15, 0x85, 0xc9, 0x75,
0x11, 0x6a, 0x00, 0x6a, 0x00, 0x57, 0xe8, 0xa3, 0xf9, 0xff, 0xff, 0x83, 0xc4, 0x0c, 0x85, 0xc0,
0x74, 0x09, 0x8b, 0x5d, 0xb4, 0xeb, 0xbb, 0x31, 0xdb, 0xeb, 0x04, 0x85, 0xdb, 0x75, 0x09, 0xc7,
0x45, 0xb8, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x0e, 0x8b, 0x03, 0x83, 0xc0, 0x03, 0x83, 0xe0, 0xfc,
0x8d, 0x04, 0x07, 0x89, 0x45, 0xbc, 0x85, 0xdb, 0x0f, 0x84, 0x9a, 0x00, 0x00, 0x00, 0x83, 0x7b,
0x04, 0x07, 0x75, 0x1f, 0x6a, 0x07, 0x68, 0x74, 0x10, 0x01, 0x00, 0xff, 0x75, 0xbc, 0xe8, 0x5b,
0xf9, 0xff, 0xff, 0x83, 0xc4, 0x0c, 0x85, 0xc0, 0x75, 0x09, 0xc7, 0x45, 0xe4, 0x01, 0x00, 0x00,
0x00, 0xeb, 0x59, 0x85, 0xdb, 0x74, 0x71, 0x83, 0x7b, 0x04, 0x0a, 0x75, 0x25, 0x6a, 0x0a, 0x68,
0x69, 0x10, 0x01, 0x00, 0xff, 0x75, 0xbc, 0xe8, 0x32, 0xf9, 0xff, 0xff, 0x83, 0xc4, 0x0c, 0x85,
0xc0, 0x75, 0x0f, 0x8d, 0x45, 0xc4, 0xe8, 0x97, 0xfb, 0xff, 0xff, 0x85, 0xc0, 0x89, 0x45, 0xb8,
0x75, 0x46, 0x85, 0xdb, 0x74, 0x42, 0x83, 0x7b, 0x04, 0x00, 0x74, 0x20, 0x85, 0xdb, 0x74, 0x38,
0x83, 0x7b, 0x04, 0x01, 0x75, 0x1f, 0x6a, 0x01, 0x68, 0x9a, 0x0f, 0x01, 0x00, 0xff, 0x75, 0xbc,
0xe8, 0xf9, 0xf8, 0xff, 0xff, 0x83, 0xc4, 0x0c, 0x85, 0xc0, 0x75, 0x09, 0xc7, 0x45, 0xb8, 0x01,
0x00, 0x00, 0x00, 0xeb, 0x13, 0x85, 0xdb, 0x74, 0x0f, 0xff, 0x75, 0xbc, 0x68, 0x3e, 0x10, 0x01,
0x00, 0xe8, 0x01, 0xf7, 0xff, 0xff, 0x58, 0x5a, 0x8b, 0x45, 0xb8, 0x85, 0xc0, 0x75, 0x13, 0x8d,
0x45, 0xc4, 0xe8, 0x3b, 0xfb, 0xff, 0xff, 0x85, 0xc0, 0x75, 0x07, 0xc7, 0x45, 0xe4, 0x01, 0x00,
0x00, 0x00, 0x68, 0x59, 0x10, 0x01, 0x00, 0xe8, 0xdb, 0xf6, 0xff, 0xff, 0x83, 0x7d, 0xe8, 0x00,
0x5f, 0x74, 0x0b, 0x68, 0x68, 0x10, 0x01, 0x00, 0xe8, 0xca, 0xf6, 0xff, 0xff, 0x5e, 0x83, 0x7d,
0xe4, 0x00, 0x74, 0x0b, 0x68, 0x73, 0x10, 0x01, 0x00, 0xe8, 0xb9, 0xf6, 0xff, 0xff, 0x5b, 0x68,
0x99, 0x0f, 0x01, 0x00, 0xe8, 0xae, 0xf6, 0xff, 0xff, 0x83, 0x7d, 0xe8, 0x00, 0x59, 0x0f, 0x84,
0x84, 0x00, 0x00, 0x00, 0x8b, 0x45, 0xec, 0x8d, 0x50, 0x18, 0x8b, 0x40, 0x0c, 0x01, 0xd0, 0x39,
0xc2, 0x89, 0x45, 0xb0, 0x89, 0xd3, 0x73, 0x70, 0x29, 0xd8, 0x8b, 0x53, 0x04, 0x39, 0xc2, 0x77,
0x67, 0x83, 0x3b, 0x01, 0x75, 0x55, 0x8d, 0x42, 0xf8, 0xba, 0x14, 0x00, 0x00, 0x00, 0x89, 0xd1,
0x31, 0xd2, 0xf7, 0xf1, 0x31, 0xff, 0x39, 0xc7, 0x89, 0x45, 0xac, 0x7d, 0x37, 0x31, 0xf6, 0x31,
0xd2, 0x83, 0x7c, 0x1e, 0x18, 0x01, 0x0f, 0x95, 0xc2, 0x42, 0x52, 0xff, 0x74, 0x1e, 0x14, 0xff,
0x74, 0x1e, 0x10, 0xff, 0x74, 0x1e, 0x0c, 0xff, 0x74, 0x1e, 0x08, 0x8b, 0x45, 0xd4, 0x47, 0xe8,
0x41, 0xf9, 0xff, 0xff, 0x83, 0xc6, 0x14, 0x83, 0xc4, 0x14, 0x3b, 0x7d, 0xac, 0x7d, 0x05, 0x83,
0xff, 0x1f, 0x7e, 0xcb, 0xc7, 0x45, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x03, 0x5b, 0x04, 0x3b, 0x5d,
0xb0, 0x73, 0x05, 0x8b, 0x45, 0xb0, 0xeb, 0x90, 0x83, 0x7d, 0xe4, 0x00, 0x0f, 0x84, 0x94, 0x00,
0x00, 0x00, 0x6a, 0x20, 0x68, 0xc4, 0x51, 0x01, 0x00, 0xe8, 0xee, 0xf3, 0xff, 0xff, 0x31, 0xf6,
0x5f, 0x39, 0xc6, 0x5a, 0xa3, 0xc0, 0x51, 0x01, 0x00, 0x7d, 0x47, 0x31, 0xdb, 0x83, 0xbb, 0xd4,
0x51, 0x01, 0x00, 0x01, 0x75, 0x07, 0xc7, 0x45, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xff, 0xb3, 0xd4,
0x51, 0x01, 0x00, 0xff, 0xb3, 0xd0, 0x51, 0x01, 0x00, 0xff, 0xb3, 0xcc, 0x51, 0x01, 0x00, 0xff,
0xb3, 0xc8, 0x51, 0x01, 0x00, 0xff, 0xb3, 0xc4, 0x51, 0x01, 0x00, 0x8b, 0x45, 0xd4, 0x46, 0xe8,
0xc1, 0xf8, 0xff, 0xff, 0x83, 0xc3, 0x14, 0x83, 0xc4, 0x14, 0x3b, 0x35, 0xc0, 0x51, 0x01, 0x00,
0x7c, 0xbb, 0x8b, 0x5d, 0xd4, 0xe8, 0xeb, 0xf3, 0xff, 0xff, 0x89, 0x83, 0xe0, 0x01, 0x00, 0x00,
0x8b, 0x5d, 0xd4, 0xe8, 0x26, 0xf4, 0xff, 0xff, 0x66, 0x89, 0x43, 0x02, 0x8b, 0x45, 0xd4, 0x83,
0xb8, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x75, 0x07, 0x66, 0x83, 0x78, 0x02, 0x00, 0x74, 0x07, 0xc7,
0x45, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x83, 0x7d, 0xd8, 0x00, 0x0f, 0x84, 0x8a, 0x00, 0x00, 0x00,
0x83, 0x7d, 0xf0, 0x00, 0x8b, 0x75, 0xc8, 0x74, 0x16, 0xf6, 0x06, 0x01, 0x74, 0x11, 0x8b, 0x56,
0x08, 0x81, 0xc2, 0x00, 0x04, 0x00, 0x00, 0x8b, 0x45, 0xd4, 0xe8, 0x0b, 0xf8, 0xff, 0xff, 0xf6,
0x06, 0x04, 0x74, 0x10, 0x6a, 0xff, 0xff, 0x76, 0x10, 0xff, 0x75, 0xd4, 0xe8, 0x9f, 0xf7, 0xff,
0xff, 0x83, 0xc4, 0x0c, 0x83, 0x7d, 0xf0, 0x00, 0x74, 0x3b, 0xf6, 0x06, 0x40, 0x74, 0x36, 0x8b,
0x5e, 0x30, 0x8b, 0x45, 0xd4, 0x89, 0xdf, 0x8b, 0x4b, 0xfc, 0x89, 0x45, 0xa8, 0x03, 0x7e, 0x2c,
0x89, 0x4d, 0xa4, 0x39, 0xfb, 0x73, 0x1e, 0xff, 0x73, 0x10, 0xff, 0x73, 0x0c, 0xff, 0x73, 0x08,
0xff, 0x73, 0x04, 0xff, 0x33, 0x8b, 0x45, 0xa8, 0xe8, 0x08, 0xf8, 0xff, 0xff, 0x83, 0xc4, 0x14,
0x03, 0x5d, 0xa4, 0xeb, 0xde, 0xf6, 0x06, 0x41, 0x0f, 0x84, 0x51, 0x01, 0x00, 0x00, 0xc7, 0x45,
0xf0, 0x00, 0x00, 0x00, 0x00, 0xe9, 0x45, 0x01, 0x00, 0x00, 0x83, 0x7d, 0xdc, 0x00, 0x0f, 0x84,
0xc9, 0x00, 0x00, 0x00, 0x8b, 0x5d, 0xc8, 0x8b, 0x43, 0x0c, 0x85, 0xc0, 0x74, 0x0f, 0x50, 0xff,
0x73, 0x08, 0xff, 0x75, 0xd4, 0xe8, 0x26, 0xf7, 0xff, 0xff, 0x83, 0xc4, 0x0c, 0x8b, 0x7b, 0x14,
0x8b, 0x73, 0x10, 0x85, 0xff, 0x0f, 0x84, 0x14, 0x01, 0x00, 0x00, 0x83, 0x3e, 0x01, 0x0f, 0x85,
0x8d, 0x00, 0x00, 0x00, 0x83, 0x7d, 0xf0, 0x00, 0x0f, 0x84, 0x83, 0x00, 0x00, 0x00, 0x8b, 0x45,
0xd4, 0xba, 0x14, 0x00, 0x00, 0x00, 0x89, 0x45, 0xa0, 0x8b, 0x46, 0x04, 0x83, 0xe8, 0x08, 0x89,
0xd1, 0x31, 0xd2, 0xf7, 0xf1, 0xc7, 0x45, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x39, 0x45, 0x9c, 0x89,
0x45, 0x98, 0x7d, 0x56, 0x31, 0xdb, 0x8b, 0x44, 0x33, 0x18, 0x83, 0xf8, 0x03, 0xba, 0x03, 0x00,
0x00, 0x00, 0x74, 0x16, 0x77, 0x05, 0xb2, 0x01, 0x48, 0xeb, 0x08, 0xba, 0x04, 0x00, 0x00, 0x00,
0x83, 0xf8, 0x04, 0x74, 0x05, 0xba, 0x02, 0x00, 0x00, 0x00, 0x52, 0xff, 0x74, 0x33, 0x14, 0xff,
0x74, 0x33, 0x10, 0xff, 0x74, 0x33, 0x0c, 0xff, 0x74, 0x33, 0x08, 0x8b, 0x45, 0xa0, 0xe8, 0x42,
0xf7, 0xff, 0xff, 0xff, 0x45, 0x9c, 0x8b, 0x45, 0x98, 0x83, 0xc4, 0x14, 0x83, 0xc3, 0x14, 0x39,
0x45, 0x9c, 0x7d, 0x06, 0x83, 0x7d, 0x9c, 0x1f, 0x7e, 0xac, 0xc7, 0x45, 0xf0, 0x00, 0x00, 0x00,
0x00, 0x8b, 0x46, 0x04, 0x01, 0xc6, 0x29, 0xc7, 0xe9, 0x58, 0xff, 0xff, 0xff, 0x83, 0x7d, 0xe0,
0x00, 0x74, 0x6c, 0x8b, 0x45, 0xcc, 0x89, 0xc6, 0x8d, 0x58, 0x0c, 0x03, 0x70, 0x04, 0x39, 0xf3,
0x73, 0x5d, 0x8b, 0x13, 0x8d, 0x42, 0x03, 0x83, 0xe0, 0xfc, 0x8d, 0x4b, 0x0c, 0x8d, 0x3c, 0x01,
0x8b, 0x43, 0x04, 0x83, 0xc0, 0x03, 0x83, 0xe0, 0xfc, 0x8d, 0x04, 0x07, 0x39, 0xf0, 0x89, 0x45,
0x94, 0x77, 0x3c, 0xa1, 0x84, 0x10, 0x01, 0x00, 0x39, 0x43, 0x08, 0x75, 0x2d, 0x3b, 0x15, 0x7c,
0x10, 0x01, 0x00, 0x75, 0x25, 0x52, 0xff, 0x35, 0x80, 0x10, 0x01, 0x00, 0x51, 0xe8, 0x9c, 0xf5,
0xff, 0xff, 0x83, 0xc4, 0x0c, 0x85, 0xc0, 0x75, 0x11, 0x57, 0xff, 0x73, 0x04, 0x8d, 0x4d, 0xc4,
0x51, 0xff, 0x15, 0x88, 0x10, 0x01, 0x00, 0x83, 0xc4, 0x0c, 0x8b, 0x5d, 0x94, 0xeb, 0x9f, 0xb0,
0x80, 0xe6, 0x70, 0x31, 0xc0, 0xe6, 0xf0, 0xe6, 0xf1, 0xb0, 0x11, 0xe6, 0x20, 0xe6, 0xa0, 0xb0,
0x20, 0xe6, 0x21, 0xb0, 0x28, 0xe6, 0xa1, 0xb0, 0x04, 0xe6, 0x21, 0xb0, 0x02, 0xe6, 0xa1, 0xb0,
0x01, 0xe6, 0x21, 0xe6, 0xa1, 0xb0, 0xff, 0xe6, 0xa1, 0xb0, 0xfb, 0xe6, 0x21, 0x8b, 0x45, 0xd4,
0x8d, 0x65, 0xf4, 0x5b, 0x5e, 0x5f, 0xc9, 0xc3, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x00, 0x48, 0x64, 0x72, 0x53, 0x00, 0x42, 0x61,
0x64, 0x20, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x62, 0x6f, 0x6f, 0x74, 0x20, 0x68,
0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x21, 0x0a,
0x00, 0x42, 0x61, 0x64, 0x20, 0x45, 0x4c, 0x46, 0x20, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74,
0x65, 0x72, 0x20, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x21, 0x0a, 0x00, 0x20, 0x20, 0x20, 0x63, 0x68,
0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x20, 0x3d, 0x20, 0x25, 0x78, 0x0a, 0x00, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x25, 0x78, 0x0a, 0x00, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x64, 0x72, 0x20, 0x3d, 0x20, 0x25, 0x78, 0x0a,
0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x3d, 0x20, 0x25,
0x78, 0x0a, 0x00, 0x62, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x20, 0x3d,
0x20, 0x25, 0x78, 0x0a, 0x00, 0x20, 0x20, 0x62, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73,
0x20, 0x3d, 0x20, 0x25, 0x78, 0x0a, 0x00, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x20, 0x62,
0x6f, 0x6f, 0x74, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x21,
0x0a, 0x00, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x25, 0x78, 0x0a, 0x00, 0x64, 0x61, 0x74, 0x61, 0x3d,
0x25, 0x78, 0x0a, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x3d, 0x25, 0x78, 0x0a, 0x00, 0x55, 0x6e,
0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x20, 0x66, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x20, 0x74,
0x79, 0x70, 0x65, 0x3a, 0x20, 0x25, 0x73, 0x0a, 0x00, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72,
0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x00, 0x20, 0x4c, 0x69, 0x6e, 0x75, 0x78, 0x42, 0x49,
0x4f, 0x53, 0x00, 0x20, 0x50, 0x43, 0x42, 0x49, 0x4f, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x9a, 0x0f, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x53, 0x06, 0x01, 0x00, 0xc0, 0x51, 0x01, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa5, 0xa5, 0xa5, 0xa5, 0x70, 0x00, 0x00, 0x00, 0xa8, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x4f, 0x4f, 0x54,
0x5f, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x3d, 0x68, 0x65, 0x61, 0x64, 0x2e, 0x53, 0x20, 0x63, 0x6f,
0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x3d, 0x74, 0x74, 0x79, 0x53, 0x30, 0x20, 0x69, 0x70, 0x3d, 0x64,
0x68, 0x63, 0x70, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x3d, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x66,
0x73, 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,
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, 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,

View File

@ -0,0 +1,29 @@
/* Hard coded locations */
#define CONVERTLOC 0x10000
#define REAL_MODE_DATA_LOC 0x20000
#define GDTLOC 0x21000
#define DEFAULT_ROOT_DEV ((0x3<<8)| 0)
#define CMDLINE_MAX 256
#ifdef ASSEMBLY
#define CONVERT_MAGIC 0xA5A5A5A5
#else
#define CONVERT_MAGIC 0xA5A5A5A5UL
#endif
#ifndef ASSEMBLY
struct image_parameters {
uint32_t convert_magic; /* a signature to verify mkelfImage was built properly */
uint32_t gdt_size;
uint32_t bss_size;
uint16_t ramdisk_flags;
uint16_t root_dev;
uint32_t entry;
uint32_t initrd_start;
uint32_t initrd_size;
uint8_t cmdline[CMDLINE_MAX];
};
#endif

View File

@ -0,0 +1,36 @@
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(startup_32)
SECTIONS
{
. = 0x10000;
_text = .; /* Text and read-only data */
.text . : {
*(.text)
*(.text.*)
} = 0x9090
.rodata (.): {
*(.rodata)
*(.rodata.*)
}
_etext = .; /* End of text section */
.data (.): { /* Data */
*(.data)
*(.data.*)
*(.trailer)
}
_edata = .; /* End of data section */
_bss = .; /* BSS */
.bss (.): {
*(.bss)
}
_end = . ;
bss_size = _end - _bss;
/DISCARD/ : {
*(.comment)
*(.note)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,476 @@
/*
* exec_kernel/user_space/head.S
*
* Copyright (C) 2000, 2002, 2003 Eric Biederman
*
* Parts of this code were take from the linux startup
* code of linux-2.4.0-test9
*
* Other parts were taken from etherboot-5.0.5
*/
#define ASSEMBLY 1
#define RELOC 0x10000
#define PROT_CODE_SEG 0x10
#define PROT_DATA_SEG 0x18
#define REAL_CODE_SEG 0x08
#define REAL_DATA_SEG 0x20
.equ CR0_PE,1
.text
.code32
#include "convert.h"
.globl startup_32
startup_32:
cld
cli
# Save the arguments safely out of the way
movl %eax, boot_type
movl %ebx, boot_data
cmp $0,%esp
jz 1f
movl 4(%esp), %eax
movl %eax, boot_param
1:
movl stack_start, %esp
# Clear eflags
pushl $0
popfl
# Clear BSS
xorl %eax,%eax
movl $ _edata,%edi
movl $ _end,%ecx
subl %edi,%ecx
cld
rep
stosb
# Move the gdt where Linux will not smash it during decompression
movl $gdt, %esi
movl $GDTLOC, %edi
movl $(gdt_end - gdt), %ecx
rep movsb
# Linux makes stupid assumptions about the segments
# that are already setup, so setup a new gdt & ldt
# and then reload the segment registers.
lgdt gdt_48
lidt idt_48
# Load the data segment registers
movl $ PROT_DATA_SEG, %eax
movl %eax, %ds
movl %eax, %es
movl %eax, %fs
movl %eax, %gs
movl %eax, %ss
pushl $image_params # image build time parameters as forth arg
pushl boot_param # boot_param pointer as third arg
pushl boot_data # boot data pointer as second arg
pushl boot_type # boot data type as first argument
call convert_params
movl %eax, %esi # put the real mode pointer in a safe place
addl $16, %esp # pop the arguments
# Setup the registers before jumping to linux
# clear eflags
pushl $0
popfl
# Flag to indicate we are the bootstrap processor
xorl %ebx, %ebx
# Clear the unspecified registers for good measure
xorl %eax, %eax
xorl %ecx, %ecx
xorl %edx, %edx
xorl %edi, %edi
xorl %esp, %esp
xorl %ebp, %ebp
# Jump to the linux kernel
ljmp $ PROT_CODE_SEG , $ 0x100000
/* Routines to query the BIOS... */
/**************************************************************************
E820_MEMSIZE - Get a listing of memory regions
**************************************************************************/
#define SMAP 0x534d4150
.globl meme820
meme820:
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %esi
pushl %edi
movl 8(%ebp), %edi /* Address to return e820 structures at */
subl $RELOC, %edi
movl 12(%ebp), %esi /* Maximum number of e820 structurs to return */
pushl %esi
call _prot_to_real
.code16
xorl %ebx, %ebx
jmpe820:
movl $0xe820, %eax
movl $SMAP, %edx
movl $20, %ecx
/* %di was setup earlier */
int $0x15
jc bail820
cmpl $SMAP, %eax
jne bail820
good820:
/* If this is useable memory, we save it by simply advancing %di by
* sizeof(e820rec)
*/
decl %esi
testl %esi,%esi
jz bail820
addw $20, %di
again820:
cmpl $0, %ebx /* check to see if %ebx is set to EOF */
jne jmpe820
bail820:
data32 call _real_to_prot
.code32
popl %eax
subl %esi, %eax /* Compute how many structure we read */
/* Restore everything else */
popl %edi
popl %esi
popl %ebx
movl %ebp, %esp
popl %ebp
ret
/**************************************************************************
MEME801 - Determine size of extended memory
**************************************************************************/
.globl meme801
meme801:
pushl %ebx
pushl %esi
pushl %edi
call _prot_to_real
.code16
stc # fix to work around buggy
xorw %cx,%cx # BIOSes which dont clear/set
xorw %dx,%dx # carry on pass/error of
# e801h memory size call
# or merely pass cx,dx though
# without changing them.
movw $0xe801,%ax
int $0x15
jc e801absent
cmpw $0x0, %cx # Kludge to handle BIOSes
jne e801usecxdx # which report their extended
cmpw $0x0, %dx # memory in AX/BX rather than
jne e801usecxdx # CX/DX. The spec I have read
movw %ax, %cx # seems to indicate AX/BX
movw %bx, %dx # are more reasonable anyway...
e801usecxdx:
andl $0xffff, %edx # clear sign extend
shll $6, %edx # and go from 64k to 1k chunks
movl %edx, %eax # store extended memory size
andl $0xffff, %ecx # clear sign extend
addl %ecx, %eax # and add lower memory into
jmp e801out
e801absent:
xorl %eax,%eax
e801out:
data32 call _real_to_prot
.code32
/* Restore Everything */
popl %edi
popl %esi
popl %ebx
ret
/**************************************************************************
MEM88 - Determine size of extended memory
**************************************************************************/
.globl mem88
mem88:
pushl %ebx
pushl %esi
pushl %edi
call _prot_to_real
.code16
movb $0x88, %ah
int $0x15
andl $0xffff, %eax
data32 call _real_to_prot
.code32
/* Restore Everything */
popl %edi
popl %esi
popl %ebx
ret
/**************************************************************************
BASEMEMSIZE - Get size of the conventional (base) memory
**************************************************************************/
.globl basememsize
basememsize:
call _prot_to_real
.code16
int $0x12
movw %ax,%cx
DATA32 call _real_to_prot
.code32
movw %cx,%ax
ret
/**************************************************************************
_REAL_TO_PROT - Go from REAL mode to Protected Mode
**************************************************************************/
.globl _real_to_prot
_real_to_prot:
.code16
cli
cs
addr32 lgdt gdt_48 - RELOC
movl %cr0,%eax
orl $CR0_PE,%eax
movl %eax,%cr0 /* turn on protected mode */
/* flush prefetch queue, and reload %cs:%eip */
data32 ljmp $PROT_CODE_SEG,$1f
1:
.code32
/* reload other segment registers */
movl $PROT_DATA_SEG,%eax
movl %eax,%ds
movl %eax,%es
movl %eax,%ss
addl $RELOC,%esp /* Fix up stack pointer */
xorl %eax,%eax
movl %eax,%fs
movl %eax,%gs
popl %eax /* Fix up return address */
addl $RELOC,%eax
pushl %eax
/* switch to protected mode idt */
cs
lidt idt_48
ret
/**************************************************************************
_PROT_TO_REAL - Go from Protected Mode to REAL Mode
**************************************************************************/
.globl _prot_to_real
_prot_to_real:
.code32
popl %eax
subl $RELOC,%eax /* Adjust return address */
pushl %eax
subl $RELOC,%esp /* Adjust stack pointer */
ljmp $REAL_CODE_SEG,$1f- RELOC /* jump to a 16 bit segment */
1:
.code16
/* clear the PE bit of CR0 */
movl %cr0,%eax
andl $0!CR0_PE,%eax
movl %eax,%cr0
/* make intersegment jmp to flush the processor pipeline
* and reload %cs:%eip (to clear upper 16 bits of %eip).
*/
data32 ljmp $(RELOC)>>4,$2f- RELOC
2:
/* we are in real mode now
* set up the real mode segment registers : %ds, $ss, %es
*/
movw %cs,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%ss
movw %ax,%fs
movw %ax,%gs
/* Switch to the real mode idt */
cs
addr32 lidt idt_real - RELOC
sti
data32 ret /* There is a 32 bit return address on the stack */
.code32
boot_type: .long 0
boot_data: .long 0
boot_param: .long 0
idt_real:
.word 0x400 # idt limit = 256
.word 0, 0
idt_48:
.word 0 # idt limit = 0
.word 0, 0 # idt base = 0L
gdt_48:
.word gdt_end - gdt - 1 # gdt limit=40,
# (5 GDT entries)
.long GDTLOC # gdt base
# Descriptor tables
# These need to be in a seperate section so I can be
# certain later activities dont stomp them
gdt:
/* 0x00 */
.word 0, 0, 0, 0 # dummy
/* 0x08 */
/* 16 bit real mode code segment */
.word 0xffff,(RELOC&0xffff)
.byte (RELOC>>16),0x9b,0x00,(RELOC>>24)
/* 0x10 */
.word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb)
.word 0 # base address = 0
.word 0x9A00 # code read/exec
.word 0x00CF # granularity = 4096, 386
# (+5th nibble of limit)
/* 0x18 */
.word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb)
.word 0 # base address = 0
.word 0x9200 # data read/write
.word 0x00CF # granularity = 4096, 386
# (+5th nibble of limit)
/* 0x20 */
/* 16 bit real mode data segment */
.word 0xffff,(RELOC&0xffff)
.byte (RELOC>>16),0x93,0x00,(RELOC>>24)
/* For 2.5.x the kernel segments have moved */
/* 0x28 dummy */
.quad 0
/* 0x30 dummy */
.quad 0
/* 0x38 dummy */
.quad 0
/* 0x40 dummy */
.quad 0
/* 0x48 dummy */
.quad 0
/* 0x50 dummy */
.quad 0
/* 0x58 dummy */
.quad 0
/* 0x60 */
.word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb)
.word 0 # base address = 0
.word 0x9A00 # code read/exec
.word 0x00CF # granularity = 4096, 386
# (+5th nibble of limit)
/* 0x68 */
.word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb)
.word 0 # base address = 0
.word 0x9200 # data read/write
.word 0x00CF # granularity = 4096, 386
# (+5th nibble of limit)
/*
* The layout of the per-CPU GDT under Linux:
*
* 0 - null
* 1 - reserved
* 2 - reserved
* 3 - reserved
*
* 4 - default user CS <==== new cacheline
* 5 - default user DS
*
* ------- start of TLS (Thread-Local Storage) segments:
*
* 6 - TLS segment #1 [ glibc's TLS segment ]
* 7 - TLS segment #2 [ Wine's %fs Win32 segment ]
* 8 - TLS segment #3
* 9 - reserved
* 10 - reserved
* 11 - reserved
*
* ------- start of kernel segments:
*
* 12 - kernel code segment <==== new cacheline
* 13 - kernel data segment
* 14 - TSS
* 15 - LDT
* 16 - PNPBIOS support (16->32 gate)
* 17 - PNPBIOS support
* 18 - PNPBIOS support
* 19 - PNPBIOS support
* 20 - PNPBIOS support
* 21 - APM BIOS support
* 22 - APM BIOS support
* 23 - APM BIOS support
*/
gdt_end:
.section ".trailer", "a"
/* Constants set at build time, these are at the very end of my image */
.balign 16
.global image_params
image_params:
convert_magic:
.long CONVERT_MAGIC
gdt_size:
.long gdt_end - gdt
bss_size:
.long bss_size
ramdisk_flags:
.word 0
root_dev:
.word DEFAULT_ROOT_DEV
entry:
.long 0
initrd_start:
.long 0
initrd_size:
.long 0
cmdline:
.asciz "BOOT_IMAGE=head.S console=ttyS0 ip=dhcp root=/dev/nfs"
.org cmdline + CMDLINE_MAX, 0
cmdline_end:

View File

@ -0,0 +1,388 @@
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#define _GNU_SOURCE
#include <getopt.h>
#include "elf.h"
#include "elf_boot.h"
#include "convert.h"
#include "x86-linux.h"
#include "mkelfImage.h"
static unsigned char payload[] = {
#include "convert.bin.c"
};
struct kernel_info;
static void (*parse_kernel_type)(struct kernel_info *info, char *kernel_buf, size_t kernel_size);
static void parse_bzImage_kernel(struct kernel_info *info, char *kernel_buf, size_t kernel_size);
static void parse_elf32_kernel(struct kernel_info *info, char *kernel_buf, size_t kernel_size);
char *vmlinux_i386_probe(char *kernel_buf, off_t kernel_size)
{
Elf32_Ehdr *ehdr;
Elf32_Phdr *phdr;
int i;
int hdr1, hdr2;
ehdr = (Elf32_Ehdr *)kernel_buf;
if (
(ehdr->e_ident[EI_MAG0] != ELFMAG0) ||
(ehdr->e_ident[EI_MAG1] != ELFMAG1) ||
(ehdr->e_ident[EI_MAG2] != ELFMAG2) ||
(ehdr->e_ident[EI_MAG3] != ELFMAG3)) {
return "No ELF signature found on kernel\n";
}
if (ehdr->e_ident[EI_CLASS] != ELFCLASS32) {
return "Not a 32bit ELF kernel\n";
}
if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) {
return "Not a little endian ELF kernel\n";
}
if (le16_to_cpu(ehdr->e_type) != ET_EXEC) {
return "Not an executable kernel\n";
}
if (le16_to_cpu(ehdr->e_machine) != EM_386) {
return "Not an i386 kernel\n";
}
if ( (ehdr->e_ident[EI_VERSION] != EV_CURRENT) ||
(le32_to_cpu(ehdr->e_version) != EV_CURRENT)) {
return "Kernel not using ELF version 1.\n";
}
if (le16_to_cpu(ehdr->e_phentsize) != sizeof(*phdr)) {
return "Kernel uses bad program header size.\n";
}
phdr = (Elf32_Phdr *)(kernel_buf + le32_to_cpu(ehdr->e_phoff));
hdr1 = hdr2 = -1;
for(i = 0; i < le32_to_cpu(ehdr->e_phnum); i++) {
if (le32_to_cpu(phdr[i].p_type) != PT_LOAD)
continue;
if (((hdr1 != -1) &&
((le32_to_cpu(phdr[hdr1].p_paddr) & 0xfffffff) != 0x100000)) ||
(hdr2 != -1)) {
return "Too many PT_LOAD segments to be a linux kernel\n";
}
if (hdr1 == -1) {
hdr1 = i;
} else {
hdr2 = i;
}
}
if (hdr1 == -1) {
return "No PT_LOAD segments!\n";
}
parse_kernel_type = parse_elf32_kernel;
return 0;
}
char *bzImage_i386_probe(char *kernel_buf, off_t kernel_size)
{
struct x86_linux_header *hdr;
unsigned long offset;
int setup_sects;
hdr = (struct x86_linux_header *)kernel_buf;
if (le16_to_cpu(hdr->boot_sector_magic) != 0xaa55) {
return "No bootsector magic";
}
if (memcmp(hdr->header_magic, "HdrS", 4) != 0) {
return "Not a linux kernel";
}
if (le16_to_cpu(hdr->protocol_version) < 0x202) {
return "Kernel protcols version before 2.02 not supported";
}
setup_sects = hdr->setup_sects;
if (setup_sects == 0) {
setup_sects = 4;
}
offset = 512 + (512 *setup_sects);
if (offset > kernel_size) {
return "Not enough bytes";
}
parse_kernel_type = parse_bzImage_kernel;
return 0;
}
char *linux_i386_probe(char *kernel_buf, off_t kernel_size)
{
char *result;
result = "";
if (result) result = bzImage_i386_probe(kernel_buf, kernel_size);
if (result) result = vmlinux_i386_probe(kernel_buf, kernel_size);
if (result) result = bzImage_i386_probe(kernel_buf, kernel_size);
return result;
}
struct kernel_info
{
void *kernel;
size_t filesz;
size_t memsz;
size_t paddr;
size_t vaddr;
void *kernel2;
size_t filesz2;
size_t memsz2;
size_t paddr2;
size_t vaddr2;
size_t entry;
char *version;
};
static void parse_elf32_kernel(struct kernel_info *info, char *kernel_buf, size_t kernel_size)
{
Elf32_Ehdr *ehdr;
Elf32_Phdr *phdr;
int i;
int hdr1, hdr2;
ehdr = (Elf32_Ehdr *)kernel_buf;
phdr = (Elf32_Phdr *)(kernel_buf + ehdr->e_phoff);
hdr1 = hdr2 = -1;
for(i = 0; i < le16_to_cpu(ehdr->e_phnum); i++) {
if (le32_to_cpu(phdr[i].p_type) != PT_LOAD)
continue;
if (hdr2 != -1) {
die("Too many PT_LOAD segments to be a linux kernel\n");
}
if (hdr1 == -1) {
hdr1 = i;
} else {
hdr2 = i;
}
}
if (hdr1 == -1) {
die("No PT_LOAD segments!\n");
}
info->kernel = kernel_buf + le32_to_cpu(phdr[hdr1].p_offset);
info->filesz = le32_to_cpu(phdr[hdr1].p_filesz);
info->memsz = le32_to_cpu(phdr[hdr1].p_memsz);
info->paddr = le32_to_cpu(phdr[hdr1].p_paddr) & 0xfffffff;
info->vaddr = le32_to_cpu(phdr[hdr1].p_vaddr);
if (hdr2 != -1) {
info->kernel2 = kernel_buf + le32_to_cpu(phdr[hdr2].p_offset);
info->filesz2 = le32_to_cpu(phdr[hdr2].p_filesz);
info->memsz2 = le32_to_cpu(phdr[hdr2].p_memsz);
info->paddr2 = le32_to_cpu(phdr[hdr2].p_paddr) & 0xfffffff;
info->vaddr2 = le32_to_cpu(phdr[hdr2].p_vaddr);
}
info->entry = 0x100000;
info->version = "unknown";
}
static void parse_bzImage_kernel(struct kernel_info *info, char *kernel_buf, size_t kernel_size)
{
struct x86_linux_header *hdr;
unsigned long offset;
int setup_sects;
hdr = (struct x86_linux_header *)kernel_buf;
setup_sects = hdr->setup_sects;
if (setup_sects == 0) {
setup_sects = 4;
}
offset = 512 + (512 *setup_sects);
info->kernel = kernel_buf + offset;
info->filesz = kernel_size - offset;
info->memsz = 0x700000;
info->paddr = 0x100000;
info->vaddr = 0x100000;
info->entry = info->paddr;
info->version = kernel_buf + 512 + le16_to_cpu(hdr->kver_addr);
}
static void parse_kernel(struct kernel_info *info, char *kernel_buf, size_t kernel_size)
{
memset(info, 0, sizeof(*info));
if (parse_kernel_type) {
parse_kernel_type(info, kernel_buf, kernel_size);
}
else {
die("Unknown kernel format");
}
}
void linux_i386_usage(void)
{
printf(
" --command-line=<string> Set the command line to <string>\n"
" --append=<string> Set the command line to <string>\n"
" --initrd=<filename> Set the initrd to <filename>\n"
" --ramdisk=<filename> Set the initrd to <filename>\n"
" --ramdisk-base=<addr> Set the initrd load address to <addr>\n"
);
return;
}
#define OPT_CMDLINE OPT_MAX+0
#define OPT_RAMDISK OPT_MAX+1
#define OPT_RAMDISK_BASE OPT_MAX+2
#define DEFAULT_RAMDISK_BASE (8*1024*1024)
int linux_i386_mkelf(int argc, char **argv,
struct memelfheader *ehdr, char *kernel_buf, off_t kernel_size)
{
const char *ramdisk, *cmdline;
unsigned long ramdisk_base;
char *payload_buf, *ramdisk_buf;
off_t payload_size, ramdisk_size;
struct memelfphdr *phdr;
struct memelfnote *note;
struct kernel_info kinfo;
struct image_parameters *params;
int index;
int opt;
static const struct option options[] = {
MKELF_OPTIONS
{ "command-line", 1, 0, OPT_CMDLINE },
{ "append", 1, 0, OPT_CMDLINE },
{ "initrd", 1, 0, OPT_RAMDISK },
{ "ramdisk", 1, 0, OPT_RAMDISK },
{ "ramdisk-base", 1, 0, OPT_RAMDISK_BASE },
{ 0 , 0, 0, 0 },
};
static const char short_options[] = MKELF_OPT_STR;
ramdisk_base = DEFAULT_RAMDISK_BASE;
ramdisk = 0;
cmdline="";
while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
switch(opt) {
case '?':
error("Unknown option %s\n", argv[optind]);
break;
case OPT_RAMDISK_BASE:
{
char *end;
unsigned long base;
base = strtoul(optarg, &end, 0);
if ((end == optarg) || (*end != '\0')) {
error("Invalid ramdisk base\n");
}
ramdisk_base = base;
}
case OPT_RAMDISK:
ramdisk = optarg;
break;
case OPT_CMDLINE:
cmdline = optarg;
break;
default:
break;
}
}
ehdr->ei_class = ELFCLASS32;
ehdr->ei_data = ELFDATA2LSB;
ehdr->e_type = ET_EXEC;
ehdr->e_machine = EM_386;
/* locate the payload buffer */
payload_buf = payload;
payload_size = sizeof(payload);
/* slurp the input files */
ramdisk_buf = slurp_file(ramdisk, &ramdisk_size);
/* parse the kernel */
parse_kernel(&kinfo, kernel_buf, kernel_size);
/* Find the parameters */
params = (void *)(payload_buf + (payload_size - sizeof(*params)));
/* A sanity check against bad versions of binutils */
if (params->convert_magic != CONVERT_MAGIC) {
die("Internal error convert_magic %08x != %08x\n",
params->convert_magic, CONVERT_MAGIC);
}
/* Copy the command line */
strncpy(params->cmdline, cmdline, sizeof(params->cmdline));
params->cmdline[sizeof(params->cmdline)-1]= '\0';
/* Add a program header for the note section */
index = 4;
index += kinfo.kernel2 ? 1:0;
index += ramdisk_size ? 1:0;
phdr = add_program_headers(ehdr, index);
/* Fill in the program headers*/
phdr[0].p_type = PT_NOTE;
/* Fill in the converter program headers */
phdr[1].p_paddr = CONVERTLOC;
phdr[1].p_vaddr = CONVERTLOC;
phdr[1].p_filesz = payload_size;
phdr[1].p_memsz = payload_size + params->bss_size;
phdr[1].p_data = payload;
/* Reserve space for the REAL MODE DATA segment AND the GDT segment */
phdr[2].p_paddr = REAL_MODE_DATA_LOC;
phdr[2].p_vaddr = REAL_MODE_DATA_LOC;
phdr[2].p_filesz = 0;
phdr[2].p_memsz = (GDTLOC - REAL_MODE_DATA_LOC) + params->gdt_size;
phdr[2].p_data = 0;
phdr[3].p_paddr = kinfo.paddr;
phdr[3].p_vaddr = kinfo.vaddr;
phdr[3].p_filesz = kinfo.filesz;
phdr[3].p_memsz = kinfo.memsz;
phdr[3].p_data = kinfo.kernel;
index = 4;
/* Put the second kernel frament if present */
if (kinfo.kernel2) {
phdr[index].p_paddr = kinfo.paddr2;
phdr[index].p_vaddr = kinfo.vaddr2;
phdr[index].p_filesz = kinfo.filesz2;
phdr[index].p_memsz = kinfo.memsz2;
phdr[index].p_data = kinfo.kernel2;
index++;
}
/* Put the ramdisk at ramdisk base.
*/
params->initrd_start = params->initrd_size = 0;
if (ramdisk_size) {
phdr[index].p_paddr = ramdisk_base;
phdr[index].p_vaddr = ramdisk_base;
phdr[index].p_filesz = ramdisk_size;
phdr[index].p_memsz = ramdisk_size;
phdr[index].p_data = ramdisk_buf;
params->initrd_start = phdr[index].p_paddr;
params->initrd_size = phdr[index].p_filesz;
index++;
}
/* Set the start location */
params->entry = kinfo.entry;
ehdr->e_entry = phdr[1].p_paddr;
/* Setup the elf notes */
note = add_notes(ehdr, 3);
note[0].n_type = EIN_PROGRAM_NAME;
note[0].n_name = "ELFBoot";
note[0].n_desc = "Linux";
note[0].n_descsz = strlen(note[0].n_desc)+1;
note[1].n_type = EIN_PROGRAM_VERSION;
note[1].n_name = "ELFBoot";
note[1].n_desc = kinfo.version;
note[1].n_descsz = strlen(note[1].n_desc);
note[2].n_type = EIN_PROGRAM_CHECKSUM;
note[2].n_name = "ELFBoot";
note[2].n_desc = 0;
note[2].n_descsz = 2;
return 0;
}

View File

@ -0,0 +1,67 @@
#ifndef _LINUX_UNIFORM_BOOT_H
#define _LINUX_UNIFORM_BOOT_H
/* The uniform boot environment information is restricted to
* hardware information. In particular for a simple enough machine
* all of the environment information should be able to reside in
* a rom and not need to be moved. This information is the
* information a trivial boot room can pass to linux to let it
* run the hardware.
*
* Also all of the information should be Position Independent Data.
* That is it should be safe to relocated any of the information
* without it's meaning/correctnes changing. The exception is the
* uniform_boot_header with it's two pointers arg & env.
*
* The addresses in the arg & env pointers must be physical
* addresses. A physical address is an address you put in the page
* table.
*
* The Command line is for user policy. Things like the default
* root device.
*
*/
struct uniform_boot_header
{
unsigned long header_bytes;
unsigned long header_checksum;
unsigned long arg;
unsigned long arg_bytes;
unsigned long env;
unsigned long env_bytes;
};
/* Every entry in the boot enviroment list will correspond to a boot
* info record. Encoding both type and size. The type is obviously
* so you can tell what it is. The size allows you to skip that
* boot enviroment record if you don't know what it easy. This allows
* forward compatibility with records not yet defined.
*/
struct ube_record {
unsigned long tag; /* tag ID */
unsigned long size; /* size of record (in bytes) */
unsigned long data[0]; /* data */
};
#define UBE_TAG_MEMORY 0x0001
struct ube_memory_range {
unsigned long long start;
unsigned long long size;
unsigned long type;
#define UBE_MEM_RAM 1
#define UBE_MEM_RESERVED 2
#define UBE_MEM_ACPI 3
#define UBE_MEM_NVS 4
};
struct ube_memory {
unsigned long tag;
unsigned long size;
struct ube_memory_range map[0];
};
#endif /* _LINUX_UNIFORM_BOOT_H */

View File

@ -0,0 +1,162 @@
#ifndef X86_LINUX_H
#define X86_LINUX_H
#define E820MAP 0x2d0 /* our map */
#define E820MAX 32 /* number of entries in E820MAP */
#define E820NR 0x1e8 /* # entries in E820MAP */
#ifndef ASSEMBLY
struct e820entry {
uint64_t addr; /* start of memory segment */
uint64_t size; /* size of memory segment */
uint32_t type; /* type of memory segment */
#define E820_RAM 1
#define E820_RESERVED 2
#define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */
#define E820_NVS 4
} __attribute__((packed));
/* FIXME expand on drive_info_struct... */
struct drive_info_struct {
uint8_t dummy[32];
};
struct sys_desc_table {
uint16_t length;
uint8_t table[318];
};
struct apm_bios_info {
uint16_t version; /* 0x40 */
uint16_t cseg; /* 0x42 */
uint32_t offset; /* 0x44 */
uint16_t cseg_16; /* 0x48 */
uint16_t dseg; /* 0x4a */
uint16_t flags; /* 0x4c */
uint16_t cseg_len; /* 0x4e */
uint16_t cseg_16_len; /* 0x50 */
uint16_t dseg_len; /* 0x52 */
uint8_t reserved[44]; /* 0x54 */
};
struct x86_linux_param_header {
uint8_t orig_x; /* 0x00 */
uint8_t orig_y; /* 0x01 */
uint16_t ext_mem_k; /* 0x02 -- EXT_MEM_K sits here */
uint16_t orig_video_page; /* 0x04 */
uint8_t orig_video_mode; /* 0x06 */
uint8_t orig_video_cols; /* 0x07 */
uint16_t unused2; /* 0x08 */
uint16_t orig_video_ega_bx; /* 0x0a */
uint16_t unused3; /* 0x0c */
uint8_t orig_video_lines; /* 0x0e */
uint8_t orig_video_isVGA; /* 0x0f */
uint16_t orig_video_points; /* 0x10 */
/* VESA graphic mode -- linear frame buffer */
uint16_t lfb_width; /* 0x12 */
uint16_t lfb_height; /* 0x14 */
uint16_t lfb_depth; /* 0x16 */
uint32_t lfb_base; /* 0x18 */
uint32_t lfb_size; /* 0x1c */
uint16_t cl_magic; /* 0x20 */
#define CL_MAGIC_VALUE 0xA33F
uint16_t cl_offset; /* 0x22 */
uint16_t lfb_linelength; /* 0x24 */
uint8_t red_size; /* 0x26 */
uint8_t red_pos; /* 0x27 */
uint8_t green_size; /* 0x28 */
uint8_t green_pos; /* 0x29 */
uint8_t blue_size; /* 0x2a */
uint8_t blue_pos; /* 0x2b */
uint8_t rsvd_size; /* 0x2c */
uint8_t rsvd_pos; /* 0x2d */
uint16_t vesapm_seg; /* 0x2e */
uint16_t vesapm_off; /* 0x30 */
uint16_t pages; /* 0x32 */
uint8_t reserved4[12]; /* 0x34 -- 0x3f reserved for future expansion */
struct apm_bios_info apm_bios_info; /* 0x40 */
struct drive_info_struct drive_info; /* 0x80 */
struct sys_desc_table sys_desc_table; /* 0xa0 */
uint32_t alt_mem_k; /* 0x1e0 */
uint8_t reserved5[4]; /* 0x1e4 */
uint8_t e820_map_nr; /* 0x1e8 */
uint8_t reserved6[8]; /* 0x1e9 */
uint8_t setup_sects; /* 0x1f1 */
uint16_t mount_root_rdonly; /* 0x1f2 */
uint8_t reserved7[4]; /* 0x1f4 */
uint16_t ramdisk_flags; /* 0x1f8 */
#define RAMDISK_IMAGE_START_MASK 0x07FF
#define RAMDISK_PROMPT_FLAG 0x8000
#define RAMDISK_LOAD_FLAG 0x4000
uint16_t vid_mode; /* 0x1fa */
uint16_t root_dev; /* 0x1fc */
uint8_t reserved9[1]; /* 0x1fe */
uint8_t aux_device_info; /* 0x1ff */
/* 2.00+ */
uint8_t reserved10[2]; /* 0x200 */
uint8_t header_magic[4]; /* 0x202 */
uint16_t protocol_version; /* 0x206 */
uint8_t reserved11[8]; /* 0x208 */
uint8_t loader_type; /* 0x210 */
#define LOADER_TYPE_LOADLIN 1
#define LOADER_TYPE_BOOTSECT_LOADER 2
#define LOADER_TYPE_SYSLINUX 3
#define LOADER_TYPE_ETHERBOOT 4
#define LOADER_TYPE_UNKNOWN 0xFF
uint8_t loader_flags; /* 0x211 */
uint8_t reserved12[2]; /* 0x212 */
uint32_t kernel_start; /* 0x214 */
uint32_t initrd_start; /* 0x218 */
uint32_t initrd_size; /* 0x21c */
uint8_t reserved13[4]; /* 0x220 */
/* 2.01+ */
uint16_t heap_end_ptr; /* 0x224 */
uint8_t reserved14[2]; /* 0x226 */
/* 2.02+ */
uint32_t cmd_line_ptr; /* 0x228 */
/* 2.03+ */
uint32_t initrd_addr_max; /* 0x22c */
uint8_t reserved15[160]; /* 0x230 */
struct e820entry e820_map[E820MAX]; /* 0x2d0 */
/* 0x550 */
#define COMMAND_LINE_SIZE 256
};
struct x86_linux_header {
uint8_t reserved1[0x1f1]; /* 0x000 */
uint8_t setup_sects; /* 0x1f1 */
uint16_t root_flags; /* 0x1f2 */
uint8_t reserved2[6]; /* 0x1f4 */
uint16_t vid_mode; /* 0x1fa */
uint16_t root_dev; /* 0x1fc */
uint16_t boot_sector_magic; /* 0x1fe */
/* 2.00+ */
uint8_t reserved3[2]; /* 0x200 */
uint8_t header_magic[4]; /* 0x202 */
uint16_t protocol_version; /* 0x206 */
uint32_t realmode_swtch; /* 0x208 */
uint16_t start_sys; /* 0x20c */
uint16_t kver_addr; /* 0x20e */
uint8_t type_of_loader; /* 0x210 */
uint8_t loadflags; /* 0x211 */
uint16_t setup_move_size; /* 0x212 */
uint32_t code32_start; /* 0x214 */
uint32_t ramdisk_image; /* 0x218 */
uint32_t ramdisk_size; /* 0x21c */
uint8_t reserved4[4]; /* 0x220 */
/* 2.01+ */
uint16_t heap_end_ptr; /* 0x224 */
uint8_t reserved5[2]; /* 0x226 */
/* 2.02+ */
uint32_t cmd_line_ptr; /* 0x228 */
/* 2.03+ */
uint32_t initrd_addr_max; /* 0x22c */
uint8_t tail[32*1024]; /* 0x230 */
} __attribute__ ((packed));
#endif /* ASSEMBLY */
#endif /* X86_LINUX_H */

View File

@ -0,0 +1,33 @@
LIA64_DIR=linux-ia64
LIA64_OBJ=$(OBJDIR)/$(LIA64_DIR)
LIA64_DEP=Makefile Makefile.conf $(LIA64_DIR)/Makefile
$(LIA64_OBJ)/mkelf-linux-ia64.o: $(LIA64_DIR)/mkelf-linux-ia64.c $(LIA64_DIR)/convert.bin.c $(LIA64_DEP)
$(MKDIR) -p $(@D)
$(HOST_CC) $(HOST_CFLAGS) -c -g $< -o $@
ifdef IA64_CC
$(LIA64_DIR)/convert.bin.c: $(LIA64_OBJ)/convert.bin $(OBJDIR)/bin/bin-to-hex $(LIA64_DEP)
$(MKDIR) -p $(@D)
$(OBJDIR)/bin/bin-to-hex < $(LIA64_OBJ)/convert.bin > $@
$(LIA64_OBJ)/convert.bin: $(LIA64_OBJ)/convert $(LIA64_DEP)
$(MKDIR) -p $(@D)
$(IA64_OBJCOPY) -O binary $< $@
CONVERT_LIA64_OBJS=$(LIA64_OBJ)/head.o $(LIA64_OBJ)/convert_params.o
$(LIA64_OBJ)/convert: $(LIA64_DIR)/convert.lds $(CONVERT_LIA64_OBJS) $(LIA64_DEP)
$(MKDIR) -p $(@D)
$(IA64_LD) $(IA64_LDFLAGS) -T $(LIA64_DIR)/convert.lds -o $@ $(CONVERT_LIA64_OBJS)
$(LIA64_OBJ)/head.o: $(LIA64_DIR)/head.S $(LIA64_DIR)/convert.h
$(MKDIR) -p $(@D)
$(IA64_CPP) $(IA64_CFLAGS) -D ASSEMBLY $< | $(IA64_AS) $(IA64_ASFLAGS) -o $@
$(LIA64_OBJ)/convert_params.o: $(LIA64_DIR)/convert_params.c $(LIA64_DIR)/convert.h $(LIA64_DEP)
$(IA64_CC) $(IA64_CFLAGS) -c -o $@ $<
endif

View File

@ -0,0 +1,310 @@
0x00, 0x08, 0x19, 0x06, 0x80, 0x05, 0x20, 0x02, 0x00, 0x62, 0x00, 0xc0, 0x01, 0x00, 0xc0, 0x00,
0x05, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xe0, 0x01, 0xe2, 0x8b, 0x6f,
0x0a, 0x08, 0x38, 0x1e, 0x05, 0x20, 0x30, 0x02, 0x80, 0x00, 0x42, 0x80, 0x04, 0xe0, 0x00, 0x84,
0x1c, 0x28, 0x41, 0x03, 0x00, 0x26, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x70, 0x0d, 0x00, 0x50,
0x0d, 0xe0, 0x00, 0x10, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0xe0, 0x81, 0x0d, 0x00, 0x98,
0x0a, 0x80, 0x00, 0x1e, 0x18, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x09, 0x00, 0x07,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x08, 0x01, 0x55, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x07,
0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00,
0x00, 0x38, 0x28, 0x40, 0x86, 0x39, 0x00, 0x6a, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x04, 0x00,
0x13, 0x00, 0x00, 0x00, 0x01, 0x80, 0x41, 0x04, 0x00, 0xc2, 0x01, 0x00, 0xf0, 0xff, 0xff, 0x48,
0x00, 0x60, 0x3d, 0x1c, 0x80, 0x05, 0x00, 0x41, 0x30, 0x00, 0x42, 0x20, 0x02, 0x60, 0x00, 0x84,
0x0a, 0x60, 0x40, 0x18, 0x3f, 0x23, 0xd0, 0x02, 0x90, 0x44, 0x08, 0x60, 0x05, 0x00, 0xc4, 0x00,
0x00, 0x80, 0x9f, 0x20, 0xd9, 0x17, 0xa0, 0x42, 0x32, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00,
0x0a, 0x80, 0x9b, 0x22, 0xd9, 0x17, 0x00, 0x2f, 0x41, 0xb2, 0x2f, 0x00, 0x00, 0x00, 0x04, 0x00,
0x0a, 0x80, 0x93, 0x22, 0xd9, 0x17, 0x00, 0x1f, 0x41, 0xb2, 0x2f, 0x00, 0x00, 0x00, 0x04, 0x00,
0x0a, 0x00, 0x88, 0x22, 0xd8, 0x11, 0x00, 0x08, 0x41, 0xb0, 0x23, 0x00, 0x00, 0x00, 0x04, 0x00,
0x0b, 0x70, 0x01, 0x40, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x01, 0x70, 0x51, 0x00,
0x10, 0x38, 0x00, 0x1c, 0x86, 0x39, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x70, 0x00, 0x00, 0x43,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x00, 0xb8, 0x28, 0x00, 0xc0, 0x50, 0x72, 0x1c, 0xe6,
0x10, 0x70, 0x01, 0x1c, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x70, 0x00, 0x00, 0x43,
0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x48, 0xff, 0xff, 0x58,
0x0b, 0x00, 0x05, 0x40, 0x00, 0x21, 0xe0, 0x02, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x00, 0xb8, 0x28, 0x00, 0xe0, 0x00, 0x70, 0x18, 0xe6,
0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xb0, 0xff, 0xff, 0x4a,
0x00, 0x00, 0xb4, 0x48, 0x2a, 0x04, 0x00, 0x60, 0x01, 0x55, 0x00, 0x00, 0xb0, 0x0a, 0x00, 0x07,
0x11, 0x60, 0xc0, 0x19, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x08, 0x00, 0x84, 0x00,
0x01, 0x00, 0x05, 0x40, 0x00, 0x21, 0x90, 0x82, 0x30, 0x00, 0x42, 0x00, 0xc2, 0x01, 0x00, 0x90,
0x0b, 0x78, 0x00, 0x40, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x01, 0x78, 0x50, 0x00,
0x11, 0x38, 0xcc, 0x1d, 0x86, 0x39, 0xe0, 0x00, 0x3c, 0x28, 0x80, 0x03, 0x80, 0x03, 0x00, 0x43,
0x1d, 0x38, 0xb0, 0x1d, 0x86, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0xf0, 0x80, 0xf0, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x50, 0x03, 0x00, 0x43,
0x10, 0x38, 0xa0, 0x1d, 0x86, 0x39, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x00, 0x03, 0x00, 0x43,
0x0b, 0x78, 0x00, 0x40, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x01, 0x78, 0x50, 0x00,
0x1d, 0x70, 0x80, 0x1c, 0x2e, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x11, 0x38, 0xe0, 0x1d, 0x86, 0x39, 0xe0, 0x00, 0x3c, 0x28, 0x80, 0x03, 0x00, 0x02, 0x00, 0x43,
0x11, 0x38, 0x90, 0x1d, 0x86, 0x39, 0xe0, 0x00, 0x3c, 0x28, 0x80, 0x03, 0xa0, 0x00, 0x00, 0x43,
0x0a, 0x38, 0x8c, 0x1d, 0x86, 0xf9, 0xe1, 0x00, 0xa8, 0x00, 0xc2, 0x43, 0x85, 0x50, 0x01, 0x84,
0xcb, 0x08, 0x3c, 0x52, 0x80, 0xd5, 0xe1, 0x00, 0x38, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00,
0xe0, 0x08, 0x38, 0x52, 0x80, 0x15, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x1d, 0x40, 0x41, 0x18, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x10, 0x30, 0xa0, 0x52, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0xd0, 0xfe, 0xff, 0x4a,
0x0a, 0x70, 0x05, 0x50, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x05, 0x70, 0x51, 0x00,
0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xe8, 0xfd, 0xff, 0x58,
0x10, 0x30, 0xa0, 0x52, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xe0, 0xff, 0xff, 0x4a,
0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x90, 0xfe, 0xff, 0x48,
0x0a, 0x38, 0x70, 0x20, 0x86, 0xb1, 0xe1, 0x00, 0xa8, 0x00, 0xc2, 0xc3, 0x01, 0x50, 0x01, 0x84,
0xc2, 0x50, 0x21, 0x54, 0x00, 0xe1, 0xa1, 0x42, 0xa8, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00,
0xc9, 0x70, 0x00, 0x1c, 0x10, 0xd0, 0x01, 0x01, 0x38, 0x30, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00,
0x03, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0x01, 0x38, 0x2c, 0x00, 0xe0, 0x00, 0x01, 0x18, 0xc0,
0xe2, 0x70, 0xb4, 0x00, 0x00, 0xe4, 0x01, 0x01, 0x40, 0x0a, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00,
0xea, 0x08, 0x38, 0x52, 0x80, 0x15, 0x80, 0x02, 0xa4, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00,
0x00, 0x30, 0x40, 0x00, 0xe1, 0x18, 0xf0, 0xf8, 0x43, 0x00, 0x29, 0x00, 0x00, 0x00, 0x04, 0x00,
0x05, 0x00, 0x00, 0x00, 0x01, 0x40, 0x66, 0x66, 0x66, 0x66, 0x66, 0xc0, 0x71, 0xd6, 0x30, 0x63,
0x0a, 0x38, 0x38, 0x00, 0xe1, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x60, 0x00, 0x18, 0x0e, 0x77, 0x00, 0x00, 0x00, 0x04, 0x00,
0x0b, 0x70, 0x18, 0x00, 0xe1, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x51, 0x70, 0xf4, 0x52,
0x0b, 0x70, 0x38, 0x1e, 0x05, 0x20, 0xf0, 0x70, 0x38, 0x22, 0x40, 0xe0, 0x00, 0x70, 0x18, 0xe4,
0x0b, 0x78, 0x3c, 0x00, 0x10, 0x20, 0xf0, 0x80, 0x3c, 0x0a, 0x40, 0x00, 0x02, 0x70, 0x00, 0x84,
0x1d, 0x78, 0xc0, 0x1e, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x11, 0x08, 0x3c, 0x52, 0x80, 0x15, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x80, 0xff, 0xff, 0x4a,
0x1d, 0x80, 0xfc, 0x53, 0x3f, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x10, 0x30, 0xa0, 0x20, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0xa0, 0xfe, 0xff, 0x4b,
0x09, 0x70, 0x00, 0x20, 0x00, 0x10, 0xf0, 0x00, 0xa0, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00,
0x09, 0xf8, 0x3f, 0x20, 0x81, 0x17, 0x10, 0x70, 0xa0, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x04, 0x00,
0x10, 0x30, 0xa0, 0x20, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xe0, 0xff, 0xff, 0x4a,
0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x60, 0xfe, 0xff, 0x48,
0x02, 0x38, 0x70, 0x20, 0x86, 0x31, 0x20, 0x01, 0x3d, 0x58, 0xc0, 0xc3, 0x01, 0x50, 0x01, 0x84,
0xc9, 0x70, 0x00, 0x54, 0x00, 0xe1, 0xa1, 0x42, 0xa8, 0x00, 0x42, 0x43, 0x85, 0x50, 0x01, 0x84,
0xec, 0x88, 0x00, 0x1c, 0x18, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0xd0, 0x88, 0x00, 0x1c, 0x10, 0x10, 0x70, 0x80, 0x00, 0x0c, 0xe1, 0x03, 0x20, 0xfe, 0xff, 0x4b,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x00, 0x40, 0x24, 0x00, 0x00, 0xc2, 0x87, 0xfc, 0x8c,
0x05, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xe0, 0x01, 0xe2, 0xff, 0x6f,
0x01, 0x78, 0x04, 0x1e, 0x00, 0x20, 0xe0, 0x70, 0x44, 0x80, 0x3c, 0xe0, 0x00, 0x01, 0x18, 0xc2,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x0b, 0x70, 0x3c, 0x1c, 0x2c, 0x20, 0xe0, 0x70, 0x3c, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00,
0x0b, 0x70, 0x00, 0x1c, 0x00, 0x10, 0xe0, 0x90, 0x38, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00,
0x10, 0x08, 0x38, 0x52, 0x80, 0x15, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x90, 0xff, 0xff, 0x4a,
0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x90, 0xfd, 0xff, 0x48,
0x02, 0x00, 0x05, 0x40, 0x00, 0x21, 0x00, 0x61, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x04, 0x00,
0x0b, 0x70, 0x00, 0x40, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x01, 0x70, 0x50, 0x00,
0x10, 0x38, 0xa0, 0x1d, 0x86, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xf0, 0xfc, 0xff, 0x4a,
0x00, 0x80, 0x10, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x10, 0x00, 0x05, 0x40, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xd0, 0xfc, 0xff, 0x48,
0x02, 0x70, 0x00, 0x54, 0x00, 0x21, 0xa0, 0x42, 0xa8, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00,
0x0b, 0x40, 0x01, 0x1c, 0x18, 0x10, 0xe0, 0x00, 0xa0, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x00, 0x38, 0x28, 0x00, 0xe0, 0x00, 0x70, 0x18, 0xe6,
0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0xe0, 0xfb, 0xff, 0x4a,
0x0a, 0x70, 0x05, 0x50, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x05, 0x70, 0x51, 0x00,
0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xf8, 0xfa, 0xff, 0x58,
0x0b, 0x70, 0x00, 0x50, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x01, 0x70, 0x50, 0x00,
0x10, 0x38, 0x00, 0x1c, 0x86, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xd0, 0xff, 0xff, 0x4a,
0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x90, 0xfb, 0xff, 0x48,
0x00, 0x70, 0xfc, 0x45, 0x3f, 0x23, 0x20, 0x00, 0x04, 0x65, 0x00, 0x00, 0x01, 0x00, 0x01, 0x84,
0x1d, 0x38, 0x00, 0x44, 0x06, 0x39, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x40, 0x00, 0x00, 0x43,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x70, 0x04, 0x55, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x1d, 0x70, 0x04, 0x42, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x11, 0x08, 0x38, 0x10, 0x80, 0x15, 0x00, 0x00, 0x00, 0x02, 0x00, 0xa0, 0xf0, 0xff, 0xff, 0x48,
0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x04, 0x55, 0x00, 0x80, 0x08, 0x00, 0x84, 0x00,
0x1d, 0x80, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x10, 0x30, 0x40, 0x44, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x50, 0x00, 0x00, 0x43,
0x00, 0x78, 0x00, 0x40, 0x00, 0x10, 0x00, 0x09, 0x40, 0x00, 0x42, 0x00, 0x14, 0x00, 0x01, 0x84,
0x0a, 0x70, 0x00, 0x42, 0x00, 0x10, 0x80, 0x80, 0x88, 0x12, 0x68, 0x20, 0x14, 0x08, 0x01, 0x84,
0x1d, 0x30, 0x38, 0x1e, 0x87, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0xf3, 0x40, 0x3c, 0x1c, 0x05, 0xe0, 0x41, 0x04, 0x00, 0xc2, 0x01, 0x04, 0xd0, 0xff, 0xff, 0x4a,
0x11, 0x40, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x08, 0x00, 0x84, 0x00,
0x1d, 0x78, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x10, 0x30, 0x3c, 0x44, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x60, 0x00, 0x00, 0x43,
0x0b, 0x70, 0x80, 0x1e, 0x00, 0x20, 0xe0, 0x00, 0x38, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x00, 0x38, 0x28, 0x00, 0xe0, 0x00, 0x70, 0x18, 0xe6,
0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x30, 0x00, 0x00, 0x43,
0x1d, 0x78, 0x04, 0x1e, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x11, 0x30, 0x3c, 0x44, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xc0, 0xff, 0xff, 0x4a,
0x10, 0x88, 0x00, 0x00, 0x00, 0x21, 0x60, 0x78, 0x88, 0x0e, 0xe8, 0x03, 0x80, 0x00, 0x00, 0x43,
0x01, 0x90, 0x3c, 0x40, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x0b, 0x70, 0x84, 0x22, 0x00, 0x20, 0x00, 0x01, 0x38, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x00, 0x40, 0x28, 0x00, 0xe0, 0x00, 0x70, 0x18, 0xe6,
0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x40, 0x00, 0x00, 0x43,
0x09, 0x88, 0x04, 0x22, 0x00, 0x21, 0x10, 0x80, 0x48, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x04, 0x00,
0x1d, 0x70, 0x44, 0x1e, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x10, 0x30, 0x38, 0x44, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xb0, 0xff, 0xff, 0x4a,
0x0b, 0x78, 0x3c, 0x22, 0x00, 0x20, 0x60, 0x78, 0x88, 0x0e, 0x68, 0x00, 0x00, 0x00, 0x04, 0x00,
0xeb, 0x78, 0xfc, 0x45, 0x3f, 0x23, 0xe0, 0x00, 0x3d, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00,
0x11, 0x00, 0x00, 0x1c, 0x80, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x08, 0x00, 0x84, 0x00,
0x00, 0x28, 0x25, 0x0c, 0x80, 0x05, 0x80, 0x02, 0x00, 0x10, 0x48, 0x40, 0x04, 0x00, 0x20, 0x90,
0x00, 0x08, 0x01, 0x40, 0x00, 0x21, 0x40, 0x02, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x05, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x60, 0x04, 0x10, 0x00, 0x68,
0x05, 0x18, 0x05, 0x46, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xe0, 0x84, 0xe3, 0xff, 0x6f,
0x19, 0x38, 0x05, 0x4e, 0x00, 0x20, 0x60, 0x02, 0x8c, 0x30, 0x20, 0x00, 0xa8, 0xfe, 0xff, 0x58,
0x01, 0x00, 0x01, 0x46, 0x18, 0x10, 0x00, 0x28, 0x01, 0x55, 0x00, 0x00, 0x40, 0x0a, 0x00, 0x07,
0x11, 0x10, 0x0c, 0x00, 0x80, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x88, 0xfe, 0xff, 0x48,
0x0a, 0x80, 0x24, 0x02, 0x80, 0x05, 0xf0, 0x40, 0x80, 0x00, 0x42, 0x00, 0x02, 0x01, 0x01, 0x84,
0x00, 0x88, 0x60, 0x40, 0x00, 0x21, 0x20, 0x01, 0x81, 0x00, 0x42, 0x80, 0xc2, 0x02, 0x01, 0x84,
0x09, 0x70, 0x20, 0x41, 0x00, 0x21, 0x30, 0x41, 0x81, 0x00, 0x42, 0x60, 0xe4, 0x02, 0x01, 0x84,
0x00, 0x20, 0xc1, 0x40, 0x00, 0x21, 0x50, 0x92, 0x81, 0x00, 0x42, 0xc0, 0x84, 0x03, 0x01, 0x84,
0x05, 0xe8, 0x00, 0x1e, 0x18, 0xd0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xe0, 0x04, 0x10, 0x00, 0x68,
0x09, 0x38, 0x05, 0x4e, 0x00, 0x20, 0x80, 0x02, 0x38, 0x30, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00,
0x00, 0x40, 0x20, 0x4f, 0x00, 0x21, 0x10, 0x42, 0x9c, 0x00, 0x42, 0x40, 0x04, 0x39, 0x01, 0x84,
0x00, 0xd0, 0x00, 0x20, 0x18, 0x10, 0xe0, 0xc1, 0x9c, 0x00, 0x42, 0xe0, 0x03, 0x3a, 0x01, 0x84,
0x09, 0xb0, 0x00, 0x22, 0x18, 0x10, 0x70, 0x01, 0x48, 0x30, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00,
0x00, 0x70, 0x00, 0x4a, 0x08, 0x10, 0xc0, 0x41, 0x9d, 0x00, 0x42, 0x60, 0xc3, 0x3a, 0x01, 0x84,
0x00, 0x90, 0x00, 0x28, 0x08, 0x10, 0x80, 0x71, 0x9d, 0x00, 0x42, 0x80, 0x22, 0x3b, 0x01, 0x84,
0x09, 0x78, 0x00, 0x4c, 0x18, 0x10, 0x30, 0x01, 0x4c, 0x20, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00,
0x00, 0xc8, 0xc0, 0x4e, 0x00, 0x21, 0x50, 0xc1, 0x9d, 0x00, 0x42, 0xc0, 0x00, 0x40, 0x1d, 0xe4,
0x08, 0x80, 0x00, 0x46, 0x08, 0x10, 0x10, 0x01, 0x90, 0x10, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00,
0x02, 0x00, 0x38, 0x28, 0x88, 0x11, 0x40, 0x01, 0x9e, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00,
0x08, 0x00, 0x3c, 0x2a, 0x98, 0x11, 0x00, 0xe8, 0x84, 0x30, 0x23, 0xe0, 0x01, 0x04, 0x01, 0x84,
0x08, 0x00, 0x68, 0x44, 0x98, 0x11, 0x00, 0xb0, 0x78, 0x30, 0x23, 0x00, 0x00, 0x00, 0x04, 0x00,
0x08, 0x00, 0x5c, 0x3e, 0x98, 0x11, 0x00, 0x98, 0x70, 0x20, 0x23, 0x00, 0x00, 0x00, 0x04, 0x00,
0x08, 0x00, 0x48, 0x36, 0x88, 0x11, 0x00, 0x80, 0x60, 0x10, 0x23, 0x00, 0x00, 0x00, 0x04, 0x00,
0x10, 0x00, 0x44, 0x32, 0x88, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x40, 0x00, 0x00, 0x42,
0x0b, 0x70, 0x00, 0x10, 0x18, 0x10, 0x70, 0x00, 0x38, 0x0c, 0x72, 0x00, 0x00, 0x00, 0x04, 0x00,
0xe9, 0x70, 0x00, 0x1e, 0x18, 0xd0, 0x01, 0x40, 0x21, 0x30, 0x23, 0x00, 0x00, 0x00, 0x04, 0x00,
0xe0, 0x00, 0x38, 0x28, 0x98, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x1d, 0x70, 0x00, 0x40, 0x18, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x11, 0x30, 0x00, 0x1c, 0x07, 0x39, 0x00, 0x02, 0x38, 0x00, 0x42, 0x83, 0x08, 0x00, 0x84, 0x02,
0x11, 0x10, 0x04, 0x00, 0x80, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0xfe, 0xff, 0x48,
0x00, 0x40, 0x31, 0x12, 0x80, 0x05, 0x10, 0x02, 0x00, 0x00, 0x42, 0xc0, 0x04, 0x00, 0x00, 0x84,
0x18, 0x20, 0x01, 0x00, 0x00, 0x21, 0xe0, 0x20, 0x80, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x20,
0x02, 0x10, 0x31, 0x40, 0x00, 0x21, 0x70, 0x02, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x0b, 0x70, 0x00, 0x1c, 0x10, 0x10, 0x00, 0x02, 0x39, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00,
0x10, 0x30, 0x88, 0x40, 0x07, 0x34, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0xd0, 0x00, 0x00, 0x43,
0x02, 0x70, 0x00, 0x44, 0x00, 0x21, 0x90, 0x62, 0x88, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00,
0x0b, 0x80, 0x10, 0x1c, 0x10, 0x14, 0xe0, 0x00, 0x38, 0x20, 0x20, 0xe0, 0x31, 0x80, 0x00, 0x84,
0x0b, 0x78, 0xf0, 0x1f, 0x2c, 0x22, 0xe0, 0x18, 0x38, 0x00, 0x42, 0xe0, 0x01, 0x78, 0x48, 0x00,
0x03, 0x70, 0xf0, 0x1d, 0x2c, 0x22, 0x30, 0x4a, 0x3d, 0x00, 0x40, 0xc0, 0x01, 0x70, 0x48, 0x00,
0x02, 0x28, 0x8d, 0x1c, 0x00, 0x20, 0xe0, 0x40, 0x88, 0x00, 0x42, 0xe0, 0x00, 0x2a, 0x19, 0xd0,
0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x70, 0x00, 0x00, 0x43,
0x10, 0x38, 0x00, 0x20, 0x86, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x70, 0x01, 0x00, 0x42,
0x0b, 0x70, 0x00, 0x1c, 0x10, 0x10, 0x60, 0x10, 0x38, 0x0e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x00,
0xd0, 0x20, 0x01, 0x46, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x30, 0x00, 0x00, 0x43,
0x11, 0x30, 0x08, 0x1c, 0x87, 0x35, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xf0, 0x00, 0x00, 0x42,
0x0a, 0x30, 0x04, 0x1c, 0x87, 0xb9, 0x11, 0x02, 0x8c, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00,
0x11, 0x10, 0x01, 0x4a, 0x00, 0x21, 0x60, 0x28, 0x81, 0x0e, 0x68, 0x03, 0x50, 0xff, 0xff, 0x4a,
0x02, 0x48, 0x00, 0x48, 0x08, 0x39, 0x70, 0x00, 0x98, 0x0c, 0x72, 0xe3, 0x11, 0x00, 0x00, 0x90,
0xe9, 0x78, 0x00, 0x00, 0x00, 0x21, 0xe2, 0x08, 0x00, 0x00, 0xc8, 0xc4, 0x01, 0x00, 0x00, 0x84,
0x0b, 0x70, 0x3c, 0x1c, 0x0c, 0x20, 0x60, 0x00, 0x38, 0x0e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x00,
0xe4, 0x50, 0x01, 0x48, 0x00, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xff, 0x23, 0x05, 0xe4, 0xff, 0x6f,
0xea, 0x58, 0x01, 0x4c, 0x00, 0xe1, 0x91, 0x0a, 0xa4, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00,
0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x78, 0xf5, 0xff, 0x5b,
0x10, 0x30, 0x00, 0x42, 0x07, 0x39, 0x00, 0x40, 0x01, 0x55, 0x00, 0x03, 0x40, 0x00, 0x00, 0x43,
0x05, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x84, 0xe5, 0xff, 0x6f,
0x03, 0x00, 0x05, 0x40, 0x00, 0x20, 0x00, 0x38, 0x05, 0x80, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00,
0x11, 0x10, 0x08, 0x00, 0x80, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x38, 0xf5, 0xff, 0x48,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x40, 0x01, 0x55, 0x00, 0x00, 0x70, 0x0a, 0x00, 0x07,
0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x08, 0x00, 0x84, 0x00,
0x1d, 0x30, 0x0c, 0x1c, 0x87, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0xd0, 0x30, 0x01, 0x46, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x20, 0xff, 0xff, 0x4b,
0x0a, 0x30, 0x10, 0x1c, 0x87, 0xb9, 0x91, 0x02, 0x8c, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00,
0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xf8, 0xfb, 0xff, 0x5b,
0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xf0, 0xfe, 0xff, 0x48,
0x10, 0x38, 0x28, 0x20, 0x86, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xe0, 0xfe, 0xff, 0x4a,
0x05, 0x58, 0x29, 0x00, 0x00, 0xe4, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x40, 0x85, 0xe6, 0xff, 0x6f,
0x11, 0x50, 0x05, 0x54, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x28, 0xfa, 0xff, 0x58,
0x11, 0x70, 0x20, 0x44, 0x00, 0x21, 0x70, 0x00, 0x20, 0x0c, 0x73, 0x03, 0xb0, 0xfe, 0xff, 0x4a,
0x0b, 0x70, 0x00, 0x1c, 0x10, 0x10, 0x60, 0x10, 0x38, 0x0e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x00,
0xc0, 0x90, 0x80, 0x46, 0x00, 0xa1, 0x31, 0x81, 0x8c, 0x00, 0x42, 0x83, 0x82, 0x19, 0x01, 0x84,
0x05, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xc3, 0x01, 0x10, 0x00, 0x68,
0xca, 0x70, 0x04, 0x1c, 0x00, 0xa0, 0xf1, 0x80, 0x38, 0x00, 0x42, 0x03, 0x82, 0x71, 0x00, 0x84,
0xc2, 0x88, 0x80, 0x1c, 0x00, 0xa1, 0xe1, 0x40, 0x39, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00,
0xc9, 0x00, 0x48, 0x1e, 0x98, 0x91, 0xf1, 0x00, 0x8c, 0x30, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00,
0xc9, 0x00, 0x3c, 0x20, 0x98, 0x91, 0xf1, 0x00, 0x4c, 0x30, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00,
0xc9, 0x00, 0x3c, 0x22, 0x98, 0x91, 0xf1, 0x00, 0x50, 0x20, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00,
0xd0, 0x00, 0x3c, 0x1c, 0x90, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x20, 0xfe, 0xff, 0x4b,
0x11, 0x30, 0x08, 0x1c, 0x87, 0x35, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x50, 0x00, 0x00, 0x42,
0x10, 0x30, 0x04, 0x1c, 0x87, 0x39, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x00, 0xfe, 0xff, 0x4a,
0x05, 0x78, 0x00, 0x46, 0x18, 0xd0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xc0, 0x01, 0x10, 0x00, 0x68,
0x0b, 0x70, 0x04, 0x1c, 0x00, 0x20, 0xe0, 0x40, 0x38, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00,
0x10, 0x00, 0x3c, 0x1c, 0x98, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xd0, 0xfd, 0xff, 0x48,
0x11, 0x30, 0x0c, 0x1c, 0x87, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x60, 0x00, 0x00, 0x43,
0x10, 0x30, 0x10, 0x1c, 0x87, 0x39, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0xb0, 0xfd, 0xff, 0x4a,
0x04, 0x50, 0x01, 0x46, 0x00, 0xe1, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x20, 0x05, 0x10, 0x00, 0x68,
0x0b, 0x58, 0x21, 0x00, 0x00, 0x24, 0x90, 0x0a, 0xa4, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00,
0x11, 0x48, 0xb1, 0x52, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x88, 0xf8, 0xff, 0x58,
0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x70, 0xfd, 0xff, 0x48,
0x05, 0x78, 0x00, 0x46, 0x18, 0xd0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xc0, 0x01, 0x10, 0x00, 0x68,
0x1d, 0x70, 0x04, 0x1c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x11, 0x70, 0xe0, 0x1c, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x70, 0xff, 0xff, 0x48,
0x00, 0x20, 0x19, 0x0a, 0x80, 0x05, 0x10, 0x81, 0x88, 0x00, 0x42, 0xe0, 0x01, 0x12, 0x01, 0x84,
0x08, 0x80, 0x00, 0x40, 0x10, 0x10, 0x20, 0xc2, 0x88, 0x00, 0x42, 0x60, 0x04, 0x00, 0xc4, 0x00,
0x05, 0x28, 0x01, 0x40, 0x00, 0xe1, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xc0, 0x01, 0x10, 0x00, 0x68,
0x0a, 0x70, 0x04, 0x1c, 0x00, 0x20, 0x20, 0x01, 0x3a, 0x00, 0x42, 0x60, 0x82, 0x74, 0x00, 0x84,
0x04, 0x00, 0x3c, 0x1c, 0x98, 0x11, 0x0e, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x71, 0xe0, 0x83, 0x65,
0x0a, 0x78, 0x00, 0x22, 0x18, 0x10, 0x70, 0x70, 0x40, 0x0c, 0x71, 0x00, 0x00, 0x00, 0x04, 0x00,
0x09, 0x00, 0x3c, 0x24, 0x98, 0x11, 0xe0, 0x00, 0x88, 0x30, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00,
0x10, 0x00, 0x38, 0x26, 0x98, 0x11, 0x00, 0x00, 0x00, 0x02, 0x80, 0x03, 0x50, 0x00, 0x00, 0x43,
0x11, 0x28, 0x01, 0x42, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x18, 0xfa, 0xff, 0x58,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x01, 0x55, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x05, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x01, 0x10, 0x00, 0x68,
0x11, 0x40, 0x04, 0x10, 0x00, 0x20, 0x00, 0x18, 0x05, 0x80, 0x03, 0x80, 0x08, 0x00, 0x84, 0x00,
0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x78, 0xfb, 0xff, 0x58,
0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x48,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x4c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x3a, 0x20, 0x25, 0x73, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69,
0x6f, 0x6e, 0x3a, 0x20, 0x25, 0x73, 0x0a, 0x00, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65,
0x3a, 0x20, 0x25, 0x73, 0x0a, 0x00, 0x00, 0x00, 0x45, 0x74, 0x68, 0x65, 0x72, 0x62, 0x6f, 0x6f,
0x74, 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, 0x50, 0x00, 0x18, 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,
0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x42, 0x4f, 0x4f, 0x54, 0x5f, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x3d, 0x68, 0x65, 0x61, 0x64, 0x2e,
0x53, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x3d, 0x74, 0x74, 0x79, 0x53, 0x30, 0x20,
0x69, 0x70, 0x3d, 0x64, 0x68, 0x63, 0x70, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x3d, 0x2f, 0x64, 0x65,
0x76, 0x2f, 0x6e, 0x66, 0x73, 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, 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, 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, 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, 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,
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, 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, 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, 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, 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, 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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

View File

@ -0,0 +1,17 @@
#define CMDLINE_MAX 1024
#ifdef ASSEMBLY
#define CONVERT_MAGIC 0xA5A5A5A5A5A5A5A5
#else
#define CONVERT_MAGIC 0xA5A5A5A5A5A5A5A5ULL
#endif
#ifndef ASSEMBLY
struct image_parameters {
uint64_t convert_magic;
uint64_t entry;
uint64_t initrd_start;
uint64_t initrd_size;
uint8_t cmdline[CMDLINE_MAX];
};
#endif

View File

@ -0,0 +1,36 @@
OUTPUT_FORMAT("elf64-ia64-little")
OUTPUT_ARCH(ia64)
ENTRY(_start)
SECTIONS {
/* . = 0; */
. = 0x0000000004400000;
.text : {
_text = . ;
*(.text)
*(.rodaa)
*(.rodata.*)
_etext = . ;
}
. = ALIGN(16);
__gp = . + 0x200000;
.sdata : {
_sdata = . ;
*(.got.plt)
*(.got)
*(.srodata)
*(.sdata)
_esdata = . ;
}
.data : {
_data = . ;
*(.data)
*(.data.*)
*(.trailer)
_edata = . ;
}
/DISCARD/ : {
*(.comment)
*(.note)
}
}

View File

@ -0,0 +1,334 @@
#include "stdint.h"
#include "limits.h"
#include <stdarg.h>
#include "elf.h"
#include "elf_boot.h"
#include "convert.h"
/* NOTE be very careful with static variables. No relocations are
* being performed so static variables with initialized pointers will
* point to the wrong locations, unless this file is loaded at just
* the right location.
*/
/* Data and functions in head.S */
extern void uart_tx_byte(int c);
static void putchar(int c)
{
if (c == '\n') {
putchar('\r');
}
#if 0
uart_tx_byte(c);
#endif
}
#define LONG_SHIFT ((int)((sizeof(unsigned long)*CHAR_BIT) - 4))
#define INT_SHIFT ((int)((sizeof(unsigned int)*CHAR_BIT) - 4))
#define SHRT_SHIFT ((int)((sizeof(unsigned short)*CHAR_BIT) - 4))
#define CHAR_SHIFT ((int)((sizeof(unsigned char)*CHAR_BIT) - 4))
/**************************************************************************
PRINTF and friends
Formats:
%x - 4 bytes int (8 hex digits, lower case)
%X - 4 bytes int (8 hex digits, upper case)
%lx - 8 bytes long (16 hex digits, lower case)
%lX - 8 bytes long (16 hex digits, upper case)
%hx - 2 bytes int (4 hex digits, lower case)
%hX - 2 bytes int (4 hex digits, upper case)
%hhx - 1 byte int (2 hex digits, lower case)
%hhX - 1 byte int (2 hex digits, upper case)
- optional # prefixes 0x or 0X
%d - decimal int
%c - char
%s - string
Note: width specification not supported
**************************************************************************/
static void printf(const char *fmt, ...)
{
va_list args;
char *p;
va_start(args, fmt);
for ( ; *fmt != '\0'; ++fmt) {
if (*fmt != '%') {
putchar(*fmt);
continue;
}
if (*++fmt == 's') {
for(p = va_arg(args, char *); *p != '\0'; p++)
putchar(*p);
}
else { /* Length of item is bounded */
char tmp[40], *q = tmp;
int shift = INT_SHIFT;
if (*fmt == 'l') {
shift = LONG_SHIFT;
fmt++;
}
else if (*fmt == 'h') {
shift = SHRT_SHIFT;
fmt++;
if (*fmt == 'h') {
shift = CHAR_SHIFT;
fmt++;
}
}
/*
* Before each format q points to tmp buffer
* After each format q points past end of item
*/
if ((*fmt | 0x20) == 'x') {
/* With x86 gcc, sizeof(long) == sizeof(int) */
unsigned long h;
int ncase;
if (shift > INT_SHIFT) {
h = va_arg(args, unsigned long);
} else {
h = va_arg(args, unsigned int);
}
ncase = (*fmt & 0x20);
for ( ; shift >= 0; shift -= 4)
*q++ = "0123456789ABCDEF"[(h >> shift) & 0xF] | ncase;
}
else if (*fmt == 'd') {
char *r;
long i;
if (shift > INT_SHIFT) {
i = va_arg(args, long);
} else {
i = va_arg(args, int);
}
if (i < 0) {
*q++ = '-';
i = -i;
}
p = q; /* save beginning of digits */
do {
*q++ = '0' + (i % 10);
i /= 10;
} while (i);
/* reverse digits, stop in middle */
r = q; /* don't alter q */
while (--r > p) {
i = *r;
*r = *p;
*p++ = i;
}
}
else if (*fmt == 'c')
*q++ = va_arg(args, int);
else
*q++ = *fmt;
/* now output the saved string */
for (p = tmp; p < q; ++p)
putchar(*p);
}
}
va_end(args);
}
void *memcpy(void *vdest, void *vsrc, size_t size)
{
unsigned char *dest = vdest, *src = vsrc;
size_t i;
for(i = 0; i < size; i++) {
*dest++ = *src++;
}
return dest;
}
int memcmp(void *vs1, void *vs2, size_t size)
{
unsigned char *s1 =vs1, *s2=vs2;
size_t i;
for(i = 0; i < size; i++, s1++, s2++) {
if (*s1 != *s2)
return *s1 - *s2;
}
return 0;
}
void strappend(char *dest, const char *src, size_t max)
{
size_t len, i;
/* Walk to the end of the destination string */
for(len = 0; len < max; len++) {
if (dest[len] == '\0')
break;
}
/* Walk through the source string and append it */
for(i = 0; (i + len) < max; i++) {
if (src[i] == '\0')
break;
dest[len + i] = src[i];
}
len = len + i;
/* Now null terminate the string */
if (len >= max) {
len = max -1;
}
dest[len] = '\0';
}
static struct ia64_boot_param {
uint64_t command_line; /* physical address of command line arguments */
uint64_t efi_systab; /* physical address of EFI system table */
uint64_t efi_memmap; /* physical address of EFI memory map */
uint64_t efi_memmap_size; /* size of EFI memory map */
uint64_t efi_memdesc_size; /* size of an EFI memory map descriptor */
uint32_t efi_memdesc_version; /* memory descriptor version */
struct {
uint16_t num_cols; /* number of columns on console output device */
uint16_t num_rows; /* number of rows on console output device */
uint16_t orig_x; /* cursor's x position */
uint16_t orig_y; /* cursor's y position */
} console_info;
uint64_t fpswa; /* physical address of the fpswa interface */
uint64_t initrd_start;
uint64_t initrd_size;
} bp = { 0, 0, 0, 0, 0, 0, { 80, 24, 0, 0 }, 0, 0, 0 };
static void append_command_line(char *arg)
{
strappend((char *)bp.command_line, " ", CMDLINE_MAX);
strappend((char *)bp.command_line, arg, CMDLINE_MAX);
}
static void convert_ia64_boot_params(struct ia64_boot_param *orig_bp)
{
/* Copy the parameters I have no clue about */
bp.efi_systab = orig_bp->efi_systab;
bp.efi_memmap = orig_bp->efi_memmap;
bp.efi_memmap_size = orig_bp->efi_memmap_size;
bp.efi_memdesc_size = orig_bp->efi_memdesc_size;
bp.efi_memdesc_version = orig_bp->efi_memdesc_version;
bp.console_info.num_cols = orig_bp->console_info.num_cols;
bp.console_info.num_rows = orig_bp->console_info.num_rows;
bp.console_info.orig_x = orig_bp->console_info.orig_x;
bp.console_info.orig_y = orig_bp->console_info.orig_y;
bp.fpswa = orig_bp->fpswa;
/* If a ramdisk was supplied and I didn't original have one,
* use it.
*/
if (orig_bp->initrd_size && (!bp.initrd_size)) {
bp.initrd_start = orig_bp->initrd_start;
bp.initrd_size = orig_bp->initrd_size;
}
/* If a command line was supplied append it */
if (orig_bp->command_line) {
append_command_line((char *)(orig_bp->command_line));
}
}
static void convert_bhdr_params(Elf_Bhdr *bhdr)
{
unsigned char *note, *end;
char *ldr_name, *ldr_version, *firmware;
ldr_name = ldr_version = firmware = 0;
note = ((char *)bhdr) + sizeof(*bhdr);
end = ((char *)bhdr) + bhdr->b_size;
while(note < end) {
Elf_Nhdr *hdr;
unsigned char *n_name, *n_desc, *next;
hdr = (Elf_Nhdr *)note;
n_name = note + sizeof(*hdr);
n_desc = n_name + ((hdr->n_namesz + 3) & ~3);
next = n_desc + ((hdr->n_descsz + 3) & ~3);
if (next > end)
break;
#if 0
printf("n_type: %x n_name(%d): n_desc(%d): \n",
hdr->n_type, hdr->n_namesz, hdr->n_descsz);
#endif
if (hdr->n_namesz == 0) {
switch(hdr->n_type) {
case EBN_FIRMWARE_TYPE:
firmware = n_desc;
break;
case EBN_BOOTLOADER_NAME:
ldr_name = n_desc;
break;
case EBN_BOOTLOADER_VERSION:
ldr_version = n_desc;
break;
case EBN_COMMAND_LINE:
append_command_line(n_desc);
break;
}
}
else if ((hdr->n_namesz == 10) &&
(memcmp(n_name, "Etherboot", 10) == 0)) {
switch(hdr->n_type) {
case EB_IA64_SYSTAB:
{
uint64_t *systabp = (void *)n_desc;
bp.efi_systab = *systabp;
break;
}
case EB_IA64_FPSWA:
{
uint64_t *fpswap = (void *)n_desc;
bp.fpswa = *fpswap;
break;
}
case EB_IA64_CONINFO:
memcpy(&bp.console_info, n_desc, sizeof(bp.console_info));
break;
case EB_IA64_MEMMAP:
{
struct efi_mem_map {
uint64_t map_size;
uint64_t map_key;
uint64_t descriptor_size;
uint64_t descriptor_version;
uint8_t map[40];
} *map = (void *)n_desc;
bp.efi_memmap = (uint64_t)&map->map;
bp.efi_memmap_size = map->map_size;
bp.efi_memdesc_size = map->descriptor_size;
bp.efi_memdesc_version = map->descriptor_version;
break;
}
}
}
note = next;
}
if (ldr_name && ldr_version) {
printf("Loader: %s version: %s\n",
ldr_name, ldr_version);
}
if (firmware) {
printf("Firmware: %s\n",
firmware);
}
}
void *convert_params(unsigned long arg1, unsigned long r28,
struct image_parameters *params)
{
struct ia64_boot_param *orig_bp;
Elf_Bhdr *bhdr = (Elf_Bhdr*)arg1;
/* handle the options I can easily deal with */
bp.command_line = (unsigned long)&params->cmdline;
bp.initrd_start = params->initrd_start;
bp.initrd_size = params->initrd_size;
orig_bp = (struct ia64_boot_param *)r28;
if (bhdr->b_signature == 0x0E1FB007) {
convert_bhdr_params(bhdr);
}
else {
convert_ia64_boot_params(orig_bp);
}
return &bp;
}

View File

@ -0,0 +1,235 @@
#define ASSEMBLY 1
.text
#include "convert.h"
.globl _start
.proc _start
_start:
alloc loc0=ar.pfs,1,2,3,0 /* in, local, out, rotating */
mov loc1=rp
mov r14=ip /* Get the address of _start, I'm in the first bundle */
movl r15=@gprel(_start)
;;
sub gp=r14,r15 /* gp = _start - @gprel(_start), current value of gp */
;;
mov out0=in0
mov out1=r28
add out2=@gprel(params),gp
br.call.sptk.few rp=convert_params
mov r28=r8
add r15=@gprel(entry), gp
;;
ld8 r16=[r15]
;;
mov b1=r16
mov ar.pfs=loc0
mov rp=loc1
;;
br.cond.sptk.few b1
.size _start, . - _start
.endp _start
#if 0
/* Base Address */
#define UART_BASE 0x00000000f8030000
#define UART_BAUD 9600
/* Data */
#define UART_RBR 0x00
#define UART_TBR 0x00
/* Control */
#define UART_IER 0x01
#define UART_IIR 0x02
#define UART_FCR 0x02
#define UART_LCR 0x03
#define UART_MCR 0x04
#define UART_DLL 0x00
#define UART_DLM 0x01
/* Status */
#define UART_LSR 0x05
#define UART_MSR 0x06
#define UART_SCR 0x07
#define UART_PHYS_BASE (0x8000000000000000|UART_BASE)
#define UART_DIV (115200/UART_BAUD)
#define UART_DIV_LO (UART_DIV&0xFF)
#define UART_DIV_HI ((UART_DIV >> 8)&0xFF)
#if ((115200%UART_BAUD) != 0)
#error Bad uart baud rate
#endif
/* NOTE: As these are debugging functions, they do not consume any
* space on the register stack, and instead rely entirely on
* scratch registers for the registers they use.
*/
uart_init:
/* set the UART_BASE */
movl r31=UART_PHYS_BASE
;;
/* disable interrupts */
add r30=UART_IER,r31
mov r29=0x00
;;
st1 [r30]=r29
/* enable fifos */
add r30=UART_FCR,r31
mov r29=0x01
;;
st1 [r30]=r29
/* Set Baud Rate Divisor to UART_BAUD */
add r30=UART_LCR,r31
mov r29=0x83
;;
st1 [r30]=r29
add r30=UART_DLL,r31
mov r29=UART_DIV_LO
;;
st1 [r30]=r29
add r30=UART_DLM,r31
mov r29=UART_DIV_HI
;;
st1 [r30]=r29
add r30=UART_LCR,r31
mov r29=0x03
;;
st1 [r30]=r29
br.ret.sptk.few rp
.proc uart_tx_byte
.globl uart_tx_byte
uart_tx_byte:
/* set the UART_PHYS_BASE */
movl r31=UART_PHYS_BASE
;;
__uart_tx_byte:
/* Wait until the UART can hold another byte */
add r30=UART_LSR,r31
;;
9: ld1.acq.nta r29=[r30]
;;
and r29=0x20,r29
;;
cmp.eq p63,p0=0,r29
(p63) br.cond.sptk.few 9b
/* Transmit the byte */
add r30=UART_TBR,r31
;;
st1.rel.nta [r30]=r32
;;
/* Wait until the UART is empty to be certain the byte is flushed */
add r30=UART_LSR,r31
;;
9: ld1.acq.nta r29=[r30]
;;
and r29=0x40,r29
;;
cmp.eq p63,p0=0,r29
(p63) br.cond.sptk.few 9b
;;
br.ret.sptk.few rp
.endp uart_tx_byte
__uart_tx_hex_char:
cmp.ltu p62,p63=9,r32
;;
(p63) add r32=48,r32 /* digits*/
(p62) add r32=55,r32 /* letters */
br.cond.sptk.few __uart_tx_byte
uart_tx_hex64:
/* set the UART_bASE */
movl r31=UART_PHYS_BASE
/* skip r28 */
mov r27=rp
mov r26=ar.pfs
mov r25=r32
;;
extr.u r32=r25,60,4
br.call.sptk.few rp=__uart_tx_hex_char
;;
extr.u r32=r25,56,4
br.call.sptk.few rp=__uart_tx_hex_char
;;
extr.u r32=r25,52,4
br.call.sptk.few rp=__uart_tx_hex_char
;;
extr.u r32=r25,48,4
br.call.sptk.few rp=__uart_tx_hex_char
;;
extr.u r32=r25,44,4
br.call.sptk.few rp=__uart_tx_hex_char
;;
extr.u r32=r25,40,4
br.call.sptk.few rp=__uart_tx_hex_char
;;
extr.u r32=r25,36,4
br.call.sptk.few rp=__uart_tx_hex_char
;;
extr.u r32=r25,32,4
br.call.sptk.few rp=__uart_tx_hex_char
;;
extr.u r32=r25,28,4
br.call.sptk.few rp=__uart_tx_hex_char
;;
extr.u r32=r25,24,4
br.call.sptk.few rp=__uart_tx_hex_char
;;
extr.u r32=r25,20,4
br.call.sptk.few rp=__uart_tx_hex_char
;;
extr.u r32=r25,16,4
br.call.sptk.few rp=__uart_tx_hex_char
;;
extr.u r32=r25,12,4
br.call.sptk.few rp=__uart_tx_hex_char
;;
extr.u r32=r25,8,4
br.call.sptk.few rp=__uart_tx_hex_char
;;
extr.u r32=r25,4,4
br.call.sptk.few rp=__uart_tx_hex_char
;;
extr.u r32=r25,0,4
br.call.sptk.few rp=__uart_tx_hex_char
;;
mov ar.pfs = r26
mov rp = r27
;;
br.ret.sptk.few rp
#endif
.section ".trailer", "a"
/* Constants set at build time, these are at the very end of my image */
.balign 16
.global params
params:
convert_magic:
.quad CONVERT_MAGIC
entry:
.quad 0
initrd_start:
.quad 0
initrd_size:
.quad 0
cmdline:
.asciz "BOOT_IMAGE=head.S console=ttyS0 ip=dhcp root=/dev/nfs"
.org cmdline + 1024, 0
cmdline_end:

View File

@ -0,0 +1,272 @@
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#define _GNU_SOURCE
#include <getopt.h>
#include "elf.h"
#include "elf_boot.h"
#include "convert.h"
#include "mkelfImage.h"
static unsigned char payload[] = {
#include "convert.bin.c"
};
char *linux_ia64_probe(char *kernel_buf, off_t kernel_size)
{
Elf64_Ehdr *ehdr;
Elf64_Phdr *phdr;
int i;
int phdrs;
ehdr = (Elf64_Ehdr *)kernel_buf;
if (
(ehdr->e_ident[EI_MAG0] != ELFMAG0) ||
(ehdr->e_ident[EI_MAG1] != ELFMAG1) ||
(ehdr->e_ident[EI_MAG2] != ELFMAG2) ||
(ehdr->e_ident[EI_MAG3] != ELFMAG3)) {
return "No ELF signature found on kernel\n";
}
if (ehdr->e_ident[EI_CLASS] != ELFCLASS64) {
return "Not a 64bit ELF kernel\n";
}
if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) {
return "Not a little endian ELF kernel\n";
}
if (le16_to_cpu(ehdr->e_type) != ET_EXEC) {
return "Not an executable kernel\n";
}
if (le16_to_cpu(ehdr->e_machine) != EM_IA_64) {
return "Not an ia64 kernel\n";
}
if ( (ehdr->e_ident[EI_VERSION] != EV_CURRENT) ||
(le32_to_cpu(ehdr->e_version) != EV_CURRENT)) {
return "Kernel not using ELF version 1.\n";
}
if (le16_to_cpu(ehdr->e_phentsize) != sizeof(*phdr)) {
return "Kernel uses bad program header size.\n";
}
phdr = (Elf64_Phdr *)(kernel_buf + le64_to_cpu(ehdr->e_phoff));
phdrs = 0;
for(i = 0; i < le16_to_cpu(ehdr->e_phnum); i++) {
if (le32_to_cpu(phdr[i].p_type) != PT_LOAD)
continue;
phdrs++;
}
if (phdrs == 0) {
return "No PT_LOAD segments!\n";
}
return 0;
}
struct kernel_info
{
int phdrs;
char *kernel_buf;
Elf64_Ehdr *ehdr;
Elf64_Phdr *phdr;
uint64_t entry;
char *version;
};
static void parse_kernel(struct kernel_info *info,
char *kernel_buf, size_t kernel_size)
{
Elf64_Ehdr *ehdr;
Elf64_Phdr *phdr;
int i;
int phdrs;
ehdr = (Elf64_Ehdr *)kernel_buf;
phdr = (Elf64_Phdr *)(kernel_buf + le64_to_cpu(ehdr->e_phoff));
phdrs = 0;
for(i = 0; i < le16_to_cpu(ehdr->e_phnum); i++) {
if (le16_to_cpu(phdr[i].p_type) != PT_LOAD)
continue;
phdrs++;
}
if (phdrs == 0) {
die("No PT_LOAD segments!\n");
}
info->kernel_buf = kernel_buf;
info->ehdr = ehdr;
info->phdrs = phdrs;
info->phdr = phdr;
info->entry = le64_to_cpu(ehdr->e_entry);
info->version = "unknown";
}
static int populate_kernel_phdrs(struct kernel_info *info, struct memelfphdr *phdr)
{
uint64_t paddr;
int i;
paddr = 0;
for(i = 0; i < info->phdrs; i++) {
Elf64_Phdr *hdr;
int j;
hdr = 0;
for(j = 0; j < le16_to_cpu(info->ehdr->e_phnum); j++) {
if (le16_to_cpu(info->phdr[j].p_type != PT_LOAD)) {
continue;
}
if (paddr > le64_to_cpu(info->phdr[j].p_paddr)) {
continue;
}
if (hdr &&
le64_to_cpu(hdr->p_paddr) <
le64_to_cpu(info->phdr[j].p_paddr)) {
continue;
}
hdr = info->phdr + j;
}
if (!hdr) {
die("Expected %d phdrs found %d!", info->phdrs, i);
}
phdr[i].p_paddr = le64_to_cpu(hdr->p_paddr);
phdr[i].p_vaddr = le64_to_cpu(hdr->p_vaddr);
phdr[i].p_filesz = le64_to_cpu(hdr->p_filesz);
phdr[i].p_memsz = le64_to_cpu(hdr->p_memsz);
phdr[i].p_data = info->kernel_buf + le64_to_cpu(hdr->p_offset);
paddr = phdr[i].p_paddr + phdr[i].p_memsz;
}
return i;
}
void linux_ia64_usage(void)
{
printf(
" --command-line=<string> Set the command line to <string>\n"
" --append=<string> Set the command line to <string>\n"
" --initrd=<filename> Set the initrd to <filename>\n"
" --ramdisk=<filename> Set the initrd to <filename>\n"
);
return;
}
#define OPT_CMDLINE OPT_MAX+0
#define OPT_RAMDISK OPT_MAX+1
int linux_ia64_mkelf(int argc, char **argv,
struct memelfheader *ehdr, char *kernel_buf, off_t kernel_size)
{
const char *ramdisk, *cmdline;
char *payload_buf, *ramdisk_buf;
off_t payload_size, ramdisk_size;
struct memelfphdr *phdr;
struct memelfnote *note;
struct kernel_info kinfo;
struct image_parameters *params;
int index;
int opt;
static const struct option options[] = {
MKELF_OPTIONS
{ "command-line", 1, 0, OPT_CMDLINE },
{ "append", 1, 0, OPT_CMDLINE },
{ "initrd", 1, 0, OPT_RAMDISK },
{ "ramdisk", 1, 0, OPT_RAMDISK },
{ 0 , 0, 0, 0 },
};
static const char short_options[] = "HV";
ramdisk = 0;
cmdline="";
while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
switch(opt) {
case '?':
error("Unknown option %s\n", argv[optind]);
break;
case OPT_RAMDISK:
ramdisk = optarg;
break;
case OPT_CMDLINE:
cmdline = optarg;
break;
default:
break;
}
}
ehdr->ei_class = ELFCLASS64;
ehdr->ei_data = ELFDATA2LSB;
ehdr->e_type = ET_EXEC;
ehdr->e_machine = EM_IA_64;
/* locate the payload buffer */
payload_buf = payload;
payload_size = sizeof(payload);
/* slurp the input files */
ramdisk_buf = slurp_file(ramdisk, &ramdisk_size);
/* parse the kernel */
parse_kernel(&kinfo, kernel_buf, kernel_size);
/* Find the parameters */
params = (void *)(payload_buf + (payload_size - sizeof(*params)));
/* A sanity check against bad versions of binutils */
if (params->convert_magic != CONVERT_MAGIC) {
die("Internal error convert_magic %16llx != %16llx\n",
(unsigned long long)(params->convert_magic), CONVERT_MAGIC);
}
/* Copy the command line */
strncpy(params->cmdline, cmdline, sizeof(params->cmdline));
params->cmdline[sizeof(params->cmdline)-1]= '\0';
/* Add a program header for the note section */
phdr = add_program_headers(ehdr, 2 + kinfo.phdrs + (ramdisk_size?1:0));
/* Fill in the program headers*/
phdr[0].p_type = PT_NOTE;
/* Fill in the kernel program headers */
index = 1 + populate_kernel_phdrs(&kinfo, phdr + 1);
/* Fill in the converter program header */
phdr[index].p_paddr = roundup(phdr[index -1].p_paddr + phdr[index -1].p_memsz, 16);
phdr[index].p_vaddr = phdr[index].p_paddr;
phdr[index].p_filesz = payload_size;
phdr[index].p_memsz = payload_size;
phdr[index].p_data = payload_buf;
index++;
/* Set the start location */
params->entry = kinfo.entry;
ehdr->e_entry = phdr[index -1].p_paddr;
/* Fill in the ramdisk program header */
params->initrd_start = params->initrd_size = 0;
if (ramdisk_size) {
phdr[index].p_paddr = roundup(phdr[index -1].p_paddr + phdr[index -1].p_memsz, 16);
phdr[index].p_vaddr = phdr[index].p_paddr;
phdr[index].p_filesz = ramdisk_size;
phdr[index].p_memsz = ramdisk_size;
phdr[index].p_data = ramdisk_buf;
params->initrd_start = phdr[index].p_paddr;
params->initrd_size = phdr[index].p_filesz;
index++;
}
/* Compute the elf notes */
note = add_notes(ehdr, 3);
note[0].n_type = EIN_PROGRAM_NAME;
note[0].n_name = "ELFBoot";
note[0].n_desc = "Linux";
note[0].n_descsz = strlen(note[0].n_desc)+1;
note[1].n_type = EIN_PROGRAM_VERSION;
note[1].n_name = "ELFBoot";
note[1].n_desc = kinfo.version;
note[1].n_descsz = strlen(note[1].n_desc)+1;
note[2].n_type = EIN_PROGRAM_CHECKSUM;
note[2].n_name = "ELFBoot";
note[2].n_desc = 0;
note[2].n_descsz = 2;
return 0;
}

View File

@ -0,0 +1,18 @@
MKELF_OBJS=$(OBJDIR)/main/mkelfImage.o \
$(OBJDIR)/linux-i386/mkelf-linux-i386.o \
$(OBJDIR)/linux-ia64/mkelf-linux-ia64.o
$(OBJDIR)/sbin/mkelfImage: $(MKELF_OBJS) $(DEPS)
$(MKDIR) -p $(@D)
$(HOST_CC) $(HOST_CFLAGS) $(MKELF_OBJS) -o $@ $(LIBS)
$(OBJDIR)/main/mkelfImage.o: main/mkelfImage.c include/mkelfImage.h $(DEPS)
$(MKDIR) -p $(@D)
$(HOST_CC) $(HOST_CFLAGS) -c $< -o $@
$(OBJDIR)/man/man8/mkelfImage.8: main/mkelfImage.man
$(MKDIR) -p $(@D)
$(SED) \
-e 's,^.TH MKELFIMAGE 8 "RELEASE_DATE" "VERSION"$$,.TH MKELFIMAGE 8 "$(RELEASE_DATE)" "$(VERSION)",' \
$< > $@
$(CP) $< $@

View File

@ -0,0 +1,663 @@
#include <stdarg.h>
#include <errno.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <getopt.h>
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
#include "elf.h"
#include "elf_boot.h"
#include "mkelfImage.h"
static struct file_type file_type[] = {
{ "linux-i386", linux_i386_probe, linux_i386_mkelf, linux_i386_usage },
{ "bzImage-i386", bzImage_i386_probe, linux_i386_mkelf, linux_i386_usage },
{ "vmlinux-i386", vmlinux_i386_probe, linux_i386_mkelf, linux_i386_usage },
{ "linux-ia64", linux_ia64_probe, linux_ia64_mkelf, linux_ia64_usage },
};
static const int file_types = sizeof(file_type)/sizeof(file_type[0]);
void die(char *fmt, ...)
{
va_list args;
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
exit(1);
}
/**************************************************************************
IPCHKSUM - Checksum IP Header
**************************************************************************/
uint16_t ipchksum(const void *data, unsigned long length)
{
unsigned long sum;
unsigned long i;
const uint8_t *ptr;
/* In the most straight forward way possible,
* compute an ip style checksum.
*/
sum = 0;
ptr = data;
for(i = 0; i < length; i++) {
unsigned long value;
value = ptr[i];
if (i & 1) {
value <<= 8;
}
/* Add the new value */
sum += value;
/* Wrap around the carry */
if (sum > 0xFFFF) {
sum = (sum + (sum >> 16)) & 0xFFFF;
}
}
return (~cpu_to_le16(sum)) & 0xFFFF;
}
uint16_t add_ipchksums(unsigned long offset, uint16_t sum, uint16_t new)
{
unsigned long checksum;
sum = ~sum & 0xFFFF;
new = ~new & 0xFFFF;
if (offset & 1) {
/* byte swap the sum if it came from an odd offset
* since the computation is endian independant this
* works.
*/
new = bswap_16(new);
}
checksum = sum + new;
if (checksum > 0xFFFF) {
checksum -= 0xFFFF;
}
return (~checksum) & 0xFFFF;
}
void *xmalloc(size_t size, const char *name)
{
void *buf;
buf = malloc(size);
if (!buf) {
die("Cannot malloc %ld bytes to hold %s: %s\n",
size + 0UL, name, strerror(errno));
}
return buf;
}
void *xrealloc(void *ptr, size_t size, const char *name)
{
void *buf;
buf = realloc(ptr, size);
if (!buf) {
die("Cannot realloc %ld bytes to hold %s: %s\n",
size + 0UL, name, strerror(errno));
}
return buf;
}
char *slurp_file(const char *filename, off_t *r_size)
{
int fd;
char *buf;
off_t size, progress;
ssize_t result;
struct stat stats;
if (!filename) {
*r_size = 0;
return 0;
}
fd = open(filename, O_RDONLY);
if (fd < 0) {
die("Cannot open `%s': %s\n",
filename, strerror(errno));
}
result = fstat(fd, &stats);
if (result < 0) {
die("Cannot stat: %s: %s\n",
filename, strerror(errno));
}
size = stats.st_size;
*r_size = size;
buf = xmalloc(size, filename);
progress = 0;
while(progress < size) {
result = read(fd, buf + progress, size - progress);
if (result < 0) {
if ((errno == EINTR) || (errno == EAGAIN))
continue;
die("read on %s of %ld bytes failed: %s\n",
filename, (size - progress)+ 0UL, strerror(errno));
}
progress += result;
}
result = close(fd);
if (result < 0) {
die("Close of %s failed: %s\n",
filename, strerror(errno));
}
return buf;
}
#if HAVE_ZLIB_H
char *slurp_decompress_file(const char *filename, off_t *r_size)
{
gzFile fp;
int errnum;
const char *msg;
char *buf;
off_t size, allocated;
ssize_t result;
if (!filename) {
*r_size = 0;
return 0;
}
fp = gzopen(filename, "rb");
if (fp == 0) {
msg = gzerror(fp, &errnum);
if (errnum == Z_ERRNO) {
msg = strerror(errno);
}
die("Cannot open `%s': %s\n", filename, msg);
}
size = 0;
allocated = 65536;
buf = xmalloc(allocated, filename);
do {
if (size == allocated) {
allocated <<= 1;
buf = xrealloc(buf, allocated, filename);
}
result = gzread(fp, buf + size, allocated - size);
if (result < 0) {
if ((errno == EINTR) || (errno == EAGAIN))
continue;
msg = gzerror(fp, &errnum);
if (errnum == Z_ERRNO) {
msg = strerror(errno);
}
die ("read on %s of %ld bytes failed: %s\n",
filename, (allocated - size) + 0UL, msg);
}
size += result;
} while(result > 0);
result = gzclose(fp);
if (result != Z_OK) {
msg = gzerror(fp, &errnum);
if (errnum == Z_ERRNO) {
msg = strerror(errno);
}
die ("Close of %s failed: %s\n", filename, msg);
}
*r_size = size;
return buf;
}
#else
char *slurp_decompress_file(const char *filename, off_t *r_size)
{
return slurp_file(filename, r_size);
}
#endif
struct memelfphdr *add_program_headers(struct memelfheader *ehdr, int count)
{
struct memelfphdr *phdr;
int i;
ehdr->e_phnum = count;
ehdr->e_phdr = phdr = xmalloc(count *sizeof(*phdr), "Program headers");
/* Set the default values */
for(i = 0; i < count; i++) {
phdr[i].p_type = PT_LOAD;
phdr[i].p_flags = PF_R | PF_W | PF_X;
phdr[i].p_vaddr = 0;
phdr[i].p_paddr = 0;
phdr[i].p_filesz = 0;
phdr[i].p_memsz = 0;
phdr[i].p_data = 0;
}
return phdr;
}
struct memelfnote *add_notes(struct memelfheader *ehdr, int count)
{
struct memelfnote *notes;
ehdr->e_notenum = count;
ehdr->e_notes = notes = xmalloc(count *sizeof(*notes), "Notes");
memset(notes, 0, count *sizeof(*notes));
return notes;
}
static int sizeof_notes(struct memelfnote *note, int notes)
{
int size;
int i;
size = 0;
for(i = 0; i < notes; i++) {
size += sizeof(Elf_Nhdr);
size += roundup(strlen(note[i].n_name)+1, 4);
size += roundup(note[i].n_descsz, 4);
}
return size;
}
static uint16_t cpu_to_elf16(struct memelfheader *ehdr, uint16_t val)
{
if (ehdr->ei_data == ELFDATA2LSB) {
return cpu_to_le16(val);
}
else if (ehdr->ei_data == ELFDATA2MSB) {
return cpu_to_be16(val);
}
die("Uknown elf layout in cpu_to_elf16");
return 0;
}
static uint32_t cpu_to_elf32(struct memelfheader *ehdr, uint32_t val)
{
if (ehdr->ei_data == ELFDATA2LSB) {
return cpu_to_le32(val);
}
else if (ehdr->ei_data == ELFDATA2MSB) {
return cpu_to_be32(val);
}
die("Uknown elf layout in cpu_to_elf32");
return 0;
}
static uint64_t cpu_to_elf64(struct memelfheader *ehdr, uint64_t val)
{
if (ehdr->ei_data == ELFDATA2LSB) {
return cpu_to_le64(val);
}
else if (ehdr->ei_data == ELFDATA2MSB) {
return cpu_to_be64(val);
}
die("Uknown elf layout in cpu_to_elf64");
return 0;
}
static void serialize_notes(char *buf, struct memelfheader *ehdr)
{
struct Elf_Nhdr hdr;
struct memelfnote *note;
int notes;
size_t size, offset;
int i;
/* Clear the buffer */
note = ehdr->e_notes;
notes = ehdr->e_notenum;
size = sizeof_notes(note, notes);
memset(buf, 0, size);
/* Write the Elf Notes */
offset = 0;
for(i = 0; i < notes; i++) {
/* Compute the note header */
size_t n_namesz;
n_namesz = strlen(note[i].n_name) +1;
hdr.n_namesz = cpu_to_elf32(ehdr, n_namesz);
hdr.n_descsz = cpu_to_elf32(ehdr, note[i].n_descsz);
hdr.n_type = cpu_to_elf32(ehdr, note[i].n_type);
/* Copy the note into the buffer */
memcpy(buf + offset, &hdr, sizeof(hdr));
offset += sizeof(hdr);
memcpy(buf + offset, note[i].n_name, n_namesz);
offset += roundup(n_namesz, 4);
memcpy(buf + offset, note[i].n_desc, note[i].n_descsz);
offset += roundup(note[i].n_descsz, 4);
}
}
static void serialize_ehdr(char *buf, struct memelfheader *ehdr)
{
if (ehdr->ei_class == ELFCLASS32) {
Elf32_Ehdr *hdr = (Elf32_Ehdr *)buf;
hdr->e_ident[EI_MAG0] = ELFMAG0;
hdr->e_ident[EI_MAG1] = ELFMAG1;
hdr->e_ident[EI_MAG2] = ELFMAG2;
hdr->e_ident[EI_MAG3] = ELFMAG3;
hdr->e_ident[EI_CLASS] = ehdr->ei_class;
hdr->e_ident[EI_DATA] = ehdr->ei_data;
hdr->e_ident[EI_VERSION] = EV_CURRENT;
hdr->e_type = cpu_to_elf16(ehdr, ehdr->e_type);
hdr->e_machine = cpu_to_elf16(ehdr, ehdr->e_machine);
hdr->e_version = cpu_to_elf32(ehdr, EV_CURRENT);
hdr->e_entry = cpu_to_elf32(ehdr, ehdr->e_entry);
hdr->e_phoff = cpu_to_elf32(ehdr, sizeof(*hdr));
hdr->e_shoff = cpu_to_elf32(ehdr, 0);
hdr->e_flags = cpu_to_elf32(ehdr, ehdr->e_flags);
hdr->e_ehsize = cpu_to_elf16(ehdr, sizeof(*hdr));
hdr->e_phentsize = cpu_to_elf16(ehdr, sizeof(Elf32_Phdr));
hdr->e_phnum = cpu_to_elf16(ehdr, ehdr->e_phnum);
hdr->e_shentsize = cpu_to_elf16(ehdr, 0);
hdr->e_shnum = cpu_to_elf16(ehdr, 0);
hdr->e_shstrndx = cpu_to_elf16(ehdr, 0);
}
else if (ehdr->ei_class == ELFCLASS64) {
Elf64_Ehdr *hdr = (Elf64_Ehdr *)buf;
hdr->e_ident[EI_MAG0] = ELFMAG0;
hdr->e_ident[EI_MAG1] = ELFMAG1;
hdr->e_ident[EI_MAG2] = ELFMAG2;
hdr->e_ident[EI_MAG3] = ELFMAG3;
hdr->e_ident[EI_CLASS] = ehdr->ei_class;
hdr->e_ident[EI_DATA] = ehdr->ei_data;
hdr->e_ident[EI_VERSION] = EV_CURRENT;
hdr->e_type = cpu_to_elf16(ehdr, ehdr->e_type);
hdr->e_machine = cpu_to_elf16(ehdr, ehdr->e_machine);
hdr->e_version = cpu_to_elf32(ehdr, EV_CURRENT);
hdr->e_entry = cpu_to_elf64(ehdr, ehdr->e_entry);
hdr->e_phoff = cpu_to_elf64(ehdr, sizeof(*hdr));
hdr->e_shoff = cpu_to_elf64(ehdr, 0);
hdr->e_flags = cpu_to_elf32(ehdr, ehdr->e_flags);
hdr->e_ehsize = cpu_to_elf16(ehdr, sizeof(*hdr));
hdr->e_phentsize = cpu_to_elf16(ehdr, sizeof(Elf64_Phdr));
hdr->e_phnum = cpu_to_elf16(ehdr, ehdr->e_phnum);
hdr->e_shentsize = cpu_to_elf16(ehdr, 0);
hdr->e_shnum = cpu_to_elf16(ehdr, 0);
hdr->e_shstrndx = cpu_to_elf16(ehdr, 0);
}
else die("Uknown elf class: %x\n", ehdr->ei_class);
}
static void serialize_phdrs(char *buf, struct memelfheader *ehdr, size_t note_size)
{
int i;
size_t offset, note_offset;
if (ehdr->ei_class == ELFCLASS32) {
Elf32_Phdr *phdr = (Elf32_Phdr *)buf;
note_offset =
sizeof(Elf32_Ehdr) + (sizeof(Elf32_Phdr)*ehdr->e_phnum);
offset = note_offset + note_size;
for(i = 0; i < ehdr->e_phnum; i++) {
struct memelfphdr *hdr = ehdr->e_phdr + i;
phdr[i].p_type = cpu_to_elf32(ehdr, hdr->p_type);
phdr[i].p_offset = cpu_to_elf32(ehdr, offset);
phdr[i].p_vaddr = cpu_to_elf32(ehdr, hdr->p_vaddr);
phdr[i].p_paddr = cpu_to_elf32(ehdr, hdr->p_paddr);
phdr[i].p_filesz = cpu_to_elf32(ehdr, hdr->p_filesz);
phdr[i].p_memsz = cpu_to_elf32(ehdr, hdr->p_memsz);
phdr[i].p_flags = cpu_to_elf32(ehdr, hdr->p_flags);
phdr[i].p_align = cpu_to_elf32(ehdr, 0);
if (phdr[i].p_type == PT_NOTE) {
phdr[i].p_filesz = cpu_to_elf32(ehdr, note_size);
phdr[i].p_memsz = cpu_to_elf32(ehdr, note_size);
phdr[i].p_offset = cpu_to_elf32(ehdr, note_offset);
} else {
offset += hdr->p_filesz;
}
}
}
else if (ehdr->ei_class == ELFCLASS64) {
Elf64_Phdr *phdr = (Elf64_Phdr *)buf;
note_offset =
sizeof(Elf64_Ehdr) + (sizeof(Elf64_Phdr)*ehdr->e_phnum);
offset = note_offset + note_size;
for(i = 0; i < ehdr->e_phnum; i++) {
struct memelfphdr *hdr = ehdr->e_phdr + i;
phdr[i].p_type = cpu_to_elf32(ehdr, hdr->p_type);
phdr[i].p_flags = cpu_to_elf32(ehdr, hdr->p_flags);
phdr[i].p_offset = cpu_to_elf64(ehdr, offset);
phdr[i].p_vaddr = cpu_to_elf64(ehdr, hdr->p_vaddr);
phdr[i].p_paddr = cpu_to_elf64(ehdr, hdr->p_paddr);
phdr[i].p_filesz = cpu_to_elf64(ehdr, hdr->p_filesz);
phdr[i].p_memsz = cpu_to_elf64(ehdr, hdr->p_memsz);
phdr[i].p_align = cpu_to_elf64(ehdr, 0);
if (phdr[i].p_type == PT_NOTE) {
phdr[i].p_filesz = cpu_to_elf64(ehdr, note_size);
phdr[i].p_memsz = cpu_to_elf64(ehdr, note_size);
phdr[i].p_offset = cpu_to_elf64(ehdr, note_offset);
} else {
offset += hdr->p_filesz;
}
}
}
else {
die("Unknwon elf class: %x\n", ehdr->ei_class);
}
}
static void write_buf(int fd, char *buf, size_t size)
{
size_t progress = 0;
ssize_t result;
while(progress < size) {
result = write(fd, buf + progress, size - progress);
if (result < 0) {
if ((errno == EAGAIN) || (errno == EINTR)) {
continue;
}
die ("write of %ld bytes failed: %s\n",
size - progress, strerror(errno));
}
progress += result;
}
}
static void write_elf(struct memelfheader *ehdr, char *output)
{
size_t ehdr_size;
size_t phdr_size;
size_t note_size;
size_t size;
uint16_t checksum;
size_t bytes;
char *buf;
int result, fd;
int i;
/* Prep for adding the checksum */
for(i = 0; i < ehdr->e_notenum; i++) {
if ((memcmp(ehdr->e_notes[i].n_name, "ELFBoot", 8) == 0) &&
(ehdr->e_notes[i].n_type == EIN_PROGRAM_CHECKSUM)) {
ehdr->e_notes[i].n_desc = &checksum;
ehdr->e_notes[i].n_descsz = 2;
}
}
/* Compute the sizes */
ehdr_size = 0;
phdr_size = 0;
note_size = 0;
if (ehdr->e_notenum) {
note_size = sizeof_notes(ehdr->e_notes, ehdr->e_notenum);
}
if (ehdr->ei_class == ELFCLASS32) {
ehdr_size = sizeof(Elf32_Ehdr);
phdr_size = sizeof(Elf32_Phdr) * ehdr->e_phnum;
}
else if (ehdr->ei_class == ELFCLASS64) {
ehdr_size = sizeof(Elf64_Ehdr);
phdr_size = sizeof(Elf64_Phdr) * ehdr->e_phnum;
}
else {
die("Unknown elf class: %x\n", ehdr->ei_class);
}
/* Allocate a buffer to temporarily hold the serialized forms */
size = ehdr_size + phdr_size + note_size;
buf = xmalloc(size, "Elf Headers");
memset(buf, 0, size);
serialize_ehdr(buf, ehdr);
serialize_phdrs(buf + ehdr_size, ehdr, note_size);
/* Compute the checksum... */
checksum = ipchksum(buf, ehdr_size + phdr_size);
bytes = ehdr_size + phdr_size;
for(i = 0; i < ehdr->e_phnum; i++) {
checksum = add_ipchksums(bytes, checksum,
ipchksum(ehdr->e_phdr[i].p_data, ehdr->e_phdr[i].p_filesz));
bytes += ehdr->e_phdr[i].p_memsz;
}
/* Compute the final form of the notes */
serialize_notes(buf + ehdr_size + phdr_size, ehdr);
/* Now write the elf image */
fd = open(output, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IRGRP | S_IROTH);
if (fd < 0) {
die("Cannot open ``%s'':%s\n",
output, strerror(errno));
}
write_buf(fd, buf, size);
for(i = 0; i < ehdr->e_phnum; i++) {
write_buf(fd, ehdr->e_phdr[i].p_data, ehdr->e_phdr[i].p_filesz);
}
result = close(fd);
if (result < 0) {
die("Close on %s failed: %s\n",
output, strerror(errno));
}
}
static void version(void)
{
printf("mkelfImage " VERSION " released " RELEASE_DATE "\n");
}
void usage(void)
{
int i;
version();
printf(
"Usage: mkelfImage [OPTION]... <kernel> <elf_kernel>\n"
"Build an ELF bootable kernel image from a normal kernel image\n"
"\n"
" -h, --help Print this help.\n"
" -v, --version Print the version of kexec.\n"
" --kernel=<filename> Set the kernel to <filename>\n"
" --output=<filename> Output to <filename>\n"
" -t, --type=TYPE Specify the new kernel is of <type>.\n"
"\n"
"Supported kernel types: \n"
);
for(i = 0; i < file_types; i++) {
printf("%s\n", file_type[i].name);
file_type[i].usage();
}
printf("\n");
}
void error(char *fmt, ...)
{
va_list args;
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
usage();
exit(1);
}
int main(int argc, char **argv)
{
int opt;
int fileind;
char *type, *kernel, *output;
off_t kernel_size;
char *kernel_buf;
int result;
int i;
struct memelfheader hdr;
static const struct option options[] = {
MKELF_OPTIONS
{ 0, 0, 0, 0 },
};
static const char short_options[] = MKELF_OPT_STR;
memset(&hdr, 0, sizeof(hdr));
kernel = 0;
output = 0;
/* Get the default type from the program name */
type = strrchr(argv[0], '/');
if (!type) type = argv[0];
if (memcmp(type, "mkelf-", 6) == 0) {
type = type + 6;
} else {
type = 0;
}
opterr = 0; /* Don't complain about unrecognized options here */
while ((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
switch(opt) {
case OPT_HELP:
usage();
return 0;
case OPT_VERSION:
version();
return 0;
case OPT_KERNEL:
kernel = optarg;
break;
case OPT_OUTPUT:
output = optarg;
break;
case OPT_TYPE:
type = optarg;
break;
default:
break;
}
}
fileind = optind;
/* Reset getopt for the next pass */
opterr = 1;
optind = 1;
if (argc - fileind > 0) {
kernel = argv[fileind++];
}
if (argc - fileind > 0) {
output = argv[fileind++];
}
if (!kernel) {
error("No kernel specified!\n");
}
if (!output) {
error("No output file specified!\n");
}
if (argc - fileind > 0) {
error("%d extra options specified!\n", argc - fileind);
}
/* slurp in the input kernel */
kernel_buf = slurp_decompress_file(kernel, &kernel_size);
/* Find/verify the kernel type */
for(i = 0; i < file_types; i++) {
char *reason;
if (type && (strcmp(type, file_type[i].name) != 0)) {
continue;
}
reason = file_type[i].probe(kernel_buf, kernel_size);
if (reason == 0) {
break;
}
if (type) {
die("Not %s: %s\n", type, reason);
}
}
if (i == file_types) {
die("Can not determine the file type of %s\n", kernel);
}
result = file_type[i].mkelf(argc, argv, &hdr, kernel_buf, kernel_size);
if (result < 0) {
die("Cannot create %s result: %d\n", output, result);
}
/* open the output file */
write_elf(&hdr, output);
return 0;
}

View File

@ -0,0 +1,166 @@
.\" Automatically generated by Pod::Man v1.3, Pod::Parser v1.13
.\" But now manually maintained
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. | will give a
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.\"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "MKELFIMAGE 8"
.TH MKELFIMAGE 8 "RELEASE_DATE" "VERSION"
.UC
.SH "NAME"
mkelfImage \- make an elf network bootable image for linux
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
\&\fBmkelfImage\fR [\-\-command\-line=\fIcommand line\fR] [\-\-kernel=\fIpath to vmlinux\fR] [\-\-ramdisk=\fIpath to ramdisk\fR] [\-\-output=\fIfile\fR] [\-\-ramdisk\-base=<start addr>]
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
\&\fBmkelfImage\fR is a program that makes a elf boot image for linux kernel
images. The image should work with any i386 multiboot compliant boot loader,
an \s-1ELF\s0 bootloader that passes no options, a loader compliant with the linuxBIOS
elf booting spec or with the linux kexec kernel patch. A key feature
here is that nothing relies upon \s-1BIOS\s0 calls, but they are made when
necessary. This is useful for systems running linuxbios.
.SH "BUGS"
.IX Header "BUGS"
Not all kernel parameters can be passed with the multiboot image format.
ip configuration is not automatically passed to a node.
The ramdisk base is hard coded to 8MB by default.
This man page need to be updated.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
The kexec kernel patch.
LinuxBIOS.
Etherboot.
The multiboot standard.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
mkelfImage is under the \s-1GNU\s0 Public License version 2
.SH "AUTHOR"
.IX Header "AUTHOR"
Eric Biederman <ebiederman@lnxi.com>

View File

@ -0,0 +1,50 @@
Summary: make an elf network bootable image for linux
Name: mkelfImage
Version:
Release: 0
Copyright: GPL
Group: Development/Tools
Source0:%{name}-%{version}.tar.gz
Packager: Andrew Ip <aip@cwlinux.com>
BuildRoot: %{_tmppath}/%{name}
%description
mkelfImage is a program that makes a elf boot image for linux kernel images.
The image should work with any i386 multiboot compliant boot loader, an ELF boot
loader that passes no options, a loader compliant with the linuxBIOS elf booting
spec or with the linux kexec kernel patch. A key feature here is that nothing
relies upon BIOS calls, but they are made when necessary. This is useful for
systems running linuxbios.
%prep
%setup -q -n %{name}-%{version}
%build
%configure
make
%install
make install DESTDIR=${RPM_BUILD_ROOT}
%files
%defattr(-,root,root)
%{_sbindir}/mkelfImage
%doc News
%doc COPYING
%doc AUTHORS
%{_mandir}/man8/mkelfImage.8.gz
%changelog
* Mon Jan 13 2003 Eric Biederman <ebiederman@lnxi.com>
- Move the man page into section 8 as mkelfImage lives in sbin
* Mon Aug 26 2002 Joshua Aune <luken@linuxnetworx.com> 1.15-1
- New version
- Merge distro and Eric's spec file
* Fri Aug 23 2002 Eric Biederman <ebiederman@lnxi.com>
- Simplified and incorporated into mkelfImage
* Sat Aug 10 2002 Andrew Ip <aip@cwlinux.com>
- Initial release

View File

@ -0,0 +1,3 @@
$(OBJDIR)/bin/bin-to-hex: util/bin-to-hex.c
$(MKDIR) -p $(@D)
$(HOST_CC) $(HOST_CFLAGS) $< -o $@

View File

@ -0,0 +1,20 @@
#include <stdio.h>
int main(int argc, char **argv)
{
int c;
int i;
i = 0;
while((c = getchar()) != EOF) {
if ((i % 16) != 0) {
putchar(' ');
}
printf("0x%02x,", c);
i++;
if ((i %16) == 0) {
putchar('\n');
}
}
putchar('\n');
return 0;
}