[Debootloaders-devel] r185 - in branches/vendor: . emile emile/docs emile/first emile/libblock emile/libcontainer emile/libemile emile/libfloppy emile/libgzip emile/libiso9660 emile/libmacos emile/libmacos/macos emile/libscsi emile/libstream emile/libunix emile/second emile/tools

Wouter Verhelst wouter at alioth.debian.org
Wed Apr 11 20:20:49 UTC 2007


Author: wouter
Date: 2007-04-11 20:20:42 +0000 (Wed, 11 Apr 2007)
New Revision: 185

Added:
   branches/vendor/emile/
   branches/vendor/emile/AUTHORS
   branches/vendor/emile/COPYING
   branches/vendor/emile/ChangeLog
   branches/vendor/emile/Makefile
   branches/vendor/emile/README
   branches/vendor/emile/README.floppy
   branches/vendor/emile/README.scsi
   branches/vendor/emile/Rules.mk
   branches/vendor/emile/docs/
   branches/vendor/emile/docs/Makefile
   branches/vendor/emile/docs/emile-first-tune.sgml
   branches/vendor/emile/docs/emile-install.sgml
   branches/vendor/emile/docs/emile-map-set.sgml
   branches/vendor/emile/docs/emile-set-cmdline.sgml
   branches/vendor/emile/docs/emile-set-output.sgml
   branches/vendor/emile/docs/emile.sgml
   branches/vendor/emile/first/
   branches/vendor/emile/first/32bitmode.i
   branches/vendor/emile/first/Makefile
   branches/vendor/emile/first/first.S
   branches/vendor/emile/first/floppy.i
   branches/vendor/emile/first/macos.i
   branches/vendor/emile/first/scsi.i
   branches/vendor/emile/libblock/
   branches/vendor/emile/libblock/Makefile
   branches/vendor/emile/libblock/block_close.c
   branches/vendor/emile/libblock/block_fstat.c
   branches/vendor/emile/libblock/block_lseek.c
   branches/vendor/emile/libblock/block_open.c
   branches/vendor/emile/libblock/block_read.c
   branches/vendor/emile/libblock/libblock.h
   branches/vendor/emile/libcontainer/
   branches/vendor/emile/libcontainer/Makefile
   branches/vendor/emile/libcontainer/container_close.c
   branches/vendor/emile/libcontainer/container_fstat.c
   branches/vendor/emile/libcontainer/container_lseek.c
   branches/vendor/emile/libcontainer/container_open.c
   branches/vendor/emile/libcontainer/container_read.c
   branches/vendor/emile/libcontainer/libcontainer.h
   branches/vendor/emile/libemile/
   branches/vendor/emile/libemile/Makefile
   branches/vendor/emile/libemile/bootblock.h
   branches/vendor/emile/libemile/emile.h
   branches/vendor/emile/libemile/emile_block0_write.c
   branches/vendor/emile/libemile/emile_checksum.c
   branches/vendor/emile/libemile/emile_first_get_param.c
   branches/vendor/emile/libemile/emile_first_set_param.c
   branches/vendor/emile/libemile/emile_first_set_param_scsi.c
   branches/vendor/emile/libemile/emile_floppy_create_image.c
   branches/vendor/emile/libemile/emile_map_bootblock_get_type.c
   branches/vendor/emile/libemile/emile_map_bootblock_is_valid.c
   branches/vendor/emile/libemile/emile_map_bootblock_read.c
   branches/vendor/emile/libemile/emile_map_bootblock_write.c
   branches/vendor/emile/libemile/emile_map_close.c
   branches/vendor/emile/libemile/emile_map_dev.c
   branches/vendor/emile/libemile/emile_map_geometry.c
   branches/vendor/emile/libemile/emile_map_get_bootinfo.c
   branches/vendor/emile/libemile/emile_map_get_driver_info.c
   branches/vendor/emile/libemile/emile_map_get_driver_number.c
   branches/vendor/emile/libemile/emile_map_get_number.c
   branches/vendor/emile/libemile/emile_map_get_partition_geometry.c
   branches/vendor/emile/libemile/emile_map_get_partition_name.c
   branches/vendor/emile/libemile/emile_map_get_partition_type.c
   branches/vendor/emile/libemile/emile_map_has_apple_driver.c
   branches/vendor/emile/libemile/emile_map_is_valid.c
   branches/vendor/emile/libemile/emile_map_open.c
   branches/vendor/emile/libemile/emile_map_partition_get_flags.c
   branches/vendor/emile/libemile/emile_map_partition_is_bootable.c
   branches/vendor/emile/libemile/emile_map_partition_is_startup.c
   branches/vendor/emile/libemile/emile_map_partition_is_valid.c
   branches/vendor/emile/libemile/emile_map_partition_set_bootable.c
   branches/vendor/emile/libemile/emile_map_partition_set_flags.c
   branches/vendor/emile/libemile/emile_map_partition_set_startup.c
   branches/vendor/emile/libemile/emile_map_read.c
   branches/vendor/emile/libemile/emile_map_seek_driver_partition.c
   branches/vendor/emile/libemile/emile_map_set_bootinfo.c
   branches/vendor/emile/libemile/emile_map_set_driver_info.c
   branches/vendor/emile/libemile/emile_map_set_driver_number.c
   branches/vendor/emile/libemile/emile_map_set_partition_name.c
   branches/vendor/emile/libemile/emile_map_set_partition_type.c
   branches/vendor/emile/libemile/emile_map_set_startup.c
   branches/vendor/emile/libemile/emile_map_write.c
   branches/vendor/emile/libemile/emile_scsi_create_container.c
   branches/vendor/emile/libemile/emile_scsi_get_dev.c
   branches/vendor/emile/libemile/emile_scsi_get_rdev.c
   branches/vendor/emile/libemile/emile_second_create_mapfile.c
   branches/vendor/emile/libemile/emile_second_get_configuration.c
   branches/vendor/emile/libemile/emile_second_get_next_property.c
   branches/vendor/emile/libemile/emile_second_get_property.c
   branches/vendor/emile/libemile/emile_second_remove_property.c
   branches/vendor/emile/libemile/emile_second_set_configuration.c
   branches/vendor/emile/libemile/emile_second_set_property.c
   branches/vendor/emile/libemile/libemile.h
   branches/vendor/emile/libemile/partition.h
   branches/vendor/emile/libfloppy/
   branches/vendor/emile/libfloppy/Makefile
   branches/vendor/emile/libfloppy/floppy_close.c
   branches/vendor/emile/libfloppy/floppy_get_blocksize.c
   branches/vendor/emile/libfloppy/floppy_open.c
   branches/vendor/emile/libfloppy/floppy_read_sector.c
   branches/vendor/emile/libfloppy/libfloppy.h
   branches/vendor/emile/libgzip/
   branches/vendor/emile/libgzip/Makefile
   branches/vendor/emile/libgzip/adler32.c
   branches/vendor/emile/libgzip/crc32.c
   branches/vendor/emile/libgzip/deflate.h
   branches/vendor/emile/libgzip/inffast.c
   branches/vendor/emile/libgzip/inffast.h
   branches/vendor/emile/libgzip/inflate.c
   branches/vendor/emile/libgzip/inflate.h
   branches/vendor/emile/libgzip/inftrees.c
   branches/vendor/emile/libgzip/inftrees.h
   branches/vendor/emile/libgzip/zconf.h
   branches/vendor/emile/libgzip/zlib.h
   branches/vendor/emile/libgzip/zutil.c
   branches/vendor/emile/libgzip/zutil.h
   branches/vendor/emile/libiso9660/
   branches/vendor/emile/libiso9660/Makefile
   branches/vendor/emile/libiso9660/iso9660_close.c
   branches/vendor/emile/libiso9660/iso9660_closedir.c
   branches/vendor/emile/libiso9660/iso9660_fstat.c
   branches/vendor/emile/libiso9660/iso9660_is_directory.c
   branches/vendor/emile/libiso9660/iso9660_lseek.c
   branches/vendor/emile/libiso9660/iso9660_mount.c
   branches/vendor/emile/libiso9660/iso9660_open.c
   branches/vendor/emile/libiso9660/iso9660_opendir.c
   branches/vendor/emile/libiso9660/iso9660_read.c
   branches/vendor/emile/libiso9660/iso9660_readdir.c
   branches/vendor/emile/libiso9660/libiso9660.h
   branches/vendor/emile/libmacos/
   branches/vendor/emile/libmacos/CloseDriver.c
   branches/vendor/emile/libmacos/Makefile
   branches/vendor/emile/libmacos/OpenDriver.c
   branches/vendor/emile/libmacos/SerGetBuf.c
   branches/vendor/emile/libmacos/display_properties.S
   branches/vendor/emile/libmacos/libmacos.h
   branches/vendor/emile/libmacos/macos/
   branches/vendor/emile/libmacos/macos/devices.h
   branches/vendor/emile/libmacos/macos/errors.h
   branches/vendor/emile/libmacos/macos/events.h
   branches/vendor/emile/libmacos/macos/files.h
   branches/vendor/emile/libmacos/macos/gestalt.h
   branches/vendor/emile/libmacos/macos/init.h
   branches/vendor/emile/libmacos/macos/lowmem.h
   branches/vendor/emile/libmacos/macos/memory.h
   branches/vendor/emile/libmacos/macos/osutils.h
   branches/vendor/emile/libmacos/macos/quickdraw.h
   branches/vendor/emile/libmacos/macos/romdefs.h
   branches/vendor/emile/libmacos/macos/scsi.h
   branches/vendor/emile/libmacos/macos/serial.h
   branches/vendor/emile/libmacos/macos/slotmanager.h
   branches/vendor/emile/libmacos/macos/traps.h
   branches/vendor/emile/libmacos/macos/types.h
   branches/vendor/emile/libmacos/macos/video.h
   branches/vendor/emile/libscsi/
   branches/vendor/emile/libscsi/Makefile
   branches/vendor/emile/libscsi/libscsi.h
   branches/vendor/emile/libscsi/scsi_INQUIRY.c
   branches/vendor/emile/libscsi/scsi_READ.c
   branches/vendor/emile/libscsi/scsi_READ_CAPACITY.c
   branches/vendor/emile/libscsi/scsi_close.c
   branches/vendor/emile/libscsi/scsi_command.c
   branches/vendor/emile/libscsi/scsi_get_blocksize.c
   branches/vendor/emile/libscsi/scsi_open.c
   branches/vendor/emile/libscsi/scsi_read_sector.c
   branches/vendor/emile/libstream/
   branches/vendor/emile/libstream/Makefile
   branches/vendor/emile/libstream/gzio.c
   branches/vendor/emile/libstream/libstream.h
   branches/vendor/emile/libstream/stream_close.c
   branches/vendor/emile/libstream/stream_fstat.c
   branches/vendor/emile/libstream/stream_lseek.c
   branches/vendor/emile/libstream/stream_open.c
   branches/vendor/emile/libstream/stream_read.c
   branches/vendor/emile/libstream/stream_uncompress.c
   branches/vendor/emile/libunix/
   branches/vendor/emile/libunix/Makefile
   branches/vendor/emile/libunix/divsi3.S
   branches/vendor/emile/libunix/free.c
   branches/vendor/emile/libunix/malloc.c
   branches/vendor/emile/libunix/memcpy.c
   branches/vendor/emile/libunix/memset.c
   branches/vendor/emile/libunix/modsi3.S
   branches/vendor/emile/libunix/mulsi3.S
   branches/vendor/emile/libunix/printf.c
   branches/vendor/emile/libunix/putchar.c
   branches/vendor/emile/libunix/puts.c
   branches/vendor/emile/libunix/read.c
   branches/vendor/emile/libunix/sprintf.c
   branches/vendor/emile/libunix/strcmp.c
   branches/vendor/emile/libunix/strcpy.c
   branches/vendor/emile/libunix/strlen.c
   branches/vendor/emile/libunix/strncmp.c
   branches/vendor/emile/libunix/strncpy.c
   branches/vendor/emile/libunix/strtol.c
   branches/vendor/emile/libunix/udivsi3.S
   branches/vendor/emile/libunix/umodsi3.S
   branches/vendor/emile/libunix/vsprintf.c
   branches/vendor/emile/libunix/write.c
   branches/vendor/emile/second/
   branches/vendor/emile/second/MMU030.c
   branches/vendor/emile/second/MMU030.h
   branches/vendor/emile/second/MMU030_asm.S
   branches/vendor/emile/second/MMU040.c
   branches/vendor/emile/second/MMU040.h
   branches/vendor/emile/second/MMU040_asm.S
   branches/vendor/emile/second/Makefile
   branches/vendor/emile/second/PPC_asm.S
   branches/vendor/emile/second/arch.c
   branches/vendor/emile/second/arch.h
   branches/vendor/emile/second/bank.c
   branches/vendor/emile/second/bank.h
   branches/vendor/emile/second/bootenv.c
   branches/vendor/emile/second/bootenv.h
   branches/vendor/emile/second/bootinfo.c
   branches/vendor/emile/second/bootinfo.h
   branches/vendor/emile/second/bootx.c
   branches/vendor/emile/second/bootx.h
   branches/vendor/emile/second/cli.c
   branches/vendor/emile/second/cli.h
   branches/vendor/emile/second/config.c
   branches/vendor/emile/second/config.h
   branches/vendor/emile/second/console.c
   branches/vendor/emile/second/console.h
   branches/vendor/emile/second/copymem.i
   branches/vendor/emile/second/driver.c
   branches/vendor/emile/second/driver.h
   branches/vendor/emile/second/enter_kernel.c
   branches/vendor/emile/second/enter_kernel.h
   branches/vendor/emile/second/enter_kernel030.S
   branches/vendor/emile/second/enter_kernel030.h
   branches/vendor/emile/second/enter_kernel040.S
   branches/vendor/emile/second/enter_kernel040.h
   branches/vendor/emile/second/enter_kernelPPC.S
   branches/vendor/emile/second/enter_kernelPPC.h
   branches/vendor/emile/second/enter_kernelnoMMU.S
   branches/vendor/emile/second/enter_kernelnoMMU.h
   branches/vendor/emile/second/font_8x16.c
   branches/vendor/emile/second/head.S
   branches/vendor/emile/second/head.h
   branches/vendor/emile/second/keyboard.c
   branches/vendor/emile/second/keyboard.h
   branches/vendor/emile/second/ld.script
   branches/vendor/emile/second/load.c
   branches/vendor/emile/second/load.h
   branches/vendor/emile/second/main.c
   branches/vendor/emile/second/misc.c
   branches/vendor/emile/second/misc.h
   branches/vendor/emile/second/serial.c
   branches/vendor/emile/second/serial.h
   branches/vendor/emile/second/vga.c
   branches/vendor/emile/second/vga.h
   branches/vendor/emile/tools/
   branches/vendor/emile/tools/Makefile
   branches/vendor/emile/tools/device.c
   branches/vendor/emile/tools/device.h
   branches/vendor/emile/tools/emile-first-tune.c
   branches/vendor/emile/tools/emile-install.c
   branches/vendor/emile/tools/emile-map-set.c
   branches/vendor/emile/tools/emile-set-cmdline.c
   branches/vendor/emile/tools/emile-set-output.c
   branches/vendor/emile/tools/emile.c
   branches/vendor/emile/tools/emile_scanbus.c
   branches/vendor/emile/tools/gzio.c
   branches/vendor/emile/tools/iso9660_cat.c
   branches/vendor/emile/tools/iso9660_ls.c
   branches/vendor/emile/tools/minigzip.c
   branches/vendor/emile/tools/read_vmlinuz.c
Log:
Add emile vendor source

Added: branches/vendor/emile/AUTHORS
===================================================================
--- branches/vendor/emile/AUTHORS	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/AUTHORS	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1 @@
+Laurent Vivier <LaurentVivier at wanadoo.fr>

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

Added: branches/vendor/emile/ChangeLog
===================================================================
--- branches/vendor/emile/ChangeLog	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/ChangeLog	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,3343 @@
+2005-12-05 21:08  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/Makefile: remove unneeded DISTFILES
+
+2005-12-05 20:59  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libcontainer/: container_open.c, container_read.c,
+	  libcontainer.h: make algorith simplier
+
+2005-12-05 20:58  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_scsi_create_container.c,
+	  emile_second_create_mapfile.c: clear mallocated memory
+
+2005-12-05 20:57  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/load.c: add 0%, check return of seek()
+
+2005-12-05 20:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: remove banner and some traces
+
+2005-12-05 20:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/enter_kernel.c: Remove traces (MMU type)
+
+2005-12-05 20:52  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-set-output.c: Can change output on second_scsi too
+
+2005-12-02 20:52  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: RELEASE Â0.10
+
+2005-12-02 20:08  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* ChangeLog: RELEASE 0.10
+
+2005-12-02 20:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/load.c: Add a progress bar
+
+2005-12-02 02:19  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/load.c: check return value of stream_read()
+
+2005-12-02 02:18  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_first_set_param_scsi.c: remove traces
+
+2005-12-02 02:17  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_second_create_mapfile.c: mapfile size is the size
+	  of the filesystem blocksize
+
+2005-12-02 01:49  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libcontainer/container_open.c: initialize the field device
+
+2005-12-02 01:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libcontainer/: libcontainer.h, container_read.c: device is a
+	  pointer
+
+2005-12-02 01:37  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_second_create_mapfile.c: write mapfile even if it
+	  already exists
+
+2005-12-02 01:14  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: Add vga parameter by default in configuration
+
+2005-12-02 00:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/scsi.i: Correctly set unit id
+
+2005-12-01 23:57  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: remove unused buffer_size
+
+2005-12-01 23:20  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add libcontainer
+
+2005-12-01 23:19  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_first_set_param_scsi.c:  change interface of
+	  emile_scsi_create_container()
+
+2005-12-01 23:17  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/stream_open.c: Correct use of libcontainer
+
+2005-12-01 23:16  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile, libstream/Makefile: Add libcontainer
+
+2005-12-01 23:16  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c, libemile/libemile.h,
+	  libemile/emile_second_create_mapfile.c,
+	  libemile/emile_scsi_create_container.c:  change interface of
+	  emile_second_create_mapfile()
+
+2005-12-01 23:14  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libcontainer/: container_close.c, container_fstat.c,
+	  container_lseek.c, container_open.c, container_read.c: first
+	  revision
+
+2005-12-01 23:13  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libcontainer/Makefile: Add fstat, remove cross-compiling (other
+	  than m68k)
+
+2005-12-01 23:12  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libcontainer/libcontainer.h: Add open, read, close, lseek, fstat
+
+2005-12-01 15:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libcontainer/Makefile: first revision
+
+2005-12-01 14:52  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libiso9660/Makefile: Remove DISTFILES, set in Rules.mk
+
+2005-12-01 14:52  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: some cleanups for dist
+
+2005-12-01 14:51  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/Makefile: Add device.c gzio.c in SOURCES, device.h in
+	  HEADERS, silent dist
+
+2005-12-01 14:49  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add --no-print-directory, silent dist, and add several
+	  subdirs in dist
+
+2005-12-01 14:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Rules.mk: Silent dist
+
+2005-12-01 07:16  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: create last.bin for cdboot-*.bin
+
+2005-11-30 17:18  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: clean cdboot-*.bin
+
+2005-11-30 16:34  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Create floppy reading files on CDROM
+
+2005-11-30 16:33  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_floppy_create_image.c: Manage file-by-name (url)
+	  and not -by-content
+
+2005-11-30 16:31  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-install.c: update copyright
+
+2005-11-30 01:54  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile, libgzip/Makefile, libiso9660/Makefile: Add
+	  CROSS_COMPILE
+
+2005-11-30 01:41  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Rules.mk: Correct clean MANPAGES
+
+2005-11-30 01:33  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: all_bin should generate second/m68k-linux-scsi/second
+
+2005-11-30 01:27  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Rules.mk, docs/Makefile: put SGML in SOURCES
+
+2005-11-30 01:20  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Rules.mk: remove trace
+
+2005-11-30 01:15  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Rules.mk: correctly extract name of module from pwd, correct
+	  problem with make dist
+
+2005-11-30 01:04  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/scsi.i: really set the scsi unit id for SCSISelect()
+
+2005-11-30 01:04  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_first_set_param_scsi.c: move to UM06
+
+2005-11-30 00:49  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add docs in all
+
+2005-11-30 00:46  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libcontainer/libcontainer.h: remove block_size and max_blocks,
+	  add size
+
+2005-11-30 00:46  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_scsi_get_dev.c: Add support for /dev/hd
+
+2005-11-30 00:44  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: correct typo for --map
+
+2005-11-30 00:30  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_second_create_mapfile.c,
+	  libemile/emile_second_set_kernel_scsi.c, tools/emile.c: move to
+	  EM06
+
+2005-11-30 00:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/Makefile: add emile_second_create_mapfile.c
+
+2005-11-30 00:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_scsi_create_container.c:  remove max_blocks form
+	  container, add it in parameters, add real file size in container
+
+2005-11-30 00:28  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/libemile.h: Add emile_second_create_mapfile(), remove
+	  emile_second_set_kernel_scsi()
+
+2005-11-29 01:21  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libmacos/Makefile: Remove typo (macos/header)
+
+2005-11-29 01:20  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: add docs in .PHONY
+
+2005-11-29 01:18  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: remove lowmem.h and memory.h, moved to libmacos
+
+2005-11-29 01:15  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: temporarily disable scsi creation, obsoleted by
+	  EM06
+
+2005-11-29 01:14  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libcontainer/libcontainer.h: moved from libemile
+
+2005-11-29 00:57  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/container.S: Obsoleted by EM06
+
+2005-11-29 00:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/config.c: read_line() : do not cross the the end of the
+	  configuration (0-mark), remove traces about kernel and initrd
+
+2005-11-29 00:39  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-set-output.c: Use EM06 header
+
+2005-11-29 00:21  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/console.c: add read_config_vga()
+
+2005-11-29 00:20  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: config.c, config.h, head.h, serial.c: Manage stopbits
+	  for serial, put parameters on a line alone, not inside kernel
+	  property
+
+2005-11-29 00:18  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_second_get_next_property.c,
+	  emile_second_remove_property.c, emile_second_set_property.c:
+	  correct management of end of line at end of configuration
+
+2005-11-28 22:35  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_second_get_next_property.c,
+	  emile_second_get_property.c, emile_second_set_property.c: Add
+	  copyright
+
+2005-11-28 22:35  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: Makefile, emile_second_remove_property.c, libemile.h:
+	  Add emile_second_remove_property()
+
+2005-11-28 22:19  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_floppy_create_image.c: Add vga parameter
+
+2005-11-28 21:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-set-cmdline.c: Manage new header (EM06)
+
+2005-11-28 21:55  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_second_get_next_property.c,
+	  emile_second_get_property.c, emile_second_set_property.c: Add new
+	  functions for EM06
+
+2005-11-28 21:54  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_second_get_configuration.c,
+	  emile_second_set_configuration.c: Check header signature
+
+2005-11-28 21:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: Makefile, emile_second_get_kernel.c, libemile.h:
+	  remove functions obsoleted by EM06, add new functions for EM06
+
+2005-11-28 13:00  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile.h: CVS test
+
+2005-11-28 12:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_get_uncompressed_size.c: remove function obsoleted
+	  by EM06
+
+2005-11-28 12:52  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_second_set_cmdline.c, emile_second_get_output.c:
+	  remove function obsoleted by EM06
+
+2005-11-28 12:49  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_second_get_cmdline.c, emile_second_set_output.c:
+	  remove function obsoleted by EM06
+
+2005-11-28 12:45  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_second_get_buffer_size.c: remove function
+	  obsoleted by EM06
+
+2005-11-28 01:20  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/libemile.h: remove function obsoleted by EM06
+
+2005-11-28 01:19  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-install.c: modified for EM06
+
+2005-11-28 01:16  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_second_set_buffer_size.c,
+	  emile_second_set_kernel.c: obsoleted by EM06
+
+2005-11-28 01:15  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/config.c: Correct case where there is no parameter for the
+	  kernel
+
+2005-11-28 00:50  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_floppy_create_image.c: manage if kernel/ramdisk
+	  are missing
+
+2005-11-28 00:45  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_second_get_configuration.c,
+	  emile_second_set_configuration.c, emile_floppy_create_image.c,
+	  libemile.h: EM06 header
+
+2005-11-27 23:37  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/Makefile: remove -m68000
+
+2005-11-27 23:31  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: head.h, config.c, config.h, head.S, serial.c, console.c:
+	  EM06 header type: all is stored as text
+
+2005-11-26 19:30  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libiso9660/iso9660_mount.c: more gcc compliant ucs_level init
+
+2005-11-26 19:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libunix/strtol.c: define strtol with __strol_internal
+
+2005-11-26 19:28  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libscsi/Makefile, libblock/Makefile, libfloppy/Makefile,
+	  libiso9660/Makefile, libstream/Makefile, libunix/Makefile,
+	  libgzip/Makefile: Add -m68000
+
+2005-11-26 10:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/config.c: Don't print ramdisk if NULL
+
+2005-11-26 10:21  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Rules.mk: Change librarie rules
+
+2005-11-26 10:21  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: remove explicit passing of make variable
+
+2005-11-26 10:02  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: config.c, config.h: Read configuration
+
+2005-11-26 10:01  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Add config.c, remove ata, add LIBS_MEDIA
+
+2005-11-26 10:00  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/load.c: correct print format
+
+2005-11-26 09:59  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: use new interface to read config and to load
+	  kernel and ramdisk
+
+2005-11-26 09:59  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.h: move container to libcontainer
+
+2005-11-26 09:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/Makefile:  create libstream in hard/ and floppy/
+
+2005-11-26 09:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/stream_open.c: Add *_SUPPORT #ifdef
+
+2005-11-26 09:51  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/gzio.c: umount only if umount exists
+
+2005-11-26 09:47  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libiso9660/Makefile: use make -C instead of cd && make
+
+2005-11-26 09:45  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: Makefile, libemile.h: add libcontainer and libstream
+	  include path
+
+2005-11-26 09:44  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libblock/block_read.c: Correct read_sector call (provide
+	  device->data instead of device)
+
+2005-11-26 09:43  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libblock/block_open.c: Correct size part decoding in filename
+
+2005-11-26 09:41  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/Makefile: add -I../libcontainer for libstream
+
+2005-11-26 09:40  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/minigzip.c: Add gzopen() prototype
+
+2005-11-26 09:40  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/read_vmlinuz.c: Add gzopen() prototype and correct some
+	  printf format
+
+2005-11-25 20:54  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/Makefile: Add 32mode.i, change flags management
+
+2005-11-25 20:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/: 32bitmode.i, first.S: Move 32bit switch to 32bitmode.i
+
+2005-11-23 23:46  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: use ELF kernel, add some libs...
+
+2005-11-23 23:44  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: correct libs ordering, add libblock
+
+2005-11-23 23:43  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: load.h, load.c:  correct load_ramdisk()
+
+2005-11-23 23:41  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libunix/: Makefile, strtol.c: add strtol
+
+2005-11-23 23:39  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libblock/: Makefile, block_close.c, block_fstat.c, block_lseek.c,
+	  block_open.c, block_read.c, libblock.h: first revision
+
+2005-11-23 23:37  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/: libstream.h, stream_open.c: Add get_size() of devices
+
+2005-11-23 23:36  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libfloppy/: Makefile, floppy_get_blocksize.c, libfloppy.h: add
+	  floppy_get_blocksize()
+
+2005-11-23 23:35  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libscsi/: Makefile, libscsi.h, scsi_get_blocksize.c:	add
+	  scsi_get_blocksize()
+
+2005-11-23 01:12  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/load.h: Add load_ramdisk(), remove load_image() and
+	  load_gzip()
+
+2005-11-23 01:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/load.c: Add load_ramdisk()
+
+2005-11-23 01:10  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libiso9660/: Makefile, iso9660_fstat.c, libiso9660.h: Add
+	  iso9660_fstat()
+
+2005-11-23 01:09  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/: Makefile, libstream.h, stream_fstat.c, stream_open.c:
+	  Add stream_fstat()
+
+2005-11-23 00:20  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Add libisio9660, libstream, libgzip, libfloppy,
+	  libscsi...
+
+2005-11-23 00:18  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/load.h:  add load_kernel()
+
+2005-11-23 00:17  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/load.c: Use libstream and decode ELF format
+
+2005-11-23 00:16  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/gzio.c: moved to libstream
+
+2005-11-23 00:14  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/Makefile: Add gzio.c and stream_uncompress.c
+
+2005-11-23 00:14  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/stream_uncompress.c: Uncompress a stream on-the-fly
+
+2005-11-23 00:14  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/gzio.c: moved from second/gzio.c
+
+2005-11-23 00:13  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/libstream.h: add stream_read(), stream_lseek() and
+	  stream_uncompress
+
+2005-11-23 00:12  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/stream_close.c: Check function is defined before using
+	  it
+
+2005-11-23 00:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/stream_open.c: Add some error strings
+
+2005-11-22 01:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libscsi/: Makefile, libscsi.h, scsi_READ_CAPACITY.c, scsi_open.c:
+	  Read the capacity of the disk and the sector size
+
+2005-11-22 00:55  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/: Makefile, stream_close.c, stream_lseek.c,
+	  stream_open.c, stream_read.c: First revision
+
+2005-11-22 00:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libfloppy/libfloppy.h: prevent multiple includes
+
+2005-11-22 00:52  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/libstream.h: add volume information in fs
+
+2005-11-21 23:09  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/Makefile: Add libstream
+
+2005-11-21 23:09  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/: device.c, device.h: Add libstream-like interface
+
+2005-11-21 23:07  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libiso9660/Makefile, libiso9660/iso9660_init.c,
+	  libiso9660/iso9660_lseek.c, libiso9660/iso9660_mount.c,
+	  libiso9660/iso9660_open.c, libiso9660/iso9660_opendir.c,
+	  libiso9660/iso9660_read.c, libiso9660/iso9660_readdir.c,
+	  libiso9660/libiso9660.h, tools/iso9660_cat.c, tools/iso9660_ls.c:
+	  Add iso9660_VOLUME
+
+2005-11-21 23:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libstream/libstream.h: first revision
+
+2005-11-21 22:58  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libmacos/macos/scsi.h: Add include macos/types.h
+
+2005-11-21 22:57  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libscsi/: scsi_close.c, scsi_open.c: Add copyright
+
+2005-11-21 22:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libscsi/: libscsi.h, scsi_read_sector.c: Add scsi_device_t
+
+2005-11-21 22:55  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libscsi/: Makefile, scsi_close.c, scsi_open.c: Add scsi_close()
+	  and scsi_open()
+
+2005-11-21 22:50  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libfloppy/: floppy_close.c, floppy_open.c: Add floppy_close() and
+	  floppy_open()
+
+2005-11-21 22:26  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libfloppy/: Makefile, floppy_lseek.c, floppy_read.c,
+	  floppy_read_sector.c, libfloppy.h: move upperlevel function to
+	  libblock, add floppy_device_t
+
+2005-11-21 22:18  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/Makefile: Split first.S to macos.i, floppy.u, scsi.i: add
+	  -I$(TOP)
+
+2005-11-21 22:17  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/: first.S, floppy.i, macos.i, scsi.i: Split first.S to
+	  macos.i, floppy.u, scsi.i
+
+2005-11-18 01:06  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libfloppy/floppy_lseek.c, libfloppy/floppy_read.c,
+	  libfloppy/floppy_read_sector.c, libfloppy/libfloppy.h, Rules.mk:
+	  Add copyright
+
+2005-11-17 14:33  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/iso9660.c: moved to libscsi
+
+2005-11-17 14:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/Makefile: add read_vmlinuz.c
+
+2005-11-17 14:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/read_vmlinuz.c: uncompress and read ELF
+
+2005-11-17 07:54  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: scsi.c, scsi.h: moved to libscsi
+
+2005-11-17 07:44  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libscsi/: Makefile, libscsi.h, scsi_INQUIRY.c, scsi_READ.c,
+	  scsi_READ_CAPACITY.c, scsi_command.c, scsi_read_sector.c: SCSI
+	  interface
+
+2005-11-16 15:03  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/device.h: device.c header
+
+2005-11-16 15:00  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* docs/Makefile, first/Makefile, libemile/Makefile,
+	  libfloppy/Makefile, libgzip/Makefile, libiso9660/Makefile,
+	  libmacos/Makefile, libunix/Makefile: Move some generic parts to
+	  Rules.mk
+
+2005-11-16 14:57  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Rules.mk: Move some generic Makefile parts
+
+2005-11-16 02:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: add libgzip and libfloppy
+
+2005-11-16 02:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libfloppy/: Makefile, floppy_lseek.c, floppy_read.c,
+	  floppy_read_sector.c, libfloppy.h: Move floppy management to
+	  libfloppy
+
+2005-11-16 01:49  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libgzip/zlib.h: disable gzopen() prototype
+
+2005-11-16 01:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: gzio.c, inflate.c, uncompress.c, uncompress.h: move to
+	  zlib-1.2.3
+
+2005-11-15 11:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libiso9660/iso9660_lseek.c: correct offset management
+
+2005-11-15 10:34  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libiso9660/: iso9660_fseek.c, iso9660_lseek.c, Makefile: change
+	  fseek to lseek
+
+2005-11-15 00:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/: gzio.c, minigzip.c: Import from zlib-1.2.3
+
+2005-11-15 00:15  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libgzip/: Makefile, adler32.c, crc32.c, deflate.h, inffast.c,
+	  inffast.h, inflate.c, inflate.h, inftrees.c, inftrees.h, zconf.h,
+	  zlib.h, zutil.c, zutil.h: Import from zlib-1.2.3
+
+2005-11-14 20:30  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libiso9660/: libiso9660.h, Makefile, iso9660_open.c,
+	  iso9660_read.c: introduce best fseek() and offset management
+
+2005-11-14 20:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libiso9660/iso9660_fseek.c: add fseek()
+
+2005-11-14 08:35  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libiso9660/iso9660_read.c: improve file access (direct i/o)
+
+2005-11-13 20:43  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libiso9660/Makefile, libiso9660/iso9660_init.c,
+	  libiso9660/iso9660_mount.c, libiso9660/iso9660_read.c,
+	  libiso9660/iso9660_readdir.c, libiso9660/libiso9660.h,
+	  tools/device.c, tools/iso9660_cat.c, tools/iso9660_ls.c,
+	  second/iso9660.c:  change device interface
+
+2005-11-12 23:35  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/iso9660.c: Add #include
+
+2005-11-12 23:33  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/iso9660.c: Add libiso9660 I/O interface
+
+2005-11-12 23:31  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add libiso9660
+
+2005-11-12 23:28  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/: iso9660_cat.c, iso9660_ls.c, Makefile, device.c: Add
+	  iso9660 tools
+
+2005-11-12 23:22  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libiso9660/Makefile: Add target
+
+2005-11-12 22:30  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libunix/: strncmp.c, strncpy.c, write.c, strcmp.c, strcpy.c,
+	  strlen.c, puts.c, read.c, sprintf.c, memset.c, printf.c,
+	  putchar.c, free.c, malloc.c, memcpy.c: Add copyright
+
+2005-11-12 20:13  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libunix/: strcmp.c, strncmp.c, Makefile: Add strcmp() and
+	  strncmp()
+
+2005-11-12 20:12  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libiso9660/: Makefile, iso9660_close.c, iso9660_closedir.c,
+	  iso9660_dir_close.c, iso9660_is_directory.c, iso9660_mount.c,
+	  iso9660_open.c, iso9660_opendir.c, iso9660_read.c,
+	  iso9660_readdir.c, libiso9660.h: Read directory and files from
+	  CDROM
+
+2005-11-08 03:19  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add libmacos and libunix. move install, uninstall and
+	  dist targets to subdirs
+
+2005-11-08 03:18  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* docs/Makefile: Add target dist
+
+2005-11-08 03:17  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/Makefile: Add targets install, uninstall and dist
+
+2005-11-08 03:16  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/Makefile: add targets install, uninstall and dist, use
+	  libmacos
+
+2005-11-08 03:16  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/bootblock.h: Move MacOS functions to libmacos
+
+2005-11-08 03:15  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Add targets dist, install and uninstall. use
+	  libs libmacos and libunix
+
+2005-11-08 03:13  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: cli.c, main.c: Move MacOS functions to libmacos, disable
+	  inline of putchar() enabled by -O2
+
+2005-11-08 03:10  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: memory.c, memory.h, printf.c, glue.S, glue.h, lowmem.h,
+	  arch.c, arch.h, bank.c, bootenv.c, console.c: Move MacOS
+	  functions to libmacos
+
+2005-11-08 03:06  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: scsi.c, serial.c, serial.h, vga.c, bootinfo.c,
+	  console.h, driver.c, driver.h, enter_kernel.c, keyboard.c,
+	  load.c, misc.h: Move MacOS functions to libmacos
+
+2005-11-08 03:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/Makefile: add targets install, uninstall and dist
+
+2005-11-08 03:04  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libunix/Makefile, libunix/divsi3.S, libunix/free.c,
+	  libunix/malloc.c, libunix/memcpy.c, libunix/memset.c,
+	  libunix/modsi3.S, libunix/mulsi3.S, libunix/printf.c,
+	  libunix/putchar.c, libunix/puts.c, libunix/read.c,
+	  libunix/sprintf.c, libunix/strcpy.c, libunix/strlen.c,
+	  libunix/strncpy.c, libunix/udivsi3.S, libunix/umodsi3.S,
+	  libunix/vsprintf.c, libunix/write.c, second/misc.c: Move
+	  UNIX/POSIX/C functions to libunix
+
+2005-11-08 03:02  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libmacos/: macos/devices.h, macos/errors.h, macos/events.h,
+	  macos/files.h, macos/gestalt.h, macos/init.h, macos/lowmem.h,
+	  macos/memory.h, macos/osutils.h, macos/quickdraw.h,
+	  macos/romdefs.h, macos/scsi.h, macos/serial.h,
+	  macos/slotmanager.h, macos/traps.h, macos/types.h, macos/video.h,
+	  CloseDriver.c, Makefile, OpenDriver.c, SerGetBuf.c,
+	  display_properties.S, libmacos.h: Move MacOS functions to
+	  libmacos
+
+2005-11-04 11:20  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/driver.c: some change in paramBlock
+
+2005-11-04 11:18  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: glue.S, glue.h: Add VolumeParam and some 'unneeded'
+	  volume functions...
+
+2005-10-21 00:04  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add enter_kernel functions and headers
+
+2005-10-21 00:02  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Add enter_kernel.o
+
+2005-10-21 00:02  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: enter_kernel.c, enter_kernel.h: functions to enter
+	  kernel with/without MMU
+
+2005-10-21 00:01  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bank.h: define check_full_in_bank(a,b) (1) when no MMU
+
+2005-10-21 00:00  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: move some functions to enter_kernel.c
+
+2005-10-20 23:13  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: enter_kernel030.h, enter_kernel040.h,
+	  enter_kernelnoMMU.h: declare enter_kernel, end_kernel
+
+2005-10-20 23:12  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: MMU030.h, MMU040.h: Declare MMU*_disable_cache
+
+2005-10-20 23:12  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: Makefile, bank.c, bank.h, bootinfo.c, main.c: add
+	  USE_MMU, USE_MMU030, USE_MMU040
+
+2005-10-20 14:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU030_asm.S: Add nop in cache disable
+
+2005-10-10 23:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: glue.S, glue.h: Disable Slot resources functions
+
+2005-10-10 23:51  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: call turn_off_interrupts()
+
+2005-10-10 23:50  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: glue.S, glue.h: Add SGetTypeSRsrc()
+
+2005-10-10 23:42  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: driver.c, driver.h: Add turn_off_interrupts
+
+2005-10-09 15:03  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_second_set_output.c: correctly read console_mask
+
+2005-10-07 00:13  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/glue.h: cleaning
+
+2005-10-07 00:07  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: glue.S, glue.h: Add SGetCString() and SRsrcInfo()
+
+2005-10-06 23:06  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/driver.c: Add function to list drivers
+
+2005-10-06 23:03  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile, second/Makefile, second/driver.c, second/driver.h,
+	  second/serial.c, second/serial.h: move OpenDriver(),
+	  CloseDriver(), read(), write(), SerGetBuf() from serial.c to
+	  driver.c
+
+2005-09-23 01:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/lowmem.h: Add LMGetUnitTableEntryCount() and
+	  LMGetUTableBase()
+
+2005-09-23 01:04  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: misc.c, misc.h: Add p2cstring()
+
+2005-09-22 22:17  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_second_set_output.c: Add read_long()/write_long()
+	  for little/big-endian and 32-64bit
+
+2005-09-22 01:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: enter_kernel030.S, enter_kernel040.S,
+	  enter_kernelnoMMU.S: set netBSD flags
+
+2005-09-20 01:08  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: use second default targets instead of explicit targets
+
+2005-09-20 00:19  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/enter_kernel030.S: Add support for NetBSD (env)
+
+2005-09-20 00:15  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: enter_kernelnoMMU.S, enter_kernel040.S: Add support for
+	  NetBSD (env)
+
+2005-09-20 00:10  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: More NetBSD support
+
+2005-09-20 00:08  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.h: Define COMMAND_LINE_LENGTH
+
+2005-09-20 00:07  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: bootenv.c, bootenv.h: Set some env variables
+
+2005-09-20 00:01  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: arch.c, arch.h, bootinfo.c: move gmt_bias from
+	  bootinfo.c to arch.c
+
+2005-09-19 21:20  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Force primary target
+
+2005-09-19 21:08  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile, second/Makefile: Add support for multiple kernel type:
+	  add netBSD
+
+2005-09-19 21:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: bootenv.c, bootenv.h: Add netBSD boot parameters support
+
+2005-09-19 21:03  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: enter_kernel030.S, enter_kernel040.S,
+	  enter_kernelnoMMU.S, main.c: Add an entry point in enter_kernel
+	  for netBSD support
+
+2005-09-10 02:06  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_second_set_output.c, tools/emile-set-output.c:
+	  smarter --gestaltid
+
+2005-09-10 01:50  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-set-output.c: Allow to set/unset gestaltid alone
+
+2005-09-10 01:44  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: set version to 0.10CVS
+
+2005-09-07 02:49  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* ChangeLog, Makefile: RELEASE 0.9
+
+2005-09-07 02:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Correct KERNEL PANIC on IIci: move bootinfo() and
+	  set_kernel_bootinfo() after disable_cache()
+
+2005-09-05 23:16  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* ChangeLog: Update with cvs2cl
+
+2005-09-05 23:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: RAMDISK memory MUST be allocated at top of memory
+
+2005-09-05 23:10  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: bank.c, bank.h: Add malloc_top() that try to allocate
+	  memory at top of memory
+
+2005-09-05 21:36  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/cli.c: Correctly manage VT100 control characters on serial
+	  port (ignore NULL characters)
+
+2005-09-03 01:54  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: remove debug=ser from CONSOLE, add dependencie on
+	  vmlinuz for floppy_ramdisk.bin
+
+2005-09-03 01:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/cli.c: Manage righ arrow, left arrow and delete keys
+
+2005-09-03 01:52  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/keyboard.c: Manage correctly escape strings, GOT table is
+	  not able to manage strings pointer in an array, use a
+	  switch()/case instead
+
+2005-09-01 01:35  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: glue.S, glue.h: Add PBSyncStatus() and its serial status
+	  commands
+
+2005-09-01 01:33  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/keyboard.c: buffer_get() return 0 instead of -1 if no
+	  available character
+
+2005-09-01 01:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/serial.c: Add SerGetBuf() to know if there is available
+	  character in serial line buffer, correct serial_keypressed
+	  according serial_getchar which is returning 0 if no available
+	  character
+
+2005-08-30 17:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* ChangeLog: Update
+
+2005-08-30 10:04  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/console.c: Add serial_cursor_restore() and
+	  serial_cursor_save()
+
+2005-08-30 10:03  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: serial.c, serial.h: Add serial_cursor_save(and
+	  serial_cursor_restore(), and open serial ports for input, read
+	  character from serial ports, detect keypressed
+
+2005-08-29 14:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Correct rescue.bin: use compressed kernel image
+
+2005-08-28 23:42  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: cli.c, main.c: Use console_cursor_on(),
+	  console_cursor_off(), console_cursor_save(),
+	  console_cursor_restore()
+
+2005-08-28 23:41  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: console.c, console.h: Add console_cursor_on(),
+	  console_cursor_off(), console_cursor_save(),
+	  console_cursor_restore()
+
+2005-08-28 23:39  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: vga.c, vga.h: Add vga_cursor_save(), vga_cursor_save()
+	  and correct backspace
+
+2005-08-28 00:06  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add path for keyboard.[ch] and cli.[ch]
+
+2005-08-27 23:54  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-map-set.c: Correct typo in usage
+
+2005-08-27 23:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: disable CONSOLE
+
+2005-08-27 23:26  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Add cli.o
+
+2005-08-27 23:25  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Call cli_edit() to edit parameters
+
+2005-08-27 23:25  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add cli.h cli.c
+
+2005-08-27 23:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: cli.c, cli.h: Command Line Interpreter
+
+2005-08-27 20:52  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/vga.c: Add management of \b
+
+2005-08-27 20:52  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/misc.c: Add strcpy()
+
+2005-08-27 17:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: console.c, console.h: Manage keyboard
+
+2005-08-27 17:46  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: keyboard.c, keyboard.h: remove wait and timeout from
+	  keyboard_keypressed()
+
+2005-08-27 17:27  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: serial.c, serial.h: rename serial_get(), add
+	  serial_keypressed() skeleton
+
+2005-08-26 13:30  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/keyboard.c: Manage ctrl, remove option
+
+2005-08-26 11:26  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/keyboard.c: Call vga_cursor_refresh()
+
+2005-08-26 11:25  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: vga.c, vga.h: Add vga_cursor_refresh(), vga_cursor_on(),
+	  vga_cursor_off(): management of cursor on the display
+
+2005-08-26 09:36  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/keyboard.c: get KeyTime before reading keycode
+
+2005-08-25 23:46  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: serial.c, serial.h: Add serial_get() skeleton
+
+2005-08-25 23:45  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: keyboard.c, keyboard.h: Add escape strings and buffer
+	  management
+
+2005-08-25 13:12  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Temporarily switch to 68020
+
+2005-08-25 13:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: keyboard.c, keyboard.h: Add scancode conversion
+	  procedure
+
+2005-08-25 10:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/keyboard.h: Add scancodes definition
+
+2005-08-25 10:18  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/lowmem.h: Add KeyLast, KeyTime, KeyRepTime and Ticks
+
+2005-08-22 22:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/keyboard.c: Really set correctly modifiers bits
+
+2005-08-22 22:26  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/keyboard.c: Set correctly modifiers bits
+
+2005-08-22 22:19  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add keyboard.h keyboard.c and misc
+
+2005-08-22 22:18  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Add keyboard management
+
+2005-08-22 22:17  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: keyboard.c, keyboard.h: Manage keyboard
+
+2005-08-21 23:22  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: glue.S, glue.h: Add GetKeys()
+
+2005-06-30 10:55  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: bank.c, bank.h, lowmem.h, main.c: 68000: Set memory bank
+	  from KERNEL_LOADADDR to ScrnBase - 0x8000
+
+2005-06-30 03:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Add low memory offset (0x3000)
+
+2005-06-28 00:22  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: correct typo
+
+2005-06-27 22:25  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: lowmem.h, bootinfo.h, bootinfo.c: Add scc write base in
+	  bootinfo for Mac Classic
+
+2005-06-16 07:41  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* docs/Makefile: EMILE documentation: man pages written by Stephen
+	  R. Marenka
+
+2005-06-16 07:31  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: EMILE documentation: man pages written by Stephen R.
+	  Marenka
+
+2005-06-16 07:27  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* docs/: emile-first-tune.sgml, emile-install.sgml,
+	  emile-map-set.sgml, emile-set-cmdline.sgml,
+	  emile-set-output.sgml, emile.sgml: EMILE documentation: man pages
+	  written by Stephen R. Marenka
+
+2005-06-15 10:07  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bootinfo.c: 68000: put vga_get_videobase() instead of
+	  vga_get_video() in boot_info.bi_mac.videoaddr
+
+2005-06-14 22:15  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: 68000: really set physImage to kernel address
+
+2005-06-14 21:39  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Add 68000-based macintosh support: load kernel at
+	  address 0x4000
+
+2005-06-14 21:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/enter_kernelnoMMU.S: set .chip 68000
+
+2005-06-13 22:18  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/enter_kernelnoMMU.S: remove ori.w   #0x0700, %sr, already
+	  deone in main()
+
+2005-06-13 22:03  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bootinfo.c: Align tags on 4-byte frontier
+
+2005-06-13 20:49  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: arch.c, arch.h, bootinfo.c: move Gestalt('ram '...) from
+	  bootinfo.c to arch.c
+
+2005-06-10 23:09  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/load.c: Define some macros about floppy structure
+
+2005-06-10 23:08  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Generates 68000 compatible floppy
+
+2005-06-10 22:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.S: 68000 compatibility: load _GLOBAL_OFFSET_TABLE_
+
+2005-06-10 00:13  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/load.c: preliminary support of uncompress on-the-fly
+
+2005-06-10 00:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: uncompress.c, uncompress.h: change prototype of
+	  uncompress(): caller provide function to feed the inflate
+	  procedure
+
+2005-06-09 21:58  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: load.c, load.h, main.c: move uncompressing kernel from
+	  main.c to load.c
+
+2005-06-09 21:55  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-install.c, tools/emile.c, second/head.S,
+	  second/head.h: move to version 5 of header: kernel_size ==
+	  kernel_image_size means uncompressed
+
+2005-06-06 21:57  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* ChangeLog: Update
+
+2005-06-06 21:38  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU040.c: Manage RESIDENT page entry
+
+2005-06-06 21:36  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/uncompress.c: Set STATIC to static
+
+2005-06-06 21:33  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.S: GCC 3 requires BSS be cleared: it places variables
+	  initialized to 0 from DATA to BSS
+
+2005-06-06 20:15  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/inflate.c: backport fix from gzip 1.3.5
+
+2005-06-02 01:26  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: glue.S, MMU030_asm.S: save and restore registers at
+	  entry/exit of functions (detected with GCC 3)
+
+2005-06-02 00:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU040_asm.S: save and restore %d2 in MMU040_read_phys
+	  (detected with GCC 3.4)
+
+2005-05-27 00:43  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/printf.c: more gcc-3 compatibility: add putchar()
+
+2005-05-27 00:41  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* ChangeLog: new ChangeLog with cvs2cl
+
+2005-05-26 19:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: update VERSION with 0.9CVS
+
+2005-05-26 00:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Release 0.8
+
+2005-05-26 00:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Add 'ori.w #0x0700,%sr'
+
+2005-05-25 21:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Remove -Os, kernel doesn't boot on my LC475
+
+2005-05-25 08:41  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: enter_kernel030.S, enter_kernel040.S, enter_kernelPPC.S:
+	  remove 'ori.w #0x0700, %sr', must be made by the caller
+
+2005-05-25 08:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/misc.c: Really change putstring() to console_putstring()
+
+2005-05-25 08:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU040.c: Remove previous modification in
+	  MMU040_logical2physicalAttr()
+
+2005-05-25 08:26  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: console.c, console.h, misc.c, printf.c, uncompress.c:
+	  use console_putchar() and console_putstring() instead of
+	  putchar() and putstring() (create some problems...)
+
+2005-05-25 07:12  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Disable serial console
+
+2005-05-25 07:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU040.c: Correct isTTSegment() (zone size) and
+	  MMU040_logical2physicalAttr() (invalid statement)
+
+2005-05-24 02:00  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: produce 68020 as cc is bugged
+
+2005-05-24 01:03  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Produce pure 68000 binaries
+
+2005-05-24 00:27  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/arch.c: Remove NULL
+
+2005-05-24 00:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/arch.c: Add support for Mac Classic
+
+2005-05-24 00:22  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/glue.S: Add commnets for InitGraf()
+
+2005-05-23 22:14  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/glue.S: Add InitGraf(), detect if LMGetMainDevic() is
+	  corrupter (0xAAAAAAAA ? detected on B&W display Mac Classic)
+
+2005-05-23 22:13  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/vga.c: Add InitGraf() and detect if
+	  glue_display_properties() cannot get properties (B&W display ?
+	  seen on Mac Classic)
+
+2005-05-23 22:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/glue.h: Add some Quickdraw structures
+
+2005-05-23 19:10  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/printf.c: correct puts() usage, use putchar() and
+	  putstring()
+
+2005-05-23 19:09  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: console.c, console.h: replace console_put() by putchar()
+	  and console_print() by putstring()
+
+2005-05-23 19:08  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/misc.c: in error(), use puts() instead of printf()
+
+2005-05-23 19:08  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/uncompress.c: use putchar() instead of console_put()
+
+2005-05-23 01:16  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: concatenate string of EMILE and CPU type
+
+2005-05-23 01:15  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Introduce gcc-3.3 and 68020 target instead of
+	  68030
+
+2005-05-22 23:16  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: cast for entry, to support gcc 3.3
+
+2005-05-22 23:15  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: console.c, console.h: Add const to console_print() to
+	  conform to puts()
+
+2005-05-22 23:14  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: load.c, uncompress.c: Add <string.h>
+
+2005-05-22 23:12  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/printf.c:  Remove SUPPORT_68000 and add __mulsi3,
+	  __udivsi3, __divsi3, umodsi3 and modsi3 to glue.S, add puts() and
+	  putchar() to support standard include
+
+2005-05-22 23:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: glue.S, bootinfo.c, vga.c:  Remove SUPPORT_68000 and add
+	  __mulsi3, __udivsi3, __divsi3, umodsi3 and modsi3 to glue.S
+
+2005-05-20 02:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/first.S: Add Heap initialization, and 68000/68010 support
+
+2005-05-19 11:02  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/first.S: Add 68000 support
+
+2005-05-19 07:58  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/vga.c: change 68000_SUPPORT by SUPPORT_68000, correct
+	  vga_clear()
+
+2005-05-19 07:51  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: bootinfo.c, glue.S, printf.c: change 68000_SUPPORT by
+	  SUPPORT_68000
+
+2005-05-18 01:44  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bootinfo.c: Add 68000 support
+
+2005-05-18 01:40  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/vga.c: Add 68000 support
+
+2005-05-18 01:36  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: printf.c, head.S: Add 68000 support
+
+2005-05-18 01:28  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/glue.S: Add 68000 support
+
+2005-05-16 23:38  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Add support of CPU without MMU
+
+2005-05-16 23:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add enter_kernelnoMMU.S
+
+2005-05-16 23:31  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Add enter_kernelnoMMU.S and mixed mixed mode
+	  image
+
+2005-05-16 23:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/enter_kernelnoMMU.S: First revision
+
+2005-05-14 03:12  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Restore RBV macintosh compatibility
+
+2005-05-14 00:36  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: enter_kernel030.S, enter_kernel040.S: move interrupt
+	  disabling from main
+
+2005-05-14 00:35  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Add BAT mapping for nubus, move interrupts
+	  deisabling to enter_kernel
+
+2005-05-14 00:02  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/enter_kernelPPC.S: disable interrupts here
+
+2005-05-14 00:01  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/enter_kernelPPC.h: change unsigned long to u_int32_t
+
+2005-05-13 19:26  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bootx.h: Add bootx_infos variable
+
+2005-05-13 19:25  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: more PPC stuff, init PPC regs here
+
+2005-05-13 19:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/enter_kernelPPC.S: remove kernel relocation, add PPC
+	  registers copy
+
+2005-05-13 19:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile, second/enter_kernelPPC.h: Add enter_kernelPPC.h
+
+2005-05-12 23:57  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bank.h: Add malloc.h for size_t in malloc()
+
+2005-05-12 23:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bootx.c: init bootx_infos structure
+
+2005-05-12 23:07  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: arch.c, arch.h: use bus types from bootx.h
+
+2005-05-12 23:06  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bootx.h: Add bootx_init() prototype
+
+2005-05-12 23:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/enter_kernelPPC.S: Add bootx info
+
+2005-05-12 23:04  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: add casts and #ifdef
+
+2005-05-12 08:00  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: more error cases for wrong architecture
+
+2005-05-12 07:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Add bootx.o in ppc objects
+
+2005-05-12 07:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add bootx files
+
+2005-05-12 07:51  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bootx.c: First revision
+
+2005-05-12 07:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Test all MMU types, more processor type specific
+	  code
+
+2005-05-12 07:47  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/enter_kernelPPC.S: Add processor switch to PPC
+
+2005-05-12 07:47  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/PPC_asm.S: remove PPC_disable_cache
+
+2005-05-12 07:46  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Move bootinfo.o to m68k objects
+
+2005-05-11 14:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bootx.h: BootX infos, borrowed from linux sources
+	  include/asm-ppc/bootx.h
+
+2005-05-11 00:52  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bank.c: Correct m68k_init_memory_bank in case where there
+	  is no MMU
+
+2005-05-11 00:37  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add second stage PPC files
+
+2005-05-11 00:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: add missing quote
+
+2005-05-11 00:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Add multi-architecture support
+
+2005-05-11 00:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bank.c: Add missing return at end of function
+
+2005-05-11 00:03  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: PPC_asm.S, enter_kernelPPC.S: preliminary PPC support
+
+2005-05-10 23:49  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: main.c, bank.c: Add multi-architecture support
+
+2005-05-10 22:20  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile, libemile/Makefile, second/Makefile, tools/Makefile: Add
+	  CROSS_COMPILE to cross-compile tools
+
+2005-05-10 16:30  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Remove last.bin on all_bin
+
+2005-05-10 16:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: set RAMDISK variable
+
+2005-05-10 13:25  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: allow to build EMILE without vmlinux
+
+2005-05-10 12:51  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile, second/Makefile: Preliminary support of multitarget
+	  architecture (m68k, ppc)
+
+2005-05-10 01:37  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bank.c: Correct ppc_init_memory_map()
+
+2005-05-10 00:47  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add target netboot.bin, rescue.bin,
+	  debian-installer.bin and boot.bin
+
+2005-05-10 00:18  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-map-set.c: Add put_driver()
+
+2005-02-04 02:00  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add emile_map_get_bootinfo emile_map_dev emile_checksum
+	  emile_map_set_driver_number emile_map_set_driver_info
+	  emile_map_set_bootinfo emile_block0_write
+
+2005-02-04 01:51  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: Makefile, libemile.h: add emile_map_set_bootinfo,
+	  emile_map_set_driver_info, emile_map_set_driver_number,
+	  emile_block0_write
+
+2005-02-04 01:45  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_map_set_bootinfo.c, emile_map_set_driver_info.c,
+	  emile_map_set_driver_number.c: first revision
+
+2005-02-04 01:42  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/partition.h: Add DD_MAX_DRIVER, the maximum driver
+	  number in block0
+
+2005-02-04 01:41  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_block0_write.c: first revision
+
+2005-02-03 17:04  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile_scanbus.c: Add partition boot info
+
+2005-02-02 17:46  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/Makefile: add emile_scanbus to emile-map-set
+
+2005-02-02 15:47  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-map-set.c: Add --get-driver
+
+2005-02-02 15:38  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/Makefile: add emile_checksum, emile_map_get_bootinfo,
+	  emile_map_dev
+
+2005-02-02 15:33  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/libemile.h: add emile_checksum, emile_map_get_bootinfo,
+	  emile_map_dev
+
+2005-02-02 15:25  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_scsi_get_rdev.c: Manage IDE device
+
+2005-02-02 15:25  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_checksum.c, emile_map_dev.c,
+	  emile_map_get_bootinfo.c: First revision
+
+2005-02-02 00:21  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile_scanbus.c: block_size is used in drivers section
+	  (block0) otherwise use 512-byte block
+
+2005-02-01 21:34  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-map-set.c: Add --scanbus
+
+2005-02-01 21:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile_scanbus.c: get block_size even if we aren't in
+	  verbose mode
+
+2005-02-01 20:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile_scanbus.c: Correct drivers info when block size is
+	  not 512 (i.e. CDROM)
+
+2005-01-26 00:25  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: disable floppy eject for my USB floppy device, add a
+	  parameter, CONSOLE, to enable or not serial console
+
+2005-01-03 02:15  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* ChangeLog: update with PowerBook 150 bugs correction
+
+2005-01-03 02:07  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU030.c: Remove duplicate shift of logical address for
+	  DT_VALID_4_BYTE in decode_4_PD() and decode_8_PD()
+
+2004-12-31 00:42  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/serial.c: correct port 1 (printer) initialisation
+
+2004-12-31 00:06  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/vga.c: correct 2 bit depth display
+
+2004-12-30 00:46  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: set version to 0.8CVS
+
+2004-12-30 00:45  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bank.c: try to find a contiguous block until it finds or
+	  there is no more memory
+
+2004-12-30 00:43  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: don't allocate contiguous if not needed
+
+2004-12-28 00:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Release 0.7
+
+2004-12-28 00:07  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: add README.floppy README.scsi
+
+2004-12-28 00:06  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* README.scsi: first revision
+
+2004-12-27 23:43  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* README.floppy: some Howto about EMILE on a floppy
+
+2004-12-27 23:35  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/Makefile, libemile/libemile.h, Makefile,
+	  libemile/emile_map_partition_set_flags.c: Add
+	  emile_map_partition_set_flags
+
+2004-12-27 23:34  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-map-set.c: activate emile_map_partition_set_flags and
+	  emile_map_set_partition_type
+
+2004-12-27 23:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: correct restore and backup parameters
+
+2004-12-27 22:45  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile_scanbus.c: display bootblock info even if not
+	  bootable
+
+2004-12-27 22:39  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/Makefile, tools/emile.c, tools/emile_scanbus.c, ChangeLog,
+	  Makefile, libemile/emile_map_set_startup.c,
+	  libemile/emile_scsi_create_container.c,
+	  libemile/emile_scsi_get_dev.c, libemile/emile_scsi_get_rdev.c,
+	  libemile/libemile.h, second/container.S, tools/emile-map-set.c:
+	  replace emile-set-startup by emile-map-set
+
+2004-12-27 22:20  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-set-startup.c: moved to emile-map-set.c
+
+2004-12-27 02:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: correct Apple_HS and --set-hfs
+
+2004-12-27 02:31  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_map_write.c: really write...
+
+2004-12-26 21:12  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: open file on --test, check it can...
+
+2004-12-26 21:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_get_uncompressed_size.c: Check if file exists and
+	  is not empty
+
+2004-12-25 02:42  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_get_uncompressed_size.c: return 0 instead of -1 if
+	  file is not compressed
+
+2004-12-25 02:35  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: allow to boot with an uncompressed kernel
+
+2004-12-25 01:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: load.c, load.h, main.c: load_image() doesn't malloc
+	  memory anymore, we must provide the buffer
+
+2004-12-25 01:49  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_floppy_create_image.c: correct buffer size setting
+	  -> rewind file at beginning of second level
+
+2004-12-25 01:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-install.c: Add --getinfo
+
+2004-12-25 00:43  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-set-output.c: use getopt()
+
+2004-12-25 00:03  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/Makefile, Makefile: remove emile-first-info.c
+
+2004-12-25 00:03  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-first-info.c: Move info emile-first-tune.c
+
+2004-12-25 00:01  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-first-tune.c: use getopt(), move code from
+	  emile-first-info.c
+
+2004-12-24 23:36  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Correct a major memroy usage mismatch
+
+2004-12-24 23:35  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: use new parameters of emile-install, don't need kernel
+	  size anymore
+
+2004-12-24 23:34  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-install.c: use getopt() and
+	  emile_get_uncompressed_size()
+
+2004-12-24 22:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_floppy_create_image.c: Set correctly size of
+	  second level in first level
+
+2004-12-24 21:15  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add MAIN_FILES, and targets install and uninstall
+
+2004-12-24 21:12  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/: emile-set-cmdline.c, emile-set-output.c: Can work on
+	  floppy image or directly on second level binary
+
+2004-12-24 21:08  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: remove BANK_DUMP
+
+2004-12-24 01:10  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: Add usage, some parameters and set bootable HFS
+	  partition
+
+2004-12-24 00:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: Add set_HFS and set_startup
+
+2004-12-24 00:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: add all stuff to set firt level, second level and
+	  boot block, change exit values
+
+2004-12-24 00:07  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_map_bootblock_write.c: change O_RDWR to O_WRONLY
+
+2004-12-23 23:35  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: Add open_map_of() and backup_bootblock()
+
+2004-12-23 00:14  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: Add ARG_TEST, check_is_EMILE_bootblock,
+	  check_is_startup, backup_bootblock
+
+2004-12-22 23:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_scsi_get_rdev.c: return 0 instead of disk when ok
+
+2004-12-22 23:47  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/Makefile, libemile/libemile.h, Makefile: Add
+	  emile_get_uncompressed_size
+
+2004-12-22 23:46  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_get_uncompressed_size.c: First revision
+
+2004-12-22 11:34  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* ChangeLog: Release 0.6
+
+2004-12-22 01:30  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: add to LIB_FILES emile_map_has_apple_driver.c
+	  libemile/emile_map_seek_driver_partition.c
+
+2004-12-22 01:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: Add some args, check Apple_Driver, checj Apple_HFS
+
+2004-12-22 01:28  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile_scanbus.c: move seek_partition() to libemile
+
+2004-12-22 01:27  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: Makefile, libemile.h: add emile_map_has_apple_driver
+	  emile_map_seek_driver_partition
+
+2004-12-21 21:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_map_has_apple_driver.c,
+	  emile_map_seek_driver_partition.c: First revision
+
+2004-12-21 19:04  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: update TOOLS_FILES and LIB_FILES
+
+2004-12-21 19:00  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_map_bootblock_get_type.c,
+	  emile_map_bootblock_is_valid.c, emile_map_close.c,
+	  emile_map_geometry.c, emile_map_get_driver_info.c,
+	  emile_map_get_driver_number.c, emile_map_get_number.c,
+	  emile_map_get_partition_geometry.c,
+	  emile_map_get_partition_name.c, emile_map_get_partition_type.c,
+	  emile_map_is_valid.c, emile_map_open.c,
+	  emile_map_partition_is_bootable.c,
+	  emile_map_partition_is_startup.c, emile_map_partition_is_valid.c,
+	  emile_map_partition_set_bootable.c,
+	  emile_map_partition_set_startup.c, emile_map_read.c,
+	  emile_map_set_partition_name.c, emile_map_set_partition_type.c:
+	  add CVSHeader
+
+2004-12-21 18:59  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/Makefile: emile_map_partition_get_flags.o
+	  emile_map_set_startup.o emile_scsi_get_rdev.o, change
+	  emile_partition_get_from_file.o to emile_scsi_get_dev.o
+
+2004-12-21 18:58  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_map_set_startup.c: Check partition type, must be
+	  Apple_HFS
+
+2004-12-21 18:57  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_map_write.c: Correct function name
+
+2004-12-21 18:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_scsi_create_container.c:  correct fd, use
+	  emile_scsi_get_dev()
+
+2004-12-21 18:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/libemile.h: Add emile_map_partition_get_flags,
+	  emile_scsi_get_dev, emile_map_set_startup, emile_scsi_get_rdev
+
+2004-12-21 18:41  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_scsi_get_dev.c: First revision
+
+2004-12-21 18:38  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_scsi_get_rdev.c: First revision
+
+2004-12-21 18:35  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile_scanbus.c: display part flags in verbose mode
+
+2004-12-21 18:35  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/Makefile: Add emile-set-startup
+
+2004-12-21 18:34  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-set-startup.c: First revision
+
+2004-12-21 17:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_map_set_startup.c: First revision
+
+2004-12-21 16:41  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_map_partition_get_flags.c: really return partition
+	  status...
+
+2004-12-21 16:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_map_partition_get_flags.c: First revision
+
+2004-12-21 16:17  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/Makefile, tools/Makefile: Add -g in CFLAGS
+
+2004-12-21 16:17  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_map_bootblock_read.c,
+	  emile_map_bootblock_write.c: correct partition device name
+
+2004-12-21 16:16  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile_scanbus.c: add print_size()
+
+2004-12-17 00:30  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add tools/emile_scanbus.c emile_map_get_number.c
+	  emile_map_bootblock_get_type.c, rename emile_map_*_bootblock to
+	  emile_map_bootblock_*, pass PREFIX to tools
+
+2004-12-17 00:28  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/Makefile: Add emile_scanbus and PREFIX
+
+2004-12-17 00:27  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: scanbus support
+
+2004-12-17 00:25  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_map_bootblock_get_type.c,
+	  libemile/emile_map_get_number.c, tools/emile_scanbus.c: First
+	  revision
+
+2004-12-17 00:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/Makefile: rename emile_map_*_bootblock to
+	  emile_map_bootblock_*, add emile_map_bootblock_get_type
+	  emile_map_get_number
+
+2004-12-17 00:22  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_map_get_partition_name.c: change prototype
+	  emile_map_get_partition_name
+
+2004-12-17 00:22  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_map_get_partition_type.c: change prototype
+	  emile_map_get_partition_type
+
+2004-12-17 00:21  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_map_open.c: first partition is 0, not 1
+
+2004-12-17 00:20  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/libemile.h: rename emile_map_*_bootblock to
+	  emile_map_bootblock_*, add bootblock IDs
+
+2004-12-17 00:20  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_map_bootblock_write.c,
+	  emile_map_bootblock_read.c: rename emile_map_*_bootblock to
+	  emile_map_bootblock_*
+
+2004-12-16 23:21  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_map_bootblock_write.c,
+	  emile_map_write_bootblock.c: rename emile_map_write_bootblock.c
+	  to emile_map_bootblock_write.c
+
+2004-12-16 23:20  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_map_bootblock_read.c,
+	  emile_map_read_bootblock.c: rename emile_map_read_bootblock.c to
+	  emile_map_bootblock_read.c
+
+2004-12-15 00:54  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: update LIB_FILES
+
+2004-12-15 00:49  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_map_bootblock_is_valid.c, emile_map_close.c,
+	  emile_map_geometry.c, emile_map_get_driver_info.c,
+	  emile_map_get_driver_number.c,
+	  emile_map_get_partition_geometry.c,
+	  emile_map_get_partition_name.c, emile_map_get_partition_type.c,
+	  emile_map_is_valid.c, emile_map_open.c,
+	  emile_map_partition_is_bootable.c,
+	  emile_map_partition_is_startup.c, emile_map_partition_is_valid.c,
+	  emile_map_partition_set_bootable.c,
+	  emile_map_partition_set_startup.c, emile_map_read.c,
+	  emile_map_read_bootblock.c, emile_map_set_partition_name.c,
+	  emile_map_set_partition_type.c, emile_map_write.c,
+	  emile_map_write_bootblock.c, emile_second_get_buffer_size.c,
+	  emile_second_set_buffer_size.c: First revision
+
+2004-12-15 00:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/Makefile: Add partition management files
+
+2004-12-15 00:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/libemile.h: Add partition management functions, remove
+	  buffer_size from emile_second_*_kernel functions
+
+2004-12-15 00:47  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/partition.h: add emile_map_t and partition types
+
+2004-12-14 22:49  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c, libemile/emile_floppy_create_image.c,
+	  libemile/emile_second_get_kernel.c,
+	  libemile/emile_second_set_kernel.c: use new function
+	  emile_second_set_buffer_size
+
+2004-12-14 17:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.h: moved to ../libemile/
+
+2004-12-13 03:12  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: set first, second and kernel parameters, it's a
+	  draft...
+
+2004-12-13 03:01  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_first_set_param_scsi.c,
+	  emile_second_set_kernel_scsi.c: print block info
+
+2004-12-13 02:59  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_scsi_create_container.c: correct numblocks in file
+
+2004-12-13 00:07  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add install and first_floppy
+
+2004-12-12 23:59  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_second_get_cmdline.c, emile_second_get_kernel.c,
+	  emile_second_get_output.c, emile_second_set_cmdline.c,
+	  emile_second_set_kernel.c, emile_second_set_kernel_scsi.c,
+	  emile_second_set_output.c, emile_first_get_param.c,
+	  emile_first_set_param.c, emile_first_set_param_scsi.c,
+	  emile_floppy_create_image.c: use EMILE error codes
+
+2004-12-12 23:57  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/libemile.h: Add EMILE error codes
+
+2004-12-10 01:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: add libemile, split DISTFILES
+
+2004-12-10 01:28  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/: Makefile, emile-first-info.c, emile-first-tune.c,
+	  emile-install.c, emile-set-cmdline.c, emile-set-output.c,
+	  emile.c: use libemile
+
+2004-12-10 01:27  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/bootblock.h: move FLOPPY_SECTOR_SIZE, FIRST_LEVEL_SIZE
+	  and get_size() to libemile.h
+
+2004-12-10 01:26  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: emile_first_set_param.c, emile_floppy_create_image.c,
+	  emile_first_get_param.c: remove file_ref
+
+2004-12-10 01:25  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_second_get_cmdline.c: correct function name
+
+2004-12-10 01:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_second_get_output.c: change prototype
+
+2004-12-10 01:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_second_set_kernel.c: rename get_size to
+	  emile_file_get_size
+
+2004-12-10 01:22  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/emile_second_set_output.c: correct prototype of
+	  emile_second_set_output
+
+2004-12-10 01:22  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/libemile.h: Add emile_file_get_size(), add
+	  emile_second_set_kernel_scsi, emile_floppy_create_image, correct
+	  emile_first_get_parami, add FLOPPY_SECTOR_SIZE and
+	  FIRST_LEVEL_SIZE
+
+2004-12-10 01:13  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/blocks.c: moved to libemile/emile_scsi_create_container.c
+
+2004-12-10 01:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/blocks.h: move to libemile/libemile.h
+
+2004-12-10 01:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-first.h: moved to libemile in bootblock.h
+
+2004-12-10 00:47  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-second.h: remove empty file
+
+2004-12-09 23:57  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* libemile/: bootblock.h, emile.h, emile_first_get_param.c,
+	  emile_first_set_param.c, emile_first_set_param_scsi.c,
+	  emile_floppy_create_image.c, emile_scsi_create_container.c,
+	  emile_second_get_cmdline.c, emile_second_get_kernel.c,
+	  emile_second_get_output.c, emile_second_set_cmdline.c,
+	  emile_second_set_kernel.c, emile_second_set_kernel_scsi.c,
+	  emile_second_set_output.c, libemile.h, Makefile, partition.h:
+	  First revision
+
+2004-12-07 01:39  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: Add SCSI support for level 1
+
+2004-12-07 01:35  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/: Makefile, first.S: Add SCSI support
+
+2004-12-07 01:31  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: clean: remove second_floppy and second_scsi
+
+2004-12-03 01:37  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add tools/blocks.h in DISTFILES
+
+2004-12-03 01:35  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/blocks.h: declare scsi_create_container() for blocks.c
+
+2004-12-03 01:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add second/container.S tools/blocks.c tools/emile.c in
+	  DISTFILES
+
+2004-12-03 01:30  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/Makefile: Add blocks.c, emile.c to create emile
+
+2004-12-03 01:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile.c: Add container information of a given kernel in an
+	  appropriate second stage file
+
+2004-12-03 01:28  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/blocks.c: create container information for a given file
+
+2004-12-03 01:26  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-install.c: Allow to create a floppy image without
+	  kernel (load kernel from SCSI disk)
+
+2004-12-03 01:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Add container.o, remove SCSI_SUPPORT from floppy
+	  binary
+
+2004-12-03 01:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/container.S: first version, data for SCSI container
+
+2004-12-03 01:21  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.S: switch to EM04, add scsi support ->
+	  kernel_image_offset is container offset
+
+2004-12-03 01:20  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.h: switch EM04, add container management for SCSI
+	  support
+
+2004-12-03 01:19  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/load.c: add scsi support to load_image()
+
+2004-12-03 01:17  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/load.h: remove floppy driver number in load_image()
+	  parameters
+
+2004-12-03 01:16  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: remove floppy driver number in load_image()
+	  parameters, add base offset to kernel image offset to find
+	  container if SCSI_SUPPORT
+
+2004-12-03 01:14  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: scsi.c, scsi.h: Add scsi_READ
+
+2004-12-01 01:22  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: add floppy driver number in load_image()
+	  parameters
+
+2004-12-01 01:21  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: create two binaries, one for booting from
+	  floppy, the other from scsi disk
+
+2004-12-01 01:18  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add scsi.c and scsi.h, rename second/second to
+	  second/second_floppy
+
+2004-12-01 01:17  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: scsi.c, scsi.h: Add SCSI management
+
+2004-12-01 01:14  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: load.c, load.h: add floppy driver number in load_image()
+	  parameters
+
+2004-12-01 01:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: glue.S, glue.h: Add MacOS functions SCSIReset(),
+	  SCSIGet(), SCSISelect(), SCSIcmd(), SCSIRead() and SCSIComplete
+
+2004-10-07 21:54  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: 0.7CVS
+
+2004-10-07 21:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/: emile-set-output.c, emile-set-cmdline.c: more bootblock
+	  signature
+
+2004-10-07 21:52  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: head.h, main.c: more bootblock signatute
+
+2004-10-07 11:14  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.S: add _gestaltID
+
+2004-10-07 11:09  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: add gestaltid
+
+2004-10-07 11:07  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/lowmem.h: remove bad comments
+
+2004-10-07 11:06  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.h: add gestaltID
+
+2004-10-07 10:57  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.h: Add gestalt ID
+
+2004-08-19 01:19  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Release 0.6
+
+2004-08-19 01:17  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: glue.S, glue.h: Add SysError()
+
+2004-08-19 01:14  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.S: check result of NewPtr and invoke SysError if
+	  needed
+
+2004-08-19 01:08  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/vga.c: correct clear function
+
+2004-08-19 00:31  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/first.S: Resolve BUG# 978484 by enabling 32bit mode in PRA%
+	  when it is not
+
+2004-07-13 00:04  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* ChangeLog, Makefile: Release 0.5
+
+2004-07-12 23:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: load.c, main.c, bank.c, bank.h: Add malloc_contiguous()
+
+2004-07-10 03:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/first.S: Add some details to boot structure
+
+2004-07-10 03:28  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: arch.c, bootinfo.c: Manage special case for Mac SE/30
+
+2004-07-10 03:26  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/lowmem.h: ROMBase is a pointer to a pointer of short
+
+2004-06-25 13:21  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add tools/emile-set-output.c in DISTFILES
+
+2004-06-25 13:16  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/serial.c: Enable  serial console on request
+
+2004-06-25 13:15  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/console.c: use console mask to enable/disable vga and
+	  serial
+
+2004-06-24 02:07  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.h: add bitmask values of console_mask
+
+2004-06-24 02:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/: emile-set-output.c, Makefile: Add emile-set-ouput to
+	  configure output of EMILE: display or serial line
+
+2004-06-23 21:09  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: to allow serial console, move last printf before
+	  cache flush and interrupt disabling
+
+2004-06-23 19:28  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bootinfo.c: Remove unused TARGET_M68K, by the way correct
+	  the bad SCC info provided to kernel
+
+2004-06-23 19:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/printf.c: Correct bad hexadecimal display. bug #977860
+
+2004-06-23 00:59  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/serial.c: don't use buffer
+
+2004-06-23 00:58  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/: emile-install.c, emile-set-cmdline.c: use second/head.h
+
+2004-06-23 00:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: add serial.[ch], vga.[ch], head.H
+
+2004-06-23 00:08  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/printf.c: Add misc.h
+
+2004-06-23 00:07  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.h: Add __HEAD_H__
+
+2004-06-23 00:07  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/misc.c: Add newline at end of error()
+
+2004-06-23 00:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: serial.c, serial.h: Add serial_put() and serial_init()
+
+2004-06-22 23:28  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: rename console_* to vga_*, move header struct to
+	  head.h
+
+2004-06-22 23:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.S: Add serial configuration information in header
+
+2004-06-22 23:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bootinfo.c: rename video graphic adapter function from
+	  console_* to vga_*
+
+2004-06-22 23:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/misc.h: Add __MISC_H__
+
+2004-06-22 23:22  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Add vga.o
+
+2004-06-22 23:21  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: console.c, console.h, vga.c, vga.h: move all stuff from
+	  console.[ch] to vga.[ch]. console is now the generic entry for
+	  video graphic adapter and serial adapter, configured with
+	  emile_l2_header
+
+2004-06-22 23:19  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.h, tools/emile-second.h: Move emile_l2_header
+	  definition from tools/emile-second.h to second/head.h
+
+2004-06-22 00:47  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add serial.c and serial.h in DISTFILES
+
+2004-06-22 00:42  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/glue.h: Add all needed stuff for serial port management
+
+2004-06-22 00:41  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/glue.S: Add PBWriteSync
+
+2004-06-22 00:41  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: Add serial.o
+
+2004-06-22 00:40  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: misc.c, misc.h: Add string conversion function from C
+	  string to pascal string
+
+2004-06-22 00:39  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: serial.c, serial.h: Serial port management
+
+2004-06-18 17:37  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: glue.S, glue.h: Add PBOpenSync(), PBCloseSync(),
+	  PBControlSync()
+
+2004-06-16 23:01  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: correct relocation of enter_kernel() at end of
+	  kernel
+
+2004-06-16 19:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: bank.c, bank.h: add check_full_in_bank()
+
+2004-06-16 19:22  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile, second/Makefile, second/main.c: Remove obsolete
+	  KERNEL_ARCH/TARGET_???
+
+2004-06-11 22:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-install.c: pad size of floppy to 1440kB to be able to
+	  create floppy with MacOS Disk Copy
+
+2004-06-09 23:34  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* ChangeLog: Release 0.4
+
+2004-06-09 23:34  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: set version to 0.4, set kernel args
+
+2004-06-09 22:52  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: disable cache early (resolve bad ramdisk detection
+
+2004-06-09 19:34  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: MMU030_asm.S, MMU040_asm.S, main.c: Add disable_cache()
+	  for 030 and 040 (new)
+
+2004-06-09 14:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: MMU030_asm.S, MMU040_asm.S, Makefile, enter_kernel030.S,
+	  enter_kernel040.S: Add .chip directive
+
+2004-06-09 01:31  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: add copymem.i to DISTFILES
+
+2004-06-08 00:13  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: copymem.i, Makefile, enter_kernel030.S,
+	  enter_kernel040.S: use copymem.i to copy kernel
+
+2004-06-07 20:52  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: put enter_kernel function at end of kernel image
+	  to avoid ovelaping
+
+2004-06-07 20:51  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/load.c: Align memory allocation
+
+2004-06-07 20:51  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: enter_kernel040.S, enter_kernel030.S: align
+
+2004-06-07 20:50  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add -I elf32-big to objcopy
+
+2004-06-05 00:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: head.S, main.c: Pass first level parameter in a
+	  structure
+
+2004-06-04 00:59  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: add rw parameter for nfs boot
+
+2004-06-04 00:39  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: use uncompressed size instead buffer size to find
+	  end of kernel to put boot info
+
+2004-06-04 00:38  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/uncompress.c: return uncompressed size
+
+2004-06-03 21:30  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: bootinfo.c, bootinfo.h, head.S, main.c: Pass booter info
+	  by args of start()
+
+2004-06-03 13:09  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile, tools/Makefile, tools/emile-first-info.c,
+	  tools/emile-first-tune.c, tools/emile-install.c,
+	  tools/emile-set-cmdline.c: Add signature(build info)
+
+2004-06-03 11:13  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: kernel size is size of vmlinux.bin
+
+2004-06-03 10:16  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: take kernel size from uncompress(), because
+	  _kernel_size from head.S is in fact a buffer size
+
+2004-06-03 10:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: bootinfo.c, bootinfo.h, main.c: pass ramdisk image
+	  address by argument to bootinfo_init()
+
+2004-06-03 10:02  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: uncompress.h, uncompress.c, main.c: pass compress image
+	  address by argument to uncompress() and remove unneeded size
+
+2004-06-03 09:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/inflate.c: change octal to hexadecimal, correct some
+	  warnings
+
+2004-06-03 09:54  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/misc.h: add __attribute__ ((noreturn)) to error()
+
+2004-06-02 23:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/arch.c: Set mmu type according to cpu type when gestalt()
+	  says noMMU
+
+2004-06-02 23:10  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Correct ramdisk management
+
+2004-06-02 19:40  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/: emile-first-info.c, emile-first-tune.c, emile-first.h,
+	  emile-install.c, emile-second.h, emile.h: 64bit support
+
+2004-06-02 19:39  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/glue.h: 64bit support for tools
+
+2004-06-02 19:38  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: arch.c, bootinfo.c, console.c, load.c, memory.c: add
+	  misc.h for glue.h (for 64bit support)
+
+2004-06-02 19:37  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/misc.h: define u_int8_t, int8_t, u_int16_t, int16_t,
+	  u_int32_t, int32_t for m68k
+
+2004-06-02 00:08  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add emile-second.h in DISTFILES
+
+2004-06-02 00:00  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bootinfo.c, second/ld.script, second/main.c,
+	  second/uncompress.c, second/Makefile, Makefile: floppy image is
+	  now built from several parts (first, second, kernel, ramdisk)
+	  with emile-install. Linker cannot provide kernel size and
+	  position anymore
+
+2004-06-01 23:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/Makefile: add emile-install
+
+2004-06-01 23:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-install.c: first revision
+
+2004-06-01 17:09  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/: emile.h, Makefile, emile-first-info.c,
+	  emile-first-tune.c, emile-set-cmdline.c: allow to read big endian
+	  on little endian machine
+
+2004-05-27 01:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.S, tools/emile-second.h, tools/emile-set-cmdline.c:
+	  Enhance second stage header
+
+2004-05-26 23:59  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: load.c, load.h: load binary image from disk
+
+2004-05-26 23:41  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: misc.c, misc.h: add memdump()
+
+2004-05-26 23:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/glue.S: Add PBReadSync()
+
+2004-05-26 23:30  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-first-tune.c: Align size and offset to 512
+
+2004-05-26 23:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/glue.h, tools/emile-first.h: move ParamBlockRec from
+	  tools/emile-first.h to second/glue.h
+
+2004-05-26 20:34  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/first.S: Align correctly memory to a frontier of 4
+
+2004-05-26 20:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: arch.h, bootinfo.h, head.S, main.c: move some stuff from
+	  head.S to main.c
+
+2004-05-26 01:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: remove BASE_ADDRESS as we have relocatable code now.
+	  Size provided in first seems to be total size = offsetof(second)
+	  + sizeof(second) = sizeof(floppy.img)
+
+2004-05-26 01:30  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: arch.c, bank.c, bootinfo.c, console.c, printf.c,
+	  uncompress.c: remove unneeded init of some variables to move it
+	  back to section bss
+
+2004-05-26 01:16  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.S: arch_init must be before init_memory_map,
+	  console_init can be the first call
+
+2004-05-26 00:39  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/first.S: align(4) the allocated buffer for second
+
+2004-05-25 22:34  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/: Makefile, first.S: Allocate memory for second stage
+	  instead of using an absolute address
+
+2004-05-25 22:14  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/glue.S: correct typo
+
+2004-05-25 22:12  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: head.S, ld.script: Allocate and relocate section BSS
+
+2004-05-25 21:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: ld.script, lowmem.h: Use absolute address to lowmem
+	  variables
+
+2004-05-25 21:30  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: glue.S, glue.h, memory.c: Use MacOS memory Management
+
+2004-05-25 01:59  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: Makefile, head.S, ld.script: Make second level
+	  relocatable using -fpic and "GLOBAL_OFFSET_TABLE" should be
+	  improved by using -mrelpc, but this flags is only supported by
+	  gcc > 3.0 (and I use gcc 2.95)
+
+2004-05-21 17:36  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-set-cmdline.c: correct typo
+
+2004-05-21 17:06  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: use emile-first-tune
+
+2004-05-21 14:42  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/: Makefile, emile-first-tune.c: Add command to tune first
+	  level
+
+2004-05-21 12:42  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-set-cmdline.c: Allow to read current command line
+
+2004-05-21 12:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* tools/emile-set-cmdline.c: Move some defines to emile-first.h
+
+2004-05-21 12:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile, tools/Makefile, tools/emile-first-info.c,
+	  tools/emile-first.h: Add emile-first-info to see content of boot
+	  block
+
+2004-05-21 12:18  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/first.S: adjust to be more "Utilities disk" like, adjust
+	  structures to be easily tunable
+
+2004-05-19 02:09  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile, second/Makefile, second/bootinfo.c, second/head.S,
+	  tools/Makefile, tools/emile-set-cmdline.c: Allow to set kernel
+	  command line
+
+2004-05-12 01:17  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* ChangeLog: Release 0.3
+
+2004-05-12 01:09  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Remove only first 32KB from allocatable memory
+
+2004-05-12 01:05  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/memory.c: Display physical memory
+
+2004-05-12 01:03  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Set version to 0.3
+
+2004-05-12 01:02  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: I move to a debian box, and ls and awk have not
+	  the same path as on my previous Mandrake box. I decide to remove
+	  absolute path.
+
+2004-03-06 02:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: call 030 when 030, and 040 when 040, and not 030
+	  when 040 and 040 when 030...
+
+2004-03-06 02:10  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Add 68040 MMU support
+
+2004-03-06 02:00  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/enter_kernel040.S: really disable MMU
+
+2004-03-06 01:25  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU040.c: clean code
+
+2004-03-06 01:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU040_asm.S: OOOPSS, it's better if we take pointer of
+	  the address to write in on the stack, from the parameter of the
+	  function...
+
+2004-03-06 00:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU040.c: Add Transparent Translation management,
+	  read_physical()
+
+2004-03-06 00:55  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU030.c: correct GET_TT_ENABLE
+
+2004-03-05 23:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: really use BASE_ADDRESS
+
+2004-03-05 23:41  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU040.c: First 040MMU support
+
+2004-03-05 23:39  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: MMU040.h, MMU040_asm.S: rename with MMU040_
+
+2004-03-04 23:51  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add 68040 MMU support skeleton
+
+2004-03-04 23:50  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: MMU.c, MMU.h, MMU030.c, MMU030.h, MMU030_asm.S,
+	  MMU040.c, MMU040.h, MMU040_asm.S, MMU_asm.S, enter_kernel.S,
+	  enter_kernel030.S, enter_kernel040.S: add 68040 MMU support
+	  skeleton
+
+2004-03-04 23:47  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: produce 68030 AND 68040 objects
+
+2004-03-04 23:47  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bank.c: add 68040 MMU support
+
+2004-03-04 23:46  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: remove MMU.h, rename enter_kernel as
+	  enter_kernel030
+
+2004-03-04 23:42  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: memory.c, bootinfo.c, console.c: remove MMU.h
+
+2004-02-27 00:43  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: remove some files for second level for powerPC,
+	  move to third level
+
+2004-02-27 00:38  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: arch.c, arch.h: More bus type info
+
+2004-02-27 00:37  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bootinfo.c: add TARGET_M68K for vars
+
+2004-02-26 23:57  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: MMU.c, MMU.h: prefix functions with MMU_
+
+2004-02-26 23:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: bank.c, bank.h: Manage noMMU and powerPC
+
+2004-02-26 23:55  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bootinfo.c: Move machine identification (cpu, mmu, fpu,
+	  architecture, bus) to arch.[ch]
+
+2004-02-26 23:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/glue.h: Add define noErr
+
+2004-02-26 23:52  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.S: Identify machine in arch_init()
+
+2004-02-26 23:51  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Add a skeleton of powerPC support
+
+2004-02-26 23:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: arch.c, arch.h: Add header
+
+2004-02-26 21:12  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/Makefile: add arch.o, and -DTARGET_PPC or -DTARGET_M68K
+
+2004-02-26 21:11  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add second/arch.[ch] in DISTFILES
+
+2004-02-26 21:10  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: arch.c, arch.h: Use Gestalt() to know property of
+	  curring system, including powerPC or 680x0 native architecture
+	  type
+
+2004-02-26 12:19  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: switch to 0.3CVS
+
+2004-02-24 23:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU.h: Remove TRACE_MMU
+
+2004-02-24 23:41  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Set Release 0.2
+
+2004-02-24 23:40  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* ChangeLog: 24 Feb 2004
+
+2004-02-24 23:31  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bootinfo.c: Get Time and GMT from MacOS
+
+2004-02-24 23:30  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: glue.S, glue.h: Add ReadLocation(MachineLocation)
+
+2004-02-24 23:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: ld.script, lowmem.h: Add Time to get time from MacOS
+
+2004-02-24 22:27  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Cleaning
+
+2004-02-24 00:51  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bootinfo.c: RAM disk address must be physical address
+
+2004-02-24 00:38  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: I decide: no need of KERNEL_ARCH in first level
+
+2004-02-24 00:37  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* ChangeLog:  24 Feb 2004
+
+2004-02-24 00:34  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: works with RBV mac ! thank you penguin... very
+	  messy: FIX ME !
+
+2004-02-24 00:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/enter_kernel.S: Add 3rd parameter to set destination
+	  address to copy kernel
+
+2004-02-24 00:31  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bootinfo.c: create boot_info[].memory like in the penguin
+	  (bigger first, physical memory blocs)
+
+2004-02-24 00:29  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bank.c: let bank_dump() for debug purpose only, activate
+	  it with BANK_DUMP macro
+
+2004-02-23 01:24  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: bank.c, bank.h: Add bank_mem_avail(): compute size of
+	  available memory
+
+2004-02-23 01:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/memory.c: Try to allocate memory to not have a bloc across
+	  two banks, correct management of top memory, and low memory
+
+2004-02-23 01:21  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/enter_kernel.S: cosmetic change, remove disabling
+	  interrupts and cache:moved to caller
+
+2004-02-23 01:20  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Disable interrupts, correct entry_t
+
+2004-02-21 02:56  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/console.h: re-add console_get_height()
+
+2004-02-21 02:52  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU.h: Add MMU_set_trace()
+
+2004-02-21 02:51  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/enter_kernel.S: reenable MMU desabling
+
+2004-02-21 02:51  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/enter_kernel.S: add end_enter_kernel, unify a2/a0
+
+2004-02-21 02:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/bank.c: Add logical address to compute bank linits
+
+2004-02-21 02:47  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: console.c, console.h, glue.S, glue.h: Add real video
+	  base address instead of computed one (with bounds)
+
+2004-02-21 02:43  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Try to boot on RBV system
+
+2004-02-21 02:21  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU.c: Correct bad table address evaluation
+
+2004-02-21 01:48  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU.c: Add dynamic trace, TT registers management
+
+2004-02-19 14:14  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Add second/bank.[ch] in DISTFILES
+
+2004-02-19 14:09  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: bank.c, bank.h, main.c, memory.c: Rename map to
+	  memory_map and export it
+
+2004-02-19 12:34  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* ChangeLog, second/Makefile, second/bank.c, second/bank.h,
+	  second/bootinfo.c, second/main.c, second/memory.c,
+	  second/memory.h: add bank.[ch], move memory bank management into
+	  them
+
+2004-02-17 23:57  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* ChangeLog: 17 Feb 2004
+
+2004-02-17 23:55  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/main.c: Correct typo
+
+2004-02-17 23:52  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: bootinfo.c, main.c, memory.c, memory.h: Add logical
+	  address in bank information
+
+2004-02-17 23:09  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU.c: correct computing of physical address
+
+2004-02-17 22:30  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU.c: correct LIMIT management in decode_8_PD()
+
+2004-02-17 21:53  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/MMU.c: add TRACE(), correct Table Indices extraction in
+	  decode_[48]_PD()
+
+2004-02-17 11:32  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* ChangeLog: [no log message]
+
+2004-02-17 11:30  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: MMU.c, MMU.h: Add dump_MMU_table() correct 8byte table
+	  scan
+
+2004-02-17 11:26  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/: main.c, bootinfo.c: move call to get_memory_mep() to
+	  memory.c
+
+2004-02-17 11:25  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/memory.h: export memory_map
+
+2004-02-17 11:23  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/memory.c: we generate memory_map here
+
+2004-02-17 11:09  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* second/head.S: Move call of bootinfo_init after memory_init (use
+	  memory_map)
+
+2004-02-17 11:06  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: Detect architecture (PPC or 68K) of kernel
+
+2004-02-16 16:04  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile: update VERSION with 0.2CVS
+
+2004-02-16 16:04  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* first/: Makefile, config.h: config.h is a generated file: -
+	  remove it from CVS - "make clean" removes it
+
+2004-02-15 21:46  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile, AUTHORS, COPYING, ChangeLog, README, second/MMU.c,
+	  second/head.S, second/MMU.h, second/MMU_asm.S, second/Makefile,
+	  second/console.c, second/console.h, second/main.c,
+	  second/printf.c, second/uncompress.h, second/font_8x16.c,
+	  second/ld.script, second/memory.c, second/bootinfo.h,
+	  second/inflate.c, second/lowmem.h, second/misc.c, second/misc.h,
+	  second/uncompress.c, first/Makefile, first/config.h,
+	  first/first.S, second/bootinfo.c, second/enter_kernel.S,
+	  second/glue.S, second/glue.h, second/memory.h: First release 0.1
+
+2004-02-15 21:46  Laurent Vivier <LaurentVivier at wanadoo.fr>
+
+	* Makefile, AUTHORS, COPYING, ChangeLog, README, second/MMU.c,
+	  second/head.S, second/MMU.h, second/MMU_asm.S, second/Makefile,
+	  second/console.c, second/console.h, second/main.c,
+	  second/printf.c, second/uncompress.h, second/font_8x16.c,
+	  second/ld.script, second/memory.c, second/bootinfo.h,
+	  second/inflate.c, second/lowmem.h, second/misc.c, second/misc.h,
+	  second/uncompress.c, first/Makefile, first/config.h,
+	  first/first.S, second/bootinfo.c, second/enter_kernel.S,
+	  second/glue.S, second/glue.h, second/memory.h: Initial revision
+

Added: branches/vendor/emile/Makefile
===================================================================
--- branches/vendor/emile/Makefile	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/Makefile	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,393 @@
+#
+#  (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+#
+#
+
+MAKEFLAGS += --no-print-directory
+
+PACKAGE	= emile
+VERSION	= 0.10
+
+PREFIX=/
+
+# kernel boot arguments
+
+FLOPPY=/dev/floppy/0
+#CONSOLE=console=ttyS0,9600n8 console=tty0
+
+NETBOOT_ARGS="root=/dev/nfs ip=dhcp rw $(CONSOLE)"
+RESCUE_ARGS="root=/dev/ramdisk ramdisk_size=2048 $(CONSOLE)"
+CDBOOT_ARGS="root=/dev/ramdisk ramdisk_size=13000 $(CONSOLE)"
+INSTALLER_ARGS="prompt_ramdisk=1 load_ramdisk=1 ramdisk_start=0 root=/dev/fd0 ramdisk_size=4096 $(CONSOLE)"
+BOOT_ARGS="root=/dev/sda4 $(CONSOLE)"
+
+# build info
+
+WHO	= $(shell whoami)
+WHERE	= $(shell hostname)
+WHEN	= $(shell LANG=C date)
+ARCH	= $(shell uname -m)
+OS	= $(shell uname -o)
+
+SIGNATURE = $(PACKAGE)-$(VERSION) $(WHO)@$(WHERE)($(ARCH) $(OS)) $(WHEN)
+
+# tools to use
+
+AS=$(CROSS_COMPILE)as
+CC=$(CROSS_COMPILE)gcc
+LD=$(CROSS_COMPILE)ld
+OBJCOPY=$(CROSS_COMPILE)objcopy
+STRIP=$(CROSS_COMPILE)strip
+
+ifneq ($(ARCH),m68k)
+M68K_CROSS_COMPILE	= m68k-linux-
+endif
+
+M68K_AS=$(M68K_CROSS_COMPILE)as
+M68K_CC=$(M68K_CROSS_COMPILE)gcc
+M68K_LD=$(M68K_CROSS_COMPILE)ld
+M68K_OBJCOPY=$(M68K_CROSS_COMPILE)objcopy
+M68K_STRIP=$(M68K_CROSS_COMPILE)strip
+
+ifneq ($(ARCH),ppc)
+PPC_CROSS_COMPILE	= ppc-linux-
+endif
+
+PPC_AS=$(PPC_CROSS_COMPILE)as
+PPC_CC=$(PPC_CROSS_COMPILE)gcc
+PPC_LD=$(PPC_CROSS_COMPILE)ld
+PPC_OBJCOPY=$(PPC_CROSS_COMPILE)objcopy
+
+# Kernel architecture
+
+LINUXRAMDISK=ramdisk.gz
+LINUXPATH=vmlinux
+
+LINUX=$(shell ls $(LINUXPATH) 2> /dev/null)
+
+ifeq ($(LINUX),$(LINUXPATH))
+	FILEARCH=$(shell file -bknL $(LINUX) | cut -d, -f 2)
+	ifeq ($(findstring PowerPC, $(FILEARCH)), PowerPC)
+
+		KARCH=ppc
+
+	else
+	ifeq ($(findstring Motorola 68000, $(FILEARCH)), Motorola 68000)
+
+		KARCH=classic
+
+	else
+	ifeq ($(findstring Motorola 68, $(FILEARCH)), Motorola 68)
+
+		KARCH=m68k
+	else
+		KARCH=unknown
+	endif
+	endif
+	endif
+else
+	KARCH=m68k
+endif
+
+# Target
+
+.PHONY: first libemile libblock libiso9660 libiso9660-m68k libgzip-m68k tools \
+       libcontainer clean all_bin all install tools-install first-install docs-install \
+       uninstall tools-uninstall first-uninstall docs-uninstall \
+       clean libemile-clean libmacos-clean libunix-clean tools-clean \
+       first-clean second-clean docs-clean libiso9660-clean libgzip-clean \
+       libfloppy-clean libscsi-clean libstream-clean libblock-clean dist docs
+
+all: docs libemile libblock libiso9660 libiso9660-m68k libgzip-m68k \
+     tools first libstream libcontainer \
+     second/$(KARCH)-linux-floppy/second \
+     second/$(KARCH)-linux-scsi/second second/m68k-netbsd-floppy/second
+
+# We can build floppy image only if a kernel is provided
+
+ifeq ($(LINUX),$(LINUXPATH))
+all_bin: netboot.bin rescue.bin debian-installer.bin boot.bin \
+	 cdboot-sarge.bin cdboot-woody.bin second/$(KARCH)-linux-scsi/second
+	rm -f last.bin
+
+cdboot-woody.bin: tools first second/$(KARCH)-linux-scsi/second
+	tools/emile-install -f first/first_floppy \
+			    -s second/$(KARCH)-linux-scsi/second \
+			    -k "iso9660:(sd3)/install/mac/linux.bin" \
+			    -r "iso9660:(sd3)/install/mac/root.bin" \
+			    cdboot-woody.bin.X
+	tools/emile-set-cmdline cdboot-woody.bin.X $(CDBOOT_ARGS)
+	mv cdboot-woody.bin.X cdboot-woody.bin
+	rm -f last.bin
+	ln -s cdboot-woody.bin last.bin
+
+cdboot-sarge.bin: tools first second/$(KARCH)-linux-scsi/second
+	tools/emile-install -f first/first_floppy \
+			-s second/$(KARCH)-linux-scsi/second \
+			-k "iso9660:(sd3)/install/kernels/vmlinuz-2.2.25-mac" \
+			-r "iso9660:(sd3)/install/cdrom/initrd22.gz" \
+			    cdboot-sarge.bin.X
+	tools/emile-set-cmdline cdboot-sarge.bin.X $(CDBOOT_ARGS)
+	mv cdboot-sarge.bin.X cdboot-sarge.bin
+	rm -f last.bin
+	ln -s cdboot-sarge.bin last.bin
+
+floppy.bin: tools first vmlinuz \
+	    second/$(KARCH)-linux-floppy/second
+	tools/emile-install -f first/first_floppy \
+			    -s second/$(KARCH)-linux-floppy/second \
+			    -k vmlinuz floppy.bin.X
+ifdef CONSOLE
+	tools/emile-set-output floppy.bin.X --printer --modem
+endif
+	mv floppy.bin.X floppy.bin
+
+floppy_ramdisk.bin: tools first vmlinuz \
+		    second/$(KARCH)-linux-floppy/second $(LINUXRAMDISK)
+	tools/emile-install -f first/first_floppy  \
+			    -s second/$(KARCH)-linux-floppy/second \
+			    -k vmlinuz -r $(LINUXRAMDISK) floppy_ramdisk.bin.X
+ifdef CONSOLE
+	tools/emile-set-output floppy_ramdisk.bin.X --printer --modem
+endif
+	mv floppy_ramdisk.bin.X floppy_ramdisk.bin
+
+debian-installer.bin: floppy.bin
+	rm -f last.bin
+	cp floppy.bin debian-installer.bin.X
+	tools/emile-set-cmdline debian-installer.bin.X $(INSTALLER_ARGS)
+	mv debian-installer.bin.X debian-installer.bin
+	ln -s debian-installer.bin last.bin
+
+netboot.bin: floppy.bin
+	rm -f last.bin
+	cp floppy.bin netboot.bin.X
+	tools/emile-set-cmdline netboot.bin.X $(NETBOOT_ARGS)
+	mv netboot.bin.X netboot.bin
+	ln -s netboot.bin last.bin
+
+rescue.bin: floppy_ramdisk.bin
+	rm -f last.bin
+	cp floppy_ramdisk.bin rescue.bin.X
+	tools/emile-set-cmdline rescue.bin.X $(RESCUE_ARGS)
+	mv rescue.bin.X rescue.bin
+	ln -s rescue.bin last.bin
+
+boot.bin: floppy.bin
+	rm -f last.bin
+	cp floppy.bin boot.bin.X
+	tools/emile-set-cmdline boot.bin.X $(BOOT_ARGS)
+	mv boot.bin.X boot.bin
+	ln -s boot.bin last.bin
+
+vmlinuz: $(LINUX)
+	$(M68K_STRIP) -s $(LINUX) -o $(LINUX).stripped
+	gzip -9 $(LINUX).stripped
+	mv $(LINUX).stripped.gz vmlinuz
+endif
+
+NETBSDPATH=netbsd
+
+NETBSD=$(shell ls $(NETBSDPATH) 2> /dev/null)
+
+ifeq ($(NETBSD),$(NETBSDPATH))
+netbsd-floppy.bin: tools first netbsd.gz \
+	    second/m68k-netbsd-floppy/second
+	tools/emile-install -f first/first_floppy \
+			    -s second/$(KARCH)-netbsd-floppy/second \
+			    -k netbsd.gz netbsd-floppy.bin.X
+ifdef CONSOLE
+	tools/emile-set-output netbsd-floppy.bin.X --printer --modem
+endif
+	mv netbsd-floppy.bin.X netbsd-floppy.bin
+
+netbsd-boot.bin: netbsd-floppy.bin
+	rm -f last.bin
+	cp netbsd-floppy.bin netbsd-boot.bin.X
+	tools/emile-set-cmdline netbsd-boot.bin.X $(BOOT_ARGS)
+	mv netbsd-boot.bin.X netbsd-boot.bin
+	ln -s netbsd-boot.bin last.bin
+
+netbsd.gz: $(NETBSD)
+	$(M68K_STRIP) -s $(NETBSD) -o $(NETBSD).stripped
+	gzip -9 $(NETBSD).stripped
+	mv $(NETBSD).stripped.gz netbsd.gz
+endif
+
+export SIGNATURE VERSION DESTDIR PREFIX KARCH CROSS_COMPILE
+
+first::
+	$(MAKE) -C first OBJCOPY=$(M68K_OBJCOPY) AS=$(M68K_AS)
+
+second/$(KARCH)-linux-floppy/second:: libmacos libunix libiso9660-m68k libgzip-m68k libfloppy libscsi libstream libblock libcontainer
+	$(MAKE) -C second OBJCOPY=$(M68K_OBJCOPY) LD=$(M68K_LD) CC=$(M68K_CC) \
+		AS=$(M68K_AS) MEDIA=floppy TARGET=$(KARCH)-linux
+
+second/$(KARCH)-linux-scsi/second:: libmacos libunix libiso9660-m68k libgzip-m68k libscsi libstream libblock libcontainer
+	$(MAKE) -C second OBJCOPY=$(M68K_OBJCOPY) LD=$(M68K_LD) CC=$(M68K_CC) \
+		AS=$(M68K_AS) TARGET=$(KARCH)-linux MEDIA=scsi
+
+second/m68k-netbsd-floppy/second:: libmacos libunix libiso9660-m68k libgzip-m68k libfloppy libstream libblock libcontainer
+	$(MAKE) -C second OBJCOPY=$(M68K_OBJCOPY) LD=$(M68K_LD) CC=$(M68K_CC) \
+		AS=$(M68K_AS) TARGET=m68k-netbsd MEDIA=floppy
+
+first-install::
+	$(MAKE) -C first install
+
+first-uninstall::
+	$(MAKE) -C first uninstall
+
+second-install::
+	$(MAKE) -C second install 
+
+second-uninstall::
+	$(MAKE) -C second uninstall
+
+libmacos::
+	$(MAKE) -C libmacos all CC=$(M68K_CC) AS=$(M68K_AS)
+
+libunix::
+	$(MAKE) -C libunix all CC=$(M68K_CC) AS=$(M68K_AS)
+
+libiso9660-m68k::
+	$(MAKE) -C libiso9660 all LD=$(M68K_LD) CC=$(M68K_CC) AS=$(M68K_AS) \
+		TARGET=m68k-linux
+
+libiso9660::
+	$(MAKE) -C libiso9660 all TARGET=native CROSS_COMPILE=$(CROSS_COMPILE)
+
+libcontainer::
+	$(MAKE) -C libcontainer all LD=$(M68K_LD) CC=$(M68K_CC) AS=$(M68K_AS)
+
+libblock::
+	$(MAKE) -C libblock all LD=$(M68K_LD) CC=$(M68K_CC) AS=$(M68K_AS)
+
+libgzip-m68k::
+	$(MAKE) -C libgzip all TARGET=$(KARCH)-linux LD=$(M68K_LD) CC=$(M68K_CC) AS=$(M68K_AS) TARGET=m68k-linux
+
+libgzip::
+	$(MAKE) -C libgzip all TARGET=native CROSS_COMPILE=$(CROSS_COMPILE)
+
+libemile::
+	$(MAKE) -C libemile all CROSS_COMPILE=$(CROSS_COMPILE)
+
+libfloppy::
+	$(MAKE) -C libfloppy all CC=$(M68K_CC) AS=$(M68K_AS)
+
+libscsi::
+	$(MAKE) -C libscsi all CC=$(M68K_CC) AS=$(M68K_AS)
+
+libstream::
+	$(MAKE) -C libstream all CC=$(M68K_CC) AS=$(M68K_AS)
+
+tools::  libemile libiso9660 libgzip
+	$(MAKE) -C tools all CROSS_COMPILE=$(CROSS_COMPILE)
+
+tools-install:: tools
+	$(MAKE) -C tools install
+
+tools-uninstall::
+	$(MAKE) -C tools uninstall
+
+docs-install:: docs
+	$(MAKE) -C docs install
+
+docs-uninstall::
+	$(MAKE) -C docs uninstall
+
+docs::
+	$(MAKE) -C docs all
+
+dump: last.bin
+	dd if=last.bin of=$(FLOPPY) bs=512
+
+install: tools-install first-install second-install docs-install
+
+uninstall: tools-uninstall first-uninstall second-uninstall docs-uninstall
+
+libemile-clean:
+	$(MAKE) -C libemile clean
+
+libmacos-clean:
+	$(MAKE) -C libmacos clean
+
+libunix-clean:
+	$(MAKE) -C libunix clean
+
+libscsi-clean:
+	$(MAKE) -C libscsi clean
+
+libstream-clean:
+	$(MAKE) -C libstream clean
+
+libiso9660-clean::
+	$(MAKE) -C libiso9660 clean TARGET=native
+	$(MAKE) -C libiso9660 clean TARGET=$(KARCH)-linux
+
+libcontainer-clean::
+	$(MAKE) -C libcontainer clean
+
+libblock-clean::
+	$(MAKE) -C libblock clean
+
+libgzip-clean::
+	$(MAKE) -C libgzip clean TARGET=native
+	$(MAKE) -C libgzip clean TARGET=$(KARCH)-linux
+
+tools-clean:
+	$(MAKE) -C tools clean
+
+first-clean:
+	$(MAKE) -C first clean
+
+second-clean:
+	$(MAKE) -C second clean
+
+docs-clean:
+	$(MAKE) -C docs clean
+
+libfloppy-clean:
+	$(MAKE) -C libfloppy clean
+
+clean:: libemile-clean libmacos-clean libunix-clean tools-clean first-clean \
+	second-clean docs-clean libiso9660-clean libgzip-clean libfloppy-clean \
+	libscsi-clean libstream-clean libblock-clean libcontainer-clean
+	rm -f floppy.bin floppy.bin.X floppy_ramdisk.bin \
+	      floppy_ramdisk.bin.X rescue.bin rescue.bin.X \
+	      debian-installer.bin debian-installer.bin.X \
+	      netboot.bin netboot.bin.X boot.bin boot.bin.X \
+	      vmlinuz last.bin cdboot-sarge.bin cdboot-woody.bin
+
+DISTFILES = AUTHORS ChangeLog COPYING Makefile README README.floppy \
+	    README.scsi Rules.mk
+
+dist:
+	rm -fr $(PACKAGE)-$(VERSION)
+	mkdir $(PACKAGE)-$(VERSION)
+	@$(MAKE) -C tools dist DISTDIR=$(shell pwd)/$(PACKAGE)-$(VERSION)
+	@$(MAKE) -C libemile dist DISTDIR=$(shell pwd)/$(PACKAGE)-$(VERSION)
+	@$(MAKE) -C second dist DISTDIR=$(shell pwd)/$(PACKAGE)-$(VERSION)
+	@$(MAKE) -C first dist DISTDIR=$(shell pwd)/$(PACKAGE)-$(VERSION)
+	@$(MAKE) -C docs dist DISTDIR=$(shell pwd)/$(PACKAGE)-$(VERSION)
+	@$(MAKE) -C libmacos dist DISTDIR=$(shell pwd)/$(PACKAGE)-$(VERSION)
+	@$(MAKE) -C libunix dist DISTDIR=$(shell pwd)/$(PACKAGE)-$(VERSION)
+	@$(MAKE) -C libstream dist DISTDIR=$(shell pwd)/$(PACKAGE)-$(VERSION)
+	@$(MAKE) -C libscsi dist DISTDIR=$(shell pwd)/$(PACKAGE)-$(VERSION)
+	@$(MAKE) -C libfloppy dist DISTDIR=$(shell pwd)/$(PACKAGE)-$(VERSION)
+	@$(MAKE) -C libblock dist DISTDIR=$(shell pwd)/$(PACKAGE)-$(VERSION)
+	@$(MAKE) -C libiso9660 dist DISTDIR=$(shell pwd)/$(PACKAGE)-$(VERSION)
+	@$(MAKE) -C libcontainer dist DISTDIR=$(shell pwd)/$(PACKAGE)-$(VERSION)
+	@$(MAKE) -C libgzip dist DISTDIR=$(shell pwd)/$(PACKAGE)-$(VERSION)
+	@$(MAKE) -C tools dist DISTDIR=$(shell pwd)/$(PACKAGE)-$(VERSION)
+	@echo TAR emile
+	@for file in $(DISTFILES); do \
+		dir=$$(dirname $$file); \
+		if [ "$$dir" != "" ] ; then \
+			mkdir -p $(PACKAGE)-$(VERSION)/$$dir; \
+		fi; \
+		cp -p $$file $(PACKAGE)-$(VERSION)/$$file; \
+	done
+	@rm -f $(PACKAGE)-$(VERSION).tar $(PACKAGE)-$(VERSION).tar.bz2
+	@tar cf $(PACKAGE)-$(VERSION).tar $(PACKAGE)-$(VERSION)
+	@bzip2 -9 $(PACKAGE)-$(VERSION).tar
+	@rm -fr $(PACKAGE)-$(VERSION)

Added: branches/vendor/emile/README
===================================================================
--- branches/vendor/emile/README	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/README	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,31 @@
+			EMILE 0.1
+		(C) 2004 Laurent Vivier
+
+	All files are distributed under the terms of GPL license. See COPYING.
+
+This tool allows to generate a floppy bootable on early macintoshes (680x0 
+based macintoshes).
+
+In the booter, is embedded the kernel found in top directory under the name of 
+"vmlinux". It has been generated previously in linux source tree with 
+"make vmlinux". If a ramdisk (ramdisk.gz) is found, it is also added in
+the floppy image.
+
+Type "make" to generate the floppy image (floppy.img).
+
+To write the image to floppy you can type "make dump".
+
+This work is based on the penguin booter for mac68k, on linux kernel, and 
+perhaps on the ppc booter BootX.
+
+Some problems can appear when there is no physical memory in the first bank.
+
+All mechanisms found in "penguin" have not been implemented in EMILE.
+You can ask me if one is missing for you :-P
+
+This work has only be tested on a MacIIci with 8 x 4 MB RAM, a Two-Page Display,
+and ethernet card sonic.
+
+Have fun
+Laurent Vivier <LaurentVivier at wanadoo.fr>
+11 Fevrier 2004 ;-)

Added: branches/vendor/emile/README.floppy
===================================================================
--- branches/vendor/emile/README.floppy	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/README.floppy	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,92 @@
+This file explains how to install EMILE to boot from a floppy
+
+--------------------------------------------------------------------------------
+How to Create a floppy from rescue disk image
+--------------------------------------------------------------------------------
+
+You can find floppy image from the package emile-rescue
+
+Under linux, the command to dump image to floppy is:
+
+	# dd if=emile-rescue-x.y.bin of=/dev/fd0 bs=512 conv=sync
+
+then, you can eject floppy with:
+
+	# eject /dev/fd0
+	
+
+If you are using MacOS, use MakeDebianFloppy AppleScript
+(you must use a floppy image with a size of exactly 1474560 bytes).
+If you are neither using linux, nor MacOS, please refer to rawrite page
+
+--------------------------------------------------------------------------------
+How to Change the kernel boot arguments
+--------------------------------------------------------------------------------
+
+The command to set kernel boot arguments is emile-set-cmdline:
+
+        emile-set-cmdline <image> <cmdline>
+        
+
+    * <image> is the floppy image or a device file (/dev/fd0) to set
+    * <cmdline> is new kernel boot arguments
+
+For instance, to set root filesystem on disk 1 partition 4
+
+ 	# emile-set-cmdline floppy.img "root=/dev/sda4"
+        
+
+To set root filesystem on ramdisk
+
+ 	# emile-set-cmdline floppy.img "root=/dev/ramdisk ramdisk_size=2048"
+ 	
+
+To set root filesystem on NFS
+
+ 	# emile-set-cmdline floppy.img \
+
+	"root=/dev/nfs ip=dhcp nfsroot=192.168.100.1:/tftboot/192.168.100.51/"
+	
+
+You can also read current boot arguments from floppy:
+
+	# emile-set-cmdline -r /dev/fd0
+	Current command line: "root=/dev/ramdisk ramdisk_size=2048"
+	
+--------------------------------------------------------------------------------
+How to Create your floppy image with your kernel
+--------------------------------------------------------------------------------
+
+First of all, you must "flatten" the kernel object:
+
+	# objcopy -I elf32-big -O binary -R .note -R .comment -S vmlinux vmlinux.bin
+	
+
+To allocate correct buffer size during uncompress, EMILE needs to know the size of flattened kernel:
+
+	# ls -l vmlinux.bin
+	-rwxr-xr-x    1 m68k     users     1290240 2004-06-09 22:41 vmlinux.bin
+	
+
+You can now compress kernel with gzip (bzip2 is not supported by EMILE):
+
+	# gzip -9 vmlinux.bin
+	
+
+You can copy first and second level bootloader and kernel to floppy:
+
+	# emile-install -f first -s second -i vmlinux.bin.gz -b 1290240 /dev/fd0
+	
+
+And finally, you can set kernel boot arguments:
+
+	# emile-set-cmdline /dev/fd0 "root=/dev/sda4"
+	
+
+If you have a ramdisk, the two last steps become:
+
+	# emile-install -f first -s second -i vmlinux.bin.gz -b 1290240 -r ramdisk.gz /dev/fd0
+	# emile-set-cmdline /dev/fd0 "root=/dev/ramdisk ramdisk_size=2048"
+	
+--------------------------------------------------------------------------------
+Laurent Vivier <LaurentVivier at wanadoo.fr>

Added: branches/vendor/emile/README.scsi
===================================================================
--- branches/vendor/emile/README.scsi	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/README.scsi	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,129 @@
+This file explains how to install EMILE to boot from a SCSI disk.
+
+first of all:
+
+USE WITH CAUTION AND AT YOUR OWN RISKS !!!!!
+
+This operations will modify properties of your partition map (if you haven't got HFS partition) or the bootblock of your HFS partition (if exists)
+
+If you generate binaries from sources packages, you must:
+
+# cp emile/tools/emile /sbin
+# mkdir /boot/emile
+# cp first/first_scsi /boot/emile
+# cp second/second_scsi /boot/emile
+
+The first operation to do is to show the state of your partition map:
+
+emile2:~# emile --scanbus -v
+/dev/sda: block size: 512, blocks number: 528808 (258.207 MB)
+  Drivers
+     0: base: 64 size: 19 type: 1 <2: Macintosh [Apple_Driver43]>
+  Partitions
+     /dev/sda1 :            Apple [Apple_partition_map]
+                 base: 1, count: 63 (31.500 kB)
+                 flags: 0x00000037
+     /dev/sda2 :        Macintosh [Apple_Driver43  ]  *
+                 base: 64, count: 32 (16.000 kB)
+                 flags: 0x0000007f
+     /dev/sda3 :        A/UX Root [Apple_UNIX_SVR2 ]
+                 base: 182864, count: 345944 (168.917 MB)
+                 flags: 0x00000037
+     /dev/sda4 :             Swap [Apple_UNIX_SVR2 ]
+                 base: 150096, count: 32768 (16.000 MB)
+                 flags: 0x00000037
+     /dev/sda5 :            MacOS [Apple_HFS       ]  <Apple bootblock>
+                 base: 96, count: 150000 (73.242 MB)
+                 flags: 0x000000b7
+
+The aim of the operation is to install the EMILE bootblock on the first HFS
+partition of the disk and to set information in it to find the second level 
+boot block. Then with set information in second level to find the kernel. All 
+is done automtically by emile.
+
+But you need a kernel... you can use the one provided with your Debian after a little modification: move it from ELF format to binary format.
+
+# cd /boot
+# gzip -d -c vmlinuz-2.2.20-mac > vmlinux-2.2.20.tmp
+# objcopy -I elf32-big -O binary -R .note -R .comment \
+					-S vmlinux-2.2.20.tmp vmlinux-2.2.20
+# rm vmlinux-2.2.20.tmp
+
+You can compress if with gzip if you want, but you have enough space on your
+disk, let it uncompressed: the boot sequence will be faster.
+
+Now, we have a kernel, we can install EMILE !
+
+You can test operation without modifying anything with parameter "--test".
+
+emile2:~# emile --test --kernel /boot/vmlinux-2.2.20
+ERROR: there is already a bootblock on "/dev/sda5"
+       you must use "--backup" to save it
+partition:   /dev/sda5
+first:       /boot/emile/first_scsi
+second:      /boot/emile/second_scsi
+kernel:      /boot/vmlinux-2.2.20
+append:      root=/dev/sda3
+buffer size: 0
+
+As we try to avoid to lost the Apple bootblock, EMILE check it and did nothing
+if you don't explicitly backup it.
+
+Now, we can really install EMILE:
+
+emile2:~# emile --kernel /boot/vmlinux-2.2.20 --backup
+Bootblock backup successfully done.
+partition:   /dev/sda5
+first:       /boot/emile/first_scsi
+second:      /boot/emile/second_scsi
+kernel:      /boot/vmlinux-2.2.20
+append:      root=/dev/sda3
+buffer size: 0
+(352374, 24) (352400, 512) (352916, 512) (353430, 484) (353930, 28) (353960, 512) (354474, 512) (354988, 72) (357750, 234) (372902, 38) (373522, 18) (373542, 20) (373564, 20) (373586, 20) (373608, 10)
+kernel image size: 1544192
+(314486, 24) (314512, 16) (182864, 2) (182864, 2) (182864, 2) (182864, 2) (314528, 16)
+
+Note: by default, EMILE installs bootblock on first HFS partition, and set 
+"root=" to the partition where is stored second_level.
+
+You can specify all parameters, see emile usage:
+
+emile2:~# emile --help
+Usage: emile [OPTION]
+Update and install EMILE stuff on your SCSI disk.
+EMILE allows to boot linux directly from linux partition
+  -h, --help           display this text
+  -v, --verbose        active verbose mode
+  -t, --test           active test mode (don't write to disk)
+  --scanbus            display information about all disks and partitions
+  -f, --first PATH     set path of EMILE first level
+  -s, --second PATH    set path of EMILE second level
+  -k, --kernel PATH    set path of kernel
+  -a, --append ARG     set kernel command line
+  -p, --partition DEV  define device where to install boot block
+  --restore[=FILE]     save current boot block from FILE
+  --backup[=FILE]      save current boot block to FILE
+  --set-hfs            set type of partition DEV to Apple_HFS (needed to be bootable)
+
+If you want to boot MacOS again (sure ?), you must restore the Apple bootblock
+with:
+
+emile2:~# emile --restore
+Bootblock restore successfully done.
+
+"--backup" saves by default bootblock in "/boot/emile/bootblock.backup"
+
+But remember, to be bootable, a disk must have:
+- a partition map
+- an Apple_Driver partition
+- an Apple_HFS partition
+- a bootblock on Apple_HFS
+
+EMILE cannot create an Apple_Driver partition, so you must partition before
+all your disk with the Apple Disk Utility.
+If you don't want to have MacOS on your disk, EMILE can change the linux root
+partition to HFS... and all works fine ;-)
+
+And now, you can start linux in less than 2 seconds...
+
+Laurent Vivier <LaurentVivier at wanadoo.fr>

Added: branches/vendor/emile/Rules.mk
===================================================================
--- branches/vendor/emile/Rules.mk	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/Rules.mk	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,36 @@
+#
+#  (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+#
+
+OBJS	= $(patsubst %.sgml,%.8.gz,$(patsubst %.S,%.o,$(SOURCES:.c=.o)))
+
+MODULE ?= $(shell basename $(TOP))
+
+DISTFILES ?= $(SOURCES) $(HEADERS) Makefile
+
+$(LIBRARY): $(LIBRARY)($(patsubst %.S,%.o,$(SOURCES:.c=.o)))
+
+%.8: %.sgml
+	docbook-to-man $< > $@
+
+%.8.gz: %.8
+	gzip -9c $< > $@
+
+dist:
+	@echo TAR $(MODULE)
+	@for file in $(DISTFILES); do \
+		dir=$$(dirname $$file); \
+		if [ "$$dir" != "" ] ; then \
+			mkdir -p $(DISTDIR)/$(MODULE)/$$dir; \
+		fi; \
+		cp -p $$file $(DISTDIR)/$(MODULE)/$$file; \
+	done
+
+ifdef TARGET
+clean:
+	cd $(TARGET) && \
+	rm -f $(OBJS) $(PROGRAMS) $(LIBRARY)
+else
+clean:
+	rm -f $(OBJS) $(PROGRAMS) $(LIBRARY) $(CLEAN) $(LIBRARIES)
+endif

Added: branches/vendor/emile/docs/Makefile
===================================================================
--- branches/vendor/emile/docs/Makefile	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/docs/Makefile	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,21 @@
+TOP=$(shell pwd)
+
+SOURCES	= emile-first-tune.sgml emile-install.sgml emile-map-set.sgml \
+	  emile-set-cmdline.sgml emile-set-output.sgml emile.sgml
+
+MANPAGES = $(SOURCES:.sgml=.8.gz)
+
+MANPATH = /usr/share/man/man8
+
+MANPAGESWPATH = $(foreach file, $(MANPAGES), $(MANPATH)/$(file))
+
+all: $(MANPAGES)
+
+install: all
+	install -m 755 -d $(DESTDIR)/$(PREFIX)/$(MANPATH)
+	install -m 644 *.8.gz $(DESTDIR)/$(PREFIX)/$(MANPATH)
+
+uninstall:
+	rm -f $(MANPAGESWPATH)
+
+include $(TOP)/../Rules.mk

Added: branches/vendor/emile/docs/emile-first-tune.sgml
===================================================================
--- branches/vendor/emile/docs/emile-first-tune.sgml	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/docs/emile-first-tune.sgml	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,158 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+
+<!-- Process this file with docbook-to-man to generate an nroff manual
+     page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
+     the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+     less'.  A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+	docbook-to-man $< > $@
+  -->
+
+  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+  <!ENTITY dhfirstname "<firstname>Stephen</firstname>">
+  <!ENTITY dhsurname   "<surname>Marenka</surname>">
+  <!-- Please adjust the date whenever revising the manpage. -->
+  <!ENTITY dhdate      "<date>May 26, 2005</date>">
+  <!ENTITY dhsection   "<manvolnum>8</manvolnum>">
+  <!ENTITY dhemail     "<email>stephen at marenka.net</email>">
+  <!ENTITY dhusername  "Stephen R. Marenka">
+  <!ENTITY dhucpackage "<refentrytitle>emile-first-tune</refentrytitle>">
+  <!ENTITY dhpackage   "emile">
+  <!ENTITY dhprogram   "emile-first-tune">
+
+  <!ENTITY debian      "<productname>Debian GNU/Linux</productname>">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+]>
+
+<refentry>
+  <refentryinfo>
+    <address>
+      &dhemail;
+    </address>
+    <author>
+      &dhfirstname;
+      &dhsurname;
+    </author>
+    <copyright>
+      <year>2005</year>
+      <holder>&dhusername;</holder>
+    </copyright>
+    &dhdate;
+  </refentryinfo>
+  <refmeta>
+    &dhucpackage;
+
+    &dhsection;
+  </refmeta>
+  <refnamediv>
+    <refname>&dhprogram;</refname>
+
+    <refpurpose>Set the <command>&dhpackage;</command> 
+		bootloader first level boot block info.
+	</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>&dhprogram;</command>
+	<arg><replaceable>options</replaceable></arg>
+	<arg>image</arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>DESCRIPTION</title>
+
+    <para><command>&dhprogram;</command> sets the  
+    		<command>&dhpackage;</command> bootloader first level
+		boot block info.
+		Display current values if no flags provided.
+	</para>
+
+  </refsect1>
+  <refsect1>
+    <title>OPTIONS</title>
+
+    <variablelist>
+      <varlistentry>
+        <term><option>-h</option>
+          <option>--help</option></term>
+        <listitem>
+          <para>Show summary of options.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-d</option>
+          <option>--drive DRIVE</option></term>
+        <listitem>
+          <para>Set the drive number (default 1).</para>
+        </listitem>
+      </varlistentry>
+      
+      <varlistentry>
+        <term><option>-o</option>
+          <option>--offset SIZE</option></term>
+        <listitem>
+          <para>Set offset of second level in bytes.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-s</option>
+          <option>--size SIZE</option></term>
+        <listitem>
+          <para>Set size of second level in bytes.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+  </refsect1>
+
+  <refsect1>
+    <title>WARNING</title>
+	<para>
+		!!! USE WITH CAUTION AND AT YOUR OWN RISK !!!
+	</para>
+  </refsect1>
+
+  <refsect1>
+    <title>SEE ALSO</title>
+
+    <para>emile(8), emile-install(8), emile-set-cmdline(8), 
+    	emile-map-set(8), emile-set-output(8).</para>
+
+  </refsect1>
+
+  <refsect1>
+    <title>AUTHOR</title>
+
+    <para>This manual page was written by &dhusername; <&dhemail;> for
+      the &debian; system (but may be used by others).  Permission is
+      granted to copy, distribute and/or modify this document under
+      the terms of the <acronym>GNU</acronym> GPL License, Version 2 
+      or any later version published by the Free Software Foundation.
+    </para>
+    <para>
+	On Debian systems, the complete text of the GNU General Public
+	License can be found in /usr/share/common-licenses/GPL.
+    </para>
+
+  </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->

Added: branches/vendor/emile/docs/emile-install.sgml
===================================================================
--- branches/vendor/emile/docs/emile-install.sgml	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/docs/emile-install.sgml	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,189 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+
+<!-- Process this file with docbook-to-man to generate an nroff manual
+     page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
+     the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+     less'.  A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+	docbook-to-man $< > $@
+  -->
+
+  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+  <!ENTITY dhfirstname "<firstname>Stephen</firstname>">
+  <!ENTITY dhsurname   "<surname>Marenka</surname>">
+  <!-- Please adjust the date whenever revising the manpage. -->
+  <!ENTITY dhdate      "<date>May 26, 2005</date>">
+  <!ENTITY dhsection   "<manvolnum>8</manvolnum>">
+  <!ENTITY dhemail     "<email>stephen at marenka.net</email>">
+  <!ENTITY dhusername  "Stephen R. Marenka">
+  <!ENTITY dhucpackage "<refentrytitle>emile-install</refentrytitle>">
+  <!ENTITY dhpackage   "emile">
+  <!ENTITY dhprogram   "emile-install">
+
+  <!ENTITY debian      "<productname>Debian GNU/Linux</productname>">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+]>
+
+<refentry>
+  <refentryinfo>
+    <address>
+      &dhemail;
+    </address>
+    <author>
+      &dhfirstname;
+      &dhsurname;
+    </author>
+    <copyright>
+      <year>2005</year>
+      <holder>&dhusername;</holder>
+    </copyright>
+    &dhdate;
+  </refentryinfo>
+  <refmeta>
+    &dhucpackage;
+
+    &dhsection;
+  </refmeta>
+  <refnamediv>
+    <refname>&dhprogram;</refname>
+
+    <refpurpose>install the <command>&dhpackage;</command> 
+		bootloader on a floppy disk
+	</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>&dhprogram;</command>
+	<arg><replaceable>options</replaceable></arg>
+	<arg>image</arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>DESCRIPTION</title>
+
+    <para><command>&dhprogram;</command> creates an 
+    		<command>&dhpackage;</command> bootable floppy disk or
+		disk image.
+	</para>
+
+  </refsect1>
+  <refsect1>
+    <title>OPTIONS</title>
+
+    <variablelist>
+      <varlistentry>
+        <term><option>-h</option>
+          <option>--help</option></term>
+        <listitem>
+          <para>Show summary of options.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-v</option>
+          <option>--verbose</option></term>
+        <listitem>
+          <para>Activate verbose mode.</para>
+        </listitem>
+      </varlistentry>
+      
+      <varlistentry>
+        <term><option>-f</option>
+          <option>--first PATH</option></term>
+        <listitem>
+          <para>Set path of EMILE first level.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-s</option>
+          <option>--second PATH</option></term>
+        <listitem>
+          <para>Set path of EMILE second level.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-k</option>
+          <option>--kernel PATH</option></term>
+        <listitem>
+          <para>Set path of kernel.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-r</option>
+          <option>--ramdisk PATH</option></term>
+        <listitem>
+          <para>Set path to ramdisk.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-b</option>
+          <option>--buffer SIZE</option></term>
+        <listitem>
+          <para>Uncompressed size of kernel.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-g</option>
+          <option>--get-info</option></term>
+        <listitem>
+          <para>Get information from image.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+  </refsect1>
+
+  <refsect1>
+    <title>WARNING</title>
+	<para>
+		!!! USE WITH CAUTION AND AT YOUR OWN RISK !!!
+	</para>
+  </refsect1>
+
+  <refsect1>
+    <title>SEE ALSO</title>
+
+    <para>emile(8), emile-first-tune(8), emile-map-set(8), 
+    emile-set-cmdline(8), emile-set-output(8).</para>
+
+  </refsect1>
+
+  <refsect1>
+    <title>AUTHOR</title>
+
+    <para>This manual page was written by &dhusername; <&dhemail;> for
+      the &debian; system (but may be used by others).  Permission is
+      granted to copy, distribute and/or modify this document under
+      the terms of the <acronym>GNU</acronym> GPL License, Version 2 
+      or any later version published by the Free Software Foundation.
+    </para>
+    <para>
+	On Debian systems, the complete text of the GNU General Public
+	License can be found in /usr/share/common-licenses/GPL.
+    </para>
+
+  </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->

Added: branches/vendor/emile/docs/emile-map-set.sgml
===================================================================
--- branches/vendor/emile/docs/emile-map-set.sgml	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/docs/emile-map-set.sgml	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,159 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+
+<!-- Process this file with docbook-to-man to generate an nroff manual
+     page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
+     the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+     less'.  A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+	docbook-to-man $< > $@
+  -->
+
+  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+  <!ENTITY dhfirstname "<firstname>Stephen</firstname>">
+  <!ENTITY dhsurname   "<surname>Marenka</surname>">
+  <!-- Please adjust the date whenever revising the manpage. -->
+  <!ENTITY dhdate      "<date>May 26, 2005</date>">
+  <!ENTITY dhsection   "<manvolnum>8</manvolnum>">
+  <!ENTITY dhemail     "<email>stephen at marenka.net</email>">
+  <!ENTITY dhusername  "Stephen R. Marenka">
+  <!ENTITY dhucpackage "<refentrytitle>emile-map-set</refentrytitle>">
+  <!ENTITY dhpackage   "emile">
+  <!ENTITY dhprogram   "emile-map-set">
+
+  <!ENTITY debian      "<productname>Debian GNU/Linux</productname>">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+]>
+
+<refentry>
+  <refentryinfo>
+    <address>
+      &dhemail;
+    </address>
+    <author>
+      &dhfirstname;
+      &dhsurname;
+    </author>
+    <copyright>
+      <year>2005</year>
+      <holder>&dhusername;</holder>
+    </copyright>
+    &dhdate;
+  </refentryinfo>
+  <refmeta>
+    &dhucpackage;
+
+    &dhsection;
+  </refmeta>
+  <refnamediv>
+    <refname>&dhprogram;</refname>
+
+    <refpurpose>Set the <command>&dhpackage;</command> 
+		bootloader partition map information.
+	</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>&dhprogram;</command>
+	<arg><replaceable>options</replaceable></arg>
+	<arg>partition</arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>DESCRIPTION</title>
+
+    <para><command>&dhprogram;</command> sets the  
+    		<command>&dhpackage;</command> bootloader partition
+		map information.
+		Do not use <option>--startup</option> with any other
+		options.
+	</para>
+
+  </refsect1>
+  <refsect1>
+    <title>OPTIONS</title>
+
+    <variablelist>
+      <varlistentry>
+        <term><option>-h</option>
+          <option>--help</option></term>
+        <listitem>
+          <para>Show summary of options.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-f</option>
+          <option>--flags FLAGS</option></term>
+        <listitem>
+          <para>Set the flags for the partition.</para>
+        </listitem>
+      </varlistentry>
+      
+      <varlistentry>
+        <term><option>-t</option>
+          <option>--type TYPE</option></term>
+        <listitem>
+          <para>Set the type of the partition.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-s</option>
+          <option>--startup</option></term>
+        <listitem>
+          <para>Set the startup partition.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+  </refsect1>
+
+  <refsect1>
+    <title>WARNING</title>
+	<para>
+		!!! USE WITH CAUTION AND AT YOUR OWN RISK !!!
+	</para>
+  </refsect1>
+
+  <refsect1>
+    <title>SEE ALSO</title>
+
+    <para>emile(8), emile-install(8), emile-first-tune(8), 
+    emile-set-cmdline(8), emile-set-output(8).</para>
+
+  </refsect1>
+
+  <refsect1>
+    <title>AUTHOR</title>
+
+    <para>This manual page was written by &dhusername; <&dhemail;> for
+      the &debian; system (but may be used by others).  Permission is
+      granted to copy, distribute and/or modify this document under
+      the terms of the <acronym>GNU</acronym> GPL License, Version 2 
+      or any later version published by the Free Software Foundation.
+    </para>
+    <para>
+	On Debian systems, the complete text of the GNU General Public
+	License can be found in /usr/share/common-licenses/GPL.
+    </para>
+
+  </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->

Added: branches/vendor/emile/docs/emile-set-cmdline.sgml
===================================================================
--- branches/vendor/emile/docs/emile-set-cmdline.sgml	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/docs/emile-set-cmdline.sgml	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,169 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+
+<!-- Process this file with docbook-to-man to generate an nroff manual
+     page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
+     the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+     less'.  A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+	docbook-to-man $< > $@
+  -->
+
+  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+  <!ENTITY dhfirstname "<firstname>Stephen</firstname>">
+  <!ENTITY dhsurname   "<surname>Marenka</surname>">
+  <!-- Please adjust the date whenever revising the manpage. -->
+  <!ENTITY dhdate      "<date>May 26, 2005</date>">
+  <!ENTITY dhsection   "<manvolnum>8</manvolnum>">
+  <!ENTITY dhemail     "<email>stephen at marenka.net</email>">
+  <!ENTITY dhusername  "Stephen R. Marenka">
+  <!ENTITY dhucpackage "<refentrytitle>emile-set-cmdline</refentrytitle>">
+  <!ENTITY dhpackage   "emile">
+  <!ENTITY dhprogram   "emile-set-cmdline">
+
+  <!ENTITY debian      "<productname>Debian GNU/Linux</productname>">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+]>
+
+<refentry>
+  <refentryinfo>
+    <address>
+      &dhemail;
+    </address>
+    <author>
+      &dhfirstname;
+      &dhsurname;
+    </author>
+    <copyright>
+      <year>2005</year>
+      <holder>&dhusername;</holder>
+    </copyright>
+    &dhdate;
+  </refentryinfo>
+  <refmeta>
+    &dhucpackage;
+
+    &dhsection;
+  </refmeta>
+  <refnamediv>
+    <refname>&dhprogram;</refname>
+
+    <refpurpose>sets the kernel command line for the 
+    		<command>&dhpackage;</command> bootloader 
+	</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>&dhprogram;</command>
+	<arg>image</arg>
+	<arg>cmdline</arg>
+    </cmdsynopsis>
+    <cmdsynopsis>
+      <command>&dhprogram;</command>
+	<arg>-r</arg>
+	<arg>image</arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>DESCRIPTION</title>
+
+    <para><command>&dhprogram;</command> sets the kernel command line 
+    		to cmdline for a <command>&dhpackage;</command> 
+		bootloader disk image, floppy disk device (/dev/fd0), 
+		or the second level file.  Executing with "-r" flag, 
+		displays the current command line.
+	</para>
+
+  </refsect1>
+  <refsect1>
+    <title>OPTIONS</title>
+
+    <variablelist>
+      <varlistentry>
+        <term><option>-h</option>
+          <option>--help</option></term>
+        <listitem>
+          <para>Show summary of options.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-r</option></term>
+        <listitem>
+          <para>Display current kernel command line.</para>
+        </listitem>
+      </varlistentry>
+      
+    </variablelist>
+  </refsect1>
+
+  <refsect1>
+    <title>EXAMPLES</title>
+	<para>
+		To set root filesystem on disk 1 partition 4:
+	</para>
+	<para>
+      		<command>&dhprogram;</command> floppy.img "root=/dev/sda4"
+	</para>
+	<para>
+		To set root filesystem on ramdisk:
+	</para>
+	<para>
+      		<command>&dhprogram;</command> floppy.img "root=/dev/ramdisk ramdisk_size=2048"
+	</para>
+	<para>
+		To set root filesystem on NFS:
+	</para>
+	<para>
+      		<command>&dhprogram;</command> floppy.img "root=/dev/nfs ip=dhcp nfsroot=192.168.100.1:/tftboot/192.168.100.51"
+	</para>
+  </refsect1>
+
+  <refsect1>
+    <title>WARNING</title>
+	<para>
+		!!! USE WITH CAUTION AND AT YOUR OWN RISK !!!
+	</para>
+  </refsect1>
+
+  <refsect1>
+    <title>SEE ALSO</title>
+
+    <para>emile(8), emile-install(8), emile-first-tune(8), 
+    	emile-map-set(8), emile-set-output(8).</para>
+
+  </refsect1>
+
+  <refsect1>
+    <title>AUTHOR</title>
+
+    <para>This manual page was written by &dhusername; <&dhemail;> for
+      the &debian; system (but may be used by others).  Permission is
+      granted to copy, distribute and/or modify this document under
+      the terms of the <acronym>GNU</acronym> GPL License, Version 2 
+      or any later version published by the Free Software Foundation.
+    </para>
+    <para>
+	On Debian systems, the complete text of the GNU General Public
+	License can be found in /usr/share/common-licenses/GPL.
+    </para>
+
+  </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->

Added: branches/vendor/emile/docs/emile-set-output.sgml
===================================================================
--- branches/vendor/emile/docs/emile-set-output.sgml	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/docs/emile-set-output.sgml	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,206 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+
+<!-- Process this file with docbook-to-man to generate an nroff manual
+     page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
+     the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+     less'.  A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+	docbook-to-man $< > $@
+  -->
+
+  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+  <!ENTITY dhfirstname "<firstname>Stephen</firstname>">
+  <!ENTITY dhsurname   "<surname>Marenka</surname>">
+  <!-- Please adjust the date whenever revising the manpage. -->
+  <!ENTITY dhdate      "<date>May 26, 2005</date>">
+  <!ENTITY dhsection   "<manvolnum>8</manvolnum>">
+  <!ENTITY dhemail     "<email>stephen at marenka.net</email>">
+  <!ENTITY dhusername  "Stephen R. Marenka">
+  <!ENTITY dhucpackage "<refentrytitle>emile-set-output</refentrytitle>">
+  <!ENTITY dhpackage   "emile">
+  <!ENTITY dhprogram   "emile-set-output">
+
+  <!ENTITY debian      "<productname>Debian GNU/Linux</productname>">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+]>
+
+<refentry>
+  <refentryinfo>
+    <address>
+      &dhemail;
+    </address>
+    <author>
+      &dhfirstname;
+      &dhsurname;
+    </author>
+    <copyright>
+      <year>2005</year>
+      <holder>&dhusername;</holder>
+    </copyright>
+    &dhdate;
+  </refentryinfo>
+  <refmeta>
+    &dhucpackage;
+
+    &dhsection;
+  </refmeta>
+  <refnamediv>
+    <refname>&dhprogram;</refname>
+
+    <refpurpose>Set the <command>&dhpackage;</command> 
+		bootloader display output.
+	</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>&dhprogram;</command>
+	<arg>image</arg>
+	<arg>--display</arg>
+	<arg><replaceable>--width WIDTH</replaceable></arg>
+	<arg><replaceable>--height HEIGHT</replaceable></arg>
+	<arg><replaceable>--depth DEPTH</replaceable></arg>
+    </cmdsynopsis>
+    <cmdsynopsis>
+      <command>&dhprogram;</command>
+	<arg>image</arg>
+	<arg>--modem</arg>
+	<arg><replaceable>--bitrate BITRATE</replaceable></arg>
+	<arg><replaceable>--datasize DATASIZE</replaceable></arg>
+	<arg><replaceable>--parity PARITY</replaceable></arg>
+	<arg><replaceable>--stopbits STOPBITS</replaceable></arg>
+    </cmdsynopsis>
+    <cmdsynopsis>
+      <command>&dhprogram;</command>
+	<arg>image</arg>
+	<arg>--printer</arg>
+	<arg><replaceable>--bitrate BITRATE</replaceable></arg>
+	<arg><replaceable>--datasize DATASIZE</replaceable></arg>
+	<arg><replaceable>--parity PARITY</replaceable></arg>
+	<arg><replaceable>--stopbits STOPBITS</replaceable></arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>DESCRIPTION</title>
+
+    <para><command>&dhprogram;</command> sets the  
+    		<command>&dhpackage;</command> output options.
+		No options displays the current configuration.
+		PARITY is 0 for none, 1 for odd, 2 for even.
+	</para>
+
+  </refsect1>
+  <refsect1>
+    <title>OPTIONS</title>
+
+    <variablelist>
+      <varlistentry>
+        <term><option>-h</option>
+          <option>--help</option></term>
+        <listitem>
+          <para>Show summary of options.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>--display</option></term>
+        <listitem>
+          <para>Enable output to display and set configuration.</para>
+        </listitem>
+      </varlistentry>
+      
+      <varlistentry>
+        <term><option>--nodisplay</option></term>
+        <listitem>
+          <para>Disable output to display.</para>
+        </listitem>
+      </varlistentry>
+      
+      <varlistentry>
+        <term><option>--modem</option></term>
+        <listitem>
+          <para>Enable output to serial port 0 (modem) and set configuration.
+	  </para>
+        </listitem>
+      </varlistentry>
+      
+      <varlistentry>
+        <term><option>--nomodem</option></term>
+        <listitem>
+          <para>Disable output to modem port.</para>
+        </listitem>
+      </varlistentry>
+      
+      <varlistentry>
+        <term><option>--printer</option></term>
+        <listitem>
+          <para>Enable output to serial port 1 (printer) and set configuration.
+	  </para>
+        </listitem>
+      </varlistentry>
+      
+      <varlistentry>
+        <term><option>--noprinter</option></term>
+        <listitem>
+          <para>Disable output to printer port.</para>
+        </listitem>
+      </varlistentry>
+      
+      <varlistentry>
+        <term><option>--gestaltid ID</option></term>
+        <listitem>
+          <para>Force the gestaltid to ID. Set to 0 to unset.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+  </refsect1>
+
+  <refsect1>
+    <title>WARNING</title>
+	<para>
+		!!! USE WITH CAUTION AND AT YOUR OWN RISK !!!
+	</para>
+  </refsect1>
+
+  <refsect1>
+    <title>SEE ALSO</title>
+
+    <para>emile(8), emile-install(8), emile-first-tune(8), 
+    emile-map-set(8), emile-set-cmdline(8).</para>
+
+  </refsect1>
+
+  <refsect1>
+    <title>AUTHOR</title>
+
+    <para>This manual page was written by &dhusername; <&dhemail;> for
+      the &debian; system (but may be used by others).  Permission is
+      granted to copy, distribute and/or modify this document under
+      the terms of the <acronym>GNU</acronym> GPL License, Version 2 
+      or any later version published by the Free Software Foundation.
+    </para>
+    <para>
+	On Debian systems, the complete text of the GNU General Public
+	License can be found in /usr/share/common-licenses/GPL.
+    </para>
+
+  </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->

Added: branches/vendor/emile/docs/emile.sgml
===================================================================
--- branches/vendor/emile/docs/emile.sgml	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/docs/emile.sgml	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,217 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+
+<!-- Process this file with docbook-to-man to generate an nroff manual
+     page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
+     the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+     less'.  A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+	docbook-to-man $< > $@
+  -->
+
+  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+  <!ENTITY dhfirstname "<firstname>Stephen</firstname>">
+  <!ENTITY dhsurname   "<surname>Marenka</surname>">
+  <!-- Please adjust the date whenever revising the manpage. -->
+  <!ENTITY dhdate      "<date>May 26, 2005</date>">
+  <!ENTITY dhsection   "<manvolnum>8</manvolnum>">
+  <!ENTITY dhemail     "<email>stephen at marenka.net</email>">
+  <!ENTITY dhusername  "Stephen R. Marenka">
+  <!ENTITY dhucpackage "<refentrytitle>emile</refentrytitle>">
+  <!ENTITY dhpackage   "emile">
+  <!ENTITY dhprogram   "emile">
+
+  <!ENTITY debian      "<productname>Debian GNU/Linux</productname>">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+]>
+
+<refentry>
+  <refentryinfo>
+    <address>
+      &dhemail;
+    </address>
+    <author>
+      &dhfirstname;
+      &dhsurname;
+    </author>
+    <copyright>
+      <year>2005</year>
+      <holder>&dhusername;</holder>
+    </copyright>
+    &dhdate;
+  </refentryinfo>
+  <refmeta>
+    &dhucpackage;
+
+    &dhsection;
+  </refmeta>
+  <refnamediv>
+    <refname>&dhprogram;</refname>
+
+    <refpurpose>install the <command>&dhpackage;</command> 
+		bootloader
+	</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>&dhprogram;</command>
+	<arg><replaceable>options</replaceable></arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>DESCRIPTION</title>
+
+    <para><command>&dhprogram;</command> installs the 
+    		<command>&dhpackage;</command> bootloader. Run it with 
+		<option>--test</option> to see the default values.
+	</para>
+
+  </refsect1>
+  <refsect1>
+    <title>OPTIONS</title>
+
+    <variablelist>
+      <varlistentry>
+        <term><option>-h</option>
+          <option>--help</option></term>
+        <listitem>
+          <para>Show summary of options.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-v</option>
+          <option>--verbose</option></term>
+        <listitem>
+          <para>Activate verbose mode.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-t</option>
+          <option>--test</option></term>
+        <listitem>
+          <para>Activate test mode (don't write to disk).</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>--scanbus</option></term>
+        <listitem>
+          <para>Display information about all disks and partitions.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-f</option>
+          <option>--first PATH</option></term>
+        <listitem>
+          <para>Set path of EMILE first level.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-s</option>
+          <option>--second PATH</option></term>
+        <listitem>
+          <para>Set path of EMILE second level.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-k</option>
+          <option>--kernel PATH</option></term>
+        <listitem>
+          <para>Set path of kernel.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-a</option>
+          <option>--append ARG</option></term>
+        <listitem>
+          <para>Set kernel command line.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-p</option>
+          <option>--partition DEV</option></term>
+        <listitem>
+          <para>Define device where to install boot block.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>--restore[=FILE]</option></term>
+        <listitem>
+          <para>Restore current boot block from FILE.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>--backup[=FILE]</option></term>
+        <listitem>
+          <para>Backup current boot block to FILE.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>--set-hfs</option></term>
+        <listitem>
+          <para>Set type of partition DEV to Apple_HFS 
+	  (needed to be bootable with a MacOS partition).</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+  </refsect1>
+
+  <refsect1>
+    <title>WARNING</title>
+	<para>
+		!!! USE WITH CAUTION AND AT YOUR OWN RISK !!!
+	</para>
+  </refsect1>
+
+  <refsect1>
+    <title>SEE ALSO</title>
+
+    <para>emile-install(8), emile-set-cmdline(8), emile-first-tune(8), 
+    	emile-map-set(8), emile-set-output(8).</para>
+
+  </refsect1>
+
+  <refsect1>
+    <title>AUTHOR</title>
+
+    <para>This manual page was written by &dhusername; <&dhemail;> for
+      the &debian; system (but may be used by others).  Permission is
+      granted to copy, distribute and/or modify this document under
+      the terms of the <acronym>GNU</acronym> GPL License, Version 2 
+      or any later version published by the Free Software Foundation.
+    </para>
+    <para>
+	On Debian systems, the complete text of the GNU General Public
+	License can be found in /usr/share/common-licenses/GPL.
+    </para>
+
+  </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->

Added: branches/vendor/emile/first/32bitmode.i
===================================================================
--- branches/vendor/emile/first/32bitmode.i	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/first/32bitmode.i	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,45 @@
+.macro	switch32bitmode
+
+	/* is a 32bit aware ROM ? */
+
+	movea.l	ROMBase,%a0
+	move.w	8(%a0), %d1		/* read ROM id */
+
+	cmp.w	#0x0178, %d1		/* only 24bit ROM */
+	bls.S	bit32_ok
+
+	/* is a 32bit aware processor ? */
+
+	cmp.w	#1, CPUFlags	/* Is 68000 or 68010 */
+	bls.S	bit32_ok
+
+	/* test if we are in 32bit mode */
+
+	move.l	#-1, %d0
+	StripAddress
+	cmp.l	#-1, %d0
+	beq.S	bit32_ok
+
+	/* Switch to 32bit mode */
+
+	lea	PRAM_buffer(%pc), %a0	/* where to store data */
+	move.w	#1, %d0			/* size of data */
+	swap	%d0
+	move.w	#0x08A, %d0		/* offset in PRAM */
+	ReadXPRam
+
+	lea	PRAM_buffer(%pc), %a0
+	or.b	#0x05, (%a0)
+
+	move.w	#1, %d0			/* size of data */
+	swap	%d0
+	move.w	#0x08A, %d0		/* offset in PRAM */
+	WriteXPRam
+	
+	/* jump to reset function in ROM */
+
+	movea.l	ROMBase,%a0
+	jmp	0x90(%a0)
+
+bit32_ok:
+.endm

Added: branches/vendor/emile/first/Makefile
===================================================================
--- branches/vendor/emile/first/Makefile	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/first/Makefile	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,42 @@
+#
+#
+# (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+#
+#
+
+first_scsi:	ASFLAGS += --defsym SCSI_SUPPORT=1
+first_floppy:	ASFLAGS += --defsym FLOPPY_SUPPORT=1
+
+TOP	= $(shell pwd)
+VPATH	= $(TOP)
+
+ASFLAGS = -I$(TOP)
+
+SOURCES = first.S
+CLEAN	= first_floppy.o first_scsi.o
+
+HEADERS = floppy.i macos.i scsi.i 32bitmode.i
+
+PROGRAMS = first_scsi first_floppy
+
+.PHONY: all
+
+all: $(PROGRAMS)
+
+%: %.o
+	$(OBJCOPY) -O binary $^ $@
+
+first_scsi.o first_floppy.o first_ata.o: first.S
+	$(AS) $(ASFLAGS) -o $@ $^
+
+install::
+	install -d $(DESTDIR)/$(PREFIX)/boot/emile/
+	install first_scsi $(DESTDIR)/$(PREFIX)/boot/emile/first_scsi
+	install -d $(DESTDIR)/$(PREFIX)/lib/emile/
+	install first_floppy $(DESTDIR)/$(PREFIX)/lib/emile/first_floppy
+
+uninstall::
+	rm -f $(DESTDIR)/$(PREFIX)/boot/emile/first_scsi
+	rm -f $(DESTDIR)/$(PREFIX)/lib/emile/first_floppy
+
+include $(TOP)/../Rules.mk

Added: branches/vendor/emile/first/first.S
===================================================================
--- branches/vendor/emile/first/first.S	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/first/first.S	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,115 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+	.chip 68000
+
+.equ	sector_size, 512
+.equ	first_level_size, 2 * sector_size
+
+.include "macos.i"
+.include "32bitmode.i"
+
+/******************************************************************************
+ *
+ * Structure: "Inside Macintosh: Files", p. 2-57
+ *
+ *****************************************************************************/
+
+begin:
+ID:		.short	0x4C4B			/* boot blocks signature */
+Entry:		bra	start			/* entry point to bootcode */
+Version:	.short	0x4418			/* boot blocks version number */
+PageFlags:	.short	0x00			/* used internally */
+SysName:	pString "Mac Bootloader"	/* System filename */
+ShellName:	pstring "Copyright 2004"	/* Finder filename */
+Dbg1Name:	pString "Laurent Vivier"	/* debugger filename */
+Dbg2Name:	pString "Distributed   "	/* debugger filename */
+ScreenName:	pString "under GNU GPL "	/* name of startup screen */
+HelloName:	pString "first level   "	/* name of startup program */
+ScrapName:	pString "version 1.2   "	/* name of system scrap file */
+CntFCBs:	.short	10			/* number of FCBs to allocate */
+CntEvts:	.short	20		    /* number of event queue elements */
+Heap128K:	.long	0x00004300	      /* system heap size on 128K Mac */
+Heap256K:	.long	0x00008000		/* used internally */
+SysHeapSize:	.long	0x00020000	  /* system heap size on all machines */
+
+.ifdef SCSI_SUPPORT
+
+.include "scsi.i"
+
+.else
+
+.include "floppy.i"
+
+.endif
+
+/******************************************************************************
+ *
+ * start : load the second stage
+ *
+ * 	start is called from the boot block header
+ *
+ *	call PBReadSync() to read blocks from floppy 
+ *	as described in param_block
+ *
+ *****************************************************************************/
+
+	.align	4
+start:
+	moveal SysZone,%a0
+	addal %pc@(SysHeapSize),%a0
+	SetApplBase
+	movel SysZone,TheZone
+
+	/* test if we are in 32bit mode, otherwise reboot in 32bit mode */
+
+	switch32bitmode
+
+	/* buffer size to store second stage booter */
+
+	get_second_size %d0
+
+	/* Allocate Memory for second stage loader */
+
+	add.l	#4, %d0
+	NewPtr
+	move.l	%a0, %d0
+	bne	malloc_ok
+	move.l	#1, %d0
+	SysError
+malloc_ok:
+	add.l	#3, %d0
+	and.l	#0xFFFFFFFC.l, %d0
+
+	/* load second stage */
+
+	load_second
+
+	/* call second stage bootloader */
+
+	jmp	(%a0)
+
+PRAM_buffer:
+	.long	0
+end:
+
+/******************************************************************************
+ *
+ * Filler: the boot block is 2 floppy blocks
+ *	  as seen on the disk of utilities of MacOS 7.6, we fill with 0xda
+ *
+ *****************************************************************************/
+
+.ifdef SCSI_SUPPORT
+	.fill first_level_size - (end - begin) - 10, 1, 0xda
+container_end:
+block_size:	.short	0
+unit_id:	.short	0
+second_size:	.long	0
+max_blocks:	.short	container_end - end
+.else
+	.fill first_level_size - (end - begin), 1, 0xda
+.endif

Added: branches/vendor/emile/first/floppy.i
===================================================================
--- branches/vendor/emile/first/floppy.i	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/first/floppy.i	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,75 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+/* floppy constants */
+
+.equ	drive_num, 1
+.equ	fsFromStart, 1
+.equ	sectors_per_track, 18 
+.equ	sides, 2
+.equ	track_size, sector_size * sectors_per_track
+.equ	track_number, 80
+
+.equ	floppy_size, sides * track_size * track_number
+.equ	second_level_size, floppy_size - first_level_size
+
+/* floppy macros */
+
+.macro PBReadSync
+	.short 0xA002
+.endm
+
+/******************************************************************************
+ *
+ * param block used to load second stage from floppy
+ *
+ *****************************************************************************/
+
+param_block:
+	.long	0	/* qLink : next queue entry */
+	.short	0	/* qType : queue type */
+	.short  0	/* ioTrap : routine trap */
+	.long	0	/* ioCmdAddr: routine address */
+	.long	0	/* ioCompletion : pointer to completion routine */
+	.short	0	/* ioResult : result code */
+	.long	0	/* ioNamePtr : pointer to pathname */
+	.short	drive_num	/* ioVRefNum : volume specification */
+	.short	-5	/* ioRefNum: file reference number */
+	.byte	0	/* ioVersNum : version number */
+	.byte	0	/* ioPermssn : read/write permission */
+	.long	0	/* ioMisc : miscellaneaous */
+ioBuffer: 		/* ioBuffer : data buffer */
+	.long	0
+ioReqCount: 		/* ioReqCount : requested number of bytes */
+	.long	second_level_size
+	.long	0	/* ioActCount : actual number of bytes */
+	.short	fsFromStart	/* ioPosMode : positioning mode and newline char */
+ioPosOffset: /* ioPosOffset : positionning offset */
+	.long	first_level_size
+
+.macro get_second_size register
+	lea	ioReqCount(%pc),%a0
+	move.l	(%a0), \register
+.endm
+
+.macro load_second
+	/* save result in the ParamBlockRec.ioBuffer */
+
+	lea	ioBuffer(%pc),%a0
+	move.l	%d0,(%a0)
+
+	/* Now, we load the second stage loader */
+
+	lea	param_block(%pc),%a0
+	PBReadSync
+	tst.l	%d0
+	beq	read_ok
+	move.l	#2, %d0
+	SysError
+read_ok:
+
+	move.l	ioBuffer(%pc),%a0
+.endm

Added: branches/vendor/emile/first/macos.i
===================================================================
--- branches/vendor/emile/first/macos.i	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/first/macos.i	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,46 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+.equ	ROMBase, 0x2ae
+.equ	SysZone, 0x2a6
+.equ	TheZone, 0x2a6
+
+.macro	SetApplBase
+	.short 0xa057
+.endm
+
+.equ	CPUFlag,	0x012F
+
+.macro StripAddress
+	.short 0xA055
+.endm
+
+.macro ReadXPRam
+	.short 0xA051
+.endm
+
+.macro WriteXPRam
+	.short 0xA052
+.endm
+
+.macro NewPtr
+	.short 0xA11E
+.endm
+
+.macro SysError
+	.short 0xA9C9
+.endm
+
+/* Pascal string : length, string */
+
+.macro pString string
+pstring_begin_\@:
+	.byte	pstring_end_\@ - pstring_string_\@ - 1
+pstring_string_\@:
+	.string "\string"
+pstring_end_\@:
+	.fill 16 - (pstring_end_\@ - pstring_begin_\@) , 1, 0
+.endm

Added: branches/vendor/emile/first/scsi.i
===================================================================
--- branches/vendor/emile/first/scsi.i	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/first/scsi.i	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,129 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+/* SCSI constants */
+
+.equ	_SCSIGet,	0x0001
+.equ	_SCSISelect,	0x0002
+.equ	_SCSICmd,	0x0003
+.equ	_SCSIComplete,	0x0004
+.equ	_SCSIRead,	0x0005
+
+.equ	COMPLETION_TIMEOUT, 300
+
+/* SCSI macros */
+
+.macro	SCSIDispatch selector
+	move.w	#\selector, -(%sp)
+	dc.w	0xA815			/* _SCSIDispatch */
+	move.w	(%sp)+, %d0
+.endm
+
+.macro	get_second_size register
+	/* buffer size to store second level booter */
+
+	move.l	second_size(%pc), \register
+.endm
+
+.macro	load_second
+	lea	container_end(%pc), %a6
+
+	lea	TIB(%pc), %a0			/* TIB */
+	move.l	%d0, TIB_buffer(%a0)
+	lea	PRAM_buffer(%pc), %a0
+	move.l	%d0, (%a0)
+	
+scsi_loop:
+	/* prepare CDB */
+
+	lea	CDB(%pc), %a0
+	move.w	-(%a6), %d2
+	beq	exit_scsi
+	move.w	%d2, CDB_nb_blocks(%a0)
+	move.l	-(%a6), CDB_offset(%a0)
+
+	/* compute # of bytes to transfer = block size * # of blocks */
+
+	move.w	block_size(%pc), %d1
+	mulu	%d2, %d1
+
+	/* prepare TIB */
+
+	lea	TIB(%pc), %a0			/* TIB */
+	move.l	%d1, TIB_size(%a0)
+
+	/* SCSI sequence */
+
+	/* SCSIGet */
+
+	clr.w	-(%sp)
+	SCSIDispatch(_SCSIGet)
+
+	/* SCSISelect */
+
+	clr.w	-(%sp)
+	move.w	unit_id(%pc), -(%sp)
+	SCSIDispatch(_SCSISelect)
+
+	/* SCSICmd */
+
+	clr.w	-(%sp)
+	pea	CDB(%pc)
+	move.w	#10, -(%sp)
+	SCSIDispatch(_SCSICmd)
+
+	/* SCSIRead */
+
+	clr.w	-(%sp)
+	pea	TIB(%pc)
+	SCSIDispatch(_SCSIRead)
+
+	/* SCSIComplete	*/
+
+	clr.w	-(%sp)
+	pea	stat(%pc)
+	pea	message(%pc)
+	move.l	#COMPLETION_TIMEOUT, -(%sp)
+	SCSIDispatch(_SCSIComplete)
+	bra	scsi_loop
+exit_scsi:
+	
+	lea	PRAM_buffer(%pc), %a0
+	move.l	(%a0), %a0
+.endm
+
+.equ	READ_10, 0x28
+.equ	CDB_offset, 2
+.equ	CDB_nb_blocks, 7
+
+	.align	4
+CDB:
+	.byte	READ_10
+	.byte	0
+	.long	0		/* offset to read, big-endian, like m68k */
+	.byte	0
+	.short	0	/* number of blocks to read, big-endian */
+	.byte	0
+
+.equ	op_inc, 1
+.equ	op_no_inc, 2
+.equ	op_stop, 7
+
+.equ	TIB_buffer, 2
+.equ	TIB_size, 6
+	.align	4
+TIB:
+	.short	op_inc
+	.long	0
+	.long	0
+	.short	op_stop
+	.long	0
+	.long	0
+
+/* SCSI complete result */
+
+stat:	.short 0
+message:	.short 0

Added: branches/vendor/emile/libblock/Makefile
===================================================================
--- branches/vendor/emile/libblock/Makefile	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libblock/Makefile	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,18 @@
+#
+#  (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+#
+
+TOP=$(shell pwd)
+
+CFLAGS	= -nostdlib -nodefaultlibs -Wall -Werror -Wno-multichar -fpic -O2 -m68000 -Wa,-m68000 -Os
+CPPFLAGS = -I$(TOP)/../libmacos -DARCH_M68K -I$(TOP)/../libstream
+
+LIBRARY = libblock.a
+
+SOURCES = block_close.c block_fstat.c block_lseek.c block_open.c block_read.c
+
+HEADERS = libblock.h
+
+all: $(LIBRARY)
+
+include $(TOP)/../Rules.mk

Added: branches/vendor/emile/libblock/block_close.c
===================================================================
--- branches/vendor/emile/libblock/block_close.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libblock/block_close.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,19 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+
+#include "libblock.h"
+
+int block_close(block_FILE *file)
+{
+	if (file == NULL)
+		return -1;
+
+	free(file);
+
+	return 0;
+}

Added: branches/vendor/emile/libblock/block_fstat.c
===================================================================
--- branches/vendor/emile/libblock/block_fstat.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libblock/block_fstat.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,19 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "libblock.h"
+
+int block_fstat(block_FILE *file, struct stream_stat *buf)
+{
+	if (buf == NULL)
+		return -1;
+	if (file->size == -1)
+		return -1;
+
+	buf->st_size = file->size;
+
+	return 0;
+}

Added: branches/vendor/emile/libblock/block_lseek.c
===================================================================
--- branches/vendor/emile/libblock/block_lseek.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libblock/block_lseek.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,31 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "libblock.h"
+
+int block_lseek(block_FILE *file, off_t offset, int whence)
+{
+	long new_offset;
+
+	switch(whence)
+	{
+	case SEEK_SET:
+		new_offset = offset;
+		break;
+	case SEEK_CUR:
+		new_offset = file->offset + offset;
+		break;
+	default:
+		return -1;
+	}
+
+	if (new_offset < 0)
+		return -1;
+
+	file->offset = new_offset;
+
+	return new_offset;
+}

Added: branches/vendor/emile/libblock/block_open.c
===================================================================
--- branches/vendor/emile/libblock/block_open.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libblock/block_open.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,52 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+
+#include "libblock.h"
+
+#define NB_SECTORS	(18*2)
+
+/*
+ * path is "<first>,<size>"
+ * where <first> is the offset of the first byte to read on the device
+ * and <size> is the number of bytes to read then.
+ */
+
+block_FILE *block_open(device_io_t *device, char *path)
+{
+	block_FILE *block;
+	int blocksize = device->get_blocksize(device);
+	int first, size;
+
+	first = strtol(path, &path, 0);
+	if ( (*path != ',') && (*path != 0) )
+		return NULL;
+
+	if (*path == ',')
+	{
+		path++;
+		size = strtol(path, &path, 0);
+		if (*path != 0)
+			return NULL;
+	}
+	else
+		size = -1;
+	
+	block = (block_FILE *)malloc(sizeof(block_FILE) + 
+				     NB_SECTORS * blocksize);
+	if (block == NULL)
+		return NULL;
+
+	block->base = first;
+	block->offset = 0;
+	block->size = size;
+	block->device = device;
+	block->current = -1;
+	block->buffer_size = NB_SECTORS * blocksize;
+
+	return block;
+}

Added: branches/vendor/emile/libblock/block_read.c
===================================================================
--- branches/vendor/emile/libblock/block_read.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libblock/block_read.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,47 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include "libblock.h"
+
+size_t block_read(block_FILE *file, void *ptr, size_t size)
+{
+	int read = 0;
+	int ret;
+	int blocksize = file->device->get_blocksize(&file->device);
+
+	while (size != 0)
+	{
+		int part;
+		int block_nb = (file->offset + file->base) / file->buffer_size;
+		int block_offset = (file->offset + file->base) % file->buffer_size;
+
+		if (block_nb != file->current)
+		{
+			ret = file->device->read_sector(file->device->data,
+					(block_nb * file->buffer_size) / blocksize,
+						 file->buffer, 
+						 file->buffer_size);
+			if (ret == -1)
+				return read;
+			file->current = block_nb;
+		}
+
+		part = file->buffer_size - block_offset;
+		if (part > size)
+			part = size;
+		memcpy(ptr, file->buffer + block_offset, part);
+
+		size -= part;
+		ptr = (char*)ptr + part;
+		file->offset += part;
+		read += part;
+	}
+
+	return read;
+}

Added: branches/vendor/emile/libblock/libblock.h
===================================================================
--- branches/vendor/emile/libblock/libblock.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libblock/libblock.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,26 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <libstream.h>
+
+typedef struct {
+	int base;
+	int offset;
+	int size;
+	device_io_t *device;
+	int current;
+	int buffer_size;
+	unsigned char buffer[0];
+} block_FILE;
+
+extern block_FILE *block_open(device_io_t *device, char *path);
+extern int block_close(block_FILE *file);
+extern size_t block_read(block_FILE *file, void *ptr, size_t size);
+extern int block_lseek(block_FILE *file, off_t offset, int whence);
+extern int block_fstat(block_FILE *file, struct stream_stat *buf);

Added: branches/vendor/emile/libcontainer/Makefile
===================================================================
--- branches/vendor/emile/libcontainer/Makefile	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libcontainer/Makefile	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,20 @@
+#
+#  (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+#
+
+TOP=$(shell pwd)
+VPATH=$(TOP)
+
+CFLAGS	= -nostdlib -nodefaultlibs -Wall -Werror -Wno-multichar -fpic -O2 -m68000 -Wa,-m68000 -Os
+CPPFLAGS = -I$(TOP)/../libstream
+
+LIBRARY = libcontainer.a
+
+SOURCES = container_close.c container_lseek.c container_open.c \
+	  container_read.c container_fstat.c
+
+HEADERS = libcontainer.h
+
+all: $(LIBRARY)
+
+include $(TOP)/../Rules.mk

Added: branches/vendor/emile/libcontainer/container_close.c
===================================================================
--- branches/vendor/emile/libcontainer/container_close.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libcontainer/container_close.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,22 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+
+#include "libcontainer.h"
+
+int container_close(container_FILE *file)
+{
+	if (file == NULL)
+		return -1;
+
+	if (file->container)
+		free(file->container);
+
+	free(file);
+
+	return 0;
+}

Added: branches/vendor/emile/libcontainer/container_fstat.c
===================================================================
--- branches/vendor/emile/libcontainer/container_fstat.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libcontainer/container_fstat.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,19 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "libcontainer.h"
+
+int container_fstat(container_FILE *file, struct stream_stat *buf)
+{
+	if (buf == NULL)
+		return -1;
+	if (file->container->size == -1)
+		return -1;
+
+	buf->st_size = file->container->size;
+
+	return 0;
+}

Added: branches/vendor/emile/libcontainer/container_lseek.c
===================================================================
--- branches/vendor/emile/libcontainer/container_lseek.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libcontainer/container_lseek.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,34 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "libcontainer.h"
+
+int container_lseek(container_FILE *file, off_t offset, int whence)
+{
+	long new_offset;
+
+	switch(whence)
+	{
+	case SEEK_SET:
+		new_offset = offset;
+		break;
+	case SEEK_CUR:
+		new_offset = file->offset + offset;
+		break;
+	default:
+		return -1;
+	}
+
+	if (new_offset < 0)
+		return -1;
+
+	file->offset = new_offset;
+
+	return new_offset;
+}

Added: branches/vendor/emile/libcontainer/container_open.c
===================================================================
--- branches/vendor/emile/libcontainer/container_open.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libcontainer/container_open.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,49 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+
+#include <stdlib.h>
+
+#include "libcontainer.h"
+
+container_FILE *container_open(device_io_t *device, char *path)
+{
+	container_FILE *file;
+	int block_size = device->get_blocksize(device->data);
+	unsigned long first, nbblocs;
+	int ret;
+
+	first = strtol(path, &path, 0);
+	if (*path != ',')
+		return NULL;
+	path++;
+	nbblocs = strtol(path, &path, 0);
+	if (*path != 0)
+		return NULL;
+	file = (container_FILE *)malloc(sizeof(container_FILE) + block_size);
+	if (file == NULL)
+		return NULL;
+
+	file->container = (struct emile_container*)malloc(block_size * nbblocs);
+	if (file->container == NULL)
+	{
+		free(file);
+		return NULL;
+	}
+
+	ret = device->read_sector(device->data, first, file->container, block_size * nbblocs);
+	if (ret == -1)
+	{
+		free(file->container);
+		free(file);
+	}
+
+	file->offset = 0;
+	file->device = device;
+	file->current_block = 0;
+	return file;
+}

Added: branches/vendor/emile/libcontainer/container_read.c
===================================================================
--- branches/vendor/emile/libcontainer/container_read.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libcontainer/container_read.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,86 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "libcontainer.h"
+
+extern void error(char *x) __attribute__ ((noreturn));
+
+static unsigned long seek_block(container_FILE *file)
+{
+	struct emile_container *container = file->container;
+	ssize_t current;
+	int i;
+	unsigned long offset = file->offset;
+	int block_size = file->device->get_blocksize(file->device->data);
+
+	for (i = 0, current = 0;
+	     container->blocks[i].offset != 0; i++)
+	{
+		int extent_size = block_size *
+				  container->blocks[i].count;
+
+		if ( (current <= offset) && (offset < current + extent_size) )
+		{
+			return container->blocks[i].offset + 
+				(offset - current) / block_size;
+		}
+
+		current += extent_size;
+	}
+
+	return 0;
+}
+
+ssize_t container_read(container_FILE *file, void *ptr, size_t size)
+{
+	int err;
+	ssize_t read = 0;
+	int part;
+	int block_size = file->device->get_blocksize(file->device->data);
+
+	while (size != 0)
+	{
+		unsigned long block_nb;
+		int block_offset;
+
+		if (file->offset >= file->container->size)
+			return read;
+
+		block_nb = seek_block(file);
+		block_offset = file->offset % block_size;
+
+		if (block_nb == 0)
+			error("BUG in libcontainer !!!");
+
+		if (block_nb != file->current_block)
+		{
+			err = file->device->read_sector(
+					file->device->data,
+					block_nb,
+					file->buffer,
+					block_size);
+			if (err == -1)
+				return -1;
+			file->current_block = block_nb;
+		}
+
+		part = block_size - block_offset;
+		if (part > size)
+			part = size;
+		memcpy(ptr, file->buffer + block_offset, part);
+
+		size -= part;
+		ptr = (char*)ptr + part;
+		file->offset += part;
+		read += part;
+	}
+
+	return read;
+}

Added: branches/vendor/emile/libcontainer/libcontainer.h
===================================================================
--- branches/vendor/emile/libcontainer/libcontainer.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libcontainer/libcontainer.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,38 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef _LIBCONTAINER_H_
+#define _LIBCONTAINER_H_
+
+#include <sys/types.h>
+
+#include <libstream.h>
+
+struct emile_block {
+	u_int32_t	offset;	/* offset of first block */
+	u_int16_t	count;	/* number of blocks */
+} __attribute__((packed));
+
+struct emile_container {
+	u_int32_t		size;
+	struct emile_block	blocks[0];
+} __attribute__((packed));
+
+typedef struct {
+	unsigned long offset;
+	device_io_t *device;
+	struct emile_container* container;
+	unsigned long current_block;
+	char *buffer[0];
+} container_FILE;
+
+extern container_FILE *container_open(device_io_t *device, char *current);
+extern int container_close(container_FILE *file);
+extern int container_lseek(container_FILE *file, off_t offset, int whence);
+extern ssize_t container_read(container_FILE *file, void *ptr, size_t size);
+extern int container_fstat(container_FILE *file, struct stream_stat *buf);
+
+#endif /* _LIBCONTAINER_H_ */

Added: branches/vendor/emile/libemile/Makefile
===================================================================
--- branches/vendor/emile/libemile/Makefile	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/Makefile	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,50 @@
+#
+#  (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+#
+#
+
+TOP=$(shell pwd)
+
+AS=$(CROSS_COMPILE)as
+CC=$(CROSS_COMPILE)gcc
+LD=$(CROSS_COMPILE)ld
+AR=$(CROSS_COMPILE)ar
+
+CPPFLAGS = $(CROSS_COMPILE_CPPFLAGS)
+LDFLAGS = $(CROSS_COMPILE_LDFLAGS)
+
+LIBRARY = libemile.a
+
+SOURCES = emile_block0_write.c emile_checksum.c emile_first_get_param.c \
+	  emile_first_set_param.c emile_first_set_param_scsi.c \
+	  emile_floppy_create_image.c \
+	  emile_map_bootblock_get_type.c emile_map_bootblock_is_valid.c \
+	  emile_map_bootblock_read.c emile_map_bootblock_write.c \
+	  emile_map_close.c emile_map_dev.c emile_map_geometry.c \
+	  emile_map_get_bootinfo.c emile_map_get_driver_info.c \
+	  emile_map_get_driver_number.c emile_map_get_number.c \
+	  emile_map_get_partition_geometry.c emile_map_get_partition_name.c \
+	  emile_map_get_partition_type.c emile_map_has_apple_driver.c \
+	  emile_map_is_valid.c emile_map_open.c \
+	  emile_map_partition_get_flags.c emile_map_partition_is_bootable.c \
+	  emile_map_partition_is_startup.c emile_map_partition_is_valid.c \
+	  emile_map_partition_set_bootable.c emile_map_partition_set_flags.c \
+	  emile_map_partition_set_startup.c emile_map_read.c \
+	  emile_map_seek_driver_partition.c emile_map_set_bootinfo.c \
+	  emile_map_set_driver_info.c emile_map_set_driver_number.c \
+	  emile_map_set_partition_name.c emile_map_set_partition_type.c \
+	  emile_map_set_startup.c emile_map_write.c \
+	  emile_scsi_create_container.c emile_scsi_get_dev.c \
+	  emile_scsi_get_rdev.c emile_second_get_configuration.c \
+	  emile_second_set_configuration.c emile_second_get_next_property.c \
+	  emile_second_get_property.c emile_second_set_property.c \
+	  emile_second_remove_property.c emile_second_create_mapfile.c
+
+HEADERS = emile.h libemile.h partition.h bootblock.h
+
+CFLAGS  = -Wall -g
+CPPFLAGS = -I../libmacos -I../libcontainer -I../libstream
+
+all: $(LIBRARY)
+
+include $(TOP)/../Rules.mk

Added: branches/vendor/emile/libemile/bootblock.h
===================================================================
--- branches/vendor/emile/libemile/bootblock.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/bootblock.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,57 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+/*
+ * WARNING: remember that m68k is big endian, like powerPC.
+ *	    i386 is little-endian
+ */
+
+#ifndef _BOOTBLOCK_H
+#define _BOOTBLOCK_H
+static __attribute__((used)) char* bootblock_header = "$CVSHeader$";
+#include <macos/devices.h>
+
+/* first level structure */
+
+/* BootBlkHdr Structure: "Inside Macintosh: Files", p. 2-57 */
+
+typedef struct BootBlkHdr BootBlkHdr_t;
+
+struct BootBlkHdr {
+	u_int16_t	ID;		/* boot blocks signature */
+	u_int32_t	Entry;		/* entry point to bootcode */
+	u_int16_t	Version;	/* boot blocks version number */
+	u_int16_t	PageFlags;	/* used internally */
+	u_int8_t	SysName[16];	/* System filename */
+	u_int8_t	ShellName[16];	/* Finder filename */
+	u_int8_t	Dbg1Name[16];	/* debugger filename */
+	u_int8_t	Dbg2Name[16];	/* debugger filename */
+	u_int8_t	ScreenName[16];	/* name of startup screen */
+	u_int8_t	HelloName[16];	/* name of startup program */
+	u_int8_t	ScrapName[16];	/* name of system scrap file */
+	u_int16_t	CntFCBs;	/* number of FCBs to allocate */
+	u_int16_t	CntEvts;	/* number of event queue elements */
+	u_int32_t	Heap128K;	/* system heap size on 128K Mac */
+	u_int32_t	Heap256K;	/* used internally */
+	u_int32_t	SysHeapSize;	/* system heap size on all machines */
+} __attribute__((packed));
+
+#define ASSERT_BBH(a)	if ( sizeof(BootBlkHdr_t) != 138 ) { a }
+
+/* EMILE Boot block structure */
+
+typedef struct eBootBlock eBootBlock_t;
+
+struct eBootBlock {
+	BootBlkHdr_t		boot_block_header;
+	ParamBlockRec_t		second_param_block;
+	u_int8_t		boot_code[1024 - sizeof(BootBlkHdr_t)
+					       - sizeof(ParamBlockRec_t)];
+} __attribute__((packed));
+
+#define ASSERT_BB(a)	if ( sizeof(eBootBlock_t) != 1024 ) { a }
+
+#endif

Added: branches/vendor/emile/libemile/emile.h
===================================================================
--- branches/vendor/emile/libemile/emile.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,71 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef  _EMILE_H
+#define  _EMILE_H
+static __attribute__((used)) char* emile_header = "$CVSHeader: $";
+#include <endian.h>
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+
+/* nothing to do, because m68k is big endian too */
+
+static inline u_int16_t read_short(u_int16_t* addr)
+{
+	return *addr;
+}
+
+static inline void write_short(u_int16_t* addr, u_int16_t value)
+{
+	*addr = value;
+}
+
+static inline u_int32_t read_long(u_int32_t* addr)
+{
+	return *addr;
+}
+
+static inline void write_long(u_int32_t* addr, u_int32_t value)
+{
+	*addr = value;
+}
+
+#else /* __BYTE_ORDER == __LITTLE_ENDIAN */
+
+/* little endian (or unknown), read byte by byte to get it in good order */
+
+static inline u_int16_t read_short(u_int16_t* addr)
+{
+	unsigned char* baddr = (unsigned char*)addr;
+
+	return ((u_int16_t)(*baddr) << 8) | (u_int16_t)*(baddr+1);
+}
+
+static inline void write_short(u_int16_t* addr, u_int16_t value)
+{
+	unsigned char* baddr = (unsigned char*)addr;
+
+	*baddr = (unsigned char)(value>>8);
+	*(baddr+1) = (unsigned char)value;
+}
+
+static inline u_int32_t read_long(u_int32_t* addr)
+{
+	u_int16_t* saddr = (u_int16_t*)addr;
+
+	return ((u_int32_t)read_short(saddr) << 16) | 
+		(u_int32_t)read_short(saddr+1);;
+}
+
+static inline void write_long(u_int32_t* addr, u_int32_t value)
+{
+	u_int16_t* saddr = (u_int16_t*)addr;
+
+	write_short(saddr, (u_int16_t)(value>>16));
+	write_short(saddr+1, (u_int16_t)value);
+}
+#endif
+#endif

Added: branches/vendor/emile/libemile/emile_block0_write.c
===================================================================
--- branches/vendor/emile/libemile/emile_block0_write.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_block0_write.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,25 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_block0_write(emile_map_t *map)
+{
+	int ret;
+
+	ret = lseek(map->fd, 0, SEEK_SET);
+	if (ret != 0)
+		return -1;
+
+	ret = write(map->fd, &map->drivers, sizeof(map->drivers));
+
+	return ret;
+}

Added: branches/vendor/emile/libemile/emile_checksum.c
===================================================================
--- branches/vendor/emile/libemile/emile_checksum.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_checksum.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,41 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "libemile.h"
+
+#ifdef USE_16BIT_CHECKSUM
+int emile_checksum(unsigned char *addr, unsigned short length)
+{
+	int j;
+	unsigned short sum = 0;
+
+	for (j = 0; j < length; j++)
+	{
+		sum += addr[j];
+		sum = (sum << 1) | (sum >> 15);
+	}
+	if (sum == 0)
+		sum = 0xFFFF;
+
+	return sum;
+}
+#else
+unsigned short emile_checksum(unsigned char *addr, unsigned int length)
+{
+	unsigned int sum = 0;
+	unsigned int i;
+
+	for (i = 0; i < length; i++)
+	{
+		sum += addr[i];
+		sum <<= 1;
+		sum |= (sum & 0x00010000) ? 1 : 0;
+	}
+
+	return sum;
+}
+#endif

Added: branches/vendor/emile/libemile/emile_first_get_param.c
===================================================================
--- branches/vendor/emile/libemile/emile_first_get_param.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_first_get_param.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,38 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "libemile.h"
+#include "emile.h"
+#include "bootblock.h"
+
+int emile_first_get_param(int fd, int *drive_num, int *second_offset, 
+			  int *second_size)
+{
+	eBootBlock_t firstBlock;
+	int ret;
+
+	ret = read(fd, &firstBlock, sizeof(firstBlock));
+	if (ret != sizeof(firstBlock))
+		return EEMILE_CANNOT_READ_FIRST;
+
+	if ( strncmp( firstBlock.boot_block_header.SysName+1,
+		      "Mac Bootloader", 14) == 0 )
+	{
+		*drive_num = read_short(&firstBlock.second_param_block.ioVRefNum);
+		*second_offset = read_long(&firstBlock.second_param_block.ioPosOffset);
+		*second_size = read_long(&firstBlock.second_param_block.ioReqCount);
+	}
+	else
+		return EEMILE_UNKNOWN_FIRST;
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_first_set_param.c
===================================================================
--- branches/vendor/emile/libemile/emile_first_set_param.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_first_set_param.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,59 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "libemile.h"
+#include "emile.h"
+#include "bootblock.h"
+
+int emile_first_set_param(int fd, unsigned short tune_mask, int drive_num, 
+			  int second_offset, int second_size)
+{
+	eBootBlock_t firstBlock;
+	int ret;
+	off_t location;
+
+	location = lseek(fd, 0, SEEK_CUR);
+	if (location == -1)
+		return EEMILE_CANNOT_READ_FIRST;
+
+	ret = read(fd, &firstBlock, sizeof(firstBlock));
+	if (ret != sizeof(firstBlock))
+		return EEMILE_CANNOT_READ_FIRST;
+
+	if ( strncmp( firstBlock.boot_block_header.SysName+1,
+		      "Mac Bootloader", 14) == 0 )
+	{
+		if (tune_mask & EMILE_FIRST_TUNE_DRIVE)
+			write_short(&firstBlock.second_param_block.ioVRefNum, 
+				    drive_num);
+
+		if (tune_mask & EMILE_FIRST_TUNE_OFFSET)
+			write_long(&firstBlock.second_param_block.ioPosOffset, 
+				   second_offset);
+
+		if (tune_mask & EMILE_FIRST_TUNE_SIZE)
+			write_long(&firstBlock.second_param_block.ioReqCount, 
+				   second_size);
+
+		ret = lseek(fd, location, SEEK_SET);
+		if (ret != 0)
+			return EEMILE_CANNOT_WRITE_FIRST;
+
+		ret = write(fd, &firstBlock, sizeof(firstBlock));
+		if (ret != sizeof(firstBlock))
+			return EEMILE_CANNOT_WRITE_FIRST;
+	}
+	else
+		return EEMILE_UNKNOWN_FIRST;
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_first_set_param_scsi.c
===================================================================
--- branches/vendor/emile/libemile/emile_first_set_param_scsi.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_first_set_param_scsi.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,89 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "libemile.h"
+
+#define BLOCK_SIZE	512	/* FIXME: should ask the disk driver */
+
+int emile_first_set_param_scsi(int fd, char *second_name)
+{
+	int ret;
+	int fd_second;
+	char first[1024];
+	int i;
+	int current;
+	struct emile_container *container;
+	unsigned short max_blocks;
+	unsigned short *first_max_blocks = (unsigned short*)&first[1022];
+	unsigned long *second_size = (unsigned long*)&first[1018];
+	unsigned short *unit_id = (unsigned short*)&first[1016];
+	unsigned short *block_size = (unsigned short*)&first[1014];
+	unsigned short *count;
+	unsigned long *offset;
+
+	ret = read(fd, first, 1024);
+	if (ret == -1)
+		return EEMILE_CANNOT_READ_FIRST;
+
+	max_blocks = *first_max_blocks / 6;
+
+	container = (struct emile_container*)
+				malloc(sizeof(struct emile_container) 
+				     + max_blocks * sizeof(struct emile_block));
+	if (container == NULL)
+		return EEMILE_MALLOC_ERROR;
+
+	fd_second = open(second_name, O_RDONLY);
+	if (fd_second == -1)
+		return EEMILE_CANNOT_OPEN_FILE;
+
+	ret = emile_scsi_create_container(fd_second, unit_id, container, max_blocks);
+	if (ret != 0)
+		return ret;
+	close(fd_second);
+
+	*block_size = BLOCK_SIZE;
+
+	*second_size = 0;
+	current = 1014;
+	for(i = 0; i < max_blocks - 1; i++)
+	{
+		current -= 2;
+		count = (short*)(&first[current]);
+		*count = container->blocks[i].count;
+		if (container->blocks[i].count == 0)
+			break;
+		current -= 4;
+		offset = (long*)(&first[current]);
+		*offset = container->blocks[i].offset;
+		(*second_size) += container->blocks[i].count;
+	}
+	putchar('\n');
+	/* mark end of blocks list */
+	current -= 2;
+	count = (short*)(&first[current]);
+	*count = 0;
+	/* set second level size */
+	(*second_size) *= BLOCK_SIZE;
+
+	ret = lseek(fd, 0, SEEK_SET);
+	if (ret != 0) 
+		return EEMILE_CANNOT_WRITE_FIRST;
+
+	ret = write(fd, first, 1024);
+	if (ret == -1)
+		return EEMILE_CANNOT_WRITE_FIRST;
+	
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_floppy_create_image.c
===================================================================
--- branches/vendor/emile/libemile/emile_floppy_create_image.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_floppy_create_image.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,232 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "libemile.h"
+#include "emile.h"
+#include "bootblock.h"
+
+static int copy_file(int fd, char* file)
+{
+	int source;
+	int size_read;
+	int size_written;
+	int total;
+	static char buffer[FLOPPY_SECTOR_SIZE];
+
+	source = open(file, O_RDONLY);
+	if (source < 0)
+	{
+		close(source);
+		return EEMILE_CANNOT_OPEN_FILE;
+	}
+
+	total = 0;
+	for(;;)
+	{
+		size_read = read(source, buffer, FLOPPY_SECTOR_SIZE);
+		if (size_read == FLOPPY_SECTOR_SIZE)
+		{
+			size_written = write(fd, buffer, FLOPPY_SECTOR_SIZE);
+			total += size_written;
+			if (size_written != FLOPPY_SECTOR_SIZE)
+			{
+				close(source);
+				return -1; 
+			}
+		}
+		else
+		{
+			if (size_read == 0)
+				break;
+
+			memset(buffer + size_read, 0, FLOPPY_SECTOR_SIZE - size_read);
+			size_written = write(fd, buffer, FLOPPY_SECTOR_SIZE);
+			total += size_written;
+			if (size_written != FLOPPY_SECTOR_SIZE)
+			{
+				close(source);
+				return -1; 
+			}
+			break;
+		}
+	}
+
+	close(source);
+	return total;
+}
+
+static int pad_image(int fd, int size)
+{
+	static char buffer[FLOPPY_SECTOR_SIZE];
+	int size_written;
+	int total;
+
+	if (size % FLOPPY_SECTOR_SIZE) {
+		fprintf(stderr, 
+			"WARNING: pad size is not a multiple of sector size\n");
+	}
+
+	memset(buffer, 0, FLOPPY_SECTOR_SIZE);
+	total = 0;
+	while (size > 0) {
+		size_written = write(fd, buffer, FLOPPY_SECTOR_SIZE);
+		total += size_written;
+		if (size_written != FLOPPY_SECTOR_SIZE) {
+			return total; 
+		}
+		size -= size_written;
+	}
+	return total;
+}
+
+static int aggregate(int fd, char* first_level, char* second_level, char* kernel_image, char* ramdisk)
+{
+	int ret;
+	int total;
+
+	ret = copy_file(fd, first_level);
+	if (ret < 0)
+		return EEMILE_CANNOT_WRITE_FIRST;
+	total = ret;
+
+	ret = copy_file(fd, second_level);
+	if (ret < 0)
+		return EEMILE_CANNOT_WRITE_SECOND;
+	total += ret;
+
+	if (kernel_image != NULL)
+	{
+		ret = copy_file(fd, kernel_image);
+		if (ret < 0)
+			return EEMILE_CANNOT_WRITE_KERNEL;
+		total += ret;
+	}
+
+	if (ramdisk != NULL)
+	{
+		ret = copy_file(fd, ramdisk);
+		if (ret < 0)
+			return EEMILE_CANNOT_WRITE_RAMDISK;
+		total += ret;
+	}
+
+	ret = pad_image(fd, 1474560 - total);
+	if (ret < 0)
+		return EEMILE_CANNOT_WRITE_PAD;
+
+	return 0;
+}
+
+static int is_url(char *path)
+{
+	return path && ((strncmp(path, "iso9660:", strlen("iso9660:")) == 0) ||
+	       (strncmp(path, "container:", strlen("container:")) == 0) ||
+	       (strncmp(path, "block:", strlen("block:")) == 0) ||
+	       (strncmp(path, "ext2:", strlen("ext2")) == 0));
+}
+int emile_floppy_create_image(char* first_level, char* second_level, 
+			      char* kernel_image, char* ramdisk, 
+			      char* image)
+{
+	int ret;
+	int fd;
+	char *kernel_url = NULL;
+	char *ramdisk_url = NULL;
+	char configuration[1024];
+
+	if (image == NULL)
+		return -1;
+
+	fd = open(image, O_RDWR|O_CREAT|O_TRUNC,
+			 S_IRUSR| S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
+	if (fd == -1)
+		return EEMILE_CANNOT_CREATE_IMAGE;
+
+	/* aggregating files: first, second, kernel, ramdisk */
+
+	if (first_level == NULL)
+	{
+		close(fd);
+		return EEMILE_MISSING_FIRST;
+	}
+
+	if (second_level == NULL)
+	{
+		close(fd);
+		return EEMILE_MISSING_SECOND;
+	}
+
+	if (kernel_image == NULL)
+		fprintf(stderr, "WARNING: kernel image file not defined\n");
+
+	if ( is_url(kernel_image) )
+	{
+		kernel_url = kernel_image;
+		kernel_image = NULL;
+	}
+	if ( is_url(ramdisk) )
+	{
+		ramdisk_url = ramdisk;
+		ramdisk = NULL;
+	}
+
+	ret = aggregate(fd, first_level, second_level, kernel_image, ramdisk);
+	if (ret != 0)
+	{
+		close(fd);
+		return ret;
+	}
+	
+	/* set first level info */
+
+	lseek(fd, 0, SEEK_SET);
+	ret = emile_first_set_param(fd, EMILE_FIRST_TUNE_DRIVE |
+					EMILE_FIRST_TUNE_OFFSET|
+					EMILE_FIRST_TUNE_SIZE, 
+					1, FIRST_LEVEL_SIZE, 
+					emile_file_get_size(second_level));
+	if (ret != 0)
+	{
+		close(fd);
+		return ret;
+	}
+
+	/* set second level info */
+
+	*configuration = 0;
+	if (kernel_image)
+	{
+		sprintf(configuration, "kernel block:(fd0)0x%lx\n", 
+			FIRST_LEVEL_SIZE + emile_file_get_size(second_level));
+	}
+	else if (kernel_url)
+		sprintf(configuration, "kernel %s\n", kernel_url);
+
+	if (ramdisk)
+		sprintf(configuration + strlen(configuration), 
+			"initrd block:(fd0)0x%lx,0x%lx\n", FIRST_LEVEL_SIZE + 
+			emile_file_get_size(second_level) + 
+			emile_file_get_size(kernel_image),
+			emile_file_get_size(ramdisk));
+	else if (ramdisk_url)
+		sprintf(configuration + strlen(configuration),
+					"initrd %s\n", ramdisk_url);
+
+	sprintf(configuration + strlen(configuration), "vga default");
+	ret = emile_second_set_configuration(fd, configuration);
+
+	close(fd);
+
+	return ret;
+}

Added: branches/vendor/emile/libemile/emile_map_bootblock_get_type.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_bootblock_get_type.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_bootblock_get_type.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,24 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <string.h>
+
+#include "libemile.h"
+
+int emile_map_bootblock_get_type(char* bootblock)
+{
+	if (!emile_map_bootblock_is_valid(bootblock))
+		return INVALID_BOOTBLOCK;
+
+	if (strcmp(&bootblock[11], "System") == 0)
+		return APPLE_BOOTBLOCK;
+
+	if (strcmp(&bootblock[11], "Mac Bootloader") == 0)
+		return EMILE_BOOTBLOCK;
+
+	return UNKNOWN_BOOTBLOCK;
+}

Added: branches/vendor/emile/libemile/emile_map_bootblock_is_valid.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_bootblock_is_valid.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_bootblock_is_valid.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,14 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_bootblock_is_valid(char *bootblock)
+{
+	return (bootblock[0] == 0x4C) && (bootblock[1] == 0x4B);
+}

Added: branches/vendor/emile/libemile/emile_map_bootblock_read.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_bootblock_read.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_bootblock_read.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,37 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_bootblock_read(emile_map_t* map, char* bootblock)
+{
+	char name[16];
+	int ret;
+	int fd;
+
+	if (!emile_map_partition_is_valid(map))
+		return -1;
+
+	sprintf(name, "%s%d", map->name, map->current + 1);
+
+	fd = open(name, O_RDONLY);
+	if (fd == -1)
+		return -1;
+
+	ret = read(fd, bootblock, BOOTBLOCK_SIZE);
+
+	close(fd);
+
+	return ret;
+}

Added: branches/vendor/emile/libemile/emile_map_bootblock_write.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_bootblock_write.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_bootblock_write.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,37 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_bootblock_write(emile_map_t* map, char* bootblock)
+{
+	char name[16];
+	int ret;
+	int fd;
+
+	if (!emile_map_partition_is_valid(map))
+		return -1;
+
+	sprintf(name, "%s%d", map->name, map->current + 1);
+
+	fd = open(name, O_WRONLY);
+	if (fd == -1)
+		return -1;
+
+	ret = write(fd, bootblock, BOOTBLOCK_SIZE);
+
+	close(fd);
+
+	return ret;
+}

Added: branches/vendor/emile/libemile/emile_map_close.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_close.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_close.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,18 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+void emile_map_close(emile_map_t *map)
+{
+	close(map->fd);
+	free(map);
+}

Added: branches/vendor/emile/libemile/emile_map_dev.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_dev.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_dev.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,19 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+char* emile_map_dev(emile_map_t *map)
+{
+	if (!emile_map_partition_is_valid(map))
+		return NULL;
+
+	return map->name;
+}

Added: branches/vendor/emile/libemile/emile_map_geometry.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_geometry.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_geometry.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,20 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_geometry(emile_map_t *map, int *block_size, int *block_count)
+{
+	if (!emile_map_is_valid(map))
+		return -1;
+
+	*block_size = map->drivers.BlkSize;
+	*block_count = map->drivers.BlkCount;
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_map_get_bootinfo.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_get_bootinfo.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_get_bootinfo.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,28 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <string.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_get_bootinfo(emile_map_t *map, int* bootstart, int *bootsize,
+		           int *bootaddr, int *bootentry, int* checksum,
+			   char* processor)
+{
+	 if (!emile_map_is_valid(map))
+		 return -1;
+
+	*bootstart = map->partition.LgBootStart;
+	*bootsize = map->partition.BootSize;
+	*bootaddr = map->partition.BootAddr;
+	*bootentry = map->partition.BootEntry;
+	*checksum = map->partition.BootCksum;
+	strcpy(processor, map->partition.Processor);
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_map_get_driver_info.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_get_driver_info.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_get_driver_info.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,25 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_get_driver_info(emile_map_t *map, int number,
+			      int *block, int *size, int* type)
+{
+	if (!emile_map_is_valid(map))
+		return -1;
+
+	if (number > emile_map_get_driver_number(map))
+		return -1;
+
+	*block = map->drivers.DrvInfo[number].Block;
+	*size = map->drivers.DrvInfo[number].Size;
+	*type = map->drivers.DrvInfo[number].Type;
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_map_get_driver_number.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_get_driver_number.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_get_driver_number.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,17 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_get_driver_number(emile_map_t *map)
+{
+	if (!emile_map_is_valid(map))
+		return -1;
+
+	return map->drivers.DrvrCount;
+}

Added: branches/vendor/emile/libemile/emile_map_get_number.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_get_number.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_get_number.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,17 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_get_number(emile_map_t *map)
+{
+	return map->partition.MapBlkCnt;
+}

Added: branches/vendor/emile/libemile/emile_map_get_partition_geometry.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_get_partition_geometry.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_get_partition_geometry.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,20 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_get_partition_geometry(emile_map_t *map, int *start, int *count)
+{
+	if (!emile_map_partition_is_valid(map))
+		return -1;
+
+	*start = map->partition.PyPartStart;
+	*count = map->partition.PartBlkCnt;
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_map_get_partition_name.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_get_partition_name.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_get_partition_name.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,19 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+char* emile_map_get_partition_name(emile_map_t *map)
+{
+	if (!emile_map_partition_is_valid(map))
+		return NULL;
+
+	return map->partition.PartName;
+}

Added: branches/vendor/emile/libemile/emile_map_get_partition_type.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_get_partition_type.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_get_partition_type.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,19 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+char* emile_map_get_partition_type(emile_map_t *map)
+{
+	if (!emile_map_partition_is_valid(map))
+		return NULL;
+
+	return map->partition.PartType;
+}

Added: branches/vendor/emile/libemile/emile_map_has_apple_driver.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_has_apple_driver.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_has_apple_driver.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,40 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+/*
+ * See http://developer.apple.com/technotes/tn/tn1189.html
+ *
+ */
+
+#include <string.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_has_apple_driver(emile_map_t *map)
+{
+	int block, size, type, part;
+	int i;
+	int ret;
+
+	for (i = 0; i < emile_map_get_driver_number(map); i++)
+	{
+		emile_map_get_driver_info(map, i, &block, &size, &type);
+
+		part = emile_map_seek_driver_partition(map, block);
+
+		ret = emile_map_read(map, part);
+		if (ret == -1)
+			return -1;
+
+		if (strncmp(map->partition.PartType, 
+			      APPLE_DRIVER, strlen(APPLE_DRIVER)) == 0)
+			return 1;
+	}
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_map_is_valid.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_is_valid.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_is_valid.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,14 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_is_valid(emile_map_t *map)
+{
+	return map->drivers.Sig == DD_SIGNATURE;
+}

Added: branches/vendor/emile/libemile/emile_map_open.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_open.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_open.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,56 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+emile_map_t* emile_map_open(char *dev, int flags)
+{
+	emile_map_t *map;
+	int ret;
+
+	ASSERT_DD(printf("INTERNAL ERROR: Bad Block 0 size structure\n");
+		  return NULL;)
+	ASSERT_P(printf("INTERNAL ERROR: Bad Partition size structure\n"); 
+		 return NULL;)
+
+	map = (emile_map_t*)malloc(sizeof(emile_map_t));
+	if (map == NULL)
+		return NULL;
+
+	map->fd = open(dev, flags);
+	if (map->fd == -1)
+	{
+		free(map);
+		return NULL;
+	}
+	strncpy(map->name, dev, 16);
+
+	ret = read(map->fd, &map->drivers, sizeof(map->drivers));
+	if (ret == -1)
+	{
+		free(map);
+		return NULL;
+	}
+
+	ret = read(map->fd, &map->partition, sizeof(map->partition));
+	if (ret == -1)
+	{
+		free(map);
+		return NULL;
+	}
+	map->current = 0;
+	
+	return map;
+}

Added: branches/vendor/emile/libemile/emile_map_partition_get_flags.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_partition_get_flags.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_partition_get_flags.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,14 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_partition_get_flags(emile_map_t *map)
+{
+	return map->partition.PartStatus;
+}

Added: branches/vendor/emile/libemile/emile_map_partition_is_bootable.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_partition_is_bootable.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_partition_is_bootable.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,14 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_partition_is_bootable(emile_map_t *map)
+{
+	return (map->partition.PartStatus & kPartitionAUXIsBootValid) == kPartitionAUXIsBootValid;
+}

Added: branches/vendor/emile/libemile/emile_map_partition_is_startup.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_partition_is_startup.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_partition_is_startup.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,14 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_partition_is_startup(emile_map_t *map)
+{
+	return (map->partition.PartStatus & kPartitionIsStartup) == kPartitionIsStartup;
+}

Added: branches/vendor/emile/libemile/emile_map_partition_is_valid.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_partition_is_valid.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_partition_is_valid.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,14 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_partition_is_valid(emile_map_t *map)
+{
+	return map->partition.Sig == MAP_SIGNATURE;
+}

Added: branches/vendor/emile/libemile/emile_map_partition_set_bootable.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_partition_set_bootable.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_partition_set_bootable.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,22 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_partition_set_bootable(emile_map_t *map, int enable)
+{
+	if (!emile_map_partition_is_valid(map))
+		return -1;
+
+	if (enable)
+		map->partition.PartStatus |= kPartitionAUXIsBootValid;
+	else
+		map->partition.PartStatus &= ~kPartitionAUXIsBootValid;
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_map_partition_set_flags.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_partition_set_flags.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_partition_set_flags.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,16 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_partition_set_flags(emile_map_t *map, int flags)
+{
+	map->partition.PartStatus = flags;
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_map_partition_set_startup.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_partition_set_startup.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_partition_set_startup.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,22 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_partition_set_startup(emile_map_t *map, int enable)
+{
+	if (!emile_map_partition_is_valid(map))
+		return -1;
+
+	if (enable)
+		map->partition.PartStatus |= kPartitionIsStartup;
+	else
+		map->partition.PartStatus &= ~kPartitionIsStartup;
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_map_read.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_read.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_read.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,38 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_read(emile_map_t *map, int part)
+{
+	off_t offset;
+	int ret;
+
+	if (map->current == part)
+		return part;
+
+	if (part > map->partition.MapBlkCnt)
+		return -1;
+
+	offset = part * sizeof(struct Partition) + sizeof(struct DriverDescriptor);
+
+	ret = lseek(map->fd, offset, SEEK_SET);
+	if (ret != offset)
+		return -1;
+	
+	ret = read(map->fd, &map->partition, sizeof(struct Partition));
+	if (ret != sizeof(struct Partition))
+		return -1;
+
+	map->current = part;
+
+	return part;
+}

Added: branches/vendor/emile/libemile/emile_map_seek_driver_partition.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_seek_driver_partition.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_seek_driver_partition.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,29 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "libemile.h"
+
+int emile_map_seek_driver_partition(emile_map_t *map, int base)
+{
+	int start;
+	int count;
+	int i;
+	int ret;
+
+	for (i = 0; i < emile_map_get_number(map); i++)
+	{
+		ret = emile_map_read(map, i);
+		if (ret == -1)
+			return -1;
+
+		emile_map_get_partition_geometry(map, &start, &count);
+		if (base == start)
+			return i;
+	}
+
+	return -1;
+}

Added: branches/vendor/emile/libemile/emile_map_set_bootinfo.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_set_bootinfo.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_set_bootinfo.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,29 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <string.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_set_bootinfo(emile_map_t *map, int bootstart, int bootsize,
+		           int bootaddr, int bootentry, int checksum,
+			   char* processor)
+{
+	 if (!emile_map_is_valid(map))
+		 return -1;
+
+	map->partition.LgBootStart = bootstart;
+	map->partition.BootSize = bootsize;
+	map->partition.BootAddr = bootaddr;
+	map->partition.BootEntry = bootentry;
+	map->partition.BootCksum = checksum;
+	memset(map->partition.Processor, 0, sizeof(map->partition.Processor));
+	strcpy(map->partition.Processor, processor);
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_map_set_driver_info.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_set_driver_info.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_set_driver_info.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,25 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_set_driver_info(emile_map_t *map, int number,
+			      int block, int size, int type)
+{
+	if (!emile_map_is_valid(map))
+		return -1;
+
+	if (number >= DD_MAX_DRIVER)
+		return -1;
+
+	map->drivers.DrvInfo[number].Block = block;
+	map->drivers.DrvInfo[number].Size = size;
+	map->drivers.DrvInfo[number].Type = type;
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_map_set_driver_number.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_set_driver_number.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_set_driver_number.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,22 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_set_driver_number(emile_map_t *map, int number)
+{
+	if (!emile_map_is_valid(map))
+		return -1;
+
+	if (number >= DD_MAX_DRIVER)
+		return -1;
+
+	map->drivers.DrvrCount = number;
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_map_set_partition_name.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_set_partition_name.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_set_partition_name.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,24 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <string.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_set_partition_name(emile_map_t *map, char* name)
+{
+	if (!emile_map_partition_is_valid(map))
+		return -1;
+
+	if (strlen(name) > 31)
+		return -1;
+
+	strncpy(map->partition.PartName, name, 32);
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_map_set_partition_type.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_set_partition_type.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_set_partition_type.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,24 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <string.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_set_partition_type(emile_map_t *map, char* type)
+{
+	if (!emile_map_partition_is_valid(map))
+		return -1;
+
+	if (strlen(type) > 31)
+		return -1;
+
+	strncpy(map->partition.PartType, type, 32);
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_map_set_startup.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_set_startup.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_set_startup.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,60 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_set_startup(char* dev_name, int partition)
+{
+	emile_map_t* map;
+	char *part_type;
+	int ret;
+	int i;
+
+	map = emile_map_open(dev_name, O_RDWR);
+	if (map == NULL)
+		return -1;
+
+	/* check partition type */
+
+	ret = emile_map_read(map, partition);
+	if (ret == -1)
+		return -1;
+
+	part_type = emile_map_get_partition_type(map);
+	if (strcmp(part_type, APPLE_HFS) != 0) {
+		fprintf(stderr, 
+		"ERROR: a startup partition must be of type Apple_HFS\n");
+		return -1;
+	}
+
+	for (i = 0; i < emile_map_get_number(map); i++)
+	{
+		ret = emile_map_read(map, i);
+		if (ret == -1)
+			return -1;
+
+		part_type = emile_map_get_partition_type(map);
+		if (strcmp(part_type, APPLE_HFS) == 0)
+		{
+			emile_map_partition_set_bootable(map, i == partition);
+			emile_map_partition_set_startup(map, i == partition);
+			ret = emile_map_write(map, i);
+			if (ret == -1)
+				return -1;
+		}
+	}
+	emile_map_close(map);
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_map_write.c
===================================================================
--- branches/vendor/emile/libemile/emile_map_write.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_map_write.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,35 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "partition.h"
+#include "libemile.h"
+
+int emile_map_write(emile_map_t *map, int part)
+{
+	off_t offset;
+	int ret;
+
+	if (part > map->partition.MapBlkCnt)
+		return -1;
+
+	offset = part * sizeof(struct Partition) + sizeof(struct DriverDescriptor);
+
+	ret = lseek(map->fd, offset, SEEK_SET);
+	if (ret != offset)
+		return -1;
+	
+	ret = write(map->fd, &map->partition, sizeof(struct Partition));
+	if (ret != sizeof(struct Partition))
+		return -1;
+
+	map->current = part;
+
+	return part;
+}

Added: branches/vendor/emile/libemile/emile_scsi_create_container.c
===================================================================
--- branches/vendor/emile/libemile/emile_scsi_create_container.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_scsi_create_container.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,182 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <string.h>
+#include <linux/fs.h>
+#include <linux/hdreg.h>
+#include <scsi/scsi.h>
+
+#include "libemile.h"
+
+struct scsi_id {
+	int dev;
+	int host_unique_id;
+};
+
+static int get_scsi_path(int fd, unsigned char *host, unsigned char *channel, 
+				 unsigned char *pun, unsigned char *lun)
+{
+	int ret;
+	struct scsi_id path;
+
+	ret = ioctl(fd, SCSI_IOCTL_GET_IDLUN, &path);
+
+	*host = path.dev >> 24;
+	*channel = path.dev >> 16;
+	*lun = path.dev >> 8;
+	*pun = path.dev;
+
+	return ret;
+}
+
+static int get_device_info(int fd, short *id, unsigned long *first_block, 
+				       int *block_size)
+{
+	int ret;
+	char dev_name[16];
+	struct hd_geometry geom;
+	unsigned char host;
+	unsigned char channel;
+	unsigned char pun;
+	unsigned char lun;
+	char *driver;
+	int disk;
+	int partition;
+
+	ret = emile_scsi_get_dev(fd, &driver, &disk, &partition);
+	if (ret == -1)
+		return -1;
+	sprintf(dev_name, "%s%c%d", driver, disk + 'a', partition);
+
+	fd = open(dev_name, O_RDONLY);
+	if (fd == -1) {
+		fprintf(stderr, "Cannot open device %s (%s)\n", dev_name,
+				 strerror(errno));
+		return -1;
+	}
+	ret = get_scsi_path(fd, &host, &channel, &pun, &lun);
+	*id = pun;
+
+	ret = ioctl(fd, HDIO_GETGEO, &geom);
+	if (ret == -1)
+	{
+		fprintf(stderr, "%s: ioctl(HDIO_GETGEO) fails: %s",
+				dev_name, strerror(errno));
+		return -1;
+	}
+#if 0	/* BLKSSZGET is buggy on my m68k 2.2.27-pre2 kernel */
+	ret = ioctl(fd, BLKSSZGET, block_size);
+	if (ret == -1)
+	{
+		fprintf(stderr, "%s: ioctl(BLKSSZGET) fails: %s",
+				dev_name, strerror(errno));
+		return -1;
+	}
+#else
+	*block_size = 512;
+#endif
+	*first_block = geom.start;
+	close(fd);
+
+	return 0;
+}
+
+#define ADD_BLOCK(a, b)					\
+	container->blocks[current].offset = (a);	\
+	container->blocks[current].count = (b);		\
+	current++;					\
+	if (current > maxblocks)			\
+	{						\
+		fprintf(stderr, "Container overflow\n");\
+		return -1;				\
+	}
+
+int emile_scsi_create_container(int fd, short *unit_id, 
+				struct emile_container* container, int maxblocks)
+{
+	int ret;
+	struct stat st;
+	unsigned long first_block;
+	int sector_size;
+	int block_size;
+	unsigned long sectors_per_block;
+	int current;
+	int logical;
+	int physical;
+	int last_physical;
+	unsigned long zone;
+	unsigned long aggregate;
+
+	ret = fstat(fd, &st);
+	if (ret == -1) {
+		perror("stat()");
+		return -1;
+	}
+
+	ret = get_device_info(fd, unit_id, &first_block, &sector_size);
+	if (ret != 0)
+		return -1;
+
+	container->size = st.st_size;
+
+	/* get filesystem block size */
+
+	ret = ioctl(fd, FIGETBSZ, &block_size);
+	if (ret != 0) {
+		perror("ioctl(FIGETBSZ)");
+		return -1;
+	}
+
+	sectors_per_block = block_size / sector_size;
+
+	/* get first physical block */
+
+	last_physical = 0;
+	ret = ioctl(fd, FIBMAP, &last_physical);
+	if (ret != 0) {
+		perror("ioctl(FIBMAP)");
+		return -1;
+	}
+
+	zone = last_physical;
+	aggregate = 1;
+
+	/* seek all physical blocks */
+
+	current = 0;
+	for (logical = 1; 
+	     logical < (st.st_size + block_size - 1) / block_size; 
+	     logical++) {
+		physical = logical;
+		ret = ioctl(fd, FIBMAP, &physical);
+		if (ret != 0)
+			break;
+		if (physical == last_physical + 1) {
+			aggregate++;
+		} else {
+			ADD_BLOCK(first_block + zone * sectors_per_block,
+				  aggregate * sectors_per_block);
+			zone = physical;
+			aggregate = 1;
+		}
+		last_physical = physical;
+	}
+
+	ADD_BLOCK(first_block + zone * sectors_per_block,
+		  aggregate * sectors_per_block);
+
+	/* end of list */
+
+	ADD_BLOCK(0L, 0L);
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_scsi_get_dev.c
===================================================================
--- branches/vendor/emile/libemile/emile_scsi_get_dev.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_scsi_get_dev.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,57 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#include "libemile.h"
+
+/* SCSI disks */
+
+#define MAJOR_HD	3
+#define MAJOR_SD	8
+static char *scsi_base = "/dev/sd";
+static char *ata_base = "/dev/hd";
+
+int emile_scsi_get_dev(int fd, char** driver, int *disk, int *partition)
+{
+	struct stat st;
+	int ret;
+	int dev;
+	int major;
+	int minor;
+
+	ret = fstat(fd, &st);
+	if (ret == -1)
+		return -1;
+
+	dev = S_ISREG(st.st_mode) ? st.st_dev : st.st_rdev;
+
+	major = (dev >> 8) & 0x0F;	/* major number = driver id */
+	minor = dev & 0xFF;		/* minor number = disk id */
+
+	switch(major)
+	{
+	case MAJOR_SD:	/* SCSI disks */
+		*driver = scsi_base;
+		*disk = minor >> 4;
+		*partition = minor & 0x0F;
+		break;
+	case MAJOR_HD:	/* ATA disks */
+		*driver = ata_base;
+		*disk = minor >> 6;
+		*partition = minor & 0x3F;
+		break;
+	default:
+		fprintf(stderr, "Unknown device major number %d\n", major);
+		return -1;
+	}
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_scsi_get_rdev.c
===================================================================
--- branches/vendor/emile/libemile/emile_scsi_get_rdev.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_scsi_get_rdev.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,48 @@
+static __attribute__((used)) char* rcsid = "$CVSHeader$";
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "partition.h"
+#include "libemile.h"
+
+#define MAJOR_HD	3
+#define MAJOR_SD	8
+static char *scsi_base = "/dev/sd";
+static char *ide_base = "/dev/hd";
+
+int emile_scsi_get_rdev(char* dev_name, char** driver, int *disk, int *partition)
+{
+	int ret;
+	struct stat st;
+	int major;
+
+	ret = stat(dev_name, &st);
+	if (ret == -1)
+		return -1;
+
+	if (!S_ISBLK(st.st_mode))
+		/*  not a block device */
+		return -1;
+
+	major = (st.st_rdev >> 8) & 0x0F;
+	switch(major)
+	{
+	case MAJOR_SD:
+		*driver = scsi_base;
+		*disk = (st.st_rdev & 0xFF) >> 4;
+		*partition = st.st_rdev &  0x0F;
+		break;
+	case MAJOR_HD:
+		*driver = ide_base;
+		*disk = (st.st_rdev & 0xFF) >> 6;
+		*partition = st.st_rdev &  0x3F;
+		break;
+	default:
+		return -1;
+	}
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_second_create_mapfile.c
===================================================================
--- branches/vendor/emile/libemile/emile_second_create_mapfile.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_second_create_mapfile.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,137 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <linux/fs.h>
+#include <string.h>
+
+#include "libemile.h"
+
+struct emile_container *emile_second_create_mapfile(short *unit_id, char *mapfile, char* kernel)
+{
+	struct emile_container *container;
+	int fd;
+	int ret;
+	short unit_id_map;
+	int block_size;
+
+	/* create container of the kernel */
+
+	fd = open(kernel, O_RDONLY);
+	if (fd == -1)
+	{
+		fprintf(stderr, "ERROR: cannot open kernel\n");
+		return NULL;
+	}
+
+	/* get filesystem block size */
+
+	ret = ioctl(fd, FIGETBSZ, &block_size);
+	if (ret != 0) {
+		close(fd);
+		perror("ioctl(FIGETBSZ)");
+		return NULL;
+	}
+
+	container = (struct emile_container *)malloc(block_size);
+	if (container == NULL)
+	{
+		fprintf(stderr, "ERROR: cannot allocate memory for container\n");
+		close(fd);
+		return NULL;
+	}
+	memset(container, 0, block_size);
+
+
+	ret = emile_scsi_create_container(fd, &unit_id_map, container, 
+			(block_size - sizeof(struct emile_container)) / sizeof(struct emile_block));
+	close(fd);
+
+	if (ret != 0)
+	{
+		fprintf(stderr, "ERROR: cannot fill container\n");
+		free(container);
+		return NULL;
+	}
+	
+	/* write container to map file */
+
+	fd = open(mapfile, O_CREAT | O_WRONLY);
+	if (fd == -1)
+	{
+		fprintf(stderr, "ERROR: cannot create map file (%s)\n", mapfile);
+		free(container);
+		return NULL;
+	}
+
+	ret = write(fd, container, block_size);
+
+	close(fd);
+
+	if (ret != block_size)
+	{
+		fprintf(stderr, "ERROR: cannot write map file (%s)\n", mapfile);
+		free(container);
+		return NULL;
+	}
+
+	/* now, we must know where is the map file */
+
+	memset(container, 0, block_size);
+	fd = open(mapfile, O_RDONLY);
+	if (fd == -1)
+	{
+		fprintf(stderr, "ERROR: cannot open map file to read (%s)\n", mapfile);
+		free(container);
+		return NULL;
+	}
+
+	ret = emile_scsi_create_container(fd, unit_id, container, 
+			(block_size - sizeof(struct emile_container)) / sizeof(struct emile_block));
+	close(fd);
+
+	if (ret != 0)
+	{
+		fprintf(stderr, "ERROR: cannot map map file...\n");
+		free(container);
+		return NULL;
+	}
+
+	if (unit_id_map != *unit_id)
+	{
+		fprintf(stderr, "ERROR: map file must be on the same disk as the file to map\n");
+		free(container);
+		return NULL;
+	}
+
+	if (container->size != block_size)
+	{
+		fprintf(stderr, "ERROR: map file size is bad (%d)\n", container->size);
+		free(container);
+		return NULL;
+	}
+
+	if (container->blocks[0].count == 0)
+	{
+		fprintf(stderr, "ERROR: map file is empty !\n");
+		free(container);
+		return NULL;
+	}
+
+	if (container->blocks[1].count != 0)
+	{
+		fprintf(stderr, "ERROR: map file is not contiguous\n");
+		free(container);
+		return NULL;
+	}
+
+	return container;
+}

Added: branches/vendor/emile/libemile/emile_second_get_configuration.c
===================================================================
--- branches/vendor/emile/libemile/emile_second_get_configuration.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_second_get_configuration.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,38 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "libemile.h"
+#include "emile.h"
+
+char* emile_second_get_configuration(int fd)
+{
+	char *conf;
+	emile_l2_header_t header;
+	int ret;
+	int size;
+
+	ret = read(fd, &header, sizeof(header));
+	if (ret != sizeof(header))
+		return NULL;
+
+	if (!EMILE_COMPAT(EMILE_06_SIGNATURE, read_long(&header.signature)))
+		return NULL;
+
+	size = read_short(&header.conf_size);
+	conf = (char*)malloc(size);
+	if (conf == NULL)
+		return NULL;
+
+	ret = read(fd, conf, size);
+	if (ret != size)
+		return NULL;
+	
+	return conf;
+}

Added: branches/vendor/emile/libemile/emile_second_get_next_property.c
===================================================================
--- branches/vendor/emile/libemile/emile_second_get_next_property.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_second_get_next_property.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,73 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include "libemile.h"
+
+static char *read_line(char *s)
+{
+	int read = 0;
+	while (*s && (*s != '\n'))
+	{
+		read++;
+		s++;
+	}
+	if (*s == 0)
+		return s;
+	return s + 1;
+}
+
+static char *read_word(char *line, char **next)
+{
+	char *word;
+
+	while ( (*line == ' ') || (*line == '\t') || (*line == '\n') )
+		line++;
+
+	word = line;
+
+	while ( *line && (*line != ' ') && (*line != '\t') && (*line != '\n') )
+		line++;
+
+	*next = line;
+
+	return word;
+}
+
+int emile_second_get_next_property(char *configuration, int index, char *name, char *property)
+{
+	char *next_word, *next_line;
+	char *current_name, *current_property;
+
+	next_line = configuration + index;
+	if (*next_line == 0)
+		return -1;
+	next_word = next_line;
+	next_line = read_line(next_line);
+
+	current_name = read_word(next_word, &next_word);
+	strncpy(name, current_name, next_word - current_name);
+	name[next_word - current_name] = 0;
+
+	current_property = read_word(next_word, &next_word);
+	if (next_line - current_property != 0)
+	{
+		strncpy(property, current_property, next_line - current_property);
+
+		/* remove '\n' if needed */
+
+		if (*(next_line - 1) == '\n')
+			property[next_line - current_property - 1] = 0;
+		else
+			property[next_line - current_property] = 0;
+	}
+	else
+		*property = 0;
+
+	return next_line - configuration;
+}

Added: branches/vendor/emile/libemile/emile_second_get_property.c
===================================================================
--- branches/vendor/emile/libemile/emile_second_get_property.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_second_get_property.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,24 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <string.h>
+
+#include "libemile.h"
+
+int emile_second_get_property(char *configuration, char *name, char *property)
+{
+	int index = 0;
+	char current_name[256];
+	while (1)
+	{
+		index = emile_second_get_next_property(configuration, index, current_name, property);
+		if (index == -1)
+			break;
+		if (strcmp(name, current_name) == 0)
+			return 0;
+	}
+	return -1;
+}

Added: branches/vendor/emile/libemile/emile_second_remove_property.c
===================================================================
--- branches/vendor/emile/libemile/emile_second_remove_property.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_second_remove_property.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,36 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include "libemile.h"
+
+void emile_second_remove_property(char *configuration, char *name)
+{
+	int index = 0;
+	int current = 0;
+	char current_name[256];
+	char current_property[256];
+
+	while (configuration[index])
+	{
+		index = emile_second_get_next_property(configuration, index, current_name, current_property);
+		if (strcmp(name, current_name) != 0)
+		{
+			memcpy(configuration + current, current_name, strlen(current_name));
+			current += strlen(current_name);
+			configuration[current++] = ' ';
+			memcpy(configuration + current, current_property, strlen(current_property));
+			current += strlen(current_property);
+			if (configuration[index])
+				configuration[current++] = '\n';
+		}
+	}
+	if (configuration[current-1] == '\n')
+		current--;
+	configuration[current++] = 0;
+}

Added: branches/vendor/emile/libemile/emile_second_set_configuration.c
===================================================================
--- branches/vendor/emile/libemile/emile_second_set_configuration.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_second_set_configuration.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,45 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "libemile.h"
+#include "emile.h"
+#include "bootblock.h"
+
+int emile_second_set_configuration(int fd, char *configuration)
+{
+	emile_l2_header_t header;
+	int ret;
+	int size;
+	int len;
+
+	if (configuration == NULL)
+		return EEMILE_CANNOT_READ_SECOND;
+
+	len = strlen (configuration) + 1;	/* + 1 for ending 0 */
+
+	ret = read(fd, &header, sizeof(header));
+	if (ret != sizeof(header))
+		return EEMILE_CANNOT_READ_SECOND;
+
+	if (!EMILE_COMPAT(EMILE_06_SIGNATURE, read_long(&header.signature)))
+		return EEMILE_INVALID_SECOND;
+
+	size = read_short(&header.conf_size);
+	if (len > size)
+		return EEMILE_INVALID_SECOND;
+
+	ret = write(fd, configuration, len);
+	if (ret != len)
+		return EEMILE_CANNOT_WRITE_SECOND;
+
+	return 0;
+}

Added: branches/vendor/emile/libemile/emile_second_set_property.c
===================================================================
--- branches/vendor/emile/libemile/emile_second_set_property.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/emile_second_set_property.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,38 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include "libemile.h"
+void emile_second_set_property(char *configuration, char *name, char *property)
+{
+	int index = 0;
+	int current = 0;
+	char current_name[256];
+	char current_property[256];
+
+	while (configuration[index])
+	{
+		index = emile_second_get_next_property(configuration, index, current_name, current_property);
+		if (strcmp(name, current_name) != 0)
+		{
+			memcpy(configuration + current, current_name, strlen(current_name));
+			current += strlen(current_name);
+			configuration[current++] = ' ';
+			memcpy(configuration + current, current_property, strlen(current_property));
+			current += strlen(current_property);
+			if (configuration[index])
+				configuration[current++] = '\n';
+			else
+			{
+				configuration[current++] = '\n';
+				break;
+			}
+		}
+	}
+	sprintf(configuration + current, "%s %s", name, property);
+}

Added: branches/vendor/emile/libemile/libemile.h
===================================================================
--- branches/vendor/emile/libemile/libemile.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/libemile.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,130 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef _LIBEMILE_H
+#define _LIBEMILE_H
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <libcontainer.h>
+
+static __attribute__((used)) char* libemile_header = "$CVSHeader$";
+
+#define SCSI_SUPPORT
+
+#include "../second/head.h"
+
+#define EMILE_FIRST_TUNE_DRIVE	0x0001
+#define EMILE_FIRST_TUNE_OFFSET	0x0002
+#define EMILE_FIRST_TUNE_SIZE	0x0004
+
+#define FLOPPY_SECTOR_SIZE	512
+#define FIRST_LEVEL_SIZE	(FLOPPY_SECTOR_SIZE * 2)
+#define BOOTBLOCK_SIZE		(FLOPPY_SECTOR_SIZE * 2)
+
+enum {
+	EEMILE_CANNOT_READ_FIRST	= -2,
+	EEMILE_UNKNOWN_FIRST		= -3,
+	EEMILE_CANNOT_WRITE_FIRST	= -4,
+	EEMILE_MALLOC_ERROR		= -5,
+	EEMILE_CANNOT_OPEN_FILE		= -6,
+	EEMILE_CANNOT_WRITE_SECOND	= -7,
+	EEMILE_CANNOT_WRITE_KERNEL	= -8,
+	EEMILE_CANNOT_WRITE_RAMDISK	= -9,
+	EEMILE_CANNOT_WRITE_PAD		= -10,
+	EEMILE_CANNOT_CREATE_IMAGE	= -11,
+	EEMILE_MISSING_FIRST		= -12,
+	EEMILE_MISSING_SECOND		= -13,
+	EEMILE_CANNOT_READ_SECOND	= -14,
+	EEMILE_INVALID_SECOND		= -15,
+	EEMILE_CANNOT_READ_KERNEL	= -16,
+};
+
+enum {
+	INVALID_BOOTBLOCK = -1,
+	APPLE_BOOTBLOCK = 0,
+	EMILE_BOOTBLOCK,
+	UNKNOWN_BOOTBLOCK,
+};
+
+#ifndef _PARTITION_H
+typedef void emile_map_t;
+#endif
+
+static inline unsigned long emile_file_get_size(char* file)
+{
+        struct stat result;
+
+        stat(file, &result);
+
+        return (result.st_size + FLOPPY_SECTOR_SIZE - 1)
+                / FLOPPY_SECTOR_SIZE * FLOPPY_SECTOR_SIZE;
+}
+
+extern int emile_first_set_param(int fd, unsigned short tune_mask, 
+				 int drive_num, int second_offset, 
+				 int second_size);
+extern int emile_first_get_param(int fd, int *drive_num, int *second_offset, 
+				 int *second_size);
+extern int emile_first_set_param_scsi(int fd, char *second_name);
+struct emile_container *emile_second_create_mapfile(short *unit_id, char *mapfile, char* kernel);
+extern int emile_floppy_create_image(char* first_level, char* second_level, 
+				     char* kernel_image, char* ramdisk, 
+				     char* image);
+extern int emile_scsi_create_container(int fd, short *unit_id,
+				       struct emile_container* container, int maxbloks);
+extern emile_map_t* emile_map_open(char* dev, int flags);
+extern void emile_map_close(emile_map_t *map);
+extern int emile_map_get_number(emile_map_t *map);
+extern int emile_map_read(emile_map_t *map, int part);
+extern int emile_map_write(emile_map_t *map, int part);
+extern int emile_map_partition_is_valid(emile_map_t *map);
+extern int emile_map_get_partition_geometry(emile_map_t *map, int *start, int *count);
+extern char* emile_map_get_partition_type(emile_map_t *map);
+extern char* emile_map_get_partition_name(emile_map_t *map);
+extern int emile_map_partition_is_bootable(emile_map_t *map);
+extern int emile_map_partition_is_startup(emile_map_t *map);
+extern int emile_map_set_partition_type(emile_map_t *map, char* type);
+extern int emile_map_set_partition_name(emile_map_t *map, char* name);
+extern int emile_map_partition_set_bootable(emile_map_t *map, int enable);
+extern int emile_map_partition_set_startup(emile_map_t *map, int enable);
+extern int emile_map_is_valid(emile_map_t *map);
+extern int emile_map_partition_get_flags(emile_map_t *map);
+extern int emile_map_partition_set_flags(emile_map_t *map, int flags);
+extern int emile_map_geometry(emile_map_t *map, int *block_size, 
+			      int *block_count);
+extern int emile_map_get_driver_number(emile_map_t *map);
+extern int emile_map_get_driver_info(emile_map_t *map, int number,
+                              int *block, int *size, int* type);
+extern int emile_map_bootblock_read(emile_map_t* map, char* bootblock);
+extern int emile_map_bootblock_write(emile_map_t* map, char* bootblock);
+extern int emile_map_bootblock_get_type(char* bootblock);
+extern int emile_map_bootblock_is_valid(char *bootblock);
+extern int emile_scsi_get_dev(int fd, char** driver, int *disk, int *partition);
+extern int emile_map_set_startup(char* dev_name, int partition);
+extern int emile_scsi_get_rdev(char* dev_name, char** driver, int *disk, int *partition);
+extern int emile_map_has_apple_driver(emile_map_t *map);
+extern int emile_map_seek_driver_partition(emile_map_t *map, int start);
+extern int emile_get_uncompressed_size(char *file);
+#ifdef USE_16BIT_CHECKSUM
+extern int emile_checksum(unsigned char *addr, unsigned short length);
+#else
+extern unsigned short emile_checksum(unsigned char *addr, unsigned int length);
+#endif
+extern int emile_map_get_bootinfo(emile_map_t* map, int* bootstart, int *bootsize, int *bootaddr, int *bootentry, int* checksum, char* processor);
+extern char* emile_map_dev(emile_map_t *map);
+extern int emile_map_set_bootinfo(emile_map_t *map, int bootstart, int bootsize, int bootaddr, int bootentry, int checksum, char* processor);
+extern int emile_map_set_driver_info(emile_map_t *map, int number, int block, int size, int type);
+extern int emile_map_set_driver_number(emile_map_t *map, int number);
+extern int emile_block0_write(emile_map_t *map);
+extern char* emile_second_get_configuration(int fd);
+extern int emile_second_set_configuration(int fd, char *configuration);
+extern int emile_second_get_next_property(char *configuration, int index, char *name, char *property);
+extern int emile_second_get_property(char *configuration, char *name, char *property);
+extern void emile_second_set_property(char *configuration, char *name, char *property);
+extern void emile_second_remove_property(char *configuration, char *name);
+#endif

Added: branches/vendor/emile/libemile/partition.h
===================================================================
--- branches/vendor/emile/libemile/partition.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libemile/partition.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,101 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+
+#ifndef _PARTITION_H
+#define _PARTITION_H
+static __attribute__((used)) char* partition_header = "$CVSHeader$";
+
+enum {
+    kPartitionAUXIsValid= 0x00000001,
+    kPartitionAUXIsAllocated  = 0x00000002,
+    kPartitionAUXIsInUse= 0x00000004,
+    kPartitionAUXIsBootValid  = 0x00000008,
+    kPartitionAUXIsReadable   = 0x00000010,
+    kPartitionAUXIsWriteable  = 0x00000020,
+    kPartitionAUXIsBootCodePositionIndependent  = 0x00000040,
+ 
+    kPartitionIsMountedAtStartup = 0x40000000,
+    kPartitionIsStartup = 0x80000000,
+ 
+    kPartitionIsChainCompatible  = 0x00000100,
+    kPartitionIsRealDeviceDriver = 0x00000200,
+    kPartitionCanChainToNext  = 0x00000400,
+};
+
+struct DriverInfo {
+	int32_t Block;
+	int16_t Size;
+	int16_t Type;
+} __attribute__((packed));
+
+#define DD_MAX_DRIVER	61
+
+struct DriverDescriptor {
+	int16_t	Sig;
+	int16_t BlkSize;
+	int32_t BlkCount;
+	int16_t DevType;
+	int16_t DevId;
+	int32_t Data;
+	int16_t DrvrCount;
+	struct DriverInfo DrvInfo[DD_MAX_DRIVER];
+	int8_t Pad[6];
+} __attribute__((packed));
+#define ASSERT_DD(a)   if ( sizeof(struct DriverDescriptor) != 512 ) { a }
+
+struct Partition {
+	int16_t	Sig;
+	int16_t	SigPad;
+	int32_t	MapBlkCnt;
+	int32_t	PyPartStart;
+	int32_t	PartBlkCnt;
+	char	PartName[32];
+	char	PartType[32];
+	int32_t	LgDataStart;
+	int32_t	DataCnt;
+	int32_t	PartStatus;
+	int32_t	LgBootStart;
+	int32_t	BootSize;
+	int32_t	BootAddr;
+	int32_t	BootAddr2;
+	int32_t	BootEntry;
+	int32_t	BootEntry2;
+	int32_t	BootCksum;
+	char	Processor[16];
+	int16_t	Pad[188];
+} __attribute__((packed));
+
+#define ASSERT_P(a)   if ( sizeof(struct Partition) != 512 ) { a }
+
+#define DD_SIGNATURE	0x4552
+#define MAP_SIGNATURE	0x504D
+
+#define APPLE_PARTITION_MAP	"Apple_partition_map"
+#define APPLE_DRIVER		"Apple_Driver"
+#define APPLE_DRIVER43		"Apple_Driver43"
+#define APPLE_MFS		"Apple_MFS"
+#define APPLE_HFS		"Apple_HFS"
+#define APPLE_UNIX_SVR2		"Apple_Unix_SVR2"
+#define APPLE_PRODOS		"Apple_PRODOS"
+#define APPLE_FREE		"Apple_Free"
+#define APPLE_SCRATCH		"Apple_Scratch"
+#define APPLE_DRIVER_ATA	"Apple_Driver_ATA"
+#define APPLE_DRIVER_ATAPI	"Apple_Driver_ATAPI"
+#define APPLE_DRIVER43_CD	"Apple_Driver43_CD"
+#define APPLE_FWDRIVER		"Apple_FWDriver"
+#define APPLE_VOID		"Apple_Void"
+#define APPLE_PATCHES		"Apple_Patches" 
+
+typedef struct {
+	int fd;
+	char name[16];
+	int current;
+	struct DriverDescriptor drivers;
+	struct Partition partition;
+} emile_map_t;
+#endif

Added: branches/vendor/emile/libfloppy/Makefile
===================================================================
--- branches/vendor/emile/libfloppy/Makefile	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libfloppy/Makefile	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,19 @@
+#
+#  (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+#
+
+TOP=$(shell pwd)
+
+CFLAGS	= -nostdlib -nodefaultlibs -Wall -Werror -Wno-multichar -fpic -O2 -m68000 -Wa,-m68000 -Os
+CPPFLAGS = -I$(TOP)/../libmacos -DARCH_M68K
+
+LIBRARY = libfloppy.a
+
+SOURCES = floppy_read_sector.c floppy_close.c floppy_open.c \
+	  floppy_get_blocksize.c
+
+HEADERS = libfloppy.h
+
+all: $(LIBRARY)
+
+include $(TOP)/../Rules.mk

Added: branches/vendor/emile/libfloppy/floppy_close.c
===================================================================
--- branches/vendor/emile/libfloppy/floppy_close.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libfloppy/floppy_close.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,17 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+
+#include "libfloppy.h"
+
+int floppy_close(floppy_device_t* device)
+{
+	if (device == NULL)
+		return -1;
+	free(device);
+	return 0;
+}

Added: branches/vendor/emile/libfloppy/floppy_get_blocksize.c
===================================================================
--- branches/vendor/emile/libfloppy/floppy_get_blocksize.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libfloppy/floppy_get_blocksize.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,6 @@
+#include "libfloppy.h"
+
+int floppy_get_blocksize(floppy_device_t *device)
+{
+	return SECTOR_SIZE;
+}

Added: branches/vendor/emile/libfloppy/floppy_open.c
===================================================================
--- branches/vendor/emile/libfloppy/floppy_open.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libfloppy/floppy_open.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,23 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+
+#include "libfloppy.h"
+
+floppy_device_t *floppy_open(int unit)
+{
+	floppy_device_t *dev;
+
+	dev = (floppy_device_t *)malloc(sizeof(floppy_device_t));
+
+	if (dev == NULL)
+		return NULL;
+
+	dev->unit = unit;
+
+	return dev;
+}

Added: branches/vendor/emile/libfloppy/floppy_read_sector.c
===================================================================
--- branches/vendor/emile/libfloppy/floppy_read_sector.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libfloppy/floppy_read_sector.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,43 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <string.h>
+
+#include <macos/devices.h>
+
+#include "libfloppy.h"
+
+/* offset is a block number
+ * size is the number of bytes to read
+ */
+
+int floppy_read_sector(floppy_device_t *device,
+		       off_t offset, void* buffer, size_t size)
+{
+	OSErr err;
+	ParamBlockRec_t param_block;
+
+	/* check size to read is multiple of sector size */
+
+	if (size & (SECTOR_SIZE - 1))
+		return -1;
+
+	memset(&param_block, 0, sizeof(param_block));
+
+	param_block.ioBuffer = (unsigned long)buffer;
+	param_block.ioVRefNum = device->unit + 1;
+	param_block.ioRefNum = -5;
+	param_block.ioReqCount = size;
+	param_block.ioPosMode = fsFromStart;
+	param_block.ioPosOffset = offset << SECTOR_SIZE_BITS;
+
+	err = PBReadSync(&param_block);
+	if (err != noErr)
+		return -1;
+
+	return 0;
+}

Added: branches/vendor/emile/libfloppy/libfloppy.h
===================================================================
--- branches/vendor/emile/libfloppy/libfloppy.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libfloppy/libfloppy.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,25 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+#ifndef __LIBFLOPY_H__
+#define __LIBFLOPY_H__
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#define SECTOR_SIZE_BITS	9
+#define SECTOR_SIZE		(1 << (SECTOR_SIZE_BITS))
+#define SECTOR_PER_TRACK	18
+#define SIDE_NB			2
+
+typedef struct {
+	int unit;
+} floppy_device_t;
+
+extern floppy_device_t *floppy_open(int unit);
+extern int floppy_close(floppy_device_t* device);
+extern int floppy_read_sector(floppy_device_t *device,off_t offset, void* buffer, size_t size);
+extern int floppy_get_blocksize(floppy_device_t *device);
+#endif /* __LIBFLOPY_H__ */

Added: branches/vendor/emile/libgzip/Makefile
===================================================================
--- branches/vendor/emile/libgzip/Makefile	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libgzip/Makefile	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,33 @@
+#
+#  (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+#
+
+TOP = $(shell pwd)
+
+VPATH=$(TOP)
+
+TARGET = native
+
+AS=$(CROSS_COMPILE)as
+CC=$(CROSS_COMPILE)gcc
+LD=$(CROSS_COMPILE)ld
+AR=$(CROSS_COMPILE)ar
+
+CFLAGS	= -nostdlib -nodefaultlibs -Wall -Werror -Wno-multichar
+ifeq ($(TARGET), m68k-linux)
+CFLAGS += -fpic -O2 -m68000 -Wa,-m68000 -Os
+endif
+
+CPPFLAGS = -DFATFREE -DNOBYFOUR -DBUILDFIXED -DNO_GZCOMPRESS -DDYNAMIC_CRC_TABLE
+
+LIBRARY = libgzip.a
+
+SOURCES = inflate.c adler32.c inftrees.c zutil.c inffast.c crc32.c
+
+HEADERS = deflate.h inffast.h inflate.h inftrees.h zconf.h zlib.h zutil.h
+
+all:
+	test -d $(TARGET) || mkdir $(TARGET)
+	cd $(TARGET) && make -f $(TOP)/Makefile $(LIBRARY) TOP=$(TOP)
+
+include $(TOP)/../Rules.mk

Added: branches/vendor/emile/libgzip/adler32.c
===================================================================
--- branches/vendor/emile/libgzip/adler32.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libgzip/adler32.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,149 @@
+/* adler32.c -- compute the Adler-32 checksum of a data stream
+ * Copyright (C) 1995-2004 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: adler32.c,v 1.1 2005/11/14 23:15:54 lvivier Exp $ */
+
+#define ZLIB_INTERNAL
+#include "zlib.h"
+
+#define BASE 65521UL    /* largest prime smaller than 65536 */
+#define NMAX 5552
+/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
+
+#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
+#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
+#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
+#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
+#define DO16(buf)   DO8(buf,0); DO8(buf,8);
+
+/* use NO_DIVIDE if your processor does not do division in hardware */
+#ifdef NO_DIVIDE
+#  define MOD(a) \
+    do { \
+        if (a >= (BASE << 16)) a -= (BASE << 16); \
+        if (a >= (BASE << 15)) a -= (BASE << 15); \
+        if (a >= (BASE << 14)) a -= (BASE << 14); \
+        if (a >= (BASE << 13)) a -= (BASE << 13); \
+        if (a >= (BASE << 12)) a -= (BASE << 12); \
+        if (a >= (BASE << 11)) a -= (BASE << 11); \
+        if (a >= (BASE << 10)) a -= (BASE << 10); \
+        if (a >= (BASE << 9)) a -= (BASE << 9); \
+        if (a >= (BASE << 8)) a -= (BASE << 8); \
+        if (a >= (BASE << 7)) a -= (BASE << 7); \
+        if (a >= (BASE << 6)) a -= (BASE << 6); \
+        if (a >= (BASE << 5)) a -= (BASE << 5); \
+        if (a >= (BASE << 4)) a -= (BASE << 4); \
+        if (a >= (BASE << 3)) a -= (BASE << 3); \
+        if (a >= (BASE << 2)) a -= (BASE << 2); \
+        if (a >= (BASE << 1)) a -= (BASE << 1); \
+        if (a >= BASE) a -= BASE; \
+    } while (0)
+#  define MOD4(a) \
+    do { \
+        if (a >= (BASE << 4)) a -= (BASE << 4); \
+        if (a >= (BASE << 3)) a -= (BASE << 3); \
+        if (a >= (BASE << 2)) a -= (BASE << 2); \
+        if (a >= (BASE << 1)) a -= (BASE << 1); \
+        if (a >= BASE) a -= BASE; \
+    } while (0)
+#else
+#  define MOD(a) a %= BASE
+#  define MOD4(a) a %= BASE
+#endif
+
+/* ========================================================================= */
+uLong ZEXPORT adler32(adler, buf, len)
+    uLong adler;
+    const Bytef *buf;
+    uInt len;
+{
+    unsigned long sum2;
+    unsigned n;
+
+    /* split Adler-32 into component sums */
+    sum2 = (adler >> 16) & 0xffff;
+    adler &= 0xffff;
+
+    /* in case user likes doing a byte at a time, keep it fast */
+    if (len == 1) {
+        adler += buf[0];
+        if (adler >= BASE)
+            adler -= BASE;
+        sum2 += adler;
+        if (sum2 >= BASE)
+            sum2 -= BASE;
+        return adler | (sum2 << 16);
+    }
+
+    /* initial Adler-32 value (deferred check for len == 1 speed) */
+    if (buf == Z_NULL)
+        return 1L;
+
+    /* in case short lengths are provided, keep it somewhat fast */
+    if (len < 16) {
+        while (len--) {
+            adler += *buf++;
+            sum2 += adler;
+        }
+        if (adler >= BASE)
+            adler -= BASE;
+        MOD4(sum2);             /* only added so many BASE's */
+        return adler | (sum2 << 16);
+    }
+
+    /* do length NMAX blocks -- requires just one modulo operation */
+    while (len >= NMAX) {
+        len -= NMAX;
+        n = NMAX / 16;          /* NMAX is divisible by 16 */
+        do {
+            DO16(buf);          /* 16 sums unrolled */
+            buf += 16;
+        } while (--n);
+        MOD(adler);
+        MOD(sum2);
+    }
+
+    /* do remaining bytes (less than NMAX, still just one modulo) */
+    if (len) {                  /* avoid modulos if none remaining */
+        while (len >= 16) {
+            len -= 16;
+            DO16(buf);
+            buf += 16;
+        }
+        while (len--) {
+            adler += *buf++;
+            sum2 += adler;
+        }
+        MOD(adler);
+        MOD(sum2);
+    }
+
+    /* return recombined sums */
+    return adler | (sum2 << 16);
+}
+
+/* ========================================================================= */
+uLong ZEXPORT adler32_combine(adler1, adler2, len2)
+    uLong adler1;
+    uLong adler2;
+    z_off_t len2;
+{
+    unsigned long sum1;
+    unsigned long sum2;
+    unsigned rem;
+
+    /* the derivation of this formula is left as an exercise for the reader */
+    rem = (unsigned)(len2 % BASE);
+    sum1 = adler1 & 0xffff;
+    sum2 = rem * sum1;
+    MOD(sum2);
+    sum1 += (adler2 & 0xffff) + BASE - 1;
+    sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
+    if (sum1 > BASE) sum1 -= BASE;
+    if (sum1 > BASE) sum1 -= BASE;
+    if (sum2 > (BASE << 1)) sum2 -= (BASE << 1);
+    if (sum2 > BASE) sum2 -= BASE;
+    return sum1 | (sum2 << 16);
+}

Added: branches/vendor/emile/libgzip/crc32.c
===================================================================
--- branches/vendor/emile/libgzip/crc32.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libgzip/crc32.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,423 @@
+/* crc32.c -- compute the CRC-32 of a data stream
+ * Copyright (C) 1995-2005 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ *
+ * Thanks to Rodney Brown <rbrown64 at csc.com.au> for his contribution of faster
+ * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
+ * tables for updating the shift register in one step with three exclusive-ors
+ * instead of four steps with four exclusive-ors.  This results in about a
+ * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
+ */
+
+/* @(#) $Id: crc32.c,v 1.1 2005/11/14 23:15:54 lvivier Exp $ */
+
+/*
+  Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
+  protection on the static variables used to control the first-use generation
+  of the crc tables.  Therefore, if you #define DYNAMIC_CRC_TABLE, you should
+  first call get_crc_table() to initialize the tables before allowing more than
+  one thread to use crc32().
+ */
+
+#ifdef MAKECRCH
+#  include <stdio.h>
+#  ifndef DYNAMIC_CRC_TABLE
+#    define DYNAMIC_CRC_TABLE
+#  endif /* !DYNAMIC_CRC_TABLE */
+#endif /* MAKECRCH */
+
+#include "zutil.h"      /* for STDC and FAR definitions */
+
+#define local static
+
+/* Find a four-byte integer type for crc32_little() and crc32_big(). */
+#ifndef NOBYFOUR
+#  ifdef STDC           /* need ANSI C limits.h to determine sizes */
+#    include <limits.h>
+#    define BYFOUR
+#    if (UINT_MAX == 0xffffffffUL)
+       typedef unsigned int u4;
+#    else
+#      if (ULONG_MAX == 0xffffffffUL)
+         typedef unsigned long u4;
+#      else
+#        if (USHRT_MAX == 0xffffffffUL)
+           typedef unsigned short u4;
+#        else
+#          undef BYFOUR     /* can't find a four-byte integer type! */
+#        endif
+#      endif
+#    endif
+#  endif /* STDC */
+#endif /* !NOBYFOUR */
+
+/* Definitions for doing the crc four data bytes at a time. */
+#ifdef BYFOUR
+#  define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \
+                (((w)&0xff00)<<8)+(((w)&0xff)<<24))
+   local unsigned long crc32_little OF((unsigned long,
+                        const unsigned char FAR *, unsigned));
+   local unsigned long crc32_big OF((unsigned long,
+                        const unsigned char FAR *, unsigned));
+#  define TBLS 8
+#else
+#  define TBLS 1
+#endif /* BYFOUR */
+
+/* Local functions for crc concatenation */
+local unsigned long gf2_matrix_times OF((unsigned long *mat,
+                                         unsigned long vec));
+local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
+
+#ifdef DYNAMIC_CRC_TABLE
+
+local volatile int crc_table_empty = 1;
+local unsigned long FAR crc_table[TBLS][256];
+local void make_crc_table OF((void));
+#ifdef MAKECRCH
+   local void write_table OF((FILE *, const unsigned long FAR *));
+#endif /* MAKECRCH */
+/*
+  Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
+  x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
+
+  Polynomials over GF(2) are represented in binary, one bit per coefficient,
+  with the lowest powers in the most significant bit.  Then adding polynomials
+  is just exclusive-or, and multiplying a polynomial by x is a right shift by
+  one.  If we call the above polynomial p, and represent a byte as the
+  polynomial q, also with the lowest power in the most significant bit (so the
+  byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
+  where a mod b means the remainder after dividing a by b.
+
+  This calculation is done using the shift-register method of multiplying and
+  taking the remainder.  The register is initialized to zero, and for each
+  incoming bit, x^32 is added mod p to the register if the bit is a one (where
+  x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
+  x (which is shifting right by one and adding x^32 mod p if the bit shifted
+  out is a one).  We start with the highest power (least significant bit) of
+  q and repeat for all eight bits of q.
+
+  The first table is simply the CRC of all possible eight bit values.  This is
+  all the information needed to generate CRCs on data a byte at a time for all
+  combinations of CRC register values and incoming bytes.  The remaining tables
+  allow for word-at-a-time CRC calculation for both big-endian and little-
+  endian machines, where a word is four bytes.
+*/
+local void make_crc_table()
+{
+    unsigned long c;
+    int n, k;
+    unsigned long poly;                 /* polynomial exclusive-or pattern */
+    /* terms of polynomial defining this crc (except x^32): */
+    static volatile int first = 1;      /* flag to limit concurrent making */
+    static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
+
+    /* See if another task is already doing this (not thread-safe, but better
+       than nothing -- significantly reduces duration of vulnerability in
+       case the advice about DYNAMIC_CRC_TABLE is ignored) */
+    if (first) {
+        first = 0;
+
+        /* make exclusive-or pattern from polynomial (0xedb88320UL) */
+        poly = 0UL;
+        for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
+            poly |= 1UL << (31 - p[n]);
+
+        /* generate a crc for every 8-bit value */
+        for (n = 0; n < 256; n++) {
+            c = (unsigned long)n;
+            for (k = 0; k < 8; k++)
+                c = c & 1 ? poly ^ (c >> 1) : c >> 1;
+            crc_table[0][n] = c;
+        }
+
+#ifdef BYFOUR
+        /* generate crc for each value followed by one, two, and three zeros,
+           and then the byte reversal of those as well as the first table */
+        for (n = 0; n < 256; n++) {
+            c = crc_table[0][n];
+            crc_table[4][n] = REV(c);
+            for (k = 1; k < 4; k++) {
+                c = crc_table[0][c & 0xff] ^ (c >> 8);
+                crc_table[k][n] = c;
+                crc_table[k + 4][n] = REV(c);
+            }
+        }
+#endif /* BYFOUR */
+
+        crc_table_empty = 0;
+    }
+    else {      /* not first */
+        /* wait for the other guy to finish (not efficient, but rare) */
+        while (crc_table_empty)
+            ;
+    }
+
+#ifdef MAKECRCH
+    /* write out CRC tables to crc32.h */
+    {
+        FILE *out;
+
+        out = fopen("crc32.h", "w");
+        if (out == NULL) return;
+        fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
+        fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
+        fprintf(out, "local const unsigned long FAR ");
+        fprintf(out, "crc_table[TBLS][256] =\n{\n  {\n");
+        write_table(out, crc_table[0]);
+#  ifdef BYFOUR
+        fprintf(out, "#ifdef BYFOUR\n");
+        for (k = 1; k < 8; k++) {
+            fprintf(out, "  },\n  {\n");
+            write_table(out, crc_table[k]);
+        }
+        fprintf(out, "#endif\n");
+#  endif /* BYFOUR */
+        fprintf(out, "  }\n};\n");
+        fclose(out);
+    }
+#endif /* MAKECRCH */
+}
+
+#ifdef MAKECRCH
+local void write_table(out, table)
+    FILE *out;
+    const unsigned long FAR *table;
+{
+    int n;
+
+    for (n = 0; n < 256; n++)
+        fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : "    ", table[n],
+                n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
+}
+#endif /* MAKECRCH */
+
+#else /* !DYNAMIC_CRC_TABLE */
+/* ========================================================================
+ * Tables of CRC-32s of all single-byte values, made by make_crc_table().
+ */
+#include "crc32.h"
+#endif /* DYNAMIC_CRC_TABLE */
+
+/* =========================================================================
+ * This function can be used by asm versions of crc32()
+ */
+const unsigned long FAR * ZEXPORT get_crc_table()
+{
+#ifdef DYNAMIC_CRC_TABLE
+    if (crc_table_empty)
+        make_crc_table();
+#endif /* DYNAMIC_CRC_TABLE */
+    return (const unsigned long FAR *)crc_table;
+}
+
+/* ========================================================================= */
+#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
+#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
+
+/* ========================================================================= */
+unsigned long ZEXPORT crc32(crc, buf, len)
+    unsigned long crc;
+    const unsigned char FAR *buf;
+    unsigned len;
+{
+    if (buf == Z_NULL) return 0UL;
+
+#ifdef DYNAMIC_CRC_TABLE
+    if (crc_table_empty)
+        make_crc_table();
+#endif /* DYNAMIC_CRC_TABLE */
+
+#ifdef BYFOUR
+    if (sizeof(void *) == sizeof(ptrdiff_t)) {
+        u4 endian;
+
+        endian = 1;
+        if (*((unsigned char *)(&endian)))
+            return crc32_little(crc, buf, len);
+        else
+            return crc32_big(crc, buf, len);
+    }
+#endif /* BYFOUR */
+    crc = crc ^ 0xffffffffUL;
+    while (len >= 8) {
+        DO8;
+        len -= 8;
+    }
+    if (len) do {
+        DO1;
+    } while (--len);
+    return crc ^ 0xffffffffUL;
+}
+
+#ifdef BYFOUR
+
+/* ========================================================================= */
+#define DOLIT4 c ^= *buf4++; \
+        c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
+            crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
+#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
+
+/* ========================================================================= */
+local unsigned long crc32_little(crc, buf, len)
+    unsigned long crc;
+    const unsigned char FAR *buf;
+    unsigned len;
+{
+    register u4 c;
+    register const u4 FAR *buf4;
+
+    c = (u4)crc;
+    c = ~c;
+    while (len && ((ptrdiff_t)buf & 3)) {
+        c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
+        len--;
+    }
+
+    buf4 = (const u4 FAR *)(const void FAR *)buf;
+    while (len >= 32) {
+        DOLIT32;
+        len -= 32;
+    }
+    while (len >= 4) {
+        DOLIT4;
+        len -= 4;
+    }
+    buf = (const unsigned char FAR *)buf4;
+
+    if (len) do {
+        c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
+    } while (--len);
+    c = ~c;
+    return (unsigned long)c;
+}
+
+/* ========================================================================= */
+#define DOBIG4 c ^= *++buf4; \
+        c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
+            crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
+#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
+
+/* ========================================================================= */
+local unsigned long crc32_big(crc, buf, len)
+    unsigned long crc;
+    const unsigned char FAR *buf;
+    unsigned len;
+{
+    register u4 c;
+    register const u4 FAR *buf4;
+
+    c = REV((u4)crc);
+    c = ~c;
+    while (len && ((ptrdiff_t)buf & 3)) {
+        c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
+        len--;
+    }
+
+    buf4 = (const u4 FAR *)(const void FAR *)buf;
+    buf4--;
+    while (len >= 32) {
+        DOBIG32;
+        len -= 32;
+    }
+    while (len >= 4) {
+        DOBIG4;
+        len -= 4;
+    }
+    buf4++;
+    buf = (const unsigned char FAR *)buf4;
+
+    if (len) do {
+        c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
+    } while (--len);
+    c = ~c;
+    return (unsigned long)(REV(c));
+}
+
+#endif /* BYFOUR */
+
+#define GF2_DIM 32      /* dimension of GF(2) vectors (length of CRC) */
+
+/* ========================================================================= */
+local unsigned long gf2_matrix_times(mat, vec)
+    unsigned long *mat;
+    unsigned long vec;
+{
+    unsigned long sum;
+
+    sum = 0;
+    while (vec) {
+        if (vec & 1)
+            sum ^= *mat;
+        vec >>= 1;
+        mat++;
+    }
+    return sum;
+}
+
+/* ========================================================================= */
+local void gf2_matrix_square(square, mat)
+    unsigned long *square;
+    unsigned long *mat;
+{
+    int n;
+
+    for (n = 0; n < GF2_DIM; n++)
+        square[n] = gf2_matrix_times(mat, mat[n]);
+}
+
+/* ========================================================================= */
+uLong ZEXPORT crc32_combine(crc1, crc2, len2)
+    uLong crc1;
+    uLong crc2;
+    z_off_t len2;
+{
+    int n;
+    unsigned long row;
+    unsigned long even[GF2_DIM];    /* even-power-of-two zeros operator */
+    unsigned long odd[GF2_DIM];     /* odd-power-of-two zeros operator */
+
+    /* degenerate case */
+    if (len2 == 0)
+        return crc1;
+
+    /* put operator for one zero bit in odd */
+    odd[0] = 0xedb88320L;           /* CRC-32 polynomial */
+    row = 1;
+    for (n = 1; n < GF2_DIM; n++) {
+        odd[n] = row;
+        row <<= 1;
+    }
+
+    /* put operator for two zero bits in even */
+    gf2_matrix_square(even, odd);
+
+    /* put operator for four zero bits in odd */
+    gf2_matrix_square(odd, even);
+
+    /* apply len2 zeros to crc1 (first square will put the operator for one
+       zero byte, eight zero bits, in even) */
+    do {
+        /* apply zeros operator for this bit of len2 */
+        gf2_matrix_square(even, odd);
+        if (len2 & 1)
+            crc1 = gf2_matrix_times(even, crc1);
+        len2 >>= 1;
+
+        /* if no more bits set, then done */
+        if (len2 == 0)
+            break;
+
+        /* another iteration of the loop with odd and even swapped */
+        gf2_matrix_square(odd, even);
+        if (len2 & 1)
+            crc1 = gf2_matrix_times(odd, crc1);
+        len2 >>= 1;
+
+        /* if no more bits set, then done */
+    } while (len2 != 0);
+
+    /* return combined crc */
+    crc1 ^= crc2;
+    return crc1;
+}

Added: branches/vendor/emile/libgzip/deflate.h
===================================================================
--- branches/vendor/emile/libgzip/deflate.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libgzip/deflate.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,331 @@
+/* deflate.h -- internal compression state
+ * Copyright (C) 1995-2004 Jean-loup Gailly
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+/* @(#) $Id: deflate.h,v 1.1 2005/11/14 23:15:54 lvivier Exp $ */
+
+#ifndef DEFLATE_H
+#define DEFLATE_H
+
+#include "zutil.h"
+
+/* define NO_GZIP when compiling if you want to disable gzip header and
+   trailer creation by deflate().  NO_GZIP would be used to avoid linking in
+   the crc code when it is not needed.  For shared libraries, gzip encoding
+   should be left enabled. */
+#ifndef NO_GZIP
+#  define GZIP
+#endif
+
+/* ===========================================================================
+ * Internal compression state.
+ */
+
+#define LENGTH_CODES 29
+/* number of length codes, not counting the special END_BLOCK code */
+
+#define LITERALS  256
+/* number of literal bytes 0..255 */
+
+#define L_CODES (LITERALS+1+LENGTH_CODES)
+/* number of Literal or Length codes, including the END_BLOCK code */
+
+#define D_CODES   30
+/* number of distance codes */
+
+#define BL_CODES  19
+/* number of codes used to transfer the bit lengths */
+
+#define HEAP_SIZE (2*L_CODES+1)
+/* maximum heap size */
+
+#define MAX_BITS 15
+/* All codes must not exceed MAX_BITS bits */
+
+#define INIT_STATE    42
+#define EXTRA_STATE   69
+#define NAME_STATE    73
+#define COMMENT_STATE 91
+#define HCRC_STATE   103
+#define BUSY_STATE   113
+#define FINISH_STATE 666
+/* Stream status */
+
+
+/* Data structure describing a single value and its code string. */
+typedef struct ct_data_s {
+    union {
+        ush  freq;       /* frequency count */
+        ush  code;       /* bit string */
+    } fc;
+    union {
+        ush  dad;        /* father node in Huffman tree */
+        ush  len;        /* length of bit string */
+    } dl;
+} FAR ct_data;
+
+#define Freq fc.freq
+#define Code fc.code
+#define Dad  dl.dad
+#define Len  dl.len
+
+typedef struct static_tree_desc_s  static_tree_desc;
+
+typedef struct tree_desc_s {
+    ct_data *dyn_tree;           /* the dynamic tree */
+    int     max_code;            /* largest code with non zero frequency */
+    static_tree_desc *stat_desc; /* the corresponding static tree */
+} FAR tree_desc;
+
+typedef ush Pos;
+typedef Pos FAR Posf;
+typedef unsigned IPos;
+
+/* A Pos is an index in the character window. We use short instead of int to
+ * save space in the various tables. IPos is used only for parameter passing.
+ */
+
+typedef struct internal_state {
+    z_streamp strm;      /* pointer back to this zlib stream */
+    int   status;        /* as the name implies */
+    Bytef *pending_buf;  /* output still pending */
+    ulg   pending_buf_size; /* size of pending_buf */
+    Bytef *pending_out;  /* next pending byte to output to the stream */
+    uInt   pending;      /* nb of bytes in the pending buffer */
+    int   wrap;          /* bit 0 true for zlib, bit 1 true for gzip */
+    gz_headerp  gzhead;  /* gzip header information to write */
+    uInt   gzindex;      /* where in extra, name, or comment */
+    Byte  method;        /* STORED (for zip only) or DEFLATED */
+    int   last_flush;    /* value of flush param for previous deflate call */
+
+                /* used by deflate.c: */
+
+    uInt  w_size;        /* LZ77 window size (32K by default) */
+    uInt  w_bits;        /* log2(w_size)  (8..16) */
+    uInt  w_mask;        /* w_size - 1 */
+
+    Bytef *window;
+    /* Sliding window. Input bytes are read into the second half of the window,
+     * and move to the first half later to keep a dictionary of at least wSize
+     * bytes. With this organization, matches are limited to a distance of
+     * wSize-MAX_MATCH bytes, but this ensures that IO is always
+     * performed with a length multiple of the block size. Also, it limits
+     * the window size to 64K, which is quite useful on MSDOS.
+     * To do: use the user input buffer as sliding window.
+     */
+
+    ulg window_size;
+    /* Actual size of window: 2*wSize, except when the user input buffer
+     * is directly used as sliding window.
+     */
+
+    Posf *prev;
+    /* Link to older string with same hash index. To limit the size of this
+     * array to 64K, this link is maintained only for the last 32K strings.
+     * An index in this array is thus a window index modulo 32K.
+     */
+
+    Posf *head; /* Heads of the hash chains or NIL. */
+
+    uInt  ins_h;          /* hash index of string to be inserted */
+    uInt  hash_size;      /* number of elements in hash table */
+    uInt  hash_bits;      /* log2(hash_size) */
+    uInt  hash_mask;      /* hash_size-1 */
+
+    uInt  hash_shift;
+    /* Number of bits by which ins_h must be shifted at each input
+     * step. It must be such that after MIN_MATCH steps, the oldest
+     * byte no longer takes part in the hash key, that is:
+     *   hash_shift * MIN_MATCH >= hash_bits
+     */
+
+    long block_start;
+    /* Window position at the beginning of the current output block. Gets
+     * negative when the window is moved backwards.
+     */
+
+    uInt match_length;           /* length of best match */
+    IPos prev_match;             /* previous match */
+    int match_available;         /* set if previous match exists */
+    uInt strstart;               /* start of string to insert */
+    uInt match_start;            /* start of matching string */
+    uInt lookahead;              /* number of valid bytes ahead in window */
+
+    uInt prev_length;
+    /* Length of the best match at previous step. Matches not greater than this
+     * are discarded. This is used in the lazy match evaluation.
+     */
+
+    uInt max_chain_length;
+    /* To speed up deflation, hash chains are never searched beyond this
+     * length.  A higher limit improves compression ratio but degrades the
+     * speed.
+     */
+
+    uInt max_lazy_match;
+    /* Attempt to find a better match only when the current match is strictly
+     * smaller than this value. This mechanism is used only for compression
+     * levels >= 4.
+     */
+#   define max_insert_length  max_lazy_match
+    /* Insert new strings in the hash table only if the match length is not
+     * greater than this length. This saves time but degrades compression.
+     * max_insert_length is used only for compression levels <= 3.
+     */
+
+    int level;    /* compression level (1..9) */
+    int strategy; /* favor or force Huffman coding*/
+
+    uInt good_match;
+    /* Use a faster search when the previous match is longer than this */
+
+    int nice_match; /* Stop searching when current match exceeds this */
+
+                /* used by trees.c: */
+    /* Didn't use ct_data typedef below to supress compiler warning */
+    struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */
+    struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
+    struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */
+
+    struct tree_desc_s l_desc;               /* desc. for literal tree */
+    struct tree_desc_s d_desc;               /* desc. for distance tree */
+    struct tree_desc_s bl_desc;              /* desc. for bit length tree */
+
+    ush bl_count[MAX_BITS+1];
+    /* number of codes at each bit length for an optimal tree */
+
+    int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */
+    int heap_len;               /* number of elements in the heap */
+    int heap_max;               /* element of largest frequency */
+    /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
+     * The same heap array is used to build all trees.
+     */
+
+    uch depth[2*L_CODES+1];
+    /* Depth of each subtree used as tie breaker for trees of equal frequency
+     */
+
+    uchf *l_buf;          /* buffer for literals or lengths */
+
+    uInt  lit_bufsize;
+    /* Size of match buffer for literals/lengths.  There are 4 reasons for
+     * limiting lit_bufsize to 64K:
+     *   - frequencies can be kept in 16 bit counters
+     *   - if compression is not successful for the first block, all input
+     *     data is still in the window so we can still emit a stored block even
+     *     when input comes from standard input.  (This can also be done for
+     *     all blocks if lit_bufsize is not greater than 32K.)
+     *   - if compression is not successful for a file smaller than 64K, we can
+     *     even emit a stored file instead of a stored block (saving 5 bytes).
+     *     This is applicable only for zip (not gzip or zlib).
+     *   - creating new Huffman trees less frequently may not provide fast
+     *     adaptation to changes in the input data statistics. (Take for
+     *     example a binary file with poorly compressible code followed by
+     *     a highly compressible string table.) Smaller buffer sizes give
+     *     fast adaptation but have of course the overhead of transmitting
+     *     trees more frequently.
+     *   - I can't count above 4
+     */
+
+    uInt last_lit;      /* running index in l_buf */
+
+    ushf *d_buf;
+    /* Buffer for distances. To simplify the code, d_buf and l_buf have
+     * the same number of elements. To use different lengths, an extra flag
+     * array would be necessary.
+     */
+
+    ulg opt_len;        /* bit length of current block with optimal trees */
+    ulg static_len;     /* bit length of current block with static trees */
+    uInt matches;       /* number of string matches in current block */
+    int last_eob_len;   /* bit length of EOB code for last block */
+
+#ifdef DEBUG
+    ulg compressed_len; /* total bit length of compressed file mod 2^32 */
+    ulg bits_sent;      /* bit length of compressed data sent mod 2^32 */
+#endif
+
+    ush bi_buf;
+    /* Output buffer. bits are inserted starting at the bottom (least
+     * significant bits).
+     */
+    int bi_valid;
+    /* Number of valid bits in bi_buf.  All bits above the last valid bit
+     * are always zero.
+     */
+
+} FAR deflate_state;
+
+/* Output a byte on the stream.
+ * IN assertion: there is enough room in pending_buf.
+ */
+#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
+
+
+#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
+/* Minimum amount of lookahead, except at the end of the input file.
+ * See deflate.c for comments about the MIN_MATCH+1.
+ */
+
+#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
+/* In order to simplify the code, particularly on 16 bit machines, match
+ * distances are limited to MAX_DIST instead of WSIZE.
+ */
+
+        /* in trees.c */
+void _tr_init         OF((deflate_state *s));
+int  _tr_tally        OF((deflate_state *s, unsigned dist, unsigned lc));
+void _tr_flush_block  OF((deflate_state *s, charf *buf, ulg stored_len,
+                          int eof));
+void _tr_align        OF((deflate_state *s));
+void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
+                          int eof));
+
+#define d_code(dist) \
+   ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
+/* Mapping from a distance to a distance code. dist is the distance - 1 and
+ * must not have side effects. _dist_code[256] and _dist_code[257] are never
+ * used.
+ */
+
+#ifndef DEBUG
+/* Inline versions of _tr_tally for speed: */
+
+#if defined(GEN_TREES_H) || !defined(STDC)
+  extern uch _length_code[];
+  extern uch _dist_code[];
+#else
+  extern const uch _length_code[];
+  extern const uch _dist_code[];
+#endif
+
+# define _tr_tally_lit(s, c, flush) \
+  { uch cc = (c); \
+    s->d_buf[s->last_lit] = 0; \
+    s->l_buf[s->last_lit++] = cc; \
+    s->dyn_ltree[cc].Freq++; \
+    flush = (s->last_lit == s->lit_bufsize-1); \
+   }
+# define _tr_tally_dist(s, distance, length, flush) \
+  { uch len = (length); \
+    ush dist = (distance); \
+    s->d_buf[s->last_lit] = dist; \
+    s->l_buf[s->last_lit++] = len; \
+    dist--; \
+    s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
+    s->dyn_dtree[d_code(dist)].Freq++; \
+    flush = (s->last_lit == s->lit_bufsize-1); \
+  }
+#else
+# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
+# define _tr_tally_dist(s, distance, length, flush) \
+              flush = _tr_tally(s, distance, length)
+#endif
+
+#endif /* DEFLATE_H */

Added: branches/vendor/emile/libgzip/inffast.c
===================================================================
--- branches/vendor/emile/libgzip/inffast.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libgzip/inffast.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,318 @@
+/* inffast.c -- fast decoding
+ * Copyright (C) 1995-2004 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zutil.h"
+#include "inftrees.h"
+#include "inflate.h"
+#include "inffast.h"
+
+#ifndef ASMINF
+
+/* Allow machine dependent optimization for post-increment or pre-increment.
+   Based on testing to date,
+   Pre-increment preferred for:
+   - PowerPC G3 (Adler)
+   - MIPS R5000 (Randers-Pehrson)
+   Post-increment preferred for:
+   - none
+   No measurable difference:
+   - Pentium III (Anderson)
+   - M68060 (Nikl)
+ */
+#ifdef POSTINC
+#  define OFF 0
+#  define PUP(a) *(a)++
+#else
+#  define OFF 1
+#  define PUP(a) *++(a)
+#endif
+
+/*
+   Decode literal, length, and distance codes and write out the resulting
+   literal and match bytes until either not enough input or output is
+   available, an end-of-block is encountered, or a data error is encountered.
+   When large enough input and output buffers are supplied to inflate(), for
+   example, a 16K input buffer and a 64K output buffer, more than 95% of the
+   inflate execution time is spent in this routine.
+
+   Entry assumptions:
+
+        state->mode == LEN
+        strm->avail_in >= 6
+        strm->avail_out >= 258
+        start >= strm->avail_out
+        state->bits < 8
+
+   On return, state->mode is one of:
+
+        LEN -- ran out of enough output space or enough available input
+        TYPE -- reached end of block code, inflate() to interpret next block
+        BAD -- error in block data
+
+   Notes:
+
+    - The maximum input bits used by a length/distance pair is 15 bits for the
+      length code, 5 bits for the length extra, 15 bits for the distance code,
+      and 13 bits for the distance extra.  This totals 48 bits, or six bytes.
+      Therefore if strm->avail_in >= 6, then there is enough input to avoid
+      checking for available input while decoding.
+
+    - The maximum bytes that a single length/distance pair can output is 258
+      bytes, which is the maximum length that can be coded.  inflate_fast()
+      requires strm->avail_out >= 258 for each loop to avoid checking for
+      output space.
+ */
+void inflate_fast(strm, start)
+z_streamp strm;
+unsigned start;         /* inflate()'s starting value for strm->avail_out */
+{
+    struct inflate_state FAR *state;
+    unsigned char FAR *in;      /* local strm->next_in */
+    unsigned char FAR *last;    /* while in < last, enough input available */
+    unsigned char FAR *out;     /* local strm->next_out */
+    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
+    unsigned char FAR *end;     /* while out < end, enough space available */
+#ifdef INFLATE_STRICT
+    unsigned dmax;              /* maximum distance from zlib header */
+#endif
+    unsigned wsize;             /* window size or zero if not using window */
+    unsigned whave;             /* valid bytes in the window */
+    unsigned write;             /* window write index */
+    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
+    unsigned long hold;         /* local strm->hold */
+    unsigned bits;              /* local strm->bits */
+    code const FAR *lcode;      /* local strm->lencode */
+    code const FAR *dcode;      /* local strm->distcode */
+    unsigned lmask;             /* mask for first level of length codes */
+    unsigned dmask;             /* mask for first level of distance codes */
+    code this;                  /* retrieved table entry */
+    unsigned op;                /* code bits, operation, extra bits, or */
+                                /*  window position, window bytes to copy */
+    unsigned len;               /* match length, unused bytes */
+    unsigned dist;              /* match distance */
+    unsigned char FAR *from;    /* where to copy match from */
+
+    /* copy state to local variables */
+    state = (struct inflate_state FAR *)strm->state;
+    in = strm->next_in - OFF;
+    last = in + (strm->avail_in - 5);
+    out = strm->next_out - OFF;
+    beg = out - (start - strm->avail_out);
+    end = out + (strm->avail_out - 257);
+#ifdef INFLATE_STRICT
+    dmax = state->dmax;
+#endif
+    wsize = state->wsize;
+    whave = state->whave;
+    write = state->write;
+    window = state->window;
+    hold = state->hold;
+    bits = state->bits;
+    lcode = state->lencode;
+    dcode = state->distcode;
+    lmask = (1U << state->lenbits) - 1;
+    dmask = (1U << state->distbits) - 1;
+
+    /* decode literals and length/distances until end-of-block or not enough
+       input data or output space */
+    do {
+        if (bits < 15) {
+            hold += (unsigned long)(PUP(in)) << bits;
+            bits += 8;
+            hold += (unsigned long)(PUP(in)) << bits;
+            bits += 8;
+        }
+        this = lcode[hold & lmask];
+      dolen:
+        op = (unsigned)(this.bits);
+        hold >>= op;
+        bits -= op;
+        op = (unsigned)(this.op);
+        if (op == 0) {                          /* literal */
+            Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
+                    "inflate:         literal '%c'\n" :
+                    "inflate:         literal 0x%02x\n", this.val));
+            PUP(out) = (unsigned char)(this.val);
+        }
+        else if (op & 16) {                     /* length base */
+            len = (unsigned)(this.val);
+            op &= 15;                           /* number of extra bits */
+            if (op) {
+                if (bits < op) {
+                    hold += (unsigned long)(PUP(in)) << bits;
+                    bits += 8;
+                }
+                len += (unsigned)hold & ((1U << op) - 1);
+                hold >>= op;
+                bits -= op;
+            }
+            Tracevv((stderr, "inflate:         length %u\n", len));
+            if (bits < 15) {
+                hold += (unsigned long)(PUP(in)) << bits;
+                bits += 8;
+                hold += (unsigned long)(PUP(in)) << bits;
+                bits += 8;
+            }
+            this = dcode[hold & dmask];
+          dodist:
+            op = (unsigned)(this.bits);
+            hold >>= op;
+            bits -= op;
+            op = (unsigned)(this.op);
+            if (op & 16) {                      /* distance base */
+                dist = (unsigned)(this.val);
+                op &= 15;                       /* number of extra bits */
+                if (bits < op) {
+                    hold += (unsigned long)(PUP(in)) << bits;
+                    bits += 8;
+                    if (bits < op) {
+                        hold += (unsigned long)(PUP(in)) << bits;
+                        bits += 8;
+                    }
+                }
+                dist += (unsigned)hold & ((1U << op) - 1);
+#ifdef INFLATE_STRICT
+                if (dist > dmax) {
+                    strm->msg = (char *)"invalid distance too far back";
+                    state->mode = BAD;
+                    break;
+                }
+#endif
+                hold >>= op;
+                bits -= op;
+                Tracevv((stderr, "inflate:         distance %u\n", dist));
+                op = (unsigned)(out - beg);     /* max distance in output */
+                if (dist > op) {                /* see if copy from window */
+                    op = dist - op;             /* distance back in window */
+                    if (op > whave) {
+                        strm->msg = (char *)"invalid distance too far back";
+                        state->mode = BAD;
+                        break;
+                    }
+                    from = window - OFF;
+                    if (write == 0) {           /* very common case */
+                        from += wsize - op;
+                        if (op < len) {         /* some from window */
+                            len -= op;
+                            do {
+                                PUP(out) = PUP(from);
+                            } while (--op);
+                            from = out - dist;  /* rest from output */
+                        }
+                    }
+                    else if (write < op) {      /* wrap around window */
+                        from += wsize + write - op;
+                        op -= write;
+                        if (op < len) {         /* some from end of window */
+                            len -= op;
+                            do {
+                                PUP(out) = PUP(from);
+                            } while (--op);
+                            from = window - OFF;
+                            if (write < len) {  /* some from start of window */
+                                op = write;
+                                len -= op;
+                                do {
+                                    PUP(out) = PUP(from);
+                                } while (--op);
+                                from = out - dist;      /* rest from output */
+                            }
+                        }
+                    }
+                    else {                      /* contiguous in window */
+                        from += write - op;
+                        if (op < len) {         /* some from window */
+                            len -= op;
+                            do {
+                                PUP(out) = PUP(from);
+                            } while (--op);
+                            from = out - dist;  /* rest from output */
+                        }
+                    }
+                    while (len > 2) {
+                        PUP(out) = PUP(from);
+                        PUP(out) = PUP(from);
+                        PUP(out) = PUP(from);
+                        len -= 3;
+                    }
+                    if (len) {
+                        PUP(out) = PUP(from);
+                        if (len > 1)
+                            PUP(out) = PUP(from);
+                    }
+                }
+                else {
+                    from = out - dist;          /* copy direct from output */
+                    do {                        /* minimum length is three */
+                        PUP(out) = PUP(from);
+                        PUP(out) = PUP(from);
+                        PUP(out) = PUP(from);
+                        len -= 3;
+                    } while (len > 2);
+                    if (len) {
+                        PUP(out) = PUP(from);
+                        if (len > 1)
+                            PUP(out) = PUP(from);
+                    }
+                }
+            }
+            else if ((op & 64) == 0) {          /* 2nd level distance code */
+                this = dcode[this.val + (hold & ((1U << op) - 1))];
+                goto dodist;
+            }
+            else {
+                strm->msg = (char *)"invalid distance code";
+                state->mode = BAD;
+                break;
+            }
+        }
+        else if ((op & 64) == 0) {              /* 2nd level length code */
+            this = lcode[this.val + (hold & ((1U << op) - 1))];
+            goto dolen;
+        }
+        else if (op & 32) {                     /* end-of-block */
+            Tracevv((stderr, "inflate:         end of block\n"));
+            state->mode = TYPE;
+            break;
+        }
+        else {
+            strm->msg = (char *)"invalid literal/length code";
+            state->mode = BAD;
+            break;
+        }
+    } while (in < last && out < end);
+
+    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
+    len = bits >> 3;
+    in -= len;
+    bits -= len << 3;
+    hold &= (1U << bits) - 1;
+
+    /* update state and return */
+    strm->next_in = in + OFF;
+    strm->next_out = out + OFF;
+    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
+    strm->avail_out = (unsigned)(out < end ?
+                                 257 + (end - out) : 257 - (out - end));
+    state->hold = hold;
+    state->bits = bits;
+    return;
+}
+
+/*
+   inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
+   - Using bit fields for code structure
+   - Different op definition to avoid & for extra bits (do & for table bits)
+   - Three separate decoding do-loops for direct, window, and write == 0
+   - Special case for distance > 1 copies to do overlapped load and store copy
+   - Explicit branch predictions (based on measured branch probabilities)
+   - Deferring match copy and interspersed it with decoding subsequent codes
+   - Swapping literal/length else
+   - Swapping window/direct else
+   - Larger unrolled copy loops (three is about right)
+   - Moving len -= 3 statement into middle of loop
+ */
+
+#endif /* !ASMINF */

Added: branches/vendor/emile/libgzip/inffast.h
===================================================================
--- branches/vendor/emile/libgzip/inffast.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libgzip/inffast.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,11 @@
+/* inffast.h -- header to use inffast.c
+ * Copyright (C) 1995-2003 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+void inflate_fast OF((z_streamp strm, unsigned start));

Added: branches/vendor/emile/libgzip/inflate.c
===================================================================
--- branches/vendor/emile/libgzip/inflate.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libgzip/inflate.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,1368 @@
+/* inflate.c -- zlib decompression
+ * Copyright (C) 1995-2005 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/*
+ * Change history:
+ *
+ * 1.2.beta0    24 Nov 2002
+ * - First version -- complete rewrite of inflate to simplify code, avoid
+ *   creation of window when not needed, minimize use of window when it is
+ *   needed, make inffast.c even faster, implement gzip decoding, and to
+ *   improve code readability and style over the previous zlib inflate code
+ *
+ * 1.2.beta1    25 Nov 2002
+ * - Use pointers for available input and output checking in inffast.c
+ * - Remove input and output counters in inffast.c
+ * - Change inffast.c entry and loop from avail_in >= 7 to >= 6
+ * - Remove unnecessary second byte pull from length extra in inffast.c
+ * - Unroll direct copy to three copies per loop in inffast.c
+ *
+ * 1.2.beta2    4 Dec 2002
+ * - Change external routine names to reduce potential conflicts
+ * - Correct filename to inffixed.h for fixed tables in inflate.c
+ * - Make hbuf[] unsigned char to match parameter type in inflate.c
+ * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset)
+ *   to avoid negation problem on Alphas (64 bit) in inflate.c
+ *
+ * 1.2.beta3    22 Dec 2002
+ * - Add comments on state->bits assertion in inffast.c
+ * - Add comments on op field in inftrees.h
+ * - Fix bug in reuse of allocated window after inflateReset()
+ * - Remove bit fields--back to byte structure for speed
+ * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths
+ * - Change post-increments to pre-increments in inflate_fast(), PPC biased?
+ * - Add compile time option, POSTINC, to use post-increments instead (Intel?)
+ * - Make MATCH copy in inflate() much faster for when inflate_fast() not used
+ * - Use local copies of stream next and avail values, as well as local bit
+ *   buffer and bit count in inflate()--for speed when inflate_fast() not used
+ *
+ * 1.2.beta4    1 Jan 2003
+ * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings
+ * - Move a comment on output buffer sizes from inffast.c to inflate.c
+ * - Add comments in inffast.c to introduce the inflate_fast() routine
+ * - Rearrange window copies in inflate_fast() for speed and simplification
+ * - Unroll last copy for window match in inflate_fast()
+ * - Use local copies of window variables in inflate_fast() for speed
+ * - Pull out common write == 0 case for speed in inflate_fast()
+ * - Make op and len in inflate_fast() unsigned for consistency
+ * - Add FAR to lcode and dcode declarations in inflate_fast()
+ * - Simplified bad distance check in inflate_fast()
+ * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new
+ *   source file infback.c to provide a call-back interface to inflate for
+ *   programs like gzip and unzip -- uses window as output buffer to avoid
+ *   window copying
+ *
+ * 1.2.beta5    1 Jan 2003
+ * - Improved inflateBack() interface to allow the caller to provide initial
+ *   input in strm.
+ * - Fixed stored blocks bug in inflateBack()
+ *
+ * 1.2.beta6    4 Jan 2003
+ * - Added comments in inffast.c on effectiveness of POSTINC
+ * - Typecasting all around to reduce compiler warnings
+ * - Changed loops from while (1) or do {} while (1) to for (;;), again to
+ *   make compilers happy
+ * - Changed type of window in inflateBackInit() to unsigned char *
+ *
+ * 1.2.beta7    27 Jan 2003
+ * - Changed many types to unsigned or unsigned short to avoid warnings
+ * - Added inflateCopy() function
+ *
+ * 1.2.0        9 Mar 2003
+ * - Changed inflateBack() interface to provide separate opaque descriptors
+ *   for the in() and out() functions
+ * - Changed inflateBack() argument and in_func typedef to swap the length
+ *   and buffer address return values for the input function
+ * - Check next_in and next_out for Z_NULL on entry to inflate()
+ *
+ * The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
+ */
+
+#include "zutil.h"
+#include "inftrees.h"
+#include "inflate.h"
+#include "inffast.h"
+
+#ifdef MAKEFIXED
+#  ifndef BUILDFIXED
+#    define BUILDFIXED
+#  endif
+#endif
+
+/* function prototypes */
+local void fixedtables OF((struct inflate_state FAR *state));
+local int updatewindow OF((z_streamp strm, unsigned out));
+#ifdef BUILDFIXED
+   void makefixed OF((void));
+#endif
+local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf,
+                              unsigned len));
+
+int ZEXPORT inflateReset(strm)
+z_streamp strm;
+{
+    struct inflate_state FAR *state;
+
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+    state = (struct inflate_state FAR *)strm->state;
+    strm->total_in = strm->total_out = state->total = 0;
+    strm->msg = Z_NULL;
+    strm->adler = 1;        /* to support ill-conceived Java test suite */
+    state->mode = HEAD;
+    state->last = 0;
+    state->havedict = 0;
+    state->dmax = 32768U;
+    state->head = Z_NULL;
+    state->wsize = 0;
+    state->whave = 0;
+    state->write = 0;
+    state->hold = 0;
+    state->bits = 0;
+    state->lencode = state->distcode = state->next = state->codes;
+    Tracev((stderr, "inflate: reset\n"));
+    return Z_OK;
+}
+
+int ZEXPORT inflatePrime(strm, bits, value)
+z_streamp strm;
+int bits;
+int value;
+{
+    struct inflate_state FAR *state;
+
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+    state = (struct inflate_state FAR *)strm->state;
+    if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
+    value &= (1L << bits) - 1;
+    state->hold += value << state->bits;
+    state->bits += bits;
+    return Z_OK;
+}
+
+int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
+z_streamp strm;
+int windowBits;
+const char *version;
+int stream_size;
+{
+    struct inflate_state FAR *state;
+
+    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
+        stream_size != (int)(sizeof(z_stream)))
+        return Z_VERSION_ERROR;
+    if (strm == Z_NULL) return Z_STREAM_ERROR;
+    strm->msg = Z_NULL;                 /* in case we return an error */
+    if (strm->zalloc == (alloc_func)0) {
+        strm->zalloc = zcalloc;
+        strm->opaque = (voidpf)0;
+    }
+    if (strm->zfree == (free_func)0) strm->zfree = zcfree;
+    state = (struct inflate_state FAR *)
+            ZALLOC(strm, 1, sizeof(struct inflate_state));
+    if (state == Z_NULL) return Z_MEM_ERROR;
+    Tracev((stderr, "inflate: allocated\n"));
+    strm->state = (struct internal_state FAR *)state;
+    if (windowBits < 0) {
+        state->wrap = 0;
+        windowBits = -windowBits;
+    }
+    else {
+        state->wrap = (windowBits >> 4) + 1;
+#ifdef GUNZIP
+        if (windowBits < 48) windowBits &= 15;
+#endif
+    }
+    if (windowBits < 8 || windowBits > 15) {
+        ZFREE(strm, state);
+        strm->state = Z_NULL;
+        return Z_STREAM_ERROR;
+    }
+    state->wbits = (unsigned)windowBits;
+    state->window = Z_NULL;
+    return inflateReset(strm);
+}
+
+int ZEXPORT inflateInit_(strm, version, stream_size)
+z_streamp strm;
+const char *version;
+int stream_size;
+{
+    return inflateInit2_(strm, DEF_WBITS, version, stream_size);
+}
+
+/*
+   Return state with length and distance decoding tables and index sizes set to
+   fixed code decoding.  Normally this returns fixed tables from inffixed.h.
+   If BUILDFIXED is defined, then instead this routine builds the tables the
+   first time it's called, and returns those tables the first time and
+   thereafter.  This reduces the size of the code by about 2K bytes, in
+   exchange for a little execution time.  However, BUILDFIXED should not be
+   used for threaded applications, since the rewriting of the tables and virgin
+   may not be thread-safe.
+ */
+local void fixedtables(state)
+struct inflate_state FAR *state;
+{
+#ifdef BUILDFIXED
+    static int virgin = 1;
+    static code *lenfix, *distfix;
+    static code fixed[544];
+
+    /* build fixed huffman tables if first call (may not be thread safe) */
+    if (virgin) {
+        unsigned sym, bits;
+        static code *next;
+
+        /* literal/length table */
+        sym = 0;
+        while (sym < 144) state->lens[sym++] = 8;
+        while (sym < 256) state->lens[sym++] = 9;
+        while (sym < 280) state->lens[sym++] = 7;
+        while (sym < 288) state->lens[sym++] = 8;
+        next = fixed;
+        lenfix = next;
+        bits = 9;
+        inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
+
+        /* distance table */
+        sym = 0;
+        while (sym < 32) state->lens[sym++] = 5;
+        distfix = next;
+        bits = 5;
+        inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
+
+        /* do this just once */
+        virgin = 0;
+    }
+#else /* !BUILDFIXED */
+#   include "inffixed.h"
+#endif /* BUILDFIXED */
+    state->lencode = lenfix;
+    state->lenbits = 9;
+    state->distcode = distfix;
+    state->distbits = 5;
+}
+
+#ifdef MAKEFIXED
+#include <stdio.h>
+
+/*
+   Write out the inffixed.h that is #include'd above.  Defining MAKEFIXED also
+   defines BUILDFIXED, so the tables are built on the fly.  makefixed() writes
+   those tables to stdout, which would be piped to inffixed.h.  A small program
+   can simply call makefixed to do this:
+
+    void makefixed(void);
+
+    int main(void)
+    {
+        makefixed();
+        return 0;
+    }
+
+   Then that can be linked with zlib built with MAKEFIXED defined and run:
+
+    a.out > inffixed.h
+ */
+void makefixed()
+{
+    unsigned low, size;
+    struct inflate_state state;
+
+    fixedtables(&state);
+    puts("    /* inffixed.h -- table for decoding fixed codes");
+    puts("     * Generated automatically by makefixed().");
+    puts("     */");
+    puts("");
+    puts("    /* WARNING: this file should *not* be used by applications.");
+    puts("       It is part of the implementation of this library and is");
+    puts("       subject to change. Applications should only use zlib.h.");
+    puts("     */");
+    puts("");
+    size = 1U << 9;
+    printf("    static const code lenfix[%u] = {", size);
+    low = 0;
+    for (;;) {
+        if ((low % 7) == 0) printf("\n        ");
+        printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits,
+               state.lencode[low].val);
+        if (++low == size) break;
+        putchar(',');
+    }
+    puts("\n    };");
+    size = 1U << 5;
+    printf("\n    static const code distfix[%u] = {", size);
+    low = 0;
+    for (;;) {
+        if ((low % 6) == 0) printf("\n        ");
+        printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
+               state.distcode[low].val);
+        if (++low == size) break;
+        putchar(',');
+    }
+    puts("\n    };");
+}
+#endif /* MAKEFIXED */
+
+/*
+   Update the window with the last wsize (normally 32K) bytes written before
+   returning.  If window does not exist yet, create it.  This is only called
+   when a window is already in use, or when output has been written during this
+   inflate call, but the end of the deflate stream has not been reached yet.
+   It is also called to create a window for dictionary data when a dictionary
+   is loaded.
+
+   Providing output buffers larger than 32K to inflate() should provide a speed
+   advantage, since only the last 32K of output is copied to the sliding window
+   upon return from inflate(), and since all distances after the first 32K of
+   output will fall in the output data, making match copies simpler and faster.
+   The advantage may be dependent on the size of the processor's data caches.
+ */
+local int updatewindow(strm, out)
+z_streamp strm;
+unsigned out;
+{
+    struct inflate_state FAR *state;
+    unsigned copy, dist;
+
+    state = (struct inflate_state FAR *)strm->state;
+
+    /* if it hasn't been done already, allocate space for the window */
+    if (state->window == Z_NULL) {
+        state->window = (unsigned char FAR *)
+                        ZALLOC(strm, 1U << state->wbits,
+                               sizeof(unsigned char));
+        if (state->window == Z_NULL) return 1;
+    }
+
+    /* if window not in use yet, initialize */
+    if (state->wsize == 0) {
+        state->wsize = 1U << state->wbits;
+        state->write = 0;
+        state->whave = 0;
+    }
+
+    /* copy state->wsize or less output bytes into the circular window */
+    copy = out - strm->avail_out;
+    if (copy >= state->wsize) {
+        zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);
+        state->write = 0;
+        state->whave = state->wsize;
+    }
+    else {
+        dist = state->wsize - state->write;
+        if (dist > copy) dist = copy;
+        zmemcpy(state->window + state->write, strm->next_out - copy, dist);
+        copy -= dist;
+        if (copy) {
+            zmemcpy(state->window, strm->next_out - copy, copy);
+            state->write = copy;
+            state->whave = state->wsize;
+        }
+        else {
+            state->write += dist;
+            if (state->write == state->wsize) state->write = 0;
+            if (state->whave < state->wsize) state->whave += dist;
+        }
+    }
+    return 0;
+}
+
+/* Macros for inflate(): */
+
+/* check function to use adler32() for zlib or crc32() for gzip */
+#ifdef GUNZIP
+#  define UPDATE(check, buf, len) \
+    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
+#else
+#  define UPDATE(check, buf, len) adler32(check, buf, len)
+#endif
+
+/* check macros for header crc */
+#ifdef GUNZIP
+#  define CRC2(check, word) \
+    do { \
+        hbuf[0] = (unsigned char)(word); \
+        hbuf[1] = (unsigned char)((word) >> 8); \
+        check = crc32(check, hbuf, 2); \
+    } while (0)
+
+#  define CRC4(check, word) \
+    do { \
+        hbuf[0] = (unsigned char)(word); \
+        hbuf[1] = (unsigned char)((word) >> 8); \
+        hbuf[2] = (unsigned char)((word) >> 16); \
+        hbuf[3] = (unsigned char)((word) >> 24); \
+        check = crc32(check, hbuf, 4); \
+    } while (0)
+#endif
+
+/* Load registers with state in inflate() for speed */
+#define LOAD() \
+    do { \
+        put = strm->next_out; \
+        left = strm->avail_out; \
+        next = strm->next_in; \
+        have = strm->avail_in; \
+        hold = state->hold; \
+        bits = state->bits; \
+    } while (0)
+
+/* Restore state from registers in inflate() */
+#define RESTORE() \
+    do { \
+        strm->next_out = put; \
+        strm->avail_out = left; \
+        strm->next_in = next; \
+        strm->avail_in = have; \
+        state->hold = hold; \
+        state->bits = bits; \
+    } while (0)
+
+/* Clear the input bit accumulator */
+#define INITBITS() \
+    do { \
+        hold = 0; \
+        bits = 0; \
+    } while (0)
+
+/* Get a byte of input into the bit accumulator, or return from inflate()
+   if there is no input available. */
+#define PULLBYTE() \
+    do { \
+        if (have == 0) goto inf_leave; \
+        have--; \
+        hold += (unsigned long)(*next++) << bits; \
+        bits += 8; \
+    } while (0)
+
+/* Assure that there are at least n bits in the bit accumulator.  If there is
+   not enough available input to do that, then return from inflate(). */
+#define NEEDBITS(n) \
+    do { \
+        while (bits < (unsigned)(n)) \
+            PULLBYTE(); \
+    } while (0)
+
+/* Return the low n bits of the bit accumulator (n < 16) */
+#define BITS(n) \
+    ((unsigned)hold & ((1U << (n)) - 1))
+
+/* Remove n bits from the bit accumulator */
+#define DROPBITS(n) \
+    do { \
+        hold >>= (n); \
+        bits -= (unsigned)(n); \
+    } while (0)
+
+/* Remove zero to seven bits as needed to go to a byte boundary */
+#define BYTEBITS() \
+    do { \
+        hold >>= bits & 7; \
+        bits -= bits & 7; \
+    } while (0)
+
+/* Reverse the bytes in a 32-bit value */
+#define REVERSE(q) \
+    ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
+     (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
+
+/*
+   inflate() uses a state machine to process as much input data and generate as
+   much output data as possible before returning.  The state machine is
+   structured roughly as follows:
+
+    for (;;) switch (state) {
+    ...
+    case STATEn:
+        if (not enough input data or output space to make progress)
+            return;
+        ... make progress ...
+        state = STATEm;
+        break;
+    ...
+    }
+
+   so when inflate() is called again, the same case is attempted again, and
+   if the appropriate resources are provided, the machine proceeds to the
+   next state.  The NEEDBITS() macro is usually the way the state evaluates
+   whether it can proceed or should return.  NEEDBITS() does the return if
+   the requested bits are not available.  The typical use of the BITS macros
+   is:
+
+        NEEDBITS(n);
+        ... do something with BITS(n) ...
+        DROPBITS(n);
+
+   where NEEDBITS(n) either returns from inflate() if there isn't enough
+   input left to load n bits into the accumulator, or it continues.  BITS(n)
+   gives the low n bits in the accumulator.  When done, DROPBITS(n) drops
+   the low n bits off the accumulator.  INITBITS() clears the accumulator
+   and sets the number of available bits to zero.  BYTEBITS() discards just
+   enough bits to put the accumulator on a byte boundary.  After BYTEBITS()
+   and a NEEDBITS(8), then BITS(8) would return the next byte in the stream.
+
+   NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return
+   if there is no input available.  The decoding of variable length codes uses
+   PULLBYTE() directly in order to pull just enough bytes to decode the next
+   code, and no more.
+
+   Some states loop until they get enough input, making sure that enough
+   state information is maintained to continue the loop where it left off
+   if NEEDBITS() returns in the loop.  For example, want, need, and keep
+   would all have to actually be part of the saved state in case NEEDBITS()
+   returns:
+
+    case STATEw:
+        while (want < need) {
+            NEEDBITS(n);
+            keep[want++] = BITS(n);
+            DROPBITS(n);
+        }
+        state = STATEx;
+    case STATEx:
+
+   As shown above, if the next state is also the next case, then the break
+   is omitted.
+
+   A state may also return if there is not enough output space available to
+   complete that state.  Those states are copying stored data, writing a
+   literal byte, and copying a matching string.
+
+   When returning, a "goto inf_leave" is used to update the total counters,
+   update the check value, and determine whether any progress has been made
+   during that inflate() call in order to return the proper return code.
+   Progress is defined as a change in either strm->avail_in or strm->avail_out.
+   When there is a window, goto inf_leave will update the window with the last
+   output written.  If a goto inf_leave occurs in the middle of decompression
+   and there is no window currently, goto inf_leave will create one and copy
+   output to the window for the next call of inflate().
+
+   In this implementation, the flush parameter of inflate() only affects the
+   return code (per zlib.h).  inflate() always writes as much as possible to
+   strm->next_out, given the space available and the provided input--the effect
+   documented in zlib.h of Z_SYNC_FLUSH.  Furthermore, inflate() always defers
+   the allocation of and copying into a sliding window until necessary, which
+   provides the effect documented in zlib.h for Z_FINISH when the entire input
+   stream available.  So the only thing the flush parameter actually does is:
+   when flush is set to Z_FINISH, inflate() cannot return Z_OK.  Instead it
+   will return Z_BUF_ERROR if it has not reached the end of the stream.
+ */
+
+int ZEXPORT inflate(strm, flush)
+z_streamp strm;
+int flush;
+{
+    struct inflate_state FAR *state;
+    unsigned char FAR *next;    /* next input */
+    unsigned char FAR *put;     /* next output */
+    unsigned have, left;        /* available input and output */
+    unsigned long hold;         /* bit buffer */
+    unsigned bits;              /* bits in bit buffer */
+    unsigned in, out;           /* save starting available input and output */
+    unsigned copy;              /* number of stored or match bytes to copy */
+    unsigned char FAR *from;    /* where to copy match bytes from */
+    code this;                  /* current decoding table entry */
+    code last;                  /* parent table entry */
+    unsigned len;               /* length to copy for repeats, bits to drop */
+    int ret;                    /* return code */
+#ifdef GUNZIP
+    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
+#endif
+    static const unsigned short order[19] = /* permutation of code lengths */
+        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
+
+    if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL ||
+        (strm->next_in == Z_NULL && strm->avail_in != 0))
+        return Z_STREAM_ERROR;
+
+    state = (struct inflate_state FAR *)strm->state;
+    if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */
+    LOAD();
+    in = have;
+    out = left;
+    ret = Z_OK;
+    for (;;)
+        switch (state->mode) {
+        case HEAD:
+            if (state->wrap == 0) {
+                state->mode = TYPEDO;
+                break;
+            }
+            NEEDBITS(16);
+#ifdef GUNZIP
+            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
+                state->check = crc32(0L, Z_NULL, 0);
+                CRC2(state->check, hold);
+                INITBITS();
+                state->mode = FLAGS;
+                break;
+            }
+            state->flags = 0;           /* expect zlib header */
+            if (state->head != Z_NULL)
+                state->head->done = -1;
+            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
+#else
+            if (
+#endif
+                ((BITS(8) << 8) + (hold >> 8)) % 31) {
+                strm->msg = (char *)"incorrect header check";
+                state->mode = BAD;
+                break;
+            }
+            if (BITS(4) != Z_DEFLATED) {
+                strm->msg = (char *)"unknown compression method";
+                state->mode = BAD;
+                break;
+            }
+            DROPBITS(4);
+            len = BITS(4) + 8;
+            if (len > state->wbits) {
+                strm->msg = (char *)"invalid window size";
+                state->mode = BAD;
+                break;
+            }
+            state->dmax = 1U << len;
+            Tracev((stderr, "inflate:   zlib header ok\n"));
+            strm->adler = state->check = adler32(0L, Z_NULL, 0);
+            state->mode = hold & 0x200 ? DICTID : TYPE;
+            INITBITS();
+            break;
+#ifdef GUNZIP
+        case FLAGS:
+            NEEDBITS(16);
+            state->flags = (int)(hold);
+            if ((state->flags & 0xff) != Z_DEFLATED) {
+                strm->msg = (char *)"unknown compression method";
+                state->mode = BAD;
+                break;
+            }
+            if (state->flags & 0xe000) {
+                strm->msg = (char *)"unknown header flags set";
+                state->mode = BAD;
+                break;
+            }
+            if (state->head != Z_NULL)
+                state->head->text = (int)((hold >> 8) & 1);
+            if (state->flags & 0x0200) CRC2(state->check, hold);
+            INITBITS();
+            state->mode = TIME;
+        case TIME:
+            NEEDBITS(32);
+            if (state->head != Z_NULL)
+                state->head->time = hold;
+            if (state->flags & 0x0200) CRC4(state->check, hold);
+            INITBITS();
+            state->mode = OS;
+        case OS:
+            NEEDBITS(16);
+            if (state->head != Z_NULL) {
+                state->head->xflags = (int)(hold & 0xff);
+                state->head->os = (int)(hold >> 8);
+            }
+            if (state->flags & 0x0200) CRC2(state->check, hold);
+            INITBITS();
+            state->mode = EXLEN;
+        case EXLEN:
+            if (state->flags & 0x0400) {
+                NEEDBITS(16);
+                state->length = (unsigned)(hold);
+                if (state->head != Z_NULL)
+                    state->head->extra_len = (unsigned)hold;
+                if (state->flags & 0x0200) CRC2(state->check, hold);
+                INITBITS();
+            }
+            else if (state->head != Z_NULL)
+                state->head->extra = Z_NULL;
+            state->mode = EXTRA;
+        case EXTRA:
+            if (state->flags & 0x0400) {
+                copy = state->length;
+                if (copy > have) copy = have;
+                if (copy) {
+                    if (state->head != Z_NULL &&
+                        state->head->extra != Z_NULL) {
+                        len = state->head->extra_len - state->length;
+                        zmemcpy(state->head->extra + len, next,
+                                len + copy > state->head->extra_max ?
+                                state->head->extra_max - len : copy);
+                    }
+                    if (state->flags & 0x0200)
+                        state->check = crc32(state->check, next, copy);
+                    have -= copy;
+                    next += copy;
+                    state->length -= copy;
+                }
+                if (state->length) goto inf_leave;
+            }
+            state->length = 0;
+            state->mode = NAME;
+        case NAME:
+            if (state->flags & 0x0800) {
+                if (have == 0) goto inf_leave;
+                copy = 0;
+                do {
+                    len = (unsigned)(next[copy++]);
+                    if (state->head != Z_NULL &&
+                            state->head->name != Z_NULL &&
+                            state->length < state->head->name_max)
+                        state->head->name[state->length++] = len;
+                } while (len && copy < have);
+                if (state->flags & 0x0200)
+                    state->check = crc32(state->check, next, copy);
+                have -= copy;
+                next += copy;
+                if (len) goto inf_leave;
+            }
+            else if (state->head != Z_NULL)
+                state->head->name = Z_NULL;
+            state->length = 0;
+            state->mode = COMMENT;
+        case COMMENT:
+            if (state->flags & 0x1000) {
+                if (have == 0) goto inf_leave;
+                copy = 0;
+                do {
+                    len = (unsigned)(next[copy++]);
+                    if (state->head != Z_NULL &&
+                            state->head->comment != Z_NULL &&
+                            state->length < state->head->comm_max)
+                        state->head->comment[state->length++] = len;
+                } while (len && copy < have);
+                if (state->flags & 0x0200)
+                    state->check = crc32(state->check, next, copy);
+                have -= copy;
+                next += copy;
+                if (len) goto inf_leave;
+            }
+            else if (state->head != Z_NULL)
+                state->head->comment = Z_NULL;
+            state->mode = HCRC;
+        case HCRC:
+            if (state->flags & 0x0200) {
+                NEEDBITS(16);
+                if (hold != (state->check & 0xffff)) {
+                    strm->msg = (char *)"header crc mismatch";
+                    state->mode = BAD;
+                    break;
+                }
+                INITBITS();
+            }
+            if (state->head != Z_NULL) {
+                state->head->hcrc = (int)((state->flags >> 9) & 1);
+                state->head->done = 1;
+            }
+            strm->adler = state->check = crc32(0L, Z_NULL, 0);
+            state->mode = TYPE;
+            break;
+#endif
+        case DICTID:
+            NEEDBITS(32);
+            strm->adler = state->check = REVERSE(hold);
+            INITBITS();
+            state->mode = DICT;
+        case DICT:
+            if (state->havedict == 0) {
+                RESTORE();
+                return Z_NEED_DICT;
+            }
+            strm->adler = state->check = adler32(0L, Z_NULL, 0);
+            state->mode = TYPE;
+        case TYPE:
+            if (flush == Z_BLOCK) goto inf_leave;
+        case TYPEDO:
+            if (state->last) {
+                BYTEBITS();
+                state->mode = CHECK;
+                break;
+            }
+            NEEDBITS(3);
+            state->last = BITS(1);
+            DROPBITS(1);
+            switch (BITS(2)) {
+            case 0:                             /* stored block */
+                Tracev((stderr, "inflate:     stored block%s\n",
+                        state->last ? " (last)" : ""));
+                state->mode = STORED;
+                break;
+            case 1:                             /* fixed block */
+                fixedtables(state);
+                Tracev((stderr, "inflate:     fixed codes block%s\n",
+                        state->last ? " (last)" : ""));
+                state->mode = LEN;              /* decode codes */
+                break;
+            case 2:                             /* dynamic block */
+                Tracev((stderr, "inflate:     dynamic codes block%s\n",
+                        state->last ? " (last)" : ""));
+                state->mode = TABLE;
+                break;
+            case 3:
+                strm->msg = (char *)"invalid block type";
+                state->mode = BAD;
+            }
+            DROPBITS(2);
+            break;
+        case STORED:
+            BYTEBITS();                         /* go to byte boundary */
+            NEEDBITS(32);
+            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
+                strm->msg = (char *)"invalid stored block lengths";
+                state->mode = BAD;
+                break;
+            }
+            state->length = (unsigned)hold & 0xffff;
+            Tracev((stderr, "inflate:       stored length %u\n",
+                    state->length));
+            INITBITS();
+            state->mode = COPY;
+        case COPY:
+            copy = state->length;
+            if (copy) {
+                if (copy > have) copy = have;
+                if (copy > left) copy = left;
+                if (copy == 0) goto inf_leave;
+                zmemcpy(put, next, copy);
+                have -= copy;
+                next += copy;
+                left -= copy;
+                put += copy;
+                state->length -= copy;
+                break;
+            }
+            Tracev((stderr, "inflate:       stored end\n"));
+            state->mode = TYPE;
+            break;
+        case TABLE:
+            NEEDBITS(14);
+            state->nlen = BITS(5) + 257;
+            DROPBITS(5);
+            state->ndist = BITS(5) + 1;
+            DROPBITS(5);
+            state->ncode = BITS(4) + 4;
+            DROPBITS(4);
+#ifndef PKZIP_BUG_WORKAROUND
+            if (state->nlen > 286 || state->ndist > 30) {
+                strm->msg = (char *)"too many length or distance symbols";
+                state->mode = BAD;
+                break;
+            }
+#endif
+            Tracev((stderr, "inflate:       table sizes ok\n"));
+            state->have = 0;
+            state->mode = LENLENS;
+        case LENLENS:
+            while (state->have < state->ncode) {
+                NEEDBITS(3);
+                state->lens[order[state->have++]] = (unsigned short)BITS(3);
+                DROPBITS(3);
+            }
+            while (state->have < 19)
+                state->lens[order[state->have++]] = 0;
+            state->next = state->codes;
+            state->lencode = (code const FAR *)(state->next);
+            state->lenbits = 7;
+            ret = inflate_table(CODES, state->lens, 19, &(state->next),
+                                &(state->lenbits), state->work);
+            if (ret) {
+                strm->msg = (char *)"invalid code lengths set";
+                state->mode = BAD;
+                break;
+            }
+            Tracev((stderr, "inflate:       code lengths ok\n"));
+            state->have = 0;
+            state->mode = CODELENS;
+        case CODELENS:
+            while (state->have < state->nlen + state->ndist) {
+                for (;;) {
+                    this = state->lencode[BITS(state->lenbits)];
+                    if ((unsigned)(this.bits) <= bits) break;
+                    PULLBYTE();
+                }
+                if (this.val < 16) {
+                    NEEDBITS(this.bits);
+                    DROPBITS(this.bits);
+                    state->lens[state->have++] = this.val;
+                }
+                else {
+                    if (this.val == 16) {
+                        NEEDBITS(this.bits + 2);
+                        DROPBITS(this.bits);
+                        if (state->have == 0) {
+                            strm->msg = (char *)"invalid bit length repeat";
+                            state->mode = BAD;
+                            break;
+                        }
+                        len = state->lens[state->have - 1];
+                        copy = 3 + BITS(2);
+                        DROPBITS(2);
+                    }
+                    else if (this.val == 17) {
+                        NEEDBITS(this.bits + 3);
+                        DROPBITS(this.bits);
+                        len = 0;
+                        copy = 3 + BITS(3);
+                        DROPBITS(3);
+                    }
+                    else {
+                        NEEDBITS(this.bits + 7);
+                        DROPBITS(this.bits);
+                        len = 0;
+                        copy = 11 + BITS(7);
+                        DROPBITS(7);
+                    }
+                    if (state->have + copy > state->nlen + state->ndist) {
+                        strm->msg = (char *)"invalid bit length repeat";
+                        state->mode = BAD;
+                        break;
+                    }
+                    while (copy--)
+                        state->lens[state->have++] = (unsigned short)len;
+                }
+            }
+
+            /* handle error breaks in while */
+            if (state->mode == BAD) break;
+
+            /* build code tables */
+            state->next = state->codes;
+            state->lencode = (code const FAR *)(state->next);
+            state->lenbits = 9;
+            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
+                                &(state->lenbits), state->work);
+            if (ret) {
+                strm->msg = (char *)"invalid literal/lengths set";
+                state->mode = BAD;
+                break;
+            }
+            state->distcode = (code const FAR *)(state->next);
+            state->distbits = 6;
+            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
+                            &(state->next), &(state->distbits), state->work);
+            if (ret) {
+                strm->msg = (char *)"invalid distances set";
+                state->mode = BAD;
+                break;
+            }
+            Tracev((stderr, "inflate:       codes ok\n"));
+            state->mode = LEN;
+        case LEN:
+            if (have >= 6 && left >= 258) {
+                RESTORE();
+                inflate_fast(strm, out);
+                LOAD();
+                break;
+            }
+            for (;;) {
+                this = state->lencode[BITS(state->lenbits)];
+                if ((unsigned)(this.bits) <= bits) break;
+                PULLBYTE();
+            }
+            if (this.op && (this.op & 0xf0) == 0) {
+                last = this;
+                for (;;) {
+                    this = state->lencode[last.val +
+                            (BITS(last.bits + last.op) >> last.bits)];
+                    if ((unsigned)(last.bits + this.bits) <= bits) break;
+                    PULLBYTE();
+                }
+                DROPBITS(last.bits);
+            }
+            DROPBITS(this.bits);
+            state->length = (unsigned)this.val;
+            if ((int)(this.op) == 0) {
+                Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
+                        "inflate:         literal '%c'\n" :
+                        "inflate:         literal 0x%02x\n", this.val));
+                state->mode = LIT;
+                break;
+            }
+            if (this.op & 32) {
+                Tracevv((stderr, "inflate:         end of block\n"));
+                state->mode = TYPE;
+                break;
+            }
+            if (this.op & 64) {
+                strm->msg = (char *)"invalid literal/length code";
+                state->mode = BAD;
+                break;
+            }
+            state->extra = (unsigned)(this.op) & 15;
+            state->mode = LENEXT;
+        case LENEXT:
+            if (state->extra) {
+                NEEDBITS(state->extra);
+                state->length += BITS(state->extra);
+                DROPBITS(state->extra);
+            }
+            Tracevv((stderr, "inflate:         length %u\n", state->length));
+            state->mode = DIST;
+        case DIST:
+            for (;;) {
+                this = state->distcode[BITS(state->distbits)];
+                if ((unsigned)(this.bits) <= bits) break;
+                PULLBYTE();
+            }
+            if ((this.op & 0xf0) == 0) {
+                last = this;
+                for (;;) {
+                    this = state->distcode[last.val +
+                            (BITS(last.bits + last.op) >> last.bits)];
+                    if ((unsigned)(last.bits + this.bits) <= bits) break;
+                    PULLBYTE();
+                }
+                DROPBITS(last.bits);
+            }
+            DROPBITS(this.bits);
+            if (this.op & 64) {
+                strm->msg = (char *)"invalid distance code";
+                state->mode = BAD;
+                break;
+            }
+            state->offset = (unsigned)this.val;
+            state->extra = (unsigned)(this.op) & 15;
+            state->mode = DISTEXT;
+        case DISTEXT:
+            if (state->extra) {
+                NEEDBITS(state->extra);
+                state->offset += BITS(state->extra);
+                DROPBITS(state->extra);
+            }
+#ifdef INFLATE_STRICT
+            if (state->offset > state->dmax) {
+                strm->msg = (char *)"invalid distance too far back";
+                state->mode = BAD;
+                break;
+            }
+#endif
+            if (state->offset > state->whave + out - left) {
+                strm->msg = (char *)"invalid distance too far back";
+                state->mode = BAD;
+                break;
+            }
+            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
+            state->mode = MATCH;
+        case MATCH:
+            if (left == 0) goto inf_leave;
+            copy = out - left;
+            if (state->offset > copy) {         /* copy from window */
+                copy = state->offset - copy;
+                if (copy > state->write) {
+                    copy -= state->write;
+                    from = state->window + (state->wsize - copy);
+                }
+                else
+                    from = state->window + (state->write - copy);
+                if (copy > state->length) copy = state->length;
+            }
+            else {                              /* copy from output */
+                from = put - state->offset;
+                copy = state->length;
+            }
+            if (copy > left) copy = left;
+            left -= copy;
+            state->length -= copy;
+            do {
+                *put++ = *from++;
+            } while (--copy);
+            if (state->length == 0) state->mode = LEN;
+            break;
+        case LIT:
+            if (left == 0) goto inf_leave;
+            *put++ = (unsigned char)(state->length);
+            left--;
+            state->mode = LEN;
+            break;
+        case CHECK:
+            if (state->wrap) {
+                NEEDBITS(32);
+                out -= left;
+                strm->total_out += out;
+                state->total += out;
+                if (out)
+                    strm->adler = state->check =
+                        UPDATE(state->check, put - out, out);
+                out = left;
+                if ((
+#ifdef GUNZIP
+                     state->flags ? hold :
+#endif
+                     REVERSE(hold)) != state->check) {
+                    strm->msg = (char *)"incorrect data check";
+                    state->mode = BAD;
+                    break;
+                }
+                INITBITS();
+                Tracev((stderr, "inflate:   check matches trailer\n"));
+            }
+#ifdef GUNZIP
+            state->mode = LENGTH;
+        case LENGTH:
+            if (state->wrap && state->flags) {
+                NEEDBITS(32);
+                if (hold != (state->total & 0xffffffffUL)) {
+                    strm->msg = (char *)"incorrect length check";
+                    state->mode = BAD;
+                    break;
+                }
+                INITBITS();
+                Tracev((stderr, "inflate:   length matches trailer\n"));
+            }
+#endif
+            state->mode = DONE;
+        case DONE:
+            ret = Z_STREAM_END;
+            goto inf_leave;
+        case BAD:
+            ret = Z_DATA_ERROR;
+            goto inf_leave;
+        case MEM:
+            return Z_MEM_ERROR;
+        case SYNC:
+        default:
+            return Z_STREAM_ERROR;
+        }
+
+    /*
+       Return from inflate(), updating the total counts and the check value.
+       If there was no progress during the inflate() call, return a buffer
+       error.  Call updatewindow() to create and/or update the window state.
+       Note: a memory error from inflate() is non-recoverable.
+     */
+  inf_leave:
+    RESTORE();
+    if (state->wsize || (state->mode < CHECK && out != strm->avail_out))
+        if (updatewindow(strm, out)) {
+            state->mode = MEM;
+            return Z_MEM_ERROR;
+        }
+    in -= strm->avail_in;
+    out -= strm->avail_out;
+    strm->total_in += in;
+    strm->total_out += out;
+    state->total += out;
+    if (state->wrap && out)
+        strm->adler = state->check =
+            UPDATE(state->check, strm->next_out - out, out);
+    strm->data_type = state->bits + (state->last ? 64 : 0) +
+                      (state->mode == TYPE ? 128 : 0);
+    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
+        ret = Z_BUF_ERROR;
+    return ret;
+}
+
+int ZEXPORT inflateEnd(strm)
+z_streamp strm;
+{
+    struct inflate_state FAR *state;
+    if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
+        return Z_STREAM_ERROR;
+    state = (struct inflate_state FAR *)strm->state;
+    if (state->window != Z_NULL) ZFREE(strm, state->window);
+    ZFREE(strm, strm->state);
+    strm->state = Z_NULL;
+    Tracev((stderr, "inflate: end\n"));
+    return Z_OK;
+}
+
+int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
+z_streamp strm;
+const Bytef *dictionary;
+uInt dictLength;
+{
+    struct inflate_state FAR *state;
+    unsigned long id;
+
+    /* check state */
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+    state = (struct inflate_state FAR *)strm->state;
+    if (state->wrap != 0 && state->mode != DICT)
+        return Z_STREAM_ERROR;
+
+    /* check for correct dictionary id */
+    if (state->mode == DICT) {
+        id = adler32(0L, Z_NULL, 0);
+        id = adler32(id, dictionary, dictLength);
+        if (id != state->check)
+            return Z_DATA_ERROR;
+    }
+
+    /* copy dictionary to window */
+    if (updatewindow(strm, strm->avail_out)) {
+        state->mode = MEM;
+        return Z_MEM_ERROR;
+    }
+    if (dictLength > state->wsize) {
+        zmemcpy(state->window, dictionary + dictLength - state->wsize,
+                state->wsize);
+        state->whave = state->wsize;
+    }
+    else {
+        zmemcpy(state->window + state->wsize - dictLength, dictionary,
+                dictLength);
+        state->whave = dictLength;
+    }
+    state->havedict = 1;
+    Tracev((stderr, "inflate:   dictionary set\n"));
+    return Z_OK;
+}
+
+int ZEXPORT inflateGetHeader(strm, head)
+z_streamp strm;
+gz_headerp head;
+{
+    struct inflate_state FAR *state;
+
+    /* check state */
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+    state = (struct inflate_state FAR *)strm->state;
+    if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
+
+    /* save header structure */
+    state->head = head;
+    head->done = 0;
+    return Z_OK;
+}
+
+/*
+   Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff.  Return when found
+   or when out of input.  When called, *have is the number of pattern bytes
+   found in order so far, in 0..3.  On return *have is updated to the new
+   state.  If on return *have equals four, then the pattern was found and the
+   return value is how many bytes were read including the last byte of the
+   pattern.  If *have is less than four, then the pattern has not been found
+   yet and the return value is len.  In the latter case, syncsearch() can be
+   called again with more data and the *have state.  *have is initialized to
+   zero for the first call.
+ */
+local unsigned syncsearch(have, buf, len)
+unsigned FAR *have;
+unsigned char FAR *buf;
+unsigned len;
+{
+    unsigned got;
+    unsigned next;
+
+    got = *have;
+    next = 0;
+    while (next < len && got < 4) {
+        if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
+            got++;
+        else if (buf[next])
+            got = 0;
+        else
+            got = 4 - got;
+        next++;
+    }
+    *have = got;
+    return next;
+}
+
+int ZEXPORT inflateSync(strm)
+z_streamp strm;
+{
+    unsigned len;               /* number of bytes to look at or looked at */
+    unsigned long in, out;      /* temporary to save total_in and total_out */
+    unsigned char buf[4];       /* to restore bit buffer to byte string */
+    struct inflate_state FAR *state;
+
+    /* check parameters */
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+    state = (struct inflate_state FAR *)strm->state;
+    if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
+
+    /* if first time, start search in bit buffer */
+    if (state->mode != SYNC) {
+        state->mode = SYNC;
+        state->hold <<= state->bits & 7;
+        state->bits -= state->bits & 7;
+        len = 0;
+        while (state->bits >= 8) {
+            buf[len++] = (unsigned char)(state->hold);
+            state->hold >>= 8;
+            state->bits -= 8;
+        }
+        state->have = 0;
+        syncsearch(&(state->have), buf, len);
+    }
+
+    /* search available input */
+    len = syncsearch(&(state->have), strm->next_in, strm->avail_in);
+    strm->avail_in -= len;
+    strm->next_in += len;
+    strm->total_in += len;
+
+    /* return no joy or set up to restart inflate() on a new block */
+    if (state->have != 4) return Z_DATA_ERROR;
+    in = strm->total_in;  out = strm->total_out;
+    inflateReset(strm);
+    strm->total_in = in;  strm->total_out = out;
+    state->mode = TYPE;
+    return Z_OK;
+}
+
+/*
+   Returns true if inflate is currently at the end of a block generated by
+   Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
+   implementation to provide an additional safety check. PPP uses
+   Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored
+   block. When decompressing, PPP checks that at the end of input packet,
+   inflate is waiting for these length bytes.
+ */
+int ZEXPORT inflateSyncPoint(strm)
+z_streamp strm;
+{
+    struct inflate_state FAR *state;
+
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+    state = (struct inflate_state FAR *)strm->state;
+    return state->mode == STORED && state->bits == 0;
+}
+
+int ZEXPORT inflateCopy(dest, source)
+z_streamp dest;
+z_streamp source;
+{
+    struct inflate_state FAR *state;
+    struct inflate_state FAR *copy;
+    unsigned char FAR *window;
+    unsigned wsize;
+
+    /* check input */
+    if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
+        source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
+        return Z_STREAM_ERROR;
+    state = (struct inflate_state FAR *)source->state;
+
+    /* allocate space */
+    copy = (struct inflate_state FAR *)
+           ZALLOC(source, 1, sizeof(struct inflate_state));
+    if (copy == Z_NULL) return Z_MEM_ERROR;
+    window = Z_NULL;
+    if (state->window != Z_NULL) {
+        window = (unsigned char FAR *)
+                 ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
+        if (window == Z_NULL) {
+            ZFREE(source, copy);
+            return Z_MEM_ERROR;
+        }
+    }
+
+    /* copy state */
+    zmemcpy(dest, source, sizeof(z_stream));
+    zmemcpy(copy, state, sizeof(struct inflate_state));
+    if (state->lencode >= state->codes &&
+        state->lencode <= state->codes + ENOUGH - 1) {
+        copy->lencode = copy->codes + (state->lencode - state->codes);
+        copy->distcode = copy->codes + (state->distcode - state->codes);
+    }
+    copy->next = copy->codes + (state->next - state->codes);
+    if (window != Z_NULL) {
+        wsize = 1U << state->wbits;
+        zmemcpy(window, state->window, wsize);
+    }
+    copy->window = window;
+    dest->state = (struct internal_state FAR *)copy;
+    return Z_OK;
+}

Added: branches/vendor/emile/libgzip/inflate.h
===================================================================
--- branches/vendor/emile/libgzip/inflate.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libgzip/inflate.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,115 @@
+/* inflate.h -- internal inflate state definition
+ * Copyright (C) 1995-2004 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+/* define NO_GZIP when compiling if you want to disable gzip header and
+   trailer decoding by inflate().  NO_GZIP would be used to avoid linking in
+   the crc code when it is not needed.  For shared libraries, gzip decoding
+   should be left enabled. */
+#ifndef NO_GZIP
+#  define GUNZIP
+#endif
+
+/* Possible inflate modes between inflate() calls */
+typedef enum {
+    HEAD,       /* i: waiting for magic header */
+    FLAGS,      /* i: waiting for method and flags (gzip) */
+    TIME,       /* i: waiting for modification time (gzip) */
+    OS,         /* i: waiting for extra flags and operating system (gzip) */
+    EXLEN,      /* i: waiting for extra length (gzip) */
+    EXTRA,      /* i: waiting for extra bytes (gzip) */
+    NAME,       /* i: waiting for end of file name (gzip) */
+    COMMENT,    /* i: waiting for end of comment (gzip) */
+    HCRC,       /* i: waiting for header crc (gzip) */
+    DICTID,     /* i: waiting for dictionary check value */
+    DICT,       /* waiting for inflateSetDictionary() call */
+        TYPE,       /* i: waiting for type bits, including last-flag bit */
+        TYPEDO,     /* i: same, but skip check to exit inflate on new block */
+        STORED,     /* i: waiting for stored size (length and complement) */
+        COPY,       /* i/o: waiting for input or output to copy stored block */
+        TABLE,      /* i: waiting for dynamic block table lengths */
+        LENLENS,    /* i: waiting for code length code lengths */
+        CODELENS,   /* i: waiting for length/lit and distance code lengths */
+            LEN,        /* i: waiting for length/lit code */
+            LENEXT,     /* i: waiting for length extra bits */
+            DIST,       /* i: waiting for distance code */
+            DISTEXT,    /* i: waiting for distance extra bits */
+            MATCH,      /* o: waiting for output space to copy string */
+            LIT,        /* o: waiting for output space to write literal */
+    CHECK,      /* i: waiting for 32-bit check value */
+    LENGTH,     /* i: waiting for 32-bit length (gzip) */
+    DONE,       /* finished check, done -- remain here until reset */
+    BAD,        /* got a data error -- remain here until reset */
+    MEM,        /* got an inflate() memory error -- remain here until reset */
+    SYNC        /* looking for synchronization bytes to restart inflate() */
+} inflate_mode;
+
+/*
+    State transitions between above modes -
+
+    (most modes can go to the BAD or MEM mode -- not shown for clarity)
+
+    Process header:
+        HEAD -> (gzip) or (zlib)
+        (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME
+        NAME -> COMMENT -> HCRC -> TYPE
+        (zlib) -> DICTID or TYPE
+        DICTID -> DICT -> TYPE
+    Read deflate blocks:
+            TYPE -> STORED or TABLE or LEN or CHECK
+            STORED -> COPY -> TYPE
+            TABLE -> LENLENS -> CODELENS -> LEN
+    Read deflate codes:
+                LEN -> LENEXT or LIT or TYPE
+                LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
+                LIT -> LEN
+    Process trailer:
+        CHECK -> LENGTH -> DONE
+ */
+
+/* state maintained between inflate() calls.  Approximately 7K bytes. */
+struct inflate_state {
+    inflate_mode mode;          /* current inflate mode */
+    int last;                   /* true if processing last block */
+    int wrap;                   /* bit 0 true for zlib, bit 1 true for gzip */
+    int havedict;               /* true if dictionary provided */
+    int flags;                  /* gzip header method and flags (0 if zlib) */
+    unsigned dmax;              /* zlib header max distance (INFLATE_STRICT) */
+    unsigned long check;        /* protected copy of check value */
+    unsigned long total;        /* protected copy of output count */
+    gz_headerp head;            /* where to save gzip header information */
+        /* sliding window */
+    unsigned wbits;             /* log base 2 of requested window size */
+    unsigned wsize;             /* window size or zero if not using window */
+    unsigned whave;             /* valid bytes in the window */
+    unsigned write;             /* window write index */
+    unsigned char FAR *window;  /* allocated sliding window, if needed */
+        /* bit accumulator */
+    unsigned long hold;         /* input bit accumulator */
+    unsigned bits;              /* number of bits in "in" */
+        /* for string and stored block copying */
+    unsigned length;            /* literal or length of data to copy */
+    unsigned offset;            /* distance back to copy string from */
+        /* for table and code decoding */
+    unsigned extra;             /* extra bits needed */
+        /* fixed and dynamic code tables */
+    code const FAR *lencode;    /* starting table for length/literal codes */
+    code const FAR *distcode;   /* starting table for distance codes */
+    unsigned lenbits;           /* index bits for lencode */
+    unsigned distbits;          /* index bits for distcode */
+        /* dynamic table building */
+    unsigned ncode;             /* number of code length code lengths */
+    unsigned nlen;              /* number of length code lengths */
+    unsigned ndist;             /* number of distance code lengths */
+    unsigned have;              /* number of code lengths in lens[] */
+    code FAR *next;             /* next available space in codes[] */
+    unsigned short lens[320];   /* temporary storage for code lengths */
+    unsigned short work[288];   /* work area for code table building */
+    code codes[ENOUGH];         /* space for code tables */
+};

Added: branches/vendor/emile/libgzip/inftrees.c
===================================================================
--- branches/vendor/emile/libgzip/inftrees.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libgzip/inftrees.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,329 @@
+/* inftrees.c -- generate Huffman trees for efficient decoding
+ * Copyright (C) 1995-2005 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zutil.h"
+#include "inftrees.h"
+
+#define MAXBITS 15
+
+const char inflate_copyright[] =
+   " inflate 1.2.3 Copyright 1995-2005 Mark Adler ";
+/*
+  If you use the zlib library in a product, an acknowledgment is welcome
+  in the documentation of your product. If for some reason you cannot
+  include such an acknowledgment, I would appreciate that you keep this
+  copyright string in the executable of your product.
+ */
+
+/*
+   Build a set of tables to decode the provided canonical Huffman code.
+   The code lengths are lens[0..codes-1].  The result starts at *table,
+   whose indices are 0..2^bits-1.  work is a writable array of at least
+   lens shorts, which is used as a work area.  type is the type of code
+   to be generated, CODES, LENS, or DISTS.  On return, zero is success,
+   -1 is an invalid code, and +1 means that ENOUGH isn't enough.  table
+   on return points to the next available entry's address.  bits is the
+   requested root table index bits, and on return it is the actual root
+   table index bits.  It will differ if the request is greater than the
+   longest code or if it is less than the shortest code.
+ */
+int inflate_table(type, lens, codes, table, bits, work)
+codetype type;
+unsigned short FAR *lens;
+unsigned codes;
+code FAR * FAR *table;
+unsigned FAR *bits;
+unsigned short FAR *work;
+{
+    unsigned len;               /* a code's length in bits */
+    unsigned sym;               /* index of code symbols */
+    unsigned min, max;          /* minimum and maximum code lengths */
+    unsigned root;              /* number of index bits for root table */
+    unsigned curr;              /* number of index bits for current table */
+    unsigned drop;              /* code bits to drop for sub-table */
+    int left;                   /* number of prefix codes available */
+    unsigned used;              /* code entries in table used */
+    unsigned huff;              /* Huffman code */
+    unsigned incr;              /* for incrementing code, index */
+    unsigned fill;              /* index for replicating entries */
+    unsigned low;               /* low bits for current root entry */
+    unsigned mask;              /* mask for low root bits */
+    code this;                  /* table entry for duplication */
+    code FAR *next;             /* next available space in table */
+    const unsigned short FAR *base;     /* base value table to use */
+    const unsigned short FAR *extra;    /* extra bits table to use */
+    int end;                    /* use base and extra for symbol > end */
+    unsigned short count[MAXBITS+1];    /* number of codes of each length */
+    unsigned short offs[MAXBITS+1];     /* offsets in table for each length */
+    static const unsigned short lbase[31] = { /* Length codes 257..285 base */
+        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
+        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
+    static const unsigned short lext[31] = { /* Length codes 257..285 extra */
+        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
+        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196};
+    static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
+        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
+        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
+        8193, 12289, 16385, 24577, 0, 0};
+    static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
+        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
+        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
+        28, 28, 29, 29, 64, 64};
+
+    /*
+       Process a set of code lengths to create a canonical Huffman code.  The
+       code lengths are lens[0..codes-1].  Each length corresponds to the
+       symbols 0..codes-1.  The Huffman code is generated by first sorting the
+       symbols by length from short to long, and retaining the symbol order
+       for codes with equal lengths.  Then the code starts with all zero bits
+       for the first code of the shortest length, and the codes are integer
+       increments for the same length, and zeros are appended as the length
+       increases.  For the deflate format, these bits are stored backwards
+       from their more natural integer increment ordering, and so when the
+       decoding tables are built in the large loop below, the integer codes
+       are incremented backwards.
+
+       This routine assumes, but does not check, that all of the entries in
+       lens[] are in the range 0..MAXBITS.  The caller must assure this.
+       1..MAXBITS is interpreted as that code length.  zero means that that
+       symbol does not occur in this code.
+
+       The codes are sorted by computing a count of codes for each length,
+       creating from that a table of starting indices for each length in the
+       sorted table, and then entering the symbols in order in the sorted
+       table.  The sorted table is work[], with that space being provided by
+       the caller.
+
+       The length counts are used for other purposes as well, i.e. finding
+       the minimum and maximum length codes, determining if there are any
+       codes at all, checking for a valid set of lengths, and looking ahead
+       at length counts to determine sub-table sizes when building the
+       decoding tables.
+     */
+
+    /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
+    for (len = 0; len <= MAXBITS; len++)
+        count[len] = 0;
+    for (sym = 0; sym < codes; sym++)
+        count[lens[sym]]++;
+
+    /* bound code lengths, force root to be within code lengths */
+    root = *bits;
+    for (max = MAXBITS; max >= 1; max--)
+        if (count[max] != 0) break;
+    if (root > max) root = max;
+    if (max == 0) {                     /* no symbols to code at all */
+        this.op = (unsigned char)64;    /* invalid code marker */
+        this.bits = (unsigned char)1;
+        this.val = (unsigned short)0;
+        *(*table)++ = this;             /* make a table to force an error */
+        *(*table)++ = this;
+        *bits = 1;
+        return 0;     /* no symbols, but wait for decoding to report error */
+    }
+    for (min = 1; min <= MAXBITS; min++)
+        if (count[min] != 0) break;
+    if (root < min) root = min;
+
+    /* check for an over-subscribed or incomplete set of lengths */
+    left = 1;
+    for (len = 1; len <= MAXBITS; len++) {
+        left <<= 1;
+        left -= count[len];
+        if (left < 0) return -1;        /* over-subscribed */
+    }
+    if (left > 0 && (type == CODES || max != 1))
+        return -1;                      /* incomplete set */
+
+    /* generate offsets into symbol table for each length for sorting */
+    offs[1] = 0;
+    for (len = 1; len < MAXBITS; len++)
+        offs[len + 1] = offs[len] + count[len];
+
+    /* sort symbols by length, by symbol order within each length */
+    for (sym = 0; sym < codes; sym++)
+        if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
+
+    /*
+       Create and fill in decoding tables.  In this loop, the table being
+       filled is at next and has curr index bits.  The code being used is huff
+       with length len.  That code is converted to an index by dropping drop
+       bits off of the bottom.  For codes where len is less than drop + curr,
+       those top drop + curr - len bits are incremented through all values to
+       fill the table with replicated entries.
+
+       root is the number of index bits for the root table.  When len exceeds
+       root, sub-tables are created pointed to by the root entry with an index
+       of the low root bits of huff.  This is saved in low to check for when a
+       new sub-table should be started.  drop is zero when the root table is
+       being filled, and drop is root when sub-tables are being filled.
+
+       When a new sub-table is needed, it is necessary to look ahead in the
+       code lengths to determine what size sub-table is needed.  The length
+       counts are used for this, and so count[] is decremented as codes are
+       entered in the tables.
+
+       used keeps track of how many table entries have been allocated from the
+       provided *table space.  It is checked when a LENS table is being made
+       against the space in *table, ENOUGH, minus the maximum space needed by
+       the worst case distance code, MAXD.  This should never happen, but the
+       sufficiency of ENOUGH has not been proven exhaustively, hence the check.
+       This assumes that when type == LENS, bits == 9.
+
+       sym increments through all symbols, and the loop terminates when
+       all codes of length max, i.e. all codes, have been processed.  This
+       routine permits incomplete codes, so another loop after this one fills
+       in the rest of the decoding tables with invalid code markers.
+     */
+
+    /* set up for code type */
+    switch (type) {
+    case CODES:
+        base = extra = work;    /* dummy value--not used */
+        end = 19;
+        break;
+    case LENS:
+        base = lbase;
+        base -= 257;
+        extra = lext;
+        extra -= 257;
+        end = 256;
+        break;
+    default:            /* DISTS */
+        base = dbase;
+        extra = dext;
+        end = -1;
+    }
+
+    /* initialize state for loop */
+    huff = 0;                   /* starting code */
+    sym = 0;                    /* starting code symbol */
+    len = min;                  /* starting code length */
+    next = *table;              /* current table to fill in */
+    curr = root;                /* current table index bits */
+    drop = 0;                   /* current bits to drop from code for index */
+    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
+    used = 1U << root;          /* use root table entries */
+    mask = used - 1;            /* mask for comparing low */
+
+    /* check available table space */
+    if (type == LENS && used >= ENOUGH - MAXD)
+        return 1;
+
+    /* process all codes and make table entries */
+    for (;;) {
+        /* create table entry */
+        this.bits = (unsigned char)(len - drop);
+        if ((int)(work[sym]) < end) {
+            this.op = (unsigned char)0;
+            this.val = work[sym];
+        }
+        else if ((int)(work[sym]) > end) {
+            this.op = (unsigned char)(extra[work[sym]]);
+            this.val = base[work[sym]];
+        }
+        else {
+            this.op = (unsigned char)(32 + 64);         /* end of block */
+            this.val = 0;
+        }
+
+        /* replicate for those indices with low len bits equal to huff */
+        incr = 1U << (len - drop);
+        fill = 1U << curr;
+        min = fill;                 /* save offset to next table */
+        do {
+            fill -= incr;
+            next[(huff >> drop) + fill] = this;
+        } while (fill != 0);
+
+        /* backwards increment the len-bit code huff */
+        incr = 1U << (len - 1);
+        while (huff & incr)
+            incr >>= 1;
+        if (incr != 0) {
+            huff &= incr - 1;
+            huff += incr;
+        }
+        else
+            huff = 0;
+
+        /* go to next symbol, update count, len */
+        sym++;
+        if (--(count[len]) == 0) {
+            if (len == max) break;
+            len = lens[work[sym]];
+        }
+
+        /* create new sub-table if needed */
+        if (len > root && (huff & mask) != low) {
+            /* if first time, transition to sub-tables */
+            if (drop == 0)
+                drop = root;
+
+            /* increment past last table */
+            next += min;            /* here min is 1 << curr */
+
+            /* determine length of next table */
+            curr = len - drop;
+            left = (int)(1 << curr);
+            while (curr + drop < max) {
+                left -= count[curr + drop];
+                if (left <= 0) break;
+                curr++;
+                left <<= 1;
+            }
+
+            /* check for enough space */
+            used += 1U << curr;
+            if (type == LENS && used >= ENOUGH - MAXD)
+                return 1;
+
+            /* point entry in root table to sub-table */
+            low = huff & mask;
+            (*table)[low].op = (unsigned char)curr;
+            (*table)[low].bits = (unsigned char)root;
+            (*table)[low].val = (unsigned short)(next - *table);
+        }
+    }
+
+    /*
+       Fill in rest of table for incomplete codes.  This loop is similar to the
+       loop above in incrementing huff for table indices.  It is assumed that
+       len is equal to curr + drop, so there is no loop needed to increment
+       through high index bits.  When the current sub-table is filled, the loop
+       drops back to the root table to fill in any remaining entries there.
+     */
+    this.op = (unsigned char)64;                /* invalid code marker */
+    this.bits = (unsigned char)(len - drop);
+    this.val = (unsigned short)0;
+    while (huff != 0) {
+        /* when done with sub-table, drop back to root table */
+        if (drop != 0 && (huff & mask) != low) {
+            drop = 0;
+            len = root;
+            next = *table;
+            this.bits = (unsigned char)len;
+        }
+
+        /* put invalid code marker in table */
+        next[huff >> drop] = this;
+
+        /* backwards increment the len-bit code huff */
+        incr = 1U << (len - 1);
+        while (huff & incr)
+            incr >>= 1;
+        if (incr != 0) {
+            huff &= incr - 1;
+            huff += incr;
+        }
+        else
+            huff = 0;
+    }
+
+    /* set return parameters */
+    *table += used;
+    *bits = root;
+    return 0;
+}

Added: branches/vendor/emile/libgzip/inftrees.h
===================================================================
--- branches/vendor/emile/libgzip/inftrees.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libgzip/inftrees.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,55 @@
+/* inftrees.h -- header to use inftrees.c
+ * Copyright (C) 1995-2005 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+/* Structure for decoding tables.  Each entry provides either the
+   information needed to do the operation requested by the code that
+   indexed that table entry, or it provides a pointer to another
+   table that indexes more bits of the code.  op indicates whether
+   the entry is a pointer to another table, a literal, a length or
+   distance, an end-of-block, or an invalid code.  For a table
+   pointer, the low four bits of op is the number of index bits of
+   that table.  For a length or distance, the low four bits of op
+   is the number of extra bits to get after the code.  bits is
+   the number of bits in this code or part of the code to drop off
+   of the bit buffer.  val is the actual byte to output in the case
+   of a literal, the base length or distance, or the offset from
+   the current table to the next table.  Each entry is four bytes. */
+typedef struct {
+    unsigned char op;           /* operation, extra bits, table bits */
+    unsigned char bits;         /* bits in this part of the code */
+    unsigned short val;         /* offset in table or code value */
+} code;
+
+/* op values as set by inflate_table():
+    00000000 - literal
+    0000tttt - table link, tttt != 0 is the number of table index bits
+    0001eeee - length or distance, eeee is the number of extra bits
+    01100000 - end of block
+    01000000 - invalid code
+ */
+
+/* Maximum size of dynamic tree.  The maximum found in a long but non-
+   exhaustive search was 1444 code structures (852 for length/literals
+   and 592 for distances, the latter actually the result of an
+   exhaustive search).  The true maximum is not known, but the value
+   below is more than safe. */
+#define ENOUGH 2048
+#define MAXD 592
+
+/* Type of code to build for inftable() */
+typedef enum {
+    CODES,
+    LENS,
+    DISTS
+} codetype;
+
+extern int inflate_table OF((codetype type, unsigned short FAR *lens,
+                             unsigned codes, code FAR * FAR *table,
+                             unsigned FAR *bits, unsigned short FAR *work));

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

Added: branches/vendor/emile/libgzip/zlib.h
===================================================================
--- branches/vendor/emile/libgzip/zlib.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libgzip/zlib.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,1359 @@
+/* zlib.h -- interface of the 'zlib' general purpose compression library
+  version 1.2.3, July 18th, 2005
+
+  Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+  Jean-loup Gailly        Mark Adler
+  jloup at gzip.org          madler at alumni.caltech.edu
+
+
+  The data format used by the zlib library is described by RFCs (Request for
+  Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
+  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
+*/
+
+#ifndef ZLIB_H
+#define ZLIB_H
+
+#include "zconf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ZLIB_VERSION "1.2.3"
+#define ZLIB_VERNUM 0x1230
+
+/*
+     The 'zlib' compression library provides in-memory compression and
+  decompression functions, including integrity checks of the uncompressed
+  data.  This version of the library supports only one compression method
+  (deflation) but other algorithms will be added later and will have the same
+  stream interface.
+
+     Compression can be done in a single step if the buffers are large
+  enough (for example if an input file is mmap'ed), or can be done by
+  repeated calls of the compression function.  In the latter case, the
+  application must provide more input and/or consume the output
+  (providing more output space) before each call.
+
+     The compressed data format used by default by the in-memory functions is
+  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
+  around a deflate stream, which is itself documented in RFC 1951.
+
+     The library also supports reading and writing files in gzip (.gz) format
+  with an interface similar to that of stdio using the functions that start
+  with "gz".  The gzip format is different from the zlib format.  gzip is a
+  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
+
+     This library can optionally read and write gzip streams in memory as well.
+
+     The zlib format was designed to be compact and fast for use in memory
+  and on communications channels.  The gzip format was designed for single-
+  file compression on file systems, has a larger header than zlib to maintain
+  directory information, and uses a different, slower check method than zlib.
+
+     The library does not install any signal handler. The decoder checks
+  the consistency of the compressed data, so the library should never
+  crash even in case of corrupted input.
+*/
+
+typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
+typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
+
+struct internal_state;
+
+typedef struct z_stream_s {
+    Bytef    *next_in;  /* next input byte */
+    uInt     avail_in;  /* number of bytes available at next_in */
+    uLong    total_in;  /* total nb of input bytes read so far */
+
+    Bytef    *next_out; /* next output byte should be put there */
+    uInt     avail_out; /* remaining free space at next_out */
+    uLong    total_out; /* total nb of bytes output so far */
+
+    char     *msg;      /* last error message, NULL if no error */
+    struct internal_state FAR *state; /* not visible by applications */
+
+    alloc_func zalloc;  /* used to allocate the internal state */
+    free_func  zfree;   /* used to free the internal state */
+    voidpf     opaque;  /* private data object passed to zalloc and zfree */
+
+    int     data_type;  /* best guess about the data type: binary or text */
+    uLong   adler;      /* adler32 value of the uncompressed data */
+    uLong   reserved;   /* reserved for future use */
+} z_stream;
+
+typedef z_stream FAR *z_streamp;
+
+/*
+     gzip header information passed to and from zlib routines.  See RFC 1952
+  for more details on the meanings of these fields.
+*/
+typedef struct gz_header_s {
+    int     text;       /* true if compressed data believed to be text */
+    uLong   time;       /* modification time */
+    int     xflags;     /* extra flags (not used when writing a gzip file) */
+    int     os;         /* operating system */
+    Bytef   *extra;     /* pointer to extra field or Z_NULL if none */
+    uInt    extra_len;  /* extra field length (valid if extra != Z_NULL) */
+    uInt    extra_max;  /* space at extra (only when reading header) */
+    Bytef   *name;      /* pointer to zero-terminated file name or Z_NULL */
+    uInt    name_max;   /* space at name (only when reading header) */
+    Bytef   *comment;   /* pointer to zero-terminated comment or Z_NULL */
+    uInt    comm_max;   /* space at comment (only when reading header) */
+    int     hcrc;       /* true if there was or will be a header crc */
+    int     done;       /* true when done reading gzip header (not used
+                           when writing a gzip file) */
+} gz_header;
+
+typedef gz_header FAR *gz_headerp;
+
+/*
+   The application must update next_in and avail_in when avail_in has
+   dropped to zero. It must update next_out and avail_out when avail_out
+   has dropped to zero. The application must initialize zalloc, zfree and
+   opaque before calling the init function. All other fields are set by the
+   compression library and must not be updated by the application.
+
+   The opaque value provided by the application will be passed as the first
+   parameter for calls of zalloc and zfree. This can be useful for custom
+   memory management. The compression library attaches no meaning to the
+   opaque value.
+
+   zalloc must return Z_NULL if there is not enough memory for the object.
+   If zlib is used in a multi-threaded application, zalloc and zfree must be
+   thread safe.
+
+   On 16-bit systems, the functions zalloc and zfree must be able to allocate
+   exactly 65536 bytes, but will not be required to allocate more than this
+   if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
+   pointers returned by zalloc for objects of exactly 65536 bytes *must*
+   have their offset normalized to zero. The default allocation function
+   provided by this library ensures this (see zutil.c). To reduce memory
+   requirements and avoid any allocation of 64K objects, at the expense of
+   compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
+
+   The fields total_in and total_out can be used for statistics or
+   progress reports. After compression, total_in holds the total size of
+   the uncompressed data and may be saved for use in the decompressor
+   (particularly if the decompressor wants to decompress everything in
+   a single step).
+*/
+
+                        /* constants */
+
+#define Z_NO_FLUSH      0
+#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
+#define Z_SYNC_FLUSH    2
+#define Z_FULL_FLUSH    3
+#define Z_FINISH        4
+#define Z_BLOCK         5
+/* Allowed flush values; see deflate() and inflate() below for details */
+
+#define Z_OK            0
+#define Z_STREAM_END    1
+#define Z_NEED_DICT     2
+#define Z_ERRNO        (-1)
+#define Z_STREAM_ERROR (-2)
+#define Z_DATA_ERROR   (-3)
+#define Z_MEM_ERROR    (-4)
+#define Z_BUF_ERROR    (-5)
+#define Z_VERSION_ERROR (-6)
+/* Return codes for the compression/decompression functions. Negative
+ * values are errors, positive values are used for special but normal events.
+ */
+
+#define Z_NO_COMPRESSION         0
+#define Z_BEST_SPEED             1
+#define Z_BEST_COMPRESSION       9
+#define Z_DEFAULT_COMPRESSION  (-1)
+/* compression levels */
+
+#define Z_FILTERED            1
+#define Z_HUFFMAN_ONLY        2
+#define Z_RLE                 3
+#define Z_FIXED               4
+#define Z_DEFAULT_STRATEGY    0
+/* compression strategy; see deflateInit2() below for details */
+
+#define Z_BINARY   0
+#define Z_TEXT     1
+#define Z_ASCII    Z_TEXT   /* for compatibility with 1.2.2 and earlier */
+#define Z_UNKNOWN  2
+/* Possible values of the data_type field (though see inflate()) */
+
+#define Z_DEFLATED   8
+/* The deflate compression method (the only one supported in this version) */
+
+#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
+
+#define zlib_version zlibVersion()
+/* for compatibility with versions < 1.0.2 */
+
+                        /* basic functions */
+
+ZEXTERN const char * ZEXPORT zlibVersion OF((void));
+/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
+   If the first character differs, the library code actually used is
+   not compatible with the zlib.h header file used by the application.
+   This check is automatically made by deflateInit and inflateInit.
+ */
+
+/*
+ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
+
+     Initializes the internal stream state for compression. The fields
+   zalloc, zfree and opaque must be initialized before by the caller.
+   If zalloc and zfree are set to Z_NULL, deflateInit updates them to
+   use default allocation functions.
+
+     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
+   1 gives best speed, 9 gives best compression, 0 gives no compression at
+   all (the input data is simply copied a block at a time).
+   Z_DEFAULT_COMPRESSION requests a default compromise between speed and
+   compression (currently equivalent to level 6).
+
+     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if level is not a valid compression level,
+   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
+   with the version assumed by the caller (ZLIB_VERSION).
+   msg is set to null if there is no error message.  deflateInit does not
+   perform any compression: this will be done by deflate().
+*/
+
+
+ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+/*
+    deflate compresses as much data as possible, and stops when the input
+  buffer becomes empty or the output buffer becomes full. It may introduce some
+  output latency (reading input without producing any output) except when
+  forced to flush.
+
+    The detailed semantics are as follows. deflate performs one or both of the
+  following actions:
+
+  - Compress more input starting at next_in and update next_in and avail_in
+    accordingly. If not all input can be processed (because there is not
+    enough room in the output buffer), next_in and avail_in are updated and
+    processing will resume at this point for the next call of deflate().
+
+  - Provide more output starting at next_out and update next_out and avail_out
+    accordingly. This action is forced if the parameter flush is non zero.
+    Forcing flush frequently degrades the compression ratio, so this parameter
+    should be set only when necessary (in interactive applications).
+    Some output may be provided even if flush is not set.
+
+  Before the call of deflate(), the application should ensure that at least
+  one of the actions is possible, by providing more input and/or consuming
+  more output, and updating avail_in or avail_out accordingly; avail_out
+  should never be zero before the call. The application can consume the
+  compressed output when it wants, for example when the output buffer is full
+  (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
+  and with zero avail_out, it must be called again after making room in the
+  output buffer because there might be more output pending.
+
+    Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
+  decide how much data to accumualte before producing output, in order to
+  maximize compression.
+
+    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
+  flushed to the output buffer and the output is aligned on a byte boundary, so
+  that the decompressor can get all input data available so far. (In particular
+  avail_in is zero after the call if enough output space has been provided
+  before the call.)  Flushing may degrade compression for some compression
+  algorithms and so it should be used only when necessary.
+
+    If flush is set to Z_FULL_FLUSH, all output is flushed as with
+  Z_SYNC_FLUSH, and the compression state is reset so that decompression can
+  restart from this point if previous compressed data has been damaged or if
+  random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
+  compression.
+
+    If deflate returns with avail_out == 0, this function must be called again
+  with the same value of the flush parameter and more output space (updated
+  avail_out), until the flush is complete (deflate returns with non-zero
+  avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
+  avail_out is greater than six to avoid repeated flush markers due to
+  avail_out == 0 on return.
+
+    If the parameter flush is set to Z_FINISH, pending input is processed,
+  pending output is flushed and deflate returns with Z_STREAM_END if there
+  was enough output space; if deflate returns with Z_OK, this function must be
+  called again with Z_FINISH and more output space (updated avail_out) but no
+  more input data, until it returns with Z_STREAM_END or an error. After
+  deflate has returned Z_STREAM_END, the only possible operations on the
+  stream are deflateReset or deflateEnd.
+
+    Z_FINISH can be used immediately after deflateInit if all the compression
+  is to be done in a single step. In this case, avail_out must be at least
+  the value returned by deflateBound (see below). If deflate does not return
+  Z_STREAM_END, then it must be called again as described above.
+
+    deflate() sets strm->adler to the adler32 checksum of all input read
+  so far (that is, total_in bytes).
+
+    deflate() may update strm->data_type if it can make a good guess about
+  the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
+  binary. This field is only for information purposes and does not affect
+  the compression algorithm in any manner.
+
+    deflate() returns Z_OK if some progress has been made (more input
+  processed or more output produced), Z_STREAM_END if all input has been
+  consumed and all output has been produced (only when flush is set to
+  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
+  if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
+  (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
+  fatal, and deflate() can be called again with more input and more output
+  space to continue compressing.
+*/
+
+
+ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+/*
+     All dynamically allocated data structures for this stream are freed.
+   This function discards any unprocessed input and does not flush any
+   pending output.
+
+     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
+   stream state was inconsistent, Z_DATA_ERROR if the stream was freed
+   prematurely (some input or output was discarded). In the error case,
+   msg may be set but then points to a static string (which must not be
+   deallocated).
+*/
+
+
+/*
+ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
+
+     Initializes the internal stream state for decompression. The fields
+   next_in, avail_in, zalloc, zfree and opaque must be initialized before by
+   the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
+   value depends on the compression method), inflateInit determines the
+   compression method from the zlib header and allocates all data structures
+   accordingly; otherwise the allocation will be deferred to the first call of
+   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to
+   use default allocation functions.
+
+     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+   version assumed by the caller.  msg is set to null if there is no error
+   message. inflateInit does not perform any decompression apart from reading
+   the zlib header if present: this will be done by inflate().  (So next_in and
+   avail_in may be modified, but next_out and avail_out are unchanged.)
+*/
+
+
+ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
+/*
+    inflate decompresses as much data as possible, and stops when the input
+  buffer becomes empty or the output buffer becomes full. It may introduce
+  some output latency (reading input without producing any output) except when
+  forced to flush.
+
+  The detailed semantics are as follows. inflate performs one or both of the
+  following actions:
+
+  - Decompress more input starting at next_in and update next_in and avail_in
+    accordingly. If not all input can be processed (because there is not
+    enough room in the output buffer), next_in is updated and processing
+    will resume at this point for the next call of inflate().
+
+  - Provide more output starting at next_out and update next_out and avail_out
+    accordingly.  inflate() provides as much output as possible, until there
+    is no more input data or no more space in the output buffer (see below
+    about the flush parameter).
+
+  Before the call of inflate(), the application should ensure that at least
+  one of the actions is possible, by providing more input and/or consuming
+  more output, and updating the next_* and avail_* values accordingly.
+  The application can consume the uncompressed output when it wants, for
+  example when the output buffer is full (avail_out == 0), or after each
+  call of inflate(). If inflate returns Z_OK and with zero avail_out, it
+  must be called again after making room in the output buffer because there
+  might be more output pending.
+
+    The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
+  Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much
+  output as possible to the output buffer. Z_BLOCK requests that inflate() stop
+  if and when it gets to the next deflate block boundary. When decoding the
+  zlib or gzip format, this will cause inflate() to return immediately after
+  the header and before the first block. When doing a raw inflate, inflate()
+  will go ahead and process the first block, and will return when it gets to
+  the end of that block, or when it runs out of data.
+
+    The Z_BLOCK option assists in appending to or combining deflate streams.
+  Also to assist in this, on return inflate() will set strm->data_type to the
+  number of unused bits in the last byte taken from strm->next_in, plus 64
+  if inflate() is currently decoding the last block in the deflate stream,
+  plus 128 if inflate() returned immediately after decoding an end-of-block
+  code or decoding the complete header up to just before the first byte of the
+  deflate stream. The end-of-block will not be indicated until all of the
+  uncompressed data from that block has been written to strm->next_out.  The
+  number of unused bits may in general be greater than seven, except when
+  bit 7 of data_type is set, in which case the number of unused bits will be
+  less than eight.
+
+    inflate() should normally be called until it returns Z_STREAM_END or an
+  error. However if all decompression is to be performed in a single step
+  (a single call of inflate), the parameter flush should be set to
+  Z_FINISH. In this case all pending input is processed and all pending
+  output is flushed; avail_out must be large enough to hold all the
+  uncompressed data. (The size of the uncompressed data may have been saved
+  by the compressor for this purpose.) The next operation on this stream must
+  be inflateEnd to deallocate the decompression state. The use of Z_FINISH
+  is never required, but can be used to inform inflate that a faster approach
+  may be used for the single inflate() call.
+
+     In this implementation, inflate() always flushes as much output as
+  possible to the output buffer, and always uses the faster approach on the
+  first call. So the only effect of the flush parameter in this implementation
+  is on the return value of inflate(), as noted below, or when it returns early
+  because Z_BLOCK is used.
+
+     If a preset dictionary is needed after this call (see inflateSetDictionary
+  below), inflate sets strm->adler to the adler32 checksum of the dictionary
+  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
+  strm->adler to the adler32 checksum of all output produced so far (that is,
+  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
+  below. At the end of the stream, inflate() checks that its computed adler32
+  checksum is equal to that saved by the compressor and returns Z_STREAM_END
+  only if the checksum is correct.
+
+    inflate() will decompress and check either zlib-wrapped or gzip-wrapped
+  deflate data.  The header type is detected automatically.  Any information
+  contained in the gzip header is not retained, so applications that need that
+  information should instead use raw inflate, see inflateInit2() below, or
+  inflateBack() and perform their own processing of the gzip header and
+  trailer.
+
+    inflate() returns Z_OK if some progress has been made (more input processed
+  or more output produced), Z_STREAM_END if the end of the compressed data has
+  been reached and all uncompressed output has been produced, Z_NEED_DICT if a
+  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
+  corrupted (input stream not conforming to the zlib format or incorrect check
+  value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
+  if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
+  Z_BUF_ERROR if no progress is possible or if there was not enough room in the
+  output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
+  inflate() can be called again with more input and more output space to
+  continue decompressing. If Z_DATA_ERROR is returned, the application may then
+  call inflateSync() to look for a good compression block if a partial recovery
+  of the data is desired.
+*/
+
+
+ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+/*
+     All dynamically allocated data structures for this stream are freed.
+   This function discards any unprocessed input and does not flush any
+   pending output.
+
+     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
+   was inconsistent. In the error case, msg may be set but then points to a
+   static string (which must not be deallocated).
+*/
+
+                        /* Advanced functions */
+
+/*
+    The following functions are needed only in some special applications.
+*/
+
+/*
+ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
+                                     int  level,
+                                     int  method,
+                                     int  windowBits,
+                                     int  memLevel,
+                                     int  strategy));
+
+     This is another version of deflateInit with more compression options. The
+   fields next_in, zalloc, zfree and opaque must be initialized before by
+   the caller.
+
+     The method parameter is the compression method. It must be Z_DEFLATED in
+   this version of the library.
+
+     The windowBits parameter is the base two logarithm of the window size
+   (the size of the history buffer). It should be in the range 8..15 for this
+   version of the library. Larger values of this parameter result in better
+   compression at the expense of memory usage. The default value is 15 if
+   deflateInit is used instead.
+
+     windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
+   determines the window size. deflate() will then generate raw deflate data
+   with no zlib header or trailer, and will not compute an adler32 check value.
+
+     windowBits can also be greater than 15 for optional gzip encoding. Add
+   16 to windowBits to write a simple gzip header and trailer around the
+   compressed data instead of a zlib wrapper. The gzip header will have no
+   file name, no extra data, no comment, no modification time (set to zero),
+   no header crc, and the operating system will be set to 255 (unknown).  If a
+   gzip stream is being written, strm->adler is a crc32 instead of an adler32.
+
+     The memLevel parameter specifies how much memory should be allocated
+   for the internal compression state. memLevel=1 uses minimum memory but
+   is slow and reduces compression ratio; memLevel=9 uses maximum memory
+   for optimal speed. The default value is 8. See zconf.h for total memory
+   usage as a function of windowBits and memLevel.
+
+     The strategy parameter is used to tune the compression algorithm. Use the
+   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
+   filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
+   string match), or Z_RLE to limit match distances to one (run-length
+   encoding). Filtered data consists mostly of small values with a somewhat
+   random distribution. In this case, the compression algorithm is tuned to
+   compress them better. The effect of Z_FILTERED is to force more Huffman
+   coding and less string matching; it is somewhat intermediate between
+   Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as
+   Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
+   parameter only affects the compression ratio but not the correctness of the
+   compressed output even if it is not set appropriately.  Z_FIXED prevents the
+   use of dynamic Huffman codes, allowing for a simpler decoder for special
+   applications.
+
+      deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
+   method). msg is set to null if there is no error message.  deflateInit2 does
+   not perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
+                                             const Bytef *dictionary,
+                                             uInt  dictLength));
+/*
+     Initializes the compression dictionary from the given byte sequence
+   without producing any compressed output. This function must be called
+   immediately after deflateInit, deflateInit2 or deflateReset, before any
+   call of deflate. The compressor and decompressor must use exactly the same
+   dictionary (see inflateSetDictionary).
+
+     The dictionary should consist of strings (byte sequences) that are likely
+   to be encountered later in the data to be compressed, with the most commonly
+   used strings preferably put towards the end of the dictionary. Using a
+   dictionary is most useful when the data to be compressed is short and can be
+   predicted with good accuracy; the data can then be compressed better than
+   with the default empty dictionary.
+
+     Depending on the size of the compression data structures selected by
+   deflateInit or deflateInit2, a part of the dictionary may in effect be
+   discarded, for example if the dictionary is larger than the window size in
+   deflate or deflate2. Thus the strings most likely to be useful should be
+   put at the end of the dictionary, not at the front. In addition, the
+   current implementation of deflate will use at most the window size minus
+   262 bytes of the provided dictionary.
+
+     Upon return of this function, strm->adler is set to the adler32 value
+   of the dictionary; the decompressor may later use this value to determine
+   which dictionary has been used by the compressor. (The adler32 value
+   applies to the whole dictionary even if only a subset of the dictionary is
+   actually used by the compressor.) If a raw deflate was requested, then the
+   adler32 value is not computed and strm->adler is not set.
+
+     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
+   parameter is invalid (such as NULL dictionary) or the stream state is
+   inconsistent (for example if deflate has already been called for this stream
+   or if the compression method is bsort). deflateSetDictionary does not
+   perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
+                                    z_streamp source));
+/*
+     Sets the destination stream as a complete copy of the source stream.
+
+     This function can be useful when several compression strategies will be
+   tried, for example when there are several ways of pre-processing the input
+   data with a filter. The streams that will be discarded should then be freed
+   by calling deflateEnd.  Note that deflateCopy duplicates the internal
+   compression state which can be quite large, so this strategy is slow and
+   can consume lots of memory.
+
+     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+   (such as zalloc being NULL). msg is left unchanged in both source and
+   destination.
+*/
+
+ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+/*
+     This function is equivalent to deflateEnd followed by deflateInit,
+   but does not free and reallocate all the internal compression state.
+   The stream will keep the same compression level and any other attributes
+   that may have been set by deflateInit2.
+
+      deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
+                                      int level,
+                                      int strategy));
+/*
+     Dynamically update the compression level and compression strategy.  The
+   interpretation of level and strategy is as in deflateInit2.  This can be
+   used to switch between compression and straight copy of the input data, or
+   to switch to a different kind of input data requiring a different
+   strategy. If the compression level is changed, the input available so far
+   is compressed with the old level (and may be flushed); the new level will
+   take effect only at the next call of deflate().
+
+     Before the call of deflateParams, the stream state must be set as for
+   a call of deflate(), since the currently available input may have to
+   be compressed and flushed. In particular, strm->avail_out must be non-zero.
+
+     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
+   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
+   if strm->avail_out was zero.
+*/
+
+ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
+                                    int good_length,
+                                    int max_lazy,
+                                    int nice_length,
+                                    int max_chain));
+/*
+     Fine tune deflate's internal compression parameters.  This should only be
+   used by someone who understands the algorithm used by zlib's deflate for
+   searching for the best matching string, and even then only by the most
+   fanatic optimizer trying to squeeze out the last compressed bit for their
+   specific input data.  Read the deflate.c source code for the meaning of the
+   max_lazy, good_length, nice_length, and max_chain parameters.
+
+     deflateTune() can be called after deflateInit() or deflateInit2(), and
+   returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
+ */
+
+ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
+                                       uLong sourceLen));
+/*
+     deflateBound() returns an upper bound on the compressed size after
+   deflation of sourceLen bytes.  It must be called after deflateInit()
+   or deflateInit2().  This would be used to allocate an output buffer
+   for deflation in a single pass, and so would be called before deflate().
+*/
+
+ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
+                                     int bits,
+                                     int value));
+/*
+     deflatePrime() inserts bits in the deflate output stream.  The intent
+  is that this function is used to start off the deflate output with the
+  bits leftover from a previous deflate stream when appending to it.  As such,
+  this function can only be used for raw deflate, and must be used before the
+  first deflate() call after a deflateInit2() or deflateReset().  bits must be
+  less than or equal to 16, and that many of the least significant bits of
+  value will be inserted in the output.
+
+      deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
+                                         gz_headerp head));
+/*
+      deflateSetHeader() provides gzip header information for when a gzip
+   stream is requested by deflateInit2().  deflateSetHeader() may be called
+   after deflateInit2() or deflateReset() and before the first call of
+   deflate().  The text, time, os, extra field, name, and comment information
+   in the provided gz_header structure are written to the gzip header (xflag is
+   ignored -- the extra flags are set according to the compression level).  The
+   caller must assure that, if not Z_NULL, name and comment are terminated with
+   a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
+   available there.  If hcrc is true, a gzip header crc is included.  Note that
+   the current versions of the command-line version of gzip (up through version
+   1.3.x) do not support header crc's, and will report that it is a "multi-part
+   gzip file" and give up.
+
+      If deflateSetHeader is not used, the default gzip header has text false,
+   the time set to zero, and os set to 255, with no extra, name, or comment
+   fields.  The gzip header is returned to the default state by deflateReset().
+
+      deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
+                                     int  windowBits));
+
+     This is another version of inflateInit with an extra parameter. The
+   fields next_in, avail_in, zalloc, zfree and opaque must be initialized
+   before by the caller.
+
+     The windowBits parameter is the base two logarithm of the maximum window
+   size (the size of the history buffer).  It should be in the range 8..15 for
+   this version of the library. The default value is 15 if inflateInit is used
+   instead. windowBits must be greater than or equal to the windowBits value
+   provided to deflateInit2() while compressing, or it must be equal to 15 if
+   deflateInit2() was not used. If a compressed stream with a larger window
+   size is given as input, inflate() will return with the error code
+   Z_DATA_ERROR instead of trying to allocate a larger window.
+
+     windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
+   determines the window size. inflate() will then process raw deflate data,
+   not looking for a zlib or gzip header, not generating a check value, and not
+   looking for any check values for comparison at the end of the stream. This
+   is for use with other formats that use the deflate compressed data format
+   such as zip.  Those formats provide their own check values. If a custom
+   format is developed using the raw deflate format for compressed data, it is
+   recommended that a check value such as an adler32 or a crc32 be applied to
+   the uncompressed data as is done in the zlib, gzip, and zip formats.  For
+   most applications, the zlib format should be used as is. Note that comments
+   above on the use in deflateInit2() applies to the magnitude of windowBits.
+
+     windowBits can also be greater than 15 for optional gzip decoding. Add
+   32 to windowBits to enable zlib and gzip decoding with automatic header
+   detection, or add 16 to decode only the gzip format (the zlib format will
+   return a Z_DATA_ERROR).  If a gzip stream is being decoded, strm->adler is
+   a crc32 instead of an adler32.
+
+     inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg
+   is set to null if there is no error message.  inflateInit2 does not perform
+   any decompression apart from reading the zlib header if present: this will
+   be done by inflate(). (So next_in and avail_in may be modified, but next_out
+   and avail_out are unchanged.)
+*/
+
+ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
+                                             const Bytef *dictionary,
+                                             uInt  dictLength));
+/*
+     Initializes the decompression dictionary from the given uncompressed byte
+   sequence. This function must be called immediately after a call of inflate,
+   if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
+   can be determined from the adler32 value returned by that call of inflate.
+   The compressor and decompressor must use exactly the same dictionary (see
+   deflateSetDictionary).  For raw inflate, this function can be called
+   immediately after inflateInit2() or inflateReset() and before any call of
+   inflate() to set the dictionary.  The application must insure that the
+   dictionary that was used for compression is provided.
+
+     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
+   parameter is invalid (such as NULL dictionary) or the stream state is
+   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
+   expected one (incorrect adler32 value). inflateSetDictionary does not
+   perform any decompression: this will be done by subsequent calls of
+   inflate().
+*/
+
+ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
+/*
+    Skips invalid compressed data until a full flush point (see above the
+  description of deflate with Z_FULL_FLUSH) can be found, or until all
+  available input is skipped. No output is provided.
+
+    inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
+  if no more input was provided, Z_DATA_ERROR if no flush point has been found,
+  or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
+  case, the application may save the current current value of total_in which
+  indicates where valid compressed data was found. In the error case, the
+  application may repeatedly call inflateSync, providing more input each time,
+  until success or end of the input data.
+*/
+
+ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
+                                    z_streamp source));
+/*
+     Sets the destination stream as a complete copy of the source stream.
+
+     This function can be useful when randomly accessing a large stream.  The
+   first pass through the stream can periodically record the inflate state,
+   allowing restarting inflate at those points when randomly accessing the
+   stream.
+
+     inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+   (such as zalloc being NULL). msg is left unchanged in both source and
+   destination.
+*/
+
+ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
+/*
+     This function is equivalent to inflateEnd followed by inflateInit,
+   but does not free and reallocate all the internal decompression state.
+   The stream will keep attributes that may have been set by inflateInit2.
+
+      inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
+                                     int bits,
+                                     int value));
+/*
+     This function inserts bits in the inflate input stream.  The intent is
+  that this function is used to start inflating at a bit position in the
+  middle of a byte.  The provided bits will be used before any bytes are used
+  from next_in.  This function should only be used with raw inflate, and
+  should be used before the first inflate() call after inflateInit2() or
+  inflateReset().  bits must be less than or equal to 16, and that many of the
+  least significant bits of value will be inserted in the input.
+
+      inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
+                                         gz_headerp head));
+/*
+      inflateGetHeader() requests that gzip header information be stored in the
+   provided gz_header structure.  inflateGetHeader() may be called after
+   inflateInit2() or inflateReset(), and before the first call of inflate().
+   As inflate() processes the gzip stream, head->done is zero until the header
+   is completed, at which time head->done is set to one.  If a zlib stream is
+   being decoded, then head->done is set to -1 to indicate that there will be
+   no gzip header information forthcoming.  Note that Z_BLOCK can be used to
+   force inflate() to return immediately after header processing is complete
+   and before any actual data is decompressed.
+
+      The text, time, xflags, and os fields are filled in with the gzip header
+   contents.  hcrc is set to true if there is a header CRC.  (The header CRC
+   was valid if done is set to one.)  If extra is not Z_NULL, then extra_max
+   contains the maximum number of bytes to write to extra.  Once done is true,
+   extra_len contains the actual extra field length, and extra contains the
+   extra field, or that field truncated if extra_max is less than extra_len.
+   If name is not Z_NULL, then up to name_max characters are written there,
+   terminated with a zero unless the length is greater than name_max.  If
+   comment is not Z_NULL, then up to comm_max characters are written there,
+   terminated with a zero unless the length is greater than comm_max.  When
+   any of extra, name, or comment are not Z_NULL and the respective field is
+   not present in the header, then that field is set to Z_NULL to signal its
+   absence.  This allows the use of deflateSetHeader() with the returned
+   structure to duplicate the header.  However if those fields are set to
+   allocated memory, then the application will need to save those pointers
+   elsewhere so that they can be eventually freed.
+
+      If inflateGetHeader is not used, then the header information is simply
+   discarded.  The header is always checked for validity, including the header
+   CRC if present.  inflateReset() will reset the process to discard the header
+   information.  The application would need to call inflateGetHeader() again to
+   retrieve the header from the next gzip stream.
+
+      inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
+                                        unsigned char FAR *window));
+
+     Initialize the internal stream state for decompression using inflateBack()
+   calls.  The fields zalloc, zfree and opaque in strm must be initialized
+   before the call.  If zalloc and zfree are Z_NULL, then the default library-
+   derived memory allocation routines are used.  windowBits is the base two
+   logarithm of the window size, in the range 8..15.  window is a caller
+   supplied buffer of that size.  Except for special applications where it is
+   assured that deflate was used with small window sizes, windowBits must be 15
+   and a 32K byte window must be supplied to be able to decompress general
+   deflate streams.
+
+     See inflateBack() for the usage of these routines.
+
+     inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
+   the paramaters are invalid, Z_MEM_ERROR if the internal state could not
+   be allocated, or Z_VERSION_ERROR if the version of the library does not
+   match the version of the header file.
+*/
+
+typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
+typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
+
+ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
+                                    in_func in, void FAR *in_desc,
+                                    out_func out, void FAR *out_desc));
+/*
+     inflateBack() does a raw inflate with a single call using a call-back
+   interface for input and output.  This is more efficient than inflate() for
+   file i/o applications in that it avoids copying between the output and the
+   sliding window by simply making the window itself the output buffer.  This
+   function trusts the application to not change the output buffer passed by
+   the output function, at least until inflateBack() returns.
+
+     inflateBackInit() must be called first to allocate the internal state
+   and to initialize the state with the user-provided window buffer.
+   inflateBack() may then be used multiple times to inflate a complete, raw
+   deflate stream with each call.  inflateBackEnd() is then called to free
+   the allocated state.
+
+     A raw deflate stream is one with no zlib or gzip header or trailer.
+   This routine would normally be used in a utility that reads zip or gzip
+   files and writes out uncompressed files.  The utility would decode the
+   header and process the trailer on its own, hence this routine expects
+   only the raw deflate stream to decompress.  This is different from the
+   normal behavior of inflate(), which expects either a zlib or gzip header and
+   trailer around the deflate stream.
+
+     inflateBack() uses two subroutines supplied by the caller that are then
+   called by inflateBack() for input and output.  inflateBack() calls those
+   routines until it reads a complete deflate stream and writes out all of the
+   uncompressed data, or until it encounters an error.  The function's
+   parameters and return types are defined above in the in_func and out_func
+   typedefs.  inflateBack() will call in(in_desc, &buf) which should return the
+   number of bytes of provided input, and a pointer to that input in buf.  If
+   there is no input available, in() must return zero--buf is ignored in that
+   case--and inflateBack() will return a buffer error.  inflateBack() will call
+   out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].  out()
+   should return zero on success, or non-zero on failure.  If out() returns
+   non-zero, inflateBack() will return with an error.  Neither in() nor out()
+   are permitted to change the contents of the window provided to
+   inflateBackInit(), which is also the buffer that out() uses to write from.
+   The length written by out() will be at most the window size.  Any non-zero
+   amount of input may be provided by in().
+
+     For convenience, inflateBack() can be provided input on the first call by
+   setting strm->next_in and strm->avail_in.  If that input is exhausted, then
+   in() will be called.  Therefore strm->next_in must be initialized before
+   calling inflateBack().  If strm->next_in is Z_NULL, then in() will be called
+   immediately for input.  If strm->next_in is not Z_NULL, then strm->avail_in
+   must also be initialized, and then if strm->avail_in is not zero, input will
+   initially be taken from strm->next_in[0 .. strm->avail_in - 1].
+
+     The in_desc and out_desc parameters of inflateBack() is passed as the
+   first parameter of in() and out() respectively when they are called.  These
+   descriptors can be optionally used to pass any information that the caller-
+   supplied in() and out() functions need to do their job.
+
+     On return, inflateBack() will set strm->next_in and strm->avail_in to
+   pass back any unused input that was provided by the last in() call.  The
+   return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
+   if in() or out() returned an error, Z_DATA_ERROR if there was a format
+   error in the deflate stream (in which case strm->msg is set to indicate the
+   nature of the error), or Z_STREAM_ERROR if the stream was not properly
+   initialized.  In the case of Z_BUF_ERROR, an input or output error can be
+   distinguished using strm->next_in which will be Z_NULL only if in() returned
+   an error.  If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to
+   out() returning non-zero.  (in() will always be called before out(), so
+   strm->next_in is assured to be defined if out() returns non-zero.)  Note
+   that inflateBack() cannot return Z_OK.
+*/
+
+ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
+/*
+     All memory allocated by inflateBackInit() is freed.
+
+     inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
+   state was inconsistent.
+*/
+
+ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
+/* Return flags indicating compile-time options.
+
+    Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
+     1.0: size of uInt
+     3.2: size of uLong
+     5.4: size of voidpf (pointer)
+     7.6: size of z_off_t
+
+    Compiler, assembler, and debug options:
+     8: DEBUG
+     9: ASMV or ASMINF -- use ASM code
+     10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
+     11: 0 (reserved)
+
+    One-time table building (smaller code, but not thread-safe if true):
+     12: BUILDFIXED -- build static block decoding tables when needed
+     13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
+     14,15: 0 (reserved)
+
+    Library content (indicates missing functionality):
+     16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
+                          deflate code when not needed)
+     17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
+                    and decode gzip streams (to avoid linking crc code)
+     18-19: 0 (reserved)
+
+    Operation variations (changes in library functionality):
+     20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
+     21: FASTEST -- deflate algorithm with only one, lowest compression level
+     22,23: 0 (reserved)
+
+    The sprintf variant used by gzprintf (zero is best):
+     24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
+     25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
+     26: 0 = returns value, 1 = void -- 1 means inferred string length returned
+
+    Remainder:
+     27-31: 0 (reserved)
+ */
+
+
+                        /* utility functions */
+
+/*
+     The following utility functions are implemented on top of the
+   basic stream-oriented functions. To simplify the interface, some
+   default options are assumed (compression level and memory usage,
+   standard memory allocation functions). The source code of these
+   utility functions can easily be modified if you need special options.
+*/
+
+ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
+                                 const Bytef *source, uLong sourceLen));
+/*
+     Compresses the source buffer into the destination buffer.  sourceLen is
+   the byte length of the source buffer. Upon entry, destLen is the total
+   size of the destination buffer, which must be at least the value returned
+   by compressBound(sourceLen). Upon exit, destLen is the actual size of the
+   compressed buffer.
+     This function can be used to compress a whole file at once if the
+   input file is mmap'ed.
+     compress returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_BUF_ERROR if there was not enough room in the output
+   buffer.
+*/
+
+ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
+                                  const Bytef *source, uLong sourceLen,
+                                  int level));
+/*
+     Compresses the source buffer into the destination buffer. The level
+   parameter has the same meaning as in deflateInit.  sourceLen is the byte
+   length of the source buffer. Upon entry, destLen is the total size of the
+   destination buffer, which must be at least the value returned by
+   compressBound(sourceLen). Upon exit, destLen is the actual size of the
+   compressed buffer.
+
+     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+   Z_STREAM_ERROR if the level parameter is invalid.
+*/
+
+ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
+/*
+     compressBound() returns an upper bound on the compressed size after
+   compress() or compress2() on sourceLen bytes.  It would be used before
+   a compress() or compress2() call to allocate the destination buffer.
+*/
+
+ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
+                                   const Bytef *source, uLong sourceLen));
+/*
+     Decompresses the source buffer into the destination buffer.  sourceLen is
+   the byte length of the source buffer. Upon entry, destLen is the total
+   size of the destination buffer, which must be large enough to hold the
+   entire uncompressed data. (The size of the uncompressed data must have
+   been saved previously by the compressor and transmitted to the decompressor
+   by some mechanism outside the scope of this compression library.)
+   Upon exit, destLen is the actual size of the compressed buffer.
+     This function can be used to decompress a whole file at once if the
+   input file is mmap'ed.
+
+     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_BUF_ERROR if there was not enough room in the output
+   buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
+*/
+
+
+typedef voidp gzFile;
+
+#if 0
+ZEXTERN gzFile ZEXPORT gzopen  OF((const char *path, const char *mode));
+/*
+     Opens a gzip (.gz) file for reading or writing. The mode parameter
+   is as in fopen ("rb" or "wb") but can also include a compression level
+   ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
+   Huffman only compression as in "wb1h", or 'R' for run-length encoding
+   as in "wb1R". (See the description of deflateInit2 for more information
+   about the strategy parameter.)
+
+     gzopen can be used to read a file which is not in gzip format; in this
+   case gzread will directly read from the file without decompression.
+
+     gzopen returns NULL if the file could not be opened or if there was
+   insufficient memory to allocate the (de)compression state; errno
+   can be checked to distinguish the two cases (if errno is zero, the
+   zlib error is Z_MEM_ERROR).  */
+#endif
+
+ZEXTERN gzFile ZEXPORT gzdopen  OF((int fd, const char *mode));
+/*
+     gzdopen() associates a gzFile with the file descriptor fd.  File
+   descriptors are obtained from calls like open, dup, creat, pipe or
+   fileno (in the file has been previously opened with fopen).
+   The mode parameter is as in gzopen.
+     The next call of gzclose on the returned gzFile will also close the
+   file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
+   descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
+     gzdopen returns NULL if there was insufficient memory to allocate
+   the (de)compression state.
+*/
+
+ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
+/*
+     Dynamically update the compression level or strategy. See the description
+   of deflateInit2 for the meaning of these parameters.
+     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
+   opened for writing.
+*/
+
+ZEXTERN int ZEXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));
+/*
+     Reads the given number of uncompressed bytes from the compressed file.
+   If the input file was not in gzip format, gzread copies the given number
+   of bytes into the buffer.
+     gzread returns the number of uncompressed bytes actually read (0 for
+   end of file, -1 for error). */
+
+ZEXTERN int ZEXPORT    gzwrite OF((gzFile file,
+                                   voidpc buf, unsigned len));
+/*
+     Writes the given number of uncompressed bytes into the compressed file.
+   gzwrite returns the number of uncompressed bytes actually written
+   (0 in case of error).
+*/
+
+ZEXTERN int ZEXPORTVA   gzprintf OF((gzFile file, const char *format, ...));
+/*
+     Converts, formats, and writes the args to the compressed file under
+   control of the format string, as in fprintf. gzprintf returns the number of
+   uncompressed bytes actually written (0 in case of error).  The number of
+   uncompressed bytes written is limited to 4095. The caller should assure that
+   this limit is not exceeded. If it is exceeded, then gzprintf() will return
+   return an error (0) with nothing written. In this case, there may also be a
+   buffer overflow with unpredictable consequences, which is possible only if
+   zlib was compiled with the insecure functions sprintf() or vsprintf()
+   because the secure snprintf() or vsnprintf() functions were not available.
+*/
+
+ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
+/*
+      Writes the given null-terminated string to the compressed file, excluding
+   the terminating null character.
+      gzputs returns the number of characters written, or -1 in case of error.
+*/
+
+ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
+/*
+      Reads bytes from the compressed file until len-1 characters are read, or
+   a newline character is read and transferred to buf, or an end-of-file
+   condition is encountered.  The string is then terminated with a null
+   character.
+      gzgets returns buf, or Z_NULL in case of error.
+*/
+
+ZEXTERN int ZEXPORT    gzputc OF((gzFile file, int c));
+/*
+      Writes c, converted to an unsigned char, into the compressed file.
+   gzputc returns the value that was written, or -1 in case of error.
+*/
+
+ZEXTERN int ZEXPORT    gzgetc OF((gzFile file));
+/*
+      Reads one byte from the compressed file. gzgetc returns this byte
+   or -1 in case of end of file or error.
+*/
+
+ZEXTERN int ZEXPORT    gzungetc OF((int c, gzFile file));
+/*
+      Push one character back onto the stream to be read again later.
+   Only one character of push-back is allowed.  gzungetc() returns the
+   character pushed, or -1 on failure.  gzungetc() will fail if a
+   character has been pushed but not read yet, or if c is -1. The pushed
+   character will be discarded if the stream is repositioned with gzseek()
+   or gzrewind().
+*/
+
+ZEXTERN int ZEXPORT    gzflush OF((gzFile file, int flush));
+/*
+     Flushes all pending output into the compressed file. The parameter
+   flush is as in the deflate() function. The return value is the zlib
+   error number (see function gzerror below). gzflush returns Z_OK if
+   the flush parameter is Z_FINISH and all output could be flushed.
+     gzflush should be called only when strictly necessary because it can
+   degrade compression.
+*/
+
+ZEXTERN z_off_t ZEXPORT    gzseek OF((gzFile file,
+                                      z_off_t offset, int whence));
+/*
+      Sets the starting position for the next gzread or gzwrite on the
+   given compressed file. The offset represents a number of bytes in the
+   uncompressed data stream. The whence parameter is defined as in lseek(2);
+   the value SEEK_END is not supported.
+     If the file is opened for reading, this function is emulated but can be
+   extremely slow. If the file is opened for writing, only forward seeks are
+   supported; gzseek then compresses a sequence of zeroes up to the new
+   starting position.
+
+      gzseek returns the resulting offset location as measured in bytes from
+   the beginning of the uncompressed stream, or -1 in case of error, in
+   particular if the file is opened for writing and the new starting position
+   would be before the current position.
+*/
+
+ZEXTERN int ZEXPORT    gzrewind OF((gzFile file));
+/*
+     Rewinds the given file. This function is supported only for reading.
+
+   gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
+*/
+
+ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
+/*
+     Returns the starting position for the next gzread or gzwrite on the
+   given compressed file. This position represents a number of bytes in the
+   uncompressed data stream.
+
+   gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
+*/
+
+ZEXTERN int ZEXPORT gzeof OF((gzFile file));
+/*
+     Returns 1 when EOF has previously been detected reading the given
+   input stream, otherwise zero.
+*/
+
+ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
+/*
+     Returns 1 if file is being read directly without decompression, otherwise
+   zero.
+*/
+
+ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
+/*
+     Flushes all pending output if necessary, closes the compressed file
+   and deallocates all the (de)compression state. The return value is the zlib
+   error number (see function gzerror below).
+*/
+
+ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
+/*
+     Returns the error message for the last error which occurred on the
+   given compressed file. errnum is set to zlib error number. If an
+   error occurred in the file system and not in the compression library,
+   errnum is set to Z_ERRNO and the application may consult errno
+   to get the exact error code.
+*/
+
+ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
+/*
+     Clears the error and end-of-file flags for file. This is analogous to the
+   clearerr() function in stdio. This is useful for continuing to read a gzip
+   file that is being written concurrently.
+*/
+
+                        /* checksum functions */
+
+/*
+     These functions are not related to compression but are exported
+   anyway because they might be useful in applications using the
+   compression library.
+*/
+
+ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
+/*
+     Update a running Adler-32 checksum with the bytes buf[0..len-1] and
+   return the updated checksum. If buf is NULL, this function returns
+   the required initial value for the checksum.
+   An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
+   much faster. Usage example:
+
+     uLong adler = adler32(0L, Z_NULL, 0);
+
+     while (read_buffer(buffer, length) != EOF) {
+       adler = adler32(adler, buffer, length);
+     }
+     if (adler != original_adler) error();
+*/
+
+ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
+                                          z_off_t len2));
+/*
+     Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1
+   and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
+   each, adler1 and adler2.  adler32_combine() returns the Adler-32 checksum of
+   seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
+*/
+
+ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
+/*
+     Update a running CRC-32 with the bytes buf[0..len-1] and return the
+   updated CRC-32. If buf is NULL, this function returns the required initial
+   value for the for the crc. Pre- and post-conditioning (one's complement) is
+   performed within this function so it shouldn't be done by the application.
+   Usage example:
+
+     uLong crc = crc32(0L, Z_NULL, 0);
+
+     while (read_buffer(buffer, length) != EOF) {
+       crc = crc32(crc, buffer, length);
+     }
+     if (crc != original_crc) error();
+*/
+
+ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
+
+/*
+     Combine two CRC-32 check values into one.  For two sequences of bytes,
+   seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
+   calculated for each, crc1 and crc2.  crc32_combine() returns the CRC-32
+   check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
+   len2.
+*/
+
+
+                        /* various hacks, don't look :) */
+
+/* deflateInit and inflateInit are macros to allow checking the zlib version
+ * and the compiler's view of z_stream:
+ */
+ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
+                                     const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
+                                     const char *version, int stream_size));
+ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
+                                      int windowBits, int memLevel,
+                                      int strategy, const char *version,
+                                      int stream_size));
+ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
+                                      const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
+                                         unsigned char FAR *window,
+                                         const char *version,
+                                         int stream_size));
+#define deflateInit(strm, level) \
+        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit(strm) \
+        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
+#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
+                      (strategy),           ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit2(strm, windowBits) \
+        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
+#define inflateBackInit(strm, windowBits, window) \
+        inflateBackInit_((strm), (windowBits), (window), \
+        ZLIB_VERSION, sizeof(z_stream))
+
+
+#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
+    struct internal_state {int dummy;}; /* hack for buggy compilers */
+#endif
+
+ZEXTERN const char   * ZEXPORT zError           OF((int));
+ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp z));
+ZEXTERN const uLongf * ZEXPORT get_crc_table    OF((void));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZLIB_H */

Added: branches/vendor/emile/libgzip/zutil.c
===================================================================
--- branches/vendor/emile/libgzip/zutil.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libgzip/zutil.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,320 @@
+/* zutil.c -- target dependent utility functions for the compression library
+ * Copyright (C) 1995-2005 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: zutil.c,v 1.1 2005/11/14 23:15:54 lvivier Exp $ */
+
+#include "zutil.h"
+
+#ifndef FATFREE
+#ifndef NO_DUMMY_DECL
+struct internal_state      {int dummy;}; /* for buggy compilers */
+#endif
+
+const char * const z_errmsg[10] = {
+"need dictionary",     /* Z_NEED_DICT       2  */
+"stream end",          /* Z_STREAM_END      1  */
+"",                    /* Z_OK              0  */
+"file error",          /* Z_ERRNO         (-1) */
+"stream error",        /* Z_STREAM_ERROR  (-2) */
+"data error",          /* Z_DATA_ERROR    (-3) */
+"insufficient memory", /* Z_MEM_ERROR     (-4) */
+"buffer error",        /* Z_BUF_ERROR     (-5) */
+"incompatible version",/* Z_VERSION_ERROR (-6) */
+""};
+
+
+const char * ZEXPORT zlibVersion()
+{
+    return ZLIB_VERSION;
+}
+
+uLong ZEXPORT zlibCompileFlags()
+{
+    uLong flags;
+
+    flags = 0;
+    switch (sizeof(uInt)) {
+    case 2:     break;
+    case 4:     flags += 1;     break;
+    case 8:     flags += 2;     break;
+    default:    flags += 3;
+    }
+    switch (sizeof(uLong)) {
+    case 2:     break;
+    case 4:     flags += 1 << 2;        break;
+    case 8:     flags += 2 << 2;        break;
+    default:    flags += 3 << 2;
+    }
+    switch (sizeof(voidpf)) {
+    case 2:     break;
+    case 4:     flags += 1 << 4;        break;
+    case 8:     flags += 2 << 4;        break;
+    default:    flags += 3 << 4;
+    }
+    switch (sizeof(z_off_t)) {
+    case 2:     break;
+    case 4:     flags += 1 << 6;        break;
+    case 8:     flags += 2 << 6;        break;
+    default:    flags += 3 << 6;
+    }
+#ifdef DEBUG
+    flags += 1 << 8;
+#endif
+#if defined(ASMV) || defined(ASMINF)
+    flags += 1 << 9;
+#endif
+#ifdef ZLIB_WINAPI
+    flags += 1 << 10;
+#endif
+#ifdef BUILDFIXED
+    flags += 1 << 12;
+#endif
+#ifdef DYNAMIC_CRC_TABLE
+    flags += 1 << 13;
+#endif
+#ifdef NO_GZCOMPRESS
+    flags += 1L << 16;
+#endif
+#ifdef NO_GZIP
+    flags += 1L << 17;
+#endif
+#ifdef PKZIP_BUG_WORKAROUND
+    flags += 1L << 20;
+#endif
+#ifdef FASTEST
+    flags += 1L << 21;
+#endif
+#ifdef STDC
+#  ifdef NO_vsnprintf
+        flags += 1L << 25;
+#    ifdef HAS_vsprintf_void
+        flags += 1L << 26;
+#    endif
+#  else
+#    ifdef HAS_vsnprintf_void
+        flags += 1L << 26;
+#    endif
+#  endif
+#else
+        flags += 1L << 24;
+#  ifdef NO_snprintf
+        flags += 1L << 25;
+#    ifdef HAS_sprintf_void
+        flags += 1L << 26;
+#    endif
+#  else
+#    ifdef HAS_snprintf_void
+        flags += 1L << 26;
+#    endif
+#  endif
+#endif
+    return flags;
+}
+
+#ifdef DEBUG
+
+#  ifndef verbose
+#    define verbose 0
+#  endif
+int z_verbose = verbose;
+
+void z_error (m)
+    char *m;
+{
+    fprintf(stderr, "%s\n", m);
+    exit(1);
+}
+#endif
+
+/* exported to allow conversion of error code to string for compress() and
+ * uncompress()
+ */
+const char * ZEXPORT zError(err)
+    int err;
+{
+    return ERR_MSG(err);
+}
+#endif /* FATFREE */
+
+#if defined(_WIN32_WCE)
+    /* The Microsoft C Run-Time Library for Windows CE doesn't have
+     * errno.  We define it as a global variable to simplify porting.
+     * Its value is always 0 and should not be used.
+     */
+    int errno = 0;
+#endif
+
+#ifndef HAVE_MEMCPY
+
+void zmemcpy(dest, source, len)
+    Bytef* dest;
+    const Bytef* source;
+    uInt  len;
+{
+    if (len == 0) return;
+    do {
+        *dest++ = *source++; /* ??? to be unrolled */
+    } while (--len != 0);
+}
+
+int zmemcmp(s1, s2, len)
+    const Bytef* s1;
+    const Bytef* s2;
+    uInt  len;
+{
+    uInt j;
+
+    for (j = 0; j < len; j++) {
+        if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
+    }
+    return 0;
+}
+
+void zmemzero(dest, len)
+    Bytef* dest;
+    uInt  len;
+{
+    if (len == 0) return;
+    do {
+        *dest++ = 0;  /* ??? to be unrolled */
+    } while (--len != 0);
+}
+#endif
+
+
+#ifdef SYS16BIT
+
+#ifdef __TURBOC__
+/* Turbo C in 16-bit mode */
+
+#  define MY_ZCALLOC
+
+/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
+ * and farmalloc(64K) returns a pointer with an offset of 8, so we
+ * must fix the pointer. Warning: the pointer must be put back to its
+ * original form in order to free it, use zcfree().
+ */
+
+#define MAX_PTR 10
+/* 10*64K = 640K */
+
+local int next_ptr = 0;
+
+typedef struct ptr_table_s {
+    voidpf org_ptr;
+    voidpf new_ptr;
+} ptr_table;
+
+local ptr_table table[MAX_PTR];
+/* This table is used to remember the original form of pointers
+ * to large buffers (64K). Such pointers are normalized with a zero offset.
+ * Since MSDOS is not a preemptive multitasking OS, this table is not
+ * protected from concurrent access. This hack doesn't work anyway on
+ * a protected system like OS/2. Use Microsoft C instead.
+ */
+
+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+    voidpf buf = opaque; /* just to make some compilers happy */
+    ulg bsize = (ulg)items*size;
+
+    /* If we allocate less than 65520 bytes, we assume that farmalloc
+     * will return a usable pointer which doesn't have to be normalized.
+     */
+    if (bsize < 65520L) {
+        buf = farmalloc(bsize);
+        if (*(ush*)&buf != 0) return buf;
+    } else {
+        buf = farmalloc(bsize + 16L);
+    }
+    if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
+    table[next_ptr].org_ptr = buf;
+
+    /* Normalize the pointer to seg:0 */
+    *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
+    *(ush*)&buf = 0;
+    table[next_ptr++].new_ptr = buf;
+    return buf;
+}
+
+void  zcfree (voidpf opaque, voidpf ptr)
+{
+    int n;
+    if (*(ush*)&ptr != 0) { /* object < 64K */
+        farfree(ptr);
+        return;
+    }
+    /* Find the original pointer */
+    for (n = 0; n < next_ptr; n++) {
+        if (ptr != table[n].new_ptr) continue;
+
+        farfree(table[n].org_ptr);
+        while (++n < next_ptr) {
+            table[n-1] = table[n];
+        }
+        next_ptr--;
+        return;
+    }
+    ptr = opaque; /* just to make some compilers happy */
+    Assert(0, "zcfree: ptr not found");
+}
+
+#endif /* __TURBOC__ */
+
+
+#ifdef M_I86
+/* Microsoft C in 16-bit mode */
+
+#  define MY_ZCALLOC
+
+#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
+#  define _halloc  halloc
+#  define _hfree   hfree
+#endif
+
+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+    if (opaque) opaque = 0; /* to make compiler happy */
+    return _halloc((long)items, size);
+}
+
+void  zcfree (voidpf opaque, voidpf ptr)
+{
+    if (opaque) opaque = 0; /* to make compiler happy */
+    _hfree(ptr);
+}
+
+#endif /* M_I86 */
+
+#endif /* SYS16BIT */
+
+
+#ifndef MY_ZCALLOC /* Any system without a special alloc function */
+
+#ifndef STDC
+extern voidp  malloc OF((uInt size));
+extern voidp  calloc OF((uInt items, uInt size));
+extern void   free   OF((voidpf ptr));
+#endif
+
+voidpf zcalloc (opaque, items, size)
+    voidpf opaque;
+    unsigned items;
+    unsigned size;
+{
+    if (opaque) items += size - size; /* make compiler happy */
+    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
+                              (voidpf)calloc(items, size);
+}
+
+void  zcfree (opaque, ptr)
+    voidpf opaque;
+    voidpf ptr;
+{
+    free(ptr);
+    if (opaque) return; /* make compiler happy */
+}
+
+#endif /* MY_ZCALLOC */

Added: branches/vendor/emile/libgzip/zutil.h
===================================================================
--- branches/vendor/emile/libgzip/zutil.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libgzip/zutil.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,269 @@
+/* zutil.h -- internal interface and configuration of the compression library
+ * Copyright (C) 1995-2005 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+/* @(#) $Id: zutil.h,v 1.1 2005/11/14 23:15:54 lvivier Exp $ */
+
+#ifndef ZUTIL_H
+#define ZUTIL_H
+
+#define ZLIB_INTERNAL
+#include "zlib.h"
+
+#ifdef STDC
+#  ifndef _WIN32_WCE
+#    include <stddef.h>
+#  endif
+#  include <string.h>
+#  include <stdlib.h>
+#endif
+#ifdef NO_ERRNO_H
+#   ifdef _WIN32_WCE
+      /* The Microsoft C Run-Time Library for Windows CE doesn't have
+       * errno.  We define it as a global variable to simplify porting.
+       * Its value is always 0 and should not be used.  We rename it to
+       * avoid conflict with other libraries that use the same workaround.
+       */
+#     define errno z_errno
+#   endif
+    extern int errno;
+#else
+#  ifndef _WIN32_WCE
+#    include <errno.h>
+#  endif
+#endif
+
+#ifndef local
+#  define local static
+#endif
+/* compile with -Dlocal if your debugger can't find static symbols */
+
+typedef unsigned char  uch;
+typedef uch FAR uchf;
+typedef unsigned short ush;
+typedef ush FAR ushf;
+typedef unsigned long  ulg;
+
+extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+/* (size given to avoid silly warnings with Visual C++) */
+
+#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
+
+#define ERR_RETURN(strm,err) \
+  return (strm->msg = (char*)ERR_MSG(err), (err))
+/* To be used only when the state is known to be valid */
+
+        /* common constants */
+
+#ifndef DEF_WBITS
+#  define DEF_WBITS MAX_WBITS
+#endif
+/* default windowBits for decompression. MAX_WBITS is for compression only */
+
+#if MAX_MEM_LEVEL >= 8
+#  define DEF_MEM_LEVEL 8
+#else
+#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
+#endif
+/* default memLevel */
+
+#define STORED_BLOCK 0
+#define STATIC_TREES 1
+#define DYN_TREES    2
+/* The three kinds of block type */
+
+#define MIN_MATCH  3
+#define MAX_MATCH  258
+/* The minimum and maximum match lengths */
+
+#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
+
+        /* target dependencies */
+
+#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
+#  define OS_CODE  0x00
+#  if defined(__TURBOC__) || defined(__BORLANDC__)
+#    if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
+       /* Allow compilation with ANSI keywords only enabled */
+       void _Cdecl farfree( void *block );
+       void *_Cdecl farmalloc( unsigned long nbytes );
+#    else
+#      include <alloc.h>
+#    endif
+#  else /* MSC or DJGPP */
+#    include <malloc.h>
+#  endif
+#endif
+
+#ifdef AMIGA
+#  define OS_CODE  0x01
+#endif
+
+#if defined(VAXC) || defined(VMS)
+#  define OS_CODE  0x02
+#  define F_OPEN(name, mode) \
+     fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
+#endif
+
+#if defined(ATARI) || defined(atarist)
+#  define OS_CODE  0x05
+#endif
+
+#ifdef OS2
+#  define OS_CODE  0x06
+#  ifdef M_I86
+     #include <malloc.h>
+#  endif
+#endif
+
+#if defined(MACOS) || defined(TARGET_OS_MAC)
+#  define OS_CODE  0x07
+#  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+#    include <unix.h> /* for fdopen */
+#  else
+#    ifndef fdopen
+#      define fdopen(fd,mode) NULL /* No fdopen() */
+#    endif
+#  endif
+#endif
+
+#ifdef TOPS20
+#  define OS_CODE  0x0a
+#endif
+
+#ifdef WIN32
+#  ifndef __CYGWIN__  /* Cygwin is Unix, not Win32 */
+#    define OS_CODE  0x0b
+#  endif
+#endif
+
+#ifdef __50SERIES /* Prime/PRIMOS */
+#  define OS_CODE  0x0f
+#endif
+
+#if defined(_BEOS_) || defined(RISCOS)
+#  define fdopen(fd,mode) NULL /* No fdopen() */
+#endif
+
+#if (defined(_MSC_VER) && (_MSC_VER > 600))
+#  if defined(_WIN32_WCE)
+#    define fdopen(fd,mode) NULL /* No fdopen() */
+#    ifndef _PTRDIFF_T_DEFINED
+       typedef int ptrdiff_t;
+#      define _PTRDIFF_T_DEFINED
+#    endif
+#  else
+#    define fdopen(fd,type)  _fdopen(fd,type)
+#  endif
+#endif
+
+        /* common defaults */
+
+#ifndef OS_CODE
+#  define OS_CODE  0x03  /* assume Unix */
+#endif
+
+#ifndef F_OPEN
+#  define F_OPEN(name, mode) fopen((name), (mode))
+#endif
+
+         /* functions */
+
+#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
+#  ifndef HAVE_VSNPRINTF
+#    define HAVE_VSNPRINTF
+#  endif
+#endif
+#if defined(__CYGWIN__)
+#  ifndef HAVE_VSNPRINTF
+#    define HAVE_VSNPRINTF
+#  endif
+#endif
+#ifndef HAVE_VSNPRINTF
+#  ifdef MSDOS
+     /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
+        but for now we just assume it doesn't. */
+#    define NO_vsnprintf
+#  endif
+#  ifdef __TURBOC__
+#    define NO_vsnprintf
+#  endif
+#  ifdef WIN32
+     /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
+#    if !defined(vsnprintf) && !defined(NO_vsnprintf)
+#      define vsnprintf _vsnprintf
+#    endif
+#  endif
+#  ifdef __SASC
+#    define NO_vsnprintf
+#  endif
+#endif
+#ifdef VMS
+#  define NO_vsnprintf
+#endif
+
+#if defined(pyr)
+#  define NO_MEMCPY
+#endif
+#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
+ /* Use our own functions for small and medium model with MSC <= 5.0.
+  * You may have to use the same strategy for Borland C (untested).
+  * The __SC__ check is for Symantec.
+  */
+#  define NO_MEMCPY
+#endif
+#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
+#  define HAVE_MEMCPY
+#endif
+#ifdef HAVE_MEMCPY
+#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
+#    define zmemcpy _fmemcpy
+#    define zmemcmp _fmemcmp
+#    define zmemzero(dest, len) _fmemset(dest, 0, len)
+#  else
+#    define zmemcpy memcpy
+#    define zmemcmp memcmp
+#    define zmemzero(dest, len) memset(dest, 0, len)
+#  endif
+#else
+   extern void zmemcpy  OF((Bytef* dest, const Bytef* source, uInt len));
+   extern int  zmemcmp  OF((const Bytef* s1, const Bytef* s2, uInt len));
+   extern void zmemzero OF((Bytef* dest, uInt len));
+#endif
+
+/* Diagnostic functions */
+#ifdef DEBUG
+#  include <stdio.h>
+   extern int z_verbose;
+   extern void z_error    OF((char *m));
+#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
+#  define Trace(x) {if (z_verbose>=0) fprintf x ;}
+#  define Tracev(x) {if (z_verbose>0) fprintf x ;}
+#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}
+#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
+#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
+#else
+#  define Assert(cond,msg)
+#  define Trace(x)
+#  define Tracev(x)
+#  define Tracevv(x)
+#  define Tracec(c,x)
+#  define Tracecv(c,x)
+#endif
+
+
+voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
+void   zcfree  OF((voidpf opaque, voidpf ptr));
+
+#define ZALLOC(strm, items, size) \
+           (*((strm)->zalloc))((strm)->opaque, (items), (size))
+#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
+#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
+
+#endif /* ZUTIL_H */

Added: branches/vendor/emile/libiso9660/Makefile
===================================================================
--- branches/vendor/emile/libiso9660/Makefile	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libiso9660/Makefile	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,34 @@
+#
+#  (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+#
+
+TOP = $(shell pwd)
+VPATH=$(TOP)
+
+AS=$(CROSS_COMPILE)as
+CC=$(CROSS_COMPILE)gcc
+LD=$(CROSS_COMPILE)ld
+AR=$(CROSS_COMPILE)ar
+
+TARGET = native
+CFLAGS	= -nostdlib -nodefaultlibs -Wall -Werror -Wno-multichar
+ifeq ($(TARGET), m68k-linux)
+CFLAGS += -fpic -O2 -m68000 -Wa,-m68000 -Os
+endif
+CPPFLAGS = -I$(TOP)/../libstream
+
+LIBRARY = libiso9660.a
+
+SOURCES = iso9660_mount.c iso9660_opendir.c \
+	  iso9660_closedir.c iso9660_readdir.c \
+	  iso9660_is_directory.c iso9660_open.c \
+	  iso9660_read.c iso9660_close.c \
+	  iso9660_lseek.c iso9660_fstat.c
+
+HEADERS = libiso9660.h
+
+all:
+	test -d $(TARGET) || mkdir $(TARGET)
+	$(MAKE) -C $(TARGET) -f $(TOP)/Makefile $(LIBRARY) TOP=$(TOP)
+
+include $(TOP)/../Rules.mk

Added: branches/vendor/emile/libiso9660/iso9660_close.c
===================================================================
--- branches/vendor/emile/libiso9660/iso9660_close.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libiso9660/iso9660_close.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,14 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+
+#include "libiso9660.h"
+
+void iso9660_close(iso9660_FILE *file)
+{
+	free(file);
+}

Added: branches/vendor/emile/libiso9660/iso9660_closedir.c
===================================================================
--- branches/vendor/emile/libiso9660/iso9660_closedir.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libiso9660/iso9660_closedir.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,19 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+
+#include "libiso9660.h"
+
+int iso9660_closedir(iso9660_DIR *dir)
+{
+	if (dir == NULL)
+		return -1;
+
+	free(dir);
+
+	return 0;
+}

Added: branches/vendor/emile/libiso9660/iso9660_fstat.c
===================================================================
--- branches/vendor/emile/libiso9660/iso9660_fstat.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libiso9660/iso9660_fstat.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,14 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "libiso9660.h"
+
+int iso9660_fstat(iso9660_FILE *file, struct stream_stat *buf)
+{
+	buf->st_size = file->size;
+
+	return 0;
+}

Added: branches/vendor/emile/libiso9660/iso9660_is_directory.c
===================================================================
--- branches/vendor/emile/libiso9660/iso9660_is_directory.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libiso9660/iso9660_is_directory.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,14 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "libiso9660.h"
+
+int iso9660_is_directory(struct iso_directory_record * idr)
+{
+	return ((idr->flags[0] & 2) != 0 &&
+		    (idr->name_len[0] != 1 ||
+		    (idr->name[0] != 0 && idr->name[0] != 1)));
+}

Added: branches/vendor/emile/libiso9660/iso9660_lseek.c
===================================================================
--- branches/vendor/emile/libiso9660/iso9660_lseek.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libiso9660/iso9660_lseek.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,36 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+
+#include "libiso9660.h"
+
+int iso9660_lseek(iso9660_FILE *file, long offset, int whence)
+{
+	long new_offset;
+
+	switch(whence)
+	{
+	case SEEK_SET:
+		new_offset = offset;
+		break;
+	case SEEK_CUR:
+		new_offset = file->offset + offset;
+		break;
+	case SEEK_END:
+		new_offset = file->size + offset;
+		break;
+	default:
+		return -1;
+	}
+
+	if ( (new_offset < 0) || (new_offset > file->size) )
+		return -1;
+
+	file->offset = new_offset;
+
+	return new_offset;
+}

Added: branches/vendor/emile/libiso9660/iso9660_mount.c
===================================================================
--- branches/vendor/emile/libiso9660/iso9660_mount.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libiso9660/iso9660_mount.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,316 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ * some parts from mkisofs (c) J. Schilling
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "libiso9660.h"
+
+#ifdef DEBUG
+void
+printchars(s, n)
+        char    *s;
+        int     n;
+{
+        int     i;
+        char    *p;
+
+        for (; n > 0 && *s; n--) {
+                if (*s == ' ') {
+                        p = s;
+                        i = n;
+                        while (--i >= 0 && *p++ == ' ')
+                                ;
+                        if (i <= 0)
+                                break;
+                }
+                putchar(*s++);
+        }
+}
+
+void print_info(struct iso_primary_descriptor *ipd)
+{
+	/* filesystem information */
+
+	printf("System id: ");
+	printchars(ipd->system_id, 32);
+	putchar('\n');
+	printf("Volume id: ");
+	printchars(ipd->volume_id, 32);
+	putchar('\n');
+
+	printf("Volume set id: ");
+	printchars(ipd->volume_set_id, 128);
+	putchar('\n');
+	printf("Publisher id: ");
+	printchars(ipd->publisher_id, 128);
+	putchar('\n');
+	printf("Data preparer id: ");
+	printchars(ipd->preparer_id, 128);
+	putchar('\n');
+	printf("Application id: ");
+	printchars(ipd->application_id, 128);
+	putchar('\n');
+
+	printf("Copyright File id: ");
+	printchars(ipd->copyright_file_id, 37);
+	putchar('\n');
+	printf("Abstract File id: ");
+	printchars(ipd->abstract_file_id, 37);
+	putchar('\n');
+	printf("Bibliographic File id: ");
+	printchars(ipd->bibliographic_file_id, 37);
+	putchar('\n');
+
+	printf("Volume set size is: %d\n", isonum_723(ipd->volume_set_size));
+	printf("Volume set sequence number is: %d\n", isonum_723(ipd->volume_sequence_number));
+	printf("Logical block size is: %d\n", isonum_723(ipd->logical_block_size));
+	printf("Volume size is: %d\n", isonum_733((unsigned char *)ipd->volume_space_size));
+}
+#endif
+
+void iso9660_name(int ucs_level, char *buffer, struct iso_directory_record * idr)
+{
+	int	j;
+	unsigned char	uh, ul, uc;
+
+	buffer[0] = 0;
+	if (idr->name_len[0] == 1 && idr->name[0] == 0)
+		strcpy(buffer, ".");
+	else if (idr->name_len[0] == 1 && idr->name[0] == 1)
+		strcpy(buffer, "..");
+	else {
+		switch (ucs_level) {
+		case 3:
+		case 2:
+		case 1:
+			/*
+			 * Unicode name.
+			 */
+
+			for (j = 0; j < (int)idr->name_len[0] / 2; j++) {
+				uh = idr->name[j*2];
+				ul = idr->name[j*2+1];
+
+				/*
+				 * unicode convertion
+				 * up = unls->unls_uni2cs[uh];
+				 *
+				 * if (up == NULL)
+				 *	uc = '\0';
+				 * else
+				 *	uc = up[ul];
+				 *
+				 * we use only low byte
+				 */
+
+				uc = ul;
+
+				buffer[j] = uc ? uc : '_';
+			}
+			buffer[idr->name_len[0]/2] = '\0';
+			break;
+		case 0:
+			/*
+			 * Normal non-Unicode name.
+			 */
+			strncpy(buffer, idr->name, idr->name_len[0]);
+			buffer[idr->name_len[0]] = 0;
+			break;
+		default:
+			/*
+			 * Don't know how to do these yet.  Maybe they are the same
+			 * as one of the above.
+			 */
+			break;
+		}
+	}
+}
+
+iso9660_VOLUME *iso9660_mount(device_io_t *device)
+{
+	iso9660_VOLUME* volume;
+	struct iso_primary_descriptor *jpd;
+	struct iso_primary_descriptor ipd;
+	struct iso_directory_record * idr;
+	int	block;
+	int ucs_level;
+
+	/* read filesystem descriptor */
+
+	device->read_sector(device->data, 16, &ipd, sizeof (ipd));
+	idr = (struct iso_directory_record *)ipd.root_directory_record;
+
+	/*
+	 * High sierra:
+	 *
+	 *	DESC TYPE	== 1 (VD_SFS)	offset 8	len 1
+	 *	STR ID		== "CDROM"	offset 9	len 5
+	 *	STD_VER		== 1		offset 14	len 1
+	 */
+
+	/* High Sierra format ? */
+
+	if ((((char *)&ipd)[8] == 1) &&
+	    (strncmp(&((char *)&ipd)[9], "CDROM", 5) == 0) &&
+	    (((char *)&ipd)[14] == 1)) {
+		printf("Incompatible format: High Sierra format\n");
+		return NULL;
+	}
+
+	/*
+	 * ISO 9660:
+	 *
+	 *	DESC TYPE	== 1 (VD_PVD)	offset 0	len 1
+	 *	STR ID		== "CD001"	offset 1	len 5
+	 *	STD_VER		== 1		offset 6	len 1
+	 */
+
+	/* NOT ISO 9660 format ? */
+
+	if ((ipd.type[0] != ISO_VD_PRIMARY) ||
+	    (strncmp(ipd.id, ISO_STANDARD_ID, sizeof (ipd.id)) != 0) ||
+	    (ipd.version[0] != 1)) {
+		printf("Not ISO 9660 format\n");
+		return NULL;
+	}
+
+#ifdef DEBUG
+	print_info(&ipd);
+#endif
+
+	/* UCS info */
+
+	block = 16;
+
+	jpd = (struct iso_primary_descriptor *)
+		malloc(sizeof(struct iso_primary_descriptor));
+	if (jpd == NULL)
+		return NULL;
+
+	memcpy(jpd, &ipd, sizeof (ipd));
+	while ((u_int8_t)jpd->type[0] != ISO_VD_END) {
+
+		/*
+		 * If Joliet UCS escape sequence found, we may be wrong
+		 */
+
+		if (jpd->unused3[0] == '%' &&
+		    jpd->unused3[1] == '/' &&
+		    (jpd->unused3[3] == '\0' ||
+		    jpd->unused3[3] == ' ') &&
+		    (jpd->unused3[2] == '@' ||
+		    jpd->unused3[2] == 'C' ||
+		    jpd->unused3[2] == 'E')) {
+
+			if (jpd->version[0] == 1)
+				goto nextblock;
+		}
+#ifdef DEBUG
+		if (jpd->type[0] == 0) {
+			printf("EL TORITO\n");
+		}
+		if (jpd->version[0] == 2) {
+			printf("CD-ROM uses ISO 9660:1999 relaxed format\n");
+			break;
+		}
+#endif
+
+nextblock:
+		block++;
+		device->read_sector(device->data, block, jpd, sizeof (*jpd));
+	}
+
+	/*
+	 * ISO 9660:
+	 *
+	 *	DESC TYPE	== 1 (VD_PVD)	offset 0	len 1
+	 *	STR ID		== "CD001"	offset 1	len 5
+	 *	STD_VER		== 1		offset 6	len 1
+	 */
+
+	/* NOT ISO 9660 format ? */
+
+	if ((ipd.type[0] != ISO_VD_PRIMARY) ||
+	    (strncmp(ipd.id, ISO_STANDARD_ID, sizeof (ipd.id)) != 0) ||
+	    (ipd.version[0] != 1))
+		return NULL;
+
+	block = 16;
+	memcpy(jpd, &ipd, sizeof (ipd));
+	while ((unsigned char) jpd->type[0] != ISO_VD_END) {
+
+		/*
+		 * Find the UCS escape sequence.
+		 */
+		if (jpd->unused3[0] == '%' &&
+		    jpd->unused3[1] == '/' &&
+		    (jpd->unused3[3] == '\0' ||
+		    jpd->unused3[3] == ' ') &&
+		    (jpd->unused3[2] == '@' ||
+		    jpd->unused3[2] == 'C' ||
+		    jpd->unused3[2] == 'E')) {
+			break;
+		}
+
+		block++;
+		device->read_sector(device->data, block, jpd, sizeof (*jpd));
+	}
+
+	/* Unable to find Joliet SVD */
+
+	if (((unsigned char) jpd->type[0] == ISO_VD_END)) {
+		free(jpd);
+		return NULL;
+	}
+
+	switch (jpd->unused3[2]) {
+	case '@':
+		ucs_level = 1;
+		break;
+	case 'C':
+		ucs_level = 2;
+		break;
+	case 'E':
+		ucs_level = 3;
+		break;
+	default:
+		/* Don't know what ucs_level */
+		free(jpd);
+		return NULL;
+	}
+
+	if (jpd->unused3[3] == ' ')
+		printf("Warning: Joliet escape sequence uses illegal space at offset 3\n");
+
+	volume = (iso9660_VOLUME*)malloc(sizeof(iso9660_VOLUME));
+	if (volume == NULL)
+		return NULL;
+
+	volume->descriptor = jpd;
+	volume->ucs_level = ucs_level;
+	volume->device = device;
+
+	return volume;
+}
+
+int iso9660_umount(iso9660_VOLUME* volume)
+{
+	if (volume == NULL)
+		return -1;
+	free(volume->descriptor);
+	free(volume);
+	return 0;
+}
+
+struct iso_directory_record *iso9660_get_root_node(iso9660_VOLUME* volume)
+{
+	return (struct iso_directory_record *)volume->descriptor->root_directory_record;
+}

Added: branches/vendor/emile/libiso9660/iso9660_open.c
===================================================================
--- branches/vendor/emile/libiso9660/iso9660_open.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libiso9660/iso9660_open.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,38 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+
+#include "libiso9660.h"
+
+iso9660_FILE* iso9660_open(iso9660_VOLUME *volume, char* pathname)
+{
+	struct iso_directory_record *root;
+	struct iso_directory_record *idr;
+	iso9660_FILE *file;
+
+	root = iso9660_get_root_node(volume);
+	if (root == NULL)
+		return NULL;
+
+	idr = iso9660_get_node(volume, root, pathname);
+	if (idr == NULL)
+		return NULL;
+
+	file = (iso9660_FILE*)malloc(sizeof(iso9660_FILE));
+	if (file == NULL)
+		return NULL;
+
+	file->base = isonum_733((unsigned char *)idr->extent);
+	file->size = isonum_733((unsigned char *)idr->size);
+	file->offset = 0;
+	file->current = -1;
+	file->volume = volume;
+
+	free(idr);
+
+	return file;
+}

Added: branches/vendor/emile/libiso9660/iso9660_opendir.c
===================================================================
--- branches/vendor/emile/libiso9660/iso9660_opendir.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libiso9660/iso9660_opendir.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,125 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "libiso9660.h"
+
+static iso9660_DIR* iso9660_opendir_node(iso9660_VOLUME *volume, struct iso_directory_record *node)
+{
+	iso9660_DIR *dir;
+
+	dir = (iso9660_DIR*)malloc(sizeof(iso9660_DIR));
+	if (dir == NULL)
+		return NULL;
+
+	dir->extent = isonum_733((unsigned char *)node->extent);
+	dir->len = isonum_733((unsigned char *)node->size);
+	dir->index =  sizeof (dir->buffer);
+	dir->volume = volume;
+
+	return dir;
+}
+
+static struct iso_directory_record* idr_new(struct iso_directory_record* idr)
+{
+	struct iso_directory_record* result;
+	int size = sizeof(*idr) + (int)idr->name_len[0];
+
+	result = (struct iso_directory_record*)malloc(size);
+	memcpy(result, idr, size);
+
+	return result;
+}
+
+static struct iso_directory_record * seek_name(iso9660_VOLUME *volume,
+					       struct iso_directory_record *idr,
+					       char *name)
+{
+	struct iso_directory_record *result;
+	char name_buf[256];
+	iso9660_DIR *dir;
+
+	dir = iso9660_opendir_node(volume, idr);
+	if (dir == NULL)
+		return NULL;
+
+	while ((idr = iso9660_readdir(dir)) != NULL)
+	{
+		iso9660_name(volume->ucs_level, name_buf, idr);
+		if (strcmp(name, name_buf) == 0)
+		{
+			result = idr_new(idr);
+			iso9660_closedir(dir);
+			return result;
+		}
+	}
+	iso9660_closedir(dir);
+	return NULL;
+}
+
+struct iso_directory_record* iso9660_get_node(
+		iso9660_VOLUME *volume,
+		struct iso_directory_record *dirnode,
+		char *path)
+{
+	struct iso_directory_record* result;
+	struct iso_directory_record* current;
+	char name[256];
+	int i;
+
+	current = idr_new(dirnode);
+	while(1)
+	{
+		/* ignore head '/' */
+
+		while (*path && *path == '/')
+			path++;
+
+		if (*path == 0)
+			break;
+
+		/* extract first path component */
+
+		i = 0;
+		while (*path && *path != '/')
+			name[i++] = *path++;
+		name[i] = 0;
+
+		/* seek first component in current directory */
+
+		result = seek_name(volume, current, name);
+		if (result == NULL)
+			return NULL;
+	
+		free(current);
+		current = result;
+	}
+	return current;
+}
+
+iso9660_DIR* iso9660_opendir(iso9660_VOLUME *volume, char *name)
+{
+	iso9660_DIR *dir;
+	struct iso_directory_record *node;
+
+	node = iso9660_get_root_node(volume);
+	if (node == NULL)
+		return NULL;
+
+	node = iso9660_get_node(volume, node, name);
+	if (node == NULL)
+		return NULL;
+
+	dir = iso9660_opendir_node(volume, node);
+
+	free(node);
+
+	dir->volume = volume;
+
+	return dir;
+}

Added: branches/vendor/emile/libiso9660/iso9660_read.c
===================================================================
--- branches/vendor/emile/libiso9660/iso9660_read.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libiso9660/iso9660_read.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,71 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <string.h>
+#include <stdio.h>
+
+#include "libiso9660.h"
+
+ssize_t iso9660_read(iso9660_FILE *file, void *buf, size_t count)
+{
+	size_t read = 0;
+
+	if ( count > (file->size  - file->offset) )
+		count = file->size  - file->offset;
+
+	while (count > 0)
+	{
+		size_t part;
+		int offset_extent;
+		int offset_index;
+
+		offset_extent = file->base + 
+				    (file->offset / ISO9660_EXTENT_SIZE);
+		offset_index = file->offset % ISO9660_EXTENT_SIZE;
+
+		if (file->current != offset_extent)
+		{
+			if ( (offset_index == 0) && 
+			     (count >= ISO9660_EXTENT_SIZE) )
+			{
+				/* direct i/o */
+
+				int extents_nb;
+
+				extents_nb = count / ISO9660_EXTENT_SIZE;
+
+				part = extents_nb * ISO9660_EXTENT_SIZE;
+
+				file->volume->device->read_sector(file->volume->device->data,
+							  offset_extent, 
+							  buf + read, part);
+				file->offset += part;
+				count -= part;
+				read += part;
+
+				continue;
+			}
+
+			file->current = offset_extent;
+			file->volume->device->read_sector(file->volume->device->data,
+						  offset_extent,
+						  file->buffer, 
+						  ISO9660_EXTENT_SIZE);
+		}
+
+		part = ISO9660_EXTENT_SIZE - offset_index;
+		if (count < part)
+			part = count;
+
+		memcpy(buf + read, file->buffer + offset_index, part);
+
+		file->offset += part;
+		count -= part;
+		read += part;
+	}
+
+	return read;
+}

Added: branches/vendor/emile/libiso9660/iso9660_readdir.c
===================================================================
--- branches/vendor/emile/libiso9660/iso9660_readdir.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libiso9660/iso9660_readdir.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,30 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "libiso9660.h"
+
+struct iso_directory_record *iso9660_readdir(iso9660_DIR *dir)
+{
+	struct iso_directory_record *idr;
+
+	if (dir->index > 2048 - offsetof(struct iso_directory_record, name[0]))
+	{
+		if (dir->len <= 0)
+			return NULL;
+		dir->volume->device->read_sector(dir->volume->device->data, dir->extent, dir->buffer, sizeof (dir->buffer));
+		dir->len -= sizeof (dir->buffer);
+		dir->extent++;
+		dir->index = 0;
+	}
+
+	idr = (struct iso_directory_record *) &dir->buffer[dir->index];
+	if (idr->length[0] == 0)
+		return NULL;
+
+	dir->index += dir->buffer[dir->index];
+
+	return idr;
+}

Added: branches/vendor/emile/libiso9660/libiso9660.h
===================================================================
--- branches/vendor/emile/libiso9660/libiso9660.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libiso9660/libiso9660.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,72 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __LIBISO9660_H__
+#define __LIBISO9660_H__
+
+#include <unistd.h>
+#include <linux/iso_fs.h>
+
+#include <libstream.h>
+
+#define ISO9660_EXTENT_SIZE (2048)
+
+typedef struct iso9660_VOLUME {
+	int ucs_level;
+	struct iso_primary_descriptor *descriptor;
+	device_io_t *device;
+} iso9660_VOLUME;
+
+typedef struct iso9660_DIR {
+	iso9660_VOLUME *volume;
+	int extent;
+	int len;
+	int index;
+	unsigned char buffer[ISO9660_EXTENT_SIZE];
+} iso9660_DIR;
+
+typedef struct iso9660_FILE {
+	iso9660_VOLUME *volume;
+	int base;			/* first extent of the file */
+	int size;			/* size of the file */
+	int offset;
+	int current;
+	unsigned char buffer[ISO9660_EXTENT_SIZE];
+} iso9660_FILE;
+
+static inline int isonum_721(char *p)
+{
+        return ((p[0] & 0xff)
+                | ((p[1] & 0xff) << 8));
+}
+
+static inline int isonum_723(char *p)
+{
+        return (isonum_721(p));
+}
+
+static inline int isonum_733(char *p)
+{
+	return ((p[0] & 0xff) | ((p[1] & 0xff) << 8) | 
+		((p[2] & 0xff) << 16) | ((p[3] & 0xff) << 24));
+}
+
+extern iso9660_VOLUME* iso9660_mount(device_io_t *device);
+extern int iso9660_umount(iso9660_VOLUME *volume);
+extern iso9660_DIR* iso9660_opendir(iso9660_VOLUME *, char *name);
+extern iso9660_FILE* iso9660_open(iso9660_VOLUME *, char* pathname);
+extern void iso9660_name(int ucs_level, char *buffer, struct iso_directory_record * idr);
+extern struct iso_directory_record *iso9660_get_root_node(iso9660_VOLUME* volume);
+extern int iso9660_closedir(iso9660_DIR *dir);
+extern struct iso_directory_record *iso9660_readdir(iso9660_DIR *dir);
+extern int iso9660_is_directory(struct iso_directory_record * idr);
+extern struct iso_directory_record* iso9660_get_node(iso9660_VOLUME *volume, struct iso_directory_record *dirnode, char *path);
+extern ssize_t iso9660_read(iso9660_FILE *file, void *buf, size_t count);
+extern void iso9660_close(iso9660_FILE *file);
+extern int iso9660_lseek(iso9660_FILE *file, long offset, int whence);
+extern int iso9660_fstat(iso9660_FILE *file, struct stream_stat *buf);
+
+#endif /* __LIBISO9660_H__ */

Added: branches/vendor/emile/libmacos/CloseDriver.c
===================================================================
--- branches/vendor/emile/libmacos/CloseDriver.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/CloseDriver.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,25 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <string.h>
+
+#include <macos/devices.h>
+
+OSErr CloseDriver(short refNum)
+{
+	OSErr err;
+	ParamBlockRec param;
+
+	memset(&param, 0, sizeof(ParamBlockRec));
+
+	param.ioRefNum = refNum;
+
+	err = PBCloseSync(&param);
+	if (err != noErr)
+		return err;
+
+	return param.ioResult;
+}

Added: branches/vendor/emile/libmacos/Makefile
===================================================================
--- branches/vendor/emile/libmacos/Makefile	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/Makefile	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,24 @@
+#
+#  (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+#
+
+TOP	= $(shell pwd)
+
+CFLAGS	= -nostdlib -nodefaultlibs -Wall -Werror -Wno-multichar -fpic -O2 -m68000 -Wa,-m68000 -Os
+CPPFLAGS	= -I$(TOP) -DARCH_M68K
+
+LIBRARY = libmacos.a
+
+SOURCES = display_properties.S \
+	  CloseDriver.c OpenDriver.c SerGetBuf.c
+
+HEADERS = libmacos.h \
+	  macos/devices.h macos/errors.h macos/events.h macos/files.h \
+	  macos/gestalt.h macos/init.h macos/lowmem.h \
+	  macos/memory.h macos/osutils.h macos/quickdraw.h macos/romdefs.h \
+	  macos/scsi.h macos/serial.h macos/slotmanager.h macos/traps.h \
+	  macos/types.h macos/video.h
+
+all: $(LIBRARY)
+
+include $(TOP)/../Rules.mk

Added: branches/vendor/emile/libmacos/OpenDriver.c
===================================================================
--- branches/vendor/emile/libmacos/OpenDriver.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/OpenDriver.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,35 @@
+/*
+ * 
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <string.h>
+
+#include <macos/devices.h>
+
+/*
+ * OpenDriver:
+ *
+ * http://developer.apple.com/documentation/mac/Devices/Devices-23.html
+ *
+ */
+
+OSErr OpenDriver(ConstStr255Param name, short *drvrRefNum)
+{
+	OSErr err;
+	ParamBlockRec param;
+
+	memset(&param, 0, sizeof(ParamBlockRec));
+
+	param.ioNamePtr = (unsigned char*)name;
+	param.ioPermssn = fsCurPerm;
+
+	err = PBOpenSync(&param);
+	if (err != noErr)
+		return err;
+
+	*drvrRefNum = param.ioRefNum;
+
+	return param.ioResult;
+}

Added: branches/vendor/emile/libmacos/SerGetBuf.c
===================================================================
--- branches/vendor/emile/libmacos/SerGetBuf.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/SerGetBuf.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,25 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <macos/devices.h>
+#include <macos/serial.h>
+
+OSErr SerGetBuf(short refNum, long *count)
+{
+	int res;
+	CntrlParam param;
+
+	param.ioCompletion = 0;
+	param.ioVRefNum = 0;
+	param.ioCRefNum = refNum;
+	param.csCode = kSERDInputCount;
+	
+	res = PBStatusSync((ParmBlkPtr)&param);
+
+	*count = *(long*)&param.csParam;
+
+	return res;
+}

Added: branches/vendor/emile/libmacos/display_properties.S
===================================================================
--- branches/vendor/emile/libmacos/display_properties.S	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/display_properties.S	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,165 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+	.chip 68000
+
+	.align 	2
+
+/*	#include <ConditionalMacros.h>
+ *	#include <Quickdraw.h>
+ */
+
+	.globl glue_display_properties
+	.type	 glue_display_properties, at function
+
+/*
+ * int
+ * glue_display_properties(unsigned long *base, unsigned long *row_bytes,
+ *			   unsigned long *width, unsigned long *height,
+ *			   unsigned long *depth, unsigned long* video)
+ */
+
+glue_display_properties:
+	/*
+         * GDHandle        hdl;
+	 * volatile PixMapPtr       pm;
+	 */
+
+	link.w %a6,#-4
+	movem.l	%a2-%a4, %sp at -
+
+	movm.l #0x3c,-(%sp)
+	move.l 28(%a6),%a3		/* unsigned long *video */
+	move.l 12(%a6),%a5		/* unsigned long *row_bytes */
+	move.l 24(%a6),%a4		/* unsigned long *depth */
+
+	/* hdl = LMGetMainDevice(); */
+
+	move.l     0x08A4,%a0
+
+
+	/* if (hdl == 0xAAAAAAAA || hdl == NULL || (**hdl).gdPMap == NULL)
+	 *	return;
+	 */
+
+	cmpa.l	#0xAAAAAAAA, %a0
+	jbeq .exit_error
+cmpa.l	#0, %a0
+	jbeq .exit_error
+	move.l (%a0),%a0
+	tst.l 22(%a0)
+	jbeq .exit_error
+
+	/* pm = *(**hdl).gdPMap; */
+
+	move.l 22(%a0),%a0
+
+	/* if (pm->baseAddr == NULL)
+	 *	return;
+	 */
+
+	move.l (%a0),-4(%a6)
+	move.l -4(%a6),%a0
+	tst.l (%a0)
+	jbeq .exit_error
+
+	/* *video = (unsigned char *)pm->baseAddr; */
+
+	move.l -4(%a6),%a0
+	move.l (%a0),(%a3)
+
+
+	/* *row_bytes = pm->rowBytes & 0x3fff; */
+
+	move.l -4(%a6),%a0
+	move.w 4(%a0),%d0
+	and.l #16383,%d0
+	move.l %d0,(%a5)
+
+	/* *width = pm->bounds.right - pm->bounds.left; */
+
+	move.l -4(%a6),%a0
+	move.w 12(%a0),%a2
+	move.l -4(%a6),%a1
+	move.l 16(%a6),%a0
+	sub.w 8(%a1),%a2
+	move.l %a2,(%a0)
+
+	/* *height = pm->bounds.bottom - pm->bounds.top; */
+
+	move.l -4(%a6),%a0
+	move.w 10(%a0),%a2
+	move.l -4(%a6),%a1
+	move.l 20(%a6),%a0
+	sub.w 6(%a1),%a2
+	move.l %a2,(%a0)
+
+	/* *depth = pm->pixelSize; */
+
+	move.l -4(%a6),%a0
+	move.w 32(%a0),%a0
+	move.l %a0,(%a4)
+
+	/* if (*depth == 15) *depth = 16; */
+
+	moveq.l #15,%d0
+	cmp.l %a0,%d0
+	jbne .not_15
+	moveq.l #16,%d0
+	move.l %d0,(%a4)
+.not_15:
+
+	/* (*base) = (*video) */
+
+	move.l	(%a3),%d0
+	move.l 8(%a6),%a3		/* unsigned long *base */
+	move.l	%d0,(%a3)
+
+	/* (*base) = (*video) + pm->bounds.top * *row_bytes; */
+
+	move.l -4(%a6),%a0
+	move.w 6(%a0),%d0
+
+	/* add 68000 support,
+	 *
+	 * row_bytes can be stored on a short
+	 *
+	 */
+
+	move.l	(%a5), %d1
+	muls.w %d1, %d0
+
+	add.l %d0,(%a3)
+
+	/* (*base) += pm->bounds.left * ((*depth) >> 3); */
+
+	move.l -4(%a6),%a0
+	move.w 8(%a0),%d1
+	move.l (%a4),%d0
+	lsr.l #3,%d0
+
+	/* add 68000 support,
+	 *
+	 * NOTE: depth can be stored on a short
+	 *
+	 */
+
+	muls.w	%d0, %d1
+
+	add.l %d1,(%a3)
+
+.exit:
+	movm.l (%sp)+,#0x3c00
+	movem.l	%sp at +, %a2-%a4
+	unlk %a6
+	moveq.l	#0, %d0
+	rts
+.exit_error:
+	movm.l (%sp)+,#0x3c00
+	movem.l	%sp at +, %a2-%a4
+	unlk %a6
+	moveq.l	#-1, %d0
+	rts

Added: branches/vendor/emile/libmacos/libmacos.h
===================================================================
--- branches/vendor/emile/libmacos/libmacos.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/libmacos.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,10 @@
+/*
+ *
+ * (c) 2004, 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+extern int glue_display_properties(unsigned long *base, 
+				    unsigned long *row_bytes,
+				    unsigned long *width, unsigned long *height,
+				    unsigned long *depth, unsigned long *video);

Added: branches/vendor/emile/libmacos/macos/devices.h
===================================================================
--- branches/vendor/emile/libmacos/macos/devices.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/devices.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,123 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_DEVICES_H__
+#define __MACOS_DEVICES_H__
+
+#include <macos/traps.h>
+#include <macos/types.h>
+#include <macos/files.h>
+#include <macos/errors.h>
+
+typedef struct
+{
+	short		drvrFlags;
+	short		drvrDelay;
+	short		drvrEMask;
+	short		drvrMenu;
+	short		drvrOpen;
+	short		drvrPrime;
+	short		drvrCtl;
+	short		drvrStatus;
+	short		drvrClose;
+	unsigned char	drvrName[];
+} DriverHeader;
+enum {
+dVMImmuneMask                 = 0x0001, /* driver does not need VM protection */
+dOpenedMask                   = 0x0020, /* driver is open */
+dRAMBasedMask                 = 0x0040, /* dCtlDriver is a handle (1) or pointer (0) */
+drvrActiveMask                = 0x0080 /* driver is currently processing a request */
+};
+
+struct DCtlEntry {
+void*                 dCtlDriver;
+volatile short      dCtlFlags;
+void*                dCtlQHdr;
+volatile long       dCtlPosition;
+void**              dCtlStorage;
+short               dCtlRefNum;
+long                dCtlCurTicks;
+void*             dCtlWindow;
+short               dCtlDelay;
+short               dCtlEMask;
+short               dCtlMenu;
+};
+typedef struct DCtlEntry                DCtlEntry;
+typedef DCtlEntry *                     DCtlPtr;
+typedef DCtlPtr *                       DCtlHandle;
+
+#ifdef ARCH_M68K
+static inline OSErr PBCloseSync(ParmBlkPtr paramBlock)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("move.l %1, %%a0\n"
+		Trap(_PBCloseSync)
+	    : "=d" (ret) : "g" (paramBlock) : UNPRESERVED_REGS);
+
+	return ret;
+}
+
+static inline OSErr PBControlSync(ParmBlkPtr paramBlock)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("move.l %1, %%a0\n"
+		Trap(_PBControlSync)
+	    : "=d" (ret) : "g" (paramBlock) : UNPRESERVED_REGS);
+
+	return ret;
+}
+
+static inline OSErr PBOpenSync(ParmBlkPtr paramBlock)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("move.l %1, %%a0\n"
+		Trap(_PBOpenSync)
+	    : "=d" (ret) : "g" (paramBlock) : UNPRESERVED_REGS);
+
+	return ret;
+}
+
+static inline OSErr PBReadSync(ParamBlockRec_t* paramBlock)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("move.l %1, %%a0\n"
+		Trap(_PBReadSync)
+	    : "=d" (ret) : "g" (paramBlock) : UNPRESERVED_REGS);
+
+	return ret;
+}
+
+static inline OSErr PBStatusSync(ParamBlockRec_t* paramBlock)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("move.l %1, %%a0\n"
+		Trap(_PBStatusSync)
+	    : "=d" (ret) : "g" (paramBlock) : UNPRESERVED_REGS);
+
+	return ret;
+}
+
+static inline OSErr PBWriteSync(ParamBlockRec_t* paramBlock)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("move.l %1, %%a0\n"
+		Trap(_PBWriteSync)
+	    : "=d" (ret) : "g" (paramBlock) : UNPRESERVED_REGS);
+
+	return ret;
+}
+
+extern OSErr OpenDriver(ConstStr255Param name, short *drvrRefNum);
+extern OSErr CloseDriver(short refNum);
+extern OSErr SerGetBuf(short refNum, long *count);
+#endif /* ARCH_M68K */
+#endif /* __MACOS_DEVICES_H__ */

Added: branches/vendor/emile/libmacos/macos/errors.h
===================================================================
--- branches/vendor/emile/libmacos/macos/errors.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/errors.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,45 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_ERRORS_H__
+#define __MACOS_ERRORS_H__
+
+#include <macos/traps.h>
+
+enum {
+	noErr = 0,
+	qErr = -1,
+	vTypErr = -2,
+	corErr = -3,
+	unimpErr = -4,
+	SlpTypeErr = -5,
+	seNoDB = -8,
+	controlErr = -17,
+	statusErr = -18,
+	readErr = -19,
+	writErr = -20,
+	badUnitErr = -21,
+	unitEmptyErr = -22,
+	openErr = -23,
+	closErr = -24,
+	dRemovErr = -25,
+	dInstErr = -26,
+	paramErr = -50,
+	userCanceledErr = -128,
+	noHardwareErr = -200,
+	notEnoughHardwareErr = -201,
+	smNoMoresRsrcs = -344,
+};
+
+#ifdef ARCH_M68K
+static inline void SysError(short errorCode)
+{
+	asm("move.l %0, %%d0\n"
+		Trap(_SysError)
+	    :: "g" (errorCode) : "%%d0", UNPRESERVED_REGS);
+}
+#endif /* ARCH_M68K */
+#endif /* __MACOS_ERRORS_H__ */

Added: branches/vendor/emile/libmacos/macos/events.h
===================================================================
--- branches/vendor/emile/libmacos/macos/events.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/events.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,20 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_EVENTS_H__
+#define __MACOS_EVENTS_H__
+
+#include <macos/traps.h>
+
+typedef u_int32_t	KeyMap[4];
+
+static inline void GetKeys(KeyMap theKeys)
+{
+	asm("move.l %0, -(%%sp)\n"
+		Trap(_GetKeys)
+	    :: "g" (theKeys) : "%%d0", UNPRESERVED_REGS );
+}
+#endif /* __MACOS_EVENTS_H__ */

Added: branches/vendor/emile/libmacos/macos/files.h
===================================================================
--- branches/vendor/emile/libmacos/macos/files.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/files.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,138 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_FILES_H__
+#define __MACOS_FILES_H__
+
+#include <macos/traps.h>
+
+enum {
+	fsAtMark	= 0,
+	fsFromStart	= 1,
+	fsFromLEOF	= 2,
+	fsFromMark	= 3
+};
+
+/* ParamBlockRec Structure: "Inside Macintosh: Files", p. 2-87 */
+
+#define COMMON_PARAMS							\
+	void*		qLink;		/* next queue entry */		\
+	u_int16_t	qType;		/* queue type */		\
+	u_int16_t	ioTrap;		/* routine trap */		\
+	void*		ioCmdAddr;	/* routine address */		\
+	void*		ioCompletion;	/* ptr to completion routine */	\
+	u_int16_t	ioResult;	/* result code */		\
+	unsigned char*	ioNamePtr;	/* pointer to pathname */	\
+	int16_t		ioVRefNum;	/* volume specification */
+
+typedef struct ParamBlockRec ParamBlockRec_t;
+struct ParamBlockRec {
+	COMMON_PARAMS
+	int16_t		ioRefNum;	/* file reference number */
+	int8_t		ioVersNum;	/* version number */
+	int8_t		ioPermssn;	/* read/write permission */
+	u_int32_t	ioMisc;		/* miscellaneaous */
+	u_int32_t	ioBuffer;	/* data buffer */
+	u_int32_t	ioReqCount;	/* requested number of bytes */
+	u_int32_t	ioActCount;	/* actual number of bytes */
+	u_int16_t	ioPosMode;	/* positioning mode and newline char */
+	int32_t		ioPosOffset;	/* positionning offset */
+} __attribute__((packed));
+typedef struct ParamBlockRec ParamBlockRec;
+typedef struct ParamBlockRec* ParmBlkPtr;
+
+struct CntrlParam {
+	COMMON_PARAMS
+	int16_t			ioCRefNum;
+	int16_t			csCode;
+	int16_t			csParam[11];
+};
+typedef struct CntrlParam CntrlParam;
+typedef CntrlParam* CntrlParamPtr;
+
+struct VolumeParam {
+	COMMON_PARAMS
+	int32_t		filler2;
+	int16_t		ioVolIndex;	/* Volume index number */
+	u_int32_t	ioVCrDate;	/* Creation date/time */
+	u_int32_t	ioVLsBkUp;	/* Last backup date/time */
+	u_int16_t	ioVAtrb;	/* Volume attr */
+	u_int16_t	ioVNmFls;	/* Number of files in directory */
+	u_int16_t	ioVDirSt;	/* Start block of file directory */
+	int16_t		ioVBlLn;	/* GetVolInfo:
+					 * length of dir in blocks
+					 */
+	u_int16_t	ioVNmAlBlks;	/* For compatibilty:
+					 * ioVNmAlBlks * ioVAlBlkSiz <= 2 GB
+					 */
+	u_int32_t	ioVAlBlkSiz;	/* For compatibilty:
+					 * ioVAlBlkSiz is <= $0000FE00 (65,024)
+					 */
+	u_int32_t	ioVClpSiz;	/*GetVolInfo: bytes to allocate at a time*/
+	u_int16_t	ioAlBlSt;	/* Starting disk(512-byte) block in block map */
+	u_int32_t	ioVNxtFNum;	/* GetVolInfo: 
+					 * next free file number
+					 */
+	u_int16_t	ioVFrBlk;	/* GetVolInfo:
+					 * # free alloc blks for this volume
+					 */
+};
+typedef struct VolumeParam	VolumeParam;
+typedef VolumeParam*		VolumeParamPtr;
+#define ASSERT_PBR(a)	if ( sizeof(ParamBlockRec_t) != 50 ) { a }
+
+/* access permissions : Inside Macintosh: Devices
+ * http://developer.apple.com/documentation/mac/Devices/
+ */
+
+enum {
+	fsCurPerm	= 0,	/* retain current permission */
+	fsRdPerm	= 1,	/* allow reads only */
+	fsWrPerm	= 2,	/* allow writes only */
+	fsRdWrPerm	= 3	/* allow reads and writes */
+};
+
+struct DrvQEl {
+  void*            qLink;
+  int16_t               qType;
+  int16_t               dQDrive;
+  int16_t               dQRefNum;
+  int16_t               dQFSID;
+  u_int16_t	dQDrvSz;
+  u_int16_t	dQDrvSz2;
+};
+typedef struct DrvQEl                   DrvQEl;
+typedef DrvQEl *                        DrvQElPtr;
+
+#ifdef ARCH_M68K
+static inline void FInitQueue(void)
+{
+	asm(Trap(_FInitQueue) ::: "%%d0", UNPRESERVED_REGS);
+}
+
+static inline OSErr PBGetVInfoSync(ParmBlkPtr paramBlock)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("move.l %1, %%a0\n"
+		Trap(_GetVolInfo)
+	    : "=g" (ret) : "g" (paramBlock) : UNPRESERVED_REGS);
+
+	return ret;
+}
+
+static inline OSErr PBMountVol(ParmBlkPtr paramBlock)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("move.l %1, %%a0\n"
+		Trap(_MountVol)
+	    : "=g" (ret) : "g" (paramBlock) : UNPRESERVED_REGS);
+
+	return ret;
+}
+#endif /* ARCH_M68K */
+#endif /* __MACOS_FILES_H__ */

Added: branches/vendor/emile/libmacos/macos/gestalt.h
===================================================================
--- branches/vendor/emile/libmacos/macos/gestalt.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/gestalt.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,223 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_GESTALT_H__
+#define __MACOS_GESTALT_H__
+
+#include <macos/traps.h>
+
+enum {
+	gestaltProcessorType	= 'proc',
+	gestalt68000		= 1,
+	gestalt68010		= 2,
+	gestalt68020		= 3,
+	gestalt68030		= 4,
+	gestalt68040		= 5
+};
+
+enum {
+	gestaltMMUType		= 'mmu ', /* mmu type */
+	gestaltNoMMU		= 0,	/* no MMU */
+	gestaltAMU		= 1,	/* address management unit */
+	gestalt68851		= 2,	/* 68851 PMMU */
+	gestalt68030MMU		= 3,	/* 68030 built-in MMU */
+	gestalt68040MMU		= 4,	/* 68040 built-in MMU */
+	gestaltEMMU1		= 5	/* Emulated MMU type 1  */
+};
+
+enum {
+	gestaltFPUType	= 'fpu ', /* fpu type */
+	gestaltNoFPU	= 0,	/* no FPU */
+	gestalt68881	= 1,	/* 68881 FPU */
+	gestalt68882	= 2,	/* 68882 FPU */
+	gestalt68040FPU	= 3	/* 68040 built-in FPU */
+};
+
+enum {
+	gestaltSysArchitecture	= 'sysa',  /* Native System Architecture */
+	gestalt68k		= 1,	   /* Motorola MC68k architecture */
+	gestaltPowerPC		= 2	   /* IBM PowerPC architecture */
+};
+
+enum {
+  gestaltMachineType            = 'mach',	/* machine type */
+  gestaltClassic                = 1,
+  gestaltMacXL                  = 2,
+  gestaltMac512KE               = 3,
+  gestaltMacPlus                = 4,
+  gestaltMacSE                  = 5,
+  gestaltMacII                  = 6,
+  gestaltMacIIx                 = 7,
+  gestaltMacIIcx                = 8,
+  gestaltMacSE030               = 9,
+  gestaltPortable               = 10,
+  gestaltMacIIci                = 11,
+  gestaltPowerMac8100_120       = 12,
+  gestaltMacIIfx                = 13,
+  gestaltMacClassic             = 17,
+  gestaltMacIIsi                = 18,
+  gestaltMacLC                  = 19,
+  gestaltMacQuadra900           = 20,
+  gestaltPowerBook170           = 21,
+  gestaltMacQuadra700           = 22,
+  gestaltClassicII              = 23,
+  gestaltPowerBook100           = 24,
+  gestaltPowerBook140           = 25,
+  gestaltMacQuadra950           = 26,
+  gestaltMacLCIII               = 27,
+  gestaltPerforma450            = gestaltMacLCIII,
+  gestaltPowerBookDuo210        = 29,
+  gestaltMacCentris650          = 30,
+  gestaltPowerBookDuo230        = 32,
+  gestaltPowerBook180           = 33,
+  gestaltPowerBook160           = 34,
+  gestaltMacQuadra800           = 35,
+  gestaltMacQuadra650           = 36,
+  gestaltMacLCII                = 37,
+  gestaltPowerBookDuo250        = 38,
+  gestaltAWS9150_80             = 39,
+  gestaltPowerMac8100_110       = 40,
+  gestaltAWS8150_110            = gestaltPowerMac8100_110,
+  gestaltPowerMac5200           = 41,
+  gestaltPowerMac5260           = gestaltPowerMac5200,
+  gestaltPerforma5300           = gestaltPowerMac5200,
+  gestaltPowerMac6200           = 42,
+  gestaltPerforma6300           = gestaltPowerMac6200,
+  gestaltMacIIvi                = 44,
+  gestaltMacIIvm                = 45,
+  gestaltPerforma600            = gestaltMacIIvm,
+  gestaltPowerMac7100_80        = 47,
+  gestaltMacIIvx                = 48,
+  gestaltMacColorClassic        = 49,
+  gestaltPerforma250            = gestaltMacColorClassic,
+  gestaltPowerBook165c          = 50,
+  gestaltMacCentris610          = 52,
+  gestaltMacQuadra610           = 53,
+  gestaltPowerBook145           = 54,
+  gestaltPowerMac8100_100       = 55,
+  gestaltMacLC520               = 56,
+  gestaltAWS9150_120            = 57,
+  gestaltPowerMac6400           = 58,
+  gestaltPerforma6400           = gestaltPowerMac6400,
+  gestaltPerforma6360           = gestaltPerforma6400,
+  gestaltMacCentris660AV        = 60,
+  gestaltMacQuadra660AV         = gestaltMacCentris660AV,
+  gestaltPerforma46x            = 62,
+  gestaltPowerMac8100_80        = 65,
+  gestaltAWS8150_80             = gestaltPowerMac8100_80,
+  gestaltPowerMac9500           = 67,
+  gestaltPowerMac9600           = gestaltPowerMac9500,
+  gestaltPowerMac7500           = 68,
+  gestaltPowerMac7600           = gestaltPowerMac7500,
+  gestaltPowerMac8500           = 69,
+  gestaltPowerMac8600           = gestaltPowerMac8500,
+  gestaltAWS8550                = gestaltPowerMac7500,
+  gestaltPowerBook180c          = 71,
+  gestaltPowerBook520           = 72,
+  gestaltPowerBook520c          = gestaltPowerBook520,
+  gestaltPowerBook540           = gestaltPowerBook520,
+  gestaltPowerBook540c          = gestaltPowerBook520,
+  gestaltPowerMac5400           = 74,
+  gestaltPowerMac6100_60        = 75,
+  gestaltAWS6150_60             = gestaltPowerMac6100_60,
+  gestaltPowerBookDuo270c       = 77,
+  gestaltMacQuadra840AV         = 78,
+  gestaltPerforma550            = 80,
+  gestaltPowerBook165           = 84,
+  gestaltPowerBook190           = 85,
+  gestaltMacTV                  = 88,
+  gestaltMacLC475               = 89,
+  gestaltPerforma47x            = gestaltMacLC475,
+  gestaltMacLC575               = 92,
+  gestaltMacQuadra605           = 94,
+  gestaltMacQuadra630           = 98,
+  gestaltMacLC580               = 99,
+  gestaltPerforma580            = gestaltMacLC580,
+  gestaltPowerMac6100_66        = 100,
+  gestaltAWS6150_66             = gestaltPowerMac6100_66,
+  gestaltPowerMac6100_80	= 101,
+  gestaltPowerBookDuo280        = 102,
+  gestaltPowerBookDuo280c       = 103,
+  gestaltPowerMacLC475          = 104,
+  gestaltPowerMacPerforma47x    = gestaltPowerMacLC475,
+  gestaltPowerMacLC575          = 105,
+  gestaltPowerMacPerforma57x    = gestaltPowerMacLC575,
+  gestaltPowerMacQuadra630      = 106,
+  gestaltPowerMacLC630          = gestaltPowerMacQuadra630,
+  gestaltPowerMacPerforma63x    = gestaltPowerMacQuadra630,
+  gestaltPowerMac7200           = 108,
+  gestaltPowerMac7300           = 109,
+  gestaltPowerMac7100_66        = 112,
+  gestaltPowerMac7100_80_chipped= 113,
+  gestaltPowerBook150           = 115,
+  gestaltPowerMacQuadra700      = 116,
+  gestaltPowerMacQuadra900      = 117,
+  gestaltPowerMacQuadra950      = 118,
+  gestaltPowerMacCentris610     = 119,
+  gestaltPowerMacCentris650     = 120,
+  gestaltPowerMacQuadra610      = 121,
+  gestaltPowerMacQuadra650      = 122,
+  gestaltPowerMacQuadra800      = 123,
+  gestaltPowerBookDuo2300       = 124,
+  gestaltPowerBook500PPCUpgrade = 126,
+  gestaltPowerBook5300          = 128,
+  gestaltPowerBook1400          = 310,
+  gestaltPowerBook3400          = 306,
+  gestaltPowerBook2400          = 307,
+  gestaltPowerBookG3Series      = 312,
+  gestaltPowerBookG3            = 313,
+  gestaltPowerBookG3Series2     = 314,
+  gestaltPowerMacNewWorld       = 406,
+  gestaltPowerMacG3             = 510,
+  gestaltPowerMac5500           = 512,
+  gestalt20thAnniversary        = gestaltPowerMac5500,
+  gestaltPowerMac6500           = 513,
+  gestaltPowerMac4400_160       = 514,
+  gestaltPowerMac4400           = 515,
+  gestaltMacOSCompatibility     = 1206
+};
+
+enum {
+	gestaltHardwareAttr= 'hdwr',	/* hardware attributes */
+	gestaltHasVIA1		= 0,	/* VIA1 exists */
+	gestaltHasVIA2		= 1,	/* VIA2 exists */
+	gestaltHasRBV          =  2,
+	gestaltHasASC		= 3,	/* Apple Sound Chip exists */
+	gestaltHasSCC		= 4,	/* SCC exists */
+	gestaltHasOSS          =  5,
+	gestaltHasSCSIDMA      =  6,
+	gestaltHasSCSI		= 7,	/* SCSI exists */
+	gestaltHasSWIMIOP      =  8,
+	gestaltHasSCCIOP       =  9,
+	gestaltHasFitch        = 10,
+	gestaltHasIWM          = 11,
+	gestaltHasPWM          = 12,
+	gestaltHasRAMSndBuff   = 13,
+	gestaltHasVideoDAConv  = 14,
+	gestaltHasPGC          = 15,
+	gestaltHasSoftPowerOff	= 19,	/* Capable of software power off */
+	gestaltHasSonic        = 20,
+	gestaltHasSCSI961	= 21,	/* 53C96 SCSI ctrl on internal bus */
+	gestaltHasSCSI962	= 22,	/* 53C96 SCSI ctrl on external bus */
+	gestaltHasDAFBVideo    = 23,
+	gestaltHasUniversalROM	= 24,	/* Do we have a Universal ROM? */
+	gestaltHasEnhancedLtalk	= 30	/* Do we have Enhanced LocalTalk? */
+};
+
+#ifdef ARCH_M68K
+static inline OSErr Gestalt(OSType selector, long * response)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("move.l %2, %%d0\n"
+		Trap(_Gestalt)
+	    "	move.l %%a0, %1\n"
+	    : "=d" (ret), "=m" (*response) : "g" (selector) : UNPRESERVED_REGS);
+
+	return ret;
+}
+#endif /* ARCH_M68K */
+#endif /* __MACOS_GESTALT_H__ */

Added: branches/vendor/emile/libmacos/macos/init.h
===================================================================
--- branches/vendor/emile/libmacos/macos/init.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/init.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,25 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_INIT_H__
+#define __MACOS_INIT_H__
+
+#include <macos/traps.h>
+
+statis inline void InitEvents(short CntEvts)
+{
+	asm("move.l %0, %%d0\n"
+		Trap(_InitEvents)
+	    :: "g" (CntEvts) : "%%d0", UNPRESERVED_REGS);
+}
+
+static inline void InitFS(short CntFCBs)
+{
+	asm("move.l %0, %%d0\n"
+		Trap(_InitFs)
+	    :: "g" (CntFCBs) : "%%d0", UNPRESERVED_REGS);
+}
+#endif /* __MACOS_INIT_H__ */

Added: branches/vendor/emile/libmacos/macos/lowmem.h
===================================================================
--- branches/vendor/emile/libmacos/macos/lowmem.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/lowmem.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,35 @@
+/*
+ *
+ * (c) 2004, 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_LOWMEM_H__
+#define __MACOS_LOWMEM_H__
+
+#include <macos/osutils.h>
+
+#define VIA1Base	(*(unsigned long*)0x01D4)
+#define SCCRd		(*(unsigned long*)0x01d8)
+#define SCCWr		(*(unsigned long*)0x01dc)
+#define ScrnBase	(*(unsigned long*)0x0824)
+#define ROMBase		(*(short**)0x02ae)
+#define HWCfgFlags	(*(unsigned long*)0x0B22)
+#define SCSIBase	(*(unsigned long*)0x0C00)
+#define ASCBase		(*(unsigned long*)0x0CC0)
+#define VIA2Base	(*(unsigned long*)0x0CEC)
+#define PMgrBase	(*(unsigned long*)0x0D18)
+#define UnivROMBits	(*(unsigned long*)0x0DD4)
+#define TimeVIADB	(*(unsigned short*)0x0cea)
+#define TimeDBRA	(*(unsigned short*)0x0D00)
+#define MemTop		(*(unsigned long*)0x0108)
+#define Time		(*(unsigned long*)0x020C)
+#define KeyLast		(*(unsigned short*)0x0184)
+#define KeyTime		(*(unsigned long*)0x0186)
+#define KeyRepTime	(*(unsigned long*)0x018A)
+#define Ticks		(*(unsigned long*)0x016A)
+
+#define LMGetUnitTableEntryCount()	(*(short*)0x1d2)
+#define LMGetUTableBase()	(*(unsigned long*)0x11c)
+#define LMGetDrvQHdr()		( (QHdrPtr) 0x0308)
+#endif /* __MACOS_LOWMEM_H__ */

Added: branches/vendor/emile/libmacos/macos/memory.h
===================================================================
--- branches/vendor/emile/libmacos/macos/memory.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/memory.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,30 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_MEMORY_H__
+#define __MACOS_MEMORY_H__
+
+#include <macos/traps.h>
+
+static inline void DisposePtr(void* ptr)
+{
+	asm("move.l %0, %%a0\n"
+		Trap(_DisposePtr)
+	    :: "g" (ptr) : "%%d0", UNPRESERVED_REGS);
+}
+
+static inline void* NewPtr(unsigned long byteCount)
+{
+	register void* ptr;
+
+	asm("move.l %1, %%d0\n"
+		Trap(_NewPtr)
+	    "	move.l %%a0, %0\n"
+	    : "=g" (ptr) : "g" (byteCount) : "%%d0", UNPRESERVED_REGS);
+
+	return ptr;
+}
+#endif /* __MACOS_MEMORY_H__ */

Added: branches/vendor/emile/libmacos/macos/osutils.h
===================================================================
--- branches/vendor/emile/libmacos/macos/osutils.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/osutils.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,39 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_OSUTILS_H__
+#define __MACOS_OSUTILS_H__
+
+#include <macos/types.h>
+#include <macos/traps.h>
+
+struct QHdr {
+  int16_t      qFlags;
+  void*   qHead;
+  void*   qTail;
+};
+typedef struct QHdr                     QHdr;
+typedef QHdr *                          QHdrPtr;
+
+struct MachineLocation
+{
+	int32_t latitude;
+	int32_t longitude;
+	union
+	{
+		int8_t dlsDelta;
+		int32_t gmtDelta;
+	} u;
+};
+typedef struct MachineLocation MachineLocation;
+
+static inline void ReadLocation(MachineLocation * loc)
+{
+	asm("move.l %0, %%a0\n"
+		XPRam(_ReadLocation)
+	    :: "g" (loc) : "%%d0", UNPRESERVED_REGS);
+}
+#endif /* __MACOS_OSUTILS_H__ */

Added: branches/vendor/emile/libmacos/macos/quickdraw.h
===================================================================
--- branches/vendor/emile/libmacos/macos/quickdraw.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/quickdraw.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,64 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_QUICKDRAW_H__
+#define __MACOS_QUICKDRAW_H__
+#include <macos/traps.h>
+
+
+struct BitMap {
+	void*	baseAddr;
+	int16_t	rowBytes;
+	Rect	bounds;
+};
+typedef struct BitMap BitMap;
+typedef BitMap* BitMapPtr;
+typedef BitMapPtr* BitMapHandle;
+
+struct Bits16 {
+	u_int16_t	elements[16];
+};
+typedef struct Bits16 Bits16;
+
+struct Cursor {
+	Bits16	data;
+	Bits16	mask;
+	Point	hotSpot;
+};
+typedef struct Cursor Cursor;
+typedef Cursor* CursorPtr;
+typedef CursorPtr* CursorHandle;
+
+struct Pattern {
+	u_int8_t	pat[8];
+};
+typedef struct Pattern Pattern;
+
+typedef void* GrafPtr;
+struct QDGlobals {
+	int8_t		privates[76];
+	int32_t	randSeed;
+	BitMap	screenBits;
+	Cursor	arrow;
+	Pattern	dkGray;
+	Pattern	ltGray;
+	Pattern	gray;
+	Pattern	black;
+	Pattern	white;
+	GrafPtr	thePort;
+};
+typedef struct QDGlobals QDGlobals;
+typedef struct QDGlobals* QDGlobalsPtr;
+typedef struct QDGlobalsPtr* QDGlobalsHandle;
+
+static inline void InitGraf(void * port)
+{
+	asm("move.l %0, -(%%sp)\n"
+		Trap(_InitGraf)
+	    "	addq.l #4, %%sp"
+	    :: "g" (port) : "%%d0", UNPRESERVED_REGS);
+}
+#endif /* __MACOS_QUICKDRAW_H__ */

Added: branches/vendor/emile/libmacos/macos/romdefs.h
===================================================================
--- branches/vendor/emile/libmacos/macos/romdefs.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/romdefs.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,14 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_ROMDEFS_H__
+#define __MACOS_ROMDEFS_H__
+enum {
+	catDisplay	= 0x0003,
+	typeVideo	= 0x0001,
+	drSwApple	= 0x0001,
+};
+#endif /* __MACOS_ROMDEFS_H__ */

Added: branches/vendor/emile/libmacos/macos/scsi.h
===================================================================
--- branches/vendor/emile/libmacos/macos/scsi.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/scsi.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,103 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_SCSI_H__
+#define __MACOS_SCSI_H__
+#include <macos/traps.h>
+#include <macos/types.h>
+
+enum {
+   op_inc	= 1,	/* transfer data, increment buffer pointer */
+   op_no_inc	= 2,	/* transfer data, don't increment pointer */
+   op_add	= 3,	/* add long to address */
+   op_mode	= 4,	/* move long to address */
+   op_loop	= 5,	/* decrement counter and loop if > 0 */
+   op_nop	= 6,	/* no operation */
+   op_stop	= 7,    /* stop TIB execution */
+   op_comp	= 8,	/* compare SCSI data with memory */
+};
+
+typedef struct TIB {	/* Transfer Instruction Block */
+   short	opcode;	/* operation code */
+   int		param1;	/* 1st parameter */
+   int		param2;	/* 2nd parameter */
+} __attribute__((packed)) TIB_t;
+
+static inline OSErr SCSICmd(void* buffer, short count)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("move.l %2, %%d0\n"
+	    "	clr.w -(%%sp)\n"
+	    "	move.l %1, -(%%sp)\n"
+	    "	move.w %d0, -(%%sp)\n"
+		SCSIDispatch(_SCSICmd)
+		: "=d" (ret) : "g" (buffer), "g" (count) : UNPRESERVED_REGS );
+
+	return ret;
+}
+
+static inline OSErr SCSIComplete(short *stat, short *message, unsigned long wait)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("clr.w	-(%%sp)\n"
+	    "	move.l	%0, -(%%sp)\n"
+	    "	move.l	%1, -(%%sp)\n"
+	    "	move.l	%2, -(%%sp)\n"
+		SCSIDispatch(_SCSIComplete)
+	: "=d" (ret) : "g" (stat), "g" (message), "g" (wait) : UNPRESERVED_REGS );
+
+	return ret;
+}
+
+static inline OSErr SCSIGet(void)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("clr.w   -(%%sp)\n"
+		SCSIDispatch(_SCSIGet)
+	    : "=d" (ret) :: UNPRESERVED_REGS );
+
+	return ret;
+}
+
+static inline OSErr SCSIRead(void *tibPtr)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("clr.w   -(%%sp)\n"
+	    "	move.l	%1, -(%%sp)\n"
+		SCSIDispatch(_SCSIRead)
+	: "=d" (ret) : "g" (tibPtr) : UNPRESERVED_REGS );
+
+	return ret;
+}
+
+static inline OSErr SCSIReset(void)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("clr.w	-(%%sp)\n"
+		SCSIDispatch(_SCSIReset)
+	: "=d" (ret)  :: UNPRESERVED_REGS );
+
+	return ret;
+}
+
+static inline OSErr SCSISelect(short targetID)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("move.w	%1, %%d0\n"
+	    "	clr.w	-(%%sp)\n"
+	    "	move.w	%%d0, -(%%sp)\n"
+		SCSIDispatch(_SCSISelect)
+	: "=d" (ret) : "g" (targetID) : UNPRESERVED_REGS );
+
+	return ret;
+}
+#endif /* __MACOS_SCSI_H__ */

Added: branches/vendor/emile/libmacos/macos/serial.h
===================================================================
--- branches/vendor/emile/libmacos/macos/serial.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/serial.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,81 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_SERIAL_H__
+#define __MACOS_SERIAL_H__
+enum {
+	baud150		= 763,
+	baud300		= 380,
+	baud600		= 189,
+	baud1200	= 94,
+	baud1800	= 62,
+	baud2400	= 46,
+	baud3600	= 30,
+	baud4800	= 22,
+	baud7200	= 14,
+	baud9600	= 10,
+	baud14400	= 6,
+	baud19200	= 4,
+	baud28800	= 2,
+	baud38400	= 1,
+	baud57600	= 0
+};
+
+enum {
+	data5		= 0,
+	data6		= 2048,
+	data7		= 1024,
+	data8		= 3072
+};
+
+enum {
+	noParity	= 0,
+	oddParity	= 4096,
+	evenParity	= 12288
+};
+
+enum {
+	stop10		= 16384,
+	stop15		= -32768L,
+	stop20		= -16384
+};
+
+enum {
+	 kSERDConfiguration	= 8,
+	 kSERDInputBuffer	= 9,
+	 kSERDSerHShake		= 10,
+	 kSERDClearBreak	= 11,
+	 kSERDSetBreak		= 12,
+	 kSERDBaudRate		= 13,
+	 kSERDHandshake		= 14,
+	 kSERDClockMIDI		= 15,
+	 kSERDMiscOptions	= 16,
+	 kSERDAssertDTR		= 17,
+	 kSERDNegateDTR		= 18,
+	 kSERDSetPEChar		= 19,
+	 kSERDSetPEAltChar	= 20,
+	 kSERDSetXOffFlag	= 21,
+	 kSERDClearXOffFlag	= 22,
+	 kSERDSendXOn		= 23,
+	 kSERDSendXOnOut	= 24,
+	 kSERDSendXOff		= 25,
+	 kSERDSendXOffOut	= 26,
+	 kSERDResetChannel	= 27,
+	 kSERDHandshakeRS232	= 28,
+	 kSERDStickParity	= 29,
+	 kSERDAssertRTS		= 30,
+	 kSERDNegateRTS		= 31,
+	 kSERD115KBaud		= 115,
+	 kSERD230KBaud		= 230
+};
+
+enum {
+	kSERDInputCount	= 2,	/* get available characters count (SerGetBuf) */
+	kSERDStatus	= 8,	/* get status information (SerStatus) */
+	kSERDVersion	= 9,	/* get driver version */
+};
+extern OSErr SerGetBuf(short refNum, long *count);
+#endif /* __MACOS_SERIAL_H__ */

Added: branches/vendor/emile/libmacos/macos/slotmanager.h
===================================================================
--- branches/vendor/emile/libmacos/macos/slotmanager.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/slotmanager.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,88 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_SLOTMANAGER_H__
+#define __MACOS_SLOTMANAGER_H__
+#include <macos/traps.h>
+
+enum {
+	sRsrcType	= 1,	/* Type of sResource */
+	sRsrcName	= 2,	/* Name of sResource */
+	sRsrcIcon	= 3,	/* Icon */
+	sRsrcDrvrDir	= 4,	/* Driver Directory */
+	sRsrcLoadDir	= 5,	/* Load directory */
+	sRsrcBootRec	= 6,	/* sBoot record */
+	sRsrcFlags	= 7,	/* sResourceFlags */
+	sRsrcHWDevId	= 8,	/* Hardware Device ID */
+};
+
+struct SpBlock {
+	long	spResult;
+	char*	spsPointer;
+	long	spSize;
+	long	spOffsetData;
+	char*	spIOFileName;
+	char*	spsExecPBlk;
+	long	spParamData;
+	long	spMisc;
+	long	spReserved;
+	short	spIOReserved;
+	short	spRefNum;
+	short	spCategory;
+	short	spCType;
+	short	spDrvrSW;
+	short	spDrvrHW;
+	int8_t	spTBMask;
+	int8_t	spSlot;
+	int8_t	spID;
+	int8_t	spExtDev;
+	int8_t	spHwDev;
+	int8_t	spByteLanes;
+	int8_t	spFlags;
+	int8_t	spKey;
+} __attribute__((packed)) ;
+typedef struct SpBlock                  SpBlock;
+typedef SpBlock *                       SpBlockPtr;
+
+enum { /* flags for spParamData */
+	fall		= 0,
+	foneslot	= 1,
+	fnext		= 2,
+};
+
+static inline OSErr SGetCString(SpBlockPtr spBlkPtr)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("move.l %1, %%a0\n"
+		SlotManager(_SGetCString)
+	    : "=g" (ret) : "g" (spBlkPtr) : UNPRESERVED_REGS);
+
+	return ret;
+}
+
+static inline OSErr SGetTypeSRsrc(SpBlockPtr spBlkPtr)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("move.l %1, %%a0\n"
+		SlotManager(_SGetTypeSRsrc)
+	    : "=g" (ret) : "g" (spBlkPtr) : UNPRESERVED_REGS);
+
+	return ret;
+}
+
+static inline OSErr SRsrcInfo(SpBlockPtr spBlkPtr)
+{
+	register OSErr ret asm("%%d0");
+
+	asm("move.l %1, %%a0\n"
+		SlotManager(_SRsrcInfo)
+	    : "=g" (ret) : "g" (spBlkPtr) : UNPRESERVED_REGS);
+
+	return ret;
+}
+#endif /* __MACOS_SLOTMANAGER_H__ */

Added: branches/vendor/emile/libmacos/macos/traps.h
===================================================================
--- branches/vendor/emile/libmacos/macos/traps.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/traps.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,87 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_TRAPS_H__
+#define __MACOS_TRAPS_H__
+#define	_DisposePtr	0xA01F
+#define	_FInitQueue	0xA016
+#define	_Gestalt	0xA1AD
+#define	_GetKeys	0xA976
+#define	_InitEvents	0xA06D
+#define	_InitFS		0xA06C
+#define	_InitGraf	0xA86E
+#define	_NewPtr		0xA11E
+#define	_NewPtrClear	0xA31E
+#define	_PBCloseSync	0xA001
+#define	_PBControlSync	0xA004
+#define	_GetVolInfo	0xA007
+#define	_MountVol	0xA00F
+#define	_PBOpenSync	0xA000
+#define	_PBReadSync	0xA002
+#define	_PBWriteSync	0xA003
+#define	_PBStatusSync	0xA005
+#define	_ReadXPRam	0xA051
+#define	_SlotManager	0xA06E
+#define	_SCSIDispatch	0xA815
+#define _SysError	0xA9C9
+
+/*
+ * Inside Macintosh Volume I, I-94: Register Saving Conventions */
+
+#define UNPRESERVED_REGS	"%%a0", "%%a1", "%%d1", "%%d2", "%%sp"
+
+#define _Trap(a)	#a
+#define Trap(a)		"	dc.w	"_Trap(a)"	/* "#a" */\n"
+
+/*
+ * XPRam Selectors
+ *
+ */
+
+#define _ReadLocation		0x000C00E4
+
+#define XPRamSelector(a)	"	move.l	#"#a", %%d0"
+
+#define	XPRam(selector)		\
+	XPRamSelector(selector)"	/* "#selector" */\n"	\
+	Trap(_ReadXPRam)
+
+/*
+ * SlotManager selectors
+ *
+ */
+
+#define	_SGetCString	0x0003
+#define	_SGetTypeSRsrc	0x000C
+#define	_SRsrcInfo	0x0016
+
+#define SlotManagerSelector(a)	"	move.l	#"#a", %%d0"
+
+#define	SlotManager(selector)"	/* "#selector" */\n"		\
+	SlotManagerSelector(selector)	\
+	Trap(_SlotManager)
+
+/*
+ * SCSI dispatch selectors
+ *
+ */
+
+#define	_SCSIReset	0x0000
+#define	_SCSIGet	0x0001
+#define	_SCSISelect	0x0002
+#define	_SCSICmd	0x0003
+#define	_SCSIComplete	0x0004
+#define	_SCSIRead	0x0005
+#define	_SCSIWrite	0x0006
+
+#define SCSIDispatchSelector(a)	"	move.w	#"#a", -(%%sp)"
+
+#define	SCSIDispatch(selector)		\
+	SCSIDispatchSelector(selector)"	/* "#selector" */\n"	\
+	Trap(_SCSIDispatch)		\
+"	move.w	(%%sp)+, %%d0\n"	\
+"	ext.l	%%d0\n"
+#endif /* __MACOS_TRAPS_H__ */

Added: branches/vendor/emile/libmacos/macos/types.h
===================================================================
--- branches/vendor/emile/libmacos/macos/types.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/types.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,46 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_TYPES_H__
+#define __MACOS_TYPES_H__
+
+#ifdef ARCH_M68K
+typedef unsigned char u_int8_t;
+typedef signed char int8_t;
+typedef unsigned short u_int16_t;
+typedef signed short int16_t;
+typedef unsigned int u_int32_t;
+typedef signed int int32_t;
+#endif /* ARCH_M68K */
+
+typedef int16_t OSErr;
+typedef unsigned long FourCharCode;
+typedef FourCharCode OSType;
+typedef unsigned char Str255[256];
+typedef const unsigned char * ConstStr255Param;
+typedef unsigned char Str27[28];
+
+enum {
+	false = 0,
+	true = 1 
+};
+
+struct Rect {
+	int16_t	top;
+	int16_t	left;
+	int16_t	bottom;
+	int16_t	right;
+};
+typedef struct Rect Rect;
+typedef Rect* RectPtr;
+
+struct Point {
+	int16_t	v;
+	int16_t	h;
+};
+typedef struct Point Point;
+typedef Point* PointPtr;
+#endif /* __MACOS_TYPES_H__ */

Added: branches/vendor/emile/libmacos/macos/video.h
===================================================================
--- branches/vendor/emile/libmacos/macos/video.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libmacos/macos/video.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,23 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MACOS_VIDEO_H__
+#define __MACOS_VIDEO_H__
+typedef struct VDFlagRec
+{
+        char flag;
+} VDFlagRec;
+typedef VDFlagRec *VDFlagPtr;
+
+typedef struct VDParamBlock
+{
+	COMMON_PARAMS
+        short ioRefNum;
+        short csCode;
+        void* csParam;
+} VDParamBlock;
+typedef VDParamBlock *VDParamBlockPtr;
+#endif /* __MACOS_VIDEO_H__ */

Added: branches/vendor/emile/libscsi/Makefile
===================================================================
--- branches/vendor/emile/libscsi/Makefile	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libscsi/Makefile	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,18 @@
+#
+#  (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+#
+
+TOP=$(shell pwd)
+CFLAGS	= -nostdlib -nodefaultlibs -Wall -Werror -Wno-multichar -fpic -O2 -m68000 -Wa,-m68000 -Os
+CPPFLAGS = -I$(TOP)/../libmacos -DARCH_M68K
+
+LIBRARY = libscsi.a
+
+SOURCES = scsi_read_sector.c scsi_command.c scsi_INQUIRY.c scsi_READ.c \
+	  scsi_open.c scsi_close.c scsi_READ_CAPACITY.c scsi_get_blocksize.c
+
+HEADERS = libscsi.h
+
+all: $(LIBRARY)
+
+include $(TOP)/../Rules.mk

Added: branches/vendor/emile/libscsi/libscsi.h
===================================================================
--- branches/vendor/emile/libscsi/libscsi.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libscsi/libscsi.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,25 @@
+/*
+ *
+ * (c) 2004, 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+                                                                                
+#include <sys/types.h>
+#include <macos/scsi.h>
+
+typedef struct {
+	int target;
+	unsigned int sector_size;
+	unsigned long capacity;
+} scsi_device_t;
+
+extern int scsi_command(int target, char* cdb, int count, TIB_t* tib);
+extern int scsi_INQUIRY(int target, char* buffer, size_t count);
+extern int scsi_READ(int target, unsigned long offset, unsigned short nb_blocks,
+		     char *buffer, int buffer_size);
+extern int scsi_READ_CAPACITY(int target, char *buffer, size_t count);
+
+extern scsi_device_t *scsi_open(int target);
+extern int scsi_read_sector(scsi_device_t *device, off_t offset, void* buffer, size_t size);
+extern int scsi_close(scsi_device_t *device);
+extern int scsi_get_blocksize(scsi_device_t *device);

Added: branches/vendor/emile/libscsi/scsi_INQUIRY.c
===================================================================
--- branches/vendor/emile/libscsi/scsi_INQUIRY.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libscsi/scsi_INQUIRY.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,36 @@
+/*
+ *
+ * (c) 2004, 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+
+#include <scsi/scsi.h>
+
+#include <macos/types.h>
+#include <macos/errors.h>
+
+#include "libscsi.h"
+
+int scsi_INQUIRY(int target, char *buffer, size_t count)
+{
+	char	cdb[6];
+	TIB_t	tib[2];
+
+	cdb[0] = INQUIRY;
+	cdb[1] = 0;
+	cdb[2] = 0;
+	cdb[3] = 0;
+	cdb[4] = count;
+	cdb[5] = 0;
+
+	tib[0].opcode = op_no_inc;
+	tib[0].param1 = (int)buffer;
+	tib[0].param2 = count;
+	tib[1].opcode = op_stop;
+	tib[1].param1 = 0;
+	tib[1].param2 = 0;
+
+	return scsi_command(target, cdb, 6, tib);
+}

Added: branches/vendor/emile/libscsi/scsi_READ.c
===================================================================
--- branches/vendor/emile/libscsi/scsi_READ.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libscsi/scsi_READ.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,67 @@
+/*
+ *
+ * (c) 2004, 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <scsi/scsi.h>
+
+#include <macos/types.h>
+#include <macos/errors.h>
+
+#include "libscsi.h"
+
+/******************************************************************************
++=====-========-========-========-========-========-========-========-========+
+|  Bit|   7    |   6    |   5    |   4    |   3    |   2    |   1    |   0    |
+|Byte |        |        |        |        |        |        |        |        |
+|=====+=======================================================================|
+| 0   |                           Operation code (28h)                        |
+|-----+-----------------------------------------------------------------------|
+| 1   |   Logical unit number    |   DPO  |   FUA  |     Reserved    | RelAdr |
+|-----+-----------------------------------------------------------------------|
+| 2   | (MSB)                                                                 |
+|-----+---                                                                 ---|
+| 3   |                                                                       |
+|-----+---                        Logical block address                    ---|
+| 4   |                                                                       |
+|-----+---                                                                 ---|
+| 5   |                                                                 (LSB) |
+|-----+-----------------------------------------------------------------------|
+| 6   |                           Reserved                                    |
+|-----+-----------------------------------------------------------------------|
+| 7   | (MSB)                                                                 |
+|-----+---                        Transfer length                             |
+| 8   |                                                                 (LSB) |
+|-----+-----------------------------------------------------------------------|
+| 9   |                           Control                                     |
++=============================================================================+
+******************************************************************************/
+
+int scsi_READ(int target, unsigned long offset, unsigned short nb_blocks, 
+	      char *buffer, int buffer_size)
+{
+	char	cdb[10];
+	TIB_t	tib[2];
+
+	cdb[0] = READ_10;
+	cdb[1] = 0;
+	cdb[2] = (offset >> 24) & 0xFF;
+	cdb[3] = (offset >> 16) & 0xFF;
+	cdb[4] = (offset >> 8) & 0xFF;
+	cdb[5] = offset & 0xFF;
+	cdb[6] = 0;
+	cdb[7] = (nb_blocks >> 8) & 0xFF;
+	cdb[8] = nb_blocks & 0xFF;
+	cdb[9] = 0;
+
+	tib[0].opcode = op_no_inc;
+	tib[0].param1 = (int)buffer;
+	tib[0].param2 = buffer_size;
+	tib[1].opcode = op_stop;
+	tib[1].param1 = 0;
+	tib[1].param2 = 0;
+
+	return scsi_command(target, cdb, 10, tib);
+}

Added: branches/vendor/emile/libscsi/scsi_READ_CAPACITY.c
===================================================================
--- branches/vendor/emile/libscsi/scsi_READ_CAPACITY.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libscsi/scsi_READ_CAPACITY.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,38 @@
+/*
+ *
+ * (c) 2004, 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <scsi/scsi.h>
+
+#include <macos/types.h>
+#include <macos/errors.h>
+
+#include "libscsi.h"
+
+int scsi_READ_CAPACITY(int target, char *buffer, size_t count)
+{
+	char	cdb[10];
+	TIB_t	tib[2];
+
+	cdb[0] = READ_CAPACITY;
+	cdb[1] = 0;
+	cdb[2] = 0;
+	cdb[3] = 0;
+	cdb[4] = 0;
+	cdb[5] = 0;
+	cdb[6] = 0;
+	cdb[7] = 0;
+	cdb[8] = 0;
+	cdb[9] = 0;
+
+	tib[0].opcode = op_no_inc;
+	tib[0].param1 = (int)buffer;
+	tib[0].param2 = count;
+	tib[1].opcode = op_stop;
+	tib[1].param1 = 0;
+	tib[1].param2 = 0;
+
+	return scsi_command(target, cdb, 10, tib);
+}

Added: branches/vendor/emile/libscsi/scsi_close.c
===================================================================
--- branches/vendor/emile/libscsi/scsi_close.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libscsi/scsi_close.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,17 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+
+#include "libscsi.h"
+
+int scsi_close(scsi_device_t *device)
+{
+	if (device == NULL)
+		return -1;
+	free(device);
+	return 0;
+}

Added: branches/vendor/emile/libscsi/scsi_command.c
===================================================================
--- branches/vendor/emile/libscsi/scsi_command.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libscsi/scsi_command.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,62 @@
+/*
+ *
+ * (c) 2004, 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+
+#include <scsi/scsi.h>
+
+#include <macos/types.h>
+#include <macos/errors.h>
+
+#include "libscsi.h"
+
+#define COMPLETION_TIMEOUT	300
+
+int scsi_command(int target, char* cdb, int count, TIB_t* tib)
+{
+	int err;
+	short stat;
+	short message;
+
+	err = SCSIGet();
+	if (err != noErr) 
+	{
+		printf("Cannot get SCSI bus (%d)\n", err);
+		return err;
+	}
+
+	err = SCSISelect(target);
+	if (err != noErr) 
+	{
+		printf("Cannot select target %d (%d)\n", target, err);
+		return err;
+	}
+
+	err = SCSICmd(cdb, count);
+	if (err != noErr) 
+	{
+		printf("Cannot send command (%d)\n", err);
+		goto complete;
+	}
+
+	err = SCSIRead(tib);
+	if (err != noErr) 
+	{
+		printf("Cannot read data (%d)\n", err);
+		goto complete;
+	}
+
+complete:
+	err = SCSIComplete(&stat, &message, COMPLETION_TIMEOUT);
+	if (err != noErr) 
+	{
+		printf("Cannot complete transaction %d %d(%d)\n", 
+							stat, message, err);
+		return err;
+	}
+
+	return noErr;
+}

Added: branches/vendor/emile/libscsi/scsi_get_blocksize.c
===================================================================
--- branches/vendor/emile/libscsi/scsi_get_blocksize.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libscsi/scsi_get_blocksize.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,12 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "libscsi.h"
+
+int scsi_get_blocksize(scsi_device_t *device)
+{
+	return device->sector_size;
+}

Added: branches/vendor/emile/libscsi/scsi_open.c
===================================================================
--- branches/vendor/emile/libscsi/scsi_open.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libscsi/scsi_open.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,31 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+
+#include <macos/errors.h>
+
+#include "libscsi.h"
+
+scsi_device_t *scsi_open(int target)
+{
+	scsi_device_t *dev;
+	unsigned char buff[8];
+	OSErr err;
+
+	err = scsi_READ_CAPACITY(target, buff, 8);
+	if (err != noErr)
+		return NULL;
+
+	dev = (scsi_device_t *)malloc(sizeof(scsi_device_t));
+	if (dev == NULL)
+		return NULL;
+	dev->target = target;
+	dev->capacity = (buff[0] << 24) | (buff[1] << 16) | (buff[2] << 8) | buff[3];
+	dev->sector_size = (buff[4] << 24) | (buff[5] << 16) | (buff[6] << 8) | buff[7];
+
+	return dev;
+}

Added: branches/vendor/emile/libscsi/scsi_read_sector.c
===================================================================
--- branches/vendor/emile/libscsi/scsi_read_sector.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libscsi/scsi_read_sector.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,30 @@
+/*
+ *
+ * (c) 2004, 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <string.h>
+
+#include <macos/devices.h>
+
+#include "libscsi.h"
+
+#define ISO_BLOCKS(X)   (((X) / device->sector_size) + (((X)%device->sector_size)?1:0))
+
+/* offset is a block number
+ * size is the number of bytes to read
+ */
+
+int scsi_read_sector(scsi_device_t *device,
+		     off_t offset, void* buffer, size_t size)
+{
+	OSErr err;
+
+	err = scsi_READ(device->target, offset, ISO_BLOCKS(size), buffer, size);
+	if (err != noErr)
+		return -1;
+
+	return 0;
+}

Added: branches/vendor/emile/libstream/Makefile
===================================================================
--- branches/vendor/emile/libstream/Makefile	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libstream/Makefile	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,31 @@
+#
+#  (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+#
+
+TOP = $(shell pwd)
+VPATH=$(TOP)
+
+CFLAGS	= -nostdlib -nodefaultlibs -Wall -Werror -Wno-multichar -fpic -g -O2 -Os
+#-m68000 -Wa,-m68000
+CPPFLAGS = -I$(TOP)/../libmacos -I$(TOP) -I$(TOP)/../libgzip
+
+LIBRARIES = hard/libstream.a floppy/libstream.a
+
+SOURCES = stream_close.c stream_open.c stream_read.c stream_lseek.c \
+	  stream_uncompress.c gzio.c stream_fstat.c
+
+HEADERS = libstream.h
+
+all: $(LIBRARIES)
+
+hard/libstream.a::
+	test -e hard || mkdir hard
+	$(MAKE) -C hard -f $(TOP)/Makefile TOP=$(TOP) LIBRARY=libstream.a CPPFLAGS="$(CPPFLAGS) \
+	-DSCSI_SUPPORT -DISO9660_SUPPORT -I$(TOP)/../libscsi -I$(TOP)/../libiso9660 \
+	-DCONTAINER_SUPPORT -I$(TOP)/../libcontainer" libstream.a
+
+floppy/libstream.a::
+	test -e floppy || mkdir floppy
+	$(MAKE) -C floppy -f $(TOP)/Makefile TOP=$(TOP) LIBRARY=libstream.a CPPFLAGS="$(CPPFLAGS) -DFLOPPY_SUPPORT -DBLOCK_SUPPORT -I$(TOP)/../libfloppy -I$(TOP)/../libblock" libstream.a
+
+include $(TOP)/../Rules.mk

Added: branches/vendor/emile/libstream/gzio.c
===================================================================
--- branches/vendor/emile/libstream/gzio.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libstream/gzio.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,522 @@
+/* gzio.c -- IO on .gz files
+ * Copyright (C) 1995-2005 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ *
+ * modified to use in EMILE by Laurent Vivier, 2005
+ *
+ */
+
+/* @(#) $Id: gzio.c,v 1.2 2005/11/26 08:51:55 lvivier Exp $ */
+
+#include <stdio.h>
+
+#include "zutil.h"
+#include "libstream.h"
+
+#ifndef NO_DUMMY_DECL
+struct internal_state {int dummy;}; /* for buggy compilers */
+#endif
+
+#ifndef Z_BUFSIZE
+#  ifdef MAXSEG_64K
+#    define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */
+#  else
+#    define Z_BUFSIZE 16384
+#  endif
+#endif
+#ifndef Z_PRINTF_BUFSIZE
+#  define Z_PRINTF_BUFSIZE 4096
+#endif
+
+#ifndef STDC
+extern voidp  malloc OF((uInt size));
+extern void   free   OF((voidpf ptr));
+#endif
+
+#define ALLOC(size) malloc(size)
+#define TRYFREE(p) {if (p) free(p);}
+
+static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
+
+/* gzip flag byte */
+#define HEAD_CRC     0x02 /* bit 1 set: header CRC present */
+#define EXTRA_FIELD  0x04 /* bit 2 set: extra field present */
+#define ORIG_NAME    0x08 /* bit 3 set: original file name present */
+#define COMMENT      0x10 /* bit 4 set: file comment present */
+#define RESERVED     0xE0 /* bits 5..7: reserved */
+
+typedef struct gz_stream {
+    z_stream stream;
+    int      z_err;   /* error code for last stream operation */
+    int      z_eof;   /* set if end of input file */
+    Byte     *inbuf;  /* input buffer */
+    Byte     *outbuf; /* output buffer */
+    uLong    crc;     /* crc32 of uncompressed data */
+    int      transparent; /* 1 if input file is not a .gz file */
+    z_off_t  start;   /* start of compressed data in file (header skipped) */
+    z_off_t  in;      /* bytes into deflate or inflate */
+    z_off_t  out;     /* bytes out of deflate or inflate */
+    int      back;    /* one character push-back */
+    int      last;    /* true if push-back is last character */
+
+    filesystem_io_t fs;
+} gz_stream;
+
+
+local int    get_byte     OF((gz_stream *s));
+local void   check_header OF((gz_stream *s));
+local int    destroy      OF((gz_stream *s));
+local uLong  getLong      OF((gz_stream *s));
+
+/* ===========================================================================
+     Opens a gzip (.gz) file for reading or writing. The mode parameter
+   is as in fopen ("rb" or "wb"). The file is given either by file descriptor
+   or path name (if fd == -1).
+     gz_open returns NULL if the file could not be opened or if there was
+   insufficient memory to allocate the (de)compression state; errno
+   can be checked to distinguish the two cases (if errno is zero, the
+   zlib error is Z_MEM_ERROR).
+*/
+gzFile gzopen (fs)
+	filesystem_io_t *fs;
+{
+    int err;
+    gz_stream *s;
+
+    s = (gz_stream *)ALLOC(sizeof(gz_stream));
+    if (!s) return Z_NULL;
+
+    s->stream.zalloc = (alloc_func)0;
+    s->stream.zfree = (free_func)0;
+    s->stream.opaque = (voidpf)0;
+    s->stream.next_in = s->inbuf = Z_NULL;
+    s->stream.next_out = s->outbuf = Z_NULL;
+    s->stream.avail_in = s->stream.avail_out = 0;
+    s->z_err = Z_OK;
+    s->z_eof = 0;
+    s->in = 0;
+    s->out = 0;
+    s->back = EOF;
+    s->crc = crc32(0L, Z_NULL, 0);
+    s->transparent = 0;
+
+    s->fs = *fs;
+
+    s->stream.next_in  = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE);
+
+    err = inflateInit2(&(s->stream), -MAX_WBITS);
+    /* windowBits is passed < 0 to tell that there is no zlib header.
+    * Note that in this case inflate *requires* an extra "dummy" byte
+    * after the compressed stream in order to complete decompression and
+    * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are
+    * present after the compressed stream.
+    */
+
+    if (err != Z_OK || s->inbuf == Z_NULL) {
+        return destroy(s), (gzFile)Z_NULL;
+    }
+    s->stream.avail_out = Z_BUFSIZE;
+
+    check_header(s); /* skip the .gz header */
+    s->start = s->fs.lseek(s->fs.file, 0, SEEK_CUR) - s->stream.avail_in;
+
+    return (gzFile)s;
+}
+
+/* ===========================================================================
+     Read a byte from a gz_stream; update next_in and avail_in. Return EOF
+   for end of file.
+   IN assertion: the stream s has been sucessfully opened for reading.
+*/
+local int get_byte(s)
+    gz_stream *s;
+{
+    if (s->z_eof) return EOF;
+    if (s->stream.avail_in == 0) {
+        s->stream.avail_in = (uInt)s->fs.read(s->fs.file, s->inbuf, Z_BUFSIZE);
+        if (s->stream.avail_in == 0) {
+            s->z_eof = 1;
+            return EOF;
+        }
+        s->stream.next_in = s->inbuf;
+    }
+    s->stream.avail_in--;
+    return *(s->stream.next_in)++;
+}
+
+/* ===========================================================================
+      Check the gzip header of a gz_stream opened for reading. Set the stream
+    mode to transparent if the gzip magic header is not present; set s->err
+    to Z_DATA_ERROR if the magic header is present but the rest of the header
+    is incorrect.
+    IN assertion: the stream s has already been created sucessfully;
+       s->stream.avail_in is zero for the first time, but may be non-zero
+       for concatenated .gz files.
+*/
+local void check_header(s)
+    gz_stream *s;
+{
+    int method; /* method byte */
+    int flags;  /* flags byte */
+    uInt len;
+    int c;
+
+    /* Assure two bytes in the buffer so we can peek ahead -- handle case
+       where first byte of header is at the end of the buffer after the last
+       gzip segment */
+    len = s->stream.avail_in;
+    if (len < 2) {
+        if (len) s->inbuf[0] = s->stream.next_in[0];
+        len = (uInt)s->fs.read(s->fs.file, s->inbuf + len, Z_BUFSIZE >> len);
+        s->stream.avail_in += len;
+        s->stream.next_in = s->inbuf;
+        if (s->stream.avail_in < 2) {
+            s->transparent = s->stream.avail_in;
+            return;
+        }
+    }
+
+    /* Peek ahead to check the gzip magic header */
+    if (s->stream.next_in[0] != gz_magic[0] ||
+        s->stream.next_in[1] != gz_magic[1]) {
+        s->transparent = 1;
+        return;
+    }
+    s->stream.avail_in -= 2;
+    s->stream.next_in += 2;
+
+    /* Check the rest of the gzip header */
+    method = get_byte(s);
+    flags = get_byte(s);
+    if (method != Z_DEFLATED || (flags & RESERVED) != 0) {
+        s->z_err = Z_DATA_ERROR;
+        return;
+    }
+
+    /* Discard time, xflags and OS code: */
+    for (len = 0; len < 6; len++) (void)get_byte(s);
+
+    if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */
+        len  =  (uInt)get_byte(s);
+        len += ((uInt)get_byte(s))<<8;
+        /* len is garbage if EOF but the loop below will quit anyway */
+        while (len-- != 0 && get_byte(s) != EOF) ;
+    }
+    if ((flags & ORIG_NAME) != 0) { /* skip the original file name */
+        while ((c = get_byte(s)) != 0 && c != EOF) ;
+    }
+    if ((flags & COMMENT) != 0) {   /* skip the .gz file comment */
+        while ((c = get_byte(s)) != 0 && c != EOF) ;
+    }
+    if ((flags & HEAD_CRC) != 0) {  /* skip the header crc */
+        for (len = 0; len < 2; len++) (void)get_byte(s);
+    }
+    s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK;
+}
+
+ /* ===========================================================================
+ * Cleanup then free the given gz_stream. Return a zlib error code.
+   Try freeing in the reverse order of allocations.
+ */
+local int destroy (s)
+    gz_stream *s;
+{
+    int err = Z_OK;
+
+    if (!s) return Z_STREAM_ERROR;
+
+    if (s->stream.state != NULL) {
+       err = inflateEnd(&(s->stream));
+    }
+    if (s->z_err < 0) err = s->z_err;
+
+    TRYFREE(s->inbuf);
+    TRYFREE(s->outbuf);
+    TRYFREE(s);
+    return err;
+}
+
+/* ===========================================================================
+     Reads the given number of uncompressed bytes from the compressed file.
+   gzread returns the number of bytes actually read (0 for end of file).
+*/
+int ZEXPORT gzread (file, buf, len)
+    gzFile file;
+    voidp buf;
+    unsigned len;
+{
+    gz_stream *s = (gz_stream*)file;
+    Bytef *start = (Bytef*)buf; /* starting point for crc computation */
+    Byte  *next_out; /* == stream.next_out but not forced far (for MSDOS) */
+
+    if (s == NULL) return Z_STREAM_ERROR;
+
+    if (s->z_err == Z_DATA_ERROR) return -1;
+    if (s->z_err == Z_STREAM_END) return 0;  /* EOF */
+
+    next_out = (Byte*)buf;
+    s->stream.next_out = (Bytef*)buf;
+    s->stream.avail_out = len;
+
+    if (s->stream.avail_out && s->back != EOF) {
+        *next_out++ = s->back;
+        s->stream.next_out++;
+        s->stream.avail_out--;
+        s->back = EOF;
+        s->out++;
+        start++;
+        if (s->last) {
+            s->z_err = Z_STREAM_END;
+            return 1;
+        }
+    }
+
+    while (s->stream.avail_out != 0) {
+
+        if (s->transparent) {
+            /* Copy first the lookahead bytes: */
+            uInt n = s->stream.avail_in;
+            if (n > s->stream.avail_out) n = s->stream.avail_out;
+            if (n > 0) {
+                zmemcpy(s->stream.next_out, s->stream.next_in, n);
+                next_out += n;
+                s->stream.next_out = next_out;
+                s->stream.next_in   += n;
+                s->stream.avail_out -= n;
+                s->stream.avail_in  -= n;
+            }
+            if (s->stream.avail_out > 0) {
+                s->stream.avail_out -=
+                    (uInt)s->fs.read(s->fs.file, next_out, s->stream.avail_out);
+            }
+            len -= s->stream.avail_out;
+            s->in  += len;
+            s->out += len;
+            if (len == 0) s->z_eof = 1;
+            return (int)len;
+        }
+        if (s->stream.avail_in == 0 && !s->z_eof) {
+
+            s->stream.avail_in = (uInt)s->fs.read(s->fs.file, s->inbuf, Z_BUFSIZE);
+            if (s->stream.avail_in == 0) {
+                s->z_eof = 1;
+            }
+            s->stream.next_in = s->inbuf;
+        }
+        s->in += s->stream.avail_in;
+        s->out += s->stream.avail_out;
+        s->z_err = inflate(&(s->stream), Z_NO_FLUSH);
+        s->in -= s->stream.avail_in;
+        s->out -= s->stream.avail_out;
+
+        if (s->z_err == Z_STREAM_END) {
+            /* Check CRC and original size */
+            s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
+            start = s->stream.next_out;
+
+            if (getLong(s) != s->crc) {
+                s->z_err = Z_DATA_ERROR;
+            } else {
+                (void)getLong(s);
+                /* The uncompressed length returned by above getlong() may be
+                 * different from s->out in case of concatenated .gz files.
+                 * Check for such files:
+                 */
+                check_header(s);
+                if (s->z_err == Z_OK) {
+                    inflateReset(&(s->stream));
+                    s->crc = crc32(0L, Z_NULL, 0);
+                }
+            }
+        }
+        if (s->z_err != Z_OK || s->z_eof) break;
+    }
+    s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
+
+    if (len == s->stream.avail_out &&
+        (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO))
+        return -1;
+    return (int)(len - s->stream.avail_out);
+}
+
+
+/* ===========================================================================
+      Sets the starting position for the next gzread or gzwrite on the given
+   compressed file. The offset represents a number of bytes in the
+      gzseek returns the resulting offset location as measured in bytes from
+   the beginning of the uncompressed stream, or -1 in case of error.
+      SEEK_END is not implemented, returns error.
+      In this version of the library, gzseek can be extremely slow.
+*/
+z_off_t ZEXPORT gzseek (file, offset, whence)
+    gzFile file;
+    z_off_t offset;
+    int whence;
+{
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL || whence == SEEK_END ||
+        s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) {
+        return -1L;
+    }
+
+    /* Rest of function is for reading only */
+
+    /* compute absolute position */
+    if (whence == SEEK_CUR) {
+        offset += s->out;
+    }
+    if (offset < 0) return -1L;
+
+    if (s->transparent) {
+        /* map to lseek */
+        s->back = EOF;
+        s->stream.avail_in = 0;
+        s->stream.next_in = s->inbuf;
+        if (s->fs.lseek(s->fs.file, offset, SEEK_SET) < 0) return -1L;
+
+        s->in = s->out = offset;
+        return offset;
+    }
+
+    /* For a negative seek, rewind and use positive seek */
+    if (offset >= s->out) {
+        offset -= s->out;
+    } else if (gzrewind(file) < 0) {
+        return -1L;
+    }
+    /* offset is now the number of bytes to skip. */
+
+    if (offset != 0 && s->outbuf == Z_NULL) {
+        s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
+        if (s->outbuf == Z_NULL) return -1L;
+    }
+    if (offset && s->back != EOF) {
+        s->back = EOF;
+        s->out++;
+        offset--;
+        if (s->last) s->z_err = Z_STREAM_END;
+    }
+    while (offset > 0)  {
+        int size = Z_BUFSIZE;
+        if (offset < Z_BUFSIZE) size = (int)offset;
+
+        size = gzread(file, s->outbuf, (uInt)size);
+        if (size <= 0) return -1L;
+        offset -= size;
+    }
+    return s->out;
+}
+
+/* ===========================================================================
+     Rewinds input file.
+*/
+int ZEXPORT gzrewind (file)
+    gzFile file;
+{
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL) return -1;
+
+    s->z_err = Z_OK;
+    s->z_eof = 0;
+    s->back = EOF;
+    s->stream.avail_in = 0;
+    s->stream.next_in = s->inbuf;
+    s->crc = crc32(0L, Z_NULL, 0);
+    if (!s->transparent) (void)inflateReset(&s->stream);
+    s->in = 0;
+    s->out = 0;
+    return s->fs.lseek(s->fs.file, s->start, SEEK_SET);
+}
+
+/* ===========================================================================
+     Returns 1 when EOF has previously been detected reading the given
+   input stream, otherwise zero.
+*/
+int ZEXPORT gzeof (file)
+    gzFile file;
+{
+    gz_stream *s = (gz_stream*)file;
+
+    /* With concatenated compressed files that can have embedded
+     * crc trailers, z_eof is no longer the only/best indicator of EOF
+     * on a gz_stream. Handle end-of-stream error explicitly here.
+     */
+    if (s == NULL) return 0;
+    if (s->z_eof) return 1;
+    return s->z_err == Z_STREAM_END;
+}
+
+/* ===========================================================================
+   Reads a long in LSB order from the given gz_stream. Sets z_err in case
+   of error.
+*/
+local uLong getLong (s)
+    gz_stream *s;
+{
+    uLong x = (uLong)get_byte(s);
+    int c;
+
+    x += ((uLong)get_byte(s))<<8;
+    x += ((uLong)get_byte(s))<<16;
+    c = get_byte(s);
+    if (c == EOF) s->z_err = Z_DATA_ERROR;
+    x += ((uLong)c)<<24;
+    return x;
+}
+
+/* ===========================================================================
+     Flushes all pending output if necessary, closes the compressed file
+   and deallocates all the (de)compression state.
+*/
+int ZEXPORT gzclose (file)
+    gzFile file;
+{
+    filesystem_io_t fs;
+    gz_stream *s = (gz_stream*)file;
+    int ret;
+
+    fs = s->fs;
+
+    if (s == NULL) return Z_STREAM_ERROR;
+
+    ret = destroy((gz_stream*)file);
+    fs.close(fs.file);
+    if (fs.umount) fs.umount(fs.file);
+
+    return ret;
+}
+
+#ifdef STDC
+#  define zstrerror(errnum) strerror(errnum)
+#else
+#  define zstrerror(errnum) ""
+#endif
+
+/* ===========================================================================
+     Returns the error message for the last error which occurred on the
+   given compressed file. errnum is set to zlib error number. If an
+   error occurred in the file system and not in the compression library,
+   errnum is set to Z_ERRNO and the application may consult errno
+   to get the exact error code.
+*/
+const char * ZEXPORT gzerror (file, errnum)
+    gzFile file;
+    int *errnum;
+{
+	return "Unknown error";
+}
+
+/* ===========================================================================
+     Clear the error and end-of-file flags, and do the same for the real file.
+*/
+void ZEXPORT gzclearerr (file)
+    gzFile file;
+{
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL) return;
+    if (s->z_err != Z_STREAM_END) s->z_err = Z_OK;
+    s->z_eof = 0;
+}

Added: branches/vendor/emile/libstream/libstream.h
===================================================================
--- branches/vendor/emile/libstream/libstream.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libstream/libstream.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,59 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+#ifndef __LIBSTREAM_H__
+#define __LIBSTREAM_H__
+
+#include <sys/types.h>
+#include <unistd.h>
+
+struct stream_stat {
+	off_t st_size;
+};
+
+typedef int (*stream_read_sector_t)(void *data,off_t offset, void* buffer, size_t size);
+typedef ssize_t (*stream_read_t)(void *data, void *buf, size_t count);
+typedef int (*stream_lseek_t)(void *data, long offset, int whence);
+typedef int (*stream_close_t)(void *data);
+typedef int (*stream_umount_t)(void *data);
+typedef int (*stream_fstat_t)(void *data, struct stream_stat *buf);
+typedef int (*stream_get_blocksize_t)(void *data);
+
+typedef struct {
+	void *data;
+	stream_read_sector_t read_sector;
+	stream_close_t close;
+	stream_get_blocksize_t get_blocksize;
+} device_io_t;
+
+typedef struct {
+	void *volume;
+	void *file;
+	stream_read_t read;
+	stream_lseek_t lseek;
+	stream_close_t close;
+	stream_umount_t umount;
+	stream_fstat_t fstat;
+} filesystem_io_t;
+
+typedef struct {
+	/* device interface */
+
+	device_io_t device;
+
+	/* filesystem interface */
+
+	filesystem_io_t fs;
+} stream_t;
+
+extern stream_t *stream_open(char *dev);
+extern int stream_read_sector(stream_t *stream,
+			     off_t offset, void* buffer, size_t size);
+extern int stream_read(stream_t *stream, void *buf, size_t count);
+extern int stream_lseek(stream_t *stream, long offset, int whence);
+extern int stream_close(stream_t *stream);
+extern int stream_uncompress(stream_t *stream);
+extern int stream_fstat(stream_t *stream, struct stream_stat *buf);
+#endif /* __LIBSTREAM_H__ */

Added: branches/vendor/emile/libstream/stream_close.c
===================================================================
--- branches/vendor/emile/libstream/stream_close.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libstream/stream_close.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,24 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+
+#include "libstream.h"
+
+int stream_close(stream_t *stream)
+{
+	if (stream->fs.close &&
+	    stream->fs.close(stream->fs.file) != 0)
+		return -1;
+	if (stream->fs.umount &&
+	    stream->fs.umount(stream->fs.volume) != 0)
+		return -1;
+	if (stream->device.close &&
+	    stream->device.close(stream->device.data) != 0)
+		return -1;
+	free(stream);
+	return 0;
+}

Added: branches/vendor/emile/libstream/stream_fstat.c
===================================================================
--- branches/vendor/emile/libstream/stream_fstat.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libstream/stream_fstat.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,15 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "libstream.h"
+
+int stream_fstat(stream_t *stream, struct stream_stat *buf)
+{
+	if (stream->fs.fstat == NULL)
+		return -1;
+
+	return stream->fs.fstat(stream->fs.file, buf);
+}

Added: branches/vendor/emile/libstream/stream_lseek.c
===================================================================
--- branches/vendor/emile/libstream/stream_lseek.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libstream/stream_lseek.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,12 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "libstream.h"
+
+int stream_lseek(stream_t *stream, long offset, int whence)
+{
+	return stream->fs.lseek(stream->fs.file, offset, whence);
+}

Added: branches/vendor/emile/libstream/stream_open.c
===================================================================
--- branches/vendor/emile/libstream/stream_open.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libstream/stream_open.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,237 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "libstream.h"
+#ifdef FLOPPY_SUPPORT
+#include <libfloppy.h>
+#endif
+#ifdef SCSI_SUPPORT
+#include <libscsi.h>
+#endif
+#ifdef BLOCK_SUPPORT
+#include <libblock.h>
+#endif
+#ifdef CONTAINER_SUPPORT
+#include <libcontainer.h>
+#endif
+#ifdef ISO9660_SUPPORT
+#include <libiso9660.h>
+#endif
+
+typedef enum {
+	device_FLOPPY,
+	device_SCSI,
+} device_t;
+
+typedef enum {
+	fs_BLOCK,
+	fs_CONTAINER,
+	fs_ISO9660,
+} fs_t;
+
+static char* get_fs(char *path, fs_t *fs)
+{
+	if (strncmp("block:", path, 6) == 0)
+	{
+		*fs = fs_BLOCK;
+		return path + 6;
+	}
+	if (strncmp("container:", path, 10) == 0)
+	{
+		*fs = fs_CONTAINER;
+		return path + 10;
+	}
+	if (strncmp("iso9660:", path, 8) == 0)
+	{
+		*fs = fs_ISO9660;
+		return path + 8;
+	}
+	return NULL;
+}
+
+static char *get_device(char* path, 
+		device_t *device, int *unit, int* partition)
+{
+	int nb;
+
+	if (*path != '(')
+		return NULL;
+	path++;
+
+	if (strncmp("fd", path, 2) == 0) {
+		*device = device_FLOPPY;
+		path += 2;
+	} else if (strncmp("sd", path, 2) == 0) {
+		*device = device_SCSI;
+		path += 2;
+	} else
+		return NULL;
+
+	nb = 0;
+	while ( (*path >= '0') && (*path <= '9') ) {
+		nb = (nb * 10) + (*path - '0');
+		path++;
+	}
+	*unit = nb;
+
+	*partition = -1;
+	if ( (*path == 0) || (*path == ')') )
+	{
+		path++;
+		return path;
+	}
+
+	if (*path != ',')
+		return NULL;
+	path++;
+
+	nb = 0;
+	while ( (*path >= '0') && (*path <= '9') ) {
+		nb = (nb * 10) + (*path - '0');
+		path++;
+	}
+	*partition = nb;
+	if ( (*path == 0) || (*path == ')') )
+	{
+		path++;
+		return path;
+	}
+
+	return NULL;
+}
+
+stream_t *stream_open(char *dev)
+{
+	stream_t *stream;
+	fs_t fs;
+	device_t device;
+	int unit, partition;
+	char *current;
+
+	current = get_fs(dev, &fs);
+	if (current == NULL)
+	{
+		printf("Cannot identify given filesystem\n");
+		return NULL;
+	}
+	current = get_device(current, &device, &unit, &partition);
+	if (current == NULL)
+	{
+		printf("Cannot identify given device\n");
+		return NULL;
+	}
+
+	stream = (stream_t*)malloc(sizeof(stream_t));
+
+	switch(device)
+	{
+#ifdef FLOPPY_SUPPORT
+		case device_FLOPPY:
+			if (partition != -1)
+			{
+				free(stream);
+				return NULL;
+			}
+			stream->device.data = floppy_open(unit);
+			if (stream->device.data == NULL)
+			{
+				free(stream);
+				return NULL;
+			}
+			stream->device.read_sector = 
+				(stream_read_sector_t)floppy_read_sector;
+			stream->device.close = (stream_close_t)floppy_close;
+			stream->device.get_blocksize = 
+				(stream_get_blocksize_t)floppy_get_blocksize; 
+			break;
+#endif /* FLOPPY_SUPPORT */
+
+#ifdef SCSI_SUPPORT
+		case device_SCSI:
+			stream->device.data = scsi_open(unit);
+			if (stream->device.data == NULL)
+			{
+				free(stream);
+				return NULL;
+			}
+			stream->device.read_sector = 
+				(stream_read_sector_t)scsi_read_sector;
+			stream->device.close = (stream_close_t)scsi_close; 
+			stream->device.get_blocksize = 
+				(stream_get_blocksize_t)scsi_get_blocksize; 
+			break;
+#endif /* SCSI_SUPPORT */
+
+		default:
+			free(stream);
+			return NULL;
+			break;
+	}
+
+	switch(fs)
+	{
+#ifdef BLOCK_SUPPORT
+		case fs_BLOCK:
+			stream->fs.volume = NULL;
+			stream->fs.file = block_open(&stream->device, current);
+			if (stream->fs.file == NULL)
+				goto outfs;
+			stream->fs.read = (stream_read_t)block_read;
+			stream->fs.lseek = (stream_lseek_t)block_lseek;
+			stream->fs.close = (stream_close_t)block_close;
+			stream->fs.umount = NULL;
+			stream->fs.fstat = (stream_fstat_t)block_fstat;
+			break;
+#endif /* BLOCK_SUPPORT */
+#ifdef CONTAINER_SUPPORT
+		case fs_CONTAINER:
+			stream->fs.volume = NULL;
+			stream->fs.file = container_open(&stream->device, current);
+			if (stream->fs.file == NULL)
+				goto outfs;
+			stream->fs.read = (stream_read_t)container_read;
+			stream->fs.lseek = (stream_lseek_t)container_lseek;
+			stream->fs.close = (stream_close_t)container_close;
+			stream->fs.umount = NULL;
+			stream->fs.fstat = (stream_fstat_t)container_fstat;
+			break;
+#endif /* CONTAINER_SUPPORT */
+
+#ifdef ISO9660_SUPPORT
+		case fs_ISO9660:
+			stream->fs.volume = iso9660_mount(&stream->device);
+			if (stream->fs.volume == NULL)
+			{
+				printf("Cannot mount volume ISO9660\n");
+				goto outfs;
+			}
+			stream->fs.file = iso9660_open(stream->fs.volume, current);
+			if (stream->fs.file == NULL)
+			{
+				iso9660_umount(stream->fs.volume);
+				goto outfs;
+			}
+			stream->fs.read = (stream_read_t)iso9660_read;
+			stream->fs.lseek = (stream_lseek_t)iso9660_lseek;
+			stream->fs.close = (stream_close_t)iso9660_close;
+			stream->fs.umount = (stream_umount_t)iso9660_umount;
+			stream->fs.fstat = (stream_fstat_t)iso9660_fstat;
+			break;
+#endif /* ISO9660_SUPPORT */
+
+		default:
+outfs:
+			stream->device.close(stream->device.data);
+			free(stream);
+			return NULL;
+	}
+
+	return stream;
+}

Added: branches/vendor/emile/libstream/stream_read.c
===================================================================
--- branches/vendor/emile/libstream/stream_read.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libstream/stream_read.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,12 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "libstream.h"
+
+int stream_read(stream_t *stream, void *buf, size_t count)
+{
+	return stream->fs.read(stream->fs.file, buf, count);
+}

Added: branches/vendor/emile/libstream/stream_uncompress.c
===================================================================
--- branches/vendor/emile/libstream/stream_uncompress.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libstream/stream_uncompress.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,22 @@
+#include <zlib.h>
+
+#include "libstream.h"
+
+extern gzFile gzopen (filesystem_io_t *fs);
+int stream_uncompress(stream_t *stream)
+{
+	gzFile *gz;
+
+	gz = gzopen(&stream->fs);
+	if (gz == NULL)
+		return -1;
+
+	stream->fs.volume = NULL;
+	stream->fs.file = gz;
+	stream->fs.read = (stream_read_t)gzread;
+	stream->fs.lseek = (stream_lseek_t)gzseek;
+	stream->fs.close = (stream_close_t)gzclose;
+	stream->fs.umount = NULL;
+
+	return 0;
+}

Added: branches/vendor/emile/libunix/Makefile
===================================================================
--- branches/vendor/emile/libunix/Makefile	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/Makefile	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,21 @@
+#
+#  (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+#
+
+TOP = $(shell pwd)
+
+CFLAGS	= -nostdlib -nodefaultlibs -Wall -Werror -Wno-multichar -fpic -O2 -m68000 -Wa,-m68000 -Os
+CPPFLAGS = -I$(TOP) -I$(TOP)/../libmacos -DARCH_M68K
+
+LIBRARY = libunix.a
+
+SOURCES = divsi3.S modsi3.S mulsi3.S udivsi3.S umodsi3.S free.c malloc.c \
+	  memcpy.c memset.c printf.c putchar.c puts.c read.c sprintf.c \
+	  strcpy.c strlen.c strncpy.c vsprintf.c write.c strcmp.c \
+	  strncmp.c strtol.c
+
+HEADERS = 
+
+all: $(LIBRARY)
+
+include $(TOP)/../Rules.mk

Added: branches/vendor/emile/libunix/divsi3.S
===================================================================
--- branches/vendor/emile/libunix/divsi3.S	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/divsi3.S	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,38 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ * Some parts from libgcc routines for 68000 w/o floating-point hardware.
+ * Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
+ *
+ */
+
+	.chip 68000
+
+	.align 	2
+
+	.globl	__divsi3
+__divsi3:
+	movel	%d2, %sp at -
+
+	moveq	#1, %d2	/* sign of result stored in %d2 (=1 or =-1) */
+	movel	%sp@(12), %d1	/* %d1 = divisor */
+	jpl	__divsi3L1
+	negl	%d1
+	negb	%d2		/* change sign because divisor <0  */
+__divsi3L1:	movel	%sp@(8), %d0	/* %d0 = dividend */
+	jpl	__divsi3L2
+	negl	%d0
+	negb	%d2
+
+__divsi3L2:	movel	%d1, %sp at -
+	movel	%d0, %sp at -
+	bsr	__udivsi3	/* divide abs(dividend) by abs(divisor) */
+	addql	#8, %sp
+
+	tstb	%d2
+	jpl	__divsi3L3
+	negl	%d0
+
+__divsi3L3:	movel	%sp at +, %d2
+	rts

Added: branches/vendor/emile/libunix/free.c
===================================================================
--- branches/vendor/emile/libunix/free.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/free.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,12 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <macos/memory.h>
+
+void free(void *ptr)
+{
+	DisposePtr(ptr);
+}

Added: branches/vendor/emile/libunix/malloc.c
===================================================================
--- branches/vendor/emile/libunix/malloc.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/malloc.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,13 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <macos/memory.h>
+
+void *malloc(size_t size)
+{
+	return NewPtr(size);
+}

Added: branches/vendor/emile/libunix/memcpy.c
===================================================================
--- branches/vendor/emile/libunix/memcpy.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/memcpy.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,17 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.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;
+}

Added: branches/vendor/emile/libunix/memset.c
===================================================================
--- branches/vendor/emile/libunix/memset.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/memset.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,16 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.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;
+}

Added: branches/vendor/emile/libunix/modsi3.S
===================================================================
--- branches/vendor/emile/libunix/modsi3.S	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/modsi3.S	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,30 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ * Some parts from libgcc routines for 68000 w/o floating-point hardware.
+ * Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
+ *
+ */
+
+	.chip 68000
+
+	.align 	2
+
+	.globl	__modsi3
+__modsi3:
+	movel	%sp@(8), %d1	/* %d1 = divisor */
+	movel	%sp@(4), %d0	/* %d0 = dividend */
+	movel	%d1, %sp at -
+	movel	%d0, %sp at -
+	bsr	__divsi3
+	addql	#8, %sp
+	movel	%sp@(8), %d1	/* %d1 = divisor */
+	movel	%d1, %sp at -
+	movel	%d0, %sp at -
+	bsr	__mulsi3	/* %d0 = (a/b)*b */
+	addql	#8, %sp
+	movel	%sp@(4), %d1	/* %d1 = dividend */
+	subl	%d0, %d1		/* %d1 = a - (a/b)*b */
+	movel	%d1, %d0
+	rts

Added: branches/vendor/emile/libunix/mulsi3.S
===================================================================
--- branches/vendor/emile/libunix/mulsi3.S	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/mulsi3.S	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,26 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ * Some parts from libgcc routines for 68000 w/o floating-point hardware.
+ * Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
+ *
+ */
+
+	.chip 68000
+
+	.align 	2
+
+	.globl	__mulsi3
+__mulsi3:
+	movew	%sp@(4), %d0	/* x0 -> %d0 */
+	muluw	%sp@(10), %d0	/* x0*y1 */
+	movew	%sp@(6), %d1	/* x1 -> %d1 */
+	muluw	%sp@(8), %d1	/* x1*y0 */
+	addl	%d1, %d0
+	swap	%d0
+	clrw	%d0
+	movew	%sp@(6), %d1	/* x1 -> %d1 */
+	muluw	%sp@(10), %d1	/* x1*y1 */
+	addl	%d1, %d0
+	rts

Added: branches/vendor/emile/libunix/printf.c
===================================================================
--- branches/vendor/emile/libunix/printf.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/printf.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,28 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+
+extern void console_putstring(const char *s);
+
+static char __printf_buffer[2048];
+
+int
+printf(const char * format, ...)
+{
+	va_list				args;
+	int					len;
+
+	va_start(args, format);
+	len = vsprintf(__printf_buffer, format, args);
+	va_end(args);
+
+	if (len)
+		console_putstring(__printf_buffer);
+
+	return len;		
+}

Added: branches/vendor/emile/libunix/putchar.c
===================================================================
--- branches/vendor/emile/libunix/putchar.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/putchar.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,12 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+extern int console_putchar(int c);
+
+int putchar (int c)
+{
+	return console_putchar(c);
+}

Added: branches/vendor/emile/libunix/puts.c
===================================================================
--- branches/vendor/emile/libunix/puts.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/puts.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,16 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+extern void console_putstring(const char *s);
+extern int console_putchar(int c);
+
+int puts(const char * s)
+{
+	console_putstring(s);
+	console_putchar('\n');
+
+	return -1;
+}

Added: branches/vendor/emile/libunix/read.c
===================================================================
--- branches/vendor/emile/libunix/read.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/read.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,32 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <macos/devices.h>
+#include <macos/serial.h>
+
+ssize_t read(int fd, void *buf, size_t count)
+{
+	int res;
+	ParamBlockRec param;
+	long available;
+
+	res = SerGetBuf(fd, &available);
+	if ( (res != noErr) || (available == 0) )
+		return 0;
+
+	param.ioCompletion = 0;
+	param.ioVRefNum = 0;
+	param.ioRefNum = fd;
+	param.ioBuffer = (u_int32_t)buf;
+	param.ioReqCount= count > available ? available : count;
+	param.ioPosMode = fsAtMark;
+	param.ioPosOffset = 0;
+	res = PBReadSync(&param);
+	if (res != noErr)
+		return 0;
+	return param.ioActCount;
+}

Added: branches/vendor/emile/libunix/sprintf.c
===================================================================
--- branches/vendor/emile/libunix/sprintf.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/sprintf.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,20 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+
+int sprintf(char * s, const char * format, ...)
+{
+	va_list	params;
+	int		r;
+	
+	va_start(params, format);
+	r = vsprintf(s, format, params);
+	va_end(params);
+	
+	return r;
+}

Added: branches/vendor/emile/libunix/strcmp.c
===================================================================
--- branches/vendor/emile/libunix/strcmp.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/strcmp.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,18 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <string.h>
+
+int strcmp(const char *__s1, const char *__s2)
+{
+	while (*__s1 && *__s1 == *__s2)
+	{
+		__s1++;
+		__s2++;
+	}
+
+	return (*__s1 - *__s2);;
+}

Added: branches/vendor/emile/libunix/strcpy.c
===================================================================
--- branches/vendor/emile/libunix/strcpy.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/strcpy.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,13 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+char *strcpy (char *__restrict __dest,
+                      __const char *__restrict __src)
+{
+	while ( (*__dest ++ = *__src++) );
+
+	return __dest;
+}

Added: branches/vendor/emile/libunix/strlen.c
===================================================================
--- branches/vendor/emile/libunix/strlen.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/strlen.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,17 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+int strlen(const char* s)
+{
+	int len;
+
+	if (!s) return 0;
+
+	len = 0;
+	while (*s++) len++;
+
+	return len;
+}

Added: branches/vendor/emile/libunix/strncmp.c
===================================================================
--- branches/vendor/emile/libunix/strncmp.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/strncmp.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,23 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <string.h>
+
+int strncmp(const char *__s1, const char *__s2, size_t __n)
+{
+	int tmp;
+	while (__n--)
+	{
+		tmp = *__s1 - *__s2;
+		if (tmp)
+			return tmp;
+		if (!*__s1)
+			break;
+		__s1++; __s2++;
+	}
+		
+	return 0;
+}

Added: branches/vendor/emile/libunix/strncpy.c
===================================================================
--- branches/vendor/emile/libunix/strncpy.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/strncpy.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,15 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+
+char *strncpy (char *__restrict __dest,
+                      __const char *__restrict __src, size_t __n)
+{
+	while ( (*__dest ++ = *__src++) && __n--);
+
+	return __dest;
+}

Added: branches/vendor/emile/libunix/strtol.c
===================================================================
--- branches/vendor/emile/libunix/strtol.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/strtol.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,72 @@
+#include <stdlib.h>
+
+static int my_isspace(int c)
+{
+	return (c == ' ') || (c == '\f') || (c == '\n') || 
+		(c == '\r') || (c == '\t') || (c == '\v');
+}
+
+long int __strtol_internal (const char *nptr, char **endptr, int base, int group)
+{
+	long result = 0;
+	int sign;
+
+	while(my_isspace(*nptr))
+		nptr++;
+
+	if (*nptr == '-')
+	{
+		nptr++;
+		sign = -1;
+	} else if (*nptr == '+')
+	{
+		nptr++;
+		sign = 1;
+	} else
+		sign = 1;
+
+	if (base == 0)
+	{
+		if (*nptr == '0')
+		{
+			nptr++;
+			if (*nptr == 'x')
+			{
+				base = 16;
+				nptr++;
+			} else
+				base = 8;
+		}
+		else
+			base = 10;
+	}
+
+	while (*nptr)
+	{
+		int digit;
+
+		if ( (*nptr >= '0') && (*nptr <= '9') )
+			digit = *nptr - '0';
+		else if ( (*nptr >= 'a') && (*nptr <= 'z') )
+			digit = *nptr - 'a' + 10;
+		else if ( (*nptr >= 'A') && (*nptr <= 'Z') )
+			digit = *nptr - 'A' + 10;
+		else
+			break;
+
+		if (digit >= base)
+			break;
+
+		result = (result * base) + digit;
+
+		nptr++;
+	}
+	if (endptr)
+		*endptr = (char*)nptr;
+	return sign * result;
+}
+
+long int strtol(const char *nptr, char **endptr, int base)
+{
+	return __strtol_internal(nptr, endptr, base, 0);
+}

Added: branches/vendor/emile/libunix/udivsi3.S
===================================================================
--- branches/vendor/emile/libunix/udivsi3.S	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/udivsi3.S	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,58 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ * Some parts from libgcc routines for 68000 w/o floating-point hardware.
+ * Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
+ *
+ */
+
+	.chip 68000
+
+	.align 	2
+
+	.globl	__udivsi3
+__udivsi3:
+	movel	%d2, %sp at -
+	movel	%sp@(12), %d1	/* %d1 = divisor */
+	movel	%sp@(8), %d0	/* %d0 = dividend */
+
+	cmpl	#0x10000, %d1 /* divisor >= 2 ^ 16 ?   */
+	jcc	__udivsi3L3		/* then try next algorithm */
+	movel	%d0, %d2
+	clrw	%d2
+	swap	%d2
+	divu	%d1, %d2          /* high quotient in lower word */
+	movew	%d2, %d0		/* save high quotient */
+	swap	%d0
+	movew	%sp@(10), %d2	/* get low dividend + high rest */
+	divu	%d1, %d2		/* low quotient */
+	movew	%d2, %d0
+	jra	__udivsi3L6
+
+__udivsi3L3:	movel	%d1, %d2		/* use %d2 as divisor backup */
+__udivsi3L4:	lsrl	#1, %d1	/* shift divisor */
+	lsrl	#1, %d0	/* shift dividend */
+	cmpl	#0x10000, %d1 /* still divisor >= 2 ^ 16 ?  */
+	jcc	__udivsi3L4
+	divu	%d1, %d0		/* now we have 16-bit divisor */
+	andl	#0xffff, %d0 /* mask out divisor, ignore remainder */
+
+/* Multiply the 16-bit tentative quotient with the 32-bit divisor.  Because of
+   the operand ranges, this might give a 33-bit product.  If this product is
+   greater than the dividend, the tentative quotient was too large. */
+	movel	%d2, %d1
+	mulu	%d0, %d1		/* low part, 32 bits */
+	swap	%d2
+	mulu	%d0, %d2		/* high part, at most 17 bits */
+	swap	%d2		/* align high part with low part */
+	tstw	%d2		/* high part 17 bits? */
+	jne	__udivsi3L5		/* if 17 bits, quotient was too large */
+	addl	%d2, %d1		/* add parts */
+	jcs	__udivsi3L5		/* if sum is 33 bits, quotient was too large */
+	cmpl	%sp@(8), %d1	/* compare the sum with the dividend */
+	jls	__udivsi3L6		/* if sum > dividend, quotient was too large */
+__udivsi3L5:	subql	#1, %d0		/* adjust quotient */
+
+__udivsi3L6:	movel	%sp at +, %d2
+	rts

Added: branches/vendor/emile/libunix/umodsi3.S
===================================================================
--- branches/vendor/emile/libunix/umodsi3.S	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/umodsi3.S	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,30 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ * Some parts from libgcc routines for 68000 w/o floating-point hardware.
+ * Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
+ *
+ */
+
+	.chip 68000
+
+	.align 	2
+
+	.globl	__umodsi3
+__umodsi3:
+	movel	%sp@(8), %d1	/* %d1 = divisor */
+	movel	%sp@(4), %d0	/* %d0 = dividend */
+	movel	%d1, %sp at -
+	movel	%d0, %sp at -
+	bsr	__udivsi3
+	addql	#8, %sp
+	movel	%sp@(8), %d1	/* %d1 = divisor */
+	movel	%d1, %sp at -
+	movel	%d0, %sp at -
+	bsr	__mulsi3	/* %d0 = (a/b)*b */
+	addql	#8, %sp
+	movel	%sp@(4), %d1	/* %d1 = dividend */
+	subl	%d0, %d1		/* %d1 = a - (a/b)*b */
+	movel	%d1, %d0
+	rts

Added: branches/vendor/emile/libunix/vsprintf.c
===================================================================
--- branches/vendor/emile/libunix/vsprintf.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/vsprintf.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,211 @@
+/*-
+ * Copyright (c) 1986, 1988, 1991, 1993
+ *      The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this
+software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by the University of
+ *      California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this
+software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *      @(#)subr_prf.c  8.3 (Berkeley) 1/21/94
+ *
+ *
+ *		Extracted vsprinf & adapted by BenH for MountX, Wed, June 3 1998.
+ *		Added support for pascal strings.
+ */
+
+#include <stdarg.h>
+
+typedef unsigned long u_long;
+typedef unsigned int u_int;
+typedef unsigned char u_char;
+
+#define NBBY    8
+
+static char *ksprintn(u_long ul, int base, int *lenp, int prec);
+
+/*
+ * Scaled down version of sprintf(3).
+ */
+int
+vsprintf(char *buf, const char *cfmt, va_list ap)
+{
+        register const char *fmt = cfmt;
+        register char *p, *bp;
+        register int ch, base;
+        u_long ul;
+        int lflag, tmp, width, pstring;
+        int prec, precspec;
+        char padc;
+
+        for (bp = buf; ; ) {
+                padc = ' ';
+                width = 0;
+                prec = 0;
+                precspec = 0;
+                pstring = 0;
+                while ((ch = *(u_char *)fmt++) != '%')
+                        if ((*bp++ = (char)ch) == '\0')
+                                return ((bp - buf) - 1);
+
+                lflag = 0;
+reswitch:       switch (ch = *(u_char *)fmt++) {
+                case '0':
+                        padc = '0';
+                        goto reswitch;
+                case '1': case '2': case '3': case '4':
+                case '5': case '6': case '7': case '8': case '9':
+                        for (width = 0;; ++fmt) {
+                                width = width * 10 + ch - '0';
+                                ch = *fmt;
+                                if (ch < '0' || ch > '9')
+                                        break;
+                        }
+                        goto reswitch;
+                       
+                case '#':
+                		pstring = 1;
+                		goto reswitch;
+                case '*':
+                        width = va_arg(ap, int);
+                        goto reswitch;
+                case '.':
+                        precspec = 1;
+                        if (*fmt == '*') {
+                                prec = va_arg(ap, int);
+                                ++fmt;
+                                goto reswitch;
+                        }
+                        for (prec = 0;; ++fmt) {
+                                ch = *fmt;
+                                if (ch < '0' || ch > '9')
+                                        break;
+                                prec = prec * 10 + ch - '0';
+                        }
+                        goto reswitch;
+                case 'l':
+                        lflag = 1;
+                        goto reswitch;
+                /* case 'b': ... break; XXX */
+                case 'c':
+                        *bp++ = (char)va_arg(ap, int);
+                        break;
+                /* case 'r': ... break; XXX */
+                case 's':
+                        p = va_arg(ap, char *);
+                        if (pstring)
+                        {
+                        	prec = precspec ? ((prec < *p) ? prec : *p) : *p;
+                        	p++;
+                        	precspec = 1;
+                        }
+                        while ((!precspec || (--prec >= 0)) && ((*bp = *p++) != 0))
+                                ++bp;
+                        break;
+                case 'd':
+                        ul = (unsigned long)(lflag ? va_arg(ap, long) : va_arg(ap, int));
+                        if ((long)ul < 0) {
+                                *bp++ = (char)'-';
+                                ul = (unsigned long)(-(long)ul);
+                        }
+                        base = 10;
+                        goto number;
+                        break;
+                case 'o':
+                        ul = lflag ? va_arg(ap, u_long) : va_arg(ap,
+u_int);
+                        base = 8;
+                        goto number;
+                        break;
+                case 'u':
+                        ul = lflag ? va_arg(ap, u_long) : va_arg(ap,
+u_int);
+                        base = 10;
+                        goto number;
+                        break;
+                case 'p':
+                        *bp++ = '0';
+                        *bp++ = 'x';
+                        ul = (u_long)va_arg(ap, void *);
+                        base = 16;
+                        goto number;
+                case 'x':
+                case 'X':
+                        ul = lflag ? va_arg(ap, u_long) : va_arg(ap,
+u_int);
+                        base = 16;
+number:                 p = ksprintn(ul, base, &tmp, prec);
+                        if (width && (width -= tmp) > 0)
+                                while (width--)
+                                        *bp++ = padc;
+                        while ((ch = *p--) != 0)
+                                *bp++ = (char)ch;
+                        break;
+                default:
+                        *bp++ = '%';
+                        if (lflag)
+                                *bp++ = 'l';
+                        /* FALLTHROUGH */
+                case '%':
+                        *bp++ = (char)ch;
+                }
+        }
+}
+
+/*
+ * Put a number (base <= 16) in a buffer in reverse order; return an
+ * optional length and a pointer to the NULL terminated (preceded?)
+ * buffer.
+ */
+static char *
+ksprintn(u_long ul, int base, int *lenp, int prec)
+{                                       /* A long in base 8, plus NULL. */
+        static char buf[sizeof(long) * NBBY / 3 + 4];
+        register char *p;
+		int i;
+        p = buf;
+        for(i=0;i<sizeof(buf);i++)
+     		buf[i] = 0;
+        do {
+                *++p = "0123456789abcdef"[ul % base];
+                ul /= base;
+        } while ((--prec > 0 || ul != 0) && p < buf + sizeof(buf) - 1);
+        if (lenp)
+                *lenp = p - buf;
+        return (p);
+}

Added: branches/vendor/emile/libunix/write.c
===================================================================
--- branches/vendor/emile/libunix/write.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/libunix/write.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,27 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <macos/devices.h>
+
+ssize_t write(int fd, const void *buf, size_t count)
+{
+	int res;
+	ParamBlockRec param;
+
+	param.ioCompletion = 0;
+	param.ioVRefNum = 0;
+	param.ioRefNum = fd;
+	param.ioBuffer = (u_int32_t)buf;
+	param.ioReqCount= count;
+	param.ioPosMode = fsAtMark;
+	param.ioPosOffset = 0;
+	res = PBWriteSync(&param);
+	if (res != noErr)
+		return 0;
+	
+	return param.ioActCount;
+}

Added: branches/vendor/emile/second/MMU030.c
===================================================================
--- branches/vendor/emile/second/MMU030.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/MMU030.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,533 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+
+#include "console.h"
+
+#include "MMU030.h"
+
+#define GET_TC_ENABLE(TC)	(TC & 0x80000000)
+#define GET_TC_SRE(TC)		(TC & 0x02000000)
+#define GET_TC_FCL(TC)		(TC & 0x01000000)
+#define GET_TC_IS(TC)		((TC & 0x000F0000) >> 16)
+#define GET_TC_PAGE_SIZE(TC)	(1 << ((TC & 0x00F00000) >> 20))
+#define GET_TC_TI(TC)		(TC & 0xFFFF)
+#define GET_TC_TIA(TC)		((TC & 0xF000) >> 12)
+#define GET_TC_TIB(TC)		((TC & 0x0F00) >> 8)
+#define GET_TC_TIC(TC)		((TC & 0x00F0) >> 4)
+#define GET_TC_TID(TC)		(TC & 0x000F)
+
+#define RP_LIMIT_MAX		0x7FFF
+#define GET_RP_LIMIT(CRP, max, min)	if (CRP[0] & 0x80000000)\
+					{\
+						min = (CRP[0] >> 16) & 0x7FFF;\
+						max = RP_LIMIT_MAX;\
+					} else {\
+						min = 0;\
+						max = (CRP[0] >> 16) & 0x7FFF;\
+					}
+
+#define GET_RP_DT(CRP)		(CRP[0] & 0x3)
+#define GET_RP_ADDR(CRP)	(CRP[1] & 0xFFFFFFF0)
+
+#define DT_INVALID		0
+#define DT_PAGE_DESCRIPTOR	1
+#define DT_VALID_4_BYTE		2
+#define DT_VALID_8_BYTE		3
+
+#define GET_TD_SF_DT(PD)	(PD & 0x3)
+#define GET_TD_SF_WP(PD)	((PD >> 2) & 0x1)
+#define GET_TD_SF_U(PD)		((PD >> 3) & 0x1)
+#define GET_TD_SF_NEXT(PD)	(PD & 0xFFFFFFF0)
+#define GET_TD_SF_ADDR(PD)	(PD & 0xFFFFFF00)
+
+#define GET_TD_LF_LIMIT(PD0, PD1, max, min)	if (PD0 & 0x80000000)\
+					{\
+						min = (PD0 >> 16) & 0x7FFF;\
+						max = RP_LIMIT_MAX;\
+					} else {\
+						min = 0;\
+						max = (PD0 >> 16) & 0x7FFF;\
+					}
+#define GET_TD_LF_DT(PD0, PD1)		(PD0 & 3)
+#define GET_TD_LF_WP(PD0, PD1)		((PD0 >> 2) & 1)
+#define GET_TD_LF_U(PD0, PD1)		((PD0 >> 3) & 0x1)
+#define GET_TD_LF_M(PD0, PD1)		((PD0 >> 4) & 0x1)
+#define GET_TD_LF_CI(PD0, PD1)		((PD0 >> 6) & 0x1)
+#define GET_TD_SF_S(PD0, PD1)		((PD0 >> 8) & 0x1)
+#define GET_TD_LF_NEXT(PD0, PD1)	(PD1 & 0xFFFFFFF0)
+#define GET_TD_LF_ADDR(PD0, PD1)	(PD1 & 0xFFFFFF00)
+
+#define GET_TT_ENABLE(TT)		(TT & 0x8000)
+#define GET_TT_BASE(TT)			( (TT >> 24) & 0xFF )
+#define GET_TT_MASK(TT)			( (TT >> 16) & 0xFF )
+
+#ifdef TRACE_MMU
+#define TRACE(format, args...)	if (MMU_trace) printf(format, ##args)
+static int MMU_trace = 0;
+void MMU030_set_trace(int enable)
+{
+	MMU_trace = enable;
+}
+#else
+#define TRACE(format, args...)
+#endif
+
+static int isTTSegment(unsigned long addr)
+{
+	unsigned long TT0;
+	unsigned long TT1;
+	unsigned long base;
+	unsigned long mask;
+	unsigned long size;
+
+	addr >>= 24;
+
+	MMU030_get_TT0(&TT0);
+
+	if (GET_TT_ENABLE(TT0))
+	{
+		mask = GET_TT_MASK(TT0);
+		base = GET_TT_BASE(TT0);
+
+		base &= ~mask;
+		addr &= ~mask;
+		size = (mask << 24) || 0x00FFFFFF;	
+
+		if ( (base <= addr) && (addr <= base + size) )
+			return 1;
+	}
+
+	MMU030_get_TT1(&TT1);
+
+	if (GET_TT_ENABLE(TT1))
+	{
+		mask = GET_TT_MASK(TT1);
+		base = GET_TT_BASE(TT1);
+
+		base &= ~mask;
+		addr &= ~mask;
+		size = (mask << 24) || 0x00FFFFFF;	
+
+		if ( (base <= addr) && (addr <= base + size) )
+			return 1;
+	}
+
+	/* if come here : no Transparent Translation */
+
+	return 0;
+}
+
+static int decode_8_PD(unsigned long *pageBase, unsigned long *pageMask,
+		unsigned long *attr,
+		unsigned long logicalAddr, unsigned long TI, 
+		unsigned long PD0, unsigned long PD1);
+
+static int decode_4_PD(unsigned long *pageBase, unsigned long *pageMask,
+		unsigned long *attr,
+		unsigned long logicalAddr, unsigned long TI, unsigned long PD)
+{
+	int dt;
+	int TIA;
+	unsigned long root;
+	int index;
+
+	TRACE("PD: %08lx ", PD);
+
+	TIA = GET_TC_TIA(TI);
+
+	dt = GET_TD_SF_DT(PD);
+
+	switch(dt)
+	{
+		case DT_INVALID:
+			TRACE("INVALID\n");
+			return -1;
+
+		case DT_PAGE_DESCRIPTOR:
+			TRACE("PAGE DESCRIPTOR\n");
+			*attr |= ((PD & 0xFF) >> 2);
+			*pageBase = GET_TD_SF_ADDR(PD);
+			return 0;
+
+		case DT_VALID_4_BYTE:
+			*attr |= ((PD & 0x0F) >> 2);
+			index = logicalAddr >> (32 - TIA);
+			*pageMask = (*pageMask) >> TIA;
+			root = GET_TD_SF_NEXT(PD);
+
+			TRACE("4-BYTE TIA: %d index: %d\n", TIA, index);
+			return decode_4_PD( pageBase, pageMask, attr,
+					    logicalAddr << TIA, TI << 4,
+					    MMU030_read_phys(root + index * 4));
+
+		case DT_VALID_8_BYTE:
+			*attr |= ((PD & 0x0F) >> 2);
+			index = logicalAddr >> (32 - TIA);
+			*pageMask = (*pageMask) >> TIA;
+			root = GET_TD_SF_NEXT(PD);
+
+			TRACE("8-BYTE TIA: %d index: %d\n", TIA, index);
+			return decode_8_PD( pageBase, pageMask, attr,
+					    logicalAddr << TIA, TI << 4, 
+					    MMU030_read_phys(root + index * 8),
+					    MMU030_read_phys(root + index * 8 + 4));
+	}
+	return 0;
+}
+
+static int decode_8_PD(unsigned long *pageBase, unsigned long *pageMask,
+		unsigned long *attr,
+		unsigned long logicalAddr, unsigned long TI, 
+		unsigned long PD0, unsigned long PD1)
+{
+	int dt;
+	int TIA;
+	unsigned long root;
+	int index;
+	unsigned long min, max;
+
+	TRACE("PD: %08lx%08lx ", PD0, PD1);
+
+	TIA = GET_TC_TIA(TI);
+
+	dt = GET_TD_LF_DT(PD0, PD1);
+
+	switch(dt)
+	{
+		case DT_INVALID:
+			TRACE("INVALID\n");
+			return -1;
+
+		case DT_PAGE_DESCRIPTOR:
+			TRACE("PAGE DESCRIPTOR\n");
+			*attr |= ((PD0 & 0xFFFF) >> 2);
+			*pageBase = GET_TD_LF_ADDR(PD0, PD1);
+			return 0;
+
+		case DT_VALID_4_BYTE:
+			*attr |= ((PD0 & 0xFFFF) >> 2);
+			index = logicalAddr >> (32 - TIA);
+			*pageMask = (*pageMask) >> TIA;
+			root = GET_TD_LF_NEXT(PD0, PD1);
+			TRACE("4-BYTE TIA: %d index: %d\n", TIA, index);
+
+			GET_TD_LF_LIMIT(PD0, PD1, max, min);
+			if ( (index < min) || (index > max) )
+				return -1;
+
+			return decode_4_PD( pageBase, pageMask, attr,
+					    logicalAddr << TIA, TI << 4,
+					    MMU030_read_phys(root + index * 4));
+
+		case DT_VALID_8_BYTE:
+			*attr |= ((PD0 & 0xFFFF) >> 2);
+			index = logicalAddr >> (32 - TIA);
+			*pageMask = (*pageMask) >> TIA;
+			root = GET_TD_LF_NEXT(PD0, PD1);
+			TRACE("8-BYTE TIA: %d index: %d\n", TIA, index);
+
+			GET_TD_LF_LIMIT(PD0, PD1, max, min);
+			if ( (index < min) || (index > max) )
+				return -1;
+
+			return decode_8_PD( pageBase, pageMask, attr,
+					    logicalAddr << TIA, TI << 4, 
+					    MMU030_read_phys(root + index * 8),
+					    MMU030_read_phys(root + index * 8 + 4));
+	}
+	return 0;
+}
+
+int MMU030_logical2physicalAttr(unsigned long logicalAddr, unsigned long *physicalAddr, unsigned long *attr)
+{
+	unsigned long TC;
+	unsigned long CRP[2];
+	unsigned long pageBase;
+	unsigned long pageMask = 0xFFFFFFFF;
+	int TIA;
+	int max, min;
+	int dt;
+	unsigned long root;
+	int is;
+	int index;
+	int ret = -1;
+
+	TRACE("logical: %08lx ", logicalAddr);
+
+	*attr = 0;
+
+	/* test if MMU is enabled */
+
+	MMU030_get_TC(&TC);
+
+	TRACE("TC: %08lx\n", TC);
+
+	if (!GET_TC_ENABLE(TC) || isTTSegment(logicalAddr))
+	{
+		*physicalAddr = logicalAddr;
+		return 0;
+	}
+
+	/* analyse CPU root pointer */
+
+	MMU030_get_CRP(CRP);
+
+	TRACE("CRP: %08lx%08lx ", CRP[0], CRP[1]);
+
+	dt = GET_RP_DT(CRP);
+	GET_RP_LIMIT(CRP, max, min);
+
+	/* analyse translation control register */
+
+	TIA = GET_TC_TIA(TC);
+	is = GET_TC_IS(TC);
+
+	index = (logicalAddr << is) >> (32 - TIA);
+	pageMask = pageMask >> (is + TIA);
+
+	if ( (index < min) || (index > max) )
+		return -1;
+	index = index - min;
+
+	root = GET_RP_ADDR(CRP);
+
+	switch(dt)
+	{
+		case DT_INVALID:
+		case DT_PAGE_DESCRIPTOR:
+			TRACE("INVALID");
+			ret = -1;
+			break;
+
+		case DT_VALID_4_BYTE:
+
+			TRACE("4-BYTE TIA: %d index: %d\n", TIA, index);
+			ret = decode_4_PD( &pageBase, &pageMask, attr,
+					   logicalAddr << (is + TIA),
+					   GET_TC_TI(TC) << 4,
+					   MMU030_read_phys(root + index * 4));
+			break;
+
+		case DT_VALID_8_BYTE:
+
+			TRACE("8-BYTE TIA: %d index: %d\n", TIA, index);
+			ret = decode_8_PD( &pageBase, &pageMask, attr,
+					   logicalAddr << (is + TIA),
+					   GET_TC_TI(TC) << 4,
+					   MMU030_read_phys(root + index * 8), 
+					   MMU030_read_phys(root + index * 8 + 4));
+			break;
+	}
+
+	*physicalAddr = pageBase + (logicalAddr & pageMask);
+	TRACE("Base: %08lx Mask: %08lx -> %08lx\n", 
+	      pageBase, pageMask, *physicalAddr);
+
+	return ret;
+}
+
+int MMU030_logical2physical(unsigned long logicalAddr, unsigned long *physicalAddr)
+{
+	unsigned long attr;
+
+	return MMU030_logical2physicalAttr(logicalAddr, physicalAddr, &attr);
+}
+
+unsigned long MMU030_get_page_size(void)
+{
+	unsigned long TC;
+
+	MMU030_get_TC(&TC);
+
+	return GET_TC_PAGE_SIZE(TC);
+}
+
+#ifdef MMU_DUMP
+static void dump_8_PD(int shift, unsigned long PD0, unsigned long PD1);
+
+static void dump_4_PD(int shift, unsigned long PD)
+{
+	int dt;
+	int i;
+	int TIA;
+	unsigned long TC;
+	unsigned long root;
+
+	if (shift > 8)
+		printf("ERROR ! shift > 8 ");
+
+	MMU030_get_TC(&TC);
+
+	TIA = (GET_TC_TI(TC) >> (8 - shift)) & 0x000F;
+
+	dt = GET_TD_SF_DT(PD);
+
+	switch(dt)
+	{
+		case DT_INVALID:
+			printf("INVALID!, ");
+			break;
+	
+		case DT_PAGE_DESCRIPTOR:
+			printf("0x%08lx (%d), ", GET_TD_SF_ADDR(PD), shift);
+			break;
+
+		case DT_VALID_4_BYTE:
+			root = GET_TD_SF_NEXT(PD);
+			for (i = 0; i < (1 << TIA); i++)
+			{
+				unsigned long PD = MMU030_read_phys(root + i * 4);
+
+				dump_4_PD(shift + 4, PD);
+			}
+			break;
+
+		case DT_VALID_8_BYTE:
+			root = GET_TD_SF_NEXT(PD);
+			for (i = 0; i < (1 << TIA); i++)
+			{
+				unsigned long PD0 = MMU030_read_phys(root + i * 8);
+				unsigned long PD1 = MMU030_read_phys(root + i * 8 + 4);
+
+				dump_8_PD(shift + 4, PD0, PD1);
+			}
+			break;
+
+		default:
+			printf("ERROR !! dt = %d ", dt);
+			break;
+	}
+}
+
+static void dump_8_PD(int shift, unsigned long PD0, unsigned long PD1)
+{
+	int dt;
+	int max, min;
+	int i;
+	int TIA;
+	unsigned long TC;
+	unsigned long root;
+
+	GET_TD_LF_LIMIT(PD0, PD1, max, min);
+
+	if (shift > 8)
+		printf("ERROR ! shift > 8 ");
+
+	MMU030_get_TC(&TC);
+
+	TIA = (GET_TC_TI(TC) >> (8 - shift)) & 0x000F;
+	max = max > (1 << TIA) ? (1 << TIA) : max;
+	if (max - min < 0)
+		printf("ERROR ! max(%d) - min(%d) < 0, TIA = %d, ", max, min, TIA);
+
+	dt = GET_TD_LF_DT(PD0, PD1);
+
+	switch(dt)
+	{
+		case DT_INVALID:
+			printf("INVALID!, ");
+			break;
+	
+		case DT_PAGE_DESCRIPTOR:
+			printf("0x%08lx (%d), ", GET_TD_LF_ADDR(PD0, PD1), shift);
+			break;
+
+		case DT_VALID_4_BYTE:
+			root = GET_TD_LF_NEXT(PD0, PD1);
+			for (i = 0; i < max - min; i++)
+			{
+				unsigned long PD = MMU030_read_phys(root + i * 4);
+
+				dump_4_PD(shift + 4, PD);
+			}
+			break;
+
+		case DT_VALID_8_BYTE:
+			root = GET_TD_LF_NEXT(PD0, PD1);
+			for (i = 0; i < max - min; i++)
+			{
+				unsigned long PD0 = MMU030_read_phys(root + i * 8);
+				unsigned long PD1 = MMU030_read_phys(root + i * 8 + 4);
+
+				dump_8_PD(shift + 4, PD0, PD1);
+			}
+			break;
+
+		default:
+			printf("ERROR !! dt = %d ", dt);
+			break;
+	}
+}
+
+void MMU030_dump_table()
+{
+	unsigned long root;
+	unsigned long TC;
+	unsigned long CRP[2];
+	int max, min;
+	int dt;
+	int i;
+	int TIA, TIB, TIC, TID;
+
+	MMU030_get_TC(&TC);
+
+	printf("TC: 0x%08lx\n", TC);
+	if (GET_TC_ENABLE(TC))
+		printf("    Enable\n");
+	if (GET_TC_SRE(TC))
+		printf("    Supervisor Root Pointer Enable\n");
+	if (GET_TC_FCL(TC))
+		printf("    Function Code lookup Enable\n");
+	printf("Page Size: %d, Initial Shift: %ld\n", 
+		GET_TC_PAGE_SIZE(TC), GET_TC_IS(TC));
+	TIA = GET_TC_TIA(TC);
+	TIB = GET_TC_TIB(TC);
+	TIC = GET_TC_TIC(TC);
+	TID = GET_TC_TID(TC);
+	printf("TIA: %d TIB: %d TIC: %d TID: %d\n", TIA, TIB, TIC, TID);
+
+	/* dump table */
+
+	MMU030_get_CRP(CRP);
+	printf("Root Pointer: 0x%08lx%08lx\n", CRP[0], CRP[1]);
+
+	dt = GET_RP_DT(CRP);
+	GET_RP_LIMIT(CRP, max, min);
+	max = max > (1 << TIA) ? (1 << TIA) : max;
+
+	root = GET_RP_ADDR(CRP);
+	printf("SRP: 0x%08lx\n", root);
+	switch(dt)
+	{
+		case DT_INVALID:
+		case DT_PAGE_DESCRIPTOR:
+			break;
+
+		case DT_VALID_4_BYTE:
+			for (i = 0; i < max - min; i++)
+			{
+				unsigned long PD = MMU030_read_phys(root + i * 4);
+
+				printf("0x%08lx -> ", (unsigned long)(i + min) << (32 - TIA));
+				dump_4_PD(0, PD);
+			}
+			break;
+
+		case DT_VALID_8_BYTE:
+			for (i = 0; i < max - min; i++)
+			{
+				unsigned long PD0 = MMU030_read_phys(root + i * 8);
+				unsigned long PD1 = MMU030_read_phys(root + i * 8 + 4);
+
+				printf("0x%08lx -> ", (unsigned long)(i + min) << (32 - TIA));
+				dump_8_PD(0, PD0, PD1);
+			}
+			break;
+	}
+}
+#endif /* MMU_DUMP */

Added: branches/vendor/emile/second/MMU030.h
===================================================================
--- branches/vendor/emile/second/MMU030.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/MMU030.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,27 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+extern void MMU030_disable_cache(void);
+
+extern void MMU030_get_TC(unsigned long *TC);
+extern void MMU030_get_SRP(unsigned long *SRP);
+extern void MMU030_get_CRP(unsigned long *CRP);
+extern void MMU030_get_TT0(unsigned long *TT0);
+extern void MMU030_get_TT1(unsigned long *TT1);
+extern int MMU030_ptest(unsigned long logical, unsigned long* physical);
+extern unsigned long MMU030_read_phys(unsigned long addr);
+extern void MMU030_write_phys(void *addr, unsigned long value);
+
+
+extern unsigned long MMU030_get_page_size(void);
+extern int MMU030_logical2physicalAttr(unsigned long logical, unsigned long *physicalAddr, unsigned long *attr);
+extern int MMU030_logical2physical(unsigned long logical, unsigned long *physicalAddr);
+#ifdef TRACE_MMU
+extern void MMU030_set_trace(int enable);
+#endif
+#ifdef MMU_DUMP
+extern void MMU030_dump_table();
+#endif

Added: branches/vendor/emile/second/MMU030_asm.S
===================================================================
--- branches/vendor/emile/second/MMU030_asm.S	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/MMU030_asm.S	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,176 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+	.chip 68030
+
+	.global MMU030_disable_cache
+MMU030_disable_cache:
+	lea 0x0808, %a0
+	nop
+	movec %a0, %cacr
+	rts
+
+	.global MMU030_get_TC
+MMU030_get_TC:
+	link.w	%fp,#0
+	move.l	8(%fp),%a0
+	pmove	%tc,%a0@
+	unlk	%fp
+	rts
+
+	.global MMU030_get_SRP
+MMU030_get_SRP:
+	link.w	%fp,#0
+	move.l	8(%fp),%a0
+	pmove	%srp,%a0@
+	unlk	%fp
+	rts
+	
+	.global MMU030_get_CRP
+MMU030_get_CRP:
+	link.w	%fp,#0
+	move.l	8(%fp),%a0
+	pmove	%crp,%a0@
+	unlk	%fp
+	rts
+
+	.global MMU030_get_TT0
+MMU030_get_TT0:
+	link.w	%fp,#0
+	move.l	8(%fp),%a0
+	pmove	%tt0, %a0@
+	unlk	%fp
+	rts
+
+	.global MMU030_get_TT1
+MMU030_get_TT1:
+	link.w	%fp,#0
+	move.l	8(%fp),%a0
+	pmove	%tt1,%a0@
+	unlk	%fp
+	rts
+
+	.global MMU030_ptest
+MMU030_ptest:
+	link.w	%fp,#-8
+	move.l	8(%fp),%a0
+
+	/* test address */
+
+	suba.l	%a1, %a1
+	ptestr	#1,(%a0),#7,%a1
+
+	/* get result */
+
+	move.l	12(%fp),%a0
+	move.l	%a1,(%a0)
+
+	lea	-8(%fp),%a0
+	pmove	%psr,%a0@
+	move.w	%a0@, %d0
+	unlk	%fp
+	rts
+
+.TT0:	.long	0
+
+	.global MMU030_read_phys
+MMU030_read_phys:
+	link.w	%fp,#-8
+
+	/* get the address to read */
+
+	move.l	8(%fp),%d0
+	move.l	%d0,%a0
+
+	/* save the %TT0 register */
+
+	lea	.TT0,%a1
+	pmove	%tt0,%a1@
+
+	/* compute %TT0 new value */
+
+	andi.l	#0xFF000000, %d0	/* 8 high bits of address */
+	ori.l	#0x00008207, %d0	/* Enable, Caching allowed, read access
+					 * Ignore Function Code
+					 */
+
+	/* disable interrupts */
+
+	move.l	%d1,-(%sp)
+	move	%sr,%d1
+	ori.w	#0x0700,%sr
+
+	/* set %TT0 with new value */
+
+	move.l	%d0, -8(%fp)
+	pmove 	-8(%fp), %tt0
+
+	/* read real memory */
+
+	move.l	%a0@,%d0
+
+	/* restore %tt0 */
+
+	pmove	%a1@,%tt0
+
+	/* restore  interrupts */
+
+	move	%d1, %sr
+	move.l	(%sp)+, %d1
+
+	unlk	%fp
+	rts
+
+	.global MMU030_write_phys
+MMU030_write_phys:
+	link.w	%fp,#-8
+	move.l	%d2,%sp at -
+
+	/* get the address to read */
+
+	move.l	8(%fp),%d0
+	move.l	%d0,%a0
+	move.l	12(%fp),%d2
+
+	/* save the %TT0 register */
+
+	lea	.TT0,%a1
+	pmove	%tt0,%a1@
+
+	/* compute %TT0 new value */
+
+	andi.l	#0xFF000000, %d0	/* 8 high bits of address */
+	ori.l	#0x00008007, %d0	/* Enable, Caching allowed, write access
+					 * Ignore Function Code
+					 */
+
+	/* disable interrupts */
+
+	move.l	%d1,-(%sp)
+	move	%sr,%d1
+	ori.w	#0x0700,%sr
+
+	/* set %TT0 with new value */
+
+	move.l	%d0, -8(%fp)
+	pmove 	-8(%fp), %tt0
+
+	/* write real memory */
+
+	move.l	%d2, %a0@
+
+	/* restore %tt0 */
+
+	pmove	%a1@,%tt0
+
+	/* restore  interrupts */
+
+	move	%d1, %sr
+	move.l	(%sp)+, %d1
+
+	move.l	%sp at +, %d2
+	unlk	%fp
+	rts

Added: branches/vendor/emile/second/MMU040.c
===================================================================
--- branches/vendor/emile/second/MMU040.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/MMU040.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,182 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ * a lot of parts from penguin booter
+ */
+
+#include <stdio.h>
+
+#include "console.h"
+
+#include "MMU040.h"
+
+#define GET_TC_ENABLE(TC)	(TC & 0x8000)
+#define IS_8K_PAGE(TC)		(TC & 0x4000)
+
+#define GET_TC_PAGE_SIZE(TC)	(IS_8K_PAGE(TC) ? 8192 : 4096)
+
+
+#define GET_PDT(PDT)		(PDT&3)
+#define UDT_IS_INVALID(PDT)	(GET_PDT(PDT) == 0)
+#define UDT_IS_RESIDENT(PDT)	((GET_PDT(PDT) == 1) || (GET_PDT(PDT) == 3))
+#define UDT_IS_INDIRECT(PDT)	(GET_PDT(PDT) == 2)
+
+#define GET_RP_UDT(RP)		(RP & 0x00000003)
+#define GET_RP_W(RP)		(RP & 0x00000004)
+#define GET_RP_U(RP)		(RP & 0x00000008)
+#define GET_RP_ADDR(RP)		(RP & 0xFFFFFE00)
+
+#define GET_TD_4K_ADDR(TD)	(TD & 0xFFFFFF00)
+#define GET_TD_8K_ADDR(TD)	(TD & 0xFFFFFF80)
+
+#define GET_TT_ENABLE(TT)	(TT & 0x8000)
+#define GET_TT_BASE(TT)		( (TT >> 24) & 0xFF )
+#define GET_TT_MASK(TT)		( (TT >> 16) & 0xFF )
+
+#ifdef TRACE_MMU
+#define TRACE(format, args...)  if (MMU_trace) printf(format, ##args)
+static int MMU_trace = 0;
+void MMU040_set_trace(int enable)
+{
+	MMU_trace = enable;
+}
+#else
+#define TRACE(format, args...)
+#endif
+
+
+static int isTTSegment(unsigned long addr)
+{
+	unsigned long DTT0;
+	unsigned long DTT1;
+	unsigned long base;
+	unsigned long mask;
+	unsigned long size;
+
+	addr >>= 24;
+
+	MMU040_get_DTT0(&DTT0);
+
+	if (GET_TT_ENABLE(DTT0))
+	{
+		mask = GET_TT_MASK(DTT0);
+		base = GET_TT_BASE(DTT0);
+
+		base &= ~mask;
+		addr &= ~mask;
+		size = mask & 0x000000FF;
+
+		if ( (base <= addr) && (addr <= base + size) )
+			return 1;
+	}
+
+	MMU040_get_DTT1(&DTT1);
+
+	if (GET_TT_ENABLE(DTT1))
+	{
+		mask = GET_TT_MASK(DTT1);
+		base = GET_TT_BASE(DTT1);
+
+		base &= ~mask;
+		addr &= ~mask;
+		size = mask & 0x000000FF;
+
+		if ( (base <= addr) && (addr <= base + size) )
+			return 1;
+	}
+
+	/* if come here : no Transparent Translation */
+
+	return 0;
+}
+
+int MMU040_logical2physicalAttr(unsigned long logicalAddr, unsigned long *physicalAddr, unsigned long *attr)
+{
+	unsigned long TC;
+	int rootIndex, ptrIndex, pageIndex;
+	unsigned long pageOffst;
+	unsigned long rootTable, ptrTable, pageTable;
+	unsigned long rootEntry, tableEntry, pageEntry;
+
+	TRACE("logical: %08lx ", logicalAddr);
+
+	MMU040_get_TC(&TC);
+	
+	TRACE("TC: %08lx\n", TC);
+
+	if ( !GET_TC_ENABLE(TC) || isTTSegment(logicalAddr) )
+	{
+		*physicalAddr = logicalAddr;
+		return 0;
+	}
+
+	MMU040_get_SRP(&rootTable);
+	TRACE("SRP: %ld\n", rootTable);
+
+	rootIndex = (logicalAddr & 0xFE000000) >> 25;
+	rootEntry = MMU040_read_phys(rootTable + 4 * rootIndex);
+	TRACE("Root Entry: %08lx\n", rootEntry);
+
+	if ( UDT_IS_INVALID(rootEntry) || UDT_IS_RESIDENT(rootEntry) )
+	{
+		*physicalAddr = logicalAddr;
+		return 0;
+	}
+
+	ptrTable = GET_RP_ADDR(rootEntry);
+	ptrIndex  = (logicalAddr & 0x01FC0000) >> 18;
+	tableEntry = MMU040_read_phys(ptrTable + 4 * ptrIndex);
+	TRACE("table Entry: %08lx\n", tableEntry);
+
+	if ( UDT_IS_INVALID(tableEntry) || UDT_IS_RESIDENT(tableEntry) )
+	{
+		*physicalAddr = logicalAddr;
+		return 0;
+	}
+
+	if (IS_8K_PAGE(TC))
+	{
+		pageTable = GET_TD_8K_ADDR(tableEntry);
+		pageIndex = (logicalAddr & 0x0003E000) >> 13;
+
+		pageEntry = MMU040_read_phys(pageTable + 4 * pageIndex);
+		pageOffst    = logicalAddr & 0x00001FFF;
+
+		*physicalAddr = (pageEntry & 0xFFFFE000) + pageOffst;
+	}
+	else
+	{
+		pageTable = GET_TD_4K_ADDR(tableEntry);
+		pageIndex = (logicalAddr & 0x0003F000) >> 12;
+
+		pageEntry = MMU040_read_phys(pageTable + 4 * pageIndex);
+		pageOffst    = logicalAddr & 0x00000FFF;
+
+		*physicalAddr = (pageEntry & 0xFFFFF000) + pageOffst;
+	}
+
+	*attr = pageEntry & 0x000004FF;
+
+	TRACE("physical: %08lx\n", *physicalAddr);
+
+	return 0;
+}
+
+int MMU040_logical2physical(unsigned long logicalAddr, unsigned long *physicalAddr)
+{
+	unsigned long attr;
+
+	return MMU040_logical2physicalAttr(logicalAddr, physicalAddr, &attr);
+}
+
+unsigned long MMU040_get_page_size(void)
+{
+	unsigned long TC;
+
+	MMU040_get_TC(&TC);
+
+	TRACE("Page Size: %d\n", GET_TC_PAGE_SIZE(TC));
+
+	return GET_TC_PAGE_SIZE(TC);
+}

Added: branches/vendor/emile/second/MMU040.h
===================================================================
--- branches/vendor/emile/second/MMU040.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/MMU040.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,21 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+extern void MMU040_disable_cache(void);
+
+extern void MMU040_get_TC(unsigned long *TC);
+extern void MMU040_get_SRP(unsigned long *SRP);
+extern void MMU040_get_CRP(unsigned long *CRP);
+extern void MMU040_get_ITT0(unsigned long *TT0);
+extern void MMU040_get_DTT0(unsigned long *TT0);
+extern void MMU040_get_ITT1(unsigned long *TT1);
+extern void MMU040_get_DTT1(unsigned long *TT1);
+extern unsigned long MMU040_read_phys(unsigned long addr);
+
+
+extern unsigned long MMU040_get_page_size(void);
+extern int MMU040_logical2physicalAttr(unsigned long logical, unsigned long *physicalAddr, unsigned long *attr);
+extern int MMU040_logical2physical(unsigned long logical, unsigned long *physicalAddr);

Added: branches/vendor/emile/second/MMU040_asm.S
===================================================================
--- branches/vendor/emile/second/MMU040_asm.S	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/MMU040_asm.S	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,141 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+	.chip 68040
+
+	.global MMU040_disable_cache
+MMU040_disable_cache:
+	moveq.l	#0, %d0
+	nop
+	cpusha	%bc
+        movec	%d0, %cacr
+	cinva	%bc
+	rts
+
+	.global MMU040_get_TC
+MMU040_get_TC:
+	link.w	%fp,#0
+	move.l	8(%fp),%a0
+	movec	%tc,%d0
+	move.l	%d0,%a0@
+	unlk	%fp
+	rts
+
+	.global MMU040_get_SRP
+MMU040_get_SRP:
+	link.w	%fp,#0
+	move.l	8(%fp),%a0
+	movec	%srp, %d0
+	move.l	%d0,%a0@
+	unlk	%fp
+	rts
+
+	.global MMU040_get_CRP
+MMU040_get_CRP:
+	link.w	%fp,#0
+	move.l	8(%fp),%a0
+	movec	%urp, %d0
+	move.l	%d0,%a0@
+	unlk	%fp
+	rts
+
+	.global MMU040_get_ITT0
+MMU040_get_ITT0:
+	link.w	%fp,#0
+	move.l	8(%fp),%a0
+	movec	%itt0, %d0
+	move.l	%d0,%a0@
+	unlk	%fp
+	rts
+
+	.global MMU040_get_DTT0
+MMU040_get_DTT0:
+	link.w	%fp,#0
+	move.l	8(%fp),%a0
+	movec	%dtt0, %d0
+	move.l	%d0,%a0@
+	unlk	%fp
+	rts
+
+	.global MMU040_get_ITT1
+MMU040_get_ITT1:
+	link.w	%fp,#0
+	move.l	8(%fp),%a0
+	movec	%itt1, %d0
+	move.l	%d0,%a0@
+	unlk	%fp
+	rts
+
+	.global MMU040_get_DTT1
+MMU040_get_DTT1:
+	link.w	%fp,#0
+	move.l	8(%fp),%a0
+	movec	%dtt1, %d0
+	move.l	%d0,%a0@
+	unlk	%fp
+	rts
+
+	.global MMU040_ptest
+MMU040_ptest:
+	link.w	%fp,#0
+	move.l	8(%fp),%a0
+
+	/* test address */
+
+	ptestw	(%a0)
+
+	movec	%mmusr,%d0
+	unlk	%fp
+	rts
+
+
+	.global MMU040_read_phys
+MMU040_read_phys:
+	link.w	%fp,#-8
+	move.l	%d2,%sp at -
+
+	/* get the address to read */
+
+	move.l	8(%fp),%d0
+	move.l	%d0,%a0
+
+	/* save the %TT0 register */
+
+	movec	%dtt0,%d2
+
+	/* compute %TT0 new value */
+
+	andi.l	#0xFF000000, %d0	/* 8 high bits of address */
+	ori.l	#0x00008207, %d0	/* Enable, Caching allowed, read access
+					 * Ignore Function Code
+					 */
+
+	/* disable interrupts */
+
+	move.l	%d1,-(%sp)
+	move	%sr,%d1
+	ori.w	#0x0700,%sr
+
+	/* set %TT0 with new value */
+
+	movec 	%d0, %dtt0
+
+	/* read real memory */
+
+	move.l	%a0@,%d0
+
+	/* restore %tt0 */
+
+	movec	%d2,%dtt0
+
+	/* restore  interrupts */
+
+	move	%d1, %sr
+	move.l	(%sp)+, %d1
+
+	move.l	%sp at +, %d2
+	unlk	%fp
+	rts

Added: branches/vendor/emile/second/Makefile
===================================================================
--- branches/vendor/emile/second/Makefile	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/Makefile	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,170 @@
+# 
+# 
+#  (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+# 
+#
+
+TARGET = m68k-linux
+MEDIA = floppy
+
+TOP		= $(shell pwd)
+VPATH		= $(TOP)
+CPPFLAGS	= -DVERSION="\"$(VERSION)\"" -I$(TOP) -Wa,-I$(TOP) \
+		  $(OPT_CPPFLAGS) -DUSE_CLI \
+		  -I$(TOP)/../libmacos -Wa,-I$(TOP)/../libmacos \
+		  -I$(TOP)/../libstream 
+
+# -O2 is needed to be able to inline functions from libmacos
+CFLAGS		= $(OPT_CFLAGS) -nostdlib -nodefaultlibs -Wall -Werror -Wno-multichar -fpic -O2
+ASFLAGS		= 
+LIBS		= $(OPT_LIBS) -L$(TOP)/../libiso9660/m68k-linux \
+		  -liso9660 -L$(TOP)/../libunix -lunix \
+		  -L$(TOP)/../libmacos -lmacos -lunix \
+		  -L$(TOP)/../libgzip/m68k-linux -lgzip \
+		  -L$(TOP)/../libfloppy -lfloppy -L$(TOP)/../libscsi -lscsi \
+		  -L$(TOP)/../libblock -lblock \
+		  -L$(TOP)/../libcontainer -lcontainer -lunix
+
+LS		= ls
+AWK		= awk
+
+HEADERS	= arch.h bank.h bootenv.h bootinfo.h bootx.h cli.h console.h driver.h enter_kernel030.h enter_kernel040.h enter_kernel.h enter_kernelnoMMU.h enter_kernelPPC.h head.h keyboard.h load.h misc.h MMU030.h MMU040.h serial.h vga.h config.h copymem.i
+
+SOURCES = head.S main.c console.c \
+	  font_8x16.c \
+	  misc.c bank.c arch.c \
+	  load.c serial.c vga.c driver.c \
+	  enter_kernel.c config.c
+
+SOURCES_CLI = keyboard.c cli.c
+
+OBJS	= $(patsubst %.c,%.o,$(SOURCES:.S=.o)) $(SOURCES_CLI:.c=.o) \
+	  $(OPTOBJS)
+
+# ARCHITECTURE
+
+SOURCES_MMU030 = MMU030_asm.S MMU030.c enter_kernel030.S
+SOURCES_MMU040 = MMU040_asm.S MMU040.c enter_kernel040.S
+SOURCES_MMU = $(SOURCES_MMU030) $(SOURCES_MMU040)
+SOURCES_noMMU = enter_kernelnoMMU.S
+SOURCES_M68K = $(SOURCES_MMU) $(SOURCES_noMMU)
+
+OBJS_M68K = $(patsubst %.c,%.o,$(SOURCES_M68K:.S=.o))
+
+SOURCES_PPC = enter_kernelPPC.S PPC_asm.S
+
+OBJS_PPC = $(patsubst %.c,%.o,$(SOURCES_PPC:.S=.o))
+
+# TARGET
+
+SOURCES_LINUX_M68K = bootinfo.c
+OBJS_LINUX_M68K = $(SOURCES_LINUX_M68K:.c=.o)
+
+SOURCES_NETBSD_M68K = bootenv.c
+OBJS_NETBSD_M68K = $(SOURCES_NETBSD_M68K:.c=.o)
+
+SOURCES_LINUX_PPC = bootx.c
+OBJS_LINUX_PPC = $(SOURCES_LINUX_PPC:.c=.o)
+
+DISTFILES = $(SOURCES) $(SOURCES_M68K) $(SOURCES_PPC) $(SOURCES_CLI) $(SOURCES_LINUX_M68K) $(SOURCES_NETBSD_M68K) $(SOURCES_LINUX_PPC) $(HEADERS) Makefile ld.script
+
+ifeq ("$(TARGET)", "m68k-linux")
+
+	OBJS_TARGET	= $(OBJS_M68K) $(OBJS_LINUX_M68K)
+	CPPFLAGS_TARGET = -D__LINUX__ -DARCH_M68K -DUSE_MMU030 -DUSE_MMU040
+	CFLAGS_TARGET	= -m68020 -Wa,-m68020 -Os
+
+else
+ifeq ("$(TARGET)", "classic-linux")
+
+	OBJS_TARGET 	= $(OBJS_noMMU) $(OBJS_LINUX_M68K)
+	CPPFLAGS_TARGET = -D__LINUX__ -DARCH_M68K
+	CFLAGS_TARGET	= -m68000 -Wa,-m68000 -Os
+
+else
+ifeq ("$(TARGET)", "ppc-linux")
+
+	OBJS_TARGET 	= $(OBJS_PPC) $(OBJS_LINUX_PPC)
+	CPPFLAGS_TARGET = -D__LINUX__ -DARCH_PPC
+	CFLAGS_TARGET	= -m68020 -Wa,-m68020 -Os
+
+else
+ifeq ("$(TARGET)", "mixed-linux")
+
+	OBJS_TARGET 	= $(OBJS_M68K) $(OBJS_LINUX_M68K) $(OBJS_PPC) $(OBJS_LINUX_PPC)
+	CPPFLAGS_TARGET = -D__LINUX__ -DARCH_M68K -DUSE_MMU030 -DUSE_MMU040 -DARCH_PPC
+	CFLAGS_TARGET	= -m68020 -Wa,-m68020 -Os
+
+else
+ifeq ("$(TARGET)", "m68k-netbsd")
+
+	OBJS_TARGET 	= $(OBJS_M68K) $(OBJS_NETBSD_M68K)
+	CPPFLAGS_TARGET = -D__NETBSD__ -DARCH_M68K -DUSE_MMU030 -DUSE_MMU040
+	CFLAGS_TARGET	= -m68020 -Wa,-m68020 -Os
+
+endif
+endif
+endif
+endif
+endif
+
+ifeq ("$(MEDIA)", "scsi")
+
+	LIBS_MEDIA=-L$(TOP)/../libstream/hard -lstream
+
+else
+ifeq ("$(MEDIA)", "floppy")
+
+	LIBS_MEDIA=-L$(TOP)/../libstream/floppy -lstream
+
+else
+endif
+endif
+
+$(TARGET)-$(MEDIA)/second::
+	test -d $(TARGET)-$(MEDIA) || mkdir $(TARGET)-$(MEDIA)
+	cd $(TARGET)-$(MEDIA) && make -f $(TOP)/Makefile second \
+			VERSION=$(VERSION) \
+			TOP=$(TOP) \
+			OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) \
+			AS=$(AS) SIGNATURE="$(SIGNATURE)" \
+			OPT_CPPFLAGS="$(CPPFLAGS_TARGET) $(CPPFLAGS_MEDIA)" \
+			OPT_CFLAGS="$(CFLAGS_TARGET)" \
+			OPTOBJS="$(OBJS_TARGET) $(OBJS_MEDIA)" \
+			OPT_LIBS="$(LIBS_MEDIA)"
+
+second: second.o
+	$(OBJCOPY) -j .text -j .data -j .rodata -j .got \
+			-O binary second.o second
+
+second.o: $(OBJS) $(TOP)/ld.script
+	$(LD) -T $(TOP)/ld.script -o second.o $(OBJS) $(LIBS)
+
+.c.o:
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $^ 
+
+install::
+	install -d $(DESTDIR)/$(PREFIX)/boot/emile/
+	install $(KARCH)-linux-scsi/second $(DESTDIR)/$(PREFIX)/boot/emile/$(KARCH)-second_scsi
+	install -d $(DESTDIR)/$(PREFIX)/lib/emile/
+	install $(KARCH)-linux-floppy/second $(DESTDIR)/$(PREFIX)/lib/emile/$(KARCH)-second_floppy
+
+uninstall::
+	rm -f $(DESTDIR)/$(PREFIX)/boot/emile/$(KARCH)-second_scsi
+	rm -f $(DESTDIR)/$(PREFIX)/lib/emile/$(KARCH)-second_floppy
+
+dist:
+	@echo TAR second
+	@for file in $(DISTFILES); do \
+		dir=$$(dirname $$file); \
+		if [ "$$dir" != "" ] ; then \
+			mkdir -p $(DISTDIR)/second/$$dir; \
+		fi; \
+		cp -p $$file $(DISTDIR)/second/$$file; \
+	done
+
+clean:
+	rm -fr m68k-linux-floppy m68k-linux-scsi m68k-linux-ata \
+	      ppc-linux-floppy ppc-linux-scsi ppc-linux-ata \
+	      mixed-linux-floppy mixed-linux-scsi mixed-linux-ata \
+	      m68k-netbsd-floppy classic-linux-floppy

Added: branches/vendor/emile/second/PPC_asm.S
===================================================================
--- branches/vendor/emile/second/PPC_asm.S	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/PPC_asm.S	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,7 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+	.chip 68020

Added: branches/vendor/emile/second/arch.c
===================================================================
--- branches/vendor/emile/second/arch.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/arch.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,170 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ * some parts from BootX, (c) Benjamin Herrenschmidt
+ *
+ */
+
+#include <macos/lowmem.h>
+#include <macos/gestalt.h>
+#include <macos/errors.h>
+
+#include "misc.h"
+#include "arch.h"
+#ifdef ARCH_PPC
+#include "bootx.h"
+#endif
+
+unsigned long cpu_type;
+unsigned long mmu_type;
+unsigned long fpu_type;
+unsigned long machine_id;
+unsigned long arch_type;
+unsigned long ram_size;
+unsigned long gmt_bias;
+#ifdef ARCH_PPC
+unsigned long bus_type;
+#endif
+
+struct older_macintosh_info {
+	char *name;
+	unsigned short ROMID;
+	unsigned short SSW;
+	unsigned long cpu_type;
+	unsigned long mmu_type;
+	unsigned long fpu_type;
+	unsigned long machine_id;
+	unsigned long arch_type;
+};
+
+struct older_macintosh_info older_macintosh[] = {
+	{ "Macintosh SE/30", 0x0178, 0x0603, 
+		gestalt68030, gestalt68030MMU, gestalt68882, 
+		gestaltMacSE030, gestalt68k },
+	{ "Macintosh Classic", 0x0276, 0x0607, 
+		gestalt68000, gestaltNoMMU, gestaltNoFPU, 
+		gestaltClassic, gestalt68k },
+	{ 0 }
+};
+
+void arch_init()
+{
+	MachineLocation where;
+	int i = 0;
+
+	/* Some systems don't support Gestalt() */
+
+	while (older_macintosh[i].name != 0 )
+	{
+		if (ROMBase[4] == older_macintosh[i].ROMID)
+		{
+			/* Doesn't support Gestalt(), nor SysEnvirons() */
+
+			cpu_type = older_macintosh[i].cpu_type;
+			mmu_type = older_macintosh[i].mmu_type;
+			fpu_type = older_macintosh[i].fpu_type;
+			machine_id = older_macintosh[i].machine_id;
+			arch_type = older_macintosh[i].arch_type;
+			ram_size = MemTop;
+
+			return;
+		}
+		i++;
+	}
+
+	/* get RAM size */
+
+	Gestalt('ram ', &ram_size);
+
+	/* get processor type */
+
+	Gestalt(gestaltProcessorType, &cpu_type);
+
+	/* check FPU */
+
+	if (Gestalt('FPUE', &fpu_type) == noErr)
+		fpu_type = 0;
+	else
+		Gestalt(gestaltFPUType, &fpu_type);
+
+	/* check MMU */
+
+	Gestalt(gestaltMMUType, &mmu_type);
+
+	/* I'v got a 'noMMU' with my 68030, not cool... */
+
+	if (mmu_type == gestaltNoMMU)
+	{
+		switch(cpu_type)
+		{
+			case gestalt68030:
+				mmu_type = gestalt68030MMU;
+				break;
+			case gestalt68040:
+				mmu_type = gestalt68040MMU;
+				break;
+		}
+	}
+
+	/* get architecture type: powerPC or m68k */
+
+	if (Gestalt(gestaltSysArchitecture, &arch_type) != noErr)
+		arch_type = gestalt68k;
+
+	/* check machine type */
+
+	Gestalt(gestaltMachineType, &machine_id);
+
+	/* GMT bias */
+
+	ReadLocation(&where);
+	gmt_bias = where.u.gmtDelta & 0x00FFFFFF;
+	if (gmt_bias & 0x00800000)
+		gmt_bias |= 0xFF000000; /* sign-extend to 32 bits */
+	gmt_bias = (long)gmt_bias / 60; /* convert to whole minutes, remember sign */
+
+#ifdef ARCH_PPC
+	/* check bus type */
+
+	if (arch_type == gestaltPowerPC)
+	{
+		unsigned long response;
+
+		/* OpenFirmware implies PCI */
+
+		if ( (Gestalt('opfw', &response) == noErr) &&
+		     (Gestalt('nreg', &response) == noErr) )
+			bus_type = BOOT_ARCH_PCI;
+		else
+			bus_type = BOOT_ARCH_NUBUS;
+
+		switch(machine_id)
+		{
+			case gestaltPowerMac6100_60:
+			case gestaltPowerMac6100_66:
+			case gestaltPowerMac6100_80:
+			case gestaltPowerMac7100_66:
+			case gestaltPowerMac7100_80:
+			case gestaltPowerMac7100_80_chipped:
+			case gestaltPowerMac8100_80:
+			case gestaltPowerMac8100_100:
+			case gestaltPowerMac8100_110:
+			case gestaltPowerMac8100_120:
+			case gestaltAWS9150_80:
+			case gestaltAWS9150_120:
+				bus_type |= BOOT_ARCH_NUBUS_PDM;
+				break;
+			case gestaltPowerMac5200:
+			case gestaltPowerMac6200:
+				bus_type |= BOOT_ARCH_NUBUS_PERFORMA;
+				break;
+			case gestaltPowerBook1400:
+			case gestaltPowerBook5300:
+			case gestaltPowerBookDuo2300:
+				bus_type |= BOOT_ARCH_NUBUS_POWERBOOK;
+				break;
+		}
+	}
+#endif
+}

Added: branches/vendor/emile/second/arch.h
===================================================================
--- branches/vendor/emile/second/arch.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/arch.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,15 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+extern unsigned long cpu_type;
+extern unsigned long mmu_type;
+extern unsigned long fpu_type;
+extern unsigned long machine_id;
+extern unsigned long arch_type;
+extern unsigned long ram_size;
+extern unsigned long gmt_bias;
+
+extern void arch_init();

Added: branches/vendor/emile/second/bank.c
===================================================================
--- branches/vendor/emile/second/bank.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/bank.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,361 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ * portion from penguin booter
+ *
+ */
+
+#include <stdio.h>
+#include <malloc.h>
+
+#include "macos/lowmem.h"
+#include "macos/gestalt.h"
+
+#include "misc.h"
+#include "arch.h"
+#ifdef ARCH_M68K
+#include "MMU030.h"
+#include "MMU040.h"
+#endif
+#include "bank.h"
+#include "vga.h"
+
+/* MacOS nanokernel data structures (nubus powerPC only)
+ * found in Boot/X, thank you Ben ;-)
+ */
+
+#ifdef ARCH_PPC
+#define MACOS_MEMMAP_PTR_ADDR		0x5FFFEFF0
+#define MACOS_MEMMAP_SIZE_ADDR		0x5FFFEFF6
+#define MACOS_MEMMAP_BANK_0FFSET	48
+#endif
+
+memory_map_t memory_map;
+
+static void bank_add_mem(unsigned long logiAddr, 
+			 unsigned long physAddr, unsigned long size)
+{
+	int i;
+	int j;
+
+	for (i = 0; i < memory_map.bank_number; i++)
+	{
+		if ( (memory_map.bank[i].physAddr + 
+				memory_map.bank[i].size == physAddr) && 
+		     (memory_map.bank[i].logiAddr + 
+				memory_map.bank[i].size == logiAddr) )
+		{
+			memory_map.bank[i].size += size;
+
+			/* can we merge 2 banks */
+
+			for (j = 0; j < memory_map.bank_number; j++)
+			{
+				if ( (memory_map.bank[i].physAddr + 
+					memory_map.bank[i].size == 
+						memory_map.bank[j].physAddr) &&
+				     (memory_map.bank[i].logiAddr + 
+					memory_map.bank[i].size == 
+						memory_map.bank[j].logiAddr) )
+				{
+					memory_map.bank[i].size += memory_map.bank[j].size;
+
+					/* remove bank */
+
+					memory_map.bank_number--;
+					memory_map.bank[j].physAddr = memory_map.bank[memory_map.bank_number].physAddr;
+					memory_map.bank[j].logiAddr = memory_map.bank[memory_map.bank_number].logiAddr;
+					memory_map.bank[j].size = memory_map.bank[memory_map.bank_number].size;
+					return;
+				}
+			}
+
+			return;
+		}
+		else if ( (physAddr + size == memory_map.bank[i].physAddr) && 
+			  (logiAddr + size == memory_map.bank[i].logiAddr) )
+		{
+			memory_map.bank[i].physAddr = physAddr;
+			memory_map.bank[i].logiAddr = logiAddr;
+			memory_map.bank[i].size += size;
+
+			return;
+		}
+	}
+
+	/* not found, create new bank */
+
+	if (memory_map.bank_number >= MAX_MEM_MAP_SIZE)
+		return;
+
+	memory_map.bank[memory_map.bank_number].physAddr = physAddr;
+	memory_map.bank[memory_map.bank_number].logiAddr = logiAddr;
+	memory_map.bank[memory_map.bank_number].size = size;
+	memory_map.bank_number++;
+}
+
+#ifdef ARCH_M68K
+void m68k_init_memory_map()
+{
+#ifdef USE_MMU
+	unsigned long logical;
+	unsigned long physical;
+	int ps;
+#endif
+
+	memory_map.bank_number = 0;
+	if (mmu_type == gestaltNoMMU)
+	{
+		if (cpu_type == gestalt68000)
+		{
+			unsigned long start = KERNEL_BASEADDR;
+			unsigned long end = ScrnBase - 0x8000;
+			bank_add_mem(start, start, end - start);
+		}
+		else
+			bank_add_mem(0, 0, MemTop);
+	}
+#ifdef USE_MMU040
+	else if (mmu_type == gestalt68040MMU)
+	{
+		ps = MMU040_get_page_size();
+		logical = 0;
+		for (logical = 0; logical < MemTop ; logical += ps)
+		{
+			if (MMU040_logical2physical(logical, &physical) == 0)
+			{
+				bank_add_mem(logical, physical, ps);
+			}
+		}
+	}
+#endif /* USE_MMU040 */
+#ifdef USE_MMU030
+	else
+	{
+		ps = MMU030_get_page_size();
+		logical = 0;
+		for (logical = 0; logical < MemTop ; logical += ps)
+		{
+			if (MMU030_logical2physical(logical, &physical) == 0)
+			{
+				bank_add_mem(logical, physical, ps);
+			}
+		}
+	}
+#endif /* USE_MMU030 */
+}
+#endif /* ARCH_M68K */
+
+#ifdef ARCH_PPC
+void ppc_init_memory_map()
+{
+	/* Nubus powerPC */
+
+	unsigned long *base = *(unsigned long**)MACOS_MEMMAP_PTR_ADDR;
+	unsigned long len = *(unsigned short*)MACOS_MEMMAP_SIZE_ADDR;
+
+	if (len <= MACOS_MEMMAP_BANK_0FFSET)
+		return;
+
+	base = (unsigned long*)((char*)base + MACOS_MEMMAP_BANK_0FFSET);
+	len -= MACOS_MEMMAP_BANK_0FFSET;
+
+	memory_map.bank_number = 0;
+	while(len >= 8)
+	{
+		unsigned long addr = *(unsigned long*)base++;
+		unsigned long size = *(unsigned long*)base++;
+
+		if (size)
+			bank_add_mem(addr, addr, size);
+
+		len -= 8;
+	}
+}
+#endif /* ARCH_PPC */
+
+void init_memory_map()
+{
+	if (arch_type == gestaltPowerPC) {
+#ifdef ARCH_PPC
+		ppc_init_memory_map();
+#else
+		error("This version of EMILE doesn't support PowePC\n");
+#endif
+	}
+	else {
+#ifdef ARCH_M68K
+		m68k_init_memory_map();
+#else
+		error("This version of EMILE doesn't support Motorola 680x0\n");
+#endif
+	}
+}
+
+#ifdef USE_MMU
+static int bank_find_by_physical(unsigned long physical)
+{
+	int i;
+
+	for (i = 0; i < memory_map.bank_number; i++)
+	{
+		if ( (memory_map.bank[i].physAddr <= physical) &&
+		     ( physical < memory_map.bank[i].physAddr + memory_map.bank[i].size) )
+			return i;
+	}
+
+	return -1;
+}
+
+static int bank_find_by_logical(unsigned long logical)
+{
+	int i;
+
+	for (i = 0; i < memory_map.bank_number; i++)
+	{
+		if ( (memory_map.bank[i].logiAddr <= logical) &&
+		     ( logical < memory_map.bank[i].logiAddr + memory_map.bank[i].size) )
+			return i;
+	}
+
+	return -1;
+}
+
+int logical2physical(unsigned long logical, unsigned long *physical)
+{
+	if ( (mmu_type == gestaltNoMMU) || (mmu_type == gestaltEMMU1) )
+	{
+		*physical = logical;
+
+		return 0;
+	}
+#if defined(ARCH_M68K)
+#ifdef USE_MMU040
+	else if (mmu_type == gestalt68040MMU)
+	{
+		return MMU040_logical2physical(logical, physical);
+	}
+#endif
+#ifdef USE_MMU030
+	return MMU030_logical2physical(logical, physical);
+#endif
+#else
+	return 0;
+#endif
+}
+
+int physical2logical(unsigned long physical, unsigned long *logical)
+{
+	int bank;
+
+	bank = bank_find_by_physical(physical);
+
+	if (bank == -1)
+		return -1;
+
+	if (memory_map.bank[bank].physAddr > memory_map.bank[bank].logiAddr)
+		*logical = physical - (memory_map.bank[bank].physAddr - 
+					memory_map.bank[bank].logiAddr);
+	else
+		*logical = physical + (memory_map.bank[bank].logiAddr - 
+					memory_map.bank[bank].physAddr);
+
+	return 0;
+}
+
+int check_full_in_bank(unsigned long start, unsigned long size)
+{
+	int bank0;
+	int bank1;
+
+	bank0 = bank_find_by_logical(start);
+	bank1 = bank_find_by_logical(start + size);
+
+	return (bank0 == bank1);
+}
+#endif /* USE_MMU */
+
+unsigned long bank_mem_avail()
+{
+	int i;
+	unsigned long size = 0;
+
+	for (i = 0; i < memory_map.bank_number; i++)
+	{
+		size += memory_map.bank[i].size;
+	}
+	return size;
+}
+
+#ifdef USE_MMU
+void *malloc_contiguous(size_t size)
+{
+	void* tmp;
+	void* contiguous;
+	int bank;
+	size_t part_size;
+
+	tmp = malloc(size);
+	if (tmp == NULL)
+		return NULL;
+	if (check_full_in_bank((unsigned long)tmp, size))
+		return tmp;
+
+	/* not in one contiguous block */
+
+	bank = bank_find_by_logical((unsigned long)tmp);
+
+	part_size = memory_map.bank[bank].size - 
+			((unsigned long)tmp - memory_map.bank[bank].logiAddr);
+	free(tmp);
+
+	tmp = malloc(part_size);
+	contiguous = malloc_contiguous(size);
+	free(tmp);
+
+	return contiguous;
+}
+#endif
+
+void *malloc_top(size_t size)
+{
+	void *top;
+	void* tmp;
+	long bubble;
+
+	bubble = bank_mem_avail() - size;
+	do {
+		tmp = malloc_contiguous(bubble);
+		if (tmp)
+		{
+			top = malloc(size);
+			free(tmp);
+			if (top)
+				return top;
+		}
+		bubble -= 1024 * 1024; /* decrease of 1 MB */
+	} while (bubble > 0);
+
+	return NULL;
+}
+
+#ifdef BANK_DUMP
+void bank_dump()
+{
+	int i;
+	unsigned long size = 0;
+
+	printf("Physical memory map:\n");
+	for (i = 0; i < memory_map.bank_number; i++)
+	{
+		printf("%d: 0x%08lx -> 0x%08lx mapped at 0x%08lx -> 0x%08lx\n",
+		i,
+		memory_map.bank[i].physAddr,
+		memory_map.bank[i].physAddr + memory_map.bank[i].size,
+		memory_map.bank[i].logiAddr,
+		memory_map.bank[i].logiAddr + memory_map.bank[i].size);
+		size += memory_map.bank[i].size;
+	}
+}
+#endif

Added: branches/vendor/emile/second/bank.h
===================================================================
--- branches/vendor/emile/second/bank.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/bank.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,43 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <malloc.h>
+
+#if defined(USE_MMU030) || defined(USE_MMU040)
+#define USE_MMU
+#endif
+
+/* physical memory information */
+
+#define MAX_MEM_MAP_SIZE                26
+#define KERNEL_BASEADDR			0x3000
+
+typedef struct memory_bank {
+        unsigned long physAddr;
+        unsigned long logiAddr;
+        unsigned long size;
+} memory_bank_t;
+
+typedef struct memory_map {
+        memory_bank_t bank[MAX_MEM_MAP_SIZE];
+        unsigned long bank_number;
+} memory_map_t;
+
+extern memory_map_t memory_map;
+
+extern void init_memory_map();
+extern unsigned long bank_mem_avail();
+extern void bank_dump();
+#ifdef USE_MMU
+extern int logical2physical(unsigned long logical, unsigned long *physical);
+extern int physical2logical(unsigned long physical, unsigned long *logical);
+extern int check_full_in_bank(unsigned long start, unsigned long size);
+extern void *malloc_contiguous(size_t size);
+#else
+#define malloc_contiguous malloc
+#define check_full_in_bank(a,b) (1)
+#endif
+extern void *malloc_top(size_t size);

Added: branches/vendor/emile/second/bootenv.c
===================================================================
--- branches/vendor/emile/second/bootenv.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/bootenv.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,51 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <macos/lowmem.h>
+#include <macos/gestalt.h>
+
+#include "arch.h"
+#include "vga.h"
+#include "bank.h"
+#include "bootenv.h"
+
+static char* setenv(char* env, char* variable, unsigned long value)
+{
+	sprintf(env, "%s=%lu", variable, value);
+	env += strlen(env) + 1;
+	env[1] = 0;
+
+	return env;
+}
+
+void bootenv_init(char* env)
+{
+	unsigned long videoaddr;
+	env = setenv(env, "ROOT_SCSI_ID", 0);
+	env = setenv(env, "SINGLE_USER", 0);
+	logical2physical(vga_get_videobase(), &videoaddr);
+	env = setenv(env, "VIDEO_ADDR", videoaddr);
+	env = setenv(env, "ROW_BYTES", vga_get_row_bytes());
+	env = setenv(env, "SCREEN_DEPTH", vga_get_depth());
+	env = setenv(env, "DIMENSIONS", (vga_get_height() << 16) | vga_get_width());
+	env = setenv(env, "BOOTTIME", Time - 2082844800);
+	env = setenv(env, "GMTBIAS", gmt_bias);
+	env = setenv(env, "BOOTERVER", 111);	/* "1.11.4a4" */
+	env = setenv(env, "MACOS_VIDEO", vga_get_video());
+	env = setenv(env, "MACOS_SCC", SCCRd);
+	env = setenv(env, "MACHINEID", machine_id);
+	env = setenv(env, "MEMSIZE", ram_size);
+	env = setenv(env, "GRAYBARS", 0);
+	env = setenv(env, "SERIALECHO", 0);
+	env = setenv(env, "SERIALCONSOLE", 0);
+	env = setenv(env, "PROCESSOR",	cpu_type - gestalt68020);
+	env = setenv(env, "ROMBASE", (unsigned long)ROMBase);
+	env = setenv(env, "TIMEDBRA", TimeDBRA);
+	env = setenv(env, "ADBDELAY", TimeVIADB);
+}

Added: branches/vendor/emile/second/bootenv.h
===================================================================
--- branches/vendor/emile/second/bootenv.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/bootenv.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,7 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+void bootenv_init(char* env);

Added: branches/vendor/emile/second/bootinfo.c
===================================================================
--- branches/vendor/emile/second/bootinfo.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/bootinfo.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,617 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ *  a lot of parts from penguin booter
+ *  based on bootstrap.c for Atari Linux booter, Copyright 1993 by Arjan Knor
+ *
+ */
+
+#include <string.h>
+
+#include <macos/lowmem.h>
+#include <macos/gestalt.h>
+
+#include "bank.h"
+#include "memory.h"
+#include "misc.h"
+#include "vga.h"
+#include "bootinfo.h"
+#include "arch.h"
+
+struct bootinfo boot_info;
+
+#if defined(EXTENDED_HW_MAP)
+
+static int
+MacHasHardware(unsigned long gestaltBit)
+{
+	long	r;
+
+	Gestalt(gestaltHardwareAttr, &r);
+
+	return ( (r & (1 << gestaltBit)) != 0);
+}
+#endif /* EXTENDED_HW_MAP */
+
+static void extractBanks(struct bootinfo *bi, memory_map_t *map)
+{
+	int i,j;
+
+	for (i = 0; i < map->bank_number; i++)
+	{
+		bi->memory[i].addr = map->bank[i].physAddr;
+		bi->memory[i].size = map->bank[i].size;
+	}
+	bi->num_memory = i;
+
+	for (i = 0; i < bi->num_memory; i++)
+	{
+		for (j = 0; j < bi->num_memory; j++)
+		{
+			if (bi->memory[i].addr + bi->memory[i].size ==
+							bi->memory[j].addr)
+			{
+				bi->memory[i].size += bi->memory[j].size;
+
+				bi->num_memory--;
+				bi->memory[j].addr = 
+						bi->memory[bi->num_memory].addr;
+				bi->memory[j].size = 
+						bi->memory[bi->num_memory].size;
+			}
+		}
+	}
+
+	/* sort : bigger first */
+
+	for (i = 0; i < bi->num_memory; i++)
+	{
+		for (j = i; j < bi->num_memory; j++)
+		{
+			if (bi->memory[i].size < bi->memory[j].size)
+			{
+				unsigned a, s;
+
+				a = bi->memory[i].addr;
+				s = bi->memory[i].size;
+
+				bi->memory[i].addr = bi->memory[j].addr;
+				bi->memory[i].size = bi->memory[j].size;
+
+				bi->memory[j].addr = a;
+				bi->memory[j].size = s;
+			}
+		}
+	}
+}
+
+void bootinfo_init(char* command_line, 
+		   char* ramdisk_start, unsigned long ramdisk_size)
+{
+	/* I'm a macintosh, I know, I'm sure */
+
+	boot_info.machtype = MACH_MAC;
+
+	/* WARNING: arch_init() must be called before ! */
+
+	boot_info.bi_mac.id = machine_id;
+
+	/* set ram size */
+
+	boot_info.bi_mac.memsize = ram_size >> 20;	/* in mega-bytes */
+
+	/* set processor type */
+
+	switch (cpu_type)
+	{
+		case gestalt68000:
+			break;
+
+		case gestalt68010:
+			break;
+
+		case gestalt68020:
+			if (mmu_type == gestalt68851)
+				boot_info.cputype = CPU_68020;
+			break;
+
+		case gestalt68030:
+			boot_info.cputype = CPU_68030;
+			break;
+
+		case gestalt68040:
+			boot_info.cputype = CPU_68040;
+			break;
+
+		default:
+			error("Unknown processor.");
+			break;
+	}
+	boot_info.bi_mac.cpuid = cpu_type - gestalt68020;
+
+	/* Set the FPU info */
+
+	switch (fpu_type)
+	{
+		case gestalt68881:
+			boot_info.cputype |= FPU_68881;
+			break;
+
+		case gestalt68882:
+			boot_info.cputype |= FPU_68882;
+			break;
+
+		case gestalt68040FPU:
+			boot_info.cputype |= FPU_68040;
+			break;
+
+		case gestaltNoFPU:
+		default:
+			break;
+	}
+
+	/* memory structure */
+
+	extractBanks(&boot_info, &memory_map);
+
+	/* ramdisk info */
+
+	boot_info.ramdisk_size = ramdisk_size;
+#ifdef USE_MMU
+	logical2physical((unsigned long)ramdisk_start, &boot_info.ramdisk_addr);
+#else
+	boot_info.ramdisk_addr = (unsigned long)ramdisk_start;
+#endif
+
+	/* command line */
+
+	strncpy(boot_info.command_line, command_line, CL_SIZE);
+
+	/* macintosh */
+
+	/* video information */
+
+	boot_info.bi_mac.videological = vga_get_video();
+#ifdef USE_MMU
+	logical2physical(vga_get_videobase(), &boot_info.bi_mac.videoaddr);
+#else
+	boot_info.bi_mac.videoaddr = vga_get_videobase();
+#endif
+	boot_info.bi_mac.videorow = vga_get_row_bytes();
+	boot_info.bi_mac.videodepth = vga_get_depth();
+	boot_info.bi_mac.dimensions = (vga_get_height() << 16) 
+							| vga_get_width();
+
+	/* booter version */
+
+	boot_info.bi_mac.bootver = 108;
+
+	/* boot time and time zone */
+
+	boot_info.bi_mac.args = 0;
+	boot_info.bi_mac.boottime = Time - 2082844800;
+
+	boot_info.bi_mac.gmtbias = gmt_bias;
+
+#ifdef USE_MMU
+	logical2physical(SCCRd, &boot_info.bi_mac.scc_read);
+	logical2physical(SCCWr, &boot_info.bi_mac.scc_write);
+#else
+	boot_info.bi_mac.scc_read = SCCRd;
+	boot_info.bi_mac.scc_write = SCCWr;
+#endif
+	boot_info.bi_mac.timedbra = TimeDBRA;
+	boot_info.bi_mac.adbdelay = TimeVIADB;
+	boot_info.bi_mac.serialmf = 0;
+	boot_info.bi_mac.serialhsk = 9600;
+	boot_info.bi_mac.serialgpi = 9600;
+
+	/* ROM base */
+
+	boot_info.bi_mac.rombase = (unsigned long)ROMBase;
+
+#if defined(EXTENDED_HW_MAP)
+	/* hardware information */
+
+	boot_info.bi_mac.HwMap = 0;
+
+	/* VIA1 */
+
+	if (MacHasHardware(gestaltHasVIA1))
+	{
+		boot_info.bi_mac.HwMap |= HW_MAP_VIA1;
+		logical2physical(VIA1Base, &boot_info.bi_mac.VIA1Base);
+	}
+
+	/* VIA2/RBV/OSS */
+
+	if (MacHasHardware(gestaltHasVIA2))
+		boot_info.bi_mac.HwMap |= HW_MAP_VIA2_VIA;
+	else if (MacHasHardware(gestaltHasRBV))
+		boot_info.bi_mac.HwMap |= HW_MAP_VIA2_RBV;
+	else if (MacHasHardware(gestaltHasOSS))
+		boot_info.bi_mac.HwMap |= HW_MAP_VIA2_OSS;
+	
+	if (boot_info.bi_mac.HwMap & 
+		(HW_MAP_VIA2_VIA | HW_MAP_VIA2_RBV | HW_MAP_VIA2_OSS))
+	{
+		logical2physical(VIA2Base, &boot_info.bi_mac.VIA2Base);
+	}
+
+	/* ADB */
+
+	if (MacHasHardware(gestaltHasSWIMIOP))
+	{
+		boot_info.bi_mac.HwMap |= HW_MAP_ADB_IOP;
+	}
+	else
+	{
+		unsigned long bits = UnivROMBits;
+		if (bits != -1)
+		{
+			bits &= 0x07000000;
+			bits >>= 24;
+
+			if (bits != 0)
+			{
+				if ( (bits == 1) || (bits == 2) )
+				{
+					boot_info.bi_mac.HwMap |= HW_MAP_ADB_IISI;
+				}
+				else
+					boot_info.bi_mac.HwMap |= HW_MAP_ADB_CUDA;
+			}
+			else
+			{
+				if (PMgrBase != -1)
+				{
+					boot_info.bi_mac.HwMap |= HW_MAP_ADB_PB1;
+				}
+			}
+		}
+	}
+
+	/* ASC */
+
+	if (ASCBase != -1)
+	{
+		boot_info.bi_mac.HwMap |= HW_MAP_ASC;
+		logical2physical(ASCBase, &boot_info.bi_mac.ASCBase);
+	}
+
+	/* SCSI 5380 */
+
+	if (MacHasHardware(gestaltHasSCSI))
+	{
+		boot_info.bi_mac.HwMap |= HW_MAP_SCSI5380;
+		logical2physical(SCSIBase, &boot_info.bi_mac.SCSIBase);
+	}
+
+	/* SCSI 5380 DMA */
+
+	if (MacHasHardware(gestaltHasSCSIDMA))
+	{
+		boot_info.bi_mac.HwMap |= HW_MAP_SCSI5380DMA;
+		logical2physical(SCSIBase, &boot_info.bi_mac.SCSIBase);
+	}
+
+	/* 5396, internal or external */
+
+	if ( MacHasHardware(gestaltHasSCSI961) ||
+	     MacHasHardware(gestaltHasSCSI962) )
+	{
+		boot_info.bi_mac.HwMap |= HW_MAP_SCSI5396;
+		logical2physical(SCSIBase, &boot_info.bi_mac.SCSIBase);
+	}
+
+	/* ATA/IDE */
+
+	if (HWCfgFlags & 0x0080)
+	{
+		if (PMgrBase != -1)
+			boot_info.bi_mac.HwMap |= HW_MAP_IDE_PB;
+		else
+			boot_info.bi_mac.HwMap |= HW_MAP_IDE_QUADRA;
+	}
+
+	/* nubus */
+
+	if (machine_id == gestaltMacSE030) {
+		boot_info.bi_mac.HwMap |= HW_MAP_NUBUS;
+	} else {
+		if (Gestalt('sltc', &boot_info.bi_mac.NubusMap) == noErr)
+		{
+			if (boot_info.bi_mac.NubusMap != 0)
+			{
+				boot_info.bi_mac.HwMap |= HW_MAP_NUBUS;
+			}
+		}
+	}
+
+	/* SCC */
+	
+	if (MacHasHardware(gestaltHasSCCIOP))
+		boot_info.bi_mac.HwMap |= HW_MAP_SCC_IOP;
+#endif /* EXTENDED_HW_MAP */
+}
+
+static char *
+add_v2_boot_record(char *dst, unsigned short tag,
+		   unsigned short in_data_size, void *in_data)
+{
+	struct bi2_record *rec;
+	int aligned_size;	/* 68000 needs 4-byte aligned address */
+
+	if ((((unsigned long)dst) & 0x3) != 0)
+		error("add_v2_boot_record: not 4-byte aligned address");
+
+	aligned_size = ((in_data_size + 3) / 4) * 4;
+
+	rec = (struct bi2_record *)dst;
+	rec->tag = tag;
+	rec->size = aligned_size + sizeof(struct bi2_record);
+	
+	memcpy(rec->data, in_data, in_data_size);
+	return (dst + sizeof(struct bi2_record) + aligned_size);
+}
+
+void
+set_kernel_bootinfo(char *dst)
+{
+	unsigned long l1, l2, l3;
+
+	/* machine type */
+
+	l1 = boot_info.machtype;
+	dst = add_v2_boot_record(dst, V2_BI_MACHTYPE, sizeof(l1), &l1);
+
+	/* CPU type */
+
+	switch(boot_info.cputype & CPU_MASK)
+	{
+		case CPU_68020:
+			l1 = V2_CPU_68020;
+			l2 = V2_MMU_68851;
+			break;
+
+		case CPU_68030:
+			l1 = V2_CPU_68030;
+			l2 = V2_MMU_68030;
+			break;
+
+		case CPU_68040:
+			l1 = V2_CPU_68040;
+			l2 = V2_MMU_68040;
+			break;
+
+		case CPU_68060:
+			l1 = V2_CPU_68060;
+			l2 = V2_MMU_68060;
+			break;
+
+		default:
+			l1 = 0;
+			l2 = 0;
+			break;
+	}
+
+	switch(boot_info.cputype & FPU_MASK)
+	{
+		case FPU_68881:
+			l3 = V2_FPU_68881;
+			break;
+
+		case FPU_68882:
+			l3 = V2_FPU_68882;
+			break;
+
+		case FPU_68040:
+			l3 = V2_FPU_68040;
+			break;
+
+		case FPU_68060:
+			l3 = V2_FPU_68060;
+			break;
+
+		default:
+			l3 = 0;
+			break;
+	}
+
+	dst = add_v2_boot_record(dst, V2_BI_CPUTYPE, sizeof(l1), &l1);
+	dst = add_v2_boot_record(dst, V2_BI_FPUTYPE, sizeof(l3), &l3);
+	dst = add_v2_boot_record(dst, V2_BI_MMUTYPE, sizeof(l2), &l2);
+
+	/* Memory chunk */
+
+	for(l1 = 0; l1 < boot_info.num_memory; l1++)
+	{
+		dst = add_v2_boot_record(dst, V2_BI_MEMCHUNK, 
+					 sizeof(struct mem_info), 
+					 &boot_info.memory[l1]);
+	}
+
+	/* RAM disk */
+
+	if (boot_info.ramdisk_size)
+	{
+		struct mem_info mi;
+
+		mi.addr = boot_info.ramdisk_addr;
+		mi.size = boot_info.ramdisk_size;
+
+		dst = add_v2_boot_record(dst, V2_BI_RAMDISK, sizeof(mi), &mi);
+	}
+
+	dst = add_v2_boot_record(dst, V2_BI_COMMAND_LINE, 
+				 strlen(boot_info.command_line) + 1, 
+				 boot_info.command_line);
+
+	l1 = boot_info.bi_mac.id;
+	dst = add_v2_boot_record(dst, V2_BI_MAC_MODEL, sizeof(l1), &l1);
+
+	l1 = boot_info.bi_mac.videoaddr;
+	dst = add_v2_boot_record(dst, V2_BI_MAC_VADDR, sizeof(l1), &l1);
+
+	l1 = boot_info.bi_mac.videodepth;
+	dst = add_v2_boot_record(dst, V2_BI_MAC_VDEPTH, sizeof(l1), &l1);
+
+	l1 = boot_info.bi_mac.videorow;
+	dst = add_v2_boot_record(dst, V2_BI_MAC_VROW, sizeof(l1), &l1);
+
+	l1 = boot_info.bi_mac.dimensions;
+	dst = add_v2_boot_record(dst, V2_BI_MAC_VDIM, sizeof(l1), &l1);
+
+	l1 = boot_info.bi_mac.videological;
+	dst = add_v2_boot_record(dst, V2_BI_MAC_VLOGICAL, sizeof(l1), &l1);
+
+	l1 = boot_info.bi_mac.scc_read;
+	dst = add_v2_boot_record(dst, V2_BI_MAC_SCCBASE_READ, sizeof(l1), &l1);
+
+	l1 = boot_info.bi_mac.scc_write;
+	dst = add_v2_boot_record(dst, V2_BI_MAC_SCCBASE_WRITE, sizeof(l1), &l1);
+
+	l1 = boot_info.bi_mac.boottime;
+	dst = add_v2_boot_record(dst, V2_BI_MAC_BTIME, sizeof(l1), &l1);
+
+	l1 = boot_info.bi_mac.gmtbias;
+	dst = add_v2_boot_record(dst, V2_BI_MAC_GMTBIAS, sizeof(l1), &l1);
+
+	l1 = boot_info.bi_mac.memsize;
+	dst = add_v2_boot_record(dst, V2_BI_MAC_MEMSIZE, sizeof(l1), &l1);
+
+	l1 = boot_info.bi_mac.cpuid;
+	dst = add_v2_boot_record(dst, V2_BI_MAC_CPUID, sizeof(l1), &l1);
+
+	l1 = boot_info.bi_mac.rombase;
+	dst = add_v2_boot_record(dst, V2_BI_MAC_ROMBASE, sizeof(l1), &l1);
+
+#if defined(EXTENDED_HW_MAP)
+	/* VIA1 */
+
+	if (boot_info.bi_mac.HwMap & HW_MAP_VIA1)
+	{
+		l1 = boot_info.bi_mac.VIA1Base;
+		dst = add_v2_boot_record(dst, V2_BI_MAC_VIA1BASE, 
+					      sizeof(l1), &l1);
+	}
+
+	/* VIA2 */
+
+	if (boot_info.bi_mac.HwMap & HW_MAP_VIA2_VIA)
+		l2 = V2_VIA2_VIA;
+	else if (boot_info.bi_mac.HwMap & HW_MAP_VIA2_RBV)
+		l2 = V2_VIA2_RBV;
+	else if (boot_info.bi_mac.HwMap & HW_MAP_VIA2_OSS)
+		l2 = V2_VIA2_OSS;
+
+	if (boot_info.bi_mac.HwMap & 
+			(HW_MAP_VIA2_VIA | HW_MAP_VIA2_RBV | HW_MAP_VIA2_OSS) )
+	{
+		l1 = boot_info.bi_mac.VIA2Base;
+
+		dst = add_v2_boot_record(dst, V2_BI_MAC_VIA2BASE, 
+					      sizeof(l1), &l1);
+		dst = add_v2_boot_record(dst, V2_BI_MAC_VIA2TYPE, 
+					      sizeof(l2), &l2);
+	}
+
+	/* ADB */
+
+	if (boot_info.bi_mac.HwMap & HW_MAP_ADB_IOP)
+		l1 = V2_ADB_IOP;
+	else if (boot_info.bi_mac.HwMap & HW_MAP_ADB_IISI)
+		l1 = V2_ADB_IISI;
+	else if (boot_info.bi_mac.HwMap & HW_MAP_ADB_CUDA)
+		l1 = V2_ADB_CUDA;
+	else if (boot_info.bi_mac.HwMap & HW_MAP_ADB_PB1)
+		l1 = V2_ADB_PB1;
+
+	dst = add_v2_boot_record(dst, V2_BI_MAC_ADBTYPE, sizeof(l1), &l1);
+
+	/* ASC */
+
+	if (boot_info.bi_mac.HwMap & HW_MAP_ASC)
+	{
+		l1 = boot_info.bi_mac.ASCBase;
+		dst = add_v2_boot_record(dst, V2_BI_MAC_ASCBASE, 
+					      sizeof(l1), &l1);
+	}
+
+	/* SCSI 5380 */
+
+	if (boot_info.bi_mac.HwMap & HW_MAP_SCSI5380)
+	{
+		l1 = boot_info.bi_mac.SCSIBase;
+
+		dst = add_v2_boot_record(dst, V2_BI_MAC_SCSI5380, 
+					      sizeof(l1), &l1);
+	}
+
+	/* SCSI 5380 DMA */
+
+	if (boot_info.bi_mac.HwMap & HW_MAP_SCSI5380DMA)
+	{
+		l1 = boot_info.bi_mac.SCSIBase;
+
+		dst = add_v2_boot_record(dst, V2_BI_MAC_SCSIDMA, 
+					      sizeof(l1), &l1);
+	}
+
+	/* SCSI 5396, internal or external */
+
+	if (boot_info.bi_mac.HwMap & HW_MAP_SCSI5396)
+	{
+		l1 = boot_info.bi_mac.SCSIBase;
+
+		dst = add_v2_boot_record(dst, V2_BI_MAC_SCSI5396, 
+					      sizeof(l1), &l1);
+	}
+
+	/* ATA/IDE */
+
+	if (boot_info.bi_mac.HwMap & HW_MAP_IDE_PB)
+	{
+		l1 = V2_IDE_PB;
+		dst = add_v2_boot_record(dst, V2_BI_MAC_IDETYPE, 
+					      sizeof(l1), &l1);
+		l2 = V2_IDE_BASE;
+		dst = add_v2_boot_record(dst, V2_BI_MAC_IDEBASE, 
+					      sizeof(l2), &l2);
+	}
+	else if (boot_info.bi_mac.HwMap & HW_MAP_IDE_QUADRA)
+	{
+		l1 = V2_IDE_QUADRA;
+		dst = add_v2_boot_record(dst, V2_BI_MAC_IDETYPE, 
+					      sizeof(l1), &l1);
+		l2 = V2_IDE_BASE;
+		dst = add_v2_boot_record(dst, V2_BI_MAC_IDEBASE, 
+					      sizeof(l2), &l2);
+	}
+
+	/* NuBus */
+
+	if (boot_info.bi_mac.HwMap & HW_MAP_NUBUS)
+	{
+		l2 = V2_NUBUS_NORMAL;
+		dst = add_v2_boot_record(dst, V2_BI_MAC_NUBUS, sizeof(l2), &l2);
+		l1 = boot_info.bi_mac.NubusMap;
+		dst = add_v2_boot_record(dst, V2_BI_MAC_SLOTMASK, 
+					      sizeof(l1), &l1);
+	}
+
+	/* SCC */
+
+	if (boot_info.bi_mac.HwMap & HW_MAP_SCC_IOP)
+		l1 = V2_SCC_NORMAL;
+	else
+		l1 = V2_SCC_IOP;
+	dst = add_v2_boot_record(dst, V2_BI_MAC_SCCTYPE, sizeof(l1), &l1);
+#endif	/* EXTENDED_HW_MAP */
+
+	/* END */
+
+	l1 = 0;
+	dst = add_v2_boot_record(dst, V2_BI_LAST, 0, &l1);
+}

Added: branches/vendor/emile/second/bootinfo.h
===================================================================
--- branches/vendor/emile/second/bootinfo.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/bootinfo.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,343 @@
+/*
+** asm/setup.h -- Definition of the Linux/m68k boot information structure
+**
+** Copyright 1992 by Greg Harp
+**
+** This file is subject to the terms and conditions of the GNU General Public
+** License.  See the file COPYING in the main directory of this archive
+** for more details.
+**
+** Created 09/29/92 by Greg Harp
+**
+** 5/2/94 Roman Hodek:
+**   Added bi_atari part of the machine dependent union bi_un; for now it
+**   contains just a model field to distinguish between TT and Falcon.
+** 26/7/96 Roman Zippel:
+**   Renamed to setup.h; added some useful macros to allow gcc some
+**   optimizations if possible.
+** 09/02/04 Laurent Vivier
+**   Remove some parts and add it in EMILE
+*/
+
+#ifndef __ASSEMBLY__
+
+struct mem_info {
+	unsigned long addr;		/* physical address of memory chunk */
+	unsigned long size;		/* length of memory chunk (in bytes) */
+};
+
+struct bi_Macintosh
+{
+	unsigned long videoaddr;
+	unsigned long videorow;
+	unsigned long videodepth;
+	unsigned long dimensions;
+	unsigned long args;
+	unsigned long boottime;
+	unsigned long gmtbias;
+	unsigned long bootver;
+	unsigned long videological;
+	unsigned long scc_read;
+	unsigned long scc_write;
+	unsigned long id;
+	unsigned long memsize;
+	unsigned long serialmf;
+	unsigned long serialhsk;
+	unsigned long serialgpi;
+	unsigned long printf;
+	unsigned long printhsk;
+	unsigned long printgpi;
+	unsigned long cpuid;
+	unsigned long rombase;
+	unsigned long adbdelay;
+	unsigned long timedbra;
+
+#if defined(EXTENDED_HW_MAP)
+#define HW_MAP_VIA1		0x00000001
+#define HW_MAP_VIA2_VIA		0x00000002
+#define HW_MAP_VIA2_RBV		0x00000004
+#define HW_MAP_VIA2_OSS		0x00000008
+#define HW_MAP_ADB_IOP		0x00000010
+#define HW_MAP_ADB_IISI		0x00000020
+#define HW_MAP_ADB_CUDA		0x00000040
+#define HW_MAP_ADB_PB1		0x00000080
+#define HW_MAP_ASC		0x00000100
+#define HW_MAP_SCSI5380		0x00000200
+#define HW_MAP_SCSI5380DMA	0x00000400
+#define HW_MAP_SCSI5396		0x00000800
+#define HW_MAP_IDE_PB		0x00001000
+#define HW_MAP_IDE_QUADRA	0x00002000
+#define HW_MAP_NUBUS		0x00004000
+#define HW_MAP_SCC_IOP		0x00008000
+
+	unsigned long HwMap;
+	unsigned long VIA1Base;
+	unsigned long VIA2Base;
+	unsigned long ASCBase;
+	unsigned long SCSIBase;
+	unsigned long NubusMap;
+#endif
+};
+	
+#else
+
+#define BI_videoaddr	BI_un
+#define BI_videorow	BI_videoaddr+4
+#define BI_videodepth	BI_videorow+4
+#define BI_dimensions	BI_videodepth+4
+#define BI_args		BI_dimensions+4
+
+#endif
+
+#define NUM_MEMINFO  4
+
+#define MACH_AMIGA   1
+#define MACH_ATARI   2
+#define MACH_MAC     3
+
+/*
+ * CPU and FPU types
+ */
+
+#define CPUB_68020 0
+#define CPUB_68030 1
+#define CPUB_68040 2
+#define CPUB_68060 3
+#define FPUB_68881 5
+#define FPUB_68882 6
+#define FPUB_68040 7				/* Internal FPU */
+#define FPUB_68060 8				/* Internal FPU */
+
+#define CPU_68020    (1<<CPUB_68020)
+#define CPU_68030    (1<<CPUB_68030)
+#define CPU_68040    (1<<CPUB_68040)
+#define CPU_68060    (1<<CPUB_68060)
+#define CPU_MASK     (31)
+#define FPU_68881    (1<<FPUB_68881)
+#define FPU_68882    (1<<FPUB_68882)
+#define FPU_68040    (1<<FPUB_68040)		/* Internal FPU */
+#define FPU_68060    (1<<FPUB_68060)		/* Internal FPU */
+#define FPU_MASK     (0xfe0)
+
+#define CL_SIZE      (256)
+
+#ifndef __ASSEMBLY__
+
+struct bootinfo {
+	unsigned long machtype;			/* machine type */
+	unsigned long cputype;			/* system CPU & FPU */
+	struct mem_info memory[NUM_MEMINFO];	/* memory description */
+	unsigned long num_memory;				/* # of memory blocks found */
+	unsigned long ramdisk_size;		/* ramdisk size in 1024 byte blocks */
+	unsigned long ramdisk_addr;		/* address of the ram disk in mem */
+	char command_line[CL_SIZE];		/* kernel command line parameters */
+	union {
+		struct bi_Macintosh bi_mac;	/* Mac specific information */
+	} bi_un;
+};
+#define bi_mac	 bi_un.bi_mac
+
+extern struct bootinfo boot_info;
+
+#else	/* __ASSEMBLY__ */
+
+BI_machtype	= 0
+BI_cputype	= BI_machtype+4
+BI_memory	= BI_cputype+4
+BI_num_memory	= BI_memory+(MI_sizeof*NUM_MEMINFO)
+BI_ramdisk_size	= BI_num_memory+4
+BI_ramdisk_addr	= BI_ramdisk_size+4
+BI_command_line	= BI_ramdisk_addr+4
+BI_un		= BI_command_line+CL_SIZE
+
+#endif /* __ASSEMBLY__ */
+
+
+/*
+ * Stuff for bootinfo interface versioning
+ *
+ * At the start of kernel code, a 'struct bootversion' is located. bootstrap
+ * checks for a matching version of the interface before booting a kernel, to
+ * avoid user confusion if kernel and bootstrap don't work together :-)
+ *
+ * If incompatible changes are made to the bootinfo interface, the major
+ * number below should be stepped (and the minor reset to 0) for the
+ * appropriate machine. If a change is backward-compatible, the minor should
+ * be stepped. "Backwards-compatible" means that booting will work, but
+ * certain features may not.
+ */
+
+#define BOOTINFOV_MAGIC			0x4249561A	/* 'BIV^Z' */
+#define MK_BI_VERSION(major,minor)	(((major)<<16)+(minor))
+#define BI_VERSION_MAJOR(v)		(((v) >> 16) & 0xffff)
+#define BI_VERSION_MINOR(v)		((v) & 0xffff)
+
+#ifndef __ASSEMBLY__
+
+struct bootversion {
+	unsigned short branch;
+	unsigned long magic;
+	struct {
+		unsigned long machtype;
+		unsigned long version;
+	} machversions[1];
+};
+
+#endif /* __ASSEMBLY__ */
+
+#define AMIGA_BOOTI_VERSION    MK_BI_VERSION( 1, 0 )
+#define ATARI_BOOTI_VERSION    MK_BI_VERSION( 1, 0 )
+#define MAC_BOOTI_VERSION      MK_BI_VERSION( 2, 0 )
+
+/************************************************************************
+ * Version 2 bootinfo structure and new defs
+ */
+
+    /*
+     *  CPU, FPU and MMU types
+     *
+     *  Note: we may rely on the following equalities:
+     *
+     *      CPU_68020 == MMU_68851
+     *      CPU_68030 == MMU_68030
+     *      CPU_68040 == FPU_68040 == MMU_68040 (not strictly, think of 68LC040!)
+     *      CPU_68060 == FPU_68060 == MMU_68060
+     */
+
+#define V2_CPUB_68020     0
+#define V2_CPUB_68030     1
+#define V2_CPUB_68040     2
+#define V2_CPUB_68060     3
+
+#define V2_CPU_68020      (1<<V2_CPUB_68020)
+#define V2_CPU_68030      (1<<V2_CPUB_68030)
+#define V2_CPU_68040      (1<<V2_CPUB_68040)
+#define V2_CPU_68060      (1<<V2_CPUB_68060)
+
+#define V2_FPUB_68881     0
+#define V2_FPUB_68882     1
+#define V2_FPUB_68040     2                       /* Internal FPU */
+#define V2_FPUB_68060     3                       /* Internal FPU */
+#define V2_FPUB_SUNFPA    4                       /* Sun-3 FPA */
+
+#define V2_FPU_68881      (1<<V2_FPUB_68881)
+#define V2_FPU_68882      (1<<V2_FPUB_68882)
+#define V2_FPU_68040      (1<<V2_FPUB_68040)
+#define V2_FPU_68060      (1<<V2_FPUB_68060)
+#define V2_FPU_SUNFPA     (1<<V2_FPUB_SUNFPA)
+
+#define V2_MMUB_68851     0
+#define V2_MMUB_68030     1                       /* Internal MMU */
+#define V2_MMUB_68040     2                       /* Internal MMU */
+#define V2_MMUB_68060     3                       /* Internal MMU */
+#define V2_MMUB_APOLLO    4                       /* Custom Apollo */
+#define V2_MMUB_SUN3      5                       /* Custom Sun-3 */
+
+#define V2_MMU_68851      (1<<V2_MMUB_68851)
+#define V2_MMU_68030      (1<<V2_MMUB_68030)
+#define V2_MMU_68040      (1<<V2_MMUB_68040)
+#define V2_MMU_68060      (1<<V2_MMUB_68060)
+#define V2_MMU_SUN3       (1<<V2_MMUB_SUN3)
+#define V2_MMU_APOLLO     (1<<V2_MMUB_APOLLO)
+
+struct bi2_record {
+    unsigned short	tag;		/* tag ID */
+    unsigned short	size;		/* size of record (in bytes) */
+    unsigned char	data[0];		/* data */
+};
+
+struct bi2_record_list {
+	struct bi2_record		*bi2_rec;
+	struct bi2_record_list	*next;
+};
+
+    /*
+     *  Tag Definitions
+     *
+     *  Machine independent tags start counting from 0x0000
+     *  Machine dependent tags start counting from 0x8000
+     */
+
+#define V2_BI_LAST			0x0000	/* last record (sentinel) */
+#define V2_BI_MACHTYPE		0x0001	/* machine type (u_long) */
+#define V2_BI_CPUTYPE		0x0002	/* cpu type (u_long) */
+#define V2_BI_FPUTYPE		0x0003	/* fpu type (u_long) */
+#define V2_BI_MMUTYPE		0x0004	/* mmu type (u_long) */
+#define V2_BI_MEMCHUNK		0x0005	/* memory chunk address and size */
+					/* (struct mem_info) */
+#define V2_BI_RAMDISK		0x0006	/* ramdisk address and size */
+					/* (struct mem_info) */
+#define V2_BI_COMMAND_LINE	0x0007	/* kernel command line parameters */
+					/* (string) */
+
+    /*
+     *  Macintosh-specific tags
+     */
+
+#define V2_BI_MAC_MODEL		0x8000	/* Mac Gestalt ID (model type) */
+#define V2_BI_MAC_VADDR		0x8001	/* Mac video base address */
+#define V2_BI_MAC_VDEPTH	0x8002	/* Mac video depth */
+#define V2_BI_MAC_VROW		0x8003	/* Mac video rowbytes */
+#define V2_BI_MAC_VDIM		0x8004	/* Mac video dimensions */
+#define V2_BI_MAC_VLOGICAL	0x8005	/* Mac video logical base */
+#define V2_BI_MAC_SCCBASE_READ	0x8006	/* Mac SCC base address */
+#define V2_BI_MAC_BTIME		0x8007	/* Mac boot time */
+#define V2_BI_MAC_GMTBIAS	0x8008	/* Mac GMT timezone offset */
+#define V2_BI_MAC_MEMSIZE	0x8009	/* Mac RAM size (sanity check) */
+#define V2_BI_MAC_CPUID		0x800a	/* Mac CPU type (sanity check) */
+#define V2_BI_MAC_ROMBASE	0x800b	/* Mac system ROM base address */ 
+#define V2_BI_MAC_SCCBASE_WRITE	0x800c	/* Mac SCC base address */
+
+    /*
+     *  Macintosh hardware profile data - unused, see macintosh.h for 
+     *  resonable type values 
+     */
+
+#define V2_BI_MAC_VIA1BASE	0x8010	/* Mac VIA1 base address (always present) */
+#define V2_BI_MAC_VIA2BASE	0x8011	/* Mac VIA2 base address (type varies) */
+#define V2_BI_MAC_VIA2TYPE	0x8012	/* Mac VIA2 type (VIA, RBV, OSS) */
+#define V2_BI_MAC_ADBTYPE	0x8013	/* Mac ADB interface type */
+#define V2_BI_MAC_ASCBASE	0x8014	/* Mac Apple Sound Chip base address */
+#define V2_BI_MAC_SCSI5380	0x8015	/* Mac NCR 5380 SCSI (base address, multi) */
+#define V2_BI_MAC_SCSIDMA	0x8016	/* Mac SCSI DMA (base address) */
+#define V2_BI_MAC_SCSI5396	0x8017	/* Mac NCR 53C96 SCSI (base address, multi) */
+#define V2_BI_MAC_IDETYPE	0x8018	/* Mac IDE interface type */
+#define V2_BI_MAC_IDEBASE	0x8019	/* Mac IDE interface base address */
+#define V2_BI_MAC_NUBUS		0x801a	/* Mac Nubus type (none, regular, pseudo) */
+#define V2_BI_MAC_SLOTMASK	0x801b	/* Mac Nubus slots present */
+#define V2_BI_MAC_SCCTYPE	0x801c	/* Mac SCC serial type (normal, IOP) */
+#define V2_BI_MAC_ETHTYPE	0x801d	/* Mac builtin ethernet type (Sonic, MACE */
+#define V2_BI_MAC_ETHBASE	0x801e	/* Mac builtin ethernet base address */
+#define V2_BI_MAC_PMU		0x801f	/* Mac power managment / poweroff hardware */
+#define V2_BI_MAC_IOP_SWIM	0x8020	/* Mac SWIM floppy IOP */
+#define V2_BI_MAC_IOP_ADB	0x8021	/* Mac ADB IOP */
+
+	/*
+	 * Type definitions
+	 */
+#define V2_VIA2_VIA			1
+#define V2_VIA2_RBV			2
+#define V2_VIA2_OSS			3
+
+#define V2_ADB_II			1
+#define V2_ADB_IISI			2
+#define V2_ADB_CUDA			3
+#define V2_ADB_PB1			4
+#define V2_ADB_PB2			5
+#define V2_ADB_IOP			6
+
+#define V2_IDE_BASE			0x50F1A000
+#define V2_IDE_QUADRA		1
+#define V2_IDE_PB			2
+
+#define V2_NUBUS_NORMAL		1
+#define V2_NUBUS_PSEUDO		2
+
+#define V2_SCC_NORMAL		1
+#define V2_SCC_IOP			4
+
+/* End version 2 bootinfo
+ ***********************************************************************/
+
+extern void bootinfo_init(char* command_line, char* ramdisk_start, unsigned long ramdisk_size);
+extern void set_kernel_bootinfo(char *dst);

Added: branches/vendor/emile/second/bootx.c
===================================================================
--- branches/vendor/emile/second/bootx.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/bootx.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,59 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ *
+ */
+
+#include "vga.h"
+#include "bank.h"
+#include "bootx.h"
+
+struct boot_infos bootx_infos;
+
+extern unsigned long machine_id;
+extern unsigned long arch_type;
+
+void bootx_init(char* command_line, 
+		   char* ramdisk_start, unsigned long ramdisk_size)
+{
+	int i;
+
+	//bootx_infos.version = BOOT_INFO_VERSION;
+	bootx_infos.version = 4;
+	bootx_infos.compatible_version = BOOT_INFO_COMPATIBLE_VERSION;
+
+	bootx_infos.logicalDisplayBase = (u_int8_t*)vga_get_video();
+	bootx_infos.machineID = machine_id;
+	bootx_infos.architecture = arch_type;
+
+	bootx_infos.deviceTreeOffset = 0;
+	bootx_infos.deviceTreeSize = 0;
+
+	bootx_infos.dispDeviceRect[0] = 0;			/* left */
+	bootx_infos.dispDeviceRect[1] = 0;			/* top */
+	bootx_infos.dispDeviceRect[2] = vga_get_width();	/* right */
+	bootx_infos.dispDeviceRect[3] = vga_get_height();	/* bottom */
+	bootx_infos.dispDeviceDepth = vga_get_depth();
+	bootx_infos.dispDeviceBase = (u_int8_t*)vga_get_videobase();
+	bootx_infos.dispDeviceRowBytes = vga_get_row_bytes();
+	bootx_infos.dispDeviceColorsOffset = 0;
+
+	bootx_infos.dispDeviceRegEntryOffset = 0;
+
+	bootx_infos.ramDisk = (u_int32_t)ramdisk_start;
+	bootx_infos.ramDiskSize = ramdisk_size;
+
+	bootx_infos.kernelParamsOffset = (long)command_line - (long)&bootx_infos;
+
+	for (i = 0; i < memory_map.bank_number; i++)
+        {
+               bootx_infos.physMemoryMap[i].physAddr = memory_map.bank[i].physAddr;
+               bootx_infos.physMemoryMap[i].size = memory_map.bank[i].size;
+        }
+
+	bootx_infos.physMemoryMapSize = i;
+
+	bootx_infos.frameBufferSize = 0;
+	//bootx_infos.totalParamsSize
+}

Added: branches/vendor/emile/second/bootx.h
===================================================================
--- branches/vendor/emile/second/bootx.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/bootx.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,128 @@
+/*
+ * This file describes the structure passed from the BootX application
+ * (for MacOS) when it is used to boot Linux.
+ *
+ * Written by Benjamin Herrenschmidt.
+ * Modified by Laurent Vivier
+ */
+
+
+#ifndef __BOOTX_H__
+#define __BOOTX_H__
+
+#include "misc.h"
+
+/* On kernel entry:
+ *
+ * r3 = 0x426f6f58    ('BooX')
+ * r4 = pointer to boot_infos
+ * r5 = NULL
+ *
+ * Data and instruction translation disabled, interrupts
+ * disabled, kernel loaded at physical 0x00000000 on PCI
+ * machines (will be different on NuBus).
+ */
+
+#define BOOT_INFO_VERSION               5
+#define BOOT_INFO_COMPATIBLE_VERSION    1
+
+/* Bit in the architecture flag mask. More to be defined in
+   future versions. Note that either BOOT_ARCH_PCI or
+   BOOT_ARCH_NUBUS is set. The other BOOT_ARCH_NUBUS_xxx are
+   set additionally when BOOT_ARCH_NUBUS is set.
+ */
+#define BOOT_ARCH_PCI                   0x00000001UL
+#define BOOT_ARCH_NUBUS                 0x00000002UL
+#define BOOT_ARCH_NUBUS_CLASS		0x00000070UL
+#define BOOT_ARCH_NUBUS_PDM             0x00000010UL
+#define BOOT_ARCH_NUBUS_PERFORMA        0x00000020UL
+#define BOOT_ARCH_NUBUS_POWERBOOK       0x00000040UL
+
+/*  Maximum number of ranges in phys memory map */
+#define MAX_MEM_MAP_SIZE				26
+
+/* This is the format of an element in the physical memory map. Note that
+   the map is optional and current BootX will only build it for pre-PCI
+   machines */
+typedef struct boot_info_map_entry
+{
+    u_int32_t       physAddr;                /* Physical starting address */
+    u_int32_t       size;                    /* Size in bytes */
+} boot_info_map_entry_t;
+
+
+/* Here are the boot informations that are passed to the bootstrap
+ * Note that the kernel arguments and the device tree are appended
+ * at the end of this structure. */
+typedef struct boot_infos
+{
+    /* Version of this structure */
+    u_int32_t       version;
+    /* backward compatible down to version: */
+    u_int32_t       compatible_version;
+
+    /* NEW (vers. 2) this holds the current _logical_ base addr of
+       the frame buffer (for use by early boot message) */
+    u_int8_t*       logicalDisplayBase;
+
+    /* NEW (vers. 4) Apple's machine identification */
+    u_int32_t       machineID;
+
+    /* NEW (vers. 4) Detected hw architecture */
+    u_int32_t       architecture;
+
+    /* The device tree (internal addresses relative to the beginning of the tree,
+     * device tree offset relative to the beginning of this structure).
+     * On pre-PCI macintosh (BOOT_ARCH_PCI bit set to 0 in architecture), this
+     * field is 0.
+     */
+    u_int32_t       deviceTreeOffset;        /* Device tree offset */
+    u_int32_t       deviceTreeSize;          /* Size of the device tree */
+
+    /* Some infos about the current MacOS display */
+    u_int32_t       dispDeviceRect[4];       /* left,top,right,bottom */
+    u_int32_t       dispDeviceDepth;         /* (8, 16 or 32) */
+    u_int8_t*       dispDeviceBase;          /* base address (physical) */
+    u_int32_t       dispDeviceRowBytes;      /* rowbytes (in bytes) */
+    u_int32_t       dispDeviceColorsOffset;  /* Colormap (8 bits only) or 0 (*) */
+    /* Optional offset in the registry to the current
+     * MacOS display. (Can be 0 when not detected) */
+     u_int32_t      dispDeviceRegEntryOffset;
+
+    /* Optional pointer to boot ramdisk (offset from this structure) */
+    u_int32_t       ramDisk;
+    u_int32_t       ramDiskSize;             /* size of ramdisk image */
+
+    /* Kernel command line arguments (offset from this structure) */
+    u_int32_t       kernelParamsOffset;
+
+    /* ALL BELOW NEW (vers. 4) */
+
+    /* This defines the physical memory. Valid with BOOT_ARCH_NUBUS flag
+       (non-PCI) only. On PCI, memory is contiguous and it's size is in the
+       device-tree. */
+    boot_info_map_entry_t
+    	        physMemoryMap[MAX_MEM_MAP_SIZE]; /* Where the phys memory is */
+    u_int32_t       physMemoryMapSize;               /* How many entries in map */
+
+
+    /* The framebuffer size (optional, currently 0) */
+    u_int32_t       frameBufferSize;         /* Represents a max size, can be 0. */
+
+    /* NEW (vers. 5) */
+
+    /* Total params size (args + colormap + device tree + ramdisk) */
+    u_int32_t       totalParamsSize;
+
+} boot_infos_t __attribute__ ((packed));
+
+/* (*) The format of the colormap is 256 * 3 * 2 bytes. Each color index is represented
+ * by 3 short words containing a 16 bits (unsigned) color component.
+ * Later versions may contain the gamma table for direct-color devices here.
+ */
+#define BOOTX_COLORTABLE_SIZE    (256UL*3UL*2UL)
+
+extern struct boot_infos bootx_infos;
+
+extern void bootx_init(char* command_line, char* ramdisk_start, unsigned long ramdisk_size);
+#endif

Added: branches/vendor/emile/second/cli.c
===================================================================
--- branches/vendor/emile/second/cli.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/cli.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,110 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#define __NO_INLINE__	/* to avoid inline putchar() */
+#include <stdio.h>
+#include <string.h>
+
+#include "console.h"
+
+#define LEFT_ARROW()	if (pos > 0)		\
+			{			\
+				putchar('\b');	\
+				pos--;		\
+			}
+
+#define RIGHT_ARROW()	if (pos < l)		\
+			{			\
+				putchar(s[pos]);\
+				pos++;		\
+			}
+
+#define DELETE()	if (pos < l)				\
+			{					\
+				strcpy(s + pos, s + pos + 1);	\
+				l--;				\
+				console_cursor_save();		\
+				printf("%s", s + pos);		\
+				putchar(' ');			\
+				console_cursor_restore();	\
+			}
+
+void cli_edit(char *s, int length)
+{
+	int l = strlen(s);
+	int pos = l;
+	int c;
+	int i;
+
+	console_cursor_off();
+	printf("%s", s);
+	console_cursor_on();
+
+	while ((c = console_getchar()) != '\r')
+	{
+retry:
+		if (c == 0)
+			continue;
+		if ( (c > 0x1f) && (c < 0x7f) && (l < length - 1) )
+		{
+			for (i = l; i > pos; i--)
+				s[i] = s[i - 1];
+			s[pos] = c;
+			putchar(c);
+			pos++;
+			l++;
+			console_cursor_save();
+			printf("%s", s + pos);
+			console_cursor_restore();
+		}
+		else switch(c)
+		{
+			case '':
+				while ((c = console_getchar()) == 0);
+				if ( c != '[' )
+					goto retry;
+				while ((c = console_getchar()) == 0);
+				switch(c)
+				{
+					case 'D':
+						LEFT_ARROW();
+						break;
+					case 'C':
+						RIGHT_ARROW();
+						break;
+					case '3':
+						if (console_getchar() == '~')
+							DELETE();
+						break;
+					default:
+						goto retry;
+				}
+				break;
+			case '':
+				LEFT_ARROW();
+				break;
+			case '':
+				RIGHT_ARROW();
+				break;
+			case '\b':	/* backspace */
+				if (pos > 0)
+				{
+					putchar('\b');
+					pos--;
+					l--;
+					strcpy(s + pos, s + pos + 1);
+					console_cursor_save();
+					printf("%s", s + pos);
+					putchar(' ');
+					console_cursor_restore();
+				}
+				break;
+			case 0x7f:	/* Delete */
+				DELETE();
+				break;
+		}
+	}
+}

Added: branches/vendor/emile/second/cli.h
===================================================================
--- branches/vendor/emile/second/cli.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/cli.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,7 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+extern void cli_edit(char *s, int length);

Added: branches/vendor/emile/second/config.c
===================================================================
--- branches/vendor/emile/second/config.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/config.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,218 @@
+
+#define __NO_INLINE__
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "config.h"
+#if defined(USE_CLI) && defined(__LINUX__)
+#include "console.h"
+#include "cli.h"
+#endif
+#include "arch.h"
+
+#define COMMAND_LINE_LENGTH 256
+char parameters[COMMAND_LINE_LENGTH];
+
+static char *read_line(char *s)
+{
+	int read = 0;
+	while (*s && (*s != '\n'))
+	{
+		read++;
+		s++;
+	}
+	if (*s == 0)
+		return s;
+	return s + 1;
+}
+
+static char *read_word(char *line, char **next)
+{
+	char *word;
+
+	while ( (*line == ' ') || (*line == '\t') || (*line == '\n') )
+		line++;
+
+	word = line;
+
+	while ( *line && (*line != ' ') && (*line != '\t') && (*line != '\n') )
+		line++;
+
+	*next = line;
+
+	return word;
+}
+
+static char *decode_serial(char* s, int *baudrate, int *parity, int *datasize, int *stopbits)
+{
+	*baudrate = strtol(s, &s, 0);
+	switch(*s)
+	{
+		case 'n':
+		case 'N':
+			*parity = 0;
+			break;
+		case 'o':
+		case 'O':
+			*parity = 1;
+			break;
+		case 'e':
+		case 'E':
+			*parity = 2;
+			break;
+		default:
+			*parity = -1;
+			break;
+	}
+	s++;
+	*datasize = strtol(s, &s, 0);
+	if (*s != '+')
+		return s;
+	s++;
+	*stopbits = strtol(s, &s, 0);
+
+	return s;
+}
+
+int read_config_vga(char *conf)
+{
+	char *next_word, *next_line, *name, *property;
+	int name_len;
+
+	next_line = conf;
+
+	while (*next_line)
+	{
+		next_word = next_line;
+		next_line = read_line(next_line);
+		name = read_word(next_word, &next_word);
+		name_len = next_word - name;
+		property = read_word(next_word, &next_word);
+
+		if (strncmp(name, "vga", name_len) == 0)
+		{
+			return 0;
+		}
+	}
+	return -1;
+}
+
+int read_config_modem(char *conf, int *bitrate, int *parity, int *datasize, int *stopbits)
+{
+	char *next_word, *next_line, *name, *property;
+	int name_len;
+
+	next_line = conf;
+
+	while (*next_line)
+	{
+		next_word = next_line;
+		next_line = read_line(next_line);
+		name = read_word(next_word, &next_word);
+		name_len = next_word - name;
+		property = read_word(next_word, &next_word);
+
+		if (strncmp(name, "modem", name_len) == 0)
+		{
+			decode_serial(property, bitrate, parity, datasize, stopbits);
+			return 0;
+		}
+	}
+	return -1;
+}
+
+int read_config_printer(char *conf, int *bitrate, int *parity, int *datasize, int *stopbits)
+{
+	char *next_word, *next_line, *name, *property;
+	int name_len;
+	next_line = conf;
+
+	while (*next_line)
+	{
+		next_word = next_line;
+		next_line = read_line(next_line);
+		name = read_word(next_word, &next_word);
+		name_len = next_word - name;
+		property = read_word(next_word, &next_word);
+
+		if (strncmp(name, "printer", name_len) == 0)
+		{
+			decode_serial(property, bitrate, parity, datasize, stopbits);
+			return 0;
+		}
+	}
+	return -1;
+}
+
+int read_config(emile_l2_header_t* info, 
+		char **kernel_path, char **command_line, char **ramdisk_path)
+{
+	char *next_word, *next_line, *name, *property;
+
+	if (!EMILE_COMPAT(EMILE_05_SIGNATURE, info->signature))
+	{
+		printf("Bad header signature !\n");
+		return -1;
+	}
+
+	next_line = info->configuration;
+
+	*ramdisk_path = NULL;
+	*kernel_path = NULL;
+	*command_line = NULL;
+	while (*next_line)
+	{
+		next_word = next_line;
+		next_line = read_line(next_line);
+		*(next_line - 1) = 0;
+
+		name = read_word(next_word, &next_word);
+		*next_word++ = 0;
+
+		property = read_word(next_word, &next_word);
+
+		if (strcmp(name, "kernel") == 0)
+		{
+			*kernel_path = property;
+		} else if (strcmp(name, "parameters") == 0) {
+#if defined(USE_CLI) && defined(__LINUX__)
+			*command_line = parameters;
+			strncpy(parameters, property, COMMAND_LINE_LENGTH);
+#else
+			if (next_word != next_line)
+				*command_line = property;
+#endif
+		}
+		else if (strcmp(name, "initrd") == 0)
+		{
+			*ramdisk_path = property;
+		}
+		else if (strcmp(name, "gestaltID") == 0)
+		{
+			machine_id = strtol(property, NULL, 0);
+			printf("User forces gestalt ID to %ld\n", machine_id);
+		}
+	}
+
+#if defined(USE_CLI) && defined(__LINUX__)
+	printf("command ");
+	console_cursor_save();
+	printf("%s", *command_line);
+	console_cursor_on();
+	if (console_keypressed(5 * 60))
+	{
+		console_cursor_restore();
+		cli_edit(*command_line, COMMAND_LINE_LENGTH);
+	}
+	console_cursor_off();
+	putchar('\n');
+#else
+#ifdef __LINUX__
+	if (*command_line != NULL)
+		printf("command %s\n", *command_line);
+#endif
+#endif
+	return 0;
+}

Added: branches/vendor/emile/second/config.h
===================================================================
--- branches/vendor/emile/second/config.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/config.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,6 @@
+#include "head.h"
+
+extern int read_config(emile_l2_header_t* info, char **kernel_path, char **command_line, char **ramdisk_path);
+extern int read_config_vga(char *conf);
+extern int read_config_modem(char *conf, int *bitrate, int *parity, int *datasize, int *stopbits);
+extern int read_config_printer(char *conf, int *bitrate, int *parity, int *datasize, int *stopbits);

Added: branches/vendor/emile/second/console.c
===================================================================
--- branches/vendor/emile/second/console.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/console.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,106 @@
+/*
+ * 
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+
+#include <macos/lowmem.h>
+
+#include "console.h"
+#include "vga.h"
+#include "serial.h"
+#include "keyboard.h"
+#include "config.h"
+
+static int vga_enabled = 0;
+
+void
+console_init(emile_l2_header_t* info)
+{
+	if (read_config_vga(info->configuration) == 0)
+	{
+		vga_init();
+		vga_enabled = 1;
+	}
+	serial_init(info);
+}
+
+int console_putchar(int c)
+{
+	if (vga_enabled)
+		vga_put(c);
+	serial_put(c);
+
+	return c;
+}
+
+void console_putstring(const char *s)
+{
+	while(*s)
+                console_putchar(*(s++));
+}
+
+#ifdef USE_CLI
+int console_keypressed(int timeout)
+{
+	long time = Ticks + timeout;
+
+	while (Ticks < time)
+	{
+		if (vga_enabled && keyboard_keypressed())
+			return 1;
+
+		if (serial_keypressed())
+			return 1;
+	}
+	return 0;
+}
+
+int console_getchar()
+{
+	int c;
+	if (vga_enabled)
+	{
+		c = keyboard_getchar();
+		if (c)
+			return c;
+	}
+	c = serial_getchar();
+	return c;
+}
+void console_cursor_on(void)
+{
+	if (vga_enabled)
+	{
+		vga_cursor_on();
+	}
+}
+
+void console_cursor_off(void)
+{
+	if (vga_enabled)
+	{
+		vga_cursor_off();
+	}
+}
+
+void console_cursor_restore(void)
+{
+	if (vga_enabled)
+	{
+		vga_cursor_restore();
+	}
+	serial_cursor_restore();
+}
+
+void console_cursor_save(void)
+{
+	if (vga_enabled)
+	{
+		vga_cursor_save();
+	}
+	serial_cursor_save();
+}
+#endif

Added: branches/vendor/emile/second/console.h
===================================================================
--- branches/vendor/emile/second/console.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/console.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,27 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __CONSOLE_H__
+#define __CONSOLE_H__
+
+#include <macos/types.h>
+
+#include "misc.h"
+#include "head.h"
+
+extern void console_init(emile_l2_header_t* info);
+extern inline int console_putchar(int c);
+extern void console_putstring(const char *s);
+#ifdef USE_CLI
+extern int console_keypressed(int timeout);
+extern int console_getchar(void);
+extern void console_cursor_on(void);
+extern void console_cursor_off(void);
+extern void console_cursor_save(void);
+extern void console_cursor_restore(void);
+#endif
+
+#endif

Added: branches/vendor/emile/second/copymem.i
===================================================================
--- branches/vendor/emile/second/copymem.i	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/copymem.i	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,25 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+.macro	copymem	src, dst, size
+	cmpa.l	\src, \dst
+	bgt.s	1f
+0:
+	move.b	(\src)+,(\dst)+
+	subq.l	#1,\size
+	bge.s	0b
+
+	bra	4f
+
+1:
+	adda.l	\size, \src
+	adda.l	\size, \dst
+2:
+	move.b	-(\src),-(\dst)
+	subq.l	#1,\size
+	bge.s	2b
+4:
+.endm

Added: branches/vendor/emile/second/driver.c
===================================================================
--- branches/vendor/emile/second/driver.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/driver.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,56 @@
+/*
+ * 
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <macos/lowmem.h>
+#include <macos/devices.h>
+#include <macos/video.h>
+
+#include "misc.h"
+
+void turn_off_interrupts()
+{
+	int i;
+	short count;
+	DCtlHandle *currentHandle;
+	DCtlPtr currentPtr;
+	DriverHeader *driverPtr, **driverHandle;
+	short refnum;
+	volatile OSErr err; /* because -O2 remove call to PBControlSync() otherwise... */
+	VDParamBlock pb;
+	VDFlagRec flag;
+	
+	count = LMGetUnitTableEntryCount();
+	currentHandle = (DCtlEntry ***) LMGetUTableBase();
+	for (i = 0; i < count; i++)
+	{
+		if (!currentHandle[i])
+			continue;
+		currentPtr = *(currentHandle[i]);
+		if (currentPtr->dCtlFlags & dRAMBasedMask)
+		{
+			driverHandle = (void*)(currentPtr->dCtlDriver);
+			if (!driverHandle)
+				continue;
+			driverPtr = *driverHandle;
+		}
+		else
+			driverPtr = (void*)(currentPtr->dCtlDriver);
+
+		err = OpenDriver(driverPtr->drvrName, &refnum);
+		if (err != noErr)
+			continue;
+		pb.ioRefNum = refnum;
+		pb.csCode = 7; /* SetInterrupt */
+		flag.flag = 1;
+		pb.csParam = &flag;
+
+		err = PBControlSync((ParmBlkPtr) &pb);
+	}
+}

Added: branches/vendor/emile/second/driver.h
===================================================================
--- branches/vendor/emile/second/driver.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/driver.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,7 @@
+/*
+ * 
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+extern void turn_off_interrupts();

Added: branches/vendor/emile/second/enter_kernel.c
===================================================================
--- branches/vendor/emile/second/enter_kernel.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/enter_kernel.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,70 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+
+#include <macos/types.h>
+#include <macos/gestalt.h>
+
+#include "misc.h"
+#include "arch.h"
+#include "enter_kernel.h"
+
+unsigned long enter_kernel;
+unsigned long end_enter_kernel;
+disable_cache_t disable_cache;
+
+void enter_kernel_init(void)
+{
+#ifdef ARCH_M68K
+	if (arch_type == gestalt68k)
+	{
+		if (mmu_type == gestalt68040MMU)
+		{
+#ifdef USE_MMU040
+			enter_kernel = (unsigned long)enter_kernel040;
+			end_enter_kernel = (unsigned long)&end_enter_kernel040;
+			disable_cache = MMU040_disable_cache;
+#else
+			error("68040 MMU is not supported");
+#endif
+		}
+		else if (mmu_type == gestalt68030MMU)
+		{
+#ifdef USE_MMU030
+			enter_kernel = (unsigned long)enter_kernel030;
+			end_enter_kernel = (unsigned long)&end_enter_kernel030;
+			disable_cache = MMU030_disable_cache;
+#else
+			error("68030 MMU is not supported");
+#endif
+		}
+		else if (mmu_type == gestalt68851)
+		{
+			error("MMU 68851 is not supported");
+		}
+		else if (mmu_type == gestaltNoMMU)
+		{
+			enter_kernel = (unsigned long)enter_kernelnoMMU;
+			end_enter_kernel = (unsigned long)&end_enter_kernelnoMMU;
+			disable_cache = noMMU_disable_cache;
+		}
+		else
+			error("Unsupported MMU");
+	}
+#endif
+#ifdef ARCH_PPC
+	if (arch_type == gestaltPowerPC)
+	{
+		enter_kernel = NULL;
+		end_enter_kernel = NULL;
+		disable_cache = NULL;
+		bootstrap_size = 0;
+	}
+	else
+		error("EMILE doesn't support your architecture");
+#endif
+}

Added: branches/vendor/emile/second/enter_kernel.h
===================================================================
--- branches/vendor/emile/second/enter_kernel.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/enter_kernel.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,35 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __ENTER_KERNEL_H__
+#define __ENTER_KERNEL_H__
+
+typedef void (*entry_t) (unsigned long , unsigned long , unsigned long, unsigned long );
+typedef void (*disable_cache_t) (void);
+
+#include "enter_kernelnoMMU.h"
+#ifdef USE_MMU030
+#include "enter_kernel030.h"
+#include "MMU030.h"
+#endif
+#ifdef USE_MMU040
+#include "enter_kernel040.h"
+#include "MMU040.h"
+#endif
+#define PAGE_SHIFT	12
+#define PAGE_SIZE	(1UL << PAGE_SHIFT)
+#define PAGE_MASK	(~(PAGE_SIZE-1))
+
+#ifdef ARCH_PPC
+#include "enter_kernelPPC.h"
+#endif
+
+extern void enter_kernel_init(void);
+extern unsigned long enter_kernel;
+extern unsigned long end_enter_kernel;
+extern disable_cache_t disable_cache;
+
+#endif

Added: branches/vendor/emile/second/enter_kernel030.S
===================================================================
--- branches/vendor/emile/second/enter_kernel030.S	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/enter_kernel030.S	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,64 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+	.chip 68030
+
+	.include "copymem.i"
+
+	.align 4
+
+	.global enter_kernel030
+enter_kernel030:
+	link.w  %fp,#-8
+
+	/* get physical start address of kernel */
+
+	move.l	8(%fp), %a0
+
+	/* size of image to relocate */
+
+	move.l	12(%fp), %d0
+
+	/* destination addresse */
+
+	move.l	16(%fp), %a2
+
+	/* bootenv address (EXPERIMENTAL) */
+
+	move.l	%a2, %a1
+	add.l	%d0, %a1
+	sub.l	#4096, %a1
+	move.l	#0x80000000, %d4
+
+	/* entry point */
+
+	move.l	20(%fp), %a3
+
+	/* disable MMU */
+
+	lea	-8(%fp), %a4
+	pmove	%tc, %a4@
+	bclr	#7, %a4@
+	pmove	%a4@, %tc
+
+	clr.l	%a4@
+	pmove	%a4@, %tt0
+	pmove	%a4@, %tt1
+
+	/* copy kernel to destination address */
+
+	copymem	%a0, %a2, %d0
+
+	/* jump into kernel */
+
+	jmp	%a3@
+
+	/* never comes here... I hope */
+
+	unlk    %fp
+	rts
+	.global end_enter_kernel030
+end_enter_kernel030:

Added: branches/vendor/emile/second/enter_kernel030.h
===================================================================
--- branches/vendor/emile/second/enter_kernel030.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/enter_kernel030.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,13 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __ENTER_KERNEL030_H__
+#define __ENTER_KERNEL030_H__
+
+extern void enter_kernel030(unsigned long addr, unsigned long size, unsigned long dest, unsigned long entry);
+extern char end_enter_kernel030;
+
+#endif

Added: branches/vendor/emile/second/enter_kernel040.S
===================================================================
--- branches/vendor/emile/second/enter_kernel040.S	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/enter_kernel040.S	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,62 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+	.chip 68040
+
+	.include "copymem.i"
+
+	.align 4
+
+	.global enter_kernel040
+enter_kernel040:
+	link.w  %fp,#0
+
+	/* get physical start address of kernel */
+
+	move.l	8(%fp), %a0
+
+	/* size of image to relocate */
+
+	move.l	12(%fp), %d0
+
+	/* destination addresse */
+
+	move.l	16(%fp), %a2
+
+	/* bootenv address (EXPERIMENTAL) */
+
+	move.l  %a2, %a1
+	add.l   %d0, %a1
+	sub.l   #4096, %a1
+	move.l	#0x80000000, %d4
+
+	/* entry point */
+
+	move.l	20(%fp), %a3
+
+	/* disable MMU */
+
+	moveq.l	#0, %d1
+	movec	%d1, %tc
+	movec	%d1, %itt0
+	movec	%d1, %dtt0
+	movec	%d1, %itt1
+	movec	%d1, %dtt1
+
+	/* copy kernel to destination address */
+
+	copymem	%a0, %a2, %d0
+
+	/* jump into kernel */
+
+	jmp	%a3@
+
+	/* never comes here... I hope */
+
+	unlk    %fp
+	rts
+	.global end_enter_kernel040
+end_enter_kernel040:

Added: branches/vendor/emile/second/enter_kernel040.h
===================================================================
--- branches/vendor/emile/second/enter_kernel040.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/enter_kernel040.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,13 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __ENTER_KERNEL040_H__
+#define __ENTER_KERNEL040_H__
+
+extern void enter_kernel040(unsigned long addr, unsigned long size, unsigned long dest, unsigned long entry);
+extern char end_enter_kernel040;
+
+#endif

Added: branches/vendor/emile/second/enter_kernelPPC.S
===================================================================
--- branches/vendor/emile/second/enter_kernelPPC.S	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/enter_kernelPPC.S	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,88 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ * 	    from BootX, (c) Benjamin Herrenschmidt
+ *
+ */
+
+	.chip 68020
+
+.equ	PC,  0x00FC
+.equ	GPR, 0x0100
+.equ	FPR, 0x0200
+
+#define pc	%sp@(PC)
+#define gpr(a)	%sp@(GPR + 8 * a + 4)
+#define fpr0(a)	%sp@(FPR + 8 * a)
+#define fpr1(a)	%sp@(FPR + 8 * a + 4)
+
+.macro copy_GPR from=0, to=31
+	move.l	%a1 at +, gpr(\from)
+.if \to-\from
+	copy_GPR "(\from+1)",\to
+.endif
+.endm
+
+.macro copy_FPR from=0, to=31
+	move.l	%a1 at +, fpr0(\from)
+	move.l	%a1 at +, fpr1(\from)
+.if \to-\from
+	copy_FPR "(\from+1)",\to
+.endif
+.endm
+
+	.align 4
+
+	.global enter_kernelPPC
+enter_kernelPPC:
+	link.w  %fp,#0
+
+	/* get physical start address of kernel */
+
+	move.l	8(%fp), %a0
+
+	/* get PPC registers values */
+
+	 move.l  12(%fp), %a1
+
+	/* prepare stack */
+
+	move.l	%sp, %d0
+	andi.l	#0xFFFFFC00, %d0
+	move.l	%d0, %sp
+	move.l	#0x00BF, %d0
+loop:
+	clr.l	-(%sp)
+	dbra	%d0, loop
+
+	/* Initialize PPC registers */
+
+	/* set up program counter */
+
+	/* PC */
+
+	move.l	%a1 at +, pc
+
+	/* GPR */
+
+	copy_GPR
+
+	/* FPR */
+
+	copy_FPR
+
+	/* Switch to PPC */
+
+	move.l	#0x47617279, %a0 /* 'Gary' */
+	move.l	#0x05051956, %a1
+	move.l	#0x0000C000, %d0
+	moveq	#0, %d2
+	reset
+
+	move.l	%sp,-(%sp)
+wait:
+	dc.w	0xFE03
+	beq	wait
+
+	unlk	%fp
+	rts

Added: branches/vendor/emile/second/enter_kernelPPC.h
===================================================================
--- branches/vendor/emile/second/enter_kernelPPC.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/enter_kernelPPC.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,25 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ * Some parts from bootX, (c) BenH
+ *
+ */
+
+#ifndef __ENTER_KERNELPPC_H__
+#define __ENTER_KERNELPPC_H__
+
+#include "misc.h"
+
+typedef u_int32_t float_reg_t[2] __attribute__((packed));
+
+typedef struct PPCRegisterList
+{
+	u_int32_t	PC;
+	u_int32_t	GPR[32];
+	float_reg_t	FPR[32];
+} PPCRegisterList __attribute__((packed));
+
+extern void enter_kernelPPC(unsigned long addr, PPCRegisterList* regs);
+
+#endif

Added: branches/vendor/emile/second/enter_kernelnoMMU.S
===================================================================
--- branches/vendor/emile/second/enter_kernelnoMMU.S	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/enter_kernelnoMMU.S	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,56 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+	.chip 68000
+
+	.include "copymem.i"
+
+	.align 4
+
+	.global enter_kernelnoMMU
+enter_kernelnoMMU:
+	link.w  %fp,#0
+
+	/* get physical start address of kernel */
+
+	move.l	8(%fp), %a0
+
+	/* size of image to relocate */
+
+	move.l	12(%fp), %d0
+
+	/* destination addresse */
+
+	move.l	16(%fp), %a2
+
+	/* entry point */
+
+	move.l	20(%fp), %a3
+
+	/* bootenv address (EXPERIMENTAL) */
+
+	move.l  %a2, %a1
+	add.l   %d0, %a1
+	sub.l   #4096, %a1
+	move.l  #0x80000000, %d4
+
+	/* copy kernel to destination address */
+
+	copymem	%a0, %a2, %d0
+
+	/* jump into kernel */
+
+	jmp	%a3@
+
+	/* never comes here... I hope */
+
+	unlk    %fp
+	rts
+	.global end_enter_kernelnoMMU
+end_enter_kernelnoMMU:
+
+	.global noMMU_disable_cache
+noMMU_disable_cache:
+	rts

Added: branches/vendor/emile/second/enter_kernelnoMMU.h
===================================================================
--- branches/vendor/emile/second/enter_kernelnoMMU.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/enter_kernelnoMMU.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,15 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __ENTER_KERNELNOMMU_H__
+#define __ENTER_KERNELNOMMU_H__
+
+extern void noMMU_disable_cache(void);
+
+extern void enter_kernelnoMMU(unsigned long addr, unsigned long size, unsigned long dest, unsigned long entry);
+extern char end_enter_kernelnoMMU;
+
+#endif

Added: branches/vendor/emile/second/font_8x16.c
===================================================================
--- branches/vendor/emile/second/font_8x16.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/font_8x16.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,4624 @@
+/*
+ * file from linux 2.4.23 source tree
+ * /usr/src/linux/drivers/video/font_8x16.c
+ *
+ * Modified by (c) Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+static unsigned char fontdata_8x16[] = {
+
+	/* 0 0x00 '^@' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 1 0x01 '^A' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7e, /* 01111110 */
+	0x81, /* 10000001 */
+	0xa5, /* 10100101 */
+	0x81, /* 10000001 */
+	0x81, /* 10000001 */
+	0xbd, /* 10111101 */
+	0x99, /* 10011001 */
+	0x81, /* 10000001 */
+	0x81, /* 10000001 */
+	0x7e, /* 01111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 2 0x02 '^B' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7e, /* 01111110 */
+	0xff, /* 11111111 */
+	0xdb, /* 11011011 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xc3, /* 11000011 */
+	0xe7, /* 11100111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0x7e, /* 01111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 3 0x03 '^C' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x6c, /* 01101100 */
+	0xfe, /* 11111110 */
+	0xfe, /* 11111110 */
+	0xfe, /* 11111110 */
+	0xfe, /* 11111110 */
+	0x7c, /* 01111100 */
+	0x38, /* 00111000 */
+	0x10, /* 00010000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 4 0x04 '^D' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x10, /* 00010000 */
+	0x38, /* 00111000 */
+	0x7c, /* 01111100 */
+	0xfe, /* 11111110 */
+	0x7c, /* 01111100 */
+	0x38, /* 00111000 */
+	0x10, /* 00010000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 5 0x05 '^E' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x3c, /* 00111100 */
+	0xe7, /* 11100111 */
+	0xe7, /* 11100111 */
+	0xe7, /* 11100111 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 6 0x06 '^F' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x7e, /* 01111110 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0x7e, /* 01111110 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 7 0x07 '^G' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x3c, /* 00111100 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 8 0x08 '^H' */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xe7, /* 11100111 */
+	0xc3, /* 11000011 */
+	0xc3, /* 11000011 */
+	0xe7, /* 11100111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+
+	/* 9 0x09 '^I' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x3c, /* 00111100 */
+	0x66, /* 01100110 */
+	0x42, /* 01000010 */
+	0x42, /* 01000010 */
+	0x66, /* 01100110 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 10 0x0a '^J' */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xc3, /* 11000011 */
+	0x99, /* 10011001 */
+	0xbd, /* 10111101 */
+	0xbd, /* 10111101 */
+	0x99, /* 10011001 */
+	0xc3, /* 11000011 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+
+	/* 11 0x0b '^K' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x1e, /* 00011110 */
+	0x0e, /* 00001110 */
+	0x1a, /* 00011010 */
+	0x32, /* 00110010 */
+	0x78, /* 01111000 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x78, /* 01111000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 12 0x0c '^L' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x3c, /* 00111100 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x3c, /* 00111100 */
+	0x18, /* 00011000 */
+	0x7e, /* 01111110 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 13 0x0d '^M' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x3f, /* 00111111 */
+	0x33, /* 00110011 */
+	0x3f, /* 00111111 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x70, /* 01110000 */
+	0xf0, /* 11110000 */
+	0xe0, /* 11100000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 14 0x0e '^N' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7f, /* 01111111 */
+	0x63, /* 01100011 */
+	0x7f, /* 01111111 */
+	0x63, /* 01100011 */
+	0x63, /* 01100011 */
+	0x63, /* 01100011 */
+	0x63, /* 01100011 */
+	0x67, /* 01100111 */
+	0xe7, /* 11100111 */
+	0xe6, /* 11100110 */
+	0xc0, /* 11000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 15 0x0f '^O' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0xdb, /* 11011011 */
+	0x3c, /* 00111100 */
+	0xe7, /* 11100111 */
+	0x3c, /* 00111100 */
+	0xdb, /* 11011011 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 16 0x10 '^P' */
+	0x00, /* 00000000 */
+	0x80, /* 10000000 */
+	0xc0, /* 11000000 */
+	0xe0, /* 11100000 */
+	0xf0, /* 11110000 */
+	0xf8, /* 11111000 */
+	0xfe, /* 11111110 */
+	0xf8, /* 11111000 */
+	0xf0, /* 11110000 */
+	0xe0, /* 11100000 */
+	0xc0, /* 11000000 */
+	0x80, /* 10000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 17 0x11 '^Q' */
+	0x00, /* 00000000 */
+	0x02, /* 00000010 */
+	0x06, /* 00000110 */
+	0x0e, /* 00001110 */
+	0x1e, /* 00011110 */
+	0x3e, /* 00111110 */
+	0xfe, /* 11111110 */
+	0x3e, /* 00111110 */
+	0x1e, /* 00011110 */
+	0x0e, /* 00001110 */
+	0x06, /* 00000110 */
+	0x02, /* 00000010 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 18 0x12 '^R' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x7e, /* 01111110 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x7e, /* 01111110 */
+	0x3c, /* 00111100 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 19 0x13 '^S' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x00, /* 00000000 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 20 0x14 '^T' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7f, /* 01111111 */
+	0xdb, /* 11011011 */
+	0xdb, /* 11011011 */
+	0xdb, /* 11011011 */
+	0x7b, /* 01111011 */
+	0x1b, /* 00011011 */
+	0x1b, /* 00011011 */
+	0x1b, /* 00011011 */
+	0x1b, /* 00011011 */
+	0x1b, /* 00011011 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 21 0x15 '^U' */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0x60, /* 01100000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x6c, /* 01101100 */
+	0x38, /* 00111000 */
+	0x0c, /* 00001100 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 22 0x16 '^V' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0xfe, /* 11111110 */
+	0xfe, /* 11111110 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 23 0x17 '^W' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x7e, /* 01111110 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x7e, /* 01111110 */
+	0x3c, /* 00111100 */
+	0x18, /* 00011000 */
+	0x7e, /* 01111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 24 0x18 '^X' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x7e, /* 01111110 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 25 0x19 '^Y' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x7e, /* 01111110 */
+	0x3c, /* 00111100 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 26 0x1a '^Z' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x0c, /* 00001100 */
+	0xfe, /* 11111110 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 27 0x1b '^[' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0xfe, /* 11111110 */
+	0x60, /* 01100000 */
+	0x30, /* 00110000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 28 0x1c '^\' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 29 0x1d '^]' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x28, /* 00101000 */
+	0x6c, /* 01101100 */
+	0xfe, /* 11111110 */
+	0x6c, /* 01101100 */
+	0x28, /* 00101000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 30 0x1e '^^' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x10, /* 00010000 */
+	0x38, /* 00111000 */
+	0x38, /* 00111000 */
+	0x7c, /* 01111100 */
+	0x7c, /* 01111100 */
+	0xfe, /* 11111110 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 31 0x1f '^_' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0xfe, /* 11111110 */
+	0x7c, /* 01111100 */
+	0x7c, /* 01111100 */
+	0x38, /* 00111000 */
+	0x38, /* 00111000 */
+	0x10, /* 00010000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 32 0x20 ' ' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 33 0x21 '!' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x3c, /* 00111100 */
+	0x3c, /* 00111100 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 34 0x22 '"' */
+	0x00, /* 00000000 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x24, /* 00100100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 35 0x23 '#' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0xfe, /* 11111110 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0xfe, /* 11111110 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 36 0x24 '$' */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc2, /* 11000010 */
+	0xc0, /* 11000000 */
+	0x7c, /* 01111100 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x86, /* 10000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 37 0x25 '%' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc2, /* 11000010 */
+	0xc6, /* 11000110 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0xc6, /* 11000110 */
+	0x86, /* 10000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 38 0x26 '&' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0x38, /* 00111000 */
+	0x76, /* 01110110 */
+	0xdc, /* 11011100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x76, /* 01110110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 39 0x27 ''' */
+	0x00, /* 00000000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 40 0x28 '(' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x18, /* 00011000 */
+	0x0c, /* 00001100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 41 0x29 ')' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x30, /* 00110000 */
+	0x18, /* 00011000 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 42 0x2a '*' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x66, /* 01100110 */
+	0x3c, /* 00111100 */
+	0xff, /* 11111111 */
+	0x3c, /* 00111100 */
+	0x66, /* 01100110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 43 0x2b '+' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x7e, /* 01111110 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 44 0x2c ',' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 45 0x2d '-' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 46 0x2e '.' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 47 0x2f '/' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x02, /* 00000010 */
+	0x06, /* 00000110 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0xc0, /* 11000000 */
+	0x80, /* 10000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 48 0x30 '0' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xd6, /* 11010110 */
+	0xd6, /* 11010110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x6c, /* 01101100 */
+	0x38, /* 00111000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 49 0x31 '1' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x38, /* 00111000 */
+	0x78, /* 01111000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x7e, /* 01111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 50 0x32 '2' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0x06, /* 00000110 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0xc0, /* 11000000 */
+	0xc6, /* 11000110 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 51 0x33 '3' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x3c, /* 00111100 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 52 0x34 '4' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x0c, /* 00001100 */
+	0x1c, /* 00011100 */
+	0x3c, /* 00111100 */
+	0x6c, /* 01101100 */
+	0xcc, /* 11001100 */
+	0xfe, /* 11111110 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x1e, /* 00011110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 53 0x35 '5' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xfc, /* 11111100 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 54 0x36 '6' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x38, /* 00111000 */
+	0x60, /* 01100000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xfc, /* 11111100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 55 0x37 '7' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0xc6, /* 11000110 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 56 0x38 '8' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 57 0x39 '9' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7e, /* 01111110 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x0c, /* 00001100 */
+	0x78, /* 01111000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 58 0x3a ':' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 59 0x3b ';' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 60 0x3c '<' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x06, /* 00000110 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0x30, /* 00110000 */
+	0x18, /* 00011000 */
+	0x0c, /* 00001100 */
+	0x06, /* 00000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 61 0x3d '=' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7e, /* 01111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7e, /* 01111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 62 0x3e '>' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x60, /* 01100000 */
+	0x30, /* 00110000 */
+	0x18, /* 00011000 */
+	0x0c, /* 00001100 */
+	0x06, /* 00000110 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 63 0x3f '?' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 64 0x40 '@' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xde, /* 11011110 */
+	0xde, /* 11011110 */
+	0xde, /* 11011110 */
+	0xdc, /* 11011100 */
+	0xc0, /* 11000000 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 65 0x41 'A' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x10, /* 00010000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xfe, /* 11111110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 66 0x42 'B' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfc, /* 11111100 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x7c, /* 01111100 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0xfc, /* 11111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 67 0x43 'C' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x3c, /* 00111100 */
+	0x66, /* 01100110 */
+	0xc2, /* 11000010 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc2, /* 11000010 */
+	0x66, /* 01100110 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 68 0x44 'D' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xf8, /* 11111000 */
+	0x6c, /* 01101100 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x6c, /* 01101100 */
+	0xf8, /* 11111000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 69 0x45 'E' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0x66, /* 01100110 */
+	0x62, /* 01100010 */
+	0x68, /* 01101000 */
+	0x78, /* 01111000 */
+	0x68, /* 01101000 */
+	0x60, /* 01100000 */
+	0x62, /* 01100010 */
+	0x66, /* 01100110 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 70 0x46 'F' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0x66, /* 01100110 */
+	0x62, /* 01100010 */
+	0x68, /* 01101000 */
+	0x78, /* 01111000 */
+	0x68, /* 01101000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0xf0, /* 11110000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 71 0x47 'G' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x3c, /* 00111100 */
+	0x66, /* 01100110 */
+	0xc2, /* 11000010 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xde, /* 11011110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x66, /* 01100110 */
+	0x3a, /* 00111010 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 72 0x48 'H' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xfe, /* 11111110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 73 0x49 'I' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x3c, /* 00111100 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 74 0x4a 'J' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x1e, /* 00011110 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x78, /* 01111000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 75 0x4b 'K' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xe6, /* 11100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x6c, /* 01101100 */
+	0x78, /* 01111000 */
+	0x78, /* 01111000 */
+	0x6c, /* 01101100 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0xe6, /* 11100110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 76 0x4c 'L' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xf0, /* 11110000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x62, /* 01100010 */
+	0x66, /* 01100110 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 77 0x4d 'M' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0xee, /* 11101110 */
+	0xfe, /* 11111110 */
+	0xfe, /* 11111110 */
+	0xd6, /* 11010110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 78 0x4e 'N' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0xe6, /* 11100110 */
+	0xf6, /* 11110110 */
+	0xfe, /* 11111110 */
+	0xde, /* 11011110 */
+	0xce, /* 11001110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 79 0x4f 'O' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 80 0x50 'P' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfc, /* 11111100 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x7c, /* 01111100 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0xf0, /* 11110000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 81 0x51 'Q' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xd6, /* 11010110 */
+	0xde, /* 11011110 */
+	0x7c, /* 01111100 */
+	0x0c, /* 00001100 */
+	0x0e, /* 00001110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 82 0x52 'R' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfc, /* 11111100 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x7c, /* 01111100 */
+	0x6c, /* 01101100 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0xe6, /* 11100110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 83 0x53 'S' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x60, /* 01100000 */
+	0x38, /* 00111000 */
+	0x0c, /* 00001100 */
+	0x06, /* 00000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 84 0x54 'T' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7e, /* 01111110 */
+	0x7e, /* 01111110 */
+	0x5a, /* 01011010 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 85 0x55 'U' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 86 0x56 'V' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x6c, /* 01101100 */
+	0x38, /* 00111000 */
+	0x10, /* 00010000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 87 0x57 'W' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xd6, /* 11010110 */
+	0xd6, /* 11010110 */
+	0xd6, /* 11010110 */
+	0xfe, /* 11111110 */
+	0xee, /* 11101110 */
+	0x6c, /* 01101100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 88 0x58 'X' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x6c, /* 01101100 */
+	0x7c, /* 01111100 */
+	0x38, /* 00111000 */
+	0x38, /* 00111000 */
+	0x7c, /* 01111100 */
+	0x6c, /* 01101100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 89 0x59 'Y' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x3c, /* 00111100 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 90 0x5a 'Z' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0xc6, /* 11000110 */
+	0x86, /* 10000110 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0xc2, /* 11000010 */
+	0xc6, /* 11000110 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 91 0x5b '[' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x3c, /* 00111100 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 92 0x5c '\' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x80, /* 10000000 */
+	0xc0, /* 11000000 */
+	0xe0, /* 11100000 */
+	0x70, /* 01110000 */
+	0x38, /* 00111000 */
+	0x1c, /* 00011100 */
+	0x0e, /* 00001110 */
+	0x06, /* 00000110 */
+	0x02, /* 00000010 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 93 0x5d ']' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x3c, /* 00111100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 94 0x5e '^' */
+	0x10, /* 00010000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 95 0x5f '_' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xff, /* 11111111 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 96 0x60 '`' */
+	0x00, /* 00000000 */
+	0x30, /* 00110000 */
+	0x18, /* 00011000 */
+	0x0c, /* 00001100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 97 0x61 'a' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x78, /* 01111000 */
+	0x0c, /* 00001100 */
+	0x7c, /* 01111100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x76, /* 01110110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 98 0x62 'b' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xe0, /* 11100000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x78, /* 01111000 */
+	0x6c, /* 01101100 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 99 0x63 'c' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 100 0x64 'd' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x1c, /* 00011100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x3c, /* 00111100 */
+	0x6c, /* 01101100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x76, /* 01110110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 101 0x65 'e' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xfe, /* 11111110 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 102 0x66 'f' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x1c, /* 00011100 */
+	0x36, /* 00110110 */
+	0x32, /* 00110010 */
+	0x30, /* 00110000 */
+	0x78, /* 01111000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x78, /* 01111000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 103 0x67 'g' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x76, /* 01110110 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x7c, /* 01111100 */
+	0x0c, /* 00001100 */
+	0xcc, /* 11001100 */
+	0x78, /* 01111000 */
+	0x00, /* 00000000 */
+
+	/* 104 0x68 'h' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xe0, /* 11100000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x6c, /* 01101100 */
+	0x76, /* 01110110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0xe6, /* 11100110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 105 0x69 'i' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x38, /* 00111000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 106 0x6a 'j' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x00, /* 00000000 */
+	0x0e, /* 00001110 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+
+	/* 107 0x6b 'k' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xe0, /* 11100000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x66, /* 01100110 */
+	0x6c, /* 01101100 */
+	0x78, /* 01111000 */
+	0x78, /* 01111000 */
+	0x6c, /* 01101100 */
+	0x66, /* 01100110 */
+	0xe6, /* 11100110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 108 0x6c 'l' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x38, /* 00111000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 109 0x6d 'm' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xec, /* 11101100 */
+	0xfe, /* 11111110 */
+	0xd6, /* 11010110 */
+	0xd6, /* 11010110 */
+	0xd6, /* 11010110 */
+	0xd6, /* 11010110 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 110 0x6e 'n' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xdc, /* 11011100 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 111 0x6f 'o' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 112 0x70 'p' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xdc, /* 11011100 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x7c, /* 01111100 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0xf0, /* 11110000 */
+	0x00, /* 00000000 */
+
+	/* 113 0x71 'q' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x76, /* 01110110 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x7c, /* 01111100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x1e, /* 00011110 */
+	0x00, /* 00000000 */
+
+	/* 114 0x72 'r' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xdc, /* 11011100 */
+	0x76, /* 01110110 */
+	0x66, /* 01100110 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0xf0, /* 11110000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 115 0x73 's' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0x60, /* 01100000 */
+	0x38, /* 00111000 */
+	0x0c, /* 00001100 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 116 0x74 't' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x10, /* 00010000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0xfc, /* 11111100 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x36, /* 00110110 */
+	0x1c, /* 00011100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 117 0x75 'u' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x76, /* 01110110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 118 0x76 'v' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x6c, /* 01101100 */
+	0x38, /* 00111000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 119 0x77 'w' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xd6, /* 11010110 */
+	0xd6, /* 11010110 */
+	0xd6, /* 11010110 */
+	0xfe, /* 11111110 */
+	0x6c, /* 01101100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 120 0x78 'x' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0x6c, /* 01101100 */
+	0x38, /* 00111000 */
+	0x38, /* 00111000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 121 0x79 'y' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7e, /* 01111110 */
+	0x06, /* 00000110 */
+	0x0c, /* 00001100 */
+	0xf8, /* 11111000 */
+	0x00, /* 00000000 */
+
+	/* 122 0x7a 'z' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0xcc, /* 11001100 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0xc6, /* 11000110 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 123 0x7b '{' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x0e, /* 00001110 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x70, /* 01110000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x0e, /* 00001110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 124 0x7c '|' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 125 0x7d '}' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x70, /* 01110000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x0e, /* 00001110 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x70, /* 01110000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 126 0x7e '~' */
+	0x00, /* 00000000 */
+	0x76, /* 01110110 */
+	0xdc, /* 11011100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 127 0x7f '' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x10, /* 00010000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 128 0x80 '€' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x3c, /* 00111100 */
+	0x66, /* 01100110 */
+	0xc2, /* 11000010 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc2, /* 11000010 */
+	0x66, /* 01100110 */
+	0x3c, /* 00111100 */
+	0x18, /* 00011000 */
+	0x70, /* 01110000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 129 0x81 '' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xcc, /* 11001100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x76, /* 01110110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 130 0x82 '‚' */
+	0x00, /* 00000000 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xfe, /* 11111110 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 131 0x83 'ƒ' */
+	0x00, /* 00000000 */
+	0x10, /* 00010000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0x00, /* 00000000 */
+	0x78, /* 01111000 */
+	0x0c, /* 00001100 */
+	0x7c, /* 01111100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x76, /* 01110110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 132 0x84 '„' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xcc, /* 11001100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x78, /* 01111000 */
+	0x0c, /* 00001100 */
+	0x7c, /* 01111100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x76, /* 01110110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 133 0x85 '…' */
+	0x00, /* 00000000 */
+	0x60, /* 01100000 */
+	0x30, /* 00110000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x78, /* 01111000 */
+	0x0c, /* 00001100 */
+	0x7c, /* 01111100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x76, /* 01110110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 134 0x86 '†' */
+	0x00, /* 00000000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0x38, /* 00111000 */
+	0x00, /* 00000000 */
+	0x78, /* 01111000 */
+	0x0c, /* 00001100 */
+	0x7c, /* 01111100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x76, /* 01110110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 135 0x87 '‡' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x18, /* 00011000 */
+	0x70, /* 01110000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 136 0x88 'ˆ' */
+	0x00, /* 00000000 */
+	0x10, /* 00010000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xfe, /* 11111110 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 137 0x89 '‰' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xfe, /* 11111110 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 138 0x8a 'Š' */
+	0x00, /* 00000000 */
+	0x60, /* 01100000 */
+	0x30, /* 00110000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xfe, /* 11111110 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 139 0x8b '‹' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x66, /* 01100110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x38, /* 00111000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 140 0x8c 'Œ' */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x66, /* 01100110 */
+	0x00, /* 00000000 */
+	0x38, /* 00111000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 141 0x8d '' */
+	0x00, /* 00000000 */
+	0x60, /* 01100000 */
+	0x30, /* 00110000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x38, /* 00111000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 142 0x8e 'Ž' */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x10, /* 00010000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xfe, /* 11111110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 143 0x8f '' */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0x38, /* 00111000 */
+	0x10, /* 00010000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0xc6, /* 11000110 */
+	0xfe, /* 11111110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 144 0x90 '' */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0x66, /* 01100110 */
+	0x62, /* 01100010 */
+	0x68, /* 01101000 */
+	0x78, /* 01111000 */
+	0x68, /* 01101000 */
+	0x62, /* 01100010 */
+	0x66, /* 01100110 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 145 0x91 '‘' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xec, /* 11101100 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x7e, /* 01111110 */
+	0xd8, /* 11011000 */
+	0xd8, /* 11011000 */
+	0x6e, /* 01101110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 146 0x92 '’' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x3e, /* 00111110 */
+	0x6c, /* 01101100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xfe, /* 11111110 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xce, /* 11001110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 147 0x93 '“' */
+	0x00, /* 00000000 */
+	0x10, /* 00010000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 148 0x94 '”' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 149 0x95 '•' */
+	0x00, /* 00000000 */
+	0x60, /* 01100000 */
+	0x30, /* 00110000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 150 0x96 '–' */
+	0x00, /* 00000000 */
+	0x30, /* 00110000 */
+	0x78, /* 01111000 */
+	0xcc, /* 11001100 */
+	0x00, /* 00000000 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x76, /* 01110110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 151 0x97 '—' */
+	0x00, /* 00000000 */
+	0x60, /* 01100000 */
+	0x30, /* 00110000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x76, /* 01110110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 152 0x98 '˜' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7e, /* 01111110 */
+	0x06, /* 00000110 */
+	0x0c, /* 00001100 */
+	0x78, /* 01111000 */
+	0x00, /* 00000000 */
+
+	/* 153 0x99 '™' */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 154 0x9a 'š' */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 155 0x9b '›' */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 156 0x9c 'œ' */
+	0x00, /* 00000000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0x64, /* 01100100 */
+	0x60, /* 01100000 */
+	0xf0, /* 11110000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0xe6, /* 11100110 */
+	0xfc, /* 11111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 157 0x9d '' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x3c, /* 00111100 */
+	0x18, /* 00011000 */
+	0x7e, /* 01111110 */
+	0x18, /* 00011000 */
+	0x7e, /* 01111110 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 158 0x9e 'ž' */
+	0x00, /* 00000000 */
+	0xf8, /* 11111000 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xf8, /* 11111000 */
+	0xc4, /* 11000100 */
+	0xcc, /* 11001100 */
+	0xde, /* 11011110 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 159 0x9f 'Ÿ' */
+	0x00, /* 00000000 */
+	0x0e, /* 00001110 */
+	0x1b, /* 00011011 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x7e, /* 01111110 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0xd8, /* 11011000 */
+	0x70, /* 01110000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 160 0xa0 ' ' */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0x00, /* 00000000 */
+	0x78, /* 01111000 */
+	0x0c, /* 00001100 */
+	0x7c, /* 01111100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x76, /* 01110110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 161 0xa1 '¡' */
+	0x00, /* 00000000 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x00, /* 00000000 */
+	0x38, /* 00111000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 162 0xa2 '¢' */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 163 0xa3 '£' */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0x00, /* 00000000 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0x76, /* 01110110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 164 0xa4 '¤' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x76, /* 01110110 */
+	0xdc, /* 11011100 */
+	0x00, /* 00000000 */
+	0xdc, /* 11011100 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 165 0xa5 '¥' */
+	0x76, /* 01110110 */
+	0xdc, /* 11011100 */
+	0x00, /* 00000000 */
+	0xc6, /* 11000110 */
+	0xe6, /* 11100110 */
+	0xf6, /* 11110110 */
+	0xfe, /* 11111110 */
+	0xde, /* 11011110 */
+	0xce, /* 11001110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 166 0xa6 '¦' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x3c, /* 00111100 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0x3e, /* 00111110 */
+	0x00, /* 00000000 */
+	0x7e, /* 01111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 167 0xa7 '§' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0x38, /* 00111000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 168 0xa8 '¨' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x00, /* 00000000 */
+	0x30, /* 00110000 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0xc0, /* 11000000 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x7c, /* 01111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 169 0xa9 '©' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 170 0xaa 'ª' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 171 0xab '«' */
+	0x00, /* 00000000 */
+	0x60, /* 01100000 */
+	0xe0, /* 11100000 */
+	0x62, /* 01100010 */
+	0x66, /* 01100110 */
+	0x6c, /* 01101100 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0xdc, /* 11011100 */
+	0x86, /* 10000110 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x3e, /* 00111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 172 0xac '¬' */
+	0x00, /* 00000000 */
+	0x60, /* 01100000 */
+	0xe0, /* 11100000 */
+	0x62, /* 01100010 */
+	0x66, /* 01100110 */
+	0x6c, /* 01101100 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x66, /* 01100110 */
+	0xce, /* 11001110 */
+	0x9a, /* 10011010 */
+	0x3f, /* 00111111 */
+	0x06, /* 00000110 */
+	0x06, /* 00000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 173 0xad '­' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x3c, /* 00111100 */
+	0x3c, /* 00111100 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 174 0xae '®' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x36, /* 00110110 */
+	0x6c, /* 01101100 */
+	0xd8, /* 11011000 */
+	0x6c, /* 01101100 */
+	0x36, /* 00110110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 175 0xaf '¯' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xd8, /* 11011000 */
+	0x6c, /* 01101100 */
+	0x36, /* 00110110 */
+	0x6c, /* 01101100 */
+	0xd8, /* 11011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 176 0xb0 '°' */
+	0x11, /* 00010001 */
+	0x44, /* 01000100 */
+	0x11, /* 00010001 */
+	0x44, /* 01000100 */
+	0x11, /* 00010001 */
+	0x44, /* 01000100 */
+	0x11, /* 00010001 */
+	0x44, /* 01000100 */
+	0x11, /* 00010001 */
+	0x44, /* 01000100 */
+	0x11, /* 00010001 */
+	0x44, /* 01000100 */
+	0x11, /* 00010001 */
+	0x44, /* 01000100 */
+	0x11, /* 00010001 */
+	0x44, /* 01000100 */
+
+	/* 177 0xb1 '±' */
+	0x55, /* 01010101 */
+	0xaa, /* 10101010 */
+	0x55, /* 01010101 */
+	0xaa, /* 10101010 */
+	0x55, /* 01010101 */
+	0xaa, /* 10101010 */
+	0x55, /* 01010101 */
+	0xaa, /* 10101010 */
+	0x55, /* 01010101 */
+	0xaa, /* 10101010 */
+	0x55, /* 01010101 */
+	0xaa, /* 10101010 */
+	0x55, /* 01010101 */
+	0xaa, /* 10101010 */
+	0x55, /* 01010101 */
+	0xaa, /* 10101010 */
+
+	/* 178 0xb2 '²' */
+	0xdd, /* 11011101 */
+	0x77, /* 01110111 */
+	0xdd, /* 11011101 */
+	0x77, /* 01110111 */
+	0xdd, /* 11011101 */
+	0x77, /* 01110111 */
+	0xdd, /* 11011101 */
+	0x77, /* 01110111 */
+	0xdd, /* 11011101 */
+	0x77, /* 01110111 */
+	0xdd, /* 11011101 */
+	0x77, /* 01110111 */
+	0xdd, /* 11011101 */
+	0x77, /* 01110111 */
+	0xdd, /* 11011101 */
+	0x77, /* 01110111 */
+
+	/* 179 0xb3 '³' */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+
+	/* 180 0xb4 '´' */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0xf8, /* 11111000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+
+	/* 181 0xb5 'µ' */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0xf8, /* 11111000 */
+	0x18, /* 00011000 */
+	0xf8, /* 11111000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+
+	/* 182 0xb6 '¶' */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0xf6, /* 11110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+
+	/* 183 0xb7 '·' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+
+	/* 184 0xb8 '¸' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xf8, /* 11111000 */
+	0x18, /* 00011000 */
+	0xf8, /* 11111000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+
+	/* 185 0xb9 '¹' */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0xf6, /* 11110110 */
+	0x06, /* 00000110 */
+	0xf6, /* 11110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+
+	/* 186 0xba 'º' */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+
+	/* 187 0xbb '»' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0x06, /* 00000110 */
+	0xf6, /* 11110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+
+	/* 188 0xbc '¼' */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0xf6, /* 11110110 */
+	0x06, /* 00000110 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 189 0xbd '½' */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 190 0xbe '¾' */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0xf8, /* 11111000 */
+	0x18, /* 00011000 */
+	0xf8, /* 11111000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 191 0xbf '¿' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xf8, /* 11111000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+
+	/* 192 0xc0 'À' */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x1f, /* 00011111 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 193 0xc1 'Á' */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0xff, /* 11111111 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 194 0xc2 'Â' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xff, /* 11111111 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+
+	/* 195 0xc3 'Ã' */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x1f, /* 00011111 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+
+	/* 196 0xc4 'Ä' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xff, /* 11111111 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 197 0xc5 'Å' */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0xff, /* 11111111 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+
+	/* 198 0xc6 'Æ' */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x1f, /* 00011111 */
+	0x18, /* 00011000 */
+	0x1f, /* 00011111 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+
+	/* 199 0xc7 'Ç' */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x37, /* 00110111 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+
+	/* 200 0xc8 'È' */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x37, /* 00110111 */
+	0x30, /* 00110000 */
+	0x3f, /* 00111111 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 201 0xc9 'É' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x3f, /* 00111111 */
+	0x30, /* 00110000 */
+	0x37, /* 00110111 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+
+	/* 202 0xca 'Ê' */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0xf7, /* 11110111 */
+	0x00, /* 00000000 */
+	0xff, /* 11111111 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 203 0xcb 'Ë' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xff, /* 11111111 */
+	0x00, /* 00000000 */
+	0xf7, /* 11110111 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+
+	/* 204 0xcc 'Ì' */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x37, /* 00110111 */
+	0x30, /* 00110000 */
+	0x37, /* 00110111 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+
+	/* 205 0xcd 'Í' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xff, /* 11111111 */
+	0x00, /* 00000000 */
+	0xff, /* 11111111 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 206 0xce 'Î' */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0xf7, /* 11110111 */
+	0x00, /* 00000000 */
+	0xf7, /* 11110111 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+
+	/* 207 0xcf 'Ï' */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0xff, /* 11111111 */
+	0x00, /* 00000000 */
+	0xff, /* 11111111 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 208 0xd0 'Ð' */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0xff, /* 11111111 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 209 0xd1 'Ñ' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xff, /* 11111111 */
+	0x00, /* 00000000 */
+	0xff, /* 11111111 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+
+	/* 210 0xd2 'Ò' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xff, /* 11111111 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+
+	/* 211 0xd3 'Ó' */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x3f, /* 00111111 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 212 0xd4 'Ô' */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x1f, /* 00011111 */
+	0x18, /* 00011000 */
+	0x1f, /* 00011111 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 213 0xd5 'Õ' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x1f, /* 00011111 */
+	0x18, /* 00011000 */
+	0x1f, /* 00011111 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+
+	/* 214 0xd6 'Ö' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x3f, /* 00111111 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+
+	/* 215 0xd7 '×' */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0xff, /* 11111111 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+
+	/* 216 0xd8 'Ø' */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0xff, /* 11111111 */
+	0x18, /* 00011000 */
+	0xff, /* 11111111 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+
+	/* 217 0xd9 'Ù' */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0xf8, /* 11111000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 218 0xda 'Ú' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x1f, /* 00011111 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+
+	/* 219 0xdb 'Û' */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+
+	/* 220 0xdc 'Ü' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+
+	/* 221 0xdd 'Ý' */
+	0xf0, /* 11110000 */
+	0xf0, /* 11110000 */
+	0xf0, /* 11110000 */
+	0xf0, /* 11110000 */
+	0xf0, /* 11110000 */
+	0xf0, /* 11110000 */
+	0xf0, /* 11110000 */
+	0xf0, /* 11110000 */
+	0xf0, /* 11110000 */
+	0xf0, /* 11110000 */
+	0xf0, /* 11110000 */
+	0xf0, /* 11110000 */
+	0xf0, /* 11110000 */
+	0xf0, /* 11110000 */
+	0xf0, /* 11110000 */
+	0xf0, /* 11110000 */
+
+	/* 222 0xde 'Þ' */
+	0x0f, /* 00001111 */
+	0x0f, /* 00001111 */
+	0x0f, /* 00001111 */
+	0x0f, /* 00001111 */
+	0x0f, /* 00001111 */
+	0x0f, /* 00001111 */
+	0x0f, /* 00001111 */
+	0x0f, /* 00001111 */
+	0x0f, /* 00001111 */
+	0x0f, /* 00001111 */
+	0x0f, /* 00001111 */
+	0x0f, /* 00001111 */
+	0x0f, /* 00001111 */
+	0x0f, /* 00001111 */
+	0x0f, /* 00001111 */
+	0x0f, /* 00001111 */
+
+	/* 223 0xdf 'ß' */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0xff, /* 11111111 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 224 0xe0 'à' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x76, /* 01110110 */
+	0xdc, /* 11011100 */
+	0xd8, /* 11011000 */
+	0xd8, /* 11011000 */
+	0xd8, /* 11011000 */
+	0xdc, /* 11011100 */
+	0x76, /* 01110110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 225 0xe1 'á' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x78, /* 01111000 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xcc, /* 11001100 */
+	0xd8, /* 11011000 */
+	0xcc, /* 11001100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xcc, /* 11001100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 226 0xe2 'â' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0xc0, /* 11000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 227 0xe3 'ã' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 228 0xe4 'ä' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0xc6, /* 11000110 */
+	0x60, /* 01100000 */
+	0x30, /* 00110000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0xc6, /* 11000110 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 229 0xe5 'å' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7e, /* 01111110 */
+	0xd8, /* 11011000 */
+	0xd8, /* 11011000 */
+	0xd8, /* 11011000 */
+	0xd8, /* 11011000 */
+	0xd8, /* 11011000 */
+	0x70, /* 01110000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 230 0xe6 'æ' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x7c, /* 01111100 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0xc0, /* 11000000 */
+	0x00, /* 00000000 */
+
+	/* 231 0xe7 'ç' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x76, /* 01110110 */
+	0xdc, /* 11011100 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 232 0xe8 'è' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7e, /* 01111110 */
+	0x18, /* 00011000 */
+	0x3c, /* 00111100 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x3c, /* 00111100 */
+	0x18, /* 00011000 */
+	0x7e, /* 01111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 233 0xe9 'é' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xfe, /* 11111110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x6c, /* 01101100 */
+	0x38, /* 00111000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 234 0xea 'ê' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0xee, /* 11101110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 235 0xeb 'ë' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x1e, /* 00011110 */
+	0x30, /* 00110000 */
+	0x18, /* 00011000 */
+	0x0c, /* 00001100 */
+	0x3e, /* 00111110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x66, /* 01100110 */
+	0x3c, /* 00111100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 236 0xec 'ì' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7e, /* 01111110 */
+	0xdb, /* 11011011 */
+	0xdb, /* 11011011 */
+	0xdb, /* 11011011 */
+	0x7e, /* 01111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 237 0xed 'í' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x03, /* 00000011 */
+	0x06, /* 00000110 */
+	0x7e, /* 01111110 */
+	0xdb, /* 11011011 */
+	0xdb, /* 11011011 */
+	0xf3, /* 11110011 */
+	0x7e, /* 01111110 */
+	0x60, /* 01100000 */
+	0xc0, /* 11000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 238 0xee 'î' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x1c, /* 00011100 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x7c, /* 01111100 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x60, /* 01100000 */
+	0x30, /* 00110000 */
+	0x1c, /* 00011100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 239 0xef 'ï' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7c, /* 01111100 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0xc6, /* 11000110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 240 0xf0 'ð' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0xfe, /* 11111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 241 0xf1 'ñ' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x7e, /* 01111110 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7e, /* 01111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 242 0xf2 'ò' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x30, /* 00110000 */
+	0x18, /* 00011000 */
+	0x0c, /* 00001100 */
+	0x06, /* 00000110 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x00, /* 00000000 */
+	0x7e, /* 01111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 243 0xf3 'ó' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x30, /* 00110000 */
+	0x60, /* 01100000 */
+	0x30, /* 00110000 */
+	0x18, /* 00011000 */
+	0x0c, /* 00001100 */
+	0x00, /* 00000000 */
+	0x7e, /* 01111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 244 0xf4 'ô' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x0e, /* 00001110 */
+	0x1b, /* 00011011 */
+	0x1b, /* 00011011 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+
+	/* 245 0xf5 'õ' */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0xd8, /* 11011000 */
+	0xd8, /* 11011000 */
+	0xd8, /* 11011000 */
+	0x70, /* 01110000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 246 0xf6 'ö' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x7e, /* 01111110 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 247 0xf7 '÷' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x76, /* 01110110 */
+	0xdc, /* 11011100 */
+	0x00, /* 00000000 */
+	0x76, /* 01110110 */
+	0xdc, /* 11011100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 248 0xf8 'ø' */
+	0x00, /* 00000000 */
+	0x38, /* 00111000 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0x38, /* 00111000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 249 0xf9 'ù' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 250 0xfa 'ú' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x18, /* 00011000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 251 0xfb 'û' */
+	0x00, /* 00000000 */
+	0x0f, /* 00001111 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0x0c, /* 00001100 */
+	0xec, /* 11101100 */
+	0x6c, /* 01101100 */
+	0x6c, /* 01101100 */
+	0x3c, /* 00111100 */
+	0x1c, /* 00011100 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 252 0xfc 'ü' */
+	0x00, /* 00000000 */
+	0x6c, /* 01101100 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x36, /* 00110110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 253 0xfd 'ý' */
+	0x00, /* 00000000 */
+	0x3c, /* 00111100 */
+	0x66, /* 01100110 */
+	0x0c, /* 00001100 */
+	0x18, /* 00011000 */
+	0x32, /* 00110010 */
+	0x7e, /* 01111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 254 0xfe 'þ' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x7e, /* 01111110 */
+	0x7e, /* 01111110 */
+	0x7e, /* 01111110 */
+	0x7e, /* 01111110 */
+	0x7e, /* 01111110 */
+	0x7e, /* 01111110 */
+	0x7e, /* 01111110 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+	/* 255 0xff 'ÿ' */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+	0x00, /* 00000000 */
+
+};
+
+char* font_get(int c)
+{
+	return &fontdata_8x16[c * 16];
+}

Added: branches/vendor/emile/second/head.S
===================================================================
--- branches/vendor/emile/second/head.S	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/head.S	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,111 @@
+/*
+ *
+ * (c) 2004, 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+	.chip 68000
+
+.macro SysError
+	.short 0xA9C9
+.endm
+
+.macro NewPtrClear
+        .short 0xA31E
+.endm
+
+.equ	paramstring_length, 1024
+
+/***************************************************************************
+ *
+ * second level arguments 
+ *
+ ***************************************************************************/
+
+_start:			bra	setup
+_signature:		.dc.b	'E','M','0','6'
+
+/* EM06 */
+
+_conf_size:		.dc.w	paramstring_length
+_configuration:		.skip	paramstring_length, 0
+
+	.align	4
+setup:
+	/* relocate C code, need to be compiled with -fpic */
+
+	bsr	relocate
+
+	/* initialize console, so we can debug ;-) */
+
+	lea	_start(%pc), %a0
+	move.l	%a0, -(%sp)
+	bsr	console_init at PLTPC
+
+	/* begin to work */
+
+	lea	_start(%pc), %a0
+	move.l	%a0, -(%sp)
+	bsr	start at PLTPC
+
+	/* We guess to never come here */
+loop:
+	bra	loop
+
+relocate:
+	/* Allocate BSS section */
+
+	move.l	#__bss_size, %d0	/* size */
+	/* Alloc and clear memory (needed by GCC 3) */
+	NewPtrClear			/* result in %a0 */
+	move.l	%a0, %d0
+	bne	malloc_ok
+	SysError
+malloc_ok:
+	move.l	%a0,%d3
+	move.l	#__bss_start, %d0
+	sub.l	%d0,%d3			/* %d3 is the offset to add for BSS */
+
+	/* real address of GOT */
+
+	lea	_GLOBAL_OFFSET_TABLE_-.-8,%a0
+	lea	(%pc, %a0), %a0
+
+	/* linked address of GOT */
+
+	move.l	#_GLOBAL_OFFSET_TABLE_, %d0
+
+	/* %d2 is the offset to add for all other sections */
+
+	move.l	%a0,%d2
+	sub.l	%d0,%d2
+
+	/* relocate BSS section */
+
+	move.l	#__got_size, %d0
+	beq	exit_relocate
+
+got_loop:
+	move.l	(%a0), %d1
+
+	cmp.l	#__bss_start.l, %d1
+	blt	other_section
+	cmp.l	#_end.l, %d1
+	bgt	other_section
+
+	/* symbol in section BSS */
+
+	add.l	%d3, %d1
+	bra	got_store
+
+other_section:
+	add.l	%d2, %d1
+
+got_store:
+	move.l	%d1, (%a0)+
+
+	subq.l	#4, %d0
+	bgt	got_loop
+
+exit_relocate:
+	rts

Added: branches/vendor/emile/second/head.h
===================================================================
--- branches/vendor/emile/second/head.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/head.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,65 @@
+/*
+ *
+ * (c) 2004, 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __HEAD_H__
+#define __HEAD_H__
+
+/*
+ * WARNING: remember that m68k is big endian, like powerPC.
+ *	    i386 is little-endian
+ */
+
+typedef struct emile_l2_header emile_l2_header_t;
+
+struct emile_l2_header {
+	/* EM01 */
+
+	u_int32_t	entry;
+	u_int32_t	signature;
+
+	/* EMO4 addendum: if kernel_image_size == 0,
+	 *		  kernel_image_offset is a pointer to a container
+	 * EM05 addendum: if kernel_image_size == kernel_size
+	 * 		  kernel is not compressed
+	 * EM06 addendum: configuration is now in string configuration
+	 */
+
+	/* EM06 */
+
+	u_int16_t	conf_size;
+	int8_t		configuration[0];
+
+	/*
+	 * gestaltID <digit>
+	 * modem <bitrate><parity><bits>	parity is n/o/e
+	 * printer <bitrate><parity><bits>
+	 * kernel <protocol>:<unit>/<path>
+	 * 	<protocol> is "iso9660", "container", "block" ...
+	 *	<unit> is "(fd0)", "(sd3)", "(sd0,4)",...
+	 *	<path> is "boot/vmlinuz-2.2.25", "/install/mac/vmlinuz-2.2.25", 
+	 *	"59904", "673280,654848",...
+	 * parameters <kernel parameters>
+	 * initrd <protocol>:<unit>/<path>
+	 * configuration <protocol>:<unit>/<path>
+	 */
+}  __attribute__((packed));
+
+#define EMILE_ID_MASK		0xFFF0
+#define EMILE_VERSION_MASK	0x000F
+
+#define EMILE_ID(a)		((a) & EMILE_ID_MASK)
+#define EMILE_VERSION(a)	((a) & EMILE_VERSION_MASK)
+
+#define EMILE_01_SIGNATURE	(('E'<<24)|('M'<<16)|('0'<<8)|'1')
+#define EMILE_02_SIGNATURE	(('E'<<24)|('M'<<16)|('0'<<8)|'2')
+#define EMILE_03_SIGNATURE	(('E'<<24)|('M'<<16)|('0'<<8)|'3')
+#define EMILE_04_SIGNATURE	(('E'<<24)|('M'<<16)|('0'<<8)|'4')
+#define EMILE_05_SIGNATURE	(('E'<<24)|('M'<<16)|('0'<<8)|'5')
+#define EMILE_06_SIGNATURE	(('E'<<24)|('M'<<16)|('0'<<8)|'6')
+
+#define EMILE_COMPAT(a,b)	( ( EMILE_ID(a) == EMILE_ID(b) ) && \
+				  ( EMILE_VERSION(a) <= EMILE_VERSION(b) ) )
+#endif /* __HEAD_H__ */

Added: branches/vendor/emile/second/keyboard.c
===================================================================
--- branches/vendor/emile/second/keyboard.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/keyboard.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,366 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+
+#include <macos/lowmem.h>
+#include <macos/events.h>
+
+#include "misc.h"
+#include "keyboard.h"
+#include "vga.h"
+
+#define test_bit(n,m)	(((char*)(m))[(n) / 8] & (1L << (n % 8)))
+
+typedef struct keyboard_map {
+	char character;
+	char shift;
+	char control;
+} keyboard_map_t;
+
+static keyboard_map_t symbols[scancode_Last] = {
+	{ 'a', 'A', 0x01 },	/* 00 scancode_A */
+	{ 's', 'S', 0x13 },	/* 01 scancode_S */
+	{ 'd', 'D', 0x04 },	/* 02 scancode_D */
+	{ 'f', 'F', 0x06 },	/* 03 scancode_F */
+	{ 'h', 'H', 0x08 },	/* 04 scancode_H */
+	{ 'g', 'G', 0x07 },	/* 05 scancode_G */
+	{ 'z', 'Z', 0x1a },	/* 06 scancode_Z */
+	{ 'x', 'X', 0x18 },	/* 07 scancode_X */
+	{ 'c', 'C', 0x03 },	/* 08 scancode_C */
+	{ 'v', 'V', 0x16 },	/* 09 scancode_V */
+	{ 0, 0, 0 },		/* 0a ? */
+	{ 'b', 'B', 0x02 },	/* 0b scancode_B */
+	{ 'q', 'Q', 0x11 },	/* 0c scancode_Q */
+	{ 'w', 'W', 0x17 },	/* 0d scancode_W */
+	{ 'e', 'E', 0x05 },	/* 0e scancode_E */
+	{ 'r', 'R', 0x12 },	/* 0f scancode_R */
+	{ 'y', 'Y', 0x19 },	/* 10 scancode_Y */
+	{ 't', 'T', 0x14 },	/* 11 scancode_T */
+	{ '1', '!', 0 },	/* 12 scancode_1 */
+	{ '2', '@', 0 },	/* 13 scancode_2 */
+	{ '3', '#', 0 },	/* 14 scancode_3 */
+	{ '4', '$', 0 },	/* 15 scancode_4 */
+	{ '6', '^', 0x1e },	/* 16 scancode_6 */
+	{ '5', '%', 0 },	/* 17 scancode_5 */
+	{ '=', '=', 0 },	/* 18 scancode_Equals */
+	{ '9', '(', 0 },	/* 19 scancode_9 */
+	{ '7', '&', 0 },	/* 1a scancode_7 */
+	{ '-', '_', 0x1f },	/* 1b scancode_Minus */
+	{ '8', '*', 0 },	/* 1c scancode_8 */
+	{ '0', ')', 0 },	/* 1d scancode_0 */
+	{ ']', '}', 0x1d },	/* 1e scancode_CloseBrace */
+	{ 'o', 'O', 0x0f },	/* 1f scancode_O */
+	{ 'u', 'U', 0x15 },	/* 20 scancode_U */
+	{ '[', '{', 0x1b },	/* 21 scancode_OpenBrace */
+	{ 'i', 'I', 0x09 },	/* 22 scancode_I */
+	{ 'p', 'P', 0x10 },	/* 23 scancode_P */
+	{ '\r', '\r', 0 },	/* 24 scancode_Return */
+	{ 'l', 'L', 0x0c },	/* 25 scancode_L */
+	{ 'j', 'J', 0x0a },	/* 26 scancode_J */
+	{ '\'', '"', 0 },	/* 27 scancode_Quote */
+	{ 'k', 'K', 0x0b },	/* 28 scancode_K */
+	{ ';', ':', 0 },	/* 29 scancode_Colon */
+	{ '\\', '|', 0x1c },	/* 2a scancode_Backslash */
+	{ ',', '<', 0 },	/* 2b scancode_Comma */
+	{ '/', '?', 0 },	/* 2c scancode_Comma */
+	{ 'n', 'N', 0x0e },	/* 2d scancode_N */
+	{ 'm', 'M', 0x0d },	/* 2e scancode_M */
+	{ 0, 0, 0 },		/* 2f scancode_Stop */
+	{ '\t', '\t', 0 },	/* 30 scancode_Tab */
+	{ ' ', ' ', 0 },	/* 31 scancode_Space */
+	{ '`', '~', 0 },	/* 32 scancode_Tilde */
+	{ '\b', '\b', 0 },	/* 33 scancode_Backspace */
+	{ 0, 0, 0 },		/* 34 ? */
+	{ 0x1b, 0, 0 },		/* 35 scancode_Escape */
+	{ 0, 0, 0 },		/* 36 ? */
+	{ 0, 0, 0 },		/* 37 scancode_Command */
+	{ 0, 0, 0 },		/* 38 scancode_LeftShift */
+	{ 0, 0, 0 },		/* 39 scancode_CapsLock */
+	{ 0, 0, 0 },		/* 3a scancode_LeftOption */
+	{ 0, 0, 0 },		/* 3b scancode_LeftControl */
+	{ 0, 0, 0 },		/* 3c scancode_RightShift */
+	{ 0, 0, 0 },		/* 3d scancode_RightOption */
+	{ 0, 0, 0 },		/* 3e scancode_RightControl */
+	{ 0, 0, 0 },		/* 3f ? */
+	{ 0, 0, 0 },		/* 40 ? */
+	{ 0, 0, 0 },		/* 41 scancode_KeypadStop */
+	{ 0, 0, 0 },		/* 42 ? */
+	{ '*', '*', 0 },	/* 43 scancode_KeypadAsterisk */
+	{ 0, 0, 0 },		/* 44 ? */
+	{ '+', '+', 0 },	/* 45 scancode_KeypadPlus */
+	{ 0, 0, 0 },		/* 46 ? */
+	{ 0, 0, 0 },		/* 47 scancode_NumLock */
+	{ 0, 0, 0 },		/* 48 ? */
+	{ 0, 0, 0 },		/* 49 ? */
+	{ 0, 0, 0 },		/* 4a ? */
+	{ '/', '/', 0 },	/* 4b scancode_KeypadSlash */
+	{ '\r', '\r', 0 },	/* 4c scancode_KeypadEnter */
+	{ 0, 0, 0 },		/* 4d ? */
+	{ '-', '-', 0 },	/* 4e scancode_KeypadSlash */
+	{ 0, 0, 0 },		/* 4f ? */
+	{ 0, 0, 0 },		/* 50 ? */
+	{ '=', '=', 0 },	/* 51 scancode_KeypadEquals */
+	{ '0', '0', 0 },	/* 52 scancode_Keypad0 */
+	{ '1', '1', 0 },	/* 53 scancode_Keypad1 */
+	{ '2', '2', 0 },	/* 54 scancode_Keypad2 */
+	{ '3', '3', 0 },	/* 55 scancode_Keypad3 */
+	{ '4', '4', 0 },	/* 56 scancode_Keypad4 */
+	{ '5', '5', 0 },	/* 57 scancode_Keypad5 */
+	{ '6', '6', 0 },	/* 58 scancode_Keypad6 */
+	{ '7', '7', 0 },	/* 59 scancode_Keypad7 */
+	{ 0, 0, 0 },		/* 5a ? */
+	{ '8', '8', 0 },	/* 5b scancode_Keypad8 */
+	{ '9', '9', 0 },	/* 5c scancode_Keypad9 */
+	{ 0, 0, 0 },		/* 5d ? */
+	{ 0, 0, 0 },		/* 5e ? */
+	{ 0, 0, 0 },		/* 5f ? */
+	{ 0x1b, 0, 0 },		/* 60 scancode_F5 */
+	{ 0x1b, 0, 0 },		/* 61 scancode_F6 */
+	{ 0x1b, 0, 0 },		/* 62 scancode_F7 */
+	{ 0x1b, 0, 0 },		/* 63 scancode_F3 */
+	{ 0x1b, 0, 0 },		/* 64 scancode_F8 */
+	{ 0x1b, 0, 0 },		/* 65 scancode_F9 */
+	{ 0, 0, 0 },		/* 66 ? */
+	{ 0x1b, 0, 0 },		/* 67 scancode_F11 */
+	{ 0, 0, 0 },		/* 68 ? */
+	{ 0, 0, 0 },		/* 69 scancode_PrintScreen */
+	{ 0, 0, 0 },		/* 6a ? */
+	{ 0, 0, 0 },		/* 6b scancode_ScreenLock */
+	{ 0, 0, 0 },		/* 6c ? */
+	{ 0x1b, 0, 0 },		/* 6d scancode_F10 */
+	{ 0, 0, 0 },		/* 6e ? */
+	{ 0x1b, 0, 0 },		/* 6f scancode_F12 */
+	{ 0, 0, 0 },		/* 70 ? */
+	{ 0, 0, 0 },		/* 71 scancode_Pause */
+	{ 0x1b, 0, 0 },		/* 72 scancode_Insert */
+	{ 0x1b, 0, 0 },		/* 73 scancode_Home */
+	{ 0x1b, 0, 0 },		/* 74 scancode_PageUp */
+	{ 0x1b, 0, 0 },		/* 75 scancode_Del */
+	{ 0x1b, 0, 0 },		/* 76 scancode_F4 */
+	{ 0x1b, 0, 0 },		/* 77 scancode_End */
+	{ 0x1b, 0, 0 },		/* 78 scancode_F2 */
+	{ 0x1b, 0, 0 },		/* 79 scancode_PageDown */
+	{ 0x1b, 0, 0 },		/* 7a scancode_F1 */
+	{ 0x1b, 0, 0 },		/* 7b scancode_Left */
+	{ 0x1b, 0, 0 },		/* 7c scancode_Right */
+	{ 0x1b, 0, 0 },		/* 7d scancode_Down */
+	{ 0x1b, 0, 0 },		/* 7e scancode_Up */
+	{ 0, 0, 0 },		/* 7f ? */
+};
+
+#define BUFFER_SIZE	64
+static int head = 0;
+static int length = 0;
+static char buffer[BUFFER_SIZE];
+
+static inline void buffer_put(char c)
+{
+	buffer[(head + length) % BUFFER_SIZE] = c;
+	length++;
+}
+
+static inline int buffer_get(void)
+{
+	int c;
+
+	if (length == 0)
+		return 0;
+
+	c = buffer[head];
+	head = (head + 1) % BUFFER_SIZE;
+	length--;
+
+	return c;
+}
+
+static inline void buffer_putstring(char *s)
+{
+	if (!s)
+		return;
+
+	while(*s)
+		buffer_put(*s++);
+}
+
+void keyboard_get_scancode(int *modifiers, int *code)
+{
+	KeyMap keyboard= {0,0,0,0};
+	int scancode;
+
+	GetKeys(keyboard);
+
+	/* modifier keys */
+
+	*modifiers = 0;
+	if (test_bit(scancode_Command, keyboard))
+		*modifiers |= modifier_command;
+	if (test_bit(scancode_LeftShift, keyboard) ||
+	    test_bit(scancode_RightShift, keyboard))
+		*modifiers |= modifier_shift;
+	if (test_bit(scancode_CapsLock, keyboard))
+		*modifiers |= modifier_capslock;
+	if (test_bit(scancode_LeftOption, keyboard) ||
+	    test_bit(scancode_RightOption, keyboard))
+		*modifiers |= modifier_option;
+	if (test_bit(scancode_LeftControl, keyboard) ||
+	    test_bit(scancode_RightControl, keyboard))
+		*modifiers |= modifier_control;
+
+	/* other keys */
+
+	for (scancode = 0; scancode < scancode_Last; scancode++)
+	{
+		/* modifiers */
+
+		if ( (scancode == scancode_Command) ||
+		     (scancode == scancode_LeftShift) ||
+		     (scancode == scancode_RightShift) ||
+		     (scancode == scancode_CapsLock) ||
+		     (scancode == scancode_LeftOption) ||
+		     (scancode == scancode_RightOption) ||
+		     (scancode == scancode_LeftControl) ||
+		     (scancode == scancode_RightControl) )
+			continue;
+
+		/* other keys */
+
+		if (test_bit(scancode, keyboard))
+			break;
+	}
+	*code = scancode;
+}
+
+int keyboard_convert_scancode(int modifiers, int scancode)
+{
+	int c;
+
+	if ((modifiers & modifier_shift) || 
+	    (modifiers & modifier_capslock))
+	{
+		c = symbols[scancode].shift;
+	} else if (modifiers & modifier_control)
+	{
+		c = symbols[scancode].control;
+	} else
+	{
+		c = symbols[scancode].character;
+	}
+
+	return c;
+}
+
+static int keyboard_catch()
+{
+	static long last_KeyTime = -1;
+	long current_keytime = KeyTime;
+	int modifiers, scancode;
+	int c;
+
+	keyboard_get_scancode(&modifiers, &scancode);
+
+	if (current_keytime != last_KeyTime)
+	{
+		last_KeyTime = current_keytime;
+
+		c = keyboard_convert_scancode(modifiers, scancode);
+
+		if (c == 0x1b)
+		{
+			buffer_put(0x1b);
+			switch(scancode)
+			{
+				case scancode_F5:
+					buffer_putstring("[15~");
+					break;
+				case scancode_F6:
+					buffer_putstring("[17~");
+					break;
+				case scancode_F7:
+					buffer_putstring("[18~");
+					break;
+				case scancode_F3:
+					buffer_putstring("OR");
+					break;
+				case scancode_F8:
+					buffer_putstring("[19~");
+					break;
+				case scancode_F9:
+					buffer_putstring("[20~");
+					break;
+				case scancode_F11:
+					buffer_putstring("[23~");
+					break;
+				case scancode_F10:
+					buffer_putstring("[21~");
+					break;
+				case scancode_F12:
+					buffer_putstring("[24~");
+					break;
+				case scancode_Insert:
+					buffer_putstring("[2~");
+					break;
+				case scancode_Home:
+					buffer_putstring("[1~");
+					break;
+				case scancode_PageUp:
+					buffer_putstring("[5~");
+					break;
+				case scancode_Del:
+					buffer_putstring("[3~");
+					break;
+				case scancode_F4:
+					buffer_putstring("OS");
+					break;
+				case scancode_End:
+					buffer_putstring("[4~");
+					break;
+				case scancode_F2:
+					buffer_putstring("OQ");
+					break;
+				case scancode_PageDown:
+					buffer_putstring("[6~");
+					break;
+				case scancode_F1:
+					buffer_putstring("OP");
+					break;
+				case scancode_Left:
+					buffer_putstring("[D");
+					break;
+				case scancode_Right:
+					buffer_putstring("[C");
+					break;
+				case scancode_Down:
+					buffer_putstring("[B");
+					break;
+				case scancode_Up:
+					buffer_putstring("[A");
+					break;
+			}
+		}
+		else if (c != 0)
+			buffer_put(c);
+	}
+
+	vga_cursor_refresh();
+
+	if (modifiers || (scancode < scancode_Last - 1))
+		return 1;
+
+	return 0;
+}
+
+int keyboard_keypressed()
+{
+	return keyboard_catch();
+}
+
+int keyboard_getchar()
+{
+	keyboard_catch();
+
+	return buffer_get();
+}

Added: branches/vendor/emile/second/keyboard.h
===================================================================
--- branches/vendor/emile/second/keyboard.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/keyboard.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,128 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+
+typedef enum modifiers_mask {
+	modifier_shift		= 0x01,
+	modifier_capslock	= 0x02,
+	modifier_command	= 0x04,
+	modifier_option		= 0x08,
+	modifier_control	= 0x10,
+} modifiers_mask;
+
+typedef enum scancodes {
+	scancode_A		= 0x00,
+	scancode_S		= 0x01,
+	scancode_D		= 0x02,
+	scancode_F		= 0x03,
+	scancode_H		= 0x04,
+	scancode_G		= 0x05,
+	scancode_Z		= 0x06,
+	scancode_X		= 0x07,
+	scancode_C		= 0x08,
+	scancode_V		= 0x09,
+	scancode_B		= 0x0b,
+	scancode_Q		= 0x0c,
+	scancode_W		= 0x0d,
+	scancode_E		= 0x0e,
+	scancode_R		= 0x0f,
+	scancode_Y		= 0x10,
+	scancode_T		= 0x11,
+	scancode_1		= 0x12,
+	scancode_2		= 0x13,
+	scancode_3		= 0x14,
+	scancode_4		= 0x15,
+	scancode_6		= 0x16,
+	scancode_5		= 0x17,
+	scancode_Equals          = 0x18,
+	scancode_9		= 0x19,
+	scancode_7		= 0x1a,
+	scancode_Minus           = 0x1b,
+	scancode_8		= 0x1c,
+	scancode_0		= 0x1d,
+	scancode_CloseBrace      = 0x1e,
+	scancode_O		= 0x1F,
+	scancode_U		= 0x20,
+	scancode_OpenBrace       = 0x21,
+	scancode_I		= 0x22,
+	scancode_P		= 0x23,
+	scancode_Return		= 0x24,
+	scancode_L		= 0x25,
+	scancode_J		= 0x26,
+	scancode_Quote           = 0x27,
+	scancode_K		= 0x28,
+	scancode_Colon           = 0x29,
+	scancode_Backslash       = 0x2a,
+	scancode_Comma           = 0x2b,
+	scancode_Slash           = 0x2c,
+	scancode_N		= 0x2d,
+	scancode_M		= 0x2e,
+	scancode_Stop		= 0x2f,
+	scancode_Tab		= 0x30,
+	scancode_Space		= 0x31,
+	scancode_Tilde		= 0x32,
+	scancode_Backspace	= 0x33,
+	scancode_Escape		= 0x35,
+	scancode_Command		= 0x37,
+	scancode_LeftShift	= 0x38,
+	scancode_CapsLock	= 0x39,
+	scancode_LeftOption	= 0x3a,
+	scancode_LeftControl	= 0x3b,
+	scancode_RightShift	= 0x3c,
+	scancode_RightOption	= 0x3d,
+	scancode_RightControl	= 0x3e,
+	scancode_KeypadStop	= 0x41,
+	scancode_KeypadAsterisk  = 0x43,
+	scancode_KeypadPlus      = 0x45,
+	scancode_NumLock		= 0x47,
+	scancode_KeypadSlash     = 0x4B,
+	scancode_KeypadEnter	= 0x4C,
+	scancode_KeypadMinus     = 0x4E,
+	scancode_KeypadEquals	= 0x51,
+	scancode_Keypad0		= 0x52,
+	scancode_Keypad1		= 0x53,
+	scancode_Keypad2		= 0x54,
+	scancode_Keypad3		= 0x55,
+	scancode_Keypad4		= 0x56,
+	scancode_Keypad5		= 0x57,
+	scancode_Keypad6		= 0x58,
+	scancode_Keypad7		= 0x59,
+	scancode_Keypad8		= 0x5b,
+	scancode_Keypad9		= 0x5c,
+	scancode_F5		= 0x60,
+	scancode_F6		= 0x61,
+	scancode_F7		= 0x62,
+	scancode_F3		= 0x63,
+	scancode_F8		= 0x64,
+	scancode_F9		= 0x65,
+	scancode_F11		= 0x67,
+	scancode_PrintScreen	= 0x69,
+	scancode_ScreenLock	= 0x6b,
+	scancode_F10		= 0x6d,
+	scancode_F12		= 0x6f,
+	scancode_Pause		= 0x71,
+	scancode_Insert		= 0x72,
+	scancode_Home		= 0x73,
+	scancode_PageUp		= 0x74,
+	scancode_Del		= 0x75,
+	scancode_F4		= 0x76,
+	scancode_End		= 0x77,
+	scancode_F2		= 0x78,
+	scancode_PageDown	= 0x79,
+	scancode_F1		= 0x7a,
+	scancode_Left		= 0x7b,
+	scancode_Right		= 0x7c,
+	scancode_Down		= 0x7d,
+	scancode_Up		= 0x7e,
+
+
+	scancode_Last		= 0x80,
+} scancodes_t;
+
+extern void keyboard_get_scancode(int *modifiers, int *code);
+extern int keyboard_convert_scancode(int modifiers, int scancode);
+extern int keyboard_keypressed(void);
+extern int keyboard_getchar();

Added: branches/vendor/emile/second/ld.script
===================================================================
--- branches/vendor/emile/second/ld.script	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/ld.script	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,92 @@
+OUTPUT_ARCH(m68k)
+SECTIONS
+{
+  .text           :
+  {
+    __bootloader_start = .;
+    *(.text .stub .text.* .gnu.linkonce.t.*)
+    *(.gnu.warning)
+  } =0x4e754e75
+  .hash           : { *(.hash) }
+  .dynsym         : { *(.dynsym) }
+  .dynstr         : { *(.dynstr) }
+  .rel.dyn        :
+    {
+      *(.rel.init)
+      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
+      *(.rel.fini)
+      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
+      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
+      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
+      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
+      *(.rel.ctors)
+      *(.rel.dtors)
+      *(.rel.got)
+      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
+    }
+  .rela.dyn       :
+    {
+      *(.rela.init)
+      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
+      *(.rela.fini)
+      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
+      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
+      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
+      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
+      *(.rela.ctors)
+      *(.rela.dtors)
+      *(.rela.got)
+      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
+    }
+  .rel.plt        : { *(.rel.plt) }
+  .rela.plt       : { *(.rela.plt) }
+  .init           :
+  {
+    KEEP (*(.init))
+  } =0x4e754e75
+  .plt            : { *(.plt) }
+  .fini           :
+  {
+    KEEP (*(.fini))
+  } =0x4e754e75
+  PROVIDE (__etext = .);
+  PROVIDE (_etext = .);
+  PROVIDE (etext = .);
+  .rodata         : {
+    *(.rodata .rodata.* .gnu.linkonce.r.*)
+  }
+  .rodata1        : { *(.rodata1) }
+  .eh_frame_hdr : { *(.eh_frame_hdr) }
+  . = ALIGN(0x2000) + (. & (0x2000 - 1));
+  . = ALIGN(32 / 8);
+  .preinit_array     : { *(.preinit_array) }
+  .init_array     : { *(.init_array) }
+  .fini_array     : { *(.fini_array) }
+  .data           :
+  {
+    *(.data .data.* .gnu.linkonce.d.*)
+    SORT(CONSTRUCTORS)
+  }
+  .data1          : { *(.data1) }
+  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
+  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
+  .eh_frame       : { KEEP (*(.eh_frame)) }
+  .gcc_except_table   : { *(.gcc_except_table) }
+  .dynamic        : { *(.dynamic) }
+  .got            : { *(.got.plt) *(.got) }
+  __got_size = . - _GLOBAL_OFFSET_TABLE_;
+  _edata = .;
+  PROVIDE (edata = .);
+  __bss_start = .;
+  .bss            :
+  {
+   *(.dynbss)
+   *(.bss .bss.* .gnu.linkonce.b.*)
+   *(COMMON)
+   . = ALIGN(32 / 8);
+  }
+  . = ALIGN(32 / 8);
+  __bss_size = . - __bss_start;
+  _end = .;
+  PROVIDE (end = .);
+}

Added: branches/vendor/emile/second/load.c
===================================================================
--- branches/vendor/emile/second/load.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/load.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,198 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#define __NO_INLINE__
+
+#include <stdio.h>
+#include <malloc.h>
+#include <elf.h>
+#include <string.h>
+
+#include <macos/types.h>
+#include <macos/devices.h>
+#include <libstream.h>
+
+#include "console.h"
+#include "bank.h"
+#include "misc.h"
+
+#include "load.h"
+
+#define PAGE_SHIFT      12
+#define PAGE_SIZE       (1UL << PAGE_SHIFT)
+
+#define BAR_STEP	40
+
+static int bar_read(stream_t *stream, char*buffer, int size, 
+		    int current, int total_size)
+{
+	int read = 0;
+	int blksize = (total_size + BAR_STEP - 1) / BAR_STEP;
+	int ret;
+
+	console_cursor_restore();
+	printf(" %d %%", ((current + read) * 100 + total_size / 2) / total_size);
+	while (size)
+	{
+		if (blksize > size)
+			blksize = size;
+		ret = stream_read(stream, buffer, blksize);
+		read += ret;
+		if (ret != blksize)
+			break;
+		console_cursor_restore();
+		printf("#");
+		console_cursor_save();
+		printf(" %d %%", ((current + read) * 100 + total_size / 2) / total_size);
+		buffer += ret;
+		size -= ret;
+	}
+	console_cursor_restore();
+	printf(" %d %%", ((current + read) * 100 + total_size / 2) / total_size);
+
+	return read;
+}
+
+char* load_kernel(char* path, int bootstrap_size,
+		  unsigned long *base, unsigned long *entry, unsigned long *size)
+{
+	Elf32_Ehdr elf_header;
+	Elf32_Phdr *program_header;
+	int ret;
+	unsigned long min_addr, max_addr, kernel_size;
+	int i;
+	char *kernel;
+	stream_t *stream;
+	int read;
+	int to_read;
+
+	printf("Loading kernel  ");
+
+	stream = stream_open(path);
+	if (stream == NULL)
+		return NULL;
+
+	stream_uncompress(stream);
+
+	ret = stream_read(stream, &elf_header, sizeof(Elf32_Ehdr));
+	if (ret != sizeof(Elf32_Ehdr))
+		error("Cannot read\n");
+
+	if  (elf_header.e_machine != EM_68K)
+	{
+		printf( "Not MC680x0 architecture\n");
+		return NULL;
+	}
+
+	if (elf_header.e_type != ET_EXEC)
+	{
+		printf( "Not an executable file\n");
+		return NULL;
+	}
+
+	program_header = (Elf32_Phdr *)malloc(elf_header.e_phnum *
+					      sizeof (Elf32_Phdr));
+	if (program_header == NULL)
+	{
+		printf( "Cannot allocate memory\n");
+		return NULL;
+	}
+
+	ret = stream_lseek(stream, elf_header.e_phoff, SEEK_SET);
+
+	ret = stream_read(stream, program_header, elf_header.e_phnum * sizeof(Elf32_Phdr));
+
+	min_addr = 0xffffffff;
+	max_addr = 0;
+	to_read = 0;
+	for (i = 0; i < elf_header.e_phnum; i++)
+	{
+		min_addr = (min_addr > program_header[i].p_vaddr) ?
+				program_header[i].p_vaddr : min_addr;
+		max_addr = (max_addr < program_header[i].p_vaddr + program_header[i].p_memsz) ?
+				program_header[i].p_vaddr + program_header[i].p_memsz: max_addr;
+		to_read += program_header[i].p_filesz;
+	}
+	if (min_addr == 0)
+	{
+		min_addr = PAGE_SIZE;
+		program_header[0].p_vaddr += PAGE_SIZE;
+		program_header[0].p_offset += PAGE_SIZE;
+		program_header[0].p_filesz -= PAGE_SIZE;
+		program_header[0].p_memsz -= PAGE_SIZE;
+	}
+	kernel_size = max_addr - min_addr;
+
+	*base = min_addr;
+	*entry = elf_header.e_entry;
+	*size = kernel_size;
+
+	kernel = (char*)malloc_contiguous(kernel_size + 4 + bootstrap_size);
+	kernel = (unsigned char*)(((unsigned long)kernel + 3) & 0xFFFFFFFC);
+	if (!check_full_in_bank((unsigned long)kernel, kernel_size))
+		error("Kernel between two banks, contact maintainer\n");
+
+	memset(kernel, 0, kernel_size);
+	read = 0;
+	console_cursor_save();
+	for (i = 0; i < elf_header.e_phnum; i++)
+	{
+		ret = stream_lseek(stream, program_header[i].p_offset, SEEK_SET);
+		if (ret != program_header[i].p_offset)
+		{
+			error("Cannot seek");
+		}
+		ret = bar_read( stream, 
+				kernel + program_header[i].p_vaddr - PAGE_SIZE,
+				program_header[i].p_filesz,
+				read, to_read);
+		if (ret != program_header[i].p_filesz)
+		{
+			printf("Read %d instead of %d\n", 
+					ret, program_header[i].p_filesz);
+			error("Cannot load");
+		}
+		read += ret;
+	}
+	putchar('\n');
+	
+	ret = stream_close(stream);
+
+	return kernel;
+}
+
+char *load_ramdisk(char* path, unsigned long *ramdisk_size)
+{
+	stream_t *stream;
+	char *ramdisk_start;
+	struct stream_stat stat;
+	int ret;
+
+	stream = stream_open(path);
+	if (stream == NULL)
+		return NULL;
+
+	stream_fstat(stream, &stat);
+
+	ramdisk_start = (char*)malloc_top(stat.st_size + 4);
+	ramdisk_start = (char*)(((unsigned long)ramdisk_start + 3) & 0xFFFFFFFC);
+
+	if (!check_full_in_bank((unsigned long)ramdisk_start, stat.st_size))
+		error("ramdisk between two banks, contact maintainer\n");
+
+	printf("Loading RAMDISK ");
+
+	console_cursor_save();
+	ret = bar_read(stream, ramdisk_start, stat.st_size, 0, stat.st_size);
+	putchar('\n');
+	if (ret != stat.st_size)
+		error("Cannot load");
+	stream_close(stream);
+
+	*ramdisk_size = stat.st_size;
+
+	return ramdisk_start;
+}

Added: branches/vendor/emile/second/load.h
===================================================================
--- branches/vendor/emile/second/load.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/load.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,8 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+                                                                                
+extern char* load_kernel(char* path, int bootstrap_size, unsigned long *base, unsigned long *entry, unsigned long *size);
+extern char* load_ramdisk(char* path, unsigned long *ramdisk_size);

Added: branches/vendor/emile/second/main.c
===================================================================
--- branches/vendor/emile/second/main.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/main.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,286 @@
+/*
+ *
+ * (c) 2004-2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#define __NO_INLINE__
+
+#include <stdio.h>
+#include <malloc.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <macos/types.h>
+#include <macos/gestalt.h>
+
+#include "bank.h"
+#include "memory.h"
+#if defined(ARCH_M68K)
+#if defined(__LINUX__)
+#include "bootinfo.h"
+#elif defined(__NETBSD__)
+#include "bootenv.h"
+#endif
+#endif
+#ifdef ARCH_PPC
+#include "bootx.h"
+#endif
+#include "arch.h"
+#include "misc.h"
+#include "load.h"
+#include "console.h"
+#include "vga.h"
+#include "driver.h"
+#include "config.h"
+
+#include "enter_kernel.h"
+
+#ifdef ARCH_M68K
+#define KERNEL_ALIGN	(256L * 1024L)	// Kernel alignment, on 256K boundary
+#if defined(__LINUX__)
+#define BI_ALLOC_SIZE	(4096L)		// Allocate 4K for bootinfo
+#elif defined(__NETBSD__)
+#define BI_ALLOC_SIZE	(4096L)
+#endif
+#endif
+
+
+int start(emile_l2_header_t* info)
+{
+	char * kernel;
+#ifdef ARCH_M68K
+	entry_t entry;
+	unsigned long physImage;
+#ifdef USE_MMU
+	unsigned long physical;
+#ifdef __LINUX__
+	unsigned long aligned_size;
+	unsigned long aligned_addr;
+#endif /* __LINUX__ */
+#endif /* USE_MMU */
+	unsigned long start_mem;
+	unsigned long entry_point;
+#endif /* ARCH_M68K */
+#ifdef ARCH_PPC
+	PPCRegisterList regs;
+#endif
+	int ret;
+	char *ramdisk_start;
+	int bootstrap_size;
+	unsigned long kernel_size;
+	unsigned long ramdisk_size;
+	char *kernel_path;
+	char *ramdisk_path;
+	char *command_line;
+
+	printf("EMILE v"VERSION" (c) 2004,2005 Laurent Vivier\n");
+
+	arch_init();
+
+	init_memory_map();
+
+#ifdef BANK_DUMP
+	bank_dump();
+#endif
+
+	printf("Available Memory: %ld kB\n", bank_mem_avail() / 1024);
+
+	enter_kernel_init();
+
+#ifdef ARCH_M68K
+	if (arch_type == gestalt68k)
+	{
+#if defined(__LINUX__)
+		/* and BI_ALLOC_SIZE for bootinfo */
+
+		bootstrap_size = BI_ALLOC_SIZE + 
+				 end_enter_kernel - enter_kernel;
+#elif defined(__NETBSD__)
+		bootstrap_size = BI_ALLOC_SIZE + 
+				 end_enter_kernel - enter_kernel;
+#endif
+	}
+#ifndef ARCH_PPC
+	else
+		error("EMILE doesn't support your architecture");
+#endif
+#endif
+
+	if (read_config(info, &kernel_path, &command_line, &ramdisk_path) != 0)
+		error("cannot read configuration\n");
+
+	/* load kernel */
+
+	kernel = load_kernel(kernel_path,
+			     bootstrap_size, 
+			     &start_mem, &entry_point, &kernel_size);
+	if (kernel == NULL)
+		error("Cannot load and uncompress kernel image\n");
+
+#ifdef ARCH_M68K
+	if (arch_type == gestalt68k)
+	{
+		unsigned long enter_size = end_enter_kernel - enter_kernel;
+
+		/* copy enter_kernel at end of kernel */
+
+		memcpy((char*)kernel +
+			kernel_size + bootstrap_size - enter_size,
+	       		(char*)enter_kernel, enter_size);
+
+		end_enter_kernel = (unsigned long)kernel + 
+				   kernel_size + bootstrap_size;
+		enter_kernel = (unsigned long)kernel + 
+			       bootstrap_size - enter_size + kernel_size;
+	}
+#endif
+
+	/* load ramdisk if needed */
+
+	if (ramdisk_path)
+	{
+		ramdisk_start = load_ramdisk(ramdisk_path, &ramdisk_size);
+		if (ramdisk_start == NULL)
+			error("Cannot open ramdisk\n");
+	}
+	else
+	{
+		ramdisk_start = 0;
+		printf("no RAMDISK\n");
+	}
+
+#ifdef ARCH_M68K
+	if (arch_type == gestalt68k)
+	{
+		/* compute final address of kernel */
+
+		if  (mmu_type == gestaltNoMMU)
+		{
+			unsigned long size = end_enter_kernel - enter_kernel;
+
+#if defined(__LINUX__)
+			/* initialize bootinfo structure */
+
+			bootinfo_init(command_line, 
+		      		ramdisk_start, ramdisk_size);
+
+			/* set bootinfo at end of kernel image */
+
+			set_kernel_bootinfo(kernel + kernel_size);
+
+			physImage = (unsigned long)kernel;
+#endif
+			entry = (entry_t)(start_mem - size);
+
+			printf("\n");
+			printf("Ok, booting the kernel.\n");
+
+			memcpy(entry, (char*)enter_kernel, size);
+		} else
+#ifndef USE_MMU
+			error("Unsupported MMU");
+#else
+		{
+			ret = logical2physical((unsigned long)kernel, &physImage);
+
+			/* disable and flush cache */
+
+			disable_cache();
+
+#if defined(__LINUX__)
+			/* initialize bootinfo structure */
+
+			bootinfo_init(command_line, 
+		      		ramdisk_start, ramdisk_size);
+
+			/* add KERNEL_ALIGN if we have to align */
+		 
+			aligned_size = boot_info.memory[0].addr & (KERNEL_ALIGN - 1);
+			if ( aligned_size > 0 )
+			{
+				aligned_size = KERNEL_ALIGN - aligned_size;
+				aligned_addr = boot_info.memory[0].addr + aligned_size;
+				aligned_size = boot_info.memory[0].size - aligned_size;
+				boot_info.memory[0].addr = aligned_addr;
+				boot_info.memory[0].size = aligned_size;
+			}
+
+			/* set bootinfo at end of kernel image */
+
+			set_kernel_bootinfo(kernel + kernel_size);
+
+#elif defined(__NETBSD__)
+			bootenv_init(kernel + kernel_size);
+#endif
+
+			printf("\n");
+			printf("Ok, booting the kernel.\n");
+
+			ret = logical2physical(enter_kernel, &physical);
+			entry = (entry_t)physical;
+
+			if ( (ret == 0) && (enter_kernel != (unsigned long)entry) )
+			{
+				unsigned long logi;
+				unsigned long size = end_enter_kernel - enter_kernel;
+
+				logi = vga_get_video();
+				ret = logical2physical(logi, &physical);
+				entry = (entry_t)physical;
+	
+				memcpy((char*)logi, (char*)enter_kernel, size);
+				memcpy((char*)entry, (char*)enter_kernel, size);
+			}
+		}
+#endif /* USE_MMU */
+	}
+	else
+#ifndef ARCH_PPC
+		error("EMILE doesn't support your architecture");
+#endif
+#endif /* ARCH_M68K */
+#ifdef ARCH_PPC
+	if (arch_type == gestaltPowerPC)
+	{
+		bootx_init(command_line, ramdisk_start, ramdisk_size);
+
+		regs.PC      = (u_int32_t)kernel;
+#define BOOT_KERNEL_STACK_SIZE 65536
+		regs.GPR[1]  = (u_int32_t)malloc_contiguous(BOOT_KERNEL_STACK_SIZE)
+				+ BOOT_KERNEL_STACK_SIZE - 512;
+		regs.GPR[2]  = 0;
+		regs.GPR[3]  = 'BooX';
+		regs.GPR[4]  = (u_int32_t)&bootx_infos;
+
+		/* Set up the info for BAT mapping on Nubus */
+
+		regs.GPR[5]  = vga_get_videobase() & 0xFF800000UL;
+		regs.GPR[11]  = 1;
+
+		printf("\n");
+		printf("Ok, booting the kernel.\n");
+	}
+	else
+		error("EMILE doesn't support your architecture");
+#endif
+
+	turn_off_interrupts();
+
+	 asm("ori.w #0x0700,%sr");
+
+	/* kick off */
+
+#ifdef ARCH_M68K
+	if (arch_type == gestalt68k)
+		entry(physImage, kernel_size + BI_ALLOC_SIZE, start_mem, entry_point);
+#endif
+#ifdef ARCH_PPC
+	if (arch_type == gestaltPowerPC)
+		enter_kernelPPC((unsigned long)kernel, &regs);
+#endif
+
+	error("Kernel startup failed");
+
+	return 0;
+}

Added: branches/vendor/emile/second/misc.c
===================================================================
--- branches/vendor/emile/second/misc.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/misc.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,72 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <string.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#include "misc.h"
+#include "console.h"
+
+unsigned char *c2pstring(char* s)
+{
+	int len = strlen(s);
+	int i;
+
+	for (i = len; i > 0; i--)
+		s[i] = s[i - 1];
+	s[0] = len;
+
+	return (unsigned char*)s;
+}
+
+static char buffer[256];
+unsigned char *p2cstring(unsigned char* s)
+{
+
+	memcpy(buffer, s + 1, s[0]);
+	buffer[(int)s[0]] = (char)0;
+
+	return buffer;
+}
+
+void error(char *x)
+{
+        console_putstring("\n\n");
+        console_putstring(x);
+        console_putstring("\n\n -- System halted\n");
+
+        while(1);       /* Halt */
+}
+
+void memdump(unsigned char* addr, unsigned long size)
+{
+	int i = 0;
+	int j;
+
+	while ( i < size)
+	{
+		printf("%08lx  ", (unsigned long)addr + i);
+
+		for (j = 0; (j < 8) && (i + j < size); j++)
+			printf("%02x ", addr[i+j]);
+		printf(" ");
+		for (j = 8; (j < 16) && (i + j < size); j++)
+			printf("%02x ", addr[i+j]);
+
+		printf(" |");
+		for (j = 0; (j < 16) && (i + j < size); j++)
+		{
+			if ( (addr[i+j] > 31) && (addr[i+j] < 128) )
+				printf("%c", addr[i+j]);
+			else
+				printf(".");
+		}
+		printf("|\n");
+
+		i += j;
+	}
+}

Added: branches/vendor/emile/second/misc.h
===================================================================
--- branches/vendor/emile/second/misc.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/misc.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,15 @@
+/*
+ *
+ * (c) 2004, 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __MISC_H__
+#define __MISC_H__
+
+extern unsigned char *c2pstring(char* s);
+extern unsigned char *p2cstring(unsigned char* s);
+extern void memdump(unsigned char* addr, unsigned long size);
+extern void error(char *x) __attribute__ ((noreturn));
+
+#endif /* __MISC_H__ */

Added: branches/vendor/emile/second/serial.c
===================================================================
--- branches/vendor/emile/second/serial.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/serial.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,362 @@
+/*
+ * 
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <macos/types.h>
+#include <macos/devices.h>
+#include <macos/serial.h>
+
+#include "misc.h"
+#include "head.h"
+#include "driver.h"
+#include "config.h"
+
+static short out_refnum0 = -1;
+static short out_refnum1 = -1;
+#ifdef USE_CLI
+static short in_refnum0 = -1;
+static short in_refnum1 = -1;
+#endif
+
+#if USE_BUFFER
+#define BUFFER_LEN 80
+static char buffer[256];
+static int buff_len;
+#endif
+
+/*
+ * Technical Note TN1119 "Serial Port Apocrypha"
+ *
+ * from http://developer.apple.com/technotes/tn/tn1119.html
+ *
+ * Inside Macintosh, Devices, "Using the Serial Driver" :
+ *
+ * http://developer.apple.com/documentation/mac/Devices/Devices-315.html
+ *
+ */
+
+/*
+ *
+ * ".AOut" Serial port A (modem) output
+ * ".AIn" Serial port A (modem) input
+ * ".BOut" Serial port B (printer) output
+ * ".BIn" Serial port B (printer) input
+ *
+ */
+
+int setserial(short refNum, unsigned int bitrate, unsigned int datasize, 
+			    int parity, int stopbits)
+{
+	CntrlParam param;
+	short seropts;
+	int res;
+
+	switch(bitrate)
+	{
+		case 150:
+			seropts = baud150;
+			break;
+
+		case 300:
+			seropts = baud300;
+			break;
+
+		case 600:
+			seropts = baud600;
+			break;
+
+		case 1200:
+			seropts = baud1200;
+			break;
+
+		case 1800:
+			seropts = baud1800;
+			break;
+
+		case 2400:
+			seropts = baud2400;
+			break;
+
+		case 3600:
+			seropts = baud3600;
+			break;
+
+		case 4800:
+			seropts = baud3600;
+			break;
+
+		case 7200:
+			seropts = baud7200;
+			break;
+
+		case 9600:
+			seropts = baud9600;
+			break;
+
+		case 14400:
+			seropts = baud14400;
+			break;
+
+		case 19200:
+			seropts = baud19200;
+			break;
+
+		case 28800:
+			seropts = baud28800;
+			break;
+
+		case 38400:
+			seropts = baud38400;
+			break;
+
+		case 57600:
+			seropts = baud57600;
+			break;
+
+		default:
+			seropts = baud9600;
+			break;
+	}
+
+	switch(datasize)
+	{
+		case 5:
+			seropts |= data5;
+			break;
+
+		case 6:
+			seropts |= data6;
+			break;
+
+		case 7:
+			seropts |= data7;
+			break;
+
+		case 8:
+			seropts |= data8;
+			break;
+
+		default:
+			seropts |= data8;
+			break;
+	}
+
+	switch(parity)
+	{
+		case 0:
+			seropts |= noParity;
+			break;
+
+		case 1:
+			seropts |= oddParity;
+			break;
+
+		case 2:
+			seropts |= evenParity;
+			break;
+	}
+
+	switch(stopbits)
+	{
+		case 0:
+			seropts |= stop10;
+			break;
+
+		case 1:
+			seropts |= stop15;
+			break;
+
+		case 2:
+			seropts |= stop20;
+			break;
+	}
+
+	param.csCode = kSERDConfiguration;
+	param.csParam[0] = seropts;
+	param.ioCRefNum = refNum;
+	param.ioVRefNum = 0;
+	param.ioCompletion = 0;
+	res = PBControlSync((ParmBlkPtr)&param);
+
+	return res;
+}
+
+void serial_put(char c)
+{
+#if USE_BUFFER
+	buffer[buff_len++] = c;
+
+	if ( c == '\n' )
+	{
+		/* add '\r' and flush buffer */
+
+		buffer[buff_len++] = '\r';
+		
+		goto flush;
+	}
+	/* if buffer is full (BUFFER_LEN - 1), flush it
+ 	 * we take BUFFER_LEN - 1 to have enough room
+	 * if we need to add '\r' on '\n'
+	 */
+
+	if (buff_len == BUFFER_LEN - 1)
+		goto flush;
+
+	return;
+flush:
+	if (out_refnum0 != -1)
+		write(out_refnum0, buffer, buff_len);
+	if (out_refnum1 != -1)
+		write(out_refnum1, buffer, buff_len);
+	buff_len = 0;
+#else
+	if ( c == '\n' )
+	{
+		if (out_refnum0 != -1)
+			write(out_refnum0, "\n\r", 2);
+		if (out_refnum1 != -1)
+			write(out_refnum1, "\n\r", 2);
+	}
+	else
+	{
+		if (out_refnum0 != -1)
+			write(out_refnum0, &c, 1);
+		if (out_refnum1 != -1)
+			write(out_refnum1, &c, 1);
+	}
+#endif
+}
+
+void serial_init(emile_l2_header_t* info)
+{
+	int res;
+	int bitrate, parity, datasize, stopbits;
+
+	res = read_config_modem(info->configuration, 
+				&bitrate, &parity, &datasize, &stopbits);
+	if (res != -1)
+	{
+		res = OpenDriver(c2pstring(".AOut"), &out_refnum0);
+		if (res != noErr) {
+			printf("Cannot open modem output port (%d)\n", res);
+		}
+		else
+		{
+			res = setserial(out_refnum0, bitrate,
+					datasize,
+					parity,
+					stopbits);
+			if (res != noErr) {
+				printf("Cannot setup modem output port (%d)\n",
+					res);
+			}
+		}
+#ifdef USE_CLI
+		res = OpenDriver(c2pstring(".AIn"), &in_refnum0);
+		if (res != noErr) {
+			printf("Cannot open modem input port (%d)\n", res);
+		}
+		else
+		{
+			res = setserial(in_refnum0, bitrate,
+					datasize,
+					parity,
+					stopbits);
+			if (res != noErr) {
+				printf("Cannot setup modem input port (%d)\n",
+					res);
+			}
+		}
+#endif /* USE_CLI */
+	}
+
+	res = read_config_printer(info->configuration, 
+				  &bitrate, &parity, &datasize, &stopbits);
+	if (res != -1) {
+		res = OpenDriver(c2pstring(".BOut"), &out_refnum1);
+		if (res != noErr) {
+			printf("Cannot open printer output port (%d)\n", res);
+		}
+		else
+		{
+			res = setserial(out_refnum1, bitrate,
+						datasize,
+						parity,
+						stopbits);
+			if (res != noErr) {
+				printf("Cannot setup printer output port (%d)\n"
+					, res);
+			}
+		}
+#ifdef USE_CLI
+		res = OpenDriver(c2pstring(".BIn"), &in_refnum1);
+		if (res != noErr) {
+			printf("Cannot open printer input port (%d)\n", res);
+		}
+		else
+		{
+			res = setserial(in_refnum1, bitrate,
+						datasize,
+						parity,
+						stopbits);
+			if (res != noErr) {
+				printf("Cannot setup printer input port (%d)\n"
+					, res);
+			}
+		}
+#endif /* USE_CLI */
+	}
+
+#if USE_BUFFER
+	buff_len = 0;
+#endif
+}
+
+#ifdef USE_CLI
+void serial_cursor_save(void)
+{
+	serial_put('');
+	serial_put('7');
+}
+
+void serial_cursor_restore(void)
+{
+	serial_put('');
+	serial_put('8');
+}
+
+int serial_getchar(void)
+{
+	int count;
+	char c;
+
+	if (in_refnum0 != -1)
+	{
+		count = read(in_refnum0, &c, 1);
+		if (count == 1)
+			return c;
+	}
+
+	if (in_refnum1 != -1)
+	{
+		count = read(in_refnum1, &c, 1);
+		if (count == 1)
+			return c;
+	}
+
+	return 0;
+}
+
+int serial_keypressed()
+{
+	if (serial_getchar() != 0)
+		return 1;
+
+	return 0;
+}
+#endif

Added: branches/vendor/emile/second/serial.h
===================================================================
--- branches/vendor/emile/second/serial.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/serial.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,19 @@
+/*
+ * 
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include "head.h"
+
+extern int setserial(short refNum, unsigned int bitrate, unsigned int datasize,
+                            int parity, int stopbits);
+
+extern void serial_put(char c);
+#ifdef USE_CLI
+extern void serial_cursor_save(void);
+extern void serial_cursor_restore(void);
+extern int serial_keypressed(void);
+extern int serial_getchar(void);
+#endif
+extern void serial_init(emile_l2_header_t* info);

Added: branches/vendor/emile/second/vga.c
===================================================================
--- branches/vendor/emile/second/vga.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/vga.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,509 @@
+/*
+ * 
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+
+#include <macos/lowmem.h>
+#include <macos/quickdraw.h>
+#include <libmacos.h>
+
+#include "misc.h"
+#include "vga.h"
+
+QDGlobals qd;
+
+typedef struct vga_handler {
+
+	unsigned char*	video;
+	unsigned char*	base;
+	unsigned long	row_bytes;	/* in bytes */
+	unsigned long	depth;		/* 4, 8, 16 or 32 */
+	unsigned long	width;		/* in pixels */
+	unsigned long	height;
+	
+	unsigned long	siz_w, siz_h;
+	unsigned long	pos_x, pos_y;
+	
+} vga_handler_t ;
+
+static unsigned char bits_depth2[16] = {
+	0x00,	/* 0  : 0000 -> 00000000 */
+	0x03,	/* 1  : 0001 -> 00000011 */
+	0x0c,	/* 2  : 0010 -> 00001100 */
+	0x0f,	/* 3  : 0011 -> 00001111 */
+	0x30,	/* 4  : 0100 -> 00110000 */
+	0x33,	/* 5  : 0101 -> 00110011 */
+	0x3c,	/* 6  : 0110 -> 00111100 */
+	0x3f,	/* 7  : 0111 -> 00111111 */
+	0xc0,	/* 8  : 1000 -> 11000000 */
+	0xc3,	/* 9  : 1001 -> 11000011 */
+	0xcc,	/* 10 : 1010 -> 11001100 */
+	0xcf,	/* 11 : 1011 -> 11001111 */
+	0xf0,	/* 12 : 1100 -> 11110000 */
+	0xf3,	/* 13 : 1101 -> 11110011 */
+	0xfc,	/* 14 : 1110 -> 11111100 */
+	0xff	/* 15 : 1111 -> 11111111 */
+};
+
+static unsigned char bits_depth4[4] = {
+	0x00,	/* 0 : 00 -> 00000000 */
+	0x0f,	/* 1 : 01 -> 00001111 */
+	0xf0,	/* 2 : 10 -> 11110000 */
+	0xFF	/* 3 : 11 -> 11111111 */
+};
+
+static unsigned char bits_depth8[2] = {
+	0x00,	/* 0 : 0 -> 00000000 */
+	0xff	/* 0 : 1 -> 11111111 */
+};
+
+static vga_handler_t vga;
+
+static unsigned long cursor_save_x, cursor_save_y;
+
+#define CURSOR_POS	0
+#define CURSOR_HIGH	16
+
+static int cursor_on = 0;
+static int cursor_state = 0;
+
+extern unsigned char* font_get(int c);
+
+static void
+draw_cursor(void)
+{
+	int l,w;
+	unsigned char *base;
+	unsigned long x_base;
+	unsigned long y_base;
+						        
+	y_base = vga.row_bytes * vga.pos_y * 16;
+	x_base = vga.pos_x * vga.depth;
+
+	base =  vga.base + y_base + x_base;
+
+	base += CURSOR_POS * vga.row_bytes;
+	for (l = 0 ; l < CURSOR_HIGH ; l++)
+	{
+		for (w = 0; w < vga.depth; w++)
+			base[w] ^= 0xFF;
+		base += vga.row_bytes;
+	}
+}
+
+static void vga_cursor(int state)
+{
+	if (cursor_state != state)
+	{
+		draw_cursor();
+		cursor_state = state;
+	}
+}
+
+void vga_cursor_refresh(void)
+{
+	if (!cursor_on)
+		return;
+
+	if (Ticks % 60 < 30)
+		vga_cursor(0);
+	else
+		vga_cursor(1);
+}
+
+void vga_cursor_on(void)
+{
+	cursor_on = 1;
+	vga_cursor_refresh();
+}
+
+void vga_cursor_off(void)
+{
+	cursor_on = 0;
+	vga_cursor(0);
+}
+
+void vga_cursor_save(void)
+{
+	cursor_save_x = vga.pos_x;
+	cursor_save_y = vga.pos_y;
+}
+
+void vga_cursor_restore(void)
+{
+	vga_cursor(0);
+	vga.pos_x = cursor_save_x;
+	vga.pos_y = cursor_save_y;
+	vga_cursor(1);
+}
+
+static void
+draw_byte_1(unsigned char *glyph, unsigned char *base)
+{
+	int l;
+
+	for (l = 0 ; l < 16; l++)
+	{
+		*base = ~(*glyph++);
+		base += vga.row_bytes;
+	}
+}
+
+static void
+draw_byte_2(unsigned char *glyph, unsigned char *base)
+{
+	int l;
+	int bits;
+
+	for (l = 0 ; l < 16; l++)
+	{
+		bits = ~(*glyph++);
+
+		base[1] = bits_depth2[bits & 0x0F];
+		bits = bits >> 4;
+		base[0] = bits_depth2[bits & 0x0F];
+
+		base += vga.row_bytes;
+	}
+}
+
+static void
+draw_byte_4(unsigned char *glyph, unsigned char *base)
+{
+	int l;
+	int bits;
+
+	for (l = 0 ; l < 16; l++)
+	{
+		bits = ~(*glyph++);
+
+		base[3] = bits_depth4[bits & 0x03];
+		bits = bits >> 2;
+
+		base[2] = bits_depth4[bits & 0x03];
+		bits = bits >> 2;
+
+		base[1] = bits_depth4[bits & 0x03];
+		bits = bits >> 2;
+
+		base[0] = bits_depth4[bits & 0x03];
+
+		base += vga.row_bytes;
+	}
+}
+
+static void
+draw_byte_8(unsigned char *glyph, unsigned char *base)
+{
+	int l;
+	int bits;
+
+	for (l = 0 ; l < 16; l++)
+	{
+		bits = ~(*glyph++);
+
+		base[7] = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+		base[6] = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+		base[5] = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+		base[4] = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+		base[3] = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+		base[2] = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+		base[1] = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+		base[0] = bits_depth8[bits & 0x01];
+
+		base += vga.row_bytes;
+	}
+}
+
+static void
+draw_byte_16(unsigned char *glyph, unsigned char *base)
+{
+	int l;
+	int bits;
+
+	for (l = 0 ; l < 16; l++)
+	{
+		bits = *glyph++;
+
+		base[15] = base[14] = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+
+		base[13] = base[12] = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+
+		base[11] = base[10] = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+
+		base[9] = base[8]   = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+
+		base[7] = base[6]   = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+
+		base[5] = base[4]   = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+
+		base[3] = base[2]   = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+
+		base[1] = base[0]   = bits_depth8[bits & 0x01];
+
+		base += vga.row_bytes;
+	}
+}
+
+static void
+draw_byte_24(unsigned char *glyph, unsigned char *base)
+{
+	int l;
+	int bits;
+
+	for (l = 0 ; l < 16; l++)
+	{
+		bits = *glyph++;
+
+		base[23] = base[22] = base[21] = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+
+		base[20] = base[19] = base[18] = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+
+		base[17] = base[16] = base[15] = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+
+		base[14] = base[13] = base[12] = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+
+		base[11] = base[10] = base[9]  = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+
+		base[8]  = base[7]  = base[6]  = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+
+		base[5]  = base[4]  = base[3]  = bits_depth8[bits & 0x01];
+		bits = bits >> 1;
+
+		base[2]  = base[1]  = base[0]  = bits_depth8[bits & 0x01];
+
+		base += vga.row_bytes;
+	}
+}
+
+static void
+draw_byte(unsigned char c, unsigned long locX, unsigned long locY)
+{
+	unsigned char *base;
+	unsigned char *glyph;
+	unsigned long x_base;
+	unsigned long y_base;
+
+	glyph =	font_get(c);
+	
+	y_base = vga.row_bytes * locY * 16;
+	x_base = locX * vga.depth;
+
+	base =	vga.base + y_base + x_base;
+
+	switch(vga.depth)
+	{
+		case 1:
+			draw_byte_1(glyph, base);
+			break;
+		case 2:
+			draw_byte_2(glyph, base);
+			break;
+		case 4:
+			draw_byte_4(glyph, base);
+			break;
+		case 8:
+			draw_byte_8(glyph, base);
+			break;
+		case 16:
+			draw_byte_16(glyph, base);
+			break;
+		case 24:
+			draw_byte_24(glyph, base);
+			break;
+	}
+}
+
+static void vga_clear();
+
+static void
+vga_scroll()
+{
+	unsigned long j;
+	unsigned long i;
+	unsigned long *src;
+	unsigned long *dst;
+	unsigned long bg32;
+
+	/* move up the screen */
+
+	src = (unsigned long *)(vga.base + (vga.row_bytes << 4));
+	dst = (unsigned long *)vga.base;
+
+	for (j = 0; j < vga.siz_h - 1; j++)
+		for (i = 0; i < (vga.row_bytes<<2); i++)
+			*dst++ = *src++;
+
+	/* clear last line */
+
+	if (vga.depth <= 8)
+		bg32 = 0xffffffff;
+	else
+		bg32 = 0x00000000;
+
+	for (j = 0; j < (vga.row_bytes << 2); j++)
+		*dst++ = bg32;
+}
+
+void
+vga_init()
+{
+	int ret;
+
+	InitGraf(&qd.thePort);
+
+	ret = glue_display_properties((unsigned long*)&vga.base,
+				&vga.row_bytes,
+				&vga.width,
+				&vga.height,
+				&vga.depth,
+				(unsigned long*)&vga.video);
+	if (ret)
+	{
+		vga.base = qd.screenBits.baseAddr;
+		vga.row_bytes = qd.screenBits.rowBytes;
+		vga.width = qd.screenBits.bounds.right - 
+				qd.screenBits.bounds.left;
+		vga.height = qd.screenBits.bounds.bottom - 
+					qd.screenBits.bounds.top;
+		vga.depth = 1;
+	}
+
+	vga.pos_x 	= 0;
+	vga.pos_y 	= 0;
+	vga.siz_w	= vga.width / 8;
+	vga.siz_h	= vga.height / 16;
+
+	vga_clear();
+}
+
+void
+vga_put(char c)
+{
+	vga_cursor(0);
+
+	switch(c) {
+		case '\r':
+			vga.pos_x = 0;
+			break;
+		case '\n':
+			vga.pos_x = 0;
+			vga.pos_y++;
+			break;
+		case '\b':
+			if (vga.pos_x > 0)
+				vga.pos_x--;
+			else if (vga.pos_y > 0)
+			{
+				vga.pos_y--;
+				vga.pos_x = vga.siz_w - 1;
+			}
+			break;
+		default:
+			draw_byte((unsigned char)c, vga.pos_x++, vga.pos_y);
+			if (vga.pos_x >= vga.siz_w) {
+				vga.pos_x = 0;
+				vga.pos_y++;
+			}
+	}
+	while (vga.pos_y >= vga.siz_h) {
+		vga_scroll();
+		vga.pos_y--;
+	}
+
+	vga_cursor_refresh();
+}
+
+static void
+vga_clear()
+{
+	int i,j;
+	unsigned long row;
+	unsigned char bg;
+	unsigned long bg32;
+	unsigned long *base;
+	unsigned char *next;
+
+	vga_cursor(0);
+
+	if (vga.depth <= 8)
+	{
+		bg = 0xff;
+		bg32 = 0xffffffff;
+	}
+	else
+	{
+		bg = 0x00;
+		bg32 = 0x00000000;
+	}
+
+	for (j = 0, row = 0; j < vga.height; j++)
+	{
+		base = (unsigned long*)(vga.base + row);
+		row += vga.row_bytes;
+
+		for (i = 0; i < (vga.row_bytes >> 2); i++)
+			*base++ = bg32;
+		next = (unsigned char*)base;
+		for (i = i << 2 ; i < vga.row_bytes; i++)
+			*next++ = bg;
+	}
+
+	vga.pos_x 	= 0;
+	vga.pos_y 	= 0;
+
+	vga_cursor_refresh();
+}
+
+unsigned long vga_get_videobase()
+{
+	return (unsigned long)vga.base;
+}
+
+unsigned long vga_get_row_bytes()
+{
+	return vga.row_bytes;
+}
+
+unsigned long vga_get_depth()
+{
+	return vga.depth;
+}
+
+unsigned long vga_get_width()
+{
+	return vga.width;
+}
+
+unsigned long vga_get_height()
+{
+	return vga.height;
+}
+
+unsigned long vga_get_video()
+{
+	return (unsigned long)vga.video;
+}

Added: branches/vendor/emile/second/vga.h
===================================================================
--- branches/vendor/emile/second/vga.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/second/vga.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,27 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#ifndef __VGA_H__
+#define __VGA_H__
+
+extern void vga_init();
+
+extern void vga_put(char c);
+extern void vga_print(char *s);
+extern void vga_cursor_refresh(void);
+extern void vga_cursor_on(void);
+extern void vga_cursor_off(void);
+extern void vga_cursor_save(void);
+extern void vga_cursor_restore(void);
+
+extern unsigned long vga_get_videobase();
+extern unsigned long vga_get_row_bytes();
+extern unsigned long vga_get_depth();
+extern unsigned long vga_get_width();
+extern unsigned long vga_get_height();
+extern unsigned long vga_get_video();
+
+#endif

Added: branches/vendor/emile/tools/Makefile
===================================================================
--- branches/vendor/emile/tools/Makefile	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/tools/Makefile	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,74 @@
+#
+#
+# (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+#
+#
+
+AS=$(CROSS_COMPILE)as
+CC=$(CROSS_COMPILE)gcc
+LD=$(CROSS_COMPILE)ld
+AR=$(CROSS_COMPILE)ar
+
+PROGRAMS = emile-set-cmdline emile-first-tune emile-install \
+	   emile-set-output emile emile-map-set iso9660_ls \
+	   iso9660_cat minigzip read_vmlinuz
+
+SOURCES	= emile-set-cmdline.c Makefile emile-first-tune.c \
+		  emile-install.c emile-set-output.c emile.c \
+		  emile_scanbus.c emile-map-set.c iso9660_ls.c \
+		  iso9660_cat.c minigzip.c read_vmlinuz.c device.c gzio.c
+
+HEADERS	= device.h
+
+DISTFILES =$(HEADERS) $(SOURCES) Makefile
+
+CPPFLAGS = $(CROSS_COMPILE_CPPFLAGS) -DSIGNATURE="\"$(SIGNATURE)\"" -DPREFIX=\"$(PREFIX)\" \
+	   -I../libemile -I../libiso9660 -I../libgzip -I../libstream \
+	   -I../libcontainer -DFATFREE -DNO_GZCOMPRESS
+
+CFLAGS	= -Wall -g
+LDLIBS = $(CROSS_COMPILE_LDFLAGS) -L../libemile -lemile -L../libiso9660/native -liso9660 -L../libgzip/native -lgzip
+
+all: $(PROGRAMS)
+
+emile: emile.o emile_scanbus.o
+
+emile-map-set: emile-map-set.o emile_scanbus.o
+
+iso9660_ls: iso9660_ls.o device.o
+
+iso9660_cat: iso9660_cat.o device.o
+
+minigzip: minigzip.c gzio.c
+
+read_vmlinuz: read_vmlinuz.o gzio.o
+
+install:
+	install -d $(DESTDIR)/$(PREFIX)/sbin/
+	install emile-set-cmdline $(DESTDIR)/$(PREFIX)/sbin/emile-set-cmdline
+	install emile-first-tune $(DESTDIR)/$(PREFIX)/sbin/emile-first-tune
+	install emile-install $(DESTDIR)/$(PREFIX)/sbin/emile-install
+	install emile-set-output $(DESTDIR)/$(PREFIX)/sbin/emile-set-output
+	install emile $(DESTDIR)/$(PREFIX)/sbin/emile
+	install emile-map-set $(DESTDIR)/$(PREFIX)/sbin/emile-map-set
+
+uninstall:
+	rm -f $(DESTDIR)/$(PREFIX)/sbin/emile-set-cmdline
+	rm -f $(DESTDIR)/$(PREFIX)/sbin/emile-first-tune
+	rm -f $(DESTDIR)/$(PREFIX)/sbin/emile-install
+	rm -f $(DESTDIR)/$(PREFIX)/sbin/emile-set-output
+	rm -f $(DESTDIR)/$(PREFIX)/sbin/emile
+	rm -f $(DESTDIR)/$(PREFIX)/sbin/emile-map-set
+
+dist:
+	@echo TAR tools
+	@for file in $(DISTFILES); do \
+		dir=$$(dirname $$file); \
+		if [ "$$dir" != "" ] ; then \
+			mkdir -p $(DISTDIR)/tools/$$dir; \
+		fi; \
+		cp -p $$file $(DISTDIR)/tools/$$file; \
+	done
+
+clean:
+	rm -f *.o $(PROGRAMS)

Added: branches/vendor/emile/tools/device.c
===================================================================
--- branches/vendor/emile/tools/device.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/tools/device.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,42 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#include "device.h"
+
+#define SECTOR_SIZE     (2048)
+#define ISO_BLOCKS(X)   (((X) / SECTOR_SIZE) + (((X)%SECTOR_SIZE)?1:0))
+
+static const char *filename = "/dev/cdrom";
+
+int device_read_sector(void *data,off_t offset, void* buffer, size_t size)
+{
+	FILE* file = (FILE*)data;
+
+	lseek(fileno(file), offset << 11, SEEK_SET);
+	return read(fileno(file), buffer, ISO_BLOCKS(size) << 11);
+}
+
+void device_close(void *data)
+{
+	FILE* file = (FILE*)data;
+	if (file)
+		fclose(file);
+}
+
+FILE *device_open(void)
+{
+	FILE* file;
+
+	file = fopen(filename, "rb");
+	if (file == NULL)
+		return NULL;
+
+	return file;
+}

Added: branches/vendor/emile/tools/device.h
===================================================================
--- branches/vendor/emile/tools/device.h	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/tools/device.h	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,15 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#include <libstream.h>
+
+extern FILE *device_open(void);
+extern void device_close(void *data);
+extern int device_read_sector(void *data, off_t offset, void* buffer, size_t size);

Added: branches/vendor/emile/tools/emile-first-tune.c
===================================================================
--- branches/vendor/emile/tools/emile-first-tune.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/tools/emile-first-tune.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,146 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <getopt.h>
+
+#include "libemile.h"
+
+enum {
+	ARG_NONE = 0,
+	ARG_HELP ='h',
+	ARG_DRIVE = 'd',
+	ARG_OFFSET ='o',
+	ARG_SIZE = 's',
+};
+
+static struct option long_options[] =
+{
+	{"help",	0, NULL,	ARG_HELP	},
+	{"drive",	1, NULL,	ARG_DRIVE	},
+	{"offset",	1, NULL,	ARG_OFFSET	},
+	{"size",	1, NULL,	ARG_SIZE	},
+	{NULL,		0, NULL,	0		},
+};
+
+static void usage(int argc, char** argv)
+{
+	fprintf(stderr, "Usage: %s [-d <drive>][-o <offset>][-s <size>] <image>\n", argv[0]);
+	fprintf(stderr, "Set EMILE first level boot block info\n");
+	fprintf(stderr, "   -d, --drive <drive>   set the drive number (default 1)\n");
+	fprintf(stderr,	"   -o, --offset <offset> set offset of second level in bytes\n");
+	fprintf(stderr,	"   -s, --size <size>     set size of second level in bytes\n");
+	fprintf(stderr, "Display current values if no flags provided\n");
+	fprintf(stderr, "\nbuild: \n%s\n", SIGNATURE);
+}
+
+int first_tune( char* image, unsigned short tune_mask, int drive_num, 
+		int second_offset, int second_size)
+{
+	int fd;
+	int ret;
+
+	fd = open(image, O_RDWR);
+	if (fd == -1)
+	{
+		perror("Cannot open image file");
+		return 2;
+	}
+	if (tune_mask == 0)
+	{
+		ret = emile_first_get_param(fd, &drive_num, &second_offset,
+					    &second_size);
+		if (ret == 0)
+		{
+			printf("EMILE boot block identified\n\n");
+			printf("Drive number: %d\n", drive_num);
+			printf("Second level offset: %d\n", second_offset);
+			printf("Second level size: %d\n", second_size);
+		}
+		else
+			printf("EMILE is not installed in this bootblock\n");
+
+		return 0;
+	}
+
+	ret = emile_first_set_param(fd, tune_mask, drive_num, second_offset, second_size);
+
+	close(fd);
+	return 0;
+}
+
+int main(int argc, char** argv)
+{
+	int ret;
+	int option_index;
+	int c;
+	char* image = NULL;
+	unsigned short tune_mask = 0;
+	int drive_num, second_offset, second_size;
+
+	while(1)
+	{
+		c = getopt_long(argc, argv, "hd:o:f:", long_options,
+				&option_index);
+		if (c == EOF)
+			break;
+
+		switch(c)
+		{
+		case ARG_HELP:
+			usage(argc, argv);
+			return 0;
+		case ARG_DRIVE:
+			tune_mask |= EMILE_FIRST_TUNE_DRIVE;
+			drive_num = atoi(optarg);
+			break;
+		case ARG_OFFSET:
+			tune_mask |= EMILE_FIRST_TUNE_OFFSET;
+			second_offset = atoi(optarg);
+			second_offset = (second_offset + 0x1FF) & 0xFFFFFE00;
+			break;
+		case ARG_SIZE:
+			tune_mask |= EMILE_FIRST_TUNE_SIZE;
+			second_size = atoi(optarg);
+			second_size = (second_size + 0x1FF) & 0xFFFFFE00;
+			break;
+		}
+	}
+
+	if (optind < argc)
+		image = argv[optind];
+
+	if (image == NULL)
+	{
+		fprintf(stderr, "ERROR: Missing filename to apply tuning\n");
+		usage(argc, argv);
+		return 1;
+	}
+
+	ret = first_tune( image, tune_mask, drive_num, second_offset, second_size);
+	switch(ret)
+	{
+	case 0:
+		break;
+	case EEMILE_CANNOT_WRITE_FIRST:
+		fprintf(stderr, "ERROR: cannot write to file\n");
+		break;
+	case EEMILE_UNKNOWN_FIRST:
+		fprintf(stderr, "ERROR: unknown file format\n");
+		break;
+	default:
+		fprintf(stderr, "ERROR: unknowm error :-P\n");
+		break;
+	}
+
+	return ret;
+}

Added: branches/vendor/emile/tools/emile-install.c
===================================================================
--- branches/vendor/emile/tools/emile-install.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/tools/emile-install.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,211 @@
+/*
+ *
+ * (c) 2004,2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <getopt.h>
+
+#include "libemile.h"
+
+enum {
+	ARG_NONE = 0,
+	ARG_HELP ='h',
+	ARG_VERBOSE = 'v',
+	ARG_FIRST = 'f',
+	ARG_SECOND = 's',
+	ARG_KERNEL = 'k',
+	ARG_RAMDISK = 'r',
+	ARG_GETINFO = 'g',
+};
+
+static struct option long_options[] =
+{
+	{"help",	0, NULL,	ARG_HELP	},
+	{"verbose",	0, NULL,	ARG_VERBOSE	},
+	{"first",	1, NULL,	ARG_FIRST	},
+	{"second",	1, NULL,	ARG_SECOND	},
+	{"kernel",	1, NULL,	ARG_KERNEL	},
+	{"ramdisk",	1, NULL,	ARG_RAMDISK	},
+	{"getinfo",	1, NULL,	ARG_GETINFO	},
+	{NULL,		0, NULL,	0		},
+};
+
+static void usage(int argc, char** argv)
+{
+	fprintf(stderr, "Usage: %s [OPTION] <image>\n", argv[0]);
+	fprintf(stderr, "Create an EMILE bootable floppy disk\n");
+	fprintf(stderr, "EMILE allows you to boot linux from a floppy disk\n");
+	fprintf(stderr, "   -h, --help      display this text\n");
+	fprintf(stderr, "   -v, --verbose   verbose mode\n");
+	fprintf(stderr, "   -f, --first     first level to copy to floppy\n");
+	fprintf(stderr, "   -s, --second    second level to copy to floppy\n");
+	fprintf(stderr, "   -k, --kernel    kernel to copy to floppy\n");
+	fprintf(stderr, "   -r, --ramdisk   ramdisk to copy to floppy\n");
+	fprintf(stderr, "   -g, --getinfo   get information from >image>\n");
+	fprintf(stderr, "\nbuild: \n%s\n", SIGNATURE);
+}
+
+int main(int argc, char** argv)
+{
+	int verbose = 0;
+	int option_index = 0;
+	char* first_level = NULL;
+	char* second_level = NULL;
+	char* kernel_image = NULL;
+	char* ramdisk = NULL;
+	char* image = NULL;
+	int action_getinfo = 0;
+	int c;
+	int ret;
+
+	while(1)
+	{
+		c = getopt_long(argc, argv, "hvf:s:k:r:g", long_options, 
+				&option_index);
+		if (c == -1)
+			break;
+		switch(c)
+		{
+		case ARG_HELP:
+			usage(argc, argv);
+			return 0;
+		case ARG_VERBOSE:
+			verbose = 1;
+			break;
+		case ARG_FIRST:
+			first_level = optarg;
+			break;
+		case ARG_SECOND:
+			second_level = optarg;
+			break;
+		case ARG_KERNEL:
+			kernel_image = optarg;
+			break;
+		case ARG_RAMDISK:
+			ramdisk = optarg;
+			break;
+		case ARG_GETINFO:
+			action_getinfo = 1;
+			break;
+		}
+	}
+
+	if (optind < argc)
+		image = argv[optind];
+
+	if (image == NULL)
+	{
+		fprintf(stderr, 
+		"ERROR: you must provide an image file or a block device.\n");
+		usage(argc, argv);
+		return 1;
+	}
+
+	if (action_getinfo)
+	{
+		int fd;
+		int drive_num;
+		int second_offset;
+		int second_size;
+
+		fd = open(image, O_RDONLY);
+		if (fd == -1)
+		{
+			fprintf(stderr, "ERROR: cannot open \"%s\"\n",
+					image);
+			return 2;
+		}
+
+		/* first level info */
+
+		ret = emile_first_get_param(fd, &drive_num, &second_offset,
+					    &second_size);
+
+		if (ret == 0)
+		{
+			char * configuration;
+
+			printf("EMILE boot block identified\n\n");
+			printf("Drive number:        %d\n", drive_num);
+			printf("Second level offset: %d\n", second_offset);
+			printf("Second level size:   %d\n", second_size);
+
+			/* second level info */
+
+			configuration = emile_second_get_configuration(fd);
+			if (configuration == NULL)
+			{
+				fprintf(stderr, "ERROR: cannot read second level\n");
+				return 3;
+			}
+			printf("%s\n", configuration);
+
+			free(configuration);
+		}
+		else
+			printf("EMILE is not installed in this bootblock\n");
+
+		close(fd);
+		return 0;
+	}
+
+	if (first_level == NULL)
+		first_level = PREFIX "/lib/emile/first_floppy";
+
+	if (second_level == NULL)
+		second_level = PREFIX "/lib/emile/second_floppy";
+
+	if (kernel_image == NULL)
+		kernel_image = PREFIX "/boot/vmlinuz";
+
+	if (verbose)
+	{
+		printf("first:   %s\n", first_level);
+		printf("second:  %s\n", second_level);
+		printf("kernel:  %s\n", kernel_image);
+		printf("ramdisk: %s\n", ramdisk);
+		printf("image:   %s\n", image);
+	}
+
+	ret = emile_floppy_create_image(first_level, second_level, 
+					kernel_image, ramdisk, image);
+	switch(ret)
+	{
+	case 0:
+		break;
+	case EEMILE_CANNOT_WRITE_FIRST:
+		fprintf(stderr, "ERROR: cannot write first\n");
+		break;
+	case EEMILE_CANNOT_WRITE_SECOND:
+		fprintf(stderr, "ERROR: cannot write second\n");
+		break;
+	case EEMILE_CANNOT_WRITE_KERNEL:
+		fprintf(stderr, "ERROR: cannot write kernel\n");
+		break;
+	case EEMILE_CANNOT_WRITE_RAMDISK:
+		fprintf(stderr, "ERROR: cannot write ramdisk\n");
+		break;
+	case EEMILE_CANNOT_WRITE_PAD:
+		fprintf(stderr, "ERROR: cannot write padding\n");
+		break;
+	case EEMILE_CANNOT_CREATE_IMAGE:
+		fprintf(stderr, "ERROR: cannot create image\n");
+		break;
+	case EEMILE_CANNOT_OPEN_FILE:
+		fprintf(stderr, "ERROR: cannot open one of provided files\n");
+		break;
+	default:
+		fprintf(stderr, "ERROR: unknown error :-P\n");
+		break;
+	}
+
+	return ret;
+}

Added: branches/vendor/emile/tools/emile-map-set.c
===================================================================
--- branches/vendor/emile/tools/emile-map-set.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/tools/emile-map-set.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,533 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "libemile.h"
+
+int verbose = 0;
+
+extern void scanbus(void);
+
+
+enum {
+	ACTION_NONE =	 0x00,
+	ACTION_FLAGS =	 0x01,
+	ACTION_TYPE = 	 0x02,
+	ACTION_STARTUP = 0x04,
+	ACTION_SCANBUS = 0x08,
+	ACTION_GET =	 0x10,
+	ACTION_PUT =	 0x20,
+};
+
+enum {
+	ARG_NONE = 0,
+	ARG_SCANBUS,
+	ARG_HELP = 'h',
+	ARG_FLAGS = 'f',
+	ARG_TYPE ='t',
+	ARG_STARTUP ='s',
+	ARG_VERBOSE = 'v',
+	ARG_GET = 'g',
+	ARG_PUT = 'p',
+};
+
+static struct option long_options[] =
+{
+	{"help",        0, NULL,        ARG_HELP        },
+	{"flags",	1, NULL,	ARG_FLAGS	},
+	{"type",	1, NULL,	ARG_TYPE	},
+	{"startup",	0, NULL,	ARG_STARTUP	},
+	{"scanbus",	0, NULL,	ARG_SCANBUS	},
+	{"verbose",	0, NULL,	ARG_VERBOSE	},
+	{"get-driver",	1, NULL,	ARG_GET		},
+	{"put-driver",	1, NULL,	ARG_PUT		},
+	{NULL,		0, NULL,	0		},
+};
+
+static void usage(int argc, char** argv)
+{
+	fprintf(stderr, "Usage: %s [--verbose|-v] --scanbus\n", argv[0]);
+	fprintf(stderr, "Usage: %s [--startup|--flags FLAGS][--type TYPE][--get-driver|-g FILE][--put-driver|-p FILE] <partition>\n", argv[0]);
+	fprintf(stderr, "\nbuild: \n%s\n", SIGNATURE);
+}
+
+static int get_driver(emile_map_t *map, int partition, char* appledriver)
+{
+	int driver;
+	int block_size, block_count;
+	int driver_number;
+	int block, size, type, part;
+	int bootstart, bootsize, bootaddr, bootentry, checksum;
+	char processor[16];
+	char *code;
+	int fd;
+	int ret;
+	char part_name[16];
+
+	emile_map_read(map, partition);
+	if (strncmp(emile_map_get_partition_type(map), 
+		    "Apple_Driver", strlen("Apple_Driver")) != 0)
+	{
+		fprintf(stderr, 
+	"ERROR: the type of the partition must begin with \"Apple_Driver\"\n");
+		return -1;
+	}
+	if (strcmp(emile_map_get_partition_name(map), "Macintosh") != 0)
+	{
+		fprintf(stderr, 
+		"ERROR: the name of the partition must be \"Macintosh\"\n");
+		return -1;
+	}
+
+	emile_map_geometry(map, &block_size, &block_count);
+
+	driver_number = emile_map_get_driver_number(map);
+	if (driver_number == 0)
+	{
+		fprintf(stderr, "ERROR: no driver on this device\n");
+		return -1;
+	}
+
+	for (driver = 0; driver < driver_number; driver++)
+	{
+		emile_map_get_driver_info(map, driver, &block, &size, &type);
+		part  = emile_map_seek_driver_partition(map, 
+						block * block_size / 512 );
+		if (part == partition)
+			break;
+	}
+	if (part != partition)
+	{
+		fprintf(stderr, 
+			"ERROR: cannot find partition in driver table\n");
+		return -1;
+	}
+	printf("Found driver %d for partition %d\n", driver, partition + 1);
+	printf("base: %d size: %d type: 0x%x\n", block, size, type);
+	emile_map_get_bootinfo(map, &bootstart, &bootsize, &bootaddr, 
+				    &bootentry, &checksum, processor);
+	printf("Bootstart: %d, Bootsize: %d, Bootaddr: %d, Bootentry: %d\n",
+		bootstart, bootsize, bootaddr, bootentry);
+	printf("Checksum: 0x%04x, Processor: %s\n", checksum, processor);
+
+	if (strcmp(processor, "68000") != 0)
+	{
+		fprintf( stderr, 
+		"ERROR: cannot manage processor %s (not 68000)\n", processor);
+		return -1;
+	}
+
+	code = (char*)malloc(bootsize);
+	if (code == NULL)
+	{
+		fprintf(stderr, "ERROR: cannot malloc() to load driver in memory\n");
+		return -1;
+	}
+
+	sprintf(part_name, "%s%d", emile_map_dev(map), partition + 1);
+	fd = open(part_name, O_RDONLY);
+	if (fd == -1)
+	{
+		fprintf(stderr, "ERROR: cannot read driver (open())\n");
+		free(code);
+		return -1;
+	}
+
+	ret = read(fd, code, bootsize);
+	close(fd);
+
+	if (ret != bootsize)
+	{
+		fprintf(stderr, "ERROR: cannot read driver (read())\n");
+		free(code);
+		return -1;
+	}
+
+	if (emile_checksum(code, bootsize) != checksum)
+		fprintf(stderr, "WARNING: checksum is invalid (0x%x)\n",
+				emile_checksum(code, bootsize));
+	else
+		printf("Checksum OK\n");
+
+	fd = open(appledriver, O_WRONLY | O_CREAT | O_EXCL, S_IWUSR | S_IRUSR);
+	if (fd == -1)
+	{
+		fprintf(stderr, "ERROR: cannot open %s to save driver\n",
+				appledriver);
+		free(code);
+		return -1;
+	}
+
+	ret = write(fd, code, bootsize);
+	close(fd);
+	free(code);
+
+	if (ret != bootsize)
+	{
+		fprintf(stderr, "ERROR: cannot save driver to %s\n", 
+				appledriver);
+		return -1;
+	}
+	return 0;
+}
+
+static int put_driver(emile_map_t *map, int partition, char* appledriver)
+{
+	int block_size, block_count;
+	int fd;
+	int ret;
+	char* code;
+	struct stat st;
+	int driver_number;
+	int block, count, checksum;
+	char part_name[16];
+
+	emile_map_read(map, partition);
+
+	if (strncmp(emile_map_get_partition_type(map), 
+		    "Apple_Driver", strlen("Apple_Driver")) != 0)
+	{
+		fprintf(stderr, 
+	"ERROR: the type of the partition must begin with \"Apple_Driver\"\n");
+		return -1;
+	}
+	if (strcmp(emile_map_get_partition_name(map), "Macintosh") != 0)
+	{
+		fprintf(stderr, 
+		"ERROR: the name of the partition must be \"Macintosh\"\n");
+		return -1;
+	}
+
+	emile_map_geometry(map, &block_size, &block_count);
+
+	/* read driver from file */
+
+	fd = open(appledriver, O_RDONLY);
+	if (fd == -1)
+	{
+		fprintf(stderr, "ERROR: cannot open file %s\n", appledriver);
+		return -1;
+	}
+
+	ret = fstat(fd, &st);
+	if (ret == -1)
+	{
+		fprintf(stderr, "ERROR: cannot stat file %s\n", appledriver);
+		return -1;
+	}
+
+	code = malloc(st.st_size);
+	if (code == NULL)
+	{
+		fprintf(stderr, "ERROR: cannot malloc %ld\n", st.st_size);
+		return -1;
+	}
+
+	ret = read(fd, code, st.st_size);
+
+	close(fd);
+
+	if (ret != st.st_size)
+	{
+		fprintf(stderr, "ERROR: cannot read file %s\n", appledriver);
+		return -1;
+	}
+
+	/* compute driver checksum */
+
+	checksum = emile_checksum(code, st.st_size);
+	printf("Driver checksum: 0x%x\n", checksum);
+
+	/* write file in partition */
+
+	sprintf(part_name, "%s%d", emile_map_dev(map), partition + 1);
+	fd = open(part_name, O_WRONLY);
+	if (fd == -1)
+	{
+		fprintf(stderr, "ERROR: cannot write driver (open())\n");
+		free(code);
+		return -1;
+	}
+
+	ret = write(fd, code, st.st_size);
+	close(fd);
+	free(code);
+
+	if (ret != st.st_size)
+	{
+		fprintf(stderr, "ERROR: cannot write driver (write())\n");
+		return -1;
+	}
+
+	/* set bootinfo */
+
+	emile_map_set_bootinfo(map, 0, st.st_size, 0, 0, checksum, "68000");
+	emile_map_partition_set_flags(map, 0x17F);
+	
+	/* add driver in drivers list */
+
+	driver_number = emile_map_get_driver_number(map);
+	if (driver_number == -1)
+	{
+		fprintf(stderr, "ERROR: cannot read drivers number\n");
+		return -1;
+	}
+
+	ret = emile_map_get_partition_geometry(map, &block, &count);
+	if (ret == -1)
+	{
+		fprintf(stderr, "ERROR: cannot read partition geometry\n");
+		return -1;
+	}
+
+	ret = emile_map_set_driver_info(map, driver_number, 
+					block / (block_size / 512) , 
+					count / (block_size / 512), 1);
+	if (ret == -1)
+	{
+		fprintf(stderr, "ERROR: cannot set driver info\n");
+		return -1;
+	}
+
+	ret = emile_map_set_driver_number(map, driver_number + 1);
+	if (driver_number == -1)
+	{
+		fprintf(stderr, "ERROR: cannot set drivers number\n");
+		return -1;
+	}
+
+	ret = emile_map_write(map, partition);
+	if (ret != partition)
+	{
+		fprintf(stderr, "ERROR: cannot set partition information\n");
+		return -1;
+	}
+
+	ret = emile_block0_write(map);
+	if (ret == -1)
+	{
+		fprintf(stderr, "ERROR: cannot set drivers information\n");
+		return -1;
+	}
+
+	return 0;
+}
+
+int main(int argc, char** argv)
+{
+	emile_map_t *map;
+	int ret;
+	int disk;
+	int partition;
+	char disk_name[16];
+	char *driver;
+	int action = ACTION_NONE;
+	char *dev_name = NULL;
+	char *appledriver = NULL;
+	int c;
+	int option_index;
+	int flags;
+	char *type;
+
+	while(1)
+	{
+		c = getopt_long(argc, argv, "hvg:p:sf:t:", long_options,
+				&option_index);
+		if (c == -1)
+			break;
+		switch(c)
+		{
+		case ARG_VERBOSE:
+			verbose++;
+			break;
+		case ARG_HELP:
+			usage(argc, argv);
+			return 0;
+		case ARG_FLAGS:
+			action |= ACTION_FLAGS;
+			flags = strtol(optarg, NULL, 0);
+			break;
+		case ARG_TYPE:
+			action |= ACTION_TYPE;
+			type = optarg;
+			break;
+		case ARG_STARTUP:
+			action |= ACTION_STARTUP;
+			break;
+		case ARG_SCANBUS:
+			action |= ACTION_SCANBUS;
+			break;
+		case ARG_GET:
+			action |= ACTION_GET;
+			appledriver = optarg;
+			break;
+		case ARG_PUT:
+			action |= ACTION_PUT;
+			appledriver = optarg;
+			break;
+		}
+	}
+	if (action & ACTION_SCANBUS) {
+		if (action & ~ACTION_SCANBUS) {
+			fprintf(stderr,
+	"ERROR: \"--scanbus\" cannot be used with other arguments\n");
+			return 1;
+		}
+
+		scanbus();
+		return 0;
+	}
+	if ((action & ACTION_GET) && (action & ACTION_PUT)) {
+		fprintf(stderr, "You should use --get-driver OR --put-driver\n");
+		return 1;
+	}
+
+	if (optind < argc)
+		dev_name = argv[optind];
+
+	if (dev_name == NULL)
+	{
+		fprintf(stderr, "ERROR: you must specify a device\n");
+		return 1;
+	}
+
+	ret = emile_scsi_get_rdev(dev_name, &driver, &disk, &partition);
+	if (ret == -1)
+	{
+		fprintf(stderr, "ERROR: cannot find disk of %s\n", dev_name);
+		return 1;
+	}
+
+	if (partition == 0)
+	{
+		fprintf(stderr, 
+			"ERROR: you must provide device of a partition\n");
+		return 1;
+	}
+
+	sprintf(disk_name, "%s%c", driver, 'a' + disk);
+
+	if (action & ACTION_STARTUP)
+	{
+		if (action & ~ACTION_STARTUP)
+		{
+			fprintf(stderr, 
+			"ERROR: don't use --startup with other flags\n");
+			return 2;
+		}
+
+		ret = emile_map_set_startup(disk_name, partition - 1);
+		if (ret == -1)
+			return 3;
+	}
+
+	if (action & ACTION_GET)
+	{
+		map = emile_map_open(disk_name, O_RDONLY);
+		if (map == NULL)
+		{
+			fprintf(stderr, "ERROR: cannot open partition map\n");
+			return 4;
+		}
+
+		if (appledriver == NULL) {
+			fprintf(stderr, "ERROR: filename missing\n");
+			emile_map_close(map);
+			return 6;
+		}
+
+		ret = get_driver(map, partition - 1, appledriver);
+		if (ret == -1) {
+			fprintf(stderr, 
+		"ERROR: cannot put driver from partition %d to file %s\n", 
+				partition, appledriver);
+			emile_map_close(map);
+			return 6;
+		}
+
+		emile_map_close(map);
+		return 0;
+	}
+
+	if (action & ACTION_PUT)
+	{
+		map = emile_map_open(disk_name, O_RDWR);
+		if (map == NULL)
+		{
+			fprintf(stderr, "ERROR: cannot open partition map\n");
+			return 4;
+		}
+
+		if (appledriver == NULL) {
+			fprintf(stderr, "ERROR: filename missing\n");
+			emile_map_close(map);
+			return 6;
+		}
+
+		ret = put_driver(map, partition - 1, appledriver);
+		if (ret == -1) {
+			fprintf(stderr, 
+		"ERROR: cannot put driver to partition %d from file %s\n", 
+				partition, appledriver);
+			emile_map_close(map);
+			return 6;
+		}
+
+		emile_map_close(map);
+		return 0;
+	}
+
+	map = emile_map_open(disk_name, O_RDWR);
+	if (map == NULL)
+	{
+		fprintf(stderr, "ERROR: cannot open partition map\n");
+		return 4;
+	}
+
+	ret = emile_map_read(map, partition - 1);
+	if (ret != partition - 1)
+	{
+		fprintf(stderr, 
+			"ERROR: cannot read partition %d info\n", partition);
+		return 5;
+	}
+
+	if (action & ACTION_FLAGS)
+	{
+		emile_map_partition_set_flags(map, flags);
+	}
+
+	if (action & ACTION_TYPE)
+	{
+		ret = emile_map_set_partition_type(map, type);
+		if (ret == -1)
+		{
+			fprintf(stderr, 
+			"ERROR: cannot set partition type to %s\n", type);
+			return 7;
+		}
+	}
+
+	ret = emile_map_write(map,  partition - 1);
+	if (ret != partition - 1)
+	{
+		fprintf(stderr, 
+			"ERROR: cannot write partition %d info\n", partition);
+		return 8;
+	}
+
+	emile_map_close(map);
+
+	return 0;
+}

Added: branches/vendor/emile/tools/emile-set-cmdline.c
===================================================================
--- branches/vendor/emile/tools/emile-set-cmdline.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/tools/emile-set-cmdline.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,156 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "libemile.h"
+
+static void usage(int argc, char** argv)
+{
+	fprintf(stderr, "Usage: %s <file> <cmdline>\n", argv[0]);
+	fprintf(stderr, "Usage: %s -r <file>\n", argv[0]);
+	fprintf(stderr, "\n     Allows to set the kernel command line <cmdline>\n");
+	fprintf(stderr, "     into the floppy image or the second level file\n");
+	fprintf(stderr, "     <image> can be a file or a device (/dev/fd0)\n");
+	fprintf(stderr, "     with \"-r\" flag, display current command line\n");
+	fprintf(stderr, "\n     Examples:\n");
+	fprintf(stderr, "\n     To set root filesystem on disk 1 partition 4\n");
+	fprintf(stderr, "\n     %s floppy.img \"root=/dev/sda4\"\n", argv[0]);
+	fprintf(stderr, "\n     To set root filesystem on ramdisk\n");
+	fprintf(stderr, "\n     %s floppy.img \"root=/dev/ramdisk ramdisk_size=2048\"\n", argv[0]);
+	fprintf(stderr, "\n     To set root filesystem on NFS\n");
+	fprintf(stderr, "\n     %s floppy.img \"root=/dev/nfs ip=dhcp nfsroot=192.168.100.1:/tftboot/192.168.100.51/\"\n", argv[0]);
+	/* and when kernel will support floppy driver:
+         * KERNEL_ARGS="vga=normal noinitrd load_ramdisk=1 prompt_ramdisk=1 ramdisk_size=16384 root=/dev/fd0 disksize=1.44 flavor=compact"
+	 */
+	fprintf(stderr, "\nbuild: \n%s\n", SIGNATURE);
+}
+
+int set_cmdline(char* image, char* cmdline)
+{
+	int fd;
+	int ret;
+	int drive, second, size;
+	char *configuration;
+	off_t offset;
+
+	fd = open(image, O_RDWR);
+
+	if (fd == -1)
+	{
+		perror("Cannot open image file");
+		return 2;
+	}
+
+	/* can work on an image or directly on second level file */
+
+        ret = emile_first_get_param(fd, &drive, &second, &size);
+	if (ret == EEMILE_UNKNOWN_FIRST)
+	{
+		/* should be a second level file */
+
+		ret = lseek(fd, 0, SEEK_SET);
+		if (ret == -1)
+		{
+			perror("Cannot go to buffer offset");
+			close(fd);
+			return 3;
+		}
+	}
+	offset = lseek(fd, 0, SEEK_CUR);
+
+	configuration = emile_second_get_configuration(fd);
+	if (configuration == NULL)
+		return 4;
+
+	emile_second_set_property(configuration, "parameters", cmdline);
+
+	ret = lseek(fd, offset, SEEK_SET);
+	if (ret == -1)
+		return 5;
+
+	ret = emile_second_set_configuration(fd, configuration);
+	if (ret != 0)
+		return 6;
+
+	free(configuration);
+
+	close(fd);
+
+	return 0;
+}
+
+int get_cmdline(char* image)
+{
+	int fd;
+	int ret;
+	char cmdline[255];
+	char *configuration;
+	int drive, second, size;
+
+	fd = open(image, O_RDONLY);
+	if (fd == -1)
+	{
+		perror("Cannot open image file");
+		return 2;
+	}
+
+	/* can work on an image or directly on second level file */
+
+        ret = emile_first_get_param(fd, &drive, &second, &size);
+	if (ret == EEMILE_UNKNOWN_FIRST)
+	{
+		/* should be a second level file */
+
+		ret = lseek(fd, 0, SEEK_SET);
+		if (ret == -1)
+		{
+			perror("Cannot go to buffer offset");
+			close(fd);
+			return 3;
+		}
+	}
+
+	configuration = emile_second_get_configuration(fd);
+	if (configuration == NULL)
+		return 4;
+
+	ret = emile_second_get_property(configuration, "parameters", cmdline);
+
+	if (ret != 0)
+		fprintf(stderr, "No command line found\n");
+	else
+		printf("Current command line: \"%s\"\n", cmdline);
+
+	free(configuration);
+
+	close(fd);
+
+	return 0;
+}
+
+int main(int argc, char** argv)
+{
+	int ret;
+	if (argc != 3)
+	{
+		usage(argc, argv);
+		return 1;
+	}
+
+	if (strcmp(argv[1], "-r") == 0)
+		ret = get_cmdline(argv[2]);
+	else
+		ret = set_cmdline(argv[1], argv[2]);
+
+	return ret;
+}

Added: branches/vendor/emile/tools/emile-set-output.c
===================================================================
--- branches/vendor/emile/tools/emile-set-output.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/tools/emile-set-output.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,406 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <getopt.h>
+
+#include "libemile.h"
+
+static char parity[] = { 'n', 'o', 'e' };
+enum {
+	ARG_NONE = 0,
+	ARG_HELP = 'h',
+	ARG_DISPLAY,
+	ARG_WIDTH,
+	ARG_HEIGHT,
+	ARG_DEPTH,
+	ARG_MODEM,
+	ARG_PRINTER,
+	ARG_BITRATE,
+	ARG_DATASIZE,
+	ARG_PARITY,
+	ARG_STOPBITS,
+	ARG_NODISPLAY,
+	ARG_NOMODEM,
+	ARG_NOPRINTER,
+	ARG_GESTALTID,
+};
+
+static struct option long_options[] =
+{
+	{"help",	0, NULL,	ARG_HELP	},
+	{"display",	0, NULL,	ARG_DISPLAY	},
+	{"width",	1, NULL,	ARG_WIDTH	},
+	{"height",	1, NULL,	ARG_HEIGHT	},
+	{"depth",	1, NULL,	ARG_DEPTH	},
+	{"modem",	0, NULL,	ARG_MODEM	},
+	{"printer",	0, NULL,	ARG_PRINTER	},
+	{"bitrate",	1, NULL,	ARG_BITRATE	},
+	{"datasize",	1, NULL,	ARG_DATASIZE	},
+	{"parity",	1, NULL,	ARG_PARITY	},
+	{"stopbits",	1, NULL,	ARG_STOPBITS	},
+	{"nodisplay",	0, NULL,	ARG_NODISPLAY	},
+	{"nomodem",	0, NULL,	ARG_NOMODEM	},
+	{"noprinter",	0, NULL,	ARG_NOPRINTER	},
+	{"gestaltid",	1, NULL,	ARG_GESTALTID	},
+	{NULL,		0, NULL,	0		},
+};
+
+enum {
+	STDOUT_VGA = 1,
+	STDOUT_MODEM = 2,
+	STDOUT_PRINTER = 4,
+};
+
+static void usage(int argc, char** argv)
+{
+	fprintf(stderr, "Usage:\n");
+	fprintf(stderr, "\n%s <file> --display [--width <width>] [--height <height>] [--depth <depth>]\n", argv[0]);
+	fprintf(stderr, "     Enable output to display and set configuration\n");
+	fprintf(stderr, "\n%s <image> --modem [--bitrate <bitrate>] [--datasize <datasize>] [--parity <parity>] [--stopbits <stopbits>]\n", argv[0]);
+	fprintf(stderr, "     Enable output to serial port 0 (modem) and set configuration\n");
+	fprintf(stderr, "\n%s <image> --printer [--bitrate <bitrate>] [--datasize <datasize>] [--parity <parity>] [--stopbits <stopbits>]\n", argv[0]);
+	fprintf(stderr, "     Enable output to serial port 1 (printer) and set configuration\n");
+	fprintf(stderr, "\n     <parity> is 0 for none, 1 for odd, 2 for even\n");
+	fprintf(stderr, "\n%s <image> --nodisplay\n", argv[0]);
+	fprintf(stderr, "     Disable output to display\n");
+	fprintf(stderr, "\n%s <image> --nomodem\n", argv[0]);
+	fprintf(stderr, "     Disable output to port 0 (modem)\n");
+	fprintf(stderr, "\n%s <image> --noprinter\n", argv[0]);
+	fprintf(stderr, "     Disable output to port 1 (printer)\n");
+	fprintf(stderr, "\n%s <image> --gestaltid <id>\n", argv[0]);
+	fprintf(stderr, "     Force <id> as gestalt id (set 0 to unset)\n");
+	fprintf(stderr, "\n%s <image>\n", argv[0]);
+	fprintf(stderr, "     Display current configuration\n");
+	fprintf(stderr, "\nbuild: \n%s\n", SIGNATURE);
+}
+
+static int display_output(char* image)
+{
+	int drive, second, size;
+	char *configuration;
+	char property[256];
+
+	int fd;
+	int ret;
+
+	fd = open(image, O_RDONLY);
+
+	if (fd == -1)
+	{
+		perror("Cannot open file");
+		return 2;
+	}
+
+	/* can work on an image or directly on second level file */
+
+	ret = emile_first_get_param(fd, &drive, &second, &size);
+	if (ret == EEMILE_UNKNOWN_FIRST)
+	{
+		/* should be a second level file */
+		ret = lseek(fd, 0, SEEK_SET);
+		if (ret == -1)
+		{
+			perror("Cannot go to buffer offset");
+			close(fd);
+			return 3;
+		}
+	}
+
+	configuration = emile_second_get_configuration(fd);
+	if (configuration == NULL)
+	{
+		perror("Cannot read header");
+		close(fd);
+		return 4;
+	}
+
+	close(fd);
+
+	if (emile_second_get_property(configuration, "vga", property) == 0)
+		printf("Output to display enabled (%s)\n", property);
+	else
+		printf("Output to display disabled\n");
+
+	if (emile_second_get_property(configuration, "modem", property) == 0)
+		printf("Output to serial port 0 (modem) enabled (%s)\n", property);
+	else
+		printf("Output to serial port 0 (modem) disabled\n");
+
+	if (emile_second_get_property(configuration, "printer", property) == 0)
+		printf("Output to serial port 1 (printer) enabled (%s)\n", property);
+	else
+		printf("Output to serial port 1 (printer) disabled\n");
+
+	if (emile_second_get_property(configuration, "gestaltID", property) == 0)
+		printf("Force Gestalt ID to %ld\n", strtol(property, NULL, 0));
+	else
+		printf("Gestalt ID is not modified\n");
+
+	free(configuration);
+
+	return 0;
+}
+
+static int set_output(char* image,
+		      unsigned int enable_mask, unsigned int disable_mask, 
+		      unsigned int bitrate0, int datasize0,
+		      int parity0, int stopbits0,
+		      unsigned int bitrate1, int datasize1,
+		      int parity1, int stopbits1, int gestaltid)
+{
+	int drive, second, size;
+	int fd;
+	int ret;
+	char *configuration;
+	char property[32];
+	int offset;
+
+	fd = open(image, O_RDWR);
+
+	if (fd == -1)
+	{
+		perror("Cannot open image file");
+		return 2;
+	}
+
+	/* can work on an image or directly on second level file */
+
+	ret = emile_first_get_param(fd, &drive, &second, &size);
+	if (ret == EEMILE_UNKNOWN_FIRST)
+	{
+		/* should be a second level file */
+		offset = lseek(fd, 0, SEEK_SET);
+		if (offset == -1)
+		{
+			perror("Cannot go to buffer offset");
+			close(fd);
+			return 3;
+		}
+	}
+
+	configuration = emile_second_get_configuration(fd);
+	if (configuration == NULL)
+	{
+		perror("Cannot read header");
+		close(fd);
+		return 4;
+	}
+
+	if (disable_mask & STDOUT_VGA)
+		emile_second_remove_property(configuration, "vga");
+	if (disable_mask & STDOUT_MODEM)
+		emile_second_remove_property(configuration, "modem");
+	if (disable_mask & STDOUT_PRINTER)
+		emile_second_remove_property(configuration, "printer");
+
+	if (enable_mask & STDOUT_VGA)
+		emile_second_set_property(configuration, "vga", "default");
+	if (enable_mask & STDOUT_MODEM)
+	{
+		sprintf(property, "%d%c%d+%d", bitrate0, parity[parity0], datasize0, stopbits0);
+		emile_second_set_property(configuration, "modem", property);
+	}
+	if (enable_mask & STDOUT_PRINTER)
+	{
+		sprintf(property, "%d%c%d+%d", bitrate1, parity[parity1], datasize1, stopbits1);
+		emile_second_set_property(configuration, "printer", property);
+	}
+
+	if (gestaltid == 0)
+		emile_second_remove_property(configuration, "gestaltID");
+	else if (gestaltid != -1)
+	{
+		sprintf(property, "0x%x", gestaltid);
+		emile_second_set_property(configuration, "gestaltID", property);
+	}
+
+	ret = lseek(fd, offset, SEEK_SET);
+	if (ret == -1)
+	{
+		perror("Cannot go to buffer offset");
+		close(fd);
+		return 3;
+	}
+
+	ret = emile_second_set_configuration(fd, configuration);
+	if (ret)
+	{
+		perror("Cannot write header");
+		close(fd);
+		return 4;
+	}
+	close(fd);
+	free(configuration);
+
+	return 0;
+}
+
+int main(int argc, char** argv)
+{
+	int ret;
+	char* image;
+	int option_index;
+	int c;
+	unsigned int enable_mask = 0;
+	unsigned int disable_mask = 0;
+	unsigned int last = 0;
+	int width = 0, height = 0 , depth = 0;
+	unsigned int bitrate0 = 9600, bitrate1 = 9600;
+	int datasize0 = 8, datasize1 = 8;
+	int stopbits0 = 1, stopbits1 = 1;
+	int parity0 = 0, parity1 = 0;
+	int gestaltid = -1;
+
+	while(1)
+	{
+		c =  getopt_long(argc, argv, "h", long_options, 
+				 &option_index);
+		if (c == EOF)
+			break;
+
+		switch(c)
+		{
+		case ARG_HELP:
+			usage(argc, argv);
+			return 0;
+		case ARG_GESTALTID:
+			gestaltid = atol(optarg);
+			break;
+		case ARG_NODISPLAY:
+			disable_mask |= STDOUT_VGA;
+			last = 0;
+			break;
+		case ARG_NOMODEM:
+			disable_mask |= STDOUT_MODEM;
+			last = 0;
+			break;
+		case ARG_NOPRINTER:
+			disable_mask |= STDOUT_PRINTER;
+			last = 0;
+			break;
+		case ARG_DISPLAY:
+			enable_mask |= STDOUT_VGA;
+			last = STDOUT_VGA;
+			break;
+		case ARG_MODEM:
+			enable_mask |= STDOUT_MODEM;
+			last = STDOUT_MODEM;
+			break;
+		case ARG_PRINTER:
+			enable_mask |= STDOUT_PRINTER;
+			last = STDOUT_PRINTER;
+			break;
+		case ARG_WIDTH:
+			if (last != STDOUT_VGA)
+			{
+				fprintf(stderr, "missing --display\n");
+				return 1;
+			}
+			width = atol(optarg);
+			break;
+		case ARG_HEIGHT:
+			if (last != STDOUT_VGA)
+			{
+				fprintf(stderr, "missing --display\n");
+				return 1;
+			}
+			height = atol(optarg);
+			break;
+		case ARG_DEPTH:
+			if (last != STDOUT_VGA)
+			{
+				fprintf(stderr, "missing --display\n");
+				return 1;
+			}
+			depth = atol(optarg);
+			break;
+		case ARG_BITRATE:
+			if (last == STDOUT_MODEM)
+				bitrate0 = atol(optarg);
+			else if (last == STDOUT_PRINTER)
+				bitrate1 = atol(optarg);
+			else
+			{
+				fprintf(stderr,
+				"missing --modem or --printer\n");
+				return 1;
+			}
+			break;
+		case ARG_DATASIZE:
+			if (last == STDOUT_MODEM)
+				datasize0 = atol(optarg);
+			else if (last == STDOUT_PRINTER)
+				datasize1 = atol(optarg);
+			else
+			{
+				fprintf(stderr,
+				"missing --modem or --printer\n");
+				return 1;
+			}
+			break;
+		case ARG_PARITY:
+			if (last == STDOUT_MODEM)
+				parity0 = atol(optarg);
+			else if (last == STDOUT_PRINTER)
+				parity1 = atol(optarg);
+			else
+			{
+				fprintf(stderr,
+				"missing --modem or --printer\n");
+				return 1;
+			}
+			break;
+		case ARG_STOPBITS:
+			if (last == STDOUT_MODEM)
+				stopbits0 = atol(optarg);
+			else if (last == STDOUT_PRINTER)
+				stopbits1 = atol(optarg);
+			else
+			{
+				fprintf(stderr,
+				"missing --modem or --printer\n");
+				return 1;
+			}
+		}
+	}
+	if (optind < argc)
+		image = argv[optind];
+	if (image == NULL)
+	{
+		fprintf(stderr, "ERROR: missing image file name\n");
+		usage(argc, argv);
+		return 1;
+	}
+
+	if ( width || height || depth)
+	{
+		fprintf(stderr,
+	"WARNING: setting display properties is not yet implemented !\n");
+	}
+
+	if (enable_mask & disable_mask) {
+		fprintf(stderr, "Cannot enable and disable at same time\n");
+		return 2;
+	}
+	if ( (enable_mask == 0) && (disable_mask == 0) && (gestaltid == -1))
+	{
+		display_output(image);
+		return 0;
+	}
+	ret = set_output(image, enable_mask, disable_mask, 
+			 bitrate0, datasize0, parity0, stopbits0,
+			 bitrate1, datasize1, parity1, stopbits1,
+			 gestaltid);
+
+	return ret;
+}

Added: branches/vendor/emile/tools/emile.c
===================================================================
--- branches/vendor/emile/tools/emile.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/tools/emile.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,789 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <getopt.h>
+
+#include "libemile.h"
+
+int verbose = 0;
+
+extern void scanbus(void);
+
+static char *first_path = PREFIX "/boot/emile/first_scsi";
+static char *second_path = PREFIX "/boot/emile/second_scsi";
+static char *kernel_path = PREFIX "/boot/vmlinuz";
+static char *map_path = NULL;
+static char *backup_path = NULL;
+static char *partition = NULL;
+static char *append_string = NULL;
+
+enum {
+	ACTION_NONE =		0x00000000,
+	ACTION_SCANBUS = 	0x00000001,
+	ACTION_SET_HFS = 	0x00000002,
+	ACTION_RESTORE = 	0x00000004,
+	ACTION_BACKUP = 	0x00000008,
+	ACTION_APPEND = 	0x00000010,
+	ACTION_TEST =		0x00000020,
+	ACTION_FIRST =		0x00000040,
+	ACTION_SECOND =		0x00000080,
+	ACTION_KERNEL =		0x00000100,
+	ACTION_PARTITION = 	0x00000200,
+	ACTION_MAP =	 	0x00000400,
+};
+
+enum {
+	ARG_NONE = 0,
+	ARG_SCANBUS,
+	ARG_SET_HFS,
+	ARG_RESTORE,
+	ARG_BACKUP,
+	ARG_APPEND = 'a',
+	ARG_VERBOSE ='v',
+	ARG_TEST = 't',
+	ARG_FIRST = 'f',
+	ARG_SECOND = 's',
+	ARG_KERNEL = 'k',
+	ARG_PARTITION = 'p',
+	ARG_HELP = 'h',
+	ARG_MAP = 'm',
+};
+
+static struct option long_options[] =
+{
+	{"verbose",	0, NULL,	ARG_VERBOSE		},
+	{"first",	1, NULL,	ARG_FIRST		},
+	{"second",	1, NULL,	ARG_SECOND		},
+	{"kernel",	1, NULL,	ARG_KERNEL		},
+	{"map",		1, NULL,	ARG_MAP			},
+	{"partition",	1, NULL,	ARG_PARTITION		},
+	{"help",	0, NULL,	ARG_HELP		},
+	{"scanbus",	0, NULL,	ARG_SCANBUS		},
+	{"set-hfs",	0, NULL,	ARG_SET_HFS 		},
+	{"restore",	2, NULL,	ARG_RESTORE 		},
+	{"backup",	2,  NULL,	ARG_BACKUP	 	},
+	{"test", 	0, NULL,	ARG_TEST 		},
+	{"append", 	0, NULL,	ARG_APPEND 		},
+	{NULL,		0, NULL,	0			}
+};
+
+static void usage(int argc, char** argv)
+{
+	fprintf(stderr, "Usage: %s [OPTION]\n", argv[0]);
+	fprintf(stderr, "Update and install EMILE stuff on your SCSI disk.\n");
+	fprintf(stderr, "EMILE allows to boot linux directly from linux partition\n");
+	fprintf(stderr,"  -h, --help           display this text\n");
+	fprintf(stderr,"  -v, --verbose        active verbose mode\n");
+	fprintf(stderr,"  -t, --test           active test mode (don't write to disk)\n");
+	fprintf(stderr,"  --scanbus            display information about all disks and partitions\n");
+	fprintf(stderr,"  -f, --first PATH     set path of EMILE first level\n");
+	fprintf(stderr,"  -s, --second PATH    set path of EMILE second level\n");
+	fprintf(stderr,"  -k, --kernel PATH    set path of kernel\n");
+	fprintf(stderr,"  -m, --map PATH       set path to the EMILE kernel map file (generated)\n");
+	fprintf(stderr,"  -a, --append ARG     set kernel command line\n");
+	fprintf(stderr,"  -p, --partition DEV  define device where to install boot block\n");
+	fprintf(stderr,"  --restore[=FILE]     save current boot block from FILE\n");
+	fprintf(stderr,"  --backup[=FILE]      save current boot block to FILE\n");
+	fprintf(stderr,"  --set-hfs            set type of partition DEV to Apple_HFS (needed to be bootable)\n");
+	fprintf(stderr, "\nUse \"--test\" to see default values\n");
+	fprintf(stderr, "!!! USE WITH CAUTION AND AT YOUR OWN RISK !!!\n");
+
+	fprintf(stderr, "\nbuild: \n%s\n", SIGNATURE);
+}
+
+static int open_map_of( char *dev_name, int flags, 
+			emile_map_t **map, int *partition)
+{
+	int ret;
+	int disk;
+	char disk_name[16];
+	char *driver;
+
+	ret = emile_scsi_get_rdev(dev_name, &driver, &disk, partition);
+	if (ret == -1)
+		return -1;
+
+	sprintf(disk_name, "%s%c", driver, 'a' + disk);
+
+	*map = emile_map_open(disk_name, flags);
+	if (*map == NULL)
+		return -1;
+
+	return 0;
+}
+
+static int check_has_apple_driver(char *dev_name)
+{
+	emile_map_t *map;
+	int partition;
+	int ret;
+
+	ret = open_map_of(dev_name, O_RDONLY, &map, &partition);
+	if (ret == -1)
+		return -1;
+
+	ret = emile_map_has_apple_driver(map);
+	emile_map_close(map);
+
+	return ret;
+}
+
+static int check_is_hfs(char *dev_name)
+{
+	emile_map_t *map;
+	int ret;
+	int partition;
+	char *part_type;
+
+	ret = open_map_of(dev_name, O_RDONLY, &map, &partition);
+	if (ret == -1)
+		return -1;
+
+	ret = emile_map_read(map, partition - 1);
+	if (ret == -1)
+		return -1;
+
+	part_type = emile_map_get_partition_type(map);
+	ret = (strcmp("Apple_HFS", part_type) == 0);
+
+	emile_map_close(map);
+
+	return ret;
+}
+
+static int check_is_EMILE_bootblock(char *dev_name)
+{
+	emile_map_t *map;
+	int ret;
+	int partition;
+	char bootblock[BOOTBLOCK_SIZE];
+	int bootblock_type;
+
+	ret = open_map_of(dev_name, O_RDONLY, &map, &partition);
+	if (ret == -1)
+		return -1;
+
+	ret = emile_map_read(map, partition - 1);
+	if (ret == -1)
+		return -1;
+
+	ret = emile_map_bootblock_read(map, bootblock);
+	if (ret == -1)
+		return -1;
+
+	bootblock_type = emile_map_bootblock_get_type(bootblock);
+
+	emile_map_close(map);
+
+	return EMILE_BOOTBLOCK == bootblock_type;
+}
+
+static int backup_bootblock(char *dev_name, char *filename)
+{
+	emile_map_t *map;
+	int ret;
+	int partition;
+	char bootblock[BOOTBLOCK_SIZE];
+	int fd;
+
+	ret = open_map_of(dev_name, O_RDONLY, &map, &partition);
+	if (ret == -1)
+		return -1;
+
+	ret = emile_map_read(map, partition - 1);
+	if (ret == -1)
+		return -1;
+
+	ret = emile_map_bootblock_read(map, bootblock);
+	if (ret == -1)
+		return -1;
+
+	emile_map_close(map);
+
+	/* save bootblock */
+
+	fd = open(filename, O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR);
+	if (fd == -1)
+	{
+		if (errno == EEXIST)
+		{
+			fprintf(stderr, "ERROR: \"%s\" already exists.\n",
+					filename);
+		}
+		return -1;
+	}
+
+	ret = write(fd, bootblock, BOOTBLOCK_SIZE);
+	if (ret != BOOTBLOCK_SIZE)
+		return -1;
+
+	close(fd);
+
+	return 0;
+}
+
+static int restore_bootblock(char *dev_name, char *filename)
+{
+	emile_map_t *map;
+	int ret;
+	int partition;
+	char bootblock[BOOTBLOCK_SIZE];
+	int fd;
+
+	if (!check_is_EMILE_bootblock(dev_name))
+	{
+		fprintf(stderr, "ERROR: cannot restore bootblock over non-EMILE bootblock\n");
+		return -1;
+	}
+
+	/* read bootblock */
+
+	fd = open(filename, O_RDONLY);
+	if (fd == -1)
+		return -1;
+
+	ret = read(fd, bootblock, BOOTBLOCK_SIZE);
+	if (ret != BOOTBLOCK_SIZE)
+		return -1;
+
+	close(fd);
+
+	/* write bootblock */
+
+	ret = open_map_of(dev_name, O_RDWR, &map, &partition);
+	if (ret == -1)
+		return -1;
+
+	ret = emile_map_read(map, partition - 1);
+	if (ret == -1)
+		return -1;
+
+	ret = emile_map_bootblock_write(map, bootblock);
+	if (ret == -1)
+		return -1;
+
+	emile_map_close(map);
+
+	return 0;
+}
+
+static int copy_file_to_bootblock(char* first_path, char* dev_name)
+{
+	emile_map_t *map;
+	int ret;
+	int partition;
+	char bootblock[BOOTBLOCK_SIZE];
+	int fd;
+
+	/* read first level */
+
+	fd = open(first_path, O_RDONLY);
+	if (fd == -1)
+		return -1;
+
+	ret = read(fd, bootblock, BOOTBLOCK_SIZE);
+	if (ret != BOOTBLOCK_SIZE)
+		return -1;
+
+	close(fd);
+
+	/* write bootblock to partition */
+
+	ret = open_map_of(dev_name, O_RDWR, &map, &partition);
+	if (ret == -1)
+		return -1;
+
+	ret = emile_map_read(map, partition - 1);
+	if (ret == -1)
+		return -1;
+
+	ret = emile_map_bootblock_write(map, bootblock);
+	if (ret == -1)
+		return -1;
+
+	emile_map_close(map);
+
+	return 0;
+}
+
+static int set_HFS(char *dev_name)
+{
+	emile_map_t *map;
+	int ret;
+	int partition;
+
+	ret = open_map_of(dev_name, O_RDWR, &map, &partition);
+	if (ret == -1)
+		return -1;
+
+	ret = emile_map_read(map, partition - 1);
+	if (ret == -1)
+		return -1;
+
+	ret = emile_map_set_partition_type(map, "Apple_HFS");
+	if (ret == -1)
+		return -1;
+
+	ret = emile_map_partition_set_bootable(map, 1);
+	if (ret == -1)
+		return -1;
+
+	ret = emile_map_write(map, partition - 1);
+	if (ret == -1)
+		return -1;
+
+	emile_map_close(map);
+
+	return 0;
+}
+
+int main(int argc, char **argv)
+{
+	int ret;
+	int c;
+	int option_index = 0;
+	char tmp_partition[16];
+	char tmp_append[512];
+	int fd;
+	int action = ACTION_NONE;
+
+	while(1)
+	{
+		c = getopt_long(argc, argv, "vhtf:a:s:k:b:", long_options, &option_index);
+		if (c == -1)
+			break;
+		switch(c)
+		{
+		case ARG_VERBOSE:
+			verbose++;
+			break;
+		case ARG_HELP:
+			usage(argc, argv);
+			return 0;
+		case ARG_SCANBUS:
+			action |= ACTION_SCANBUS;
+			break;
+		case ARG_FIRST:
+			action |= ACTION_FIRST;
+			first_path = optarg;
+			break;
+		case ARG_SECOND:
+			action |= ACTION_SECOND;
+			second_path = optarg;
+			break;
+		case ARG_KERNEL:
+			action |= ACTION_KERNEL;
+			kernel_path = optarg;
+			break;
+		case ARG_MAP:
+			action |= ACTION_MAP;
+			map_path = optarg;
+			break;
+		case ARG_PARTITION:
+			action |= ACTION_PARTITION;
+			partition = optarg;
+			break;
+		case ARG_SET_HFS:
+			action |= ACTION_SET_HFS;
+			break;
+		case ARG_RESTORE:
+			action |= ACTION_RESTORE;
+			if (optarg != NULL)
+				backup_path = optarg;
+			else
+				backup_path = PREFIX "/boot/emile/bootblock.backup";
+			break;
+		case ARG_BACKUP:
+			action |= ACTION_BACKUP;
+			if (optarg != NULL)
+				backup_path = optarg;
+			else
+				backup_path = PREFIX "/boot/emile/bootblock.backup";
+			break;
+		case ARG_APPEND:
+			action |= ACTION_APPEND;
+			append_string = optarg;
+			break;
+		case ARG_TEST:
+			action |= ACTION_TEST;
+			break;
+		default:
+			fprintf(stderr, "ERROR: unknown option %s (%d, %c)\n",
+					argv[optind], c, c);
+			return 1;
+		}
+	}
+
+	if (action & ACTION_SCANBUS) {
+
+		if (action & ~ACTION_SCANBUS) {
+			fprintf(stderr, 
+	"ERROR: \"--scanbus\" cannot be used with other arguments\n");
+			return 1;
+		}
+
+		scanbus();
+		return 0;
+	}
+
+	/* seek first HFS partition */
+
+	if (partition == NULL)
+	{
+		int fd;
+		char dev_name[16];
+		emile_map_t* map;
+		char *part_type;
+		int i;
+		char *driver;
+		int disk;
+		int partnb;
+
+		fd = open(second_path, O_RDONLY);
+		if (fd == -1)
+		{
+			fprintf(stderr, "ERROR: cannot open \"%s\"\n", 
+					second_path);
+			return 2;
+		}
+
+		ret = emile_scsi_get_dev(fd, &driver, &disk, &partnb);
+		if (ret == -1)
+		{
+			fprintf(stderr,"ERROR: cannot find device of \"%s\"\n", 
+					second_path);
+			return 2;
+		}
+		close(fd);
+
+		sprintf(dev_name, "%s%c", driver, disk + 'a');
+
+		 /* ROM boots on the first HFS partition it finds */
+
+		map = emile_map_open(dev_name, O_RDONLY);
+		if (map == NULL)
+		{
+			fprintf(stderr, "ERROR: cannot open partition map\n");
+			return 2;
+		}
+
+		for (i = 0; i < emile_map_get_number(map); i++)
+		{
+			ret = emile_map_read(map, i);
+			if (ret == -1)
+				break;
+
+			part_type = emile_map_get_partition_type(map);
+			if (strcmp(part_type, "Apple_HFS") == 0)
+			{
+				sprintf(tmp_partition, "%s%d", dev_name, i + 1);
+				partition = tmp_partition;
+				break;
+			}
+		}
+		emile_map_close(map);
+	}
+
+	/* if there is no HFS partition, we'll use the partition
+	 * where there is second_scsi (/boot or /)
+	 */
+
+	if (partition == NULL)
+	{
+		int fd;
+		char *driver;
+		int disk;
+		int partnb;
+
+		fd = open(second_path, O_RDONLY);
+		if (fd == -1)
+			return 2;
+		ret = emile_scsi_get_dev(fd, &driver, &disk, &partnb);
+		if (ret == 0)
+		{
+			sprintf(tmp_partition, 
+				"%s%c%d", driver, disk + 'a', partnb);
+			partition = tmp_partition;
+		}
+		close(fd);
+	}
+
+	if (partition == NULL)
+	{
+		fprintf(stderr, 
+	"ERROR: you must specify a partition to set EMILE bootblock\n");
+		fprintf(stderr,
+	"       you can have the list of available partitions with \"--scanbus\".\n");
+		return 3;
+	}
+
+	if (action & ACTION_RESTORE)
+	{
+		if (action & ~(ACTION_RESTORE | ACTION_PARTITION))
+		{
+			fprintf(stderr, 
+	"ERROR: \"--restore\" cannot be used with other arguments\n");
+			return 13;
+		}
+
+		ret = restore_bootblock(partition, backup_path);
+		if (ret == -1)
+		{
+			fprintf(stderr, 
+			"ERROR: cannot restore bootblock %s from %s\n", 
+			partition, backup_path);
+			return 14;
+		}
+		printf("Bootblock restore successfully done.\n");
+
+		return 0;
+	}
+
+	if (append_string == NULL)
+	{
+		char *driver;
+		int disk;
+		int partnb;
+
+		fd = open(second_path, O_RDONLY);
+		if (fd == -1)
+		{
+			fprintf(stderr, "ERROR: cannot open \"%s\"\n", 
+					second_path);
+			return 2;
+		}
+
+		ret = emile_scsi_get_dev(fd, &driver, &disk, &partnb);
+		if (ret == -1)
+		{
+			fprintf(stderr,"ERROR: cannot find device of \"%s\"\n", 
+					second_path);
+			return 2;
+		}
+		close(fd);
+
+		sprintf(tmp_append, "root=%s%c%d", driver, disk + 'a', partnb);
+		append_string = tmp_append;
+	}
+
+	ret = check_has_apple_driver(partition);
+	if (ret == -1)
+	{
+		fprintf(stderr, "ERROR: cannot check if Apple_Driver exists\n");
+		fprintf(stderr, "       you should try as root\n");
+		if ((action & ACTION_TEST) == 0)
+			return 4;
+	}
+	if (ret == 0)
+	{
+		fprintf(stderr,
+	"ERROR: to be bootable a disk must have an Apple Driver on it\n");
+		fprintf(stderr,
+	"       You must partition this disk with Apple Disk utility\n");
+		fprintf(stderr,
+	"       or wait a release of EMILE allowing you to add this driver\n");
+		if ((action & ACTION_TEST) == 0)
+			return 5;
+	}
+
+	ret = check_is_hfs(partition);
+	if (ret == -1)
+	{
+		fprintf(stderr,
+			"ERROR: cannot check if partition is Apple_HFS\n");
+		fprintf(stderr, "       you should try as root\n");
+		if ((action & ACTION_TEST) == 0)
+			return 6;
+	}
+	if ( (ret == 0) && (action & ACTION_SET_HFS) )
+	{
+		fprintf(stderr,
+	"ERROR: to be bootable a partition must be of type Apple_HFS\n");
+		fprintf(stderr,
+	"       you can change it to Apple_HFS using \"--set-hfs\" argument\n");
+		if ((action & ACTION_TEST) == 0)
+			return 7;
+	}
+
+	ret = check_is_EMILE_bootblock(partition);
+	if (ret == -1)
+	{
+		fprintf(stderr, "ERROR: cannot check bootblock type\n");
+		fprintf(stderr, "       you should try as root\n");
+		if ((action & ACTION_TEST) == 0)
+			return 8;
+	}
+	if ( (ret == 0) && ((action & ACTION_BACKUP) == 0) )
+	{
+		fprintf(stderr,
+	"ERROR: there is already a bootblock on \"%s\"\n", partition);
+		fprintf(stderr,
+	"       you must use \"--backup\" to save it\n");
+		if ((action & ACTION_TEST) == 0)
+			return 9;
+	}
+	
+	if (action & ACTION_BACKUP)
+	{
+		if (action & ACTION_TEST)
+		{
+			fprintf(stderr, 
+	"ERROR: \"--backup\" cannot be used with \"--test\"\n");
+			return 13;
+		}
+
+		ret = backup_bootblock(partition, backup_path);
+		if (ret == -1)
+		{
+			fprintf(stderr, 
+			"ERROR: cannot backup bootblock %s to %s\n", 
+			partition, backup_path);
+			return 14;
+		}
+		printf("Bootblock backup successfully done.\n");
+	}
+
+	if (map_path == NULL)
+	{
+		map_path = (char*)malloc(strlen(kernel_path) + 5);
+		if (map_path == NULL)
+		{
+			fprintf(stderr,
+			"ERROR: cannot allocate memory\n");
+			return 15;
+		}
+		sprintf(map_path, "%s.map", kernel_path);
+	}
+
+	printf("partition:   %s\n", partition);
+	printf("first:       %s\n", first_path);
+	printf("second:      %s\n", second_path);
+	printf("kernel:      %s\n", kernel_path);
+	printf("map file:    %s\n", map_path);
+	printf("append:      %s\n", append_string);
+
+	/* set kernel info into second level */
+
+	fd = open(second_path, O_RDWR);
+	if (fd == -1)
+	{
+		fprintf(stderr, "ERROR: cannot open \"%s\"\n",
+				second_path);
+		return 16;
+	}
+
+	if ((action & ACTION_TEST) == 0)
+	{
+		char *configuration;
+		struct emile_container *container;
+		short unit_id;
+		char map_info[64];
+
+		container = emile_second_create_mapfile(&unit_id, map_path, kernel_path);
+		if (container == NULL)
+		{
+			fprintf(stderr, 
+		"ERROR: cannot set \"%s\" information in \"%s\".\n", 
+				kernel_path, map_path);
+			return 17;
+		}
+
+		/* set second configuration */
+
+		lseek(fd, 0, SEEK_SET);
+		configuration = emile_second_get_configuration(fd);
+
+		/* set kernel info */
+
+		sprintf(map_info, "container:(sd%d)0x%x,0x%x", unit_id, 
+				   container->blocks[0].offset, container->blocks[0].count);
+		emile_second_set_property(configuration, "kernel", map_info);
+
+		/* set cmdline */
+
+		emile_second_set_property(configuration, "parameters", append_string);
+		emile_second_set_property(configuration, "vga", "default");
+
+		/* save configuration */
+
+		lseek(fd, 0, SEEK_SET);
+		ret = emile_second_set_configuration(fd, configuration);
+		if (ret != 0)
+		{
+			free(configuration);
+			fprintf(stderr,
+		"ERROR: cannot set configuration in %s\n", second_path);
+			return 19;
+		}
+		free(configuration);
+	}
+
+	close(fd);
+
+	/* set second info in first level */
+
+	fd = open(first_path, O_RDWR);
+	if (fd == -1)
+	{
+		fprintf(stderr, 
+			"ERROR: cannot open \"%s\".\n", first_path);
+		return 20;
+	}
+
+	if ((action & ACTION_TEST) == 0)
+	{
+		ret = emile_first_set_param_scsi(fd, second_path);
+		if (ret == -1)
+		{
+			fprintf(stderr, 
+		"ERROR: cannot set \"%s\" information into \"%s\".\n", 
+				second_path, first_path);
+			return 21;
+		}
+	}
+
+	close(fd);
+
+	if ((action & ACTION_TEST) == 0)
+	{
+		/* copy first level to boot block */
+
+		ret = copy_file_to_bootblock(first_path, partition);
+		if (ret == -1)
+		{
+			fprintf(stderr,
+		"ERROR: cannot write \"%s\" to bootblock of \"%s\".\n", 
+					first_path, partition);
+			fprintf(stderr,
+		"       %s\n", strerror(errno));
+			return 22;
+		}
+
+		/* set HFS if needed */
+
+		if (action & ACTION_SET_HFS)
+		{
+			ret = set_HFS(partition);
+			if (ret == -1)
+			{
+				fprintf( stderr, 
+			"ERROR: cannot set partition type of \"%s\" to Apple_HFS.\n"
+					, partition);
+				return 23;
+			}
+		}
+	}
+	
+	return 0;
+}

Added: branches/vendor/emile/tools/emile_scanbus.c
===================================================================
--- branches/vendor/emile/tools/emile_scanbus.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/tools/emile_scanbus.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,224 @@
+/*
+ *
+ * (c) 2004 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <getopt.h>
+
+#include "libemile.h"
+
+#define EMILE_MAX_DISK		16
+#define EMILE_MAX_DEVNAME	16
+
+typedef char device_name_t[EMILE_MAX_DEVNAME];
+
+extern int verbose;
+
+static void print_size(int nb_blocks, int block_size)
+{
+	int B, GB, MB, kB;
+
+	B = (nb_blocks * block_size) % 1024;
+
+	if (block_size > 1024)
+		kB = nb_blocks * (block_size / 1024);
+	else
+		kB = nb_blocks / (1024 / block_size);
+	
+	MB = kB / 1024;
+	kB = kB % 1024;
+
+	GB = MB / 1024;
+	MB = MB % 1024;
+
+	if (GB)
+		printf("%d.%03d GB", GB, MB * 1000 / 1024);
+	else if (MB)
+		printf("%d.%03d MB", MB, kB * 1000 / 1024);
+	else
+		printf("%d.%03d kB", kB, B * 1000 / 1024);
+}
+
+static int emile_scanbus(device_name_t devices[EMILE_MAX_DISK])
+{
+	int i,j;
+	int fd;
+	device_name_t	dev;
+
+	j = 0;
+
+	/* scan SCSI disks */
+
+	for(i = 0; (i < EMILE_MAX_DISK) && (j < EMILE_MAX_DISK); i++)
+	{
+		sprintf(dev, "/dev/sd%c", 'a' + i);
+		fd = open(dev, O_RDONLY);
+		if (fd == -1)
+			break;
+		close(fd);
+		strncpy(devices[j++], dev, EMILE_MAX_DEVNAME);
+	}
+
+	/* scan ATA disks: EMILE doesn't manage them, but this
+	 * allows to have all information on all disks
+	 */
+
+	for(i = 0; (i < EMILE_MAX_DISK) && (j < EMILE_MAX_DISK); i++)
+	{
+		sprintf(dev, "/dev/hd%c", 'a' + i);
+		fd = open(dev, O_RDONLY);
+		if (fd == -1)
+			break;
+		close(fd);
+		strncpy(devices[j++], dev, EMILE_MAX_DEVNAME);
+	}
+
+	return j;
+}
+
+void scanbus(void)
+{
+	emile_map_t* map;
+	device_name_t devices[EMILE_MAX_DISK];
+	int count;
+	int i;
+	int j;
+	int boottype;
+	char bootblock[BOOTBLOCK_SIZE];
+
+	count = emile_scanbus(devices);
+	if (count == 0)
+	{
+		if (errno == EACCES)
+		{
+			fprintf(stderr, 
+	"ERROR: cannot access to devices (you should try as root...)\n");
+			return;
+		}
+		printf("No disk found\n");
+	}
+	for (i = 0; i < count; i++)
+	{
+		int block_size, block_count;
+
+		printf("%s:", devices[i]);
+		map = emile_map_open(devices[i], O_RDONLY);
+
+		emile_map_geometry(map, &block_size, &block_count);
+		if (verbose)
+		{
+			printf(" block size: %d, blocks number: %d (", 
+				block_size, block_count);
+			print_size(block_count, 512);
+			printf(")\n");
+		}
+		else putchar('\n');
+
+		if (map == NULL)
+		{
+			printf("\t<No information available>\n");
+			continue;
+		}
+		if (!emile_map_is_valid(map))
+		{
+			printf("\t<No valid partition map found>\n");
+			continue;
+		}
+		if (emile_map_get_driver_number(map) > 0)
+			printf("  Drivers\n");
+		for (j = 0; j < emile_map_get_driver_number(map); j++)
+		{
+			int block, size, type, part;
+			emile_map_get_driver_info(map, j, 
+						  &block, &size, &type);
+			printf("     %d: base: %d size: %d type: %d",
+			       j, block * block_size / 512, 
+			       size * block_size / 512 , type);
+			part = emile_map_seek_driver_partition(map, 
+					block * block_size / 512 );
+			if (part == -1)
+				printf(" <invalid>\n");
+			else
+			{
+				emile_map_read(map, part);
+				printf(" <%d: %s [%s]>\n", part + 1,
+					emile_map_get_partition_name(map),
+					emile_map_get_partition_type(map));
+			}
+		}
+		printf("  Partitions\n");
+		for (j = 0; j < emile_map_get_number(map); j++)
+		{
+			emile_map_read(map, j);
+
+			if (emile_map_partition_is_startup(map))
+				printf(" --> ");
+			else
+				printf("     ");
+			printf("%s%-2d: ", devices[i], j + 1);
+			printf("%16s [%-16s] ", 
+				emile_map_get_partition_name(map),
+				emile_map_get_partition_type(map));
+			emile_map_bootblock_read(map, bootblock);
+			boottype = emile_map_bootblock_get_type(bootblock);
+			switch(boottype)
+			{
+			case INVALID_BOOTBLOCK:
+				break;
+			case APPLE_BOOTBLOCK:
+				printf(" <Apple bootblock>");
+				break;
+			case EMILE_BOOTBLOCK:
+				printf(" <EMILE bootblock>");
+				break;
+			default:
+				printf(" <unknown bootblock>");
+				break;
+			}
+			if (emile_map_partition_is_bootable(map))
+				printf(" *\n");
+			else
+				putchar('\n');
+			if (verbose)
+			{
+				int start, count;
+				int bootstart, bootsize, bootaddr, bootentry;
+				int checksum;
+				char processor[16];
+
+				emile_map_get_partition_geometry(map,
+								&start, &count);
+				printf("                 base: %d, count: %d (", 
+					start, count);
+				print_size(count, 512);
+				printf(")\n");
+				printf("                 flags: 0x%08x\n", 
+					emile_map_partition_get_flags(map));
+				emile_map_get_bootinfo(map, &bootstart, 
+							&bootsize, &bootaddr, 
+							&bootentry, &checksum, 
+							processor);
+				printf("                 "
+				       "Bootstart: %d, Bootsize: %d\n",
+				       bootstart, bootsize);
+				printf("                 "
+				       "Bootaddr: %d, Bootentry: %d\n", 
+				       bootaddr, bootentry);
+				printf("                 "
+				       "Checksum: 0x%04x, Processor: %s\n", 
+					checksum, processor);
+
+			}
+		}
+		emile_map_close(map);
+	}
+}

Added: branches/vendor/emile/tools/gzio.c
===================================================================
--- branches/vendor/emile/tools/gzio.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/tools/gzio.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,1047 @@
+/* gzio.c -- IO on .gz files
+ * Copyright (C) 1995-2005 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ *
+ * Compile this file with -DNO_GZCOMPRESS to avoid the compression code.
+ */
+
+/* @(#) $Id: gzio.c,v 1.1 2005/11/14 23:24:08 lvivier Exp $ */
+
+#include <stdio.h>
+
+#include "zutil.h"
+
+#ifdef NO_DEFLATE       /* for compatibility with old definition */
+#  define NO_GZCOMPRESS
+#endif
+
+#ifndef NO_DUMMY_DECL
+struct internal_state {int dummy;}; /* for buggy compilers */
+#endif
+
+#ifndef Z_BUFSIZE
+#  ifdef MAXSEG_64K
+#    define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */
+#  else
+#    define Z_BUFSIZE 16384
+#  endif
+#endif
+#ifndef Z_PRINTF_BUFSIZE
+#  define Z_PRINTF_BUFSIZE 4096
+#endif
+
+#ifdef __MVS__
+#  pragma map (fdopen , "\174\174FDOPEN")
+   FILE *fdopen(int, const char *);
+#endif
+
+#ifndef STDC
+extern voidp  malloc OF((uInt size));
+extern void   free   OF((voidpf ptr));
+#endif
+
+#define ALLOC(size) malloc(size)
+#define TRYFREE(p) {if (p) free(p);}
+
+static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
+
+/* gzip flag byte */
+#define ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */
+#define HEAD_CRC     0x02 /* bit 1 set: header CRC present */
+#define EXTRA_FIELD  0x04 /* bit 2 set: extra field present */
+#define ORIG_NAME    0x08 /* bit 3 set: original file name present */
+#define COMMENT      0x10 /* bit 4 set: file comment present */
+#define RESERVED     0xE0 /* bits 5..7: reserved */
+
+typedef struct gz_stream {
+    z_stream stream;
+    int      z_err;   /* error code for last stream operation */
+    int      z_eof;   /* set if end of input file */
+    FILE     *file;   /* .gz file */
+    Byte     *inbuf;  /* input buffer */
+    Byte     *outbuf; /* output buffer */
+    uLong    crc;     /* crc32 of uncompressed data */
+    char     *msg;    /* error message */
+    char     *path;   /* path name for debugging only */
+    int      transparent; /* 1 if input file is not a .gz file */
+    char     mode;    /* 'w' or 'r' */
+    z_off_t  start;   /* start of compressed data in file (header skipped) */
+    z_off_t  in;      /* bytes into deflate or inflate */
+    z_off_t  out;     /* bytes out of deflate or inflate */
+    int      back;    /* one character push-back */
+    int      last;    /* true if push-back is last character */
+} gz_stream;
+
+
+local gzFile gz_open      OF((const char *path, const char *mode, int  fd));
+#ifndef NO_GZCOMPRESS
+local int do_flush        OF((gzFile file, int flush));
+local void   putLong      OF((FILE *file, uLong x));
+#endif /* NO_GZCOMPRESS */
+local int    get_byte     OF((gz_stream *s));
+local void   check_header OF((gz_stream *s));
+local int    destroy      OF((gz_stream *s));
+local uLong  getLong      OF((gz_stream *s));
+
+/* ===========================================================================
+     Opens a gzip (.gz) file for reading or writing. The mode parameter
+   is as in fopen ("rb" or "wb"). The file is given either by file descriptor
+   or path name (if fd == -1).
+     gz_open returns NULL if the file could not be opened or if there was
+   insufficient memory to allocate the (de)compression state; errno
+   can be checked to distinguish the two cases (if errno is zero, the
+   zlib error is Z_MEM_ERROR).
+*/
+local gzFile gz_open (path, mode, fd)
+    const char *path;
+    const char *mode;
+    int  fd;
+{
+    int err;
+    int level = Z_DEFAULT_COMPRESSION; /* compression level */
+    int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */
+    char *p = (char*)mode;
+    gz_stream *s;
+    char fmode[80]; /* copy of mode, without the compression level */
+    char *m = fmode;
+
+    if (!path || !mode) return Z_NULL;
+
+    s = (gz_stream *)ALLOC(sizeof(gz_stream));
+    if (!s) return Z_NULL;
+
+    s->stream.zalloc = (alloc_func)0;
+    s->stream.zfree = (free_func)0;
+    s->stream.opaque = (voidpf)0;
+    s->stream.next_in = s->inbuf = Z_NULL;
+    s->stream.next_out = s->outbuf = Z_NULL;
+    s->stream.avail_in = s->stream.avail_out = 0;
+    s->file = NULL;
+    s->z_err = Z_OK;
+    s->z_eof = 0;
+    s->in = 0;
+    s->out = 0;
+    s->back = EOF;
+    s->crc = crc32(0L, Z_NULL, 0);
+    s->msg = NULL;
+    s->transparent = 0;
+
+    s->path = (char*)ALLOC(strlen(path)+1);
+    if (s->path == NULL) {
+        return destroy(s), (gzFile)Z_NULL;
+    }
+    strcpy(s->path, path); /* do this early for debugging */
+
+    s->mode = '\0';
+    do {
+        if (*p == 'r') s->mode = 'r';
+        if (*p == 'w' || *p == 'a') s->mode = 'w';
+        if (*p >= '0' && *p <= '9') {
+            level = *p - '0';
+        } else if (*p == 'f') {
+          strategy = Z_FILTERED;
+        } else if (*p == 'h') {
+          strategy = Z_HUFFMAN_ONLY;
+        } else if (*p == 'R') {
+          strategy = Z_RLE;
+        } else {
+            *m++ = *p; /* copy the mode */
+        }
+    } while (*p++ && m != fmode + sizeof(fmode));
+    if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL;
+
+    if (s->mode == 'w') {
+#ifdef NO_GZCOMPRESS
+        err = Z_STREAM_ERROR;
+#else
+        err = deflateInit2(&(s->stream), level,
+                           Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy);
+        /* windowBits is passed < 0 to suppress zlib header */
+
+        s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
+#endif
+        if (err != Z_OK || s->outbuf == Z_NULL) {
+            return destroy(s), (gzFile)Z_NULL;
+        }
+    } else {
+        s->stream.next_in  = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE);
+
+        err = inflateInit2(&(s->stream), -MAX_WBITS);
+        /* windowBits is passed < 0 to tell that there is no zlib header.
+         * Note that in this case inflate *requires* an extra "dummy" byte
+         * after the compressed stream in order to complete decompression and
+         * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are
+         * present after the compressed stream.
+         */
+        if (err != Z_OK || s->inbuf == Z_NULL) {
+            return destroy(s), (gzFile)Z_NULL;
+        }
+    }
+    s->stream.avail_out = Z_BUFSIZE;
+
+    errno = 0;
+#ifdef FATFREE
+    s->file = F_OPEN(path, fmode);
+#else
+    s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode);
+#endif
+
+    if (s->file == NULL) {
+        return destroy(s), (gzFile)Z_NULL;
+    }
+    if (s->mode == 'w') {
+        /* Write a very simple .gz header:
+         */
+        fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
+             Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE);
+        s->start = 10L;
+        /* We use 10L instead of ftell(s->file) to because ftell causes an
+         * fflush on some systems. This version of the library doesn't use
+         * start anyway in write mode, so this initialization is not
+         * necessary.
+         */
+    } else {
+        check_header(s); /* skip the .gz header */
+        s->start = ftell(s->file) - s->stream.avail_in;
+    }
+
+    return (gzFile)s;
+}
+
+/* ===========================================================================
+     Opens a gzip (.gz) file for reading or writing.
+*/
+gzFile ZEXPORT gzopen (path, mode)
+    const char *path;
+    const char *mode;
+{
+    return gz_open (path, mode, -1);
+}
+
+#ifndef FATFREE
+/* ===========================================================================
+     Associate a gzFile with the file descriptor fd. fd is not dup'ed here
+   to mimic the behavio(u)r of fdopen.
+*/
+gzFile ZEXPORT gzdopen (fd, mode)
+    int fd;
+    const char *mode;
+{
+    char name[46];      /* allow for up to 128-bit integers */
+
+    if (fd < 0) return (gzFile)Z_NULL;
+    sprintf(name, "<fd:%d>", fd); /* for debugging */
+
+    return gz_open (name, mode, fd);
+}
+#endif /* FATFREE */
+
+#ifndef NO_GZCOMPRESS
+/* ===========================================================================
+ * Update the compression level and strategy
+ */
+int ZEXPORT gzsetparams (file, level, strategy)
+    gzFile file;
+    int level;
+    int strategy;
+{
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
+
+    /* Make room to allow flushing */
+    if (s->stream.avail_out == 0) {
+
+        s->stream.next_out = s->outbuf;
+        if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
+            s->z_err = Z_ERRNO;
+        }
+        s->stream.avail_out = Z_BUFSIZE;
+    }
+
+    return deflateParams (&(s->stream), level, strategy);
+}
+#endif /* NO_GZCOMPRESS */
+
+/* ===========================================================================
+     Read a byte from a gz_stream; update next_in and avail_in. Return EOF
+   for end of file.
+   IN assertion: the stream s has been sucessfully opened for reading.
+*/
+local int get_byte(s)
+    gz_stream *s;
+{
+    if (s->z_eof) return EOF;
+    if (s->stream.avail_in == 0) {
+        errno = 0;
+        s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file);
+        if (s->stream.avail_in == 0) {
+            s->z_eof = 1;
+            if (ferror(s->file)) s->z_err = Z_ERRNO;
+            return EOF;
+        }
+        s->stream.next_in = s->inbuf;
+    }
+    s->stream.avail_in--;
+    return *(s->stream.next_in)++;
+}
+
+/* ===========================================================================
+      Check the gzip header of a gz_stream opened for reading. Set the stream
+    mode to transparent if the gzip magic header is not present; set s->err
+    to Z_DATA_ERROR if the magic header is present but the rest of the header
+    is incorrect.
+    IN assertion: the stream s has already been created sucessfully;
+       s->stream.avail_in is zero for the first time, but may be non-zero
+       for concatenated .gz files.
+*/
+local void check_header(s)
+    gz_stream *s;
+{
+    int method; /* method byte */
+    int flags;  /* flags byte */
+    uInt len;
+    int c;
+
+    /* Assure two bytes in the buffer so we can peek ahead -- handle case
+       where first byte of header is at the end of the buffer after the last
+       gzip segment */
+    len = s->stream.avail_in;
+    if (len < 2) {
+        if (len) s->inbuf[0] = s->stream.next_in[0];
+        errno = 0;
+        len = (uInt)fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file);
+        if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO;
+        s->stream.avail_in += len;
+        s->stream.next_in = s->inbuf;
+        if (s->stream.avail_in < 2) {
+            s->transparent = s->stream.avail_in;
+            return;
+        }
+    }
+
+    /* Peek ahead to check the gzip magic header */
+    if (s->stream.next_in[0] != gz_magic[0] ||
+        s->stream.next_in[1] != gz_magic[1]) {
+        s->transparent = 1;
+        return;
+    }
+    s->stream.avail_in -= 2;
+    s->stream.next_in += 2;
+
+    /* Check the rest of the gzip header */
+    method = get_byte(s);
+    flags = get_byte(s);
+    if (method != Z_DEFLATED || (flags & RESERVED) != 0) {
+        s->z_err = Z_DATA_ERROR;
+        return;
+    }
+
+    /* Discard time, xflags and OS code: */
+    for (len = 0; len < 6; len++) (void)get_byte(s);
+
+    if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */
+        len  =  (uInt)get_byte(s);
+        len += ((uInt)get_byte(s))<<8;
+        /* len is garbage if EOF but the loop below will quit anyway */
+        while (len-- != 0 && get_byte(s) != EOF) ;
+    }
+    if ((flags & ORIG_NAME) != 0) { /* skip the original file name */
+        while ((c = get_byte(s)) != 0 && c != EOF) ;
+    }
+    if ((flags & COMMENT) != 0) {   /* skip the .gz file comment */
+        while ((c = get_byte(s)) != 0 && c != EOF) ;
+    }
+    if ((flags & HEAD_CRC) != 0) {  /* skip the header crc */
+        for (len = 0; len < 2; len++) (void)get_byte(s);
+    }
+    s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK;
+}
+
+ /* ===========================================================================
+ * Cleanup then free the given gz_stream. Return a zlib error code.
+   Try freeing in the reverse order of allocations.
+ */
+local int destroy (s)
+    gz_stream *s;
+{
+    int err = Z_OK;
+
+    if (!s) return Z_STREAM_ERROR;
+
+    TRYFREE(s->msg);
+
+    if (s->stream.state != NULL) {
+        if (s->mode == 'w') {
+#ifdef NO_GZCOMPRESS
+            err = Z_STREAM_ERROR;
+#else
+            err = deflateEnd(&(s->stream));
+#endif
+        } else if (s->mode == 'r') {
+            err = inflateEnd(&(s->stream));
+        }
+    }
+    if (s->file != NULL && fclose(s->file)) {
+#ifdef ESPIPE
+        if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */
+#endif
+            err = Z_ERRNO;
+    }
+    if (s->z_err < 0) err = s->z_err;
+
+    TRYFREE(s->inbuf);
+    TRYFREE(s->outbuf);
+    TRYFREE(s->path);
+    TRYFREE(s);
+    return err;
+}
+
+/* ===========================================================================
+     Reads the given number of uncompressed bytes from the compressed file.
+   gzread returns the number of bytes actually read (0 for end of file).
+*/
+int ZEXPORT gzread (file, buf, len)
+    gzFile file;
+    voidp buf;
+    unsigned len;
+{
+    gz_stream *s = (gz_stream*)file;
+    Bytef *start = (Bytef*)buf; /* starting point for crc computation */
+    Byte  *next_out; /* == stream.next_out but not forced far (for MSDOS) */
+
+    if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR;
+
+    if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1;
+    if (s->z_err == Z_STREAM_END) return 0;  /* EOF */
+
+    next_out = (Byte*)buf;
+    s->stream.next_out = (Bytef*)buf;
+    s->stream.avail_out = len;
+
+    if (s->stream.avail_out && s->back != EOF) {
+        *next_out++ = s->back;
+        s->stream.next_out++;
+        s->stream.avail_out--;
+        s->back = EOF;
+        s->out++;
+        start++;
+        if (s->last) {
+            s->z_err = Z_STREAM_END;
+            return 1;
+        }
+    }
+
+    while (s->stream.avail_out != 0) {
+
+        if (s->transparent) {
+            /* Copy first the lookahead bytes: */
+            uInt n = s->stream.avail_in;
+            if (n > s->stream.avail_out) n = s->stream.avail_out;
+            if (n > 0) {
+                zmemcpy(s->stream.next_out, s->stream.next_in, n);
+                next_out += n;
+                s->stream.next_out = next_out;
+                s->stream.next_in   += n;
+                s->stream.avail_out -= n;
+                s->stream.avail_in  -= n;
+            }
+            if (s->stream.avail_out > 0) {
+                s->stream.avail_out -=
+                    (uInt)fread(next_out, 1, s->stream.avail_out, s->file);
+            }
+            len -= s->stream.avail_out;
+            s->in  += len;
+            s->out += len;
+            if (len == 0) s->z_eof = 1;
+            return (int)len;
+        }
+        if (s->stream.avail_in == 0 && !s->z_eof) {
+
+            errno = 0;
+            s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file);
+            if (s->stream.avail_in == 0) {
+                s->z_eof = 1;
+                if (ferror(s->file)) {
+                    s->z_err = Z_ERRNO;
+                    break;
+                }
+            }
+            s->stream.next_in = s->inbuf;
+        }
+        s->in += s->stream.avail_in;
+        s->out += s->stream.avail_out;
+        s->z_err = inflate(&(s->stream), Z_NO_FLUSH);
+        s->in -= s->stream.avail_in;
+        s->out -= s->stream.avail_out;
+
+        if (s->z_err == Z_STREAM_END) {
+            /* Check CRC and original size */
+            s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
+            start = s->stream.next_out;
+
+            if (getLong(s) != s->crc) {
+                s->z_err = Z_DATA_ERROR;
+            } else {
+                (void)getLong(s);
+                /* The uncompressed length returned by above getlong() may be
+                 * different from s->out in case of concatenated .gz files.
+                 * Check for such files:
+                 */
+                check_header(s);
+                if (s->z_err == Z_OK) {
+                    inflateReset(&(s->stream));
+                    s->crc = crc32(0L, Z_NULL, 0);
+                }
+            }
+        }
+        if (s->z_err != Z_OK || s->z_eof) break;
+    }
+    s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
+
+    if (len == s->stream.avail_out &&
+        (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO))
+        return -1;
+    return (int)(len - s->stream.avail_out);
+}
+
+#ifndef FATFREE
+/* ===========================================================================
+      Reads one byte from the compressed file. gzgetc returns this byte
+   or -1 in case of end of file or error.
+*/
+int ZEXPORT gzgetc(file)
+    gzFile file;
+{
+    unsigned char c;
+
+    return gzread(file, &c, 1) == 1 ? c : -1;
+}
+
+
+/* ===========================================================================
+      Push one byte back onto the stream.
+*/
+int ZEXPORT gzungetc(c, file)
+    int c;
+    gzFile file;
+{
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL || s->mode != 'r' || c == EOF || s->back != EOF) return EOF;
+    s->back = c;
+    s->out--;
+    s->last = (s->z_err == Z_STREAM_END);
+    if (s->last) s->z_err = Z_OK;
+    s->z_eof = 0;
+    return c;
+}
+
+
+/* ===========================================================================
+      Reads bytes from the compressed file until len-1 characters are
+   read, or a newline character is read and transferred to buf, or an
+   end-of-file condition is encountered.  The string is then terminated
+   with a null character.
+      gzgets returns buf, or Z_NULL in case of error.
+
+      The current implementation is not optimized at all.
+*/
+char * ZEXPORT gzgets(file, buf, len)
+    gzFile file;
+    char *buf;
+    int len;
+{
+    char *b = buf;
+    if (buf == Z_NULL || len <= 0) return Z_NULL;
+
+    while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ;
+    *buf = '\0';
+    return b == buf && len > 0 ? Z_NULL : b;
+}
+#endif /* FATFREE */
+
+
+#ifndef NO_GZCOMPRESS
+/* ===========================================================================
+     Writes the given number of uncompressed bytes into the compressed file.
+   gzwrite returns the number of bytes actually written (0 in case of error).
+*/
+int ZEXPORT gzwrite (file, buf, len)
+    gzFile file;
+    voidpc buf;
+    unsigned len;
+{
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
+
+    s->stream.next_in = (Bytef*)buf;
+    s->stream.avail_in = len;
+
+    while (s->stream.avail_in != 0) {
+
+        if (s->stream.avail_out == 0) {
+
+            s->stream.next_out = s->outbuf;
+            if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
+                s->z_err = Z_ERRNO;
+                break;
+            }
+            s->stream.avail_out = Z_BUFSIZE;
+        }
+        s->in += s->stream.avail_in;
+        s->out += s->stream.avail_out;
+        s->z_err = deflate(&(s->stream), Z_NO_FLUSH);
+        s->in -= s->stream.avail_in;
+        s->out -= s->stream.avail_out;
+        if (s->z_err != Z_OK) break;
+    }
+    s->crc = crc32(s->crc, (const Bytef *)buf, len);
+
+    return (int)(len - s->stream.avail_in);
+}
+
+
+/* ===========================================================================
+     Converts, formats, and writes the args to the compressed file under
+   control of the format string, as in fprintf. gzprintf returns the number of
+   uncompressed bytes actually written (0 in case of error).
+*/
+#ifdef STDC
+#include <stdarg.h>
+
+int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...)
+{
+    char buf[Z_PRINTF_BUFSIZE];
+    va_list va;
+    int len;
+
+    buf[sizeof(buf) - 1] = 0;
+    va_start(va, format);
+#ifdef NO_vsnprintf
+#  ifdef HAS_vsprintf_void
+    (void)vsprintf(buf, format, va);
+    va_end(va);
+    for (len = 0; len < sizeof(buf); len++)
+        if (buf[len] == 0) break;
+#  else
+    len = vsprintf(buf, format, va);
+    va_end(va);
+#  endif
+#else
+#  ifdef HAS_vsnprintf_void
+    (void)vsnprintf(buf, sizeof(buf), format, va);
+    va_end(va);
+    len = strlen(buf);
+#  else
+    len = vsnprintf(buf, sizeof(buf), format, va);
+    va_end(va);
+#  endif
+#endif
+    if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0)
+        return 0;
+    return gzwrite(file, buf, (unsigned)len);
+}
+#else /* not ANSI C */
+
+int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
+                       a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
+    gzFile file;
+    const char *format;
+    int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
+        a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
+{
+    char buf[Z_PRINTF_BUFSIZE];
+    int len;
+
+    buf[sizeof(buf) - 1] = 0;
+#ifdef NO_snprintf
+#  ifdef HAS_sprintf_void
+    sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
+            a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+    for (len = 0; len < sizeof(buf); len++)
+        if (buf[len] == 0) break;
+#  else
+    len = sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
+                a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+#  endif
+#else
+#  ifdef HAS_snprintf_void
+    snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
+             a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+    len = strlen(buf);
+#  else
+    len = snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
+                 a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+#  endif
+#endif
+    if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0)
+        return 0;
+    return gzwrite(file, buf, len);
+}
+#endif
+
+/* ===========================================================================
+      Writes c, converted to an unsigned char, into the compressed file.
+   gzputc returns the value that was written, or -1 in case of error.
+*/
+int ZEXPORT gzputc(file, c)
+    gzFile file;
+    int c;
+{
+    unsigned char cc = (unsigned char) c; /* required for big endian systems */
+
+    return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1;
+}
+
+
+/* ===========================================================================
+      Writes the given null-terminated string to the compressed file, excluding
+   the terminating null character.
+      gzputs returns the number of characters written, or -1 in case of error.
+*/
+int ZEXPORT gzputs(file, s)
+    gzFile file;
+    const char *s;
+{
+    return gzwrite(file, (char*)s, (unsigned)strlen(s));
+}
+
+
+/* ===========================================================================
+     Flushes all pending output into the compressed file. The parameter
+   flush is as in the deflate() function.
+*/
+local int do_flush (file, flush)
+    gzFile file;
+    int flush;
+{
+    uInt len;
+    int done = 0;
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
+
+    s->stream.avail_in = 0; /* should be zero already anyway */
+
+    for (;;) {
+        len = Z_BUFSIZE - s->stream.avail_out;
+
+        if (len != 0) {
+            if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) {
+                s->z_err = Z_ERRNO;
+                return Z_ERRNO;
+            }
+            s->stream.next_out = s->outbuf;
+            s->stream.avail_out = Z_BUFSIZE;
+        }
+        if (done) break;
+        s->out += s->stream.avail_out;
+        s->z_err = deflate(&(s->stream), flush);
+        s->out -= s->stream.avail_out;
+
+        /* Ignore the second of two consecutive flushes: */
+        if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK;
+
+        /* deflate has finished flushing only when it hasn't used up
+         * all the available space in the output buffer:
+         */
+        done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END);
+
+        if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break;
+    }
+    return  s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
+}
+
+int ZEXPORT gzflush (file, flush)
+     gzFile file;
+     int flush;
+{
+    gz_stream *s = (gz_stream*)file;
+    int err = do_flush (file, flush);
+
+    if (err) return err;
+    fflush(s->file);
+    return  s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
+}
+#endif /* NO_GZCOMPRESS */
+
+/* ===========================================================================
+      Sets the starting position for the next gzread or gzwrite on the given
+   compressed file. The offset represents a number of bytes in the
+      gzseek returns the resulting offset location as measured in bytes from
+   the beginning of the uncompressed stream, or -1 in case of error.
+      SEEK_END is not implemented, returns error.
+      In this version of the library, gzseek can be extremely slow.
+*/
+z_off_t ZEXPORT gzseek (file, offset, whence)
+    gzFile file;
+    z_off_t offset;
+    int whence;
+{
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL || whence == SEEK_END ||
+        s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) {
+        return -1L;
+    }
+
+    if (s->mode == 'w') {
+#ifdef NO_GZCOMPRESS
+        return -1L;
+#else
+        if (whence == SEEK_SET) {
+            offset -= s->in;
+        }
+        if (offset < 0) return -1L;
+
+        /* At this point, offset is the number of zero bytes to write. */
+        if (s->inbuf == Z_NULL) {
+            s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */
+            if (s->inbuf == Z_NULL) return -1L;
+            zmemzero(s->inbuf, Z_BUFSIZE);
+        }
+        while (offset > 0)  {
+            uInt size = Z_BUFSIZE;
+            if (offset < Z_BUFSIZE) size = (uInt)offset;
+
+            size = gzwrite(file, s->inbuf, size);
+            if (size == 0) return -1L;
+
+            offset -= size;
+        }
+        return s->in;
+#endif
+    }
+    /* Rest of function is for reading only */
+
+    /* compute absolute position */
+    if (whence == SEEK_CUR) {
+        offset += s->out;
+    }
+    if (offset < 0) return -1L;
+
+    if (s->transparent) {
+        /* map to fseek */
+        s->back = EOF;
+        s->stream.avail_in = 0;
+        s->stream.next_in = s->inbuf;
+        if (fseek(s->file, offset, SEEK_SET) < 0) return -1L;
+
+        s->in = s->out = offset;
+        return offset;
+    }
+
+    /* For a negative seek, rewind and use positive seek */
+    if (offset >= s->out) {
+        offset -= s->out;
+    } else if (gzrewind(file) < 0) {
+        return -1L;
+    }
+    /* offset is now the number of bytes to skip. */
+
+    if (offset != 0 && s->outbuf == Z_NULL) {
+        s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
+        if (s->outbuf == Z_NULL) return -1L;
+    }
+    if (offset && s->back != EOF) {
+        s->back = EOF;
+        s->out++;
+        offset--;
+        if (s->last) s->z_err = Z_STREAM_END;
+    }
+    while (offset > 0)  {
+        int size = Z_BUFSIZE;
+        if (offset < Z_BUFSIZE) size = (int)offset;
+
+        size = gzread(file, s->outbuf, (uInt)size);
+        if (size <= 0) return -1L;
+        offset -= size;
+    }
+    return s->out;
+}
+
+/* ===========================================================================
+     Rewinds input file.
+*/
+int ZEXPORT gzrewind (file)
+    gzFile file;
+{
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL || s->mode != 'r') return -1;
+
+    s->z_err = Z_OK;
+    s->z_eof = 0;
+    s->back = EOF;
+    s->stream.avail_in = 0;
+    s->stream.next_in = s->inbuf;
+    s->crc = crc32(0L, Z_NULL, 0);
+    if (!s->transparent) (void)inflateReset(&s->stream);
+    s->in = 0;
+    s->out = 0;
+    return fseek(s->file, s->start, SEEK_SET);
+}
+
+#ifndef FATFREE
+/* ===========================================================================
+     Returns the starting position for the next gzread or gzwrite on the
+   given compressed file. This position represents a number of bytes in the
+   uncompressed data stream.
+*/
+z_off_t ZEXPORT gztell (file)
+    gzFile file;
+{
+    return gzseek(file, 0L, SEEK_CUR);
+}
+#endif /* FATFREE */
+
+/* ===========================================================================
+     Returns 1 when EOF has previously been detected reading the given
+   input stream, otherwise zero.
+*/
+int ZEXPORT gzeof (file)
+    gzFile file;
+{
+    gz_stream *s = (gz_stream*)file;
+
+    /* With concatenated compressed files that can have embedded
+     * crc trailers, z_eof is no longer the only/best indicator of EOF
+     * on a gz_stream. Handle end-of-stream error explicitly here.
+     */
+    if (s == NULL || s->mode != 'r') return 0;
+    if (s->z_eof) return 1;
+    return s->z_err == Z_STREAM_END;
+}
+
+#ifndef FATFREE
+/* ===========================================================================
+     Returns 1 if reading and doing so transparently, otherwise zero.
+*/
+int ZEXPORT gzdirect (file)
+    gzFile file;
+{
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL || s->mode != 'r') return 0;
+    return s->transparent;
+}
+#endif /* FATFREE */
+
+#ifndef NO_GZCOMPRESS
+/* ===========================================================================
+   Outputs a long in LSB order to the given file
+*/
+local void putLong (file, x)
+    FILE *file;
+    uLong x;
+{
+    int n;
+    for (n = 0; n < 4; n++) {
+        fputc((int)(x & 0xff), file);
+        x >>= 8;
+    }
+}
+#endif /* NO_GZCOMPRESS */
+
+/* ===========================================================================
+   Reads a long in LSB order from the given gz_stream. Sets z_err in case
+   of error.
+*/
+local uLong getLong (s)
+    gz_stream *s;
+{
+    uLong x = (uLong)get_byte(s);
+    int c;
+
+    x += ((uLong)get_byte(s))<<8;
+    x += ((uLong)get_byte(s))<<16;
+    c = get_byte(s);
+    if (c == EOF) s->z_err = Z_DATA_ERROR;
+    x += ((uLong)c)<<24;
+    return x;
+}
+
+/* ===========================================================================
+     Flushes all pending output if necessary, closes the compressed file
+   and deallocates all the (de)compression state.
+*/
+int ZEXPORT gzclose (file)
+    gzFile file;
+{
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL) return Z_STREAM_ERROR;
+
+    if (s->mode == 'w') {
+#ifdef NO_GZCOMPRESS
+        return Z_STREAM_ERROR;
+#else
+        if (do_flush (file, Z_FINISH) != Z_OK)
+            return destroy((gz_stream*)file);
+
+        putLong (s->file, s->crc);
+        putLong (s->file, (uLong)(s->in & 0xffffffff));
+#endif
+    }
+    return destroy((gz_stream*)file);
+}
+
+#ifdef STDC
+#  define zstrerror(errnum) strerror(errnum)
+#else
+#  define zstrerror(errnum) ""
+#endif
+
+/* ===========================================================================
+     Returns the error message for the last error which occurred on the
+   given compressed file. errnum is set to zlib error number. If an
+   error occurred in the file system and not in the compression library,
+   errnum is set to Z_ERRNO and the application may consult errno
+   to get the exact error code.
+*/
+const char * ZEXPORT gzerror (file, errnum)
+    gzFile file;
+    int *errnum;
+{
+#ifdef FATFREE
+	return "Unknown error";
+#else
+    char *m;
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL) {
+        *errnum = Z_STREAM_ERROR;
+        return (const char*)ERR_MSG(Z_STREAM_ERROR);
+    }
+    *errnum = s->z_err;
+    if (*errnum == Z_OK) return (const char*)"";
+
+    m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);
+
+    if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);
+
+    TRYFREE(s->msg);
+    s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3);
+    if (s->msg == Z_NULL) return (const char*)ERR_MSG(Z_MEM_ERROR);
+    strcpy(s->msg, s->path);
+    strcat(s->msg, ": ");
+    strcat(s->msg, m);
+    return (const char*)s->msg;
+#endif /* FATFREE */
+}
+
+/* ===========================================================================
+     Clear the error and end-of-file flags, and do the same for the real file.
+*/
+void ZEXPORT gzclearerr (file)
+    gzFile file;
+{
+    gz_stream *s = (gz_stream*)file;
+
+    if (s == NULL) return;
+    if (s->z_err != Z_STREAM_END) s->z_err = Z_OK;
+    s->z_eof = 0;
+    clearerr(s->file);
+}

Added: branches/vendor/emile/tools/iso9660_cat.c
===================================================================
--- branches/vendor/emile/tools/iso9660_cat.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/tools/iso9660_cat.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,58 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <stddef.h>
+#include <string.h>
+
+#include <libiso9660.h>
+#include <libstream.h>
+
+#include "device.h"
+
+int main(int argc, char **argv)
+{
+	char *path;
+	device_io_t device;
+	iso9660_FILE* file;
+	iso9660_VOLUME *volume;
+	char buffer[512];
+	size_t size;
+
+	device.data = device_open();
+	device.read_sector = (stream_read_sector_t)device_read_sector;
+	device.close = (stream_close_t)device_close;
+
+	volume = iso9660_mount(&device);
+	if (volume == NULL)
+		return 1;
+
+	if (argc > 1)
+		path = argv[1];
+	else
+		path = "/";
+
+	file = iso9660_open(volume, path);
+	if (file == NULL)
+	{
+		fprintf(stderr, "%s not found\n", path);
+		return -1;
+	}
+
+	while((size = iso9660_read(file, buffer, 512)) > 0)
+		write(STDOUT_FILENO, buffer, size);
+	iso9660_close(file);
+
+	iso9660_umount(volume);
+
+	device_close(device.data);
+
+	return 0;
+}

Added: branches/vendor/emile/tools/iso9660_ls.c
===================================================================
--- branches/vendor/emile/tools/iso9660_ls.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/tools/iso9660_ls.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,68 @@
+/*
+ *
+ * (c) 2005 Laurent Vivier <LaurentVivier at wanadoo.fr>
+ *
+ */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <stddef.h>
+#include <string.h>
+
+#include <libiso9660.h>
+
+#include "device.h"
+
+static void list(iso9660_VOLUME *volume, char *path)
+{
+	char            name_buf[256];
+	iso9660_DIR *dir;
+	struct iso_directory_record *idr;
+
+	dir = iso9660_opendir(volume, path);
+	if (dir == NULL)
+		return;
+
+	while ((idr = iso9660_readdir(dir)) != NULL)
+	{
+		iso9660_name(volume->ucs_level, name_buf, idr);
+
+		if (iso9660_is_directory(idr)) {
+			printf("%s/\n", name_buf);
+		} else {
+			printf("%s\n", name_buf);
+		}
+	}
+	iso9660_closedir(dir);
+}
+
+int main(int argc, char **argv)
+{
+	char *path;
+	device_io_t device;
+	iso9660_VOLUME *volume;
+
+	device.data = device_open();
+	device.read_sector = (stream_read_sector_t)device_read_sector;
+	device.close = (stream_close_t)device_close;
+
+	volume = iso9660_mount(&device);
+	if (volume == NULL)
+		return -1;
+
+	if (argc > 1)
+		path = argv[1];
+	else
+		path = "/";
+
+	list(volume, path);
+
+	iso9660_umount(volume);
+
+	device_close(device.data);
+
+	return (0);
+}

Added: branches/vendor/emile/tools/minigzip.c
===================================================================
--- branches/vendor/emile/tools/minigzip.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/tools/minigzip.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,338 @@
+/* minigzip.c -- simulate gzip using the zlib compression library
+ * Copyright (C) 1995-2005 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/*
+ * minigzip is a minimal implementation of the gzip utility. This is
+ * only an example of using zlib and isn't meant to replace the
+ * full-featured gzip. No attempt is made to deal with file systems
+ * limiting names to 14 or 8+3 characters, etc... Error checking is
+ * very limited. So use minigzip only for testing; use gzip for the
+ * real thing. On MSDOS, use only on file names without extension
+ * or in pipe mode.
+ */
+
+/* @(#) $Id: minigzip.c,v 1.2 2005/11/26 08:40:53 lvivier Exp $ */
+
+#include <stdio.h>
+#include "zlib.h"
+
+#ifdef STDC
+#  include <string.h>
+#  include <stdlib.h>
+#endif
+
+#ifdef USE_MMAP
+#  include <sys/types.h>
+#  include <sys/mman.h>
+#  include <sys/stat.h>
+#endif
+
+#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
+#  include <fcntl.h>
+#  include <io.h>
+#  define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
+#else
+#  define SET_BINARY_MODE(file)
+#endif
+
+#ifdef VMS
+#  define unlink delete
+#  define GZ_SUFFIX "-gz"
+#endif
+#ifdef RISCOS
+#  define unlink remove
+#  define GZ_SUFFIX "-gz"
+#  define fileno(file) file->__file
+#endif
+#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+#  include <unix.h> /* for fileno */
+#endif
+
+#ifndef WIN32 /* unlink already in stdio.h for WIN32 */
+  extern int unlink OF((const char *));
+#endif
+
+#ifndef GZ_SUFFIX
+#  define GZ_SUFFIX ".gz"
+#endif
+#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1)
+
+#define BUFLEN      16384
+#define MAX_NAME_LEN 1024
+
+#ifdef MAXSEG_64K
+#  define local static
+   /* Needed for systems with limitation on stack size. */
+#else
+#  define local
+#endif
+
+char *prog;
+
+gzFile ZEXPORT gzopen (char*, char*);
+void error            OF((const char *msg));
+void gz_compress      OF((FILE   *in, gzFile out));
+#ifdef USE_MMAP
+int  gz_compress_mmap OF((FILE   *in, gzFile out));
+#endif
+void gz_uncompress    OF((gzFile in, FILE   *out));
+void file_compress    OF((char  *file, char *mode));
+void file_uncompress  OF((char  *file));
+int  main             OF((int argc, char *argv[]));
+
+/* ===========================================================================
+ * Display error message and exit
+ */
+void error(msg)
+    const char *msg;
+{
+    fprintf(stderr, "%s: %s\n", prog, msg);
+    exit(1);
+}
+
+#ifndef NO_GZCOMPRESS 
+/* ===========================================================================
+ * Compress input to output then close both files.
+ */
+
+void gz_compress(in, out)
+    FILE   *in;
+    gzFile out;
+{
+    local char buf[BUFLEN];
+    int len;
+    int err;
+
+#ifdef USE_MMAP
+    /* Try first compressing with mmap. If mmap fails (minigzip used in a
+     * pipe), use the normal fread loop.
+     */
+    if (gz_compress_mmap(in, out) == Z_OK) return;
+#endif
+    for (;;) {
+        len = (int)fread(buf, 1, sizeof(buf), in);
+        if (ferror(in)) {
+            perror("fread");
+            exit(1);
+        }
+        if (len == 0) break;
+
+        if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err));
+    }
+    fclose(in);
+    if (gzclose(out) != Z_OK) error("failed gzclose");
+}
+
+#ifdef USE_MMAP /* MMAP version, Miguel Albrecht <malbrech at eso.org> */
+
+/* Try compressing the input file at once using mmap. Return Z_OK if
+ * if success, Z_ERRNO otherwise.
+ */
+int gz_compress_mmap(in, out)
+    FILE   *in;
+    gzFile out;
+{
+    int len;
+    int err;
+    int ifd = fileno(in);
+    caddr_t buf;    /* mmap'ed buffer for the entire input file */
+    off_t buf_len;  /* length of the input file */
+    struct stat sb;
+
+    /* Determine the size of the file, needed for mmap: */
+    if (fstat(ifd, &sb) < 0) return Z_ERRNO;
+    buf_len = sb.st_size;
+    if (buf_len <= 0) return Z_ERRNO;
+
+    /* Now do the actual mmap: */
+    buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0);
+    if (buf == (caddr_t)(-1)) return Z_ERRNO;
+
+    /* Compress the whole file at once: */
+    len = gzwrite(out, (char *)buf, (unsigned)buf_len);
+
+    if (len != (int)buf_len) error(gzerror(out, &err));
+
+    munmap(buf, buf_len);
+    fclose(in);
+    if (gzclose(out) != Z_OK) error("failed gzclose");
+    return Z_OK;
+}
+#endif /* USE_MMAP */
+#endif /* NO_GZCOMPRESS */
+
+/* ===========================================================================
+ * Uncompress input to output then close both files.
+ */
+void gz_uncompress(in, out)
+    gzFile in;
+    FILE   *out;
+{
+    local char buf[BUFLEN];
+    int len;
+    int err;
+
+    for (;;) {
+        len = gzread(in, buf, sizeof(buf));
+        if (len < 0) error (gzerror(in, &err));
+        if (len == 0) break;
+
+        if ((int)fwrite(buf, 1, (unsigned)len, out) != len) {
+            error("failed fwrite");
+        }
+    }
+    if (fclose(out)) error("failed fclose");
+
+    if (gzclose(in) != Z_OK) error("failed gzclose");
+}
+
+
+#ifndef NO_GZCOMPRESS 
+/* ===========================================================================
+ * Compress the given file: create a corresponding .gz file and remove the
+ * original.
+ */
+void file_compress(file, mode)
+    char  *file;
+    char  *mode;
+{
+    local char outfile[MAX_NAME_LEN];
+    FILE  *in;
+    gzFile out;
+
+    strcpy(outfile, file);
+    strcat(outfile, GZ_SUFFIX);
+
+    in = fopen(file, "rb");
+    if (in == NULL) {
+        perror(file);
+        exit(1);
+    }
+    out = gzopen(outfile, mode);
+    if (out == NULL) {
+        fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile);
+        exit(1);
+    }
+    gz_compress(in, out);
+
+    unlink(file);
+}
+#endif /* NO_GZCOMPRESS */
+
+
+/* ===========================================================================
+ * Uncompress the given file and remove the original.
+ */
+void file_uncompress(file)
+    char  *file;
+{
+    local char buf[MAX_NAME_LEN];
+    char *infile, *outfile;
+    FILE  *out;
+    gzFile in;
+    uInt len = (uInt)strlen(file);
+
+    strcpy(buf, file);
+
+    if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) {
+        infile = file;
+        outfile = buf;
+        outfile[len-3] = '\0';
+    } else {
+        outfile = file;
+        infile = buf;
+        strcat(infile, GZ_SUFFIX);
+    }
+    in = gzopen(infile, "rb");
+    if (in == NULL) {
+        fprintf(stderr, "%s: can't gzopen %s\n", prog, infile);
+        exit(1);
+    }
+    out = fopen(outfile, "wb");
+    if (out == NULL) {
+        perror(file);
+        exit(1);
+    }
+
+    gz_uncompress(in, out);
+
+    unlink(infile);
+}
+
+
+/* ===========================================================================
+ * Usage:  minigzip [-d] [-f] [-h] [-r] [-1 to -9] [files...]
+ *   -d : decompress
+ *   -f : compress with Z_FILTERED
+ *   -h : compress with Z_HUFFMAN_ONLY
+ *   -r : compress with Z_RLE
+ *   -1 to -9 : compression level
+ */
+
+int main(argc, argv)
+    int argc;
+    char *argv[];
+{
+    int uncompr = 0;
+#ifndef FATFREE
+    gzFile file;
+#endif /* FATFREE */
+    char outmode[20];
+
+    strcpy(outmode, "wb6 ");
+
+    prog = argv[0];
+    argc--, argv++;
+
+    while (argc > 0) {
+      if (strcmp(*argv, "-d") == 0)
+        uncompr = 1;
+#ifndef NO_GZCOMPRESS 
+      else if (strcmp(*argv, "-f") == 0)
+        outmode[3] = 'f';
+      else if (strcmp(*argv, "-h") == 0)
+        outmode[3] = 'h';
+      else if (strcmp(*argv, "-r") == 0)
+        outmode[3] = 'R';
+      else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' &&
+               (*argv)[2] == 0)
+        outmode[2] = (*argv)[1];
+#endif /* NO_GZCOMPRESS */
+      else
+        break;
+      argc--, argv++;
+    }
+    if (outmode[3] == ' ')
+        outmode[3] = 0;
+    if (argc == 0) {
+#ifndef FATFREE
+        SET_BINARY_MODE(stdin);
+        SET_BINARY_MODE(stdout);
+        if (uncompr) {
+            file = gzdopen(fileno(stdin), "rb");
+            if (file == NULL) error("can't gzdopen stdin");
+            gz_uncompress(file, stdout);
+#ifndef NO_GZCOMPRESS 
+        } else {
+            file = gzdopen(fileno(stdout), outmode);
+            if (file == NULL) error("can't gzdopen stdout");
+            gz_compress(stdin, file);
+#endif /* NO_GZCOMPRESS */
+        }
+#endif /* FATFREE */
+	error("stdin/stdout unsupported\n");
+    } else {
+        do {
+            if (uncompr) {
+                file_uncompress(*argv);
+#ifndef NO_GZCOMPRESS 
+            } else {
+                file_compress(*argv, outmode);
+#endif /* NO_GZCOMPRESS */
+            }
+        } while (argv++, --argc);
+    }
+    return 0;
+}

Added: branches/vendor/emile/tools/read_vmlinuz.c
===================================================================
--- branches/vendor/emile/tools/read_vmlinuz.c	2007-04-11 20:19:12 UTC (rev 184)
+++ branches/vendor/emile/tools/read_vmlinuz.c	2007-04-11 20:20:42 UTC (rev 185)
@@ -0,0 +1,89 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <elf.h>
+
+#include "zlib.h"
+
+gzFile ZEXPORT gzopen (char*, char*);
+
+#define PAGE_SHIFT      12
+#define PAGE_SIZE       (1UL << PAGE_SHIFT)
+
+int main(int argc, char **argv)
+{
+	gzFile in;
+	Elf32_Ehdr elf_header;
+	Elf32_Phdr *program_header;
+	int ret;
+	unsigned long min_addr, max_addr, kernel_size;
+	int i;
+	char * base;
+
+	in = gzopen("vmlinux.gz", "rb");
+	ret = gzread(in, &elf_header, sizeof(Elf32_Ehdr));
+
+	if  (elf_header.e_machine != EM_68K)
+	{
+		fprintf(stderr, "Not MC680x0 architecture\n");
+		return 1;
+	}
+
+	if (elf_header.e_type != ET_EXEC)
+	{
+		fprintf(stderr, "Not an executable file\n");
+		return 2;
+	}
+
+	program_header = (Elf32_Phdr *)malloc(elf_header.e_phnum *
+					      sizeof (Elf32_Phdr));
+	if (program_header == NULL)
+	{
+		fprintf(stderr, "Cannot allocate memory\n");
+		return 3;
+	}
+
+	ret = gzseek(in, elf_header.e_phoff, SEEK_SET);
+
+	ret = gzread(in, program_header, elf_header.e_phnum * sizeof(Elf32_Phdr));
+	min_addr = 0xffffffff;
+	max_addr = 0;
+	for (i = 0; i < elf_header.e_phnum; i++)
+	{
+		min_addr = (min_addr > program_header[i].p_vaddr) ?
+				program_header[i].p_vaddr : min_addr;
+		max_addr = (max_addr < program_header[i].p_vaddr + program_header[i].p_memsz) ?
+				program_header[i].p_vaddr + program_header[i].p_memsz: max_addr;
+	}
+	if (min_addr == 0)
+	{
+		min_addr = PAGE_SIZE;
+		program_header[0].p_vaddr += PAGE_SIZE;
+		program_header[0].p_offset += PAGE_SIZE;
+		program_header[0].p_filesz -= PAGE_SIZE;
+		program_header[0].p_memsz -= PAGE_SIZE;
+	}
+	kernel_size = max_addr - min_addr;
+	fprintf(stderr, "Kernel memory footprint: %ld\n", kernel_size);
+	fprintf(stderr, "Base address: 0x%lx\n", min_addr);
+	fprintf(stderr, "Entry point: 0x%lx\n", (long)elf_header.e_entry);
+
+	base = (char*)malloc(kernel_size);
+	memset(base, 0, kernel_size);
+	for (i = 0; i < elf_header.e_phnum; i++)
+	{
+		fprintf(stderr, "Reading Program Section #%d, "
+				"offset 0x%lx, (0x%lx,%lx)\n",
+				i, (long)program_header[i].p_offset,
+				program_header[i].p_vaddr - PAGE_SIZE,
+				(long)program_header[i].p_filesz);
+		ret = gzseek(in, program_header[i].p_offset, SEEK_SET);
+		ret = gzread(in, base + program_header[i].p_vaddr - PAGE_SIZE, program_header[i].p_filesz);
+	}
+	write(STDOUT_FILENO, base, kernel_size);
+	
+	ret = gzclose(in);
+
+	return 0;
+}




More information about the Debootloaders-devel mailing list