mail.coreboot.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
List overview
Download
SerialICE
September 2013
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
serialice@serialice.com
1 participants
2 discussions
Start a n
N
ew thread
Patch set updated for serialice: b8111b7 SerialICE support for HP DL 120 G5 motherboard using a Server Pilot II BMC
by Ruud Schramp
11 Sep '13
11 Sep '13
Ruud Schramp (schramp(a)holmes.nl) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/3918
-gerrit commit b8111b7cdc340b7722b0d7e6ff9fb95d25932ffd Author: Ruud Schramp <schramp(a)holmes.nl> Date: Wed Sep 11 01:49:30 2013 -0700 SerialICE support for HP DL 120 G5 motherboard using a Server Pilot II BMC Additional patches for copying a RAM version of serialice to RAM and compression for fast dumping. RAM Memory acquisition using live-BIOS modification
https://program.ohm2013.org/event/157.html
http://bofh.nikhef.nl/events/OHM/video/d3-t3-12-20130802-2200-ram_memory_ac…
Change-Id: Ia1d8abdd181ace44c5b94c7bba2f284701c7c2eb Signed-off-by: Ruud Schramp <schramp(a)holmes.nl> --- SerialICE/Kconfig | 4 + SerialICE/Makefile | 8 +- SerialICE/chipset.c | 6 + SerialICE/lzf/Makefile | 71 +++ SerialICE/lzf/README | 4 + SerialICE/lzf/liblzf-3.6/Changes | 136 +++++ SerialICE/lzf/liblzf-3.6/LICENSE | 27 + SerialICE/lzf/liblzf-3.6/Makefile | 71 +++ SerialICE/lzf/liblzf-3.6/Makefile.in | 66 +++ SerialICE/lzf/liblzf-3.6/README | 29 ++ SerialICE/lzf/liblzf-3.6/config.h | 17 + SerialICE/lzf/liblzf-3.6/config.h.in | 16 + SerialICE/lzf/liblzf-3.6/config.log | 549 ++++++++++++++++++++ SerialICE/lzf/liblzf-3.6/config.status | 827 +++++++++++++++++++++++++++++++ SerialICE/lzf/liblzf-3.6/configure.ac | 25 + SerialICE/lzf/liblzf-3.6/crc32.h | 65 +++ SerialICE/lzf/liblzf-3.6/cs/CLZF.cs | 344 +++++++++++++ SerialICE/lzf/liblzf-3.6/cs/README | 7 + SerialICE/lzf/liblzf-3.6/install-sh | 251 ++++++++++ SerialICE/lzf/liblzf-3.6/lzf.c | 537 ++++++++++++++++++++ SerialICE/lzf/liblzf-3.6/lzf.h | 100 ++++ SerialICE/lzf/liblzf-3.6/lzfP.h | 185 +++++++ SerialICE/lzf/liblzf-3.6/lzf_c.c | 291 +++++++++++ SerialICE/lzf/liblzf-3.6/lzf_d.c | 185 +++++++ SerialICE/lzf/liblzf-3.6/romdecompress.c | 245 +++++++++ SerialICE/lzf/romdecompress.c | 245 +++++++++ SerialICE/mainboard/intel_3210_ich9.c | 161 ++++++ SerialICE/mainboard/ipmi.c | 253 ++++++++++ SerialICE/mainboard/ipmi_disable.c | 37 ++ SerialICE/serial.c | 5 + SerialICE/serialice.c | 382 ++++++++++++++ SerialICE/serialice.ld | 38 +- SerialICE/start.S | 3 + 33 files changed, 5185 insertions(+), 5 deletions(-) diff --git a/SerialICE/Kconfig b/SerialICE/Kconfig index 6406414..3cee76b 100644 --- a/SerialICE/Kconfig +++ b/SerialICE/Kconfig @@ -33,6 +33,9 @@ config BOARD_KONTRON_986LCD_M config BOARD_INTEL_D945GCLF bool "Intel D945GCLF" +config BOARD_3210_ICH9 + bool "Intel 3210 + ICH9" + config BOARD_DELL_S1850 bool "Dell PowerEdge S1850" @@ -59,6 +62,7 @@ config BOARD_INIT string default "kontron_986lcd-m.c" if BOARD_KONTRON_986LCD_M default "intel_d945gclf.c" if BOARD_INTEL_D945GCLF + default "intel_3210_ich9.c" if BOARD_3210_ICH9 default "dell_s1850.c" if BOARD_DELL_S1850 default "asus_m2v-mx_se.c" if BOARD_ASUS_M2V_MX_SE default "msi_ms6178.c" if BOARD_MSI_MS6178 diff --git a/SerialICE/Makefile b/SerialICE/Makefile index 3979b62..8164468 100644 --- a/SerialICE/Makefile +++ b/SerialICE/Makefile @@ -110,9 +110,13 @@ $(obj)/serialice.rom: $(obj)/serialice.elf $(Q)printf " OBJCOPY $(subst $(shell pwd)/,,$(@))\n" $(Q)$(OBJCOPY) -O binary $< $@ -$(obj)/serialice.elf: $(obj)/serialice.o $(obj)/start.o $(src)/serialice.ld +$(obj)/serialice-ram.o: $(SOURCES) + $(CC) -O2 "-DVERSION=\"$(VERSION)\" \"RAM\"" -DCOMPRESS -I . -I build/ -I mainboard/ -c serialice.c -o build/serialice-ram.o + $(OBJCOPY) --prefix-symbols _ram --prefix-sections .ram build/serialice-ram.o build/serialice-ram.o + +$(obj)/serialice.elf: $(obj)/serialice.o $(obj)/start.o $(src)/serialice.ld $(obj)/serialice-ram.o $(Q)printf " LINK $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(CC) $(LDFLAGS) -o $@ $(obj)/serialice.o $(obj)/start.o + $(Q)$(CC) $(LDFLAGS) -o $@ $(obj)/serialice.o $(obj)/serialice-ram.o $(obj)/start.o $(Q)$(NM) $@ | sort -u > $(obj)/serialice.map $(obj)/serialice.S: $(SOURCES) $(obj)/romcc diff --git a/SerialICE/chipset.c b/SerialICE/chipset.c index 3354acd..262f460 100644 --- a/SerialICE/chipset.c +++ b/SerialICE/chipset.c @@ -64,6 +64,12 @@ static inline void pnp_set_iobase0(u16 port, u16 iobase) pnp_write_register(port, 0x61, iobase & 0xff); } +static inline void pnp_set_iobase1(u16 port, u16 iobase) +{ + pnp_write_register(port, 0x62, (iobase >> 8) & 0xff); + pnp_write_register(port, 0x63, iobase & 0xff); +} + static inline void pnp_set_irq0(u16 port, u8 irq) { pnp_write_register(port, 0x70, irq); diff --git a/SerialICE/lzf/Makefile b/SerialICE/lzf/Makefile new file mode 100644 index 0000000..11b6f6c --- /dev/null +++ b/SerialICE/lzf/Makefile @@ -0,0 +1,71 @@ +VERSION = 3.6 + +prefix = /usr/local +exec_prefix = ${prefix} +libdir = ${exec_prefix}/lib +bindir = ${exec_prefix}/bin +includedir = ${prefix}/include + + + +CC = gcc +CPPFLAGS = -I. +CFLAGS = -g +#CFLAGS = -g -O2 -O3 -funroll-all-loops +LDFLAGS = +RANLIB = ranlib +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 + +all: Makefile lzf romdecompress + +clean: + -rm -f *.o *.a lzf bench + +lzf_c.o: lzf_c.c lzfP.h + +lzf_d.o: lzf_d.c lzfP.h + +romdecompress.o: romdecompress.c + +romdecompress: romdecompress.o liblzf.a + +lzf.o: lzf.c + +lzf: lzf.o liblzf.a + +lzfP.h: lzf.h config.h + +liblzf.a: lzf_c.o lzf_d.o + rm -f $@ + $(AR) rc $@ $^ + $(RANLIB) $@ + +install: all + $(INSTALL) -d $(bindir) + $(INSTALL) -m 755 lzf $(bindir) + $(INSTALL) -d $(includedir) + $(INSTALL_DATA) lzf.h $(includedir) + $(INSTALL) -d $(libdir) + $(INSTALL_DATA) liblzf.a $(libdir) + +dist: + mkdir liblzf-$(VERSION) + tar c LICENSE README Makefile.in config.h.in \ + configure configure.ac install-sh \ + cs/README cs/CLZF.cs \ + lzf.h lzfP.h lzf_c.c lzf_d.c \ + crc32.h lzf.c Changes \ + | tar xpC liblzf-$(VERSION) + -chown -R root.root liblzf-$(VERSION) + chmod -R u=rwX,go=rX liblzf-$(VERSION) + tar cvf - liblzf-$(VERSION) | gzip -9 >liblzf-$(VERSION).tar.gz + rm -rf liblzf-$(VERSION) + ls -l liblzf-$(VERSION).tar.gz + +Makefile: Makefile.in + ./config.status + +bench: Makefile liblzf.a bench.c + $(CC) $(CPPFLAGS) $(CFLAGS) -g -o bench bench.c -L. -llzf + diff --git a/SerialICE/lzf/README b/SerialICE/lzf/README new file mode 100644 index 0000000..a2f87ba --- /dev/null +++ b/SerialICE/lzf/README @@ -0,0 +1,4 @@ +This application is using +liblzf-3.6.tar.gz + +The decompression application was hand-edited into the makefile diff --git a/SerialICE/lzf/liblzf-3.6/Changes b/SerialICE/lzf/liblzf-3.6/Changes new file mode 100644 index 0000000..93bd4cb --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/Changes @@ -0,0 +1,136 @@ +3.6 Mon Feb 7 17:37:31 CET 2011 + - fixed hash calculation in C♯ version (Tiago Freitas Leal). + - unroll copy for small sizes, use memcpy for larger sizes, + greatly speeding up decompression in most cases. + - finally disable rep movsb - it's a big loss on modern intel cpus, + and only a small win on amd cpus. + - improve C++ compatibility of the code. + - slightly improve compressor speed. + - halved memory requirements for compressor on 64 bit architectures, + which can improve the speed quite a bit on older cpus. + +3.5 Fri May 1 02:28:42 CEST 2009 + - lzf_compress did sometimes write one octet past the given output + buffer (analyzed and nice testcase by Salvatore Sanfilippo). + +3.4 Tue Sep 2 06:45:00 CEST 2008 + - the fix from 3.3 introduced a compression bug, which is fixed in + this release (which explains the mysterious prerelease...). Thanks + once more to Clément Calmels. + +3.3 Mon Aug 25 03:17:42 CEST 2008 + - lzf_compress could access memory after the given input buffer + when outputting back references. reported with nice testcase + by Clément Calmels. + +3.2 Fri May 9 18:52:23 CEST 2008 + - include a workaround for failing POSIX and real-world compliance + on 64 bit windows (microsoft claims to support POSIX, but is far + from it). (bug found and analysed nicely by John Lilley). + +3.1 Fri Nov 30 11:33:04 CET 2007 + - IMPORTANT BUGFIX: a too long final literal run would corrupt data + in the encoder (this was introduced in 3.0 only, earlier versions + are safe). + +3.0 Tue Nov 13 22:13:09 CET 2007 + - switched to 2-clause bsd with "GPL v2 or any later version" option. + - speed up compression by ~10-15% in common cases + by some manual unrolling. + - import some compiler tricks from JSON::XS, for further speed-ups. + - tune hash functions depending on ULTRA_FAST or VERY_FAST settings. + - for typical binary data (e.g. /bin/bash, memory dumps, + canterbury corpus etc.), speed is now comparable to fastlz, but + with better compression ratio. with ULTRA_FAST, it's typically + 3-15% faster than fastlz while still maintaining a similar ratio. + (amd64 and core 2 duo, ymmv). thanks a lot for the competition :) + - undo inline assembly in compressor, it is no longer helpful. + - no changes to the decompressor. + - use a HLOG of 16 by default now (formerly 15). + +2.1 Fri Nov 2 13:34:42 CET 2007 + - switched to a 2-clause bsd license with GPL exception. + - get rid of memcpy. + - tentatively use rep movsb on x86 and x86_64 (gcc only) for a + moderate speed improvement. + - applied patch by Kein-Hong Man to maske lzf.c compile under + the crippled mingw32 environment. + +2.0 Fri Feb 16 23:11:18 CET 2007 + - replaced lzf demo by industrial-strength lzf utility with behaviour + similar other compression utilities. Thanks for Stefan Traby for + rewriting it! + - fix state arg prototype. + +1.7 Wed Sep 27 17:29:15 CEST 2006 + - remove bogus "unlzf" patch. + note to self: never accept well-meant patches. + - make lzf more robust in presence of padding bytes or sudden eof. + +1.6 Fri Jul 7 17:31:26 CEST 2006 + - the lzf example utility will now uncompress if invoked + as "unlzf" (patch by Scott Feeney). + - add CHECK_INPUT option that adds more checks for input + data validity. + - help applications that do not pass in the correct length + (such as php) by returning either EINVAL or E2BIG. + - default HLOG size is now 15 (cpu caches have increased). + - documentation fixes. + +1.51 Thu Apr 14 22:15:46 CEST 2005 + - incorporated C♯ implementation of both the en- and decoder, + written by "Oren J. Maurice". + You can find it in the cs/ subdirectory. + - make FRST, NEXT IDX overridable if lzf_c.c is directly included + in the code. + +1.5 Tue Mar 8 20:23:23 CET 2005 + - incorporated improvements by Adam D. Moss, + which includes a new VERY_FAST mode which is + a bit slower than ULTRA_FAST but much better, + and enabled it as default. + +1.401 Thu Mar 3 18:00:52 CET 2005 + - use cstring in c++, not string.h. + - change of contact address. + +1.4 Wed Dec 15 08:08:49 CET 2004 + - very very slight tuning of the hashing function. + +1.3 Thu Mar 25 15:41:17 CET 2004 + - changed license of lzf core code to explicitly allow + relicensing under the GPLv2. + - added VPATH support as suggested by Björn Eriksson. + +1.2 Mon Dec 29 13:47:28 CET 2003 + - avoid spurious memory accesses after the to-be-compressed + memory region. originally reported by Michal Zalewski. + - flip LZF_STACK_ARG meaning (to be correct). + +1.1 Tue Dec 23 05:48:32 CET 2003 + - removed #warn directive, it's not worth the hassle. + - add LZF_STACK_ARG and AVOID_ERRNO configurations + for embedded systems. + - make it compile cleanly as c++. + - some small documentation and code fixes. + +1.0 Sun Nov 17 12:37:37 CET 2002 + - slightly better compression ratio, almost unmeasurably + slower. + - some documentation fixes. + +0.4 Thu Jun 13 14:11:10 CEST 2002 + - typoe fix. + - lzf demo program now properly decompresses small files. + - fix another 64 bit issue, found by Laurent Deniel. + +0.3 Tue Jan 16 13:21:14 CET 2001 + - fix silly beginners 32/64 bit mistake. + +0.2 Thu Jan 4 05:56:42 CET 2001 + - now totally independent of autoconfig, for + easy inclusion into other programs. + - much better fine-tuning, faster and better than 0.1. + +0.1 2000 + - initial release. diff --git a/SerialICE/lzf/liblzf-3.6/LICENSE b/SerialICE/lzf/liblzf-3.6/LICENSE new file mode 100644 index 0000000..ee54ff7 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2000-2009 Marc Alexander Lehmann <schmorp(a)schmorp.de> + +Redistribution and use in source and binary forms, with or without modifica- +tion, 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. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- +CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- +CIAL, 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 OTH- +ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + +Alternatively, the following files carry an additional notice that +explicitly allows relicensing under the GPLv2: lzf.c lzf.h lzfP.h lzf_c.c +lzf_d.c + diff --git a/SerialICE/lzf/liblzf-3.6/Makefile b/SerialICE/lzf/liblzf-3.6/Makefile new file mode 100644 index 0000000..11b6f6c --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/Makefile @@ -0,0 +1,71 @@ +VERSION = 3.6 + +prefix = /usr/local +exec_prefix = ${prefix} +libdir = ${exec_prefix}/lib +bindir = ${exec_prefix}/bin +includedir = ${prefix}/include + + + +CC = gcc +CPPFLAGS = -I. +CFLAGS = -g +#CFLAGS = -g -O2 -O3 -funroll-all-loops +LDFLAGS = +RANLIB = ranlib +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 + +all: Makefile lzf romdecompress + +clean: + -rm -f *.o *.a lzf bench + +lzf_c.o: lzf_c.c lzfP.h + +lzf_d.o: lzf_d.c lzfP.h + +romdecompress.o: romdecompress.c + +romdecompress: romdecompress.o liblzf.a + +lzf.o: lzf.c + +lzf: lzf.o liblzf.a + +lzfP.h: lzf.h config.h + +liblzf.a: lzf_c.o lzf_d.o + rm -f $@ + $(AR) rc $@ $^ + $(RANLIB) $@ + +install: all + $(INSTALL) -d $(bindir) + $(INSTALL) -m 755 lzf $(bindir) + $(INSTALL) -d $(includedir) + $(INSTALL_DATA) lzf.h $(includedir) + $(INSTALL) -d $(libdir) + $(INSTALL_DATA) liblzf.a $(libdir) + +dist: + mkdir liblzf-$(VERSION) + tar c LICENSE README Makefile.in config.h.in \ + configure configure.ac install-sh \ + cs/README cs/CLZF.cs \ + lzf.h lzfP.h lzf_c.c lzf_d.c \ + crc32.h lzf.c Changes \ + | tar xpC liblzf-$(VERSION) + -chown -R root.root liblzf-$(VERSION) + chmod -R u=rwX,go=rX liblzf-$(VERSION) + tar cvf - liblzf-$(VERSION) | gzip -9 >liblzf-$(VERSION).tar.gz + rm -rf liblzf-$(VERSION) + ls -l liblzf-$(VERSION).tar.gz + +Makefile: Makefile.in + ./config.status + +bench: Makefile liblzf.a bench.c + $(CC) $(CPPFLAGS) $(CFLAGS) -g -o bench bench.c -L. -llzf + diff --git a/SerialICE/lzf/liblzf-3.6/Makefile.in b/SerialICE/lzf/liblzf-3.6/Makefile.in new file mode 100644 index 0000000..3c87d62 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/Makefile.in @@ -0,0 +1,66 @@ +VERSION = 3.6 + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +bindir = @bindir@ +includedir = @includedir@ + +VPATH = @srcdir@ + +CC = @CC@ +CPPFLAGS = -I. @CPPFLAGS@ +CFLAGS = @CFLAGS@ +LDFLAGS = @LDFLAGS@ +RANLIB = @RANLIB@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +all: Makefile lzf + +clean: + -rm -f *.o *.a lzf bench + +lzf_c.o: lzf_c.c lzfP.h + +lzf_d.o: lzf_d.c lzfP.h + +lzf.o: lzf.c + +lzf: lzf.o liblzf.a + +lzfP.h: lzf.h config.h + +liblzf.a: lzf_c.o lzf_d.o + rm -f $@ + $(AR) rc $@ $^ + $(RANLIB) $@ + +install: all + $(INSTALL) -d $(bindir) + $(INSTALL) -m 755 lzf $(bindir) + $(INSTALL) -d $(includedir) + $(INSTALL_DATA) lzf.h $(includedir) + $(INSTALL) -d $(libdir) + $(INSTALL_DATA) liblzf.a $(libdir) + +dist: + mkdir liblzf-$(VERSION) + tar c LICENSE README Makefile.in config.h.in \ + configure configure.ac install-sh \ + cs/README cs/CLZF.cs \ + lzf.h lzfP.h lzf_c.c lzf_d.c \ + crc32.h lzf.c Changes \ + | tar xpC liblzf-$(VERSION) + -chown -R root.root liblzf-$(VERSION) + chmod -R u=rwX,go=rX liblzf-$(VERSION) + tar cvf - liblzf-$(VERSION) | gzip -9 >liblzf-$(VERSION).tar.gz + rm -rf liblzf-$(VERSION) + ls -l liblzf-$(VERSION).tar.gz + +Makefile: Makefile.in + ./config.status + +bench: Makefile liblzf.a bench.c + $(CC) $(CPPFLAGS) $(CFLAGS) -g -o bench bench.c -L. -llzf + diff --git a/SerialICE/lzf/liblzf-3.6/README b/SerialICE/lzf/liblzf-3.6/README new file mode 100644 index 0000000..0734ebe --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/README @@ -0,0 +1,29 @@ +DESCRIPTION + LZF is an extremely fast (not that much slower than a pure memcpy) + compression algorithm. It is ideal for applications where you want to + save *some* space but not at the cost of speed. It is ideal for + repetitive data as well. The module is self-contained and very small. + + It's written in ISO-C with no external dependencies other than what + C provides and can easily be #include'd into your code, no makefile + changes or library builds requires. + + A C♯ implementation without external dependencies is available, too. + + I do not know for certain whether any patents in any countries apply + to this algorithm, but at the moment it is believed that it is free + from any patents. More importantly, it is also free to use in every + software package (see LICENSE). + + See the lzf.h file for details on how the functions in this + mini-library are to be used. + + NOTE: This package contains a very bare-bones command-line utility + which is neither optimized for speed nor for compression. This library + is really intended to be used inside larger programs. + +AUTHOR + This library was written by Marc Lehmann <schmorp(a)schmorp.de> (See also +
http://software.schmorp.de/pkg/liblzf
). + + diff --git a/SerialICE/lzf/liblzf-3.6/config.h b/SerialICE/lzf/liblzf-3.6/config.h new file mode 100644 index 0000000..b5df3b1 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/config.h @@ -0,0 +1,17 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */ + +/* Define to empty if the keyword does not work. */ +/* #undef const */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* The number of bytes in a int. */ +#define SIZEOF_INT 4 + +/* The number of bytes in a long. */ +#define SIZEOF_LONG 4 + +/* The number of bytes in a short. */ +#define SIZEOF_SHORT 2 diff --git a/SerialICE/lzf/liblzf-3.6/config.h.in b/SerialICE/lzf/liblzf-3.6/config.h.in new file mode 100644 index 0000000..5fd69c6 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/config.h.in @@ -0,0 +1,16 @@ +/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */ + +/* Define to empty if the keyword does not work. */ +#undef const + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* The number of bytes in a int. */ +#undef SIZEOF_INT + +/* The number of bytes in a long. */ +#undef SIZEOF_LONG + +/* The number of bytes in a short. */ +#undef SIZEOF_SHORT diff --git a/SerialICE/lzf/liblzf-3.6/config.log b/SerialICE/lzf/liblzf-3.6/config.log new file mode 100644 index 0000000..972b728 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/config.log @@ -0,0 +1,549 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by configure, which was +generated by GNU Autoconf 2.60. Invocation command line was + + $ ./configure + +## --------- ## +## Platform. ## +## --------- ## + +hostname = koekiemonster +uname -m = i686 +uname -r = 2.6.32-24-generic-pae +uname -s = Linux +uname -v = #39-Ubuntu SMP Wed Jul 28 07:39:26 UTC 2010 + +/usr/bin/uname -p = unknown +/bin/uname -X = unknown + +/bin/arch = unknown +/usr/bin/arch -k = unknown +/usr/convex/getsysinfo = unknown +/usr/bin/hostinfo = unknown +/bin/machine = unknown +/usr/bin/oslevel = unknown +/bin/universe = unknown + +PATH: /usr/local/sbin +PATH: /usr/local/bin +PATH: /usr/sbin +PATH: /usr/bin +PATH: /sbin +PATH: /bin +PATH: /usr/games +PATH: /opt/SUNWspro/bin +PATH: /home/schramp +PATH: /usr/users/work/aftertime/ + + +## ----------- ## +## Core tests. ## +## ----------- ## + +configure:1723: checking for gcc +configure:1739: found /usr/bin/gcc +configure:1750: result: gcc +configure:1988: checking for C compiler version +configure:1995: gcc --version >&5 +gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3 +Copyright (C) 2009 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +configure:1998: $? = 0 +configure:2005: gcc -v >&5 +Using built-in specs. +Target: i486-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu +Thread model: posix +gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) +configure:2008: $? = 0 +configure:2015: gcc -V >&5 +gcc: '-V' option must have argument +configure:2018: $? = 1 +configure:2041: checking for C compiler default output file name +configure:2068: gcc conftest.c >&5 +configure:2071: $? = 0 +configure:2117: result: a.out +configure:2122: checking whether the C compiler works +configure:2132: ./a.out +configure:2135: $? = 0 +configure:2152: result: yes +configure:2159: checking whether we are cross compiling +configure:2161: result: no +configure:2164: checking for suffix of executables +configure:2171: gcc -o conftest conftest.c >&5 +configure:2174: $? = 0 +configure:2198: result: +configure:2204: checking for suffix of object files +configure:2230: gcc -c conftest.c >&5 +configure:2233: $? = 0 +configure:2256: result: o +configure:2260: checking whether we are using the GNU C compiler +configure:2289: gcc -c conftest.c >&5 +configure:2295: $? = 0 +configure:2302: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:2305: $? = 0 +configure:2312: test -s conftest.o +configure:2315: $? = 0 +configure:2329: result: yes +configure:2334: checking whether gcc accepts -g +configure:2364: gcc -c -g conftest.c >&5 +configure:2370: $? = 0 +configure:2377: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:2380: $? = 0 +configure:2387: test -s conftest.o +configure:2390: $? = 0 +configure:2520: result: yes +configure:2537: checking for gcc option to accept ISO C89 +configure:2611: gcc -c -g -O2 conftest.c >&5 +configure:2617: $? = 0 +configure:2624: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:2627: $? = 0 +configure:2634: test -s conftest.o +configure:2637: $? = 0 +configure:2657: result: none needed +configure:2683: checking for special C compiler options needed for large files +configure:2810: result: no +configure:2816: checking for _FILE_OFFSET_BITS value needed for large files +configure:2852: gcc -c -g -O2 conftest.c >&5 +conftest.c:15: warning: left shift count >= width of type +conftest.c:15: warning: left shift count >= width of type +conftest.c:17: error: size of array 'off_t_is_large' is negative +configure:2858: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| #define PACKAGE_NAME "" +| #define PACKAGE_TARNAME "" +| #define PACKAGE_VERSION "" +| #define PACKAGE_STRING "" +| #define PACKAGE_BUGREPORT "" +| #define _GNU_SOURCE 1 +| /* end confdefs.h. */ +| #include <sys/types.h> +| /* Check that off_t can represent 2**63 - 1 correctly. +| We can't simply define LARGE_OFF_T to be 9223372036854775807, +| since some C++ compilers masquerading as C compilers +| incorrectly reject 9223372036854775807. */ +| #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +| int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 +| && LARGE_OFF_T % 2147483647 == 1) +| ? 1 : -1]; +| int +| main () +| { +| +| ; +| return 0; +| } +configure:2919: gcc -c -g -O2 conftest.c >&5 +configure:2925: $? = 0 +configure:2932: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:2935: $? = 0 +configure:2942: test -s conftest.o +configure:2945: $? = 0 +configure:2959: result: 64 +configure:2969: checking for _LARGE_FILES value needed for large files +configure:3005: gcc -c -g -O2 conftest.c >&5 +configure:3011: $? = 0 +configure:3018: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:3021: $? = 0 +configure:3028: test -s conftest.o +configure:3031: $? = 0 +configure:3112: result: no +configure:3172: checking for gcc +configure:3199: result: gcc +configure:3437: checking for C compiler version +configure:3444: gcc --version >&5 +gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3 +Copyright (C) 2009 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +configure:3447: $? = 0 +configure:3454: gcc -v >&5 +Using built-in specs. +Target: i486-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu +Thread model: posix +gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) +configure:3457: $? = 0 +configure:3464: gcc -V >&5 +gcc: '-V' option must have argument +configure:3467: $? = 1 +configure:3470: checking whether we are using the GNU C compiler +configure:3539: result: yes +configure:3544: checking whether gcc accepts -g +configure:3730: result: yes +configure:3747: checking for gcc option to accept ISO C89 +configure:3867: result: none needed +configure:3928: checking for ranlib +configure:3944: found /usr/bin/ranlib +configure:3955: result: ranlib +configure:4025: checking for a BSD-compatible install +configure:4081: result: /usr/bin/install -c +configure:4097: checking how to run the C preprocessor +configure:4137: gcc -E conftest.c +configure:4143: $? = 0 +configure:4181: gcc -E conftest.c +conftest.c:10:28: error: ac_nonexistent.h: No such file or directory +configure:4187: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| #define PACKAGE_NAME "" +| #define PACKAGE_TARNAME "" +| #define PACKAGE_VERSION "" +| #define PACKAGE_STRING "" +| #define PACKAGE_BUGREPORT "" +| #define _GNU_SOURCE 1 +| #define _FILE_OFFSET_BITS 64 +| /* end confdefs.h. */ +| #include <ac_nonexistent.h> +configure:4227: result: gcc -E +configure:4256: gcc -E conftest.c +configure:4262: $? = 0 +configure:4300: gcc -E conftest.c +conftest.c:10:28: error: ac_nonexistent.h: No such file or directory +configure:4306: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| #define PACKAGE_NAME "" +| #define PACKAGE_TARNAME "" +| #define PACKAGE_VERSION "" +| #define PACKAGE_STRING "" +| #define PACKAGE_BUGREPORT "" +| #define _GNU_SOURCE 1 +| #define _FILE_OFFSET_BITS 64 +| /* end confdefs.h. */ +| #include <ac_nonexistent.h> +configure:4351: checking for grep that handles long lines and -e +configure:4425: result: /bin/grep +configure:4430: checking for egrep +configure:4508: result: /bin/grep -E +configure:4513: checking for ANSI C header files +configure:4543: gcc -c -g -O2 conftest.c >&5 +configure:4549: $? = 0 +configure:4556: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4559: $? = 0 +configure:4566: test -s conftest.o +configure:4569: $? = 0 +configure:4665: gcc -o conftest -g -O2 conftest.c >&5 +configure:4668: $? = 0 +configure:4674: ./conftest +configure:4677: $? = 0 +configure:4694: result: yes +configure:4719: checking for sys/types.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4719: checking for sys/stat.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4719: checking for stdlib.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4719: checking for string.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4719: checking for memory.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4719: checking for strings.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4719: checking for inttypes.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4719: checking for stdint.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4719: checking for unistd.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4791: checking for short +configure:4821: gcc -c -g -O2 conftest.c >&5 +configure:4827: $? = 0 +configure:4834: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4837: $? = 0 +configure:4844: test -s conftest.o +configure:4847: $? = 0 +configure:4859: result: yes +configure:4862: checking size of short +configure:5250: gcc -o conftest -g -O2 conftest.c >&5 +configure:5253: $? = 0 +configure:5259: ./conftest +configure:5262: $? = 0 +configure:5284: result: 2 +configure:5291: checking for int +configure:5321: gcc -c -g -O2 conftest.c >&5 +configure:5327: $? = 0 +configure:5334: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:5337: $? = 0 +configure:5344: test -s conftest.o +configure:5347: $? = 0 +configure:5359: result: yes +configure:5362: checking size of int +configure:5750: gcc -o conftest -g -O2 conftest.c >&5 +configure:5753: $? = 0 +configure:5759: ./conftest +configure:5762: $? = 0 +configure:5784: result: 4 +configure:5791: checking for long +configure:5821: gcc -c -g -O2 conftest.c >&5 +configure:5827: $? = 0 +configure:5834: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:5837: $? = 0 +configure:5844: test -s conftest.o +configure:5847: $? = 0 +configure:5859: result: yes +configure:5862: checking size of long +configure:6250: gcc -o conftest -g -O2 conftest.c >&5 +configure:6253: $? = 0 +configure:6259: ./conftest +configure:6262: $? = 0 +configure:6284: result: 4 +configure:6292: checking for an ANSI C-conforming const +configure:6367: gcc -c -g -O2 conftest.c >&5 +configure:6373: $? = 0 +configure:6380: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:6383: $? = 0 +configure:6390: test -s conftest.o +configure:6393: $? = 0 +configure:6405: result: yes +configure:6415: checking for inline +configure:6441: gcc -c -g -O2 conftest.c >&5 +configure:6447: $? = 0 +configure:6454: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:6457: $? = 0 +configure:6464: test -s conftest.o +configure:6467: $? = 0 +configure:6482: result: inline +configure:6516: checking getopt.h usability +configure:6533: gcc -c -g -O2 conftest.c >&5 +configure:6539: $? = 0 +configure:6546: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:6549: $? = 0 +configure:6556: test -s conftest.o +configure:6559: $? = 0 +configure:6570: result: yes +configure:6574: checking getopt.h presence +configure:6589: gcc -E conftest.c +configure:6595: $? = 0 +configure:6616: result: yes +configure:6644: checking for getopt.h +configure:6652: result: yes +configure:6669: checking for getopt_long +configure:6725: gcc -o conftest -g -O2 conftest.c >&5 +configure:6731: $? = 0 +configure:6738: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:6741: $? = 0 +configure:6748: test -s conftest +configure:6751: $? = 0 +configure:6765: result: yes +configure:6885: creating ./config.status + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.60. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on koekiemonster + +config.status:583: creating Makefile +config.status:583: creating config.h + +## ---------------- ## +## Cache variables. ## +## ---------------- ## + +ac_cv_c_compiler_gnu=yes +ac_cv_c_const=yes +ac_cv_c_inline=inline +ac_cv_env_CC_set= +ac_cv_env_CC_value= +ac_cv_env_CFLAGS_set= +ac_cv_env_CFLAGS_value= +ac_cv_env_CPPFLAGS_set= +ac_cv_env_CPPFLAGS_value= +ac_cv_env_CPP_set= +ac_cv_env_CPP_value= +ac_cv_env_LDFLAGS_set= +ac_cv_env_LDFLAGS_value= +ac_cv_env_build_alias_set= +ac_cv_env_build_alias_value= +ac_cv_env_host_alias_set= +ac_cv_env_host_alias_value= +ac_cv_env_target_alias_set= +ac_cv_env_target_alias_value= +ac_cv_func_getopt_long=yes +ac_cv_header_getopt_h=yes +ac_cv_header_inttypes_h=yes +ac_cv_header_memory_h=yes +ac_cv_header_stdc=yes +ac_cv_header_stdint_h=yes +ac_cv_header_stdlib_h=yes +ac_cv_header_string_h=yes +ac_cv_header_strings_h=yes +ac_cv_header_sys_stat_h=yes +ac_cv_header_sys_types_h=yes +ac_cv_header_unistd_h=yes +ac_cv_objext=o +ac_cv_path_EGREP='/bin/grep -E' +ac_cv_path_GREP=/bin/grep +ac_cv_path_install='/usr/bin/install -c' +ac_cv_prog_CPP='gcc -E' +ac_cv_prog_ac_ct_CC=gcc +ac_cv_prog_ac_ct_RANLIB=ranlib +ac_cv_prog_cc_c89= +ac_cv_prog_cc_g=yes +ac_cv_sizeof_int=4 +ac_cv_sizeof_long=4 +ac_cv_sizeof_short=2 +ac_cv_sys_file_offset_bits=64 +ac_cv_sys_large_files=no +ac_cv_sys_largefile_CC=no +ac_cv_type_int=yes +ac_cv_type_long=yes +ac_cv_type_short=yes + +## ----------------- ## +## Output variables. ## +## ----------------- ## + +CC='gcc' +CFLAGS='-g -O2 -O3 -funroll-all-loops' +CPP='gcc -E' +CPPFLAGS='' +DEFS='-DHAVE_CONFIG_H' +ECHO_C='' +ECHO_N='-n' +ECHO_T='' +EGREP='/bin/grep -E' +EXEEXT='' +GREP='/bin/grep' +INSTALL_DATA='${INSTALL} -m 644' +INSTALL_PROGRAM='${INSTALL}' +INSTALL_SCRIPT='${INSTALL}' +LDFLAGS='' +LIBOBJS='' +LIBS='' +LTLIBOBJS='' +OBJEXT='o' +PACKAGE_BUGREPORT='' +PACKAGE_NAME='' +PACKAGE_STRING='' +PACKAGE_TARNAME='' +PACKAGE_VERSION='' +PATH_SEPARATOR=':' +RANLIB='ranlib' +SHELL='/bin/bash' +ac_ct_CC='gcc' +bindir='${exec_prefix}/bin' +build_alias='' +datadir='${datarootdir}' +datarootdir='${prefix}/share' +docdir='${datarootdir}/doc/${PACKAGE}' +dvidir='${docdir}' +exec_prefix='${prefix}' +host_alias='' +htmldir='${docdir}' +includedir='${prefix}/include' +infodir='${datarootdir}/info' +libdir='${exec_prefix}/lib' +libexecdir='${exec_prefix}/libexec' +localedir='${datarootdir}/locale' +localstatedir='${prefix}/var' +mandir='${datarootdir}/man' +oldincludedir='/usr/include' +pdfdir='${docdir}' +prefix='/usr/local' +program_transform_name='s,x,x,' +psdir='${docdir}' +sbindir='${exec_prefix}/sbin' +sharedstatedir='${prefix}/com' +sysconfdir='${prefix}/etc' +target_alias='' + +## ----------- ## +## confdefs.h. ## +## ----------- ## + +#define PACKAGE_NAME "" +#define PACKAGE_TARNAME "" +#define PACKAGE_VERSION "" +#define PACKAGE_STRING "" +#define PACKAGE_BUGREPORT "" +#define _GNU_SOURCE 1 +#define _FILE_OFFSET_BITS 64 +#define STDC_HEADERS 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_UNISTD_H 1 +#define SIZEOF_SHORT 2 +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +#define HAVE_GETOPT_H 1 +#define HAVE_GETOPT_LONG 1 + +configure: exit 0 diff --git a/SerialICE/lzf/liblzf-3.6/config.status b/SerialICE/lzf/liblzf-3.6/config.status new file mode 100644 index 0000000..a76542b --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/config.status @@ -0,0 +1,827 @@ +#! /bin/bash +# Generated by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=${CONFIG_SHELL-/bin/bash} +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +# Find out whether ``test -x'' works. Don't use a zero-byte file, as +# systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + as_executable_p="test -x" +else + as_executable_p=: +fi +rm -f conf$$.file + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by $as_me, which was +generated by GNU Autoconf 2.60. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +# Files that config.status was made for. +config_files=" Makefile" +config_headers=" config.h" + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to <bug-autoconf(a)gnu.org>." + +ac_cs_version="\ +config.status +configured by ./configure, generated by GNU Autoconf 2.60, + with options \"\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='/usr/users/work/serialice/SerialICE-1.5/lzf/liblzf-3.6' +srcdir='.' +INSTALL='/usr/bin/install -c' +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +if $ac_cs_recheck; then + echo "running CONFIG_SHELL=/bin/bash /bin/bash ./configure " $ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=/bin/bash + export CONFIG_SHELL + exec /bin/bash "./configure" $ac_configure_extra_args --no-create --no-recursion +fi + +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +cat >"$tmp/subs-1.sed" <<\CEOF +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +s,@SHELL@,|#_!!_#|/bin/bash,g +s,@PATH_SEPARATOR@,|#_!!_#|:,g +s,@PACKAGE_NAME@,|#_!!_#|,g +s,@PACKAGE_TARNAME@,|#_!!_#|,g +s,@PACKAGE_VERSION@,|#_!!_#|,g +s,@PACKAGE_STRING@,|#_!!_#|,g +s,@PACKAGE_BUGREPORT@,|#_!!_#|,g +s,@exec_prefix@,|#_!!_#|${prefix},g +s,@prefix@,|#_!!_#|/usr/local,g +s,@program_transform_name@,|#_!!_#|s\,x\,x\,,g +s,@bindir@,|#_!!_#|${exec_prefix}/bin,g +s,@sbindir@,|#_!!_#|${exec_prefix}/sbin,g +s,@libexecdir@,|#_!!_#|${exec_prefix}/libexec,g +s,@datarootdir@,|#_!!_#|${prefix}/share,g +s,@datadir@,|#_!!_#|${datarootdir},g +s,@sysconfdir@,|#_!!_#|${prefix}/etc,g +s,@sharedstatedir@,|#_!!_#|${prefix}/com,g +s,@localstatedir@,|#_!!_#|${prefix}/var,g +s,@includedir@,|#_!!_#|${prefix}/include,g +s,@oldincludedir@,|#_!!_#|/usr/include,g +s,@docdir@,|#_!!_#|${datarootdir}/doc/${PACKAGE},g +s,@infodir@,|#_!!_#|${datarootdir}/info,g +s,@htmldir@,|#_!!_#|${docdir},g +s,@dvidir@,|#_!!_#|${docdir},g +s,@pdfdir@,|#_!!_#|${docdir},g +s,@psdir@,|#_!!_#|${docdir},g +s,@libdir@,|#_!!_#|${exec_prefix}/lib,g +s,@localedir@,|#_!!_#|${datarootdir}/locale,g +s,@mandir@,|#_!!_#|${datarootdir}/man,g +s,@DEFS@,|#_!!_#|-DHAVE_CONFIG_H,g +s,@ECHO_C@,|#_!!_#|,g +s,@ECHO_N@,|#_!!_#|-n,g +s,@ECHO_T@,|#_!!_#|,g +s,@LIBS@,|#_!!_#|,g +s,@build_alias@,|#_!!_#|,g +s,@host_alias@,|#_!!_#|,g +s,@target_alias@,|#_!!_#|,g +s,@CC@,|#_!!_#|gcc,g +s,@CFLAGS@,|#_!!_#|-g -O2 -O3 -funroll-all-loops,g +s,@LDFLAGS@,|#_!!_#|,g +s,@CPPFLAGS@,|#_!!_#|,g +s,@ac_ct_CC@,|#_!!_#|gcc,g +s,@EXEEXT@,|#_!!_#|,g +s,@OBJEXT@,|#_!!_#|o,g +s,@RANLIB@,|#_!!_#|ranlib,g +s,@INSTALL_PROGRAM@,|#_!!_#|${INSTALL},g +s,@INSTALL_SCRIPT@,|#_!!_#|${INSTALL},g +s,@INSTALL_DATA@,|#_!!_#|${INSTALL} -m 644,g +s,@CPP@,|#_!!_#|gcc -E,g +s,@GREP@,|#_!!_#|/bin/grep,g +s,@EGREP@,|#_!!_#|/bin/grep -E,g +s,@LIBOBJS@,|#_!!_#|,g +s,@LTLIBOBJS@,|#_!!_#|,g +:end +s/|#_!!_#|//g +CEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + ac_datarootdir_hack=' + s&@datadir@&${datarootdir}&g + s&@docdir@&${datarootdir}/doc/${PACKAGE}&g + s&@infodir@&${datarootdir}/info&g + s&@localedir@&${datarootdir}/locale&g + s&@mandir@&${datarootdir}/man&g + s&\${datarootdir}&${prefix}/share&g' ;; +esac + sed "/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +} + +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + :H) + # + # CONFIG_HEADER + # + # First, check the format of the line: + cat >"$tmp/defines.sed" <<\CEOF +/^[ ]*#[ ]*undef[ ][ ]*[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*[ ]*$/b def +/^[ ]*#[ ]*define[ ][ ]*[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*[( ]/b def +b +:def +s/$/ / +s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_NAME\)[ (].*,\1define\2 "" , +s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_TARNAME\)[ (].*,\1define\2 "" , +s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_VERSION\)[ (].*,\1define\2 "" , +s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_STRING\)[ (].*,\1define\2 "" , +s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_BUGREPORT\)[ (].*,\1define\2 "" , +s,^\([ #]*\)[^ ]*\([ ]*_GNU_SOURCE\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*_FILE_OFFSET_BITS\)[ (].*,\1define\2 64 , +s,^\([ #]*\)[^ ]*\([ ]*STDC_HEADERS\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_TYPES_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_STAT_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_STDLIB_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRING_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_MEMORY_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRINGS_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_INTTYPES_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_STDINT_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_UNISTD_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*SIZEOF_SHORT\)[ (].*,\1define\2 2 , +s,^\([ #]*\)[^ ]*\([ ]*SIZEOF_INT\)[ (].*,\1define\2 4 , +s,^\([ #]*\)[^ ]*\([ ]*SIZEOF_LONG\)[ (].*,\1define\2 4 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_GETOPT_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_GETOPT_LONG\)[ (].*,\1define\2 1 , +s/ $// +s,^[ #]*u.*,/* & */, +CEOF + sed -f "$tmp/defines.sed" $ac_file_inputs >"$tmp/out1" +ac_result="$tmp/out1" + if test x"$ac_file" != x-; then + echo "/* $configure_input */" >"$tmp/config.h" + cat "$ac_result" >>"$tmp/config.h" + if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f $ac_file + mv "$tmp/config.h" $ac_file + fi + else + echo "/* $configure_input */" + cat "$ac_result" + fi + rm -f "$tmp/out12" + ;; + + + esac + +done # for ac_tag + + +{ (exit 0); exit 0; } diff --git a/SerialICE/lzf/liblzf-3.6/configure.ac b/SerialICE/lzf/liblzf-3.6/configure.ac new file mode 100644 index 0000000..58316a0 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/configure.ac @@ -0,0 +1,25 @@ +AC_INIT +AC_CONFIG_SRCDIR([lzfP.h]) + +AC_CONFIG_HEADER(config.h) + +AC_GNU_SOURCE +AC_SYS_LARGEFILE +AC_PROG_CC +AC_PROG_RANLIB +AC_PROG_INSTALL +AC_HEADER_STDC + +AC_C_CONST +AC_C_INLINE +AC_CHECK_HEADERS(getopt.h) +AC_CHECK_FUNCS(getopt_long) + +if test "$GCC" = yes; then + CFLAGS="$CFLAGS -O3 -funroll-all-loops" +else + AC_MSG_RESULT(no gcc) +fi + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/SerialICE/lzf/liblzf-3.6/crc32.h b/SerialICE/lzf/liblzf-3.6/crc32.h new file mode 100644 index 0000000..cf8f6d4 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/crc32.h @@ -0,0 +1,65 @@ +#ifndef CRC32_H +#define CRC32_H + +/* crc32 0xdebb20e3 table and supplementary functions. */ + +static const u32 crc_32_tab[] = +{ + 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, + 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, + 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, + 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, + 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, + 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, + 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, + 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, + 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, + 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, + 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, + 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, + 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, + 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, + 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, + 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, + 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, + 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, + 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, + 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, + 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, + 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, + 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, + 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, + 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, + 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, + 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, + 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, + 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, + 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, + 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, + 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, + 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, + 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, + 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, + 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, + 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, + 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, + 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, + 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, + 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, + 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, + 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, + 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, + 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, + 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, + 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, + 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, + 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, + 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, + 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, + 0x2d02ef8dL +}; + +#define crc32(crc,byte) (crc_32_tab[(u8)(crc) ^ (u8)(byte)] ^ ((crc) >> 8)) + +#endif + diff --git a/SerialICE/lzf/liblzf-3.6/cs/CLZF.cs b/SerialICE/lzf/liblzf-3.6/cs/CLZF.cs new file mode 100644 index 0000000..710419a --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/cs/CLZF.cs @@ -0,0 +1,344 @@ +/* + * Copyright (c) 2005 Oren J. Maurice <oymaurice(a)hazorea.org.il> + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, 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. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, 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 OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License version 2 (the "GPL"), in which case the + * provisions of the GPL are applicable instead of the above. If you wish to + * allow the use of your version of this file only under the terms of the + * GPL and not to allow others to use your version of this file under the + * BSD license, indicate your decision by deleting the provisions above and + * replace them with the notice and other provisions required by the GPL. If + * you do not delete the provisions above, a recipient may use your version + * of this file under either the BSD or the GPL. + */ + +using System; + +namespace
LZF.NET
+{ + + /// <summary> + /// Summary description for CLZF. + /// </summary> + public class CLZF + { + // CRC32 data & function + UInt32 []crc_32_tab = new UInt32[256] + { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d + }; + + public UInt32 crc32(UInt32 OldCRC,byte NewData) + { + return crc_32_tab[(OldCRC & 0xff) ^ NewData] ^ (OldCRC >> 8); + } + + + /// <summary> + /// LZF Compressor + /// </summary> + + UInt32 HLOG=14; + UInt32 HSIZE=(1<<14); + + /* + * don't play with this unless you benchmark! + * decompression is not dependent on the hash function + * the hashing function might seem strange, just believe me + * it works ;) + */ + UInt32 MAX_LIT=(1 << 5); + UInt32 MAX_OFF=(1 << 13); + UInt32 MAX_REF=((1 << 8) + (1 << 3)); + + UInt32 FRST(byte[] Array,UInt32 ptr) + { + return (UInt32)(((Array[ptr]) << 8) | Array[ptr+1]); + } + + UInt32 NEXT(UInt32 v,byte[] Array,UInt32 ptr) + { + return ((v) << 8) | Array[ptr+2]; + } + + UInt32 IDX(UInt32 h) + { + return ((((h ^ (h << 5)) >> (int) (3*8 - HLOG)) - h*5) & (HSIZE - 1)); + } + + /* + * compressed format + * + * 000LLLLL <L+1> ; literal + * LLLOOOOO oooooooo ; backref L + * 111OOOOO LLLLLLLL oooooooo ; backref L+7 + * + */ + + public int lzf_compress (byte[] in_data, int in_len,byte[] out_data, int out_len) + { + int c; + long []htab=new long[1<<14]; + for (c=0;c<1<<14;c++) + { + htab[c]=0; + } + + long hslot; + UInt32 iidx = 0; + UInt32 oidx = 0; + //byte *in_end = ip + in_len; + //byte *out_end = op + out_len; + long reference; + + UInt32 hval = FRST (in_data,iidx); + long off; + int lit = 0; + + for (;;) + { + if (iidx < in_len - 2) + { + hval = NEXT (hval, in_data,iidx); + hslot = IDX (hval); + reference = htab[hslot]; + htab[hslot] = (long)iidx; + + if ((off = iidx - reference - 1) < MAX_OFF + && iidx + 4 < in_len + && reference > 0 + && in_data[reference+0] == in_data[iidx+0] + && in_data[reference+1] == in_data[iidx+1] + && in_data[reference+2] == in_data[iidx+2] + ) + { + /* match found at *reference++ */ + UInt32 len = 2; + UInt32 maxlen = (UInt32)in_len - iidx - len; + maxlen = maxlen > MAX_REF ? MAX_REF : maxlen; + + if (oidx + lit + 1 + 3 >= out_len) + return 0; + + do + len++; + while (len < maxlen && in_data[reference+len] == in_data[iidx+len]); + + if (lit!=0) + { + out_data[oidx++] = (byte)(lit - 1); + lit = -lit; + do + out_data[oidx++] = in_data[iidx+lit]; + while ((++lit)!=0); + } + + len -= 2; + iidx++; + + if (len < 7) + { + out_data[oidx++] = (byte)((off >> 8) + (len << 5)); + } + else + { + out_data[oidx++] = (byte)((off >> 8) + ( 7 << 5)); + out_data[oidx++] = (byte)(len - 7); + } + + out_data[oidx++] = (byte)off; + + iidx += len-1; + hval = FRST (in_data,iidx); + + hval = NEXT (hval,in_data, iidx); + htab[IDX (hval)] = iidx; + iidx++; + + hval = NEXT (hval, in_data,iidx); + htab[IDX (hval)] = iidx; + iidx++; + continue; + } + } + else if (iidx == in_len) + break; + + /* one more literal byte we must copy */ + lit++; + iidx++; + + if (lit == MAX_LIT) + { + if (oidx + 1 + MAX_LIT >= out_len) + return 0; + + out_data[oidx++] = (byte)(MAX_LIT - 1); + lit = -lit; + do + out_data[oidx++] = in_data[iidx+lit]; + while ((++lit)!=0); + } + } + + if (lit!=0) + { + if (oidx + lit + 1 >= out_len) + return 0; + + out_data[oidx++] = (byte)(lit - 1); + lit = -lit; + do + out_data[oidx++] = in_data[iidx+lit]; + while ((++lit)!=0); + } + + return (int)oidx; + } + + /// <summary> + /// LZF Decompressor + /// </summary> + public int lzf_decompress ( byte[] in_data, int in_len, byte[] out_data, int out_len) + { + UInt32 iidx=0; + UInt32 oidx=0; + + do + { + UInt32 ctrl = in_data[iidx++]; + + if (ctrl < (1 << 5)) /* literal run */ + { + ctrl++; + + if (oidx + ctrl > out_len) + { + //SET_ERRNO (E2BIG); + return 0; + } + + do + out_data[oidx++] = in_data[iidx++]; + while ((--ctrl)!=0); + } + else /* back reference */ + { + UInt32 len = ctrl >> 5; + + int reference = (int)(oidx - ((ctrl & 0x1f) << 8) - 1); + + if (len == 7) + len += in_data[iidx++]; + + reference -= in_data[iidx++]; + + if (oidx + len + 2 > out_len) + { + //SET_ERRNO (E2BIG); + return 0; + } + + if (reference < 0) + { + //SET_ERRNO (EINVAL); + return 0; + } + + out_data[oidx++]=out_data[reference++]; + out_data[oidx++]=out_data[reference++]; + + do + out_data[oidx++]=out_data[reference++]; + while ((--len)!=0); + } + } + while (iidx < in_len); + + return (int)oidx; + } + + public CLZF() + { + // + // TODO: Add ructor logic here + // + } + } +} + diff --git a/SerialICE/lzf/liblzf-3.6/cs/README b/SerialICE/lzf/liblzf-3.6/cs/README new file mode 100644 index 0000000..9964aff --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/cs/README @@ -0,0 +1,7 @@ +The C♯ implementation of the LZF en-/decoder functions in this +directory was written (and is maintained) by + + Oren J. Maurice <oymaurice(a)hazorea.org.il>. + +If you have any questions or improvements, you should contact the +original author (and maybe CC me, Marc Lehmann <liblzf(a)schmorp.de>). diff --git a/SerialICE/lzf/liblzf-3.6/install-sh b/SerialICE/lzf/liblzf-3.6/install-sh new file mode 100644 index 0000000..e9de238 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/SerialICE/lzf/liblzf-3.6/lzf.c b/SerialICE/lzf/liblzf-3.6/lzf.c new file mode 100644 index 0000000..bedfdb6 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/lzf.c @@ -0,0 +1,537 @@ +/* + * Copyright (c) 2006 Stefan Traby <stefan(a)hello-penguin.com> + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, 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 OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#include "config.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#include <limits.h> +#include "lzf.h" + +#ifdef HAVE_GETOPT_H +# include <getopt.h> +#endif + +#define BLOCKSIZE (1024 * 64 - 1) +#define MAX_BLOCKSIZE BLOCKSIZE + +typedef unsigned char u8; + +static off_t nr_read, nr_written; + +static const char *imagename; +static enum { compress, uncompress, lzcat } mode = compress; +static int verbose = 0; +static int force = 0; +static long blocksize = BLOCKSIZE; + +#ifdef HAVE_GETOPT_LONG + + struct option longopts[] = { + {"compress", 0, 0, 'c'}, + {"decompress", 0, 0, 'd'}, + {"uncompress", 0, 0, 'd'}, + {"force", 0, 0, 'f'}, + {"help", 0, 0, 'h'}, + {"verbose", 0, 0, 'v'}, + {"blocksize", 1, 0, 'b'}, + {0, 0, 0, 0} + }; + + static const char *opt = + "-c --compress compress\n" + "-d --decompress decompress\n" + "-f --force force overwrite of output file\n" + "-h --help give this help\n" "-v --verbose verbose mode\n" "-b # --blocksize # set blocksize\n" "\n"; + +#else + + static const char *opt = + "-c compress\n" + "-d decompress\n" + "-f force overwrite of output file\n" + "-h give this help\n" + "-v verbose mode\n" + "-b # set blocksize\n" + "\n"; + +#endif + +static void +usage (int rc) +{ + fprintf (stderr, "\n" + "lzf, a very lightweight compression/decompression utility written by Stefan Traby.\n" + "uses liblzf written by Marc Lehmann <schmorp(a)schmorp.de> You can find more info at\n" + "
http://liblzf.plan9.de/\n
" + "\n" + "usage: lzf [-dufhvb] [file ...]\n" + " unlzf [file ...]\n" + " lzcat [file ...]\n" + "\n%s", + opt); + + exit (rc); +} + +static inline ssize_t +rread (int fd, void *buf, size_t len) +{ + ssize_t rc = 0, offset = 0; + char *p = buf; + + while (len && (rc = read (fd, &p[offset], len)) > 0) + { + offset += rc; + len -= rc; + } + + nr_read += offset; + + if (rc < 0) + return rc; + + return offset; +} + +/* returns 0 if all written else -1 */ +static inline ssize_t +wwrite (int fd, void *buf, size_t len) +{ + ssize_t rc; + char *b = buf; + size_t l = len; + + while (l) + { + rc = write (fd, b, l); + if (rc < 0) + { + fprintf (stderr, "%s: write error: ", imagename); + perror (""); + return -1; + } + + l -= rc; + b += rc; + } + + nr_written += len; + return 0; +} + +/* + * Anatomy: an lzf file consists of any number of blocks in the following format: + * + * \x00 EOF (optional) + * "ZV\0" 2-byte-usize <uncompressed data> + * "ZV\1" 2-byte-csize 2-byte-usize <compressed data> + * "ZV\2" 4-byte-crc32-0xdebb20e3 (NYI) + */ + + +#define TYPE0_HDR_SIZE 5 +#define TYPE1_HDR_SIZE 7 +#define MAX_HDR_SIZE 7 +#define MIN_HDR_SIZE 5 + +static int +compress_fd (int from, int to) +{ + ssize_t us, cs, len; + u8 buf1[MAX_BLOCKSIZE + MAX_HDR_SIZE + 16]; + u8 buf2[MAX_BLOCKSIZE + MAX_HDR_SIZE + 16]; + u8 *header; + + nr_read = nr_written = 0; + while ((us = rread (from, &buf1[MAX_HDR_SIZE], blocksize)) > 0) + { + cs = lzf_compress (&buf1[MAX_HDR_SIZE], us, &buf2[MAX_HDR_SIZE], us > 4 ? us - 4 : us); + if (cs) + { + header = &buf2[MAX_HDR_SIZE - TYPE1_HDR_SIZE]; + header[0] = 'Z'; + header[1] = 'V'; + header[2] = 1; + header[3] = cs >> 8; + header[4] = cs & 0xff; + header[5] = us >> 8; + header[6] = us & 0xff; + len = cs + TYPE1_HDR_SIZE; + } + else + { // write uncompressed + header = &buf1[MAX_HDR_SIZE - TYPE0_HDR_SIZE]; + header[0] = 'Z'; + header[1] = 'V'; + header[2] = 0; + header[3] = us >> 8; + header[4] = us & 0xff; + len = us + TYPE0_HDR_SIZE; + } + + if (wwrite (to, header, len) == -1) + return -1; + } + + return 0; +} + +static int +uncompress_fd (int from, int to) +{ + u8 header[MAX_HDR_SIZE]; + u8 buf1[MAX_BLOCKSIZE + MAX_HDR_SIZE + 16]; + u8 buf2[MAX_BLOCKSIZE + MAX_HDR_SIZE + 16]; + u8 *p; + int l, rd; + ssize_t rc, cs, us, bytes, over = 0; + + nr_read = nr_written = 0; + while (1) + { + rc = rread (from, header + over, MAX_HDR_SIZE - over); + if (rc < 0) + { + fprintf (stderr, "%s: read error: ", imagename); + perror (""); + return -1; + } + + rc += over; + over = 0; + if (!rc || header[0] == 0) + return 0; + + if (rc < MIN_HDR_SIZE || header[0] != 'Z' || header[1] != 'V') + { + fprintf (stderr, "%s: invalid data stream - magic not found or short header\n", imagename); + return -1; + } + + switch (header[2]) + { + case 0: + cs = -1; + us = (header[3] << 8) | header[4]; + p = &header[TYPE0_HDR_SIZE]; + break; + case 1: + if (rc < TYPE1_HDR_SIZE) + { + goto short_read; + } + cs = (header[3] << 8) | header[4]; + us = (header[5] << 8) | header[6]; + p = &header[TYPE1_HDR_SIZE]; + break; + default: + fprintf (stderr, "%s: unknown blocktype\n", imagename); + return -1; + } + + bytes = cs == -1 ? us : cs; + l = &header[rc] - p; + + if (l > 0) + memcpy (buf1, p, l); + + if (l > bytes) + { + over = l - bytes; + memmove (header, &p[bytes], over); + } + + p = &buf1[l]; + rd = bytes - l; + if (rd > 0) + if ((rc = rread (from, p, rd)) != rd) + goto short_read; + + if (cs == -1) + { + if (wwrite (to, buf1, us)) + return -1; + } + else + { + if (lzf_decompress (buf1, cs, buf2, us) != us) + { + fprintf (stderr, "%s: decompress: invalid stream - data corrupted\n", imagename); + return -1; + } + + if (wwrite (to, buf2, us)) + return -1; + } + } + + return 0; + +short_read: + fprintf (stderr, "%s: short data\n", imagename); + return -1; +} + +static int +open_out (const char *name) +{ + int fd; + int m = O_EXCL; + + if (force) + m = 0; + + fd = open (name, O_CREAT | O_WRONLY | O_TRUNC | m, 600); +#if defined(__MINGW32__) + _setmode(fd, _O_BINARY); +#endif + return fd; +} + +static int +compose_name (const char *fname, char *oname) +{ + char *p; + + if (mode == compress) + { + if (strlen (fname) > PATH_MAX - 4) + { + fprintf (stderr, "%s: %s.lzf: name too long", imagename, fname); + return -1; + } + + strcpy (oname, fname); + strcat (oname, ".lzf"); + } + else + { + if (strlen (fname) > PATH_MAX) + { + fprintf (stderr, "%s: %s: name too long\n", imagename, fname); + return -1; + } + + strcpy (oname, fname); + p = &oname[strlen (oname)] - 4; + if (p < oname || strcmp (p, ".lzf")) + { + fprintf (stderr, "%s: %s: unknown suffix\n", imagename, fname); + return -1; + } + + *p = 0; + } + + return 0; +} + +static int +run_file (const char *fname) +{ + int fd, fd2; + int rc; + struct stat mystat; + char oname[PATH_MAX + 1]; + + if (mode != lzcat) + if (compose_name (fname, oname)) + return -1; + +#if !defined(__MINGW32__) + rc = lstat (fname, &mystat); +#else + rc = stat (fname, &mystat); +#endif + fd = open (fname, O_RDONLY); +#if defined(__MINGW32__) + _setmode(fd, _O_BINARY); +#endif + if (rc || fd == -1) + { + fprintf (stderr, "%s: %s: ", imagename, fname); + perror (""); + return -1; + } + + if (!S_ISREG (mystat.st_mode)) + { + fprintf (stderr, "%s: %s: not a regular file.\n", imagename, fname); + close (fd); + return -1; + } + + if (mode == lzcat) + { + rc = uncompress_fd (fd, 1); + close (fd); + return rc; + } + + fd2 = open_out (oname); + if (fd2 == -1) + { + fprintf (stderr, "%s: %s: ", imagename, oname); + perror (""); + close (fd); + return -1; + } + + if (mode == compress) + { + rc = compress_fd (fd, fd2); + if (!rc && verbose) + fprintf (stderr, "%s: %5.1f%% -- replaced with %s\n", + fname, nr_read == 0 ? 0 : 100.0 - nr_written / ((double) nr_read / 100.0), oname); + } + else + { + rc = uncompress_fd (fd, fd2); + if (!rc && verbose) + fprintf (stderr, "%s: %5.1f%% -- replaced with %s\n", + fname, nr_written == 0 ? 0 : 100.0 - nr_read / ((double) nr_written / 100.0), oname); + } + +#if !defined(__MINGW32__) + fchmod (fd2, mystat.st_mode); +#else + chmod (oname, mystat.st_mode); +#endif + close (fd); + close (fd2); + + if (!rc) + unlink (fname); + + return rc; +} + +int +main (int argc, char *argv[]) +{ + char *p = argv[0]; + int optc; + int rc = 0; + + errno = 0; + p = getenv ("LZF_BLOCKSIZE"); + if (p) + { + blocksize = strtoul (p, 0, 0); + if (errno || !blocksize || blocksize > MAX_BLOCKSIZE) + blocksize = BLOCKSIZE; + } + + p = strrchr (argv[0], '/'); + imagename = p ? ++p : argv[0]; + + if (!strncmp (imagename, "un", 2) || !strncmp (imagename, "de", 2)) + mode = uncompress; + + if (strstr (imagename, "cat")) + mode = lzcat; + +#ifdef HAVE_GETOPT_LONG + while ((optc = getopt_long (argc, argv, "cdfhvb:", longopts, 0)) != -1) +#else + while ((optc = getopt (argc, argv, "cdfhvb:")) != -1) +#endif + { + switch (optc) + { + case 'c': + mode = compress; + break; + case 'd': + mode = uncompress; + break; + case 'f': + force = 1; + break; + case 'h': + usage (0); + break; + case 'v': + verbose = 1; + break; + case 'b': + errno = 0; + blocksize = strtoul (optarg, 0, 0); + if (errno || !blocksize || blocksize > MAX_BLOCKSIZE) + blocksize = BLOCKSIZE; + break; + default: + usage (1); + break; + } + } + + if (optind == argc) + { // stdin stdout + if (!force) + { + if ((mode == uncompress || mode == lzcat) && isatty (0)) + { + fprintf (stderr, "%s: compressed data not read from a terminal. Use -f to force decompression.\n", imagename); + exit (1); + } + if (mode == compress && isatty (1)) + { + fprintf (stderr, "%s: compressed data not written to a terminal. Use -f to force compression.\n", imagename); + exit (1); + } + } + + if (mode == compress) + rc = compress_fd (0, 1); + else + rc = uncompress_fd (0, 1); + + exit (rc ? 1 : 0); + } + + while (optind < argc) + rc |= run_file (argv[optind++]); + + exit (rc ? 1 : 0); +} + diff --git a/SerialICE/lzf/liblzf-3.6/lzf.h b/SerialICE/lzf/liblzf-3.6/lzf.h new file mode 100644 index 0000000..919b6e6 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/lzf.h @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2000-2008 Marc Alexander Lehmann <schmorp(a)schmorp.de> + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, 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 OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#ifndef LZF_H +#define LZF_H + +/*********************************************************************** +** +** lzf -- an extremely fast/free compression/decompression-method +**
http://liblzf.plan9.de/
+** +** This algorithm is believed to be patent-free. +** +***********************************************************************/ + +#define LZF_VERSION 0x0105 /* 1.5, API version */ + +/* + * Compress in_len bytes stored at the memory block starting at + * in_data and write the result to out_data, up to a maximum length + * of out_len bytes. + * + * If the output buffer is not large enough or any error occurs return 0, + * otherwise return the number of bytes used, which might be considerably + * more than in_len (but less than 104% of the original size), so it + * makes sense to always use out_len == in_len - 1), to ensure _some_ + * compression, and store the data uncompressed otherwise (with a flag, of + * course. + * + * lzf_compress might use different algorithms on different systems and + * even different runs, thus might result in different compressed strings + * depending on the phase of the moon or similar factors. However, all + * these strings are architecture-independent and will result in the + * original data when decompressed using lzf_decompress. + * + * The buffers must not be overlapping. + * + * If the option LZF_STATE_ARG is enabled, an extra argument must be + * supplied which is not reflected in this header file. Refer to lzfP.h + * and lzf_c.c. + * + */ +unsigned int +lzf_compress (const void *const in_data, unsigned int in_len, + void *out_data, unsigned int out_len); + +/* + * Decompress data compressed with some version of the lzf_compress + * function and stored at location in_data and length in_len. The result + * will be stored at out_data up to a maximum of out_len characters. + * + * If the output buffer is not large enough to hold the decompressed + * data, a 0 is returned and errno is set to E2BIG. Otherwise the number + * of decompressed bytes (i.e. the original length of the data) is + * returned. + * + * If an error in the compressed data is detected, a zero is returned and + * errno is set to EINVAL. + * + * This function is very fast, about as fast as a copying loop. + */ +unsigned int +lzf_decompress (const void *const in_data, unsigned int in_len, + void *out_data, unsigned int out_len); + +#endif + diff --git a/SerialICE/lzf/liblzf-3.6/lzfP.h b/SerialICE/lzf/liblzf-3.6/lzfP.h new file mode 100644 index 0000000..7b7feda --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/lzfP.h @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2000-2007 Marc Alexander Lehmann <schmorp(a)schmorp.de> + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, 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 OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#ifndef LZFP_h +#define LZFP_h + +#define STANDALONE 1 /* at the moment, this is ok. */ + +#ifndef STANDALONE +# include "lzf.h" +#endif + +/* + * Size of hashtable is (1 << HLOG) * sizeof (char *) + * decompression is independent of the hash table size + * the difference between 15 and 14 is very small + * for small blocks (and 14 is usually a bit faster). + * For a low-memory/faster configuration, use HLOG == 13; + * For best compression, use 15 or 16 (or more, up to 22). + */ +#ifndef HLOG +# define HLOG 16 +#endif + +/* + * Sacrifice very little compression quality in favour of compression speed. + * This gives almost the same compression as the default code, and is + * (very roughly) 15% faster. This is the preferred mode of operation. + */ +#ifndef VERY_FAST +# define VERY_FAST 1 +#endif + +/* + * Sacrifice some more compression quality in favour of compression speed. + * (roughly 1-2% worse compression for large blocks and + * 9-10% for small, redundant, blocks and >>20% better speed in both cases) + * In short: when in need for speed, enable this for binary data, + * possibly disable this for text data. + */ +#ifndef ULTRA_FAST +# define ULTRA_FAST 0 +#endif + +/* + * Unconditionally aligning does not cost very much, so do it if unsure + */ +#ifndef STRICT_ALIGN +# define STRICT_ALIGN !(defined(__i386) || defined (__amd64)) +#endif + +/* + * You may choose to pre-set the hash table (might be faster on some + * modern cpus and large (>>64k) blocks, and also makes compression + * deterministic/repeatable when the configuration otherwise is the same). + */ +#ifndef INIT_HTAB +# define INIT_HTAB 0 +#endif + +/* + * Avoid assigning values to errno variable? for some embedding purposes + * (linux kernel for example), this is necessary. NOTE: this breaks + * the documentation in lzf.h. Avoiding errno has no speed impact. + */ +#ifndef AVOID_ERRNO +# define AVOID_ERRNO 0 +#endif + +/* + * Whether to pass the LZF_STATE variable as argument, or allocate it + * on the stack. For small-stack environments, define this to 1. + * NOTE: this breaks the prototype in lzf.h. + */ +#ifndef LZF_STATE_ARG +# define LZF_STATE_ARG 0 +#endif + +/* + * Whether to add extra checks for input validity in lzf_decompress + * and return EINVAL if the input stream has been corrupted. This + * only shields against overflowing the input buffer and will not + * detect most corrupted streams. + * This check is not normally noticeable on modern hardware + * (<1% slowdown), but might slow down older cpus considerably. + */ +#ifndef CHECK_INPUT +# define CHECK_INPUT 1 +#endif + +/* + * Whether to store pointers or offsets inside the hash table. On + * 64 bit architetcures, pointers take up twice as much space, + * and might also be slower. Default is to autodetect. + */ +/*#define LZF_USER_OFFSETS autodetect */ + +/*****************************************************************************/ +/* nothing should be changed below */ + +#ifdef __cplusplus +# include <cstring> +# include <climits> +using namespace std; +#else +# include <string.h> +# include <limits.h> +#endif + +#ifndef LZF_USE_OFFSETS +# if defined (WIN32) +# define LZF_USE_OFFSETS defined(_M_X64) +# else +# if __cplusplus > 199711L +# include <cstdint> +# else +# include <stdint.h> +# endif +# define LZF_USE_OFFSETS (UINTPTR_MAX > 0xffffffffU) +# endif +#endif + +typedef unsigned char u8; + +#if LZF_USE_OFFSETS +# define LZF_HSLOT_BIAS ((const u8 *)in_data) + typedef unsigned int LZF_HSLOT; +#else +# define LZF_HSLOT_BIAS 0 + typedef const u8 *LZF_HSLOT; +#endif + +typedef LZF_HSLOT LZF_STATE[1 << (HLOG)]; + +#if !STRICT_ALIGN +/* for unaligned accesses we need a 16 bit datatype. */ +# if USHRT_MAX == 65535 + typedef unsigned short u16; +# elif UINT_MAX == 65535 + typedef unsigned int u16; +# else +# undef STRICT_ALIGN +# define STRICT_ALIGN 1 +# endif +#endif + +#if ULTRA_FAST +# undef VERY_FAST +#endif + +#endif + diff --git a/SerialICE/lzf/liblzf-3.6/lzf_c.c b/SerialICE/lzf/liblzf-3.6/lzf_c.c new file mode 100644 index 0000000..bc07084 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/lzf_c.c @@ -0,0 +1,291 @@ +/* + * Copyright (c) 2000-2010 Marc Alexander Lehmann <schmorp(a)schmorp.de> + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, 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 OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#include "lzfP.h" + +#define HSIZE (1 << (HLOG)) + +/* + * don't play with this unless you benchmark! + * the data format is not dependent on the hash function. + * the hash function might seem strange, just believe me, + * it works ;) + */ +#ifndef FRST +# define FRST(p) (((p[0]) << 8) | p[1]) +# define NEXT(v,p) (((v) << 8) | p[2]) +# if ULTRA_FAST +# define IDX(h) ((( h >> (3*8 - HLOG)) - h ) & (HSIZE - 1)) +# elif VERY_FAST +# define IDX(h) ((( h >> (3*8 - HLOG)) - h*5) & (HSIZE - 1)) +# else +# define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) - h*5) & (HSIZE - 1)) +# endif +#endif +/* + * IDX works because it is very similar to a multiplicative hash, e.g. + * ((h * 57321 >> (3*8 - HLOG)) & (HSIZE - 1)) + * the latter is also quite fast on newer CPUs, and compresses similarly. + * + * the next one is also quite good, albeit slow ;) + * (int)(cos(h & 0xffffff) * 1e6) + */ + +#if 0 +/* original lzv-like hash function, much worse and thus slower */ +# define FRST(p) (p[0] << 5) ^ p[1] +# define NEXT(v,p) ((v) << 5) ^ p[2] +# define IDX(h) ((h) & (HSIZE - 1)) +#endif + +#define MAX_LIT (1 << 5) +#define MAX_OFF (1 << 13) +#define MAX_REF ((1 << 8) + (1 << 3)) + +#if __GNUC__ >= 3 +# define expect(expr,value) __builtin_expect ((expr),(value)) +# define inline inline +#else +# define expect(expr,value) (expr) +# define inline static +#endif + +#define expect_false(expr) expect ((expr) != 0, 0) +#define expect_true(expr) expect ((expr) != 0, 1) + +/* + * compressed format + * + * 000LLLLL <L+1> ; literal, L+1=1..33 octets + * LLLooooo oooooooo ; backref L+1=1..7 octets, o+1=1..4096 offset + * 111ooooo LLLLLLLL oooooooo ; backref L+8 octets, o+1=1..4096 offset + * + */ + +unsigned int +lzf_compress (const void *const in_data, unsigned int in_len, + void *out_data, unsigned int out_len +#if LZF_STATE_ARG + , LZF_STATE htab +#endif + ) +{ +#if !LZF_STATE_ARG + LZF_STATE htab; +#endif + const u8 *ip = (const u8 *)in_data; + u8 *op = (u8 *)out_data; + const u8 *in_end = ip + in_len; + u8 *out_end = op + out_len; + const u8 *ref; + + /* off requires a type wide enough to hold a general pointer difference. + * ISO C doesn't have that (size_t might not be enough and ptrdiff_t only + * works for differences within a single object). We also assume that no + * no bit pattern traps. Since the only platform that is both non-POSIX + * and fails to support both assumptions is windows 64 bit, we make a + * special workaround for it. + */ +#if defined (WIN32) && defined (_M_X64) + unsigned _int64 off; /* workaround for missing POSIX compliance */ +#else + unsigned long off; +#endif + unsigned int hval; + int lit; + + if (!in_len || !out_len) + return 0; + +#if INIT_HTAB + memset (htab, 0, sizeof (htab)); +#endif + + lit = 0; op++; /* start run */ + + hval = FRST (ip); + while (ip < in_end - 2) + { + LZF_HSLOT *hslot; + + hval = NEXT (hval, ip); + hslot = htab + IDX (hval); + ref = *hslot + LZF_HSLOT_BIAS; *hslot = ip - LZF_HSLOT_BIAS; + + if (1 +#if INIT_HTAB + && ref < ip /* the next test will actually take care of this, but this is faster */ +#endif + && (off = ip - ref - 1) < MAX_OFF + && ref > (u8 *)in_data + && ref[2] == ip[2] +#if STRICT_ALIGN + && ((ref[1] << 8) | ref[0]) == ((ip[1] << 8) | ip[0]) +#else + && *(u16 *)ref == *(u16 *)ip +#endif + ) + { + /* match found at *ref++ */ + unsigned int len = 2; + unsigned int maxlen = in_end - ip - len; + maxlen = maxlen > MAX_REF ? MAX_REF : maxlen; + + if (expect_false (op + 3 + 1 >= out_end)) /* first a faster conservative test */ + if (op - !lit + 3 + 1 >= out_end) /* second the exact but rare test */ + return 0; + + op [- lit - 1] = lit - 1; /* stop run */ + op -= !lit; /* undo run if length is zero */ + + for (;;) + { + if (expect_true (maxlen > 16)) + { + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + } + + do + len++; + while (len < maxlen && ref[len] == ip[len]); + + break; + } + + len -= 2; /* len is now #octets - 1 */ + ip++; + + if (len < 7) + { + *op++ = (off >> 8) + (len << 5); + } + else + { + *op++ = (off >> 8) + ( 7 << 5); + *op++ = len - 7; + } + + *op++ = off; + + lit = 0; op++; /* start run */ + + ip += len + 1; + + if (expect_false (ip >= in_end - 2)) + break; + +#if ULTRA_FAST || VERY_FAST + --ip; +# if VERY_FAST && !ULTRA_FAST + --ip; +# endif + hval = FRST (ip); + + hval = NEXT (hval, ip); + htab[IDX (hval)] = ip - LZF_HSLOT_BIAS; + ip++; + +# if VERY_FAST && !ULTRA_FAST + hval = NEXT (hval, ip); + htab[IDX (hval)] = ip - LZF_HSLOT_BIAS; + ip++; +# endif +#else + ip -= len + 1; + + do + { + hval = NEXT (hval, ip); + htab[IDX (hval)] = ip - LZF_HSLOT_BIAS; + ip++; + } + while (len--); +#endif + } + else + { + /* one more literal byte we must copy */ + if (expect_false (op >= out_end)) + return 0; + + lit++; *op++ = *ip++; + + if (expect_false (lit == MAX_LIT)) + { + op [- lit - 1] = lit - 1; /* stop run */ + lit = 0; op++; /* start run */ + } + } + } + + if (op + 3 > out_end) /* at most 3 bytes can be missing here */ + return 0; + + while (ip < in_end) + { + lit++; *op++ = *ip++; + + if (expect_false (lit == MAX_LIT)) + { + op [- lit - 1] = lit - 1; /* stop run */ + lit = 0; op++; /* start run */ + } + } + + op [- lit - 1] = lit - 1; /* end run */ + op -= !lit; /* undo run if length is zero */ + + return op - (u8 *)out_data; +} + diff --git a/SerialICE/lzf/liblzf-3.6/lzf_d.c b/SerialICE/lzf/liblzf-3.6/lzf_d.c new file mode 100644 index 0000000..8433b8f --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/lzf_d.c @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2000-2010 Marc Alexander Lehmann <schmorp(a)schmorp.de> + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, 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 OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#include "lzfP.h" + +#if AVOID_ERRNO +# define SET_ERRNO(n) +#else +# include <errno.h> +# define SET_ERRNO(n) errno = (n) +#endif + +#if USE_REP_MOVSB /* small win on amd, big loss on intel */ +#if (__i386 || __amd64) && __GNUC__ >= 3 +# define lzf_movsb(dst, src, len) \ + asm ("rep movsb" \ + : "=D" (dst), "=S" (src), "=c" (len) \ + : "0" (dst), "1" (src), "2" (len)); +#endif +#endif + +unsigned int +lzf_decompress (const void *const in_data, unsigned int in_len, + void *out_data, unsigned int out_len) +{ + u8 const *ip = (const u8 *)in_data; + u8 *op = (u8 *)out_data; + u8 const *const in_end = ip + in_len; + u8 *const out_end = op + out_len; + + do + { + unsigned int ctrl = *ip++; + + if (ctrl < (1 << 5)) /* literal run */ + { + ctrl++; + + if (op + ctrl > out_end) + { + SET_ERRNO (E2BIG); + return 0; + } + +#if CHECK_INPUT + if (ip + ctrl > in_end) + { + SET_ERRNO (EINVAL); + return 0; + } +#endif + +#ifdef lzf_movsb + lzf_movsb (op, ip, ctrl); +#else + switch (ctrl) + { + case 32: *op++ = *ip++; case 31: *op++ = *ip++; case 30: *op++ = *ip++; case 29: *op++ = *ip++; + case 28: *op++ = *ip++; case 27: *op++ = *ip++; case 26: *op++ = *ip++; case 25: *op++ = *ip++; + case 24: *op++ = *ip++; case 23: *op++ = *ip++; case 22: *op++ = *ip++; case 21: *op++ = *ip++; + case 20: *op++ = *ip++; case 19: *op++ = *ip++; case 18: *op++ = *ip++; case 17: *op++ = *ip++; + case 16: *op++ = *ip++; case 15: *op++ = *ip++; case 14: *op++ = *ip++; case 13: *op++ = *ip++; + case 12: *op++ = *ip++; case 11: *op++ = *ip++; case 10: *op++ = *ip++; case 9: *op++ = *ip++; + case 8: *op++ = *ip++; case 7: *op++ = *ip++; case 6: *op++ = *ip++; case 5: *op++ = *ip++; + case 4: *op++ = *ip++; case 3: *op++ = *ip++; case 2: *op++ = *ip++; case 1: *op++ = *ip++; + } +#endif + } + else /* back reference */ + { + unsigned int len = ctrl >> 5; + + u8 *ref = op - ((ctrl & 0x1f) << 8) - 1; + +#if CHECK_INPUT + if (ip >= in_end) + { + SET_ERRNO (EINVAL); + return 0; + } +#endif + if (len == 7) + { + len += *ip++; +#if CHECK_INPUT + if (ip >= in_end) + { + SET_ERRNO (EINVAL); + return 0; + } +#endif + } + + ref -= *ip++; + + if (op + len + 2 > out_end) + { + SET_ERRNO (E2BIG); + return 0; + } + + if (ref < (u8 *)out_data) + { + SET_ERRNO (EINVAL); + return 0; + } + +#ifdef lzf_movsb + len += 2; + lzf_movsb (op, ref, len); +#else + switch (len) + { + default: + len += 2; + + if (op >= ref + len) + { + /* disjunct areas */ + memcpy (op, ref, len); + op += len; + } + else + { + /* overlapping, use octte by octte copying */ + do + *op++ = *ref++; + while (--len); + } + + break; + + case 9: *op++ = *ref++; + case 8: *op++ = *ref++; + case 7: *op++ = *ref++; + case 6: *op++ = *ref++; + case 5: *op++ = *ref++; + case 4: *op++ = *ref++; + case 3: *op++ = *ref++; + case 2: *op++ = *ref++; + case 1: *op++ = *ref++; + case 0: *op++ = *ref++; /* two octets more */ + *op++ = *ref++; + } +#endif + } + } + while (ip < in_end); + + return op - (u8 *)out_data; +} + diff --git a/SerialICE/lzf/liblzf-3.6/romdecompress.c b/SerialICE/lzf/liblzf-3.6/romdecompress.c new file mode 100644 index 0000000..1f76cf2 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/romdecompress.c @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2006 Stefan Traby <stefan(a)hello-penguin.com> + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, 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 OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#define _LARGEFILE64_SOURCE +#include "config.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#include <limits.h> +#include "lzf.h" + +#ifdef HAVE_GETOPT_H +# include <getopt.h> +#endif + +#define OVERLAP 64 +#define MAXBLOCK (512*1024) + +char buffer[MAXBLOCK]; + + +int findsyncCOMP(char *buffer, int size) +{ + char *ptr=buffer; + char *end=buffer+size-4; + while (ptr<end) + { + if (memcmp(ptr,"COMP",4)==0) + { + fprintf(stderr,"COMP FOUND\n"); + return ptr-buffer; + } + ptr++; + }; + return -1; +}; + +int findsyncSTRT(char *buffer, int size) +{ + char *ptr=buffer; + char *end=buffer+size-4; + while (ptr<end) + { + if (memcmp(ptr,"STRT",4)==0) + { + fprintf(stderr,"STRT FOUND\n"); + return ptr-buffer; + } + ptr++; + }; + return -1; +}; + +#define ONEGIG (1024LL*1024LL*1024LL) + + +int decodeblockCOMP(char *buffer,int bufsize) +{ + int paged_gigabyte; + unsigned int intaddr; + off64_t addr; + int size; + int csize; + int csum; + if (memcmp(buffer,"COMP",4)!=0) + { + fprintf(stderr,"Decoding error EXPECTED COMP\n"); + return -1; + }; + + int cnt = sscanf(buffer+4,"%02x%08x%08x%08x%08x",&paged_gigabyte,&intaddr,&size,&csize,&csum); + if (cnt != 5) + { + fprintf(stderr,"Decoding error expected addresses\n"); + return 4; + }; + + addr=intaddr; + if (addr>=ONEGIG && addr<(2*ONEGIG)) + { + addr-=ONEGIG; + addr+=(ONEGIG*paged_gigabyte); + }; + + fprintf(stderr,"%08llx %08x %08x %08x\n",addr,size,csize,csum); + { + unsigned char outbuffer[size+10]; + int outsize = lzf_decompress (buffer+(4+2+4*8),csize,outbuffer,size); + if (outsize!=size) + { + fprintf(stderr,"Decompression length error %08x!=%08x\n",size,outsize); + return 4; + }; + int off; + int check=0; + for(off=0;off<size;off++) + { + check+=outbuffer[off]; + }; + if (check!=csum) + { + fprintf(stderr,"Decompression checksum error %08x!=%08x\n",csum,check); + }; + lseek64(1,addr,SEEK_SET); + write(1,outbuffer,size); + }; + + return (4+2+4*8)+csize; +}; + +int decodeblockSTRT(char *buffer,int bufsize) +{ + int addr; //Terminating zero + int size; //Terminating zero + int csum; //Terminating zero + if (memcmp(buffer,"STRT",4)!=0) + { + fprintf(stderr,"Decoding error EXPECTED STRT\n"); + return -1; + }; + + int cnt = sscanf(buffer+4,"%08x",&addr); + if (cnt != 1) + { + fprintf(stderr,"Decoding error expected address\n"); + return 4; + }; + + size=65536; + csum=*(int *) (buffer+8+4+size); + + fprintf(stderr,"%08x %08x %08x\n",addr,size,csum); + { + int off; + int check=0; + for(off=0;off<size;off++) + { + check+=(unsigned char ) buffer[4+8+off]; + }; + if (check!=csum) + { + fprintf(stderr,"transport checksum error %08x!=%08x\n",csum,check); + return 4; + }; + lseek(1,addr,SEEK_SET); + write(1,buffer+4,size); + }; + + return (4+8+4+2+size); +}; + + +int +main (int argc, char *argv[]) +{ + enum { sync , nosync } state = nosync; + int offset=0; + int size=0; + int sizeread=0; + + while ((sizeread=read(0,buffer+size,MAXBLOCK-size)) || (size>OVERLAP)) + { + size+=sizeread; + if (state==nosync) { + if ((offset=findsyncCOMP(buffer,size))>=0) + state=sync; + else + offset=(size-OVERLAP) >=0 ? (size-OVERLAP) : 0; + size-=offset; + if (offset!=0) + memmove(buffer,buffer+offset,size); + } else { + if ((offset=decodeblockCOMP(buffer,size))<8) + { + state=nosync; + }; + size-=offset; + memmove(buffer,buffer+offset,size); + }; + + }; + + lseek(0,0,SEEK_SET); + while ((sizeread=read(0,buffer+size,MAXBLOCK-size)) || (size>OVERLAP)) + { + size+=sizeread; + if (state==nosync) { + if ((offset=findsyncSTRT(buffer,size))>=0) + state=sync; + else + offset=(size-OVERLAP) >=0 ? (size-OVERLAP) : 0; + size-=offset; + if (offset!=0) + memmove(buffer,buffer+offset,size); + } else { + if ((offset=decodeblockSTRT(buffer,size))<8) + { + state=nosync; + }; + size-=offset; + memmove(buffer,buffer+offset,size); + }; + sizeread=0; + + }; +} + diff --git a/SerialICE/lzf/romdecompress.c b/SerialICE/lzf/romdecompress.c new file mode 100644 index 0000000..1f76cf2 --- /dev/null +++ b/SerialICE/lzf/romdecompress.c @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2006 Stefan Traby <stefan(a)hello-penguin.com> + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, 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 OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#define _LARGEFILE64_SOURCE +#include "config.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#include <limits.h> +#include "lzf.h" + +#ifdef HAVE_GETOPT_H +# include <getopt.h> +#endif + +#define OVERLAP 64 +#define MAXBLOCK (512*1024) + +char buffer[MAXBLOCK]; + + +int findsyncCOMP(char *buffer, int size) +{ + char *ptr=buffer; + char *end=buffer+size-4; + while (ptr<end) + { + if (memcmp(ptr,"COMP",4)==0) + { + fprintf(stderr,"COMP FOUND\n"); + return ptr-buffer; + } + ptr++; + }; + return -1; +}; + +int findsyncSTRT(char *buffer, int size) +{ + char *ptr=buffer; + char *end=buffer+size-4; + while (ptr<end) + { + if (memcmp(ptr,"STRT",4)==0) + { + fprintf(stderr,"STRT FOUND\n"); + return ptr-buffer; + } + ptr++; + }; + return -1; +}; + +#define ONEGIG (1024LL*1024LL*1024LL) + + +int decodeblockCOMP(char *buffer,int bufsize) +{ + int paged_gigabyte; + unsigned int intaddr; + off64_t addr; + int size; + int csize; + int csum; + if (memcmp(buffer,"COMP",4)!=0) + { + fprintf(stderr,"Decoding error EXPECTED COMP\n"); + return -1; + }; + + int cnt = sscanf(buffer+4,"%02x%08x%08x%08x%08x",&paged_gigabyte,&intaddr,&size,&csize,&csum); + if (cnt != 5) + { + fprintf(stderr,"Decoding error expected addresses\n"); + return 4; + }; + + addr=intaddr; + if (addr>=ONEGIG && addr<(2*ONEGIG)) + { + addr-=ONEGIG; + addr+=(ONEGIG*paged_gigabyte); + }; + + fprintf(stderr,"%08llx %08x %08x %08x\n",addr,size,csize,csum); + { + unsigned char outbuffer[size+10]; + int outsize = lzf_decompress (buffer+(4+2+4*8),csize,outbuffer,size); + if (outsize!=size) + { + fprintf(stderr,"Decompression length error %08x!=%08x\n",size,outsize); + return 4; + }; + int off; + int check=0; + for(off=0;off<size;off++) + { + check+=outbuffer[off]; + }; + if (check!=csum) + { + fprintf(stderr,"Decompression checksum error %08x!=%08x\n",csum,check); + }; + lseek64(1,addr,SEEK_SET); + write(1,outbuffer,size); + }; + + return (4+2+4*8)+csize; +}; + +int decodeblockSTRT(char *buffer,int bufsize) +{ + int addr; //Terminating zero + int size; //Terminating zero + int csum; //Terminating zero + if (memcmp(buffer,"STRT",4)!=0) + { + fprintf(stderr,"Decoding error EXPECTED STRT\n"); + return -1; + }; + + int cnt = sscanf(buffer+4,"%08x",&addr); + if (cnt != 1) + { + fprintf(stderr,"Decoding error expected address\n"); + return 4; + }; + + size=65536; + csum=*(int *) (buffer+8+4+size); + + fprintf(stderr,"%08x %08x %08x\n",addr,size,csum); + { + int off; + int check=0; + for(off=0;off<size;off++) + { + check+=(unsigned char ) buffer[4+8+off]; + }; + if (check!=csum) + { + fprintf(stderr,"transport checksum error %08x!=%08x\n",csum,check); + return 4; + }; + lseek(1,addr,SEEK_SET); + write(1,buffer+4,size); + }; + + return (4+8+4+2+size); +}; + + +int +main (int argc, char *argv[]) +{ + enum { sync , nosync } state = nosync; + int offset=0; + int size=0; + int sizeread=0; + + while ((sizeread=read(0,buffer+size,MAXBLOCK-size)) || (size>OVERLAP)) + { + size+=sizeread; + if (state==nosync) { + if ((offset=findsyncCOMP(buffer,size))>=0) + state=sync; + else + offset=(size-OVERLAP) >=0 ? (size-OVERLAP) : 0; + size-=offset; + if (offset!=0) + memmove(buffer,buffer+offset,size); + } else { + if ((offset=decodeblockCOMP(buffer,size))<8) + { + state=nosync; + }; + size-=offset; + memmove(buffer,buffer+offset,size); + }; + + }; + + lseek(0,0,SEEK_SET); + while ((sizeread=read(0,buffer+size,MAXBLOCK-size)) || (size>OVERLAP)) + { + size+=sizeread; + if (state==nosync) { + if ((offset=findsyncSTRT(buffer,size))>=0) + state=sync; + else + offset=(size-OVERLAP) >=0 ? (size-OVERLAP) : 0; + size-=offset; + if (offset!=0) + memmove(buffer,buffer+offset,size); + } else { + if ((offset=decodeblockSTRT(buffer,size))<8) + { + state=nosync; + }; + size-=offset; + memmove(buffer,buffer+offset,size); + }; + sizeread=0; + + }; +} + diff --git a/SerialICE/mainboard/intel_3210_ich9.c b/SerialICE/mainboard/intel_3210_ich9.c new file mode 100644 index 0000000..a9f184c --- /dev/null +++ b/SerialICE/mainboard/intel_3210_ich9.c @@ -0,0 +1,161 @@ +/* + * SerialICE + * + * Copyright (C) 2009 coresystems GmbH + * Copyright (C) 2011 Netherlands Forensic Institute + * + * 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; version 2 of the License. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "ipmi.c" + +/* Hardware specific functions */ + +#define RCBA 0xfed1c000 +#define GCS 0x3410 +#define RCBA32(x) *((volatile u32 *)(RCBA + x)) + +/* Pilot uses 0x5A/0xA5 pattern to actiavte deactivate config access. */ +static void pnp_enter_ext_func_mode_pilot(u16 dev) +{ +outb(0x5A, dev); +} + +static void pnp_exit_ext_func_mode_pilot(u16 dev) +{ +outb(0xA5, dev); +} + + + +static void southbridge_init(void) +{ + u16 reg16; + u32 reg32; + + // Set up RCBA (CHECKED RUUD) + pci_write_config32(PCI_ADDR(0, 0x1f, 0, 0xf0), RCBA | 1); + +#if 1 + // port80 writes go to LPC: + reg32 = RCBA32(GCS); + reg32 = reg32 & ~0x04; + RCBA32(GCS) = reg32; + outb(0x23, 0x80); +#endif + + // Enable Serial IRQ +#define SIRQ_CNTL 0x64 + pci_write_config8(PCI_ADDR(0, 0x1f, 0, SIRQ_CNTL), 0xd0); + // Set COM1 decode range + // (COMA DECODE RANGE 3F8, COMB DECODE RANGE 2F8) +#define LPC_IO_DEC 0x80 + pci_write_config16(PCI_ADDR(0, 0x1f, 0, LPC_IO_DEC), 0x0010); + +#define LPC_EN 0x82 + // Enable COM1 (RUUD: why not COMB as well?) + // COMA enable, COMB disable LPT enable, FDD enable, KPOC enable, + // superIO enable +// pci_write_config16(PCI_ADDR(0, 0x1f, 0, LPC_EN), 0x140d); + pci_write_config16(PCI_ADDR(0, 0x1f, 0, LPC_EN), 0x3f0f); + + // Enable SIO PM Events at 0x680 + // bit0: enable=1 + // bit2-15 range (0xCA1) + // bit18-23 mask (0x000) +#define GEN1_DEC 0x84 + pci_write_config32(PCI_ADDR(0, 0x1f, 0, GEN1_DEC), 0x00000CA1); + // bit0: enable=1 + // bit2-15 range (0x680) + // bit18-23 mask (0x07c) +#define GEN2_DEC 0x88 + pci_write_config32(PCI_ADDR(0, 0x1f, 0, GEN2_DEC), 0x007c0681); +#define GEN3_DEC 0x8C +// pci_write_config32(PCI_ADDR(0, 0x1f, 0, GEN3_DEC), 0x000F00A1); + + + // Disable watchdog +#define PMBASE 0x500 +#define TCOBASE (PMBASE + 0x60) + pci_write_config32(PCI_ADDR(0, 0x1f, 0, 0x40), PMBASE | 1); + pci_write_config8(PCI_ADDR(0, 0x1f, 0, 0x44), 0x80); + reg16 = inw(TCOBASE + 0x08); + reg16 |= (1 << 11); + outw(reg16, TCOBASE + 0x08); + outw(0x0008, TCOBASE + 0x04); + outw(0x0002, TCOBASE + 0x06); +} + +static void superio_init(void) +{ + pnp_enter_ext_func_mode_pilot(0x2e); + + pnp_set_logical_device(0x2e, 2); // COM-A + pnp_set_enable(0x2e, 0); + pnp_set_iobase0(0x2e, 0x3f8); + pnp_set_irq0(0x2e, 4); + pnp_set_enable(0x2e, 1); + + pnp_exit_ext_func_mode_pilot(0x2e); + pnp_enter_ext_func_mode_pilot(0x2e); + + pnp_set_logical_device(0x2e, 8 ); // IPMI ?? protocol + pnp_set_enable(0x2e, 0); + pnp_set_iobase0(0x2e, 0xCA0); + pnp_set_iobase1(0x2e, 0xCA1); + pnp_set_enable(0x2e, 1); + + pnp_exit_ext_func_mode_pilot(0x2e); + pnp_enter_ext_func_mode_pilot(0x2e); + + pnp_set_logical_device(0x2e, 9 ); // IPMI kb protocol + pnp_set_enable(0x2e, 0); + pnp_set_iobase0(0x2e, 0xCA2); + pnp_set_iobase1(0x2e, 0xCA3); + pnp_set_enable(0x2e, 1); +/* + outb(pnp_read_register(0x2e,0x60),0x80); + outb(pnp_read_register(0x2e,0x61),0x80); + outb(pnp_read_register(0x2e,0x62),0x80); + outb(pnp_read_register(0x2e,0x63),0x80); + READBACK TEST gives expected result +*/ + pnp_exit_ext_func_mode_pilot(0x2e); + +} + +static void chipset_init(void) +{ + outb(0x01,0x80); + southbridge_init(); + outb(0x02,0x80); + superio_init(); + outb(0x03,0x80); + setup_early_ipmi_serial(); + outb(0x04,0x80); +/* + { + int b; + for (b=0;b<0x10;b++) + { + outb(b,0x80); + int c; + for(c=0;c<32000;c++) + (void) inb(0x80); + }; + }; +*/ +} + diff --git a/SerialICE/mainboard/ipmi.c b/SerialICE/mainboard/ipmi.c new file mode 100644 index 0000000..06f5476 --- /dev/null +++ b/SerialICE/mainboard/ipmi.c @@ -0,0 +1,253 @@ +/* + * SerialICE + * + * Copyright (C) 2011 Netherlands Forensic Institute + * + * 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; version 2 of the License. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * This is an example of lowlevel code for disabeling the BMC serial + * communication. + */ + +#define nftransport 0xc + +#define OBF (1 << 0) +#define IBF (1 << 1) + +#define ipmidata 0xca2 +#define ipmicsr 0xca3 + +#if 0 +static u8 i_n_b_debug(u16 port) +{ + u8 d=inb(port); + outb(d,0x80); + return d; +} + +#define inb i_n_b_debug +#endif + +#if 0 +static char * print_binary(char val) +{ + static char strbuf[20]; + char *dat=strbuf; + unsigned char mask=0x80; + while (mask!=0) { + *dat= (val & mask) ? '1' : '0'; + mask = mask>>1; + dat++; + }; + *dat=0; + return strbuf; +}; +#endif + +static int writestateQ(void) +{ + return ((inb(ipmicsr)>>6)==0x10); +} + +static int readstateQ(void) +{ + return ((inb(ipmicsr)>>6)==0x01); +} + +static int idlestateQ(void) +{ + return ((inb(ipmicsr)>>6)==0x00); +} + +static inline void ibfzero(void) +{ + while(inb(ipmicsr) & IBF) + ; +} +static inline void clearobf(void) +{ + (void) inb(ipmidata); +} + +static inline void waitobf(void) +{ + while((inb(ipmicsr) & OBF) == 0) + ; +} + +/* quite possibly the stupidest interface ever designed. */ +static inline void first_cmd_byte(unsigned char byte) +{ + ibfzero(); + clearobf(); + outb(0x61, ipmicsr); + ibfzero(); + clearobf(); + outb(byte, ipmidata); +} + +static inline void next_cmd_byte(unsigned char byte) +{ + ibfzero(); + clearobf(); + outb(byte, ipmidata); +} + +static inline void last_cmd_byte(unsigned char byte) +{ + ibfzero(); + clearobf(); + outb(0x62, ipmicsr); + + ibfzero(); + clearobf(); + outb(byte, ipmidata); +} + +static inline void getStatus(void ) +{ + do { + ibfzero(); + outb(0x60, ipmicsr); + ibfzero(); + clearobf(); + outb(0, ipmidata); + ibfzero(); + } while (!readstateQ()); + waitobf(); + + int val=inb(ipmidata); + outb(val,ipmidata); + ibfzero(); + waitobf(); + clearobf(); +} + + +static inline void read_response_byte(void) +{ + int val = -1; + if ((inb(ipmicsr)>>6) != 1) //Check state=0x01 (READ); + return; + + ibfzero(); + waitobf(); + val = inb(ipmidata); + outb(0x68, ipmidata); + + /* see if it is done */ + if ((inb(ipmicsr)>>6) != 1){ + /* wait for the dummy read. Which describes this protocol */ + waitobf(); + (void)inb(ipmidata); + } +} + +static inline void ipmidelay(void) +{ + int i; + for(i = 0; i < 10; i++) { + inb(0x80); + } +} + +static void earlydbg(char POST) +{ + outb(POST,0x80); +} + +static inline void ipmi_request(const char *Start, const char *End) +{ + unsigned char c; + /* be safe; make sure it is really ready */ + while ((inb(ipmicsr)>>6)) { //Not IDLE + outb(inb(ipmicsr),0x80); + outb(0x60, ipmicsr); //abort + + }; + + first_cmd_byte(*Start); + ipmidelay(); + Start++; + + while( (int) Start< ((int) End -1)) { + next_cmd_byte(*Start); + ipmidelay(); + Start++; + }; + + last_cmd_byte(*Start); + ipmidelay(); +} + +static void ipmi_transaction(const char *Start, const char *End) +{ + ipmi_request(Start,End); + ibfzero(); + while(readstateQ()) { + char val; + waitobf(); + val=inb(ipmidata); + outb(0x68,ipmidata); + ipmidelay(); + ibfzero(); + }; + if (idlestateQ()) { +// char val; +// waitobf(); +// val = inb(ipmidata); + } else { + getStatus(); + } +} + + + +const char channel_access[]={0x06<<2,0x40,0x04,0x80,0x05}; +const char serialmodem_conf[]={0x0c<<2,0x10,0x04,0x08,0x00,0x0f}; +const char serial_mux1[]={0x0c<<2,0x12,0x04,0x06}; +const char serial_mux2[]={0x0c<<2,0x12,0x04,0x03}; +const char serial_mux3[]={0x0c<<2,0x12,0x04,0x07}; + +static void setup_early_ipmi_serial(void ) +{ +// earlydbg(0x0d); + //set channel access system only +// ipmi_transaction(channel_access,channel_access+sizeof(channel_access)); + while ((inb(ipmicsr)>>6)) { //Not IDLE + outb(inb(ipmicsr),0x80); + outb(0x60, ipmicsr); //abort + getStatus(); + }; + + //Set serial/modem config +// ipmi_transaction(serialmodem_conf,serialmodem_conf+sizeof(serialmodem_conf)); +// earlydbg(result); + + //Set serial mux 1 +// ipmi_transaction(serial_mux1,serial_mux1+sizeof(serial_mux1)); +// earlydbg(result); + + //Set serial mux 2 + ipmi_transaction(serial_mux2,serial_mux2+sizeof(serial_mux2)); + + //Set serial mux 3 +// ipmi_transaction(serial_mux3,serial_mux3+sizeof(serial_mux3)); + + earlydbg(0x0e); + +} + diff --git a/SerialICE/mainboard/ipmi_disable.c b/SerialICE/mainboard/ipmi_disable.c new file mode 100644 index 0000000..5ea1bbf --- /dev/null +++ b/SerialICE/mainboard/ipmi_disable.c @@ -0,0 +1,37 @@ +/* + * SerialICE + * + * Copyright (C) 2011 Netherlands Forensic Institute + * + * 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; version 2 of the License. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * This is an example of lowlevel code for disabeling the BMC serial + * communication. + */ +#include <stdio.h> +#include <sys/io.h> + +#include "ipmi.c" + +int main(int argc, char **argv) +{ + iopl(3); + ioperm(0x80, 0x20 , 1); + earlydbg(0x12); + getStatus(); + setup_early_ipmi_serial(); +}; + diff --git a/SerialICE/serial.c b/SerialICE/serial.c index 9aaecb6..4728703 100644 --- a/SerialICE/serial.c +++ b/SerialICE/serial.c @@ -57,6 +57,11 @@ static void sio_putc(u8 data) while (!(inb(SIO_PORT + UART_LSR) & 0x40)) ; } +static u8 sio_dataready(void) +{ + return ((inb(SIO_PORT + UART_LSR) & 0x01)); +} + static u8 sio_getc(void) { u8 val; diff --git a/SerialICE/serialice.c b/SerialICE/serialice.c index 34c62e9..961483e 100644 --- a/SerialICE/serialice.c +++ b/SerialICE/serialice.c @@ -17,6 +17,24 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#define STACKTOP 0x20000 + +#ifdef COMPRESS + +#define u8 lzf_u8 +#define u16 lzf_u16 + +#define INIT_HTAB 1 +#define HLOG 13 +#define AVOID_ERRNO 1 + +#include "lzf/liblzf-3.6/lzf_c.c" + +#undef u8 +#undef u16 + +#endif + #include <types.h> #include <serialice.h> #include <io.h> @@ -28,7 +46,281 @@ #include "chipset.c" +#ifdef COMPRESS +//Above 1Meg +#define COMPRESSBUF 0x100000 +//1.1 Meg buffer +#define COMPRESSBUFSIZE ((512*1024)) +#define COMPRESSBLOCKSIZE ((256*1024)) + +#define PAGETABLE (COMPRESSBUF+COMPRESSBUFSIZE) + +#define PAE + +#ifdef PAE +/* This implementation targets huge (2M pages) */ + +/* This code assumes the sizeof an long int == 8 */ + +typedef struct { + long long int pagedirptr[512]; //Actually 4, but must be page alligned + long long int pagedir[512*4]; +} pagetbl; + +void __flush_tlb_global(unsigned int pt) +{ +/* + * Intel CPU features in CR4 + */ +#define X86_CR4_VME 0x00000001 /* enable vm86 extensions */ +#define X86_CR4_PVI 0x00000002 /* virtual interrupts flag enable */ +#define X86_CR4_TSD 0x00000004 /* disable time stamp at ipl 3 */ +#define X86_CR4_DE 0x00000008 /* enable debugging extensions */ +#define X86_CR4_PSE 0x00000010 /* enable page size extensions */ +#define X86_CR4_PAE 0x00000020 /* enable physical address extensions */ +#define X86_CR4_MCE 0x00000040 /* Machine check enable */ +#define X86_CR4_PGE 0x00000080 /* enable global pages */ +#define X86_CR4_PCE 0x00000100 /* enable performance counters at ipl 3 */ +#define X86_CR4_OSFXSR 0x00000200 /* enable fast FPU save and restore */ +#define X86_CR4_OSXMMEXCPT 0x00000400 /* enable unmasked SSE exceptions */ +#define X86_CR4_VMXE 0x00002000 /* enable VMX virtualization */ +#define X86_CR4_OSXSAVE 0x00040000 /* enable xsave and xrestore */ + + do { + unsigned int mmu_cr4_features; + unsigned int mmu_cr0; + long long int local_idt=0; + + __asm__ __volatile__( + "lidt %0; \n" + : + : "m" (local_idt) + : "memory"); + __asm__ __volatile__( + "movl %%cr4, %0; \n" + "movl %%cr0, %1; \n" + : "=&r" (mmu_cr4_features), + "=&r" (mmu_cr0) + : + : "memory"); + + mmu_cr4_features = mmu_cr4_features | X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE; + mmu_cr0 = mmu_cr0 | 0x80000000; //Paging On + + __asm__ __volatile__( + "movl %1, %%cr4; # turn on extensions \n" + "movl %0, %%cr3; # Set Pagetable \n" + "movl %2, %%cr0; # Enable paging \n" + "ljmp $0x08,$1f\n" + "1:\n" + : + : "r" (pt), + "r" (mmu_cr4_features), + "r" (mmu_cr0) + : "memory"); + } while (0); +}; + +#define _PAGE_BIT_PRESENT 0 /* is present */ +#define _PAGE_BIT_RW 1 /* writeable */ +#define _PAGE_BIT_USER 2 /* userspace addressable */ +#define _PAGE_BIT_PWT 3 /* page write through */ +#define _PAGE_BIT_PCD 4 /* page cache disabled */ +#define _PAGE_BIT_ACCESSED 5 /* was accessed (raised by CPU) */ +#define _PAGE_BIT_DIRTY 6 /* was written to (raised by CPU) */ +#define _PAGE_BIT_PSE 7 /* 4 MB (or 2MB) page */ +#define _PAGE_BIT_PAT 7 /* on 4KB pages */ +#define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */ +#define _PAGE_BIT_UNUSED1 9 /* available for programmer */ +#define _PAGE_BIT_IOMAP 10 /* flag used to indicate IO mapping */ +#define _PAGE_BIT_HIDDEN 11 /* hidden by kmemcheck */ +#define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */ +#define _PAGE_BIT_SPECIAL _PAGE_BIT_UNUSED1 +#define _PAGE_BIT_CPA_TEST _PAGE_BIT_UNUSED1 +#define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */ + +int paged_gigabyte; + +void enter_pae() +{ + u8 windowed_gig; //The area starting at 0x40000000 is a window to a specified gig of memory + //Entering 01 will give a linear view of the lowest + //4G of mem, + //Entering 04 will show the area between 4 and 5G at + //the address 0x40000000 + windowed_gig=sio_get8(); + paged_gigabyte=windowed_gig; + + unsigned long long int windowbase= ((unsigned long long int )windowed_gig)*0x40000000L; + if (sizeof (long long int)!=8) + { + sio_putstring("ERROR INT SIZE"); + return ; + }; + long long int pagenr; + pagetbl *PTBL=(pagetbl *) PAGETABLE; + PTBL->pagedirptr[0]=0x1 | (long long int) &PTBL->pagedir[0*512] ; + PTBL->pagedirptr[1]=0x1 | (long long int) &PTBL->pagedir[1*512] ; + PTBL->pagedirptr[2]=0x1 | (long long int) &PTBL->pagedir[2*512] ; + PTBL->pagedirptr[3]=0x1 | (long long int) &PTBL->pagedir[3*512] ; + for (pagenr=0;pagenr<(4*512);pagenr++) + PTBL->pagedir[pagenr]=0x8F | pagenr*(2*1024*1024); + for (pagenr=512;pagenr<(2*512);pagenr++) + PTBL->pagedir[pagenr]=0x8F | ((pagenr-512) *(2*1024*1024)) | windowbase ; +//0x8F +//_PAGE_BIT_PSE _PAGE_BIT_PWT _PAGE_BIT_USER _PAGE_BIT_RW _PAGE_BIT_PRESENT + __flush_tlb_global((int) PTBL); +}; + +#endif //PAE + + +void *memset(void *s, int c, size_t n) +{ + int i; + char *ss=(char *) s; + for(i=0;i<n;i++) + { + *ss=c; + ss++; + }; +}; + +static void post_putc(u8 c) +{ + outb(c,0x80); +} + +static void post_putstring(char *str) +{ + while(*str!=0) + post_putc(*str++); +} + +static void post_put8(u32 data) +{ + int i; + for (i=4; i >= 0; i -= 4) { + u8 c = (data >> i) & 0xf; + if (c > 9) \ + c += ('a' - 10); \ + else \ + c += '0'; \ + post_putc(c); + }; +} + +static void post_put32(u32 data) +{ + int i; + for (i=28; i >= 0; i -= 4) { + u8 c = (data >> i) & 0xf; + if (c > 9) \ + c += ('a' - 10); \ + else \ + c += '0'; \ + post_putc(c); + }; +} + +static void serialice_dump_compressed2(u8 * addr) +{ + unsigned int outsize; + u8 *data; + u32 checksum=0; + for(data = addr;data<(addr+COMPRESSBLOCKSIZE);data++) + checksum += *data; + + outsize = lzf_compress ((void *) addr,COMPRESSBLOCKSIZE, (void *) COMPRESSBUF, COMPRESSBUFSIZE); + + sio_putstring("COMP"); + sio_put8((u8) paged_gigabyte); + sio_put32((u32) addr); + sio_put32((u32) COMPRESSBLOCKSIZE); + sio_put32((u32) outsize); + sio_put32((u32) checksum); + for(data = (u8 *) COMPRESSBUF ;data<(u8 *) (COMPRESSBUF+outsize);data++) + sio_putc(*data); +}; + +static void serialice_dump_compressed(void) +{ + u32 addr; + u32 endaddr; + addr = sio_get32(); + sio_getc(); // skip . + endaddr = sio_get32(); + while ((!sio_dataready()) && (addr < endaddr)) { + serialice_dump_compressed2((char *) addr); + addr+=COMPRESSBLOCKSIZE; + }; +}; + +static void post_dump_compressed2(u8 * addr) +{ + unsigned int outsize; + u8 *data; + u32 checksum=0; + for(data = addr;data<(addr+COMPRESSBLOCKSIZE);data++) + checksum += *data; + + outsize = lzf_compress ((void *) addr,COMPRESSBLOCKSIZE, (void *) COMPRESSBUF, COMPRESSBUFSIZE); + + post_putstring("COMP"); + post_put8((u8) paged_gigabyte); + post_put32((u32) addr); + post_put32((u32) COMPRESSBLOCKSIZE); + post_put32((u32) outsize); + post_put32((u32) checksum); + for(data = (u8 *) COMPRESSBUF ;data<(u8 *) (COMPRESSBUF+outsize);data++) + post_putc(*data); +}; + +static void post_dump_compressed(void) +{ + u32 addr; + u32 endaddr; + addr = sio_get32(); + sio_getc(); // skip . + endaddr = sio_get32(); + while ((!sio_dataready()) && (addr < endaddr)) { + post_dump_compressed2((char *) addr); + addr+=COMPRESSBLOCKSIZE; + }; +}; + /* Accessor functions */ +static void serialice_dump_post(void) +{ + u32 addr; + + // Format: + // *rm00000000.w + addr = sio_get32(); + while (!sio_dataready()) { + int b; + for (b=0;b<0x1000;b++) + { + outb(read8(addr),0x80); + addr++; + }; + }; +} + +#endif + +static int serialice_run_from_ram(void) +{ +/* Copy to ram */ + __asm__ volatile ("movl $_shadow_dst_begin,%%edi"::); + __asm__ volatile ("movl $_shadow_src_begin,%%esi"::); + __asm__ volatile ("movl $_shadow_dst_end, %%ecx"::); + __asm__ volatile ("subl $_shadow_dst_begin, %%ecx"::); + __asm__ volatile ("cld ; rep ; movsb"); + //STACKTOP + __asm__ volatile ("movl $0x20000,%%esp\n\tcall _rammain\n\t"::); + return 0; +} static void serialice_read_memory(void) { @@ -50,6 +342,68 @@ static void serialice_read_memory(void) } } +#if 0 + +static void serialice_scan_memory(void) +{ + u32 addr; + + // Format: + // *dm00000000 + addr = sio_get32(); + while (!sio_dataready()) { + u8 byte; + sio_putc('\r'); + sio_putc('\n'); + sio_put32(addr); + sio_putc(' '); + do { + byte=read8(addr); + if ((byte>='a') && (byte<'z')) sio_putc(byte); + if (byte>='A' && byte<='Z') sio_putc(byte); + if (byte>='0' && byte<='9') sio_putc(byte); + addr++; + } while ((addr & 0x1F) !=0); + addr += (0x2000-0x20); + }; + + sio_putc('\r'); sio_putc('\n'); +} + +#endif + +static void serialice_dump_memory(void) +{ + u32 addr; + u32 checksum; + + // Format: + // *dm00000000 + addr = sio_get32(); + checksum=0; + while (!sio_dataready()) { + u8 byte; + if ( (addr & 0xFFFF) == 0) { + sio_putc(checksum); + sio_putc(checksum>>8); + sio_putc(checksum>>16); + sio_putc(checksum>>24); + checksum=0; + sio_putc('S'); + sio_putc('T'); + sio_putc('R'); + sio_putc('T'); + sio_put32(addr); + }; + byte=read8(addr); + sio_putc(byte); + checksum+=byte; + addr++; + }; + sio_putc('\r'); sio_putc('\n'); +} + + static void serialice_write_memory(void) { u8 width; @@ -194,6 +548,10 @@ int main(void) sio_putstring("\nSerialICE v" VERSION " (" __DATE__ ")\n"); +#ifdef COMPRESS + paged_gigabyte=1; +#endif + while(1) { u16 c; sio_putstring("\n> "); @@ -212,6 +570,14 @@ int main(void) case (('w' << 8)|'m'): // Write Memory *wm serialice_write_memory(); break; + case (('d' << 8)|'m'): // Dump Memory *dm + serialice_dump_memory(); + break; +#ifdef COMPRESS + case (('c' << 8)|'m'): // Dump Memory compressed *cm + serialice_dump_compressed(); + break; +#endif case (('r' << 8)|'i'): // Read IO *ri serialice_read_io(); break; @@ -227,6 +593,22 @@ int main(void) case (('c' << 8)|'i'): // Read CPUID *ci serialice_cpuinfo(); break; +#ifdef COMPRESS + case (('d' << 8)|'p'): // Post Write + serialice_dump_post(); + break; + case (('c' << 8)|'p'): // Compressed Post Dump + post_dump_compressed(); + break; +#endif + case (('r' << 8)|'r'): // Post Write + serialice_run_from_ram(); + break; +#ifdef PAE + case (('p' << 8)|'a'): // Post Write + enter_pae(); + break; +#endif default: sio_putstring("ERROR\n"); break; diff --git a/SerialICE/serialice.ld b/SerialICE/serialice.ld index 9dd1591..8abce7e 100644 --- a/SerialICE/serialice.ld +++ b/SerialICE/serialice.ld @@ -20,19 +20,36 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) +_PHYS_LOCATION = 0x1000; +_FLASHSIZE = (2 * 1024 * 1024); _ROMSIZE = (1024 * 64); +_FLASHBASE = 0x100000000 - (_FLASHSIZE); +_ROMCOPY = 0x100000000 - (2 * _ROMSIZE); _ROMBASE = 0x100000000 - (_ROMSIZE); SECTIONS { + . = _FLASHBASE ; + .empty : { + BYTE(0xFF) ; + FILL(0xFF) ; + . = _FLASHSIZE - (_ROMSIZE * 2) ; + } + . = _ROMCOPY ; + .romcopy : { + _shadow_src_begin = . ; + _ram_shadow_src_begin = . ; + } . = _ROMBASE; .rom : { _main = . ; + _ram_rammain = . ; *(.rom.text); - *(.text); *(.rom.data); - *(.data); + + *(.text); + *(.data); *(.rodata); - *(.rodata.*); + *(.rodata.*); } . = 0xffffff40; @@ -55,9 +72,24 @@ SECTIONS { BYTE(0x00); } + .shadow _PHYS_LOCATION : AT (_ROMCOPY) { + _shadow_dst_begin = . ; + _ram_shadow_dst_begin = . ; + + *(.ram.rom.text); + *(.ram.text); + *(.ram.rom.data); + *(.ram.data); + *(.ram.rodata); + *(.ram.rodata.*); + _shadow_dst_end = . ; + _ram_shadow_dst_end = . ; + } /DISCARD/ : { *(.comment) *(.note.*) *(.note) + *(.ram.eh_frame); + *(.ram.comment); } } diff --git a/SerialICE/start.S b/SerialICE/start.S index e751bab..ac6d6f5 100644 --- a/SerialICE/start.S +++ b/SerialICE/start.S @@ -19,6 +19,9 @@ #include "serialice.h" + /* Messages */ + .section ".rom.text" + .globl _c_main .code32 _c_main:
1
0
0
0
New patch to review for serialice: 5c408e5 SerialICE support for HP DL 120 G5 motherboard using a Server Pilot II BMC
by Ruud Schramp
11 Sep '13
11 Sep '13
Ruud Schramp (schramp(a)holmes.nl) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/3918
-gerrit commit 5c408e56b95048fecce2ef3221975f7164a71cde Author: Ruud Schramp <schramp(a)holmes.nl> Date: Wed Sep 11 01:49:30 2013 -0700 SerialICE support for HP DL 120 G5 motherboard using a Server Pilot II BMC Additional patches for copying a RAM version of serialice to RAM and compression for fast dumping. RAM Memory acquisition using live-BIOS modification
https://program.ohm2013.org/event/157.html
http://bofh.nikhef.nl/events/OHM/video/d3-t3-12-20130802-2200-ram_memory_ac…
Change-Id: Ia1d8abdd181ace44c5b94c7bba2f284701c7c2eb Signed-off-by: Ruud Schramp <schramp(a)holmes.nl> --- SerialICE/Kconfig | 4 + SerialICE/Makefile | 8 +- SerialICE/chipset.c | 6 + SerialICE/lzf/Makefile | 71 +++ SerialICE/lzf/README | 4 + SerialICE/lzf/liblzf-3.6/Changes | 136 +++++ SerialICE/lzf/liblzf-3.6/LICENSE | 27 + SerialICE/lzf/liblzf-3.6/Makefile | 71 +++ SerialICE/lzf/liblzf-3.6/Makefile.in | 66 +++ SerialICE/lzf/liblzf-3.6/README | 29 ++ SerialICE/lzf/liblzf-3.6/config.h | 17 + SerialICE/lzf/liblzf-3.6/config.h.in | 16 + SerialICE/lzf/liblzf-3.6/config.log | 549 ++++++++++++++++++++ SerialICE/lzf/liblzf-3.6/config.status | 827 +++++++++++++++++++++++++++++++ SerialICE/lzf/liblzf-3.6/configure.ac | 25 + SerialICE/lzf/liblzf-3.6/crc32.h | 65 +++ SerialICE/lzf/liblzf-3.6/cs/CLZF.cs | 344 +++++++++++++ SerialICE/lzf/liblzf-3.6/cs/README | 7 + SerialICE/lzf/liblzf-3.6/install-sh | 251 ++++++++++ SerialICE/lzf/liblzf-3.6/lzf.c | 537 ++++++++++++++++++++ SerialICE/lzf/liblzf-3.6/lzf.h | 100 ++++ SerialICE/lzf/liblzf-3.6/lzfP.h | 185 +++++++ SerialICE/lzf/liblzf-3.6/lzf_c.c | 291 +++++++++++ SerialICE/lzf/liblzf-3.6/lzf_d.c | 185 +++++++ SerialICE/lzf/liblzf-3.6/romdecompress.c | 245 +++++++++ SerialICE/lzf/romdecompress.c | 245 +++++++++ SerialICE/mainboard/intel_3210_ich9.c | 161 ++++++ SerialICE/mainboard/ipmi.c | 253 ++++++++++ SerialICE/mainboard/ipmi_disable.c | 37 ++ SerialICE/serial.c | 5 + SerialICE/serialice.c | 382 ++++++++++++++ SerialICE/serialice.ld | 37 +- SerialICE/start.S | 3 + 33 files changed, 5184 insertions(+), 5 deletions(-) diff --git a/SerialICE/Kconfig b/SerialICE/Kconfig index 6406414..3cee76b 100644 --- a/SerialICE/Kconfig +++ b/SerialICE/Kconfig @@ -33,6 +33,9 @@ config BOARD_KONTRON_986LCD_M config BOARD_INTEL_D945GCLF bool "Intel D945GCLF" +config BOARD_3210_ICH9 + bool "Intel 3210 + ICH9" + config BOARD_DELL_S1850 bool "Dell PowerEdge S1850" @@ -59,6 +62,7 @@ config BOARD_INIT string default "kontron_986lcd-m.c" if BOARD_KONTRON_986LCD_M default "intel_d945gclf.c" if BOARD_INTEL_D945GCLF + default "intel_3210_ich9.c" if BOARD_3210_ICH9 default "dell_s1850.c" if BOARD_DELL_S1850 default "asus_m2v-mx_se.c" if BOARD_ASUS_M2V_MX_SE default "msi_ms6178.c" if BOARD_MSI_MS6178 diff --git a/SerialICE/Makefile b/SerialICE/Makefile index 3979b62..2894183 100644 --- a/SerialICE/Makefile +++ b/SerialICE/Makefile @@ -110,9 +110,13 @@ $(obj)/serialice.rom: $(obj)/serialice.elf $(Q)printf " OBJCOPY $(subst $(shell pwd)/,,$(@))\n" $(Q)$(OBJCOPY) -O binary $< $@ -$(obj)/serialice.elf: $(obj)/serialice.o $(obj)/start.o $(src)/serialice.ld +$(obj)/serialice-ram.o: $(SOURCES) + gcc -O2 "-DVERSION=\"$(VERSION)\" \"RAM\"" -DCOMPRESS -I . -I build/ -I mainboard/ -c serialice.c -o build/serialice-ram.o + objcopy --prefix-symbols _ram --prefix-sections .ram build/serialice-ram.o build/serialice-ram.o + +$(obj)/serialice.elf: $(obj)/serialice.o $(obj)/start.o $(src)/serialice.ld $(obj)/serialice-ram.o $(Q)printf " LINK $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(CC) $(LDFLAGS) -o $@ $(obj)/serialice.o $(obj)/start.o + $(Q)$(CC) $(LDFLAGS) -o $@ $(obj)/serialice.o $(obj)/serialice-ram.o $(obj)/start.o $(Q)$(NM) $@ | sort -u > $(obj)/serialice.map $(obj)/serialice.S: $(SOURCES) $(obj)/romcc diff --git a/SerialICE/chipset.c b/SerialICE/chipset.c index 3354acd..262f460 100644 --- a/SerialICE/chipset.c +++ b/SerialICE/chipset.c @@ -64,6 +64,12 @@ static inline void pnp_set_iobase0(u16 port, u16 iobase) pnp_write_register(port, 0x61, iobase & 0xff); } +static inline void pnp_set_iobase1(u16 port, u16 iobase) +{ + pnp_write_register(port, 0x62, (iobase >> 8) & 0xff); + pnp_write_register(port, 0x63, iobase & 0xff); +} + static inline void pnp_set_irq0(u16 port, u8 irq) { pnp_write_register(port, 0x70, irq); diff --git a/SerialICE/lzf/Makefile b/SerialICE/lzf/Makefile new file mode 100644 index 0000000..11b6f6c --- /dev/null +++ b/SerialICE/lzf/Makefile @@ -0,0 +1,71 @@ +VERSION = 3.6 + +prefix = /usr/local +exec_prefix = ${prefix} +libdir = ${exec_prefix}/lib +bindir = ${exec_prefix}/bin +includedir = ${prefix}/include + + + +CC = gcc +CPPFLAGS = -I. +CFLAGS = -g +#CFLAGS = -g -O2 -O3 -funroll-all-loops +LDFLAGS = +RANLIB = ranlib +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 + +all: Makefile lzf romdecompress + +clean: + -rm -f *.o *.a lzf bench + +lzf_c.o: lzf_c.c lzfP.h + +lzf_d.o: lzf_d.c lzfP.h + +romdecompress.o: romdecompress.c + +romdecompress: romdecompress.o liblzf.a + +lzf.o: lzf.c + +lzf: lzf.o liblzf.a + +lzfP.h: lzf.h config.h + +liblzf.a: lzf_c.o lzf_d.o + rm -f $@ + $(AR) rc $@ $^ + $(RANLIB) $@ + +install: all + $(INSTALL) -d $(bindir) + $(INSTALL) -m 755 lzf $(bindir) + $(INSTALL) -d $(includedir) + $(INSTALL_DATA) lzf.h $(includedir) + $(INSTALL) -d $(libdir) + $(INSTALL_DATA) liblzf.a $(libdir) + +dist: + mkdir liblzf-$(VERSION) + tar c LICENSE README Makefile.in config.h.in \ + configure configure.ac install-sh \ + cs/README cs/CLZF.cs \ + lzf.h lzfP.h lzf_c.c lzf_d.c \ + crc32.h lzf.c Changes \ + | tar xpC liblzf-$(VERSION) + -chown -R root.root liblzf-$(VERSION) + chmod -R u=rwX,go=rX liblzf-$(VERSION) + tar cvf - liblzf-$(VERSION) | gzip -9 >liblzf-$(VERSION).tar.gz + rm -rf liblzf-$(VERSION) + ls -l liblzf-$(VERSION).tar.gz + +Makefile: Makefile.in + ./config.status + +bench: Makefile liblzf.a bench.c + $(CC) $(CPPFLAGS) $(CFLAGS) -g -o bench bench.c -L. -llzf + diff --git a/SerialICE/lzf/README b/SerialICE/lzf/README new file mode 100644 index 0000000..a2f87ba --- /dev/null +++ b/SerialICE/lzf/README @@ -0,0 +1,4 @@ +This application is using +liblzf-3.6.tar.gz + +The decompression application was hand-edited into the makefile diff --git a/SerialICE/lzf/liblzf-3.6/Changes b/SerialICE/lzf/liblzf-3.6/Changes new file mode 100644 index 0000000..93bd4cb --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/Changes @@ -0,0 +1,136 @@ +3.6 Mon Feb 7 17:37:31 CET 2011 + - fixed hash calculation in C♯ version (Tiago Freitas Leal). + - unroll copy for small sizes, use memcpy for larger sizes, + greatly speeding up decompression in most cases. + - finally disable rep movsb - it's a big loss on modern intel cpus, + and only a small win on amd cpus. + - improve C++ compatibility of the code. + - slightly improve compressor speed. + - halved memory requirements for compressor on 64 bit architectures, + which can improve the speed quite a bit on older cpus. + +3.5 Fri May 1 02:28:42 CEST 2009 + - lzf_compress did sometimes write one octet past the given output + buffer (analyzed and nice testcase by Salvatore Sanfilippo). + +3.4 Tue Sep 2 06:45:00 CEST 2008 + - the fix from 3.3 introduced a compression bug, which is fixed in + this release (which explains the mysterious prerelease...). Thanks + once more to Clément Calmels. + +3.3 Mon Aug 25 03:17:42 CEST 2008 + - lzf_compress could access memory after the given input buffer + when outputting back references. reported with nice testcase + by Clément Calmels. + +3.2 Fri May 9 18:52:23 CEST 2008 + - include a workaround for failing POSIX and real-world compliance + on 64 bit windows (microsoft claims to support POSIX, but is far + from it). (bug found and analysed nicely by John Lilley). + +3.1 Fri Nov 30 11:33:04 CET 2007 + - IMPORTANT BUGFIX: a too long final literal run would corrupt data + in the encoder (this was introduced in 3.0 only, earlier versions + are safe). + +3.0 Tue Nov 13 22:13:09 CET 2007 + - switched to 2-clause bsd with "GPL v2 or any later version" option. + - speed up compression by ~10-15% in common cases + by some manual unrolling. + - import some compiler tricks from JSON::XS, for further speed-ups. + - tune hash functions depending on ULTRA_FAST or VERY_FAST settings. + - for typical binary data (e.g. /bin/bash, memory dumps, + canterbury corpus etc.), speed is now comparable to fastlz, but + with better compression ratio. with ULTRA_FAST, it's typically + 3-15% faster than fastlz while still maintaining a similar ratio. + (amd64 and core 2 duo, ymmv). thanks a lot for the competition :) + - undo inline assembly in compressor, it is no longer helpful. + - no changes to the decompressor. + - use a HLOG of 16 by default now (formerly 15). + +2.1 Fri Nov 2 13:34:42 CET 2007 + - switched to a 2-clause bsd license with GPL exception. + - get rid of memcpy. + - tentatively use rep movsb on x86 and x86_64 (gcc only) for a + moderate speed improvement. + - applied patch by Kein-Hong Man to maske lzf.c compile under + the crippled mingw32 environment. + +2.0 Fri Feb 16 23:11:18 CET 2007 + - replaced lzf demo by industrial-strength lzf utility with behaviour + similar other compression utilities. Thanks for Stefan Traby for + rewriting it! + - fix state arg prototype. + +1.7 Wed Sep 27 17:29:15 CEST 2006 + - remove bogus "unlzf" patch. + note to self: never accept well-meant patches. + - make lzf more robust in presence of padding bytes or sudden eof. + +1.6 Fri Jul 7 17:31:26 CEST 2006 + - the lzf example utility will now uncompress if invoked + as "unlzf" (patch by Scott Feeney). + - add CHECK_INPUT option that adds more checks for input + data validity. + - help applications that do not pass in the correct length + (such as php) by returning either EINVAL or E2BIG. + - default HLOG size is now 15 (cpu caches have increased). + - documentation fixes. + +1.51 Thu Apr 14 22:15:46 CEST 2005 + - incorporated C♯ implementation of both the en- and decoder, + written by "Oren J. Maurice". + You can find it in the cs/ subdirectory. + - make FRST, NEXT IDX overridable if lzf_c.c is directly included + in the code. + +1.5 Tue Mar 8 20:23:23 CET 2005 + - incorporated improvements by Adam D. Moss, + which includes a new VERY_FAST mode which is + a bit slower than ULTRA_FAST but much better, + and enabled it as default. + +1.401 Thu Mar 3 18:00:52 CET 2005 + - use cstring in c++, not string.h. + - change of contact address. + +1.4 Wed Dec 15 08:08:49 CET 2004 + - very very slight tuning of the hashing function. + +1.3 Thu Mar 25 15:41:17 CET 2004 + - changed license of lzf core code to explicitly allow + relicensing under the GPLv2. + - added VPATH support as suggested by Björn Eriksson. + +1.2 Mon Dec 29 13:47:28 CET 2003 + - avoid spurious memory accesses after the to-be-compressed + memory region. originally reported by Michal Zalewski. + - flip LZF_STACK_ARG meaning (to be correct). + +1.1 Tue Dec 23 05:48:32 CET 2003 + - removed #warn directive, it's not worth the hassle. + - add LZF_STACK_ARG and AVOID_ERRNO configurations + for embedded systems. + - make it compile cleanly as c++. + - some small documentation and code fixes. + +1.0 Sun Nov 17 12:37:37 CET 2002 + - slightly better compression ratio, almost unmeasurably + slower. + - some documentation fixes. + +0.4 Thu Jun 13 14:11:10 CEST 2002 + - typoe fix. + - lzf demo program now properly decompresses small files. + - fix another 64 bit issue, found by Laurent Deniel. + +0.3 Tue Jan 16 13:21:14 CET 2001 + - fix silly beginners 32/64 bit mistake. + +0.2 Thu Jan 4 05:56:42 CET 2001 + - now totally independent of autoconfig, for + easy inclusion into other programs. + - much better fine-tuning, faster and better than 0.1. + +0.1 2000 + - initial release. diff --git a/SerialICE/lzf/liblzf-3.6/LICENSE b/SerialICE/lzf/liblzf-3.6/LICENSE new file mode 100644 index 0000000..ee54ff7 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2000-2009 Marc Alexander Lehmann <schmorp(a)schmorp.de> + +Redistribution and use in source and binary forms, with or without modifica- +tion, 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. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- +CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- +CIAL, 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 OTH- +ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + +Alternatively, the following files carry an additional notice that +explicitly allows relicensing under the GPLv2: lzf.c lzf.h lzfP.h lzf_c.c +lzf_d.c + diff --git a/SerialICE/lzf/liblzf-3.6/Makefile b/SerialICE/lzf/liblzf-3.6/Makefile new file mode 100644 index 0000000..11b6f6c --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/Makefile @@ -0,0 +1,71 @@ +VERSION = 3.6 + +prefix = /usr/local +exec_prefix = ${prefix} +libdir = ${exec_prefix}/lib +bindir = ${exec_prefix}/bin +includedir = ${prefix}/include + + + +CC = gcc +CPPFLAGS = -I. +CFLAGS = -g +#CFLAGS = -g -O2 -O3 -funroll-all-loops +LDFLAGS = +RANLIB = ranlib +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 + +all: Makefile lzf romdecompress + +clean: + -rm -f *.o *.a lzf bench + +lzf_c.o: lzf_c.c lzfP.h + +lzf_d.o: lzf_d.c lzfP.h + +romdecompress.o: romdecompress.c + +romdecompress: romdecompress.o liblzf.a + +lzf.o: lzf.c + +lzf: lzf.o liblzf.a + +lzfP.h: lzf.h config.h + +liblzf.a: lzf_c.o lzf_d.o + rm -f $@ + $(AR) rc $@ $^ + $(RANLIB) $@ + +install: all + $(INSTALL) -d $(bindir) + $(INSTALL) -m 755 lzf $(bindir) + $(INSTALL) -d $(includedir) + $(INSTALL_DATA) lzf.h $(includedir) + $(INSTALL) -d $(libdir) + $(INSTALL_DATA) liblzf.a $(libdir) + +dist: + mkdir liblzf-$(VERSION) + tar c LICENSE README Makefile.in config.h.in \ + configure configure.ac install-sh \ + cs/README cs/CLZF.cs \ + lzf.h lzfP.h lzf_c.c lzf_d.c \ + crc32.h lzf.c Changes \ + | tar xpC liblzf-$(VERSION) + -chown -R root.root liblzf-$(VERSION) + chmod -R u=rwX,go=rX liblzf-$(VERSION) + tar cvf - liblzf-$(VERSION) | gzip -9 >liblzf-$(VERSION).tar.gz + rm -rf liblzf-$(VERSION) + ls -l liblzf-$(VERSION).tar.gz + +Makefile: Makefile.in + ./config.status + +bench: Makefile liblzf.a bench.c + $(CC) $(CPPFLAGS) $(CFLAGS) -g -o bench bench.c -L. -llzf + diff --git a/SerialICE/lzf/liblzf-3.6/Makefile.in b/SerialICE/lzf/liblzf-3.6/Makefile.in new file mode 100644 index 0000000..3c87d62 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/Makefile.in @@ -0,0 +1,66 @@ +VERSION = 3.6 + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +bindir = @bindir@ +includedir = @includedir@ + +VPATH = @srcdir@ + +CC = @CC@ +CPPFLAGS = -I. @CPPFLAGS@ +CFLAGS = @CFLAGS@ +LDFLAGS = @LDFLAGS@ +RANLIB = @RANLIB@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +all: Makefile lzf + +clean: + -rm -f *.o *.a lzf bench + +lzf_c.o: lzf_c.c lzfP.h + +lzf_d.o: lzf_d.c lzfP.h + +lzf.o: lzf.c + +lzf: lzf.o liblzf.a + +lzfP.h: lzf.h config.h + +liblzf.a: lzf_c.o lzf_d.o + rm -f $@ + $(AR) rc $@ $^ + $(RANLIB) $@ + +install: all + $(INSTALL) -d $(bindir) + $(INSTALL) -m 755 lzf $(bindir) + $(INSTALL) -d $(includedir) + $(INSTALL_DATA) lzf.h $(includedir) + $(INSTALL) -d $(libdir) + $(INSTALL_DATA) liblzf.a $(libdir) + +dist: + mkdir liblzf-$(VERSION) + tar c LICENSE README Makefile.in config.h.in \ + configure configure.ac install-sh \ + cs/README cs/CLZF.cs \ + lzf.h lzfP.h lzf_c.c lzf_d.c \ + crc32.h lzf.c Changes \ + | tar xpC liblzf-$(VERSION) + -chown -R root.root liblzf-$(VERSION) + chmod -R u=rwX,go=rX liblzf-$(VERSION) + tar cvf - liblzf-$(VERSION) | gzip -9 >liblzf-$(VERSION).tar.gz + rm -rf liblzf-$(VERSION) + ls -l liblzf-$(VERSION).tar.gz + +Makefile: Makefile.in + ./config.status + +bench: Makefile liblzf.a bench.c + $(CC) $(CPPFLAGS) $(CFLAGS) -g -o bench bench.c -L. -llzf + diff --git a/SerialICE/lzf/liblzf-3.6/README b/SerialICE/lzf/liblzf-3.6/README new file mode 100644 index 0000000..0734ebe --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/README @@ -0,0 +1,29 @@ +DESCRIPTION + LZF is an extremely fast (not that much slower than a pure memcpy) + compression algorithm. It is ideal for applications where you want to + save *some* space but not at the cost of speed. It is ideal for + repetitive data as well. The module is self-contained and very small. + + It's written in ISO-C with no external dependencies other than what + C provides and can easily be #include'd into your code, no makefile + changes or library builds requires. + + A C♯ implementation without external dependencies is available, too. + + I do not know for certain whether any patents in any countries apply + to this algorithm, but at the moment it is believed that it is free + from any patents. More importantly, it is also free to use in every + software package (see LICENSE). + + See the lzf.h file for details on how the functions in this + mini-library are to be used. + + NOTE: This package contains a very bare-bones command-line utility + which is neither optimized for speed nor for compression. This library + is really intended to be used inside larger programs. + +AUTHOR + This library was written by Marc Lehmann <schmorp(a)schmorp.de> (See also +
http://software.schmorp.de/pkg/liblzf
). + + diff --git a/SerialICE/lzf/liblzf-3.6/config.h b/SerialICE/lzf/liblzf-3.6/config.h new file mode 100644 index 0000000..b5df3b1 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/config.h @@ -0,0 +1,17 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */ + +/* Define to empty if the keyword does not work. */ +/* #undef const */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* The number of bytes in a int. */ +#define SIZEOF_INT 4 + +/* The number of bytes in a long. */ +#define SIZEOF_LONG 4 + +/* The number of bytes in a short. */ +#define SIZEOF_SHORT 2 diff --git a/SerialICE/lzf/liblzf-3.6/config.h.in b/SerialICE/lzf/liblzf-3.6/config.h.in new file mode 100644 index 0000000..5fd69c6 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/config.h.in @@ -0,0 +1,16 @@ +/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */ + +/* Define to empty if the keyword does not work. */ +#undef const + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* The number of bytes in a int. */ +#undef SIZEOF_INT + +/* The number of bytes in a long. */ +#undef SIZEOF_LONG + +/* The number of bytes in a short. */ +#undef SIZEOF_SHORT diff --git a/SerialICE/lzf/liblzf-3.6/config.log b/SerialICE/lzf/liblzf-3.6/config.log new file mode 100644 index 0000000..972b728 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/config.log @@ -0,0 +1,549 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by configure, which was +generated by GNU Autoconf 2.60. Invocation command line was + + $ ./configure + +## --------- ## +## Platform. ## +## --------- ## + +hostname = koekiemonster +uname -m = i686 +uname -r = 2.6.32-24-generic-pae +uname -s = Linux +uname -v = #39-Ubuntu SMP Wed Jul 28 07:39:26 UTC 2010 + +/usr/bin/uname -p = unknown +/bin/uname -X = unknown + +/bin/arch = unknown +/usr/bin/arch -k = unknown +/usr/convex/getsysinfo = unknown +/usr/bin/hostinfo = unknown +/bin/machine = unknown +/usr/bin/oslevel = unknown +/bin/universe = unknown + +PATH: /usr/local/sbin +PATH: /usr/local/bin +PATH: /usr/sbin +PATH: /usr/bin +PATH: /sbin +PATH: /bin +PATH: /usr/games +PATH: /opt/SUNWspro/bin +PATH: /home/schramp +PATH: /usr/users/work/aftertime/ + + +## ----------- ## +## Core tests. ## +## ----------- ## + +configure:1723: checking for gcc +configure:1739: found /usr/bin/gcc +configure:1750: result: gcc +configure:1988: checking for C compiler version +configure:1995: gcc --version >&5 +gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3 +Copyright (C) 2009 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +configure:1998: $? = 0 +configure:2005: gcc -v >&5 +Using built-in specs. +Target: i486-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu +Thread model: posix +gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) +configure:2008: $? = 0 +configure:2015: gcc -V >&5 +gcc: '-V' option must have argument +configure:2018: $? = 1 +configure:2041: checking for C compiler default output file name +configure:2068: gcc conftest.c >&5 +configure:2071: $? = 0 +configure:2117: result: a.out +configure:2122: checking whether the C compiler works +configure:2132: ./a.out +configure:2135: $? = 0 +configure:2152: result: yes +configure:2159: checking whether we are cross compiling +configure:2161: result: no +configure:2164: checking for suffix of executables +configure:2171: gcc -o conftest conftest.c >&5 +configure:2174: $? = 0 +configure:2198: result: +configure:2204: checking for suffix of object files +configure:2230: gcc -c conftest.c >&5 +configure:2233: $? = 0 +configure:2256: result: o +configure:2260: checking whether we are using the GNU C compiler +configure:2289: gcc -c conftest.c >&5 +configure:2295: $? = 0 +configure:2302: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:2305: $? = 0 +configure:2312: test -s conftest.o +configure:2315: $? = 0 +configure:2329: result: yes +configure:2334: checking whether gcc accepts -g +configure:2364: gcc -c -g conftest.c >&5 +configure:2370: $? = 0 +configure:2377: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:2380: $? = 0 +configure:2387: test -s conftest.o +configure:2390: $? = 0 +configure:2520: result: yes +configure:2537: checking for gcc option to accept ISO C89 +configure:2611: gcc -c -g -O2 conftest.c >&5 +configure:2617: $? = 0 +configure:2624: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:2627: $? = 0 +configure:2634: test -s conftest.o +configure:2637: $? = 0 +configure:2657: result: none needed +configure:2683: checking for special C compiler options needed for large files +configure:2810: result: no +configure:2816: checking for _FILE_OFFSET_BITS value needed for large files +configure:2852: gcc -c -g -O2 conftest.c >&5 +conftest.c:15: warning: left shift count >= width of type +conftest.c:15: warning: left shift count >= width of type +conftest.c:17: error: size of array 'off_t_is_large' is negative +configure:2858: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| #define PACKAGE_NAME "" +| #define PACKAGE_TARNAME "" +| #define PACKAGE_VERSION "" +| #define PACKAGE_STRING "" +| #define PACKAGE_BUGREPORT "" +| #define _GNU_SOURCE 1 +| /* end confdefs.h. */ +| #include <sys/types.h> +| /* Check that off_t can represent 2**63 - 1 correctly. +| We can't simply define LARGE_OFF_T to be 9223372036854775807, +| since some C++ compilers masquerading as C compilers +| incorrectly reject 9223372036854775807. */ +| #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +| int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 +| && LARGE_OFF_T % 2147483647 == 1) +| ? 1 : -1]; +| int +| main () +| { +| +| ; +| return 0; +| } +configure:2919: gcc -c -g -O2 conftest.c >&5 +configure:2925: $? = 0 +configure:2932: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:2935: $? = 0 +configure:2942: test -s conftest.o +configure:2945: $? = 0 +configure:2959: result: 64 +configure:2969: checking for _LARGE_FILES value needed for large files +configure:3005: gcc -c -g -O2 conftest.c >&5 +configure:3011: $? = 0 +configure:3018: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:3021: $? = 0 +configure:3028: test -s conftest.o +configure:3031: $? = 0 +configure:3112: result: no +configure:3172: checking for gcc +configure:3199: result: gcc +configure:3437: checking for C compiler version +configure:3444: gcc --version >&5 +gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3 +Copyright (C) 2009 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +configure:3447: $? = 0 +configure:3454: gcc -v >&5 +Using built-in specs. +Target: i486-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu +Thread model: posix +gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) +configure:3457: $? = 0 +configure:3464: gcc -V >&5 +gcc: '-V' option must have argument +configure:3467: $? = 1 +configure:3470: checking whether we are using the GNU C compiler +configure:3539: result: yes +configure:3544: checking whether gcc accepts -g +configure:3730: result: yes +configure:3747: checking for gcc option to accept ISO C89 +configure:3867: result: none needed +configure:3928: checking for ranlib +configure:3944: found /usr/bin/ranlib +configure:3955: result: ranlib +configure:4025: checking for a BSD-compatible install +configure:4081: result: /usr/bin/install -c +configure:4097: checking how to run the C preprocessor +configure:4137: gcc -E conftest.c +configure:4143: $? = 0 +configure:4181: gcc -E conftest.c +conftest.c:10:28: error: ac_nonexistent.h: No such file or directory +configure:4187: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| #define PACKAGE_NAME "" +| #define PACKAGE_TARNAME "" +| #define PACKAGE_VERSION "" +| #define PACKAGE_STRING "" +| #define PACKAGE_BUGREPORT "" +| #define _GNU_SOURCE 1 +| #define _FILE_OFFSET_BITS 64 +| /* end confdefs.h. */ +| #include <ac_nonexistent.h> +configure:4227: result: gcc -E +configure:4256: gcc -E conftest.c +configure:4262: $? = 0 +configure:4300: gcc -E conftest.c +conftest.c:10:28: error: ac_nonexistent.h: No such file or directory +configure:4306: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| #define PACKAGE_NAME "" +| #define PACKAGE_TARNAME "" +| #define PACKAGE_VERSION "" +| #define PACKAGE_STRING "" +| #define PACKAGE_BUGREPORT "" +| #define _GNU_SOURCE 1 +| #define _FILE_OFFSET_BITS 64 +| /* end confdefs.h. */ +| #include <ac_nonexistent.h> +configure:4351: checking for grep that handles long lines and -e +configure:4425: result: /bin/grep +configure:4430: checking for egrep +configure:4508: result: /bin/grep -E +configure:4513: checking for ANSI C header files +configure:4543: gcc -c -g -O2 conftest.c >&5 +configure:4549: $? = 0 +configure:4556: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4559: $? = 0 +configure:4566: test -s conftest.o +configure:4569: $? = 0 +configure:4665: gcc -o conftest -g -O2 conftest.c >&5 +configure:4668: $? = 0 +configure:4674: ./conftest +configure:4677: $? = 0 +configure:4694: result: yes +configure:4719: checking for sys/types.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4719: checking for sys/stat.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4719: checking for stdlib.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4719: checking for string.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4719: checking for memory.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4719: checking for strings.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4719: checking for inttypes.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4719: checking for stdint.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4719: checking for unistd.h +configure:4740: gcc -c -g -O2 conftest.c >&5 +configure:4746: $? = 0 +configure:4753: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4756: $? = 0 +configure:4763: test -s conftest.o +configure:4766: $? = 0 +configure:4779: result: yes +configure:4791: checking for short +configure:4821: gcc -c -g -O2 conftest.c >&5 +configure:4827: $? = 0 +configure:4834: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:4837: $? = 0 +configure:4844: test -s conftest.o +configure:4847: $? = 0 +configure:4859: result: yes +configure:4862: checking size of short +configure:5250: gcc -o conftest -g -O2 conftest.c >&5 +configure:5253: $? = 0 +configure:5259: ./conftest +configure:5262: $? = 0 +configure:5284: result: 2 +configure:5291: checking for int +configure:5321: gcc -c -g -O2 conftest.c >&5 +configure:5327: $? = 0 +configure:5334: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:5337: $? = 0 +configure:5344: test -s conftest.o +configure:5347: $? = 0 +configure:5359: result: yes +configure:5362: checking size of int +configure:5750: gcc -o conftest -g -O2 conftest.c >&5 +configure:5753: $? = 0 +configure:5759: ./conftest +configure:5762: $? = 0 +configure:5784: result: 4 +configure:5791: checking for long +configure:5821: gcc -c -g -O2 conftest.c >&5 +configure:5827: $? = 0 +configure:5834: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:5837: $? = 0 +configure:5844: test -s conftest.o +configure:5847: $? = 0 +configure:5859: result: yes +configure:5862: checking size of long +configure:6250: gcc -o conftest -g -O2 conftest.c >&5 +configure:6253: $? = 0 +configure:6259: ./conftest +configure:6262: $? = 0 +configure:6284: result: 4 +configure:6292: checking for an ANSI C-conforming const +configure:6367: gcc -c -g -O2 conftest.c >&5 +configure:6373: $? = 0 +configure:6380: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:6383: $? = 0 +configure:6390: test -s conftest.o +configure:6393: $? = 0 +configure:6405: result: yes +configure:6415: checking for inline +configure:6441: gcc -c -g -O2 conftest.c >&5 +configure:6447: $? = 0 +configure:6454: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:6457: $? = 0 +configure:6464: test -s conftest.o +configure:6467: $? = 0 +configure:6482: result: inline +configure:6516: checking getopt.h usability +configure:6533: gcc -c -g -O2 conftest.c >&5 +configure:6539: $? = 0 +configure:6546: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:6549: $? = 0 +configure:6556: test -s conftest.o +configure:6559: $? = 0 +configure:6570: result: yes +configure:6574: checking getopt.h presence +configure:6589: gcc -E conftest.c +configure:6595: $? = 0 +configure:6616: result: yes +configure:6644: checking for getopt.h +configure:6652: result: yes +configure:6669: checking for getopt_long +configure:6725: gcc -o conftest -g -O2 conftest.c >&5 +configure:6731: $? = 0 +configure:6738: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:6741: $? = 0 +configure:6748: test -s conftest +configure:6751: $? = 0 +configure:6765: result: yes +configure:6885: creating ./config.status + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.60. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on koekiemonster + +config.status:583: creating Makefile +config.status:583: creating config.h + +## ---------------- ## +## Cache variables. ## +## ---------------- ## + +ac_cv_c_compiler_gnu=yes +ac_cv_c_const=yes +ac_cv_c_inline=inline +ac_cv_env_CC_set= +ac_cv_env_CC_value= +ac_cv_env_CFLAGS_set= +ac_cv_env_CFLAGS_value= +ac_cv_env_CPPFLAGS_set= +ac_cv_env_CPPFLAGS_value= +ac_cv_env_CPP_set= +ac_cv_env_CPP_value= +ac_cv_env_LDFLAGS_set= +ac_cv_env_LDFLAGS_value= +ac_cv_env_build_alias_set= +ac_cv_env_build_alias_value= +ac_cv_env_host_alias_set= +ac_cv_env_host_alias_value= +ac_cv_env_target_alias_set= +ac_cv_env_target_alias_value= +ac_cv_func_getopt_long=yes +ac_cv_header_getopt_h=yes +ac_cv_header_inttypes_h=yes +ac_cv_header_memory_h=yes +ac_cv_header_stdc=yes +ac_cv_header_stdint_h=yes +ac_cv_header_stdlib_h=yes +ac_cv_header_string_h=yes +ac_cv_header_strings_h=yes +ac_cv_header_sys_stat_h=yes +ac_cv_header_sys_types_h=yes +ac_cv_header_unistd_h=yes +ac_cv_objext=o +ac_cv_path_EGREP='/bin/grep -E' +ac_cv_path_GREP=/bin/grep +ac_cv_path_install='/usr/bin/install -c' +ac_cv_prog_CPP='gcc -E' +ac_cv_prog_ac_ct_CC=gcc +ac_cv_prog_ac_ct_RANLIB=ranlib +ac_cv_prog_cc_c89= +ac_cv_prog_cc_g=yes +ac_cv_sizeof_int=4 +ac_cv_sizeof_long=4 +ac_cv_sizeof_short=2 +ac_cv_sys_file_offset_bits=64 +ac_cv_sys_large_files=no +ac_cv_sys_largefile_CC=no +ac_cv_type_int=yes +ac_cv_type_long=yes +ac_cv_type_short=yes + +## ----------------- ## +## Output variables. ## +## ----------------- ## + +CC='gcc' +CFLAGS='-g -O2 -O3 -funroll-all-loops' +CPP='gcc -E' +CPPFLAGS='' +DEFS='-DHAVE_CONFIG_H' +ECHO_C='' +ECHO_N='-n' +ECHO_T='' +EGREP='/bin/grep -E' +EXEEXT='' +GREP='/bin/grep' +INSTALL_DATA='${INSTALL} -m 644' +INSTALL_PROGRAM='${INSTALL}' +INSTALL_SCRIPT='${INSTALL}' +LDFLAGS='' +LIBOBJS='' +LIBS='' +LTLIBOBJS='' +OBJEXT='o' +PACKAGE_BUGREPORT='' +PACKAGE_NAME='' +PACKAGE_STRING='' +PACKAGE_TARNAME='' +PACKAGE_VERSION='' +PATH_SEPARATOR=':' +RANLIB='ranlib' +SHELL='/bin/bash' +ac_ct_CC='gcc' +bindir='${exec_prefix}/bin' +build_alias='' +datadir='${datarootdir}' +datarootdir='${prefix}/share' +docdir='${datarootdir}/doc/${PACKAGE}' +dvidir='${docdir}' +exec_prefix='${prefix}' +host_alias='' +htmldir='${docdir}' +includedir='${prefix}/include' +infodir='${datarootdir}/info' +libdir='${exec_prefix}/lib' +libexecdir='${exec_prefix}/libexec' +localedir='${datarootdir}/locale' +localstatedir='${prefix}/var' +mandir='${datarootdir}/man' +oldincludedir='/usr/include' +pdfdir='${docdir}' +prefix='/usr/local' +program_transform_name='s,x,x,' +psdir='${docdir}' +sbindir='${exec_prefix}/sbin' +sharedstatedir='${prefix}/com' +sysconfdir='${prefix}/etc' +target_alias='' + +## ----------- ## +## confdefs.h. ## +## ----------- ## + +#define PACKAGE_NAME "" +#define PACKAGE_TARNAME "" +#define PACKAGE_VERSION "" +#define PACKAGE_STRING "" +#define PACKAGE_BUGREPORT "" +#define _GNU_SOURCE 1 +#define _FILE_OFFSET_BITS 64 +#define STDC_HEADERS 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_UNISTD_H 1 +#define SIZEOF_SHORT 2 +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +#define HAVE_GETOPT_H 1 +#define HAVE_GETOPT_LONG 1 + +configure: exit 0 diff --git a/SerialICE/lzf/liblzf-3.6/config.status b/SerialICE/lzf/liblzf-3.6/config.status new file mode 100644 index 0000000..a76542b --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/config.status @@ -0,0 +1,827 @@ +#! /bin/bash +# Generated by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=${CONFIG_SHELL-/bin/bash} +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +# Find out whether ``test -x'' works. Don't use a zero-byte file, as +# systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + as_executable_p="test -x" +else + as_executable_p=: +fi +rm -f conf$$.file + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by $as_me, which was +generated by GNU Autoconf 2.60. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +# Files that config.status was made for. +config_files=" Makefile" +config_headers=" config.h" + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to <bug-autoconf(a)gnu.org>." + +ac_cs_version="\ +config.status +configured by ./configure, generated by GNU Autoconf 2.60, + with options \"\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='/usr/users/work/serialice/SerialICE-1.5/lzf/liblzf-3.6' +srcdir='.' +INSTALL='/usr/bin/install -c' +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +if $ac_cs_recheck; then + echo "running CONFIG_SHELL=/bin/bash /bin/bash ./configure " $ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=/bin/bash + export CONFIG_SHELL + exec /bin/bash "./configure" $ac_configure_extra_args --no-create --no-recursion +fi + +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +cat >"$tmp/subs-1.sed" <<\CEOF +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +s,@SHELL@,|#_!!_#|/bin/bash,g +s,@PATH_SEPARATOR@,|#_!!_#|:,g +s,@PACKAGE_NAME@,|#_!!_#|,g +s,@PACKAGE_TARNAME@,|#_!!_#|,g +s,@PACKAGE_VERSION@,|#_!!_#|,g +s,@PACKAGE_STRING@,|#_!!_#|,g +s,@PACKAGE_BUGREPORT@,|#_!!_#|,g +s,@exec_prefix@,|#_!!_#|${prefix},g +s,@prefix@,|#_!!_#|/usr/local,g +s,@program_transform_name@,|#_!!_#|s\,x\,x\,,g +s,@bindir@,|#_!!_#|${exec_prefix}/bin,g +s,@sbindir@,|#_!!_#|${exec_prefix}/sbin,g +s,@libexecdir@,|#_!!_#|${exec_prefix}/libexec,g +s,@datarootdir@,|#_!!_#|${prefix}/share,g +s,@datadir@,|#_!!_#|${datarootdir},g +s,@sysconfdir@,|#_!!_#|${prefix}/etc,g +s,@sharedstatedir@,|#_!!_#|${prefix}/com,g +s,@localstatedir@,|#_!!_#|${prefix}/var,g +s,@includedir@,|#_!!_#|${prefix}/include,g +s,@oldincludedir@,|#_!!_#|/usr/include,g +s,@docdir@,|#_!!_#|${datarootdir}/doc/${PACKAGE},g +s,@infodir@,|#_!!_#|${datarootdir}/info,g +s,@htmldir@,|#_!!_#|${docdir},g +s,@dvidir@,|#_!!_#|${docdir},g +s,@pdfdir@,|#_!!_#|${docdir},g +s,@psdir@,|#_!!_#|${docdir},g +s,@libdir@,|#_!!_#|${exec_prefix}/lib,g +s,@localedir@,|#_!!_#|${datarootdir}/locale,g +s,@mandir@,|#_!!_#|${datarootdir}/man,g +s,@DEFS@,|#_!!_#|-DHAVE_CONFIG_H,g +s,@ECHO_C@,|#_!!_#|,g +s,@ECHO_N@,|#_!!_#|-n,g +s,@ECHO_T@,|#_!!_#|,g +s,@LIBS@,|#_!!_#|,g +s,@build_alias@,|#_!!_#|,g +s,@host_alias@,|#_!!_#|,g +s,@target_alias@,|#_!!_#|,g +s,@CC@,|#_!!_#|gcc,g +s,@CFLAGS@,|#_!!_#|-g -O2 -O3 -funroll-all-loops,g +s,@LDFLAGS@,|#_!!_#|,g +s,@CPPFLAGS@,|#_!!_#|,g +s,@ac_ct_CC@,|#_!!_#|gcc,g +s,@EXEEXT@,|#_!!_#|,g +s,@OBJEXT@,|#_!!_#|o,g +s,@RANLIB@,|#_!!_#|ranlib,g +s,@INSTALL_PROGRAM@,|#_!!_#|${INSTALL},g +s,@INSTALL_SCRIPT@,|#_!!_#|${INSTALL},g +s,@INSTALL_DATA@,|#_!!_#|${INSTALL} -m 644,g +s,@CPP@,|#_!!_#|gcc -E,g +s,@GREP@,|#_!!_#|/bin/grep,g +s,@EGREP@,|#_!!_#|/bin/grep -E,g +s,@LIBOBJS@,|#_!!_#|,g +s,@LTLIBOBJS@,|#_!!_#|,g +:end +s/|#_!!_#|//g +CEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + ac_datarootdir_hack=' + s&@datadir@&${datarootdir}&g + s&@docdir@&${datarootdir}/doc/${PACKAGE}&g + s&@infodir@&${datarootdir}/info&g + s&@localedir@&${datarootdir}/locale&g + s&@mandir@&${datarootdir}/man&g + s&\${datarootdir}&${prefix}/share&g' ;; +esac + sed "/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +} + +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + :H) + # + # CONFIG_HEADER + # + # First, check the format of the line: + cat >"$tmp/defines.sed" <<\CEOF +/^[ ]*#[ ]*undef[ ][ ]*[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*[ ]*$/b def +/^[ ]*#[ ]*define[ ][ ]*[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*[( ]/b def +b +:def +s/$/ / +s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_NAME\)[ (].*,\1define\2 "" , +s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_TARNAME\)[ (].*,\1define\2 "" , +s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_VERSION\)[ (].*,\1define\2 "" , +s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_STRING\)[ (].*,\1define\2 "" , +s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_BUGREPORT\)[ (].*,\1define\2 "" , +s,^\([ #]*\)[^ ]*\([ ]*_GNU_SOURCE\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*_FILE_OFFSET_BITS\)[ (].*,\1define\2 64 , +s,^\([ #]*\)[^ ]*\([ ]*STDC_HEADERS\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_TYPES_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_STAT_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_STDLIB_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRING_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_MEMORY_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRINGS_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_INTTYPES_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_STDINT_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_UNISTD_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*SIZEOF_SHORT\)[ (].*,\1define\2 2 , +s,^\([ #]*\)[^ ]*\([ ]*SIZEOF_INT\)[ (].*,\1define\2 4 , +s,^\([ #]*\)[^ ]*\([ ]*SIZEOF_LONG\)[ (].*,\1define\2 4 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_GETOPT_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_GETOPT_LONG\)[ (].*,\1define\2 1 , +s/ $// +s,^[ #]*u.*,/* & */, +CEOF + sed -f "$tmp/defines.sed" $ac_file_inputs >"$tmp/out1" +ac_result="$tmp/out1" + if test x"$ac_file" != x-; then + echo "/* $configure_input */" >"$tmp/config.h" + cat "$ac_result" >>"$tmp/config.h" + if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f $ac_file + mv "$tmp/config.h" $ac_file + fi + else + echo "/* $configure_input */" + cat "$ac_result" + fi + rm -f "$tmp/out12" + ;; + + + esac + +done # for ac_tag + + +{ (exit 0); exit 0; } diff --git a/SerialICE/lzf/liblzf-3.6/configure.ac b/SerialICE/lzf/liblzf-3.6/configure.ac new file mode 100644 index 0000000..58316a0 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/configure.ac @@ -0,0 +1,25 @@ +AC_INIT +AC_CONFIG_SRCDIR([lzfP.h]) + +AC_CONFIG_HEADER(config.h) + +AC_GNU_SOURCE +AC_SYS_LARGEFILE +AC_PROG_CC +AC_PROG_RANLIB +AC_PROG_INSTALL +AC_HEADER_STDC + +AC_C_CONST +AC_C_INLINE +AC_CHECK_HEADERS(getopt.h) +AC_CHECK_FUNCS(getopt_long) + +if test "$GCC" = yes; then + CFLAGS="$CFLAGS -O3 -funroll-all-loops" +else + AC_MSG_RESULT(no gcc) +fi + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/SerialICE/lzf/liblzf-3.6/crc32.h b/SerialICE/lzf/liblzf-3.6/crc32.h new file mode 100644 index 0000000..cf8f6d4 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/crc32.h @@ -0,0 +1,65 @@ +#ifndef CRC32_H +#define CRC32_H + +/* crc32 0xdebb20e3 table and supplementary functions. */ + +static const u32 crc_32_tab[] = +{ + 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, + 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, + 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, + 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, + 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, + 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, + 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, + 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, + 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, + 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, + 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, + 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, + 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, + 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, + 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, + 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, + 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, + 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, + 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, + 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, + 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, + 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, + 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, + 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, + 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, + 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, + 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, + 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, + 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, + 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, + 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, + 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, + 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, + 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, + 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, + 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, + 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, + 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, + 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, + 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, + 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, + 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, + 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, + 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, + 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, + 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, + 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, + 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, + 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, + 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, + 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, + 0x2d02ef8dL +}; + +#define crc32(crc,byte) (crc_32_tab[(u8)(crc) ^ (u8)(byte)] ^ ((crc) >> 8)) + +#endif + diff --git a/SerialICE/lzf/liblzf-3.6/cs/CLZF.cs b/SerialICE/lzf/liblzf-3.6/cs/CLZF.cs new file mode 100644 index 0000000..710419a --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/cs/CLZF.cs @@ -0,0 +1,344 @@ +/* + * Copyright (c) 2005 Oren J. Maurice <oymaurice(a)hazorea.org.il> + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, 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. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, 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 OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License version 2 (the "GPL"), in which case the + * provisions of the GPL are applicable instead of the above. If you wish to + * allow the use of your version of this file only under the terms of the + * GPL and not to allow others to use your version of this file under the + * BSD license, indicate your decision by deleting the provisions above and + * replace them with the notice and other provisions required by the GPL. If + * you do not delete the provisions above, a recipient may use your version + * of this file under either the BSD or the GPL. + */ + +using System; + +namespace
LZF.NET
+{ + + /// <summary> + /// Summary description for CLZF. + /// </summary> + public class CLZF + { + // CRC32 data & function + UInt32 []crc_32_tab = new UInt32[256] + { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d + }; + + public UInt32 crc32(UInt32 OldCRC,byte NewData) + { + return crc_32_tab[(OldCRC & 0xff) ^ NewData] ^ (OldCRC >> 8); + } + + + /// <summary> + /// LZF Compressor + /// </summary> + + UInt32 HLOG=14; + UInt32 HSIZE=(1<<14); + + /* + * don't play with this unless you benchmark! + * decompression is not dependent on the hash function + * the hashing function might seem strange, just believe me + * it works ;) + */ + UInt32 MAX_LIT=(1 << 5); + UInt32 MAX_OFF=(1 << 13); + UInt32 MAX_REF=((1 << 8) + (1 << 3)); + + UInt32 FRST(byte[] Array,UInt32 ptr) + { + return (UInt32)(((Array[ptr]) << 8) | Array[ptr+1]); + } + + UInt32 NEXT(UInt32 v,byte[] Array,UInt32 ptr) + { + return ((v) << 8) | Array[ptr+2]; + } + + UInt32 IDX(UInt32 h) + { + return ((((h ^ (h << 5)) >> (int) (3*8 - HLOG)) - h*5) & (HSIZE - 1)); + } + + /* + * compressed format + * + * 000LLLLL <L+1> ; literal + * LLLOOOOO oooooooo ; backref L + * 111OOOOO LLLLLLLL oooooooo ; backref L+7 + * + */ + + public int lzf_compress (byte[] in_data, int in_len,byte[] out_data, int out_len) + { + int c; + long []htab=new long[1<<14]; + for (c=0;c<1<<14;c++) + { + htab[c]=0; + } + + long hslot; + UInt32 iidx = 0; + UInt32 oidx = 0; + //byte *in_end = ip + in_len; + //byte *out_end = op + out_len; + long reference; + + UInt32 hval = FRST (in_data,iidx); + long off; + int lit = 0; + + for (;;) + { + if (iidx < in_len - 2) + { + hval = NEXT (hval, in_data,iidx); + hslot = IDX (hval); + reference = htab[hslot]; + htab[hslot] = (long)iidx; + + if ((off = iidx - reference - 1) < MAX_OFF + && iidx + 4 < in_len + && reference > 0 + && in_data[reference+0] == in_data[iidx+0] + && in_data[reference+1] == in_data[iidx+1] + && in_data[reference+2] == in_data[iidx+2] + ) + { + /* match found at *reference++ */ + UInt32 len = 2; + UInt32 maxlen = (UInt32)in_len - iidx - len; + maxlen = maxlen > MAX_REF ? MAX_REF : maxlen; + + if (oidx + lit + 1 + 3 >= out_len) + return 0; + + do + len++; + while (len < maxlen && in_data[reference+len] == in_data[iidx+len]); + + if (lit!=0) + { + out_data[oidx++] = (byte)(lit - 1); + lit = -lit; + do + out_data[oidx++] = in_data[iidx+lit]; + while ((++lit)!=0); + } + + len -= 2; + iidx++; + + if (len < 7) + { + out_data[oidx++] = (byte)((off >> 8) + (len << 5)); + } + else + { + out_data[oidx++] = (byte)((off >> 8) + ( 7 << 5)); + out_data[oidx++] = (byte)(len - 7); + } + + out_data[oidx++] = (byte)off; + + iidx += len-1; + hval = FRST (in_data,iidx); + + hval = NEXT (hval,in_data, iidx); + htab[IDX (hval)] = iidx; + iidx++; + + hval = NEXT (hval, in_data,iidx); + htab[IDX (hval)] = iidx; + iidx++; + continue; + } + } + else if (iidx == in_len) + break; + + /* one more literal byte we must copy */ + lit++; + iidx++; + + if (lit == MAX_LIT) + { + if (oidx + 1 + MAX_LIT >= out_len) + return 0; + + out_data[oidx++] = (byte)(MAX_LIT - 1); + lit = -lit; + do + out_data[oidx++] = in_data[iidx+lit]; + while ((++lit)!=0); + } + } + + if (lit!=0) + { + if (oidx + lit + 1 >= out_len) + return 0; + + out_data[oidx++] = (byte)(lit - 1); + lit = -lit; + do + out_data[oidx++] = in_data[iidx+lit]; + while ((++lit)!=0); + } + + return (int)oidx; + } + + /// <summary> + /// LZF Decompressor + /// </summary> + public int lzf_decompress ( byte[] in_data, int in_len, byte[] out_data, int out_len) + { + UInt32 iidx=0; + UInt32 oidx=0; + + do + { + UInt32 ctrl = in_data[iidx++]; + + if (ctrl < (1 << 5)) /* literal run */ + { + ctrl++; + + if (oidx + ctrl > out_len) + { + //SET_ERRNO (E2BIG); + return 0; + } + + do + out_data[oidx++] = in_data[iidx++]; + while ((--ctrl)!=0); + } + else /* back reference */ + { + UInt32 len = ctrl >> 5; + + int reference = (int)(oidx - ((ctrl & 0x1f) << 8) - 1); + + if (len == 7) + len += in_data[iidx++]; + + reference -= in_data[iidx++]; + + if (oidx + len + 2 > out_len) + { + //SET_ERRNO (E2BIG); + return 0; + } + + if (reference < 0) + { + //SET_ERRNO (EINVAL); + return 0; + } + + out_data[oidx++]=out_data[reference++]; + out_data[oidx++]=out_data[reference++]; + + do + out_data[oidx++]=out_data[reference++]; + while ((--len)!=0); + } + } + while (iidx < in_len); + + return (int)oidx; + } + + public CLZF() + { + // + // TODO: Add ructor logic here + // + } + } +} + diff --git a/SerialICE/lzf/liblzf-3.6/cs/README b/SerialICE/lzf/liblzf-3.6/cs/README new file mode 100644 index 0000000..9964aff --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/cs/README @@ -0,0 +1,7 @@ +The C♯ implementation of the LZF en-/decoder functions in this +directory was written (and is maintained) by + + Oren J. Maurice <oymaurice(a)hazorea.org.il>. + +If you have any questions or improvements, you should contact the +original author (and maybe CC me, Marc Lehmann <liblzf(a)schmorp.de>). diff --git a/SerialICE/lzf/liblzf-3.6/install-sh b/SerialICE/lzf/liblzf-3.6/install-sh new file mode 100644 index 0000000..e9de238 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/SerialICE/lzf/liblzf-3.6/lzf.c b/SerialICE/lzf/liblzf-3.6/lzf.c new file mode 100644 index 0000000..bedfdb6 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/lzf.c @@ -0,0 +1,537 @@ +/* + * Copyright (c) 2006 Stefan Traby <stefan(a)hello-penguin.com> + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, 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 OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#include "config.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#include <limits.h> +#include "lzf.h" + +#ifdef HAVE_GETOPT_H +# include <getopt.h> +#endif + +#define BLOCKSIZE (1024 * 64 - 1) +#define MAX_BLOCKSIZE BLOCKSIZE + +typedef unsigned char u8; + +static off_t nr_read, nr_written; + +static const char *imagename; +static enum { compress, uncompress, lzcat } mode = compress; +static int verbose = 0; +static int force = 0; +static long blocksize = BLOCKSIZE; + +#ifdef HAVE_GETOPT_LONG + + struct option longopts[] = { + {"compress", 0, 0, 'c'}, + {"decompress", 0, 0, 'd'}, + {"uncompress", 0, 0, 'd'}, + {"force", 0, 0, 'f'}, + {"help", 0, 0, 'h'}, + {"verbose", 0, 0, 'v'}, + {"blocksize", 1, 0, 'b'}, + {0, 0, 0, 0} + }; + + static const char *opt = + "-c --compress compress\n" + "-d --decompress decompress\n" + "-f --force force overwrite of output file\n" + "-h --help give this help\n" "-v --verbose verbose mode\n" "-b # --blocksize # set blocksize\n" "\n"; + +#else + + static const char *opt = + "-c compress\n" + "-d decompress\n" + "-f force overwrite of output file\n" + "-h give this help\n" + "-v verbose mode\n" + "-b # set blocksize\n" + "\n"; + +#endif + +static void +usage (int rc) +{ + fprintf (stderr, "\n" + "lzf, a very lightweight compression/decompression utility written by Stefan Traby.\n" + "uses liblzf written by Marc Lehmann <schmorp(a)schmorp.de> You can find more info at\n" + "
http://liblzf.plan9.de/\n
" + "\n" + "usage: lzf [-dufhvb] [file ...]\n" + " unlzf [file ...]\n" + " lzcat [file ...]\n" + "\n%s", + opt); + + exit (rc); +} + +static inline ssize_t +rread (int fd, void *buf, size_t len) +{ + ssize_t rc = 0, offset = 0; + char *p = buf; + + while (len && (rc = read (fd, &p[offset], len)) > 0) + { + offset += rc; + len -= rc; + } + + nr_read += offset; + + if (rc < 0) + return rc; + + return offset; +} + +/* returns 0 if all written else -1 */ +static inline ssize_t +wwrite (int fd, void *buf, size_t len) +{ + ssize_t rc; + char *b = buf; + size_t l = len; + + while (l) + { + rc = write (fd, b, l); + if (rc < 0) + { + fprintf (stderr, "%s: write error: ", imagename); + perror (""); + return -1; + } + + l -= rc; + b += rc; + } + + nr_written += len; + return 0; +} + +/* + * Anatomy: an lzf file consists of any number of blocks in the following format: + * + * \x00 EOF (optional) + * "ZV\0" 2-byte-usize <uncompressed data> + * "ZV\1" 2-byte-csize 2-byte-usize <compressed data> + * "ZV\2" 4-byte-crc32-0xdebb20e3 (NYI) + */ + + +#define TYPE0_HDR_SIZE 5 +#define TYPE1_HDR_SIZE 7 +#define MAX_HDR_SIZE 7 +#define MIN_HDR_SIZE 5 + +static int +compress_fd (int from, int to) +{ + ssize_t us, cs, len; + u8 buf1[MAX_BLOCKSIZE + MAX_HDR_SIZE + 16]; + u8 buf2[MAX_BLOCKSIZE + MAX_HDR_SIZE + 16]; + u8 *header; + + nr_read = nr_written = 0; + while ((us = rread (from, &buf1[MAX_HDR_SIZE], blocksize)) > 0) + { + cs = lzf_compress (&buf1[MAX_HDR_SIZE], us, &buf2[MAX_HDR_SIZE], us > 4 ? us - 4 : us); + if (cs) + { + header = &buf2[MAX_HDR_SIZE - TYPE1_HDR_SIZE]; + header[0] = 'Z'; + header[1] = 'V'; + header[2] = 1; + header[3] = cs >> 8; + header[4] = cs & 0xff; + header[5] = us >> 8; + header[6] = us & 0xff; + len = cs + TYPE1_HDR_SIZE; + } + else + { // write uncompressed + header = &buf1[MAX_HDR_SIZE - TYPE0_HDR_SIZE]; + header[0] = 'Z'; + header[1] = 'V'; + header[2] = 0; + header[3] = us >> 8; + header[4] = us & 0xff; + len = us + TYPE0_HDR_SIZE; + } + + if (wwrite (to, header, len) == -1) + return -1; + } + + return 0; +} + +static int +uncompress_fd (int from, int to) +{ + u8 header[MAX_HDR_SIZE]; + u8 buf1[MAX_BLOCKSIZE + MAX_HDR_SIZE + 16]; + u8 buf2[MAX_BLOCKSIZE + MAX_HDR_SIZE + 16]; + u8 *p; + int l, rd; + ssize_t rc, cs, us, bytes, over = 0; + + nr_read = nr_written = 0; + while (1) + { + rc = rread (from, header + over, MAX_HDR_SIZE - over); + if (rc < 0) + { + fprintf (stderr, "%s: read error: ", imagename); + perror (""); + return -1; + } + + rc += over; + over = 0; + if (!rc || header[0] == 0) + return 0; + + if (rc < MIN_HDR_SIZE || header[0] != 'Z' || header[1] != 'V') + { + fprintf (stderr, "%s: invalid data stream - magic not found or short header\n", imagename); + return -1; + } + + switch (header[2]) + { + case 0: + cs = -1; + us = (header[3] << 8) | header[4]; + p = &header[TYPE0_HDR_SIZE]; + break; + case 1: + if (rc < TYPE1_HDR_SIZE) + { + goto short_read; + } + cs = (header[3] << 8) | header[4]; + us = (header[5] << 8) | header[6]; + p = &header[TYPE1_HDR_SIZE]; + break; + default: + fprintf (stderr, "%s: unknown blocktype\n", imagename); + return -1; + } + + bytes = cs == -1 ? us : cs; + l = &header[rc] - p; + + if (l > 0) + memcpy (buf1, p, l); + + if (l > bytes) + { + over = l - bytes; + memmove (header, &p[bytes], over); + } + + p = &buf1[l]; + rd = bytes - l; + if (rd > 0) + if ((rc = rread (from, p, rd)) != rd) + goto short_read; + + if (cs == -1) + { + if (wwrite (to, buf1, us)) + return -1; + } + else + { + if (lzf_decompress (buf1, cs, buf2, us) != us) + { + fprintf (stderr, "%s: decompress: invalid stream - data corrupted\n", imagename); + return -1; + } + + if (wwrite (to, buf2, us)) + return -1; + } + } + + return 0; + +short_read: + fprintf (stderr, "%s: short data\n", imagename); + return -1; +} + +static int +open_out (const char *name) +{ + int fd; + int m = O_EXCL; + + if (force) + m = 0; + + fd = open (name, O_CREAT | O_WRONLY | O_TRUNC | m, 600); +#if defined(__MINGW32__) + _setmode(fd, _O_BINARY); +#endif + return fd; +} + +static int +compose_name (const char *fname, char *oname) +{ + char *p; + + if (mode == compress) + { + if (strlen (fname) > PATH_MAX - 4) + { + fprintf (stderr, "%s: %s.lzf: name too long", imagename, fname); + return -1; + } + + strcpy (oname, fname); + strcat (oname, ".lzf"); + } + else + { + if (strlen (fname) > PATH_MAX) + { + fprintf (stderr, "%s: %s: name too long\n", imagename, fname); + return -1; + } + + strcpy (oname, fname); + p = &oname[strlen (oname)] - 4; + if (p < oname || strcmp (p, ".lzf")) + { + fprintf (stderr, "%s: %s: unknown suffix\n", imagename, fname); + return -1; + } + + *p = 0; + } + + return 0; +} + +static int +run_file (const char *fname) +{ + int fd, fd2; + int rc; + struct stat mystat; + char oname[PATH_MAX + 1]; + + if (mode != lzcat) + if (compose_name (fname, oname)) + return -1; + +#if !defined(__MINGW32__) + rc = lstat (fname, &mystat); +#else + rc = stat (fname, &mystat); +#endif + fd = open (fname, O_RDONLY); +#if defined(__MINGW32__) + _setmode(fd, _O_BINARY); +#endif + if (rc || fd == -1) + { + fprintf (stderr, "%s: %s: ", imagename, fname); + perror (""); + return -1; + } + + if (!S_ISREG (mystat.st_mode)) + { + fprintf (stderr, "%s: %s: not a regular file.\n", imagename, fname); + close (fd); + return -1; + } + + if (mode == lzcat) + { + rc = uncompress_fd (fd, 1); + close (fd); + return rc; + } + + fd2 = open_out (oname); + if (fd2 == -1) + { + fprintf (stderr, "%s: %s: ", imagename, oname); + perror (""); + close (fd); + return -1; + } + + if (mode == compress) + { + rc = compress_fd (fd, fd2); + if (!rc && verbose) + fprintf (stderr, "%s: %5.1f%% -- replaced with %s\n", + fname, nr_read == 0 ? 0 : 100.0 - nr_written / ((double) nr_read / 100.0), oname); + } + else + { + rc = uncompress_fd (fd, fd2); + if (!rc && verbose) + fprintf (stderr, "%s: %5.1f%% -- replaced with %s\n", + fname, nr_written == 0 ? 0 : 100.0 - nr_read / ((double) nr_written / 100.0), oname); + } + +#if !defined(__MINGW32__) + fchmod (fd2, mystat.st_mode); +#else + chmod (oname, mystat.st_mode); +#endif + close (fd); + close (fd2); + + if (!rc) + unlink (fname); + + return rc; +} + +int +main (int argc, char *argv[]) +{ + char *p = argv[0]; + int optc; + int rc = 0; + + errno = 0; + p = getenv ("LZF_BLOCKSIZE"); + if (p) + { + blocksize = strtoul (p, 0, 0); + if (errno || !blocksize || blocksize > MAX_BLOCKSIZE) + blocksize = BLOCKSIZE; + } + + p = strrchr (argv[0], '/'); + imagename = p ? ++p : argv[0]; + + if (!strncmp (imagename, "un", 2) || !strncmp (imagename, "de", 2)) + mode = uncompress; + + if (strstr (imagename, "cat")) + mode = lzcat; + +#ifdef HAVE_GETOPT_LONG + while ((optc = getopt_long (argc, argv, "cdfhvb:", longopts, 0)) != -1) +#else + while ((optc = getopt (argc, argv, "cdfhvb:")) != -1) +#endif + { + switch (optc) + { + case 'c': + mode = compress; + break; + case 'd': + mode = uncompress; + break; + case 'f': + force = 1; + break; + case 'h': + usage (0); + break; + case 'v': + verbose = 1; + break; + case 'b': + errno = 0; + blocksize = strtoul (optarg, 0, 0); + if (errno || !blocksize || blocksize > MAX_BLOCKSIZE) + blocksize = BLOCKSIZE; + break; + default: + usage (1); + break; + } + } + + if (optind == argc) + { // stdin stdout + if (!force) + { + if ((mode == uncompress || mode == lzcat) && isatty (0)) + { + fprintf (stderr, "%s: compressed data not read from a terminal. Use -f to force decompression.\n", imagename); + exit (1); + } + if (mode == compress && isatty (1)) + { + fprintf (stderr, "%s: compressed data not written to a terminal. Use -f to force compression.\n", imagename); + exit (1); + } + } + + if (mode == compress) + rc = compress_fd (0, 1); + else + rc = uncompress_fd (0, 1); + + exit (rc ? 1 : 0); + } + + while (optind < argc) + rc |= run_file (argv[optind++]); + + exit (rc ? 1 : 0); +} + diff --git a/SerialICE/lzf/liblzf-3.6/lzf.h b/SerialICE/lzf/liblzf-3.6/lzf.h new file mode 100644 index 0000000..919b6e6 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/lzf.h @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2000-2008 Marc Alexander Lehmann <schmorp(a)schmorp.de> + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, 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 OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#ifndef LZF_H +#define LZF_H + +/*********************************************************************** +** +** lzf -- an extremely fast/free compression/decompression-method +**
http://liblzf.plan9.de/
+** +** This algorithm is believed to be patent-free. +** +***********************************************************************/ + +#define LZF_VERSION 0x0105 /* 1.5, API version */ + +/* + * Compress in_len bytes stored at the memory block starting at + * in_data and write the result to out_data, up to a maximum length + * of out_len bytes. + * + * If the output buffer is not large enough or any error occurs return 0, + * otherwise return the number of bytes used, which might be considerably + * more than in_len (but less than 104% of the original size), so it + * makes sense to always use out_len == in_len - 1), to ensure _some_ + * compression, and store the data uncompressed otherwise (with a flag, of + * course. + * + * lzf_compress might use different algorithms on different systems and + * even different runs, thus might result in different compressed strings + * depending on the phase of the moon or similar factors. However, all + * these strings are architecture-independent and will result in the + * original data when decompressed using lzf_decompress. + * + * The buffers must not be overlapping. + * + * If the option LZF_STATE_ARG is enabled, an extra argument must be + * supplied which is not reflected in this header file. Refer to lzfP.h + * and lzf_c.c. + * + */ +unsigned int +lzf_compress (const void *const in_data, unsigned int in_len, + void *out_data, unsigned int out_len); + +/* + * Decompress data compressed with some version of the lzf_compress + * function and stored at location in_data and length in_len. The result + * will be stored at out_data up to a maximum of out_len characters. + * + * If the output buffer is not large enough to hold the decompressed + * data, a 0 is returned and errno is set to E2BIG. Otherwise the number + * of decompressed bytes (i.e. the original length of the data) is + * returned. + * + * If an error in the compressed data is detected, a zero is returned and + * errno is set to EINVAL. + * + * This function is very fast, about as fast as a copying loop. + */ +unsigned int +lzf_decompress (const void *const in_data, unsigned int in_len, + void *out_data, unsigned int out_len); + +#endif + diff --git a/SerialICE/lzf/liblzf-3.6/lzfP.h b/SerialICE/lzf/liblzf-3.6/lzfP.h new file mode 100644 index 0000000..7b7feda --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/lzfP.h @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2000-2007 Marc Alexander Lehmann <schmorp(a)schmorp.de> + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, 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 OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#ifndef LZFP_h +#define LZFP_h + +#define STANDALONE 1 /* at the moment, this is ok. */ + +#ifndef STANDALONE +# include "lzf.h" +#endif + +/* + * Size of hashtable is (1 << HLOG) * sizeof (char *) + * decompression is independent of the hash table size + * the difference between 15 and 14 is very small + * for small blocks (and 14 is usually a bit faster). + * For a low-memory/faster configuration, use HLOG == 13; + * For best compression, use 15 or 16 (or more, up to 22). + */ +#ifndef HLOG +# define HLOG 16 +#endif + +/* + * Sacrifice very little compression quality in favour of compression speed. + * This gives almost the same compression as the default code, and is + * (very roughly) 15% faster. This is the preferred mode of operation. + */ +#ifndef VERY_FAST +# define VERY_FAST 1 +#endif + +/* + * Sacrifice some more compression quality in favour of compression speed. + * (roughly 1-2% worse compression for large blocks and + * 9-10% for small, redundant, blocks and >>20% better speed in both cases) + * In short: when in need for speed, enable this for binary data, + * possibly disable this for text data. + */ +#ifndef ULTRA_FAST +# define ULTRA_FAST 0 +#endif + +/* + * Unconditionally aligning does not cost very much, so do it if unsure + */ +#ifndef STRICT_ALIGN +# define STRICT_ALIGN !(defined(__i386) || defined (__amd64)) +#endif + +/* + * You may choose to pre-set the hash table (might be faster on some + * modern cpus and large (>>64k) blocks, and also makes compression + * deterministic/repeatable when the configuration otherwise is the same). + */ +#ifndef INIT_HTAB +# define INIT_HTAB 0 +#endif + +/* + * Avoid assigning values to errno variable? for some embedding purposes + * (linux kernel for example), this is necessary. NOTE: this breaks + * the documentation in lzf.h. Avoiding errno has no speed impact. + */ +#ifndef AVOID_ERRNO +# define AVOID_ERRNO 0 +#endif + +/* + * Whether to pass the LZF_STATE variable as argument, or allocate it + * on the stack. For small-stack environments, define this to 1. + * NOTE: this breaks the prototype in lzf.h. + */ +#ifndef LZF_STATE_ARG +# define LZF_STATE_ARG 0 +#endif + +/* + * Whether to add extra checks for input validity in lzf_decompress + * and return EINVAL if the input stream has been corrupted. This + * only shields against overflowing the input buffer and will not + * detect most corrupted streams. + * This check is not normally noticeable on modern hardware + * (<1% slowdown), but might slow down older cpus considerably. + */ +#ifndef CHECK_INPUT +# define CHECK_INPUT 1 +#endif + +/* + * Whether to store pointers or offsets inside the hash table. On + * 64 bit architetcures, pointers take up twice as much space, + * and might also be slower. Default is to autodetect. + */ +/*#define LZF_USER_OFFSETS autodetect */ + +/*****************************************************************************/ +/* nothing should be changed below */ + +#ifdef __cplusplus +# include <cstring> +# include <climits> +using namespace std; +#else +# include <string.h> +# include <limits.h> +#endif + +#ifndef LZF_USE_OFFSETS +# if defined (WIN32) +# define LZF_USE_OFFSETS defined(_M_X64) +# else +# if __cplusplus > 199711L +# include <cstdint> +# else +# include <stdint.h> +# endif +# define LZF_USE_OFFSETS (UINTPTR_MAX > 0xffffffffU) +# endif +#endif + +typedef unsigned char u8; + +#if LZF_USE_OFFSETS +# define LZF_HSLOT_BIAS ((const u8 *)in_data) + typedef unsigned int LZF_HSLOT; +#else +# define LZF_HSLOT_BIAS 0 + typedef const u8 *LZF_HSLOT; +#endif + +typedef LZF_HSLOT LZF_STATE[1 << (HLOG)]; + +#if !STRICT_ALIGN +/* for unaligned accesses we need a 16 bit datatype. */ +# if USHRT_MAX == 65535 + typedef unsigned short u16; +# elif UINT_MAX == 65535 + typedef unsigned int u16; +# else +# undef STRICT_ALIGN +# define STRICT_ALIGN 1 +# endif +#endif + +#if ULTRA_FAST +# undef VERY_FAST +#endif + +#endif + diff --git a/SerialICE/lzf/liblzf-3.6/lzf_c.c b/SerialICE/lzf/liblzf-3.6/lzf_c.c new file mode 100644 index 0000000..bc07084 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/lzf_c.c @@ -0,0 +1,291 @@ +/* + * Copyright (c) 2000-2010 Marc Alexander Lehmann <schmorp(a)schmorp.de> + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, 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 OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#include "lzfP.h" + +#define HSIZE (1 << (HLOG)) + +/* + * don't play with this unless you benchmark! + * the data format is not dependent on the hash function. + * the hash function might seem strange, just believe me, + * it works ;) + */ +#ifndef FRST +# define FRST(p) (((p[0]) << 8) | p[1]) +# define NEXT(v,p) (((v) << 8) | p[2]) +# if ULTRA_FAST +# define IDX(h) ((( h >> (3*8 - HLOG)) - h ) & (HSIZE - 1)) +# elif VERY_FAST +# define IDX(h) ((( h >> (3*8 - HLOG)) - h*5) & (HSIZE - 1)) +# else +# define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) - h*5) & (HSIZE - 1)) +# endif +#endif +/* + * IDX works because it is very similar to a multiplicative hash, e.g. + * ((h * 57321 >> (3*8 - HLOG)) & (HSIZE - 1)) + * the latter is also quite fast on newer CPUs, and compresses similarly. + * + * the next one is also quite good, albeit slow ;) + * (int)(cos(h & 0xffffff) * 1e6) + */ + +#if 0 +/* original lzv-like hash function, much worse and thus slower */ +# define FRST(p) (p[0] << 5) ^ p[1] +# define NEXT(v,p) ((v) << 5) ^ p[2] +# define IDX(h) ((h) & (HSIZE - 1)) +#endif + +#define MAX_LIT (1 << 5) +#define MAX_OFF (1 << 13) +#define MAX_REF ((1 << 8) + (1 << 3)) + +#if __GNUC__ >= 3 +# define expect(expr,value) __builtin_expect ((expr),(value)) +# define inline inline +#else +# define expect(expr,value) (expr) +# define inline static +#endif + +#define expect_false(expr) expect ((expr) != 0, 0) +#define expect_true(expr) expect ((expr) != 0, 1) + +/* + * compressed format + * + * 000LLLLL <L+1> ; literal, L+1=1..33 octets + * LLLooooo oooooooo ; backref L+1=1..7 octets, o+1=1..4096 offset + * 111ooooo LLLLLLLL oooooooo ; backref L+8 octets, o+1=1..4096 offset + * + */ + +unsigned int +lzf_compress (const void *const in_data, unsigned int in_len, + void *out_data, unsigned int out_len +#if LZF_STATE_ARG + , LZF_STATE htab +#endif + ) +{ +#if !LZF_STATE_ARG + LZF_STATE htab; +#endif + const u8 *ip = (const u8 *)in_data; + u8 *op = (u8 *)out_data; + const u8 *in_end = ip + in_len; + u8 *out_end = op + out_len; + const u8 *ref; + + /* off requires a type wide enough to hold a general pointer difference. + * ISO C doesn't have that (size_t might not be enough and ptrdiff_t only + * works for differences within a single object). We also assume that no + * no bit pattern traps. Since the only platform that is both non-POSIX + * and fails to support both assumptions is windows 64 bit, we make a + * special workaround for it. + */ +#if defined (WIN32) && defined (_M_X64) + unsigned _int64 off; /* workaround for missing POSIX compliance */ +#else + unsigned long off; +#endif + unsigned int hval; + int lit; + + if (!in_len || !out_len) + return 0; + +#if INIT_HTAB + memset (htab, 0, sizeof (htab)); +#endif + + lit = 0; op++; /* start run */ + + hval = FRST (ip); + while (ip < in_end - 2) + { + LZF_HSLOT *hslot; + + hval = NEXT (hval, ip); + hslot = htab + IDX (hval); + ref = *hslot + LZF_HSLOT_BIAS; *hslot = ip - LZF_HSLOT_BIAS; + + if (1 +#if INIT_HTAB + && ref < ip /* the next test will actually take care of this, but this is faster */ +#endif + && (off = ip - ref - 1) < MAX_OFF + && ref > (u8 *)in_data + && ref[2] == ip[2] +#if STRICT_ALIGN + && ((ref[1] << 8) | ref[0]) == ((ip[1] << 8) | ip[0]) +#else + && *(u16 *)ref == *(u16 *)ip +#endif + ) + { + /* match found at *ref++ */ + unsigned int len = 2; + unsigned int maxlen = in_end - ip - len; + maxlen = maxlen > MAX_REF ? MAX_REF : maxlen; + + if (expect_false (op + 3 + 1 >= out_end)) /* first a faster conservative test */ + if (op - !lit + 3 + 1 >= out_end) /* second the exact but rare test */ + return 0; + + op [- lit - 1] = lit - 1; /* stop run */ + op -= !lit; /* undo run if length is zero */ + + for (;;) + { + if (expect_true (maxlen > 16)) + { + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + len++; if (ref [len] != ip [len]) break; + } + + do + len++; + while (len < maxlen && ref[len] == ip[len]); + + break; + } + + len -= 2; /* len is now #octets - 1 */ + ip++; + + if (len < 7) + { + *op++ = (off >> 8) + (len << 5); + } + else + { + *op++ = (off >> 8) + ( 7 << 5); + *op++ = len - 7; + } + + *op++ = off; + + lit = 0; op++; /* start run */ + + ip += len + 1; + + if (expect_false (ip >= in_end - 2)) + break; + +#if ULTRA_FAST || VERY_FAST + --ip; +# if VERY_FAST && !ULTRA_FAST + --ip; +# endif + hval = FRST (ip); + + hval = NEXT (hval, ip); + htab[IDX (hval)] = ip - LZF_HSLOT_BIAS; + ip++; + +# if VERY_FAST && !ULTRA_FAST + hval = NEXT (hval, ip); + htab[IDX (hval)] = ip - LZF_HSLOT_BIAS; + ip++; +# endif +#else + ip -= len + 1; + + do + { + hval = NEXT (hval, ip); + htab[IDX (hval)] = ip - LZF_HSLOT_BIAS; + ip++; + } + while (len--); +#endif + } + else + { + /* one more literal byte we must copy */ + if (expect_false (op >= out_end)) + return 0; + + lit++; *op++ = *ip++; + + if (expect_false (lit == MAX_LIT)) + { + op [- lit - 1] = lit - 1; /* stop run */ + lit = 0; op++; /* start run */ + } + } + } + + if (op + 3 > out_end) /* at most 3 bytes can be missing here */ + return 0; + + while (ip < in_end) + { + lit++; *op++ = *ip++; + + if (expect_false (lit == MAX_LIT)) + { + op [- lit - 1] = lit - 1; /* stop run */ + lit = 0; op++; /* start run */ + } + } + + op [- lit - 1] = lit - 1; /* end run */ + op -= !lit; /* undo run if length is zero */ + + return op - (u8 *)out_data; +} + diff --git a/SerialICE/lzf/liblzf-3.6/lzf_d.c b/SerialICE/lzf/liblzf-3.6/lzf_d.c new file mode 100644 index 0000000..8433b8f --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/lzf_d.c @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2000-2010 Marc Alexander Lehmann <schmorp(a)schmorp.de> + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, 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 OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#include "lzfP.h" + +#if AVOID_ERRNO +# define SET_ERRNO(n) +#else +# include <errno.h> +# define SET_ERRNO(n) errno = (n) +#endif + +#if USE_REP_MOVSB /* small win on amd, big loss on intel */ +#if (__i386 || __amd64) && __GNUC__ >= 3 +# define lzf_movsb(dst, src, len) \ + asm ("rep movsb" \ + : "=D" (dst), "=S" (src), "=c" (len) \ + : "0" (dst), "1" (src), "2" (len)); +#endif +#endif + +unsigned int +lzf_decompress (const void *const in_data, unsigned int in_len, + void *out_data, unsigned int out_len) +{ + u8 const *ip = (const u8 *)in_data; + u8 *op = (u8 *)out_data; + u8 const *const in_end = ip + in_len; + u8 *const out_end = op + out_len; + + do + { + unsigned int ctrl = *ip++; + + if (ctrl < (1 << 5)) /* literal run */ + { + ctrl++; + + if (op + ctrl > out_end) + { + SET_ERRNO (E2BIG); + return 0; + } + +#if CHECK_INPUT + if (ip + ctrl > in_end) + { + SET_ERRNO (EINVAL); + return 0; + } +#endif + +#ifdef lzf_movsb + lzf_movsb (op, ip, ctrl); +#else + switch (ctrl) + { + case 32: *op++ = *ip++; case 31: *op++ = *ip++; case 30: *op++ = *ip++; case 29: *op++ = *ip++; + case 28: *op++ = *ip++; case 27: *op++ = *ip++; case 26: *op++ = *ip++; case 25: *op++ = *ip++; + case 24: *op++ = *ip++; case 23: *op++ = *ip++; case 22: *op++ = *ip++; case 21: *op++ = *ip++; + case 20: *op++ = *ip++; case 19: *op++ = *ip++; case 18: *op++ = *ip++; case 17: *op++ = *ip++; + case 16: *op++ = *ip++; case 15: *op++ = *ip++; case 14: *op++ = *ip++; case 13: *op++ = *ip++; + case 12: *op++ = *ip++; case 11: *op++ = *ip++; case 10: *op++ = *ip++; case 9: *op++ = *ip++; + case 8: *op++ = *ip++; case 7: *op++ = *ip++; case 6: *op++ = *ip++; case 5: *op++ = *ip++; + case 4: *op++ = *ip++; case 3: *op++ = *ip++; case 2: *op++ = *ip++; case 1: *op++ = *ip++; + } +#endif + } + else /* back reference */ + { + unsigned int len = ctrl >> 5; + + u8 *ref = op - ((ctrl & 0x1f) << 8) - 1; + +#if CHECK_INPUT + if (ip >= in_end) + { + SET_ERRNO (EINVAL); + return 0; + } +#endif + if (len == 7) + { + len += *ip++; +#if CHECK_INPUT + if (ip >= in_end) + { + SET_ERRNO (EINVAL); + return 0; + } +#endif + } + + ref -= *ip++; + + if (op + len + 2 > out_end) + { + SET_ERRNO (E2BIG); + return 0; + } + + if (ref < (u8 *)out_data) + { + SET_ERRNO (EINVAL); + return 0; + } + +#ifdef lzf_movsb + len += 2; + lzf_movsb (op, ref, len); +#else + switch (len) + { + default: + len += 2; + + if (op >= ref + len) + { + /* disjunct areas */ + memcpy (op, ref, len); + op += len; + } + else + { + /* overlapping, use octte by octte copying */ + do + *op++ = *ref++; + while (--len); + } + + break; + + case 9: *op++ = *ref++; + case 8: *op++ = *ref++; + case 7: *op++ = *ref++; + case 6: *op++ = *ref++; + case 5: *op++ = *ref++; + case 4: *op++ = *ref++; + case 3: *op++ = *ref++; + case 2: *op++ = *ref++; + case 1: *op++ = *ref++; + case 0: *op++ = *ref++; /* two octets more */ + *op++ = *ref++; + } +#endif + } + } + while (ip < in_end); + + return op - (u8 *)out_data; +} + diff --git a/SerialICE/lzf/liblzf-3.6/romdecompress.c b/SerialICE/lzf/liblzf-3.6/romdecompress.c new file mode 100644 index 0000000..1f76cf2 --- /dev/null +++ b/SerialICE/lzf/liblzf-3.6/romdecompress.c @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2006 Stefan Traby <stefan(a)hello-penguin.com> + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, 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 OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#define _LARGEFILE64_SOURCE +#include "config.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#include <limits.h> +#include "lzf.h" + +#ifdef HAVE_GETOPT_H +# include <getopt.h> +#endif + +#define OVERLAP 64 +#define MAXBLOCK (512*1024) + +char buffer[MAXBLOCK]; + + +int findsyncCOMP(char *buffer, int size) +{ + char *ptr=buffer; + char *end=buffer+size-4; + while (ptr<end) + { + if (memcmp(ptr,"COMP",4)==0) + { + fprintf(stderr,"COMP FOUND\n"); + return ptr-buffer; + } + ptr++; + }; + return -1; +}; + +int findsyncSTRT(char *buffer, int size) +{ + char *ptr=buffer; + char *end=buffer+size-4; + while (ptr<end) + { + if (memcmp(ptr,"STRT",4)==0) + { + fprintf(stderr,"STRT FOUND\n"); + return ptr-buffer; + } + ptr++; + }; + return -1; +}; + +#define ONEGIG (1024LL*1024LL*1024LL) + + +int decodeblockCOMP(char *buffer,int bufsize) +{ + int paged_gigabyte; + unsigned int intaddr; + off64_t addr; + int size; + int csize; + int csum; + if (memcmp(buffer,"COMP",4)!=0) + { + fprintf(stderr,"Decoding error EXPECTED COMP\n"); + return -1; + }; + + int cnt = sscanf(buffer+4,"%02x%08x%08x%08x%08x",&paged_gigabyte,&intaddr,&size,&csize,&csum); + if (cnt != 5) + { + fprintf(stderr,"Decoding error expected addresses\n"); + return 4; + }; + + addr=intaddr; + if (addr>=ONEGIG && addr<(2*ONEGIG)) + { + addr-=ONEGIG; + addr+=(ONEGIG*paged_gigabyte); + }; + + fprintf(stderr,"%08llx %08x %08x %08x\n",addr,size,csize,csum); + { + unsigned char outbuffer[size+10]; + int outsize = lzf_decompress (buffer+(4+2+4*8),csize,outbuffer,size); + if (outsize!=size) + { + fprintf(stderr,"Decompression length error %08x!=%08x\n",size,outsize); + return 4; + }; + int off; + int check=0; + for(off=0;off<size;off++) + { + check+=outbuffer[off]; + }; + if (check!=csum) + { + fprintf(stderr,"Decompression checksum error %08x!=%08x\n",csum,check); + }; + lseek64(1,addr,SEEK_SET); + write(1,outbuffer,size); + }; + + return (4+2+4*8)+csize; +}; + +int decodeblockSTRT(char *buffer,int bufsize) +{ + int addr; //Terminating zero + int size; //Terminating zero + int csum; //Terminating zero + if (memcmp(buffer,"STRT",4)!=0) + { + fprintf(stderr,"Decoding error EXPECTED STRT\n"); + return -1; + }; + + int cnt = sscanf(buffer+4,"%08x",&addr); + if (cnt != 1) + { + fprintf(stderr,"Decoding error expected address\n"); + return 4; + }; + + size=65536; + csum=*(int *) (buffer+8+4+size); + + fprintf(stderr,"%08x %08x %08x\n",addr,size,csum); + { + int off; + int check=0; + for(off=0;off<size;off++) + { + check+=(unsigned char ) buffer[4+8+off]; + }; + if (check!=csum) + { + fprintf(stderr,"transport checksum error %08x!=%08x\n",csum,check); + return 4; + }; + lseek(1,addr,SEEK_SET); + write(1,buffer+4,size); + }; + + return (4+8+4+2+size); +}; + + +int +main (int argc, char *argv[]) +{ + enum { sync , nosync } state = nosync; + int offset=0; + int size=0; + int sizeread=0; + + while ((sizeread=read(0,buffer+size,MAXBLOCK-size)) || (size>OVERLAP)) + { + size+=sizeread; + if (state==nosync) { + if ((offset=findsyncCOMP(buffer,size))>=0) + state=sync; + else + offset=(size-OVERLAP) >=0 ? (size-OVERLAP) : 0; + size-=offset; + if (offset!=0) + memmove(buffer,buffer+offset,size); + } else { + if ((offset=decodeblockCOMP(buffer,size))<8) + { + state=nosync; + }; + size-=offset; + memmove(buffer,buffer+offset,size); + }; + + }; + + lseek(0,0,SEEK_SET); + while ((sizeread=read(0,buffer+size,MAXBLOCK-size)) || (size>OVERLAP)) + { + size+=sizeread; + if (state==nosync) { + if ((offset=findsyncSTRT(buffer,size))>=0) + state=sync; + else + offset=(size-OVERLAP) >=0 ? (size-OVERLAP) : 0; + size-=offset; + if (offset!=0) + memmove(buffer,buffer+offset,size); + } else { + if ((offset=decodeblockSTRT(buffer,size))<8) + { + state=nosync; + }; + size-=offset; + memmove(buffer,buffer+offset,size); + }; + sizeread=0; + + }; +} + diff --git a/SerialICE/lzf/romdecompress.c b/SerialICE/lzf/romdecompress.c new file mode 100644 index 0000000..1f76cf2 --- /dev/null +++ b/SerialICE/lzf/romdecompress.c @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2006 Stefan Traby <stefan(a)hello-penguin.com> + * + * Redistribution and use in source and binary forms, with or without modifica- + * tion, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- + * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- + * CIAL, 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 OTH- + * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, the contents of this file may be used under the terms of + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL. + */ + +#define _LARGEFILE64_SOURCE +#include "config.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#include <limits.h> +#include "lzf.h" + +#ifdef HAVE_GETOPT_H +# include <getopt.h> +#endif + +#define OVERLAP 64 +#define MAXBLOCK (512*1024) + +char buffer[MAXBLOCK]; + + +int findsyncCOMP(char *buffer, int size) +{ + char *ptr=buffer; + char *end=buffer+size-4; + while (ptr<end) + { + if (memcmp(ptr,"COMP",4)==0) + { + fprintf(stderr,"COMP FOUND\n"); + return ptr-buffer; + } + ptr++; + }; + return -1; +}; + +int findsyncSTRT(char *buffer, int size) +{ + char *ptr=buffer; + char *end=buffer+size-4; + while (ptr<end) + { + if (memcmp(ptr,"STRT",4)==0) + { + fprintf(stderr,"STRT FOUND\n"); + return ptr-buffer; + } + ptr++; + }; + return -1; +}; + +#define ONEGIG (1024LL*1024LL*1024LL) + + +int decodeblockCOMP(char *buffer,int bufsize) +{ + int paged_gigabyte; + unsigned int intaddr; + off64_t addr; + int size; + int csize; + int csum; + if (memcmp(buffer,"COMP",4)!=0) + { + fprintf(stderr,"Decoding error EXPECTED COMP\n"); + return -1; + }; + + int cnt = sscanf(buffer+4,"%02x%08x%08x%08x%08x",&paged_gigabyte,&intaddr,&size,&csize,&csum); + if (cnt != 5) + { + fprintf(stderr,"Decoding error expected addresses\n"); + return 4; + }; + + addr=intaddr; + if (addr>=ONEGIG && addr<(2*ONEGIG)) + { + addr-=ONEGIG; + addr+=(ONEGIG*paged_gigabyte); + }; + + fprintf(stderr,"%08llx %08x %08x %08x\n",addr,size,csize,csum); + { + unsigned char outbuffer[size+10]; + int outsize = lzf_decompress (buffer+(4+2+4*8),csize,outbuffer,size); + if (outsize!=size) + { + fprintf(stderr,"Decompression length error %08x!=%08x\n",size,outsize); + return 4; + }; + int off; + int check=0; + for(off=0;off<size;off++) + { + check+=outbuffer[off]; + }; + if (check!=csum) + { + fprintf(stderr,"Decompression checksum error %08x!=%08x\n",csum,check); + }; + lseek64(1,addr,SEEK_SET); + write(1,outbuffer,size); + }; + + return (4+2+4*8)+csize; +}; + +int decodeblockSTRT(char *buffer,int bufsize) +{ + int addr; //Terminating zero + int size; //Terminating zero + int csum; //Terminating zero + if (memcmp(buffer,"STRT",4)!=0) + { + fprintf(stderr,"Decoding error EXPECTED STRT\n"); + return -1; + }; + + int cnt = sscanf(buffer+4,"%08x",&addr); + if (cnt != 1) + { + fprintf(stderr,"Decoding error expected address\n"); + return 4; + }; + + size=65536; + csum=*(int *) (buffer+8+4+size); + + fprintf(stderr,"%08x %08x %08x\n",addr,size,csum); + { + int off; + int check=0; + for(off=0;off<size;off++) + { + check+=(unsigned char ) buffer[4+8+off]; + }; + if (check!=csum) + { + fprintf(stderr,"transport checksum error %08x!=%08x\n",csum,check); + return 4; + }; + lseek(1,addr,SEEK_SET); + write(1,buffer+4,size); + }; + + return (4+8+4+2+size); +}; + + +int +main (int argc, char *argv[]) +{ + enum { sync , nosync } state = nosync; + int offset=0; + int size=0; + int sizeread=0; + + while ((sizeread=read(0,buffer+size,MAXBLOCK-size)) || (size>OVERLAP)) + { + size+=sizeread; + if (state==nosync) { + if ((offset=findsyncCOMP(buffer,size))>=0) + state=sync; + else + offset=(size-OVERLAP) >=0 ? (size-OVERLAP) : 0; + size-=offset; + if (offset!=0) + memmove(buffer,buffer+offset,size); + } else { + if ((offset=decodeblockCOMP(buffer,size))<8) + { + state=nosync; + }; + size-=offset; + memmove(buffer,buffer+offset,size); + }; + + }; + + lseek(0,0,SEEK_SET); + while ((sizeread=read(0,buffer+size,MAXBLOCK-size)) || (size>OVERLAP)) + { + size+=sizeread; + if (state==nosync) { + if ((offset=findsyncSTRT(buffer,size))>=0) + state=sync; + else + offset=(size-OVERLAP) >=0 ? (size-OVERLAP) : 0; + size-=offset; + if (offset!=0) + memmove(buffer,buffer+offset,size); + } else { + if ((offset=decodeblockSTRT(buffer,size))<8) + { + state=nosync; + }; + size-=offset; + memmove(buffer,buffer+offset,size); + }; + sizeread=0; + + }; +} + diff --git a/SerialICE/mainboard/intel_3210_ich9.c b/SerialICE/mainboard/intel_3210_ich9.c new file mode 100644 index 0000000..a9f184c --- /dev/null +++ b/SerialICE/mainboard/intel_3210_ich9.c @@ -0,0 +1,161 @@ +/* + * SerialICE + * + * Copyright (C) 2009 coresystems GmbH + * Copyright (C) 2011 Netherlands Forensic Institute + * + * 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; version 2 of the License. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "ipmi.c" + +/* Hardware specific functions */ + +#define RCBA 0xfed1c000 +#define GCS 0x3410 +#define RCBA32(x) *((volatile u32 *)(RCBA + x)) + +/* Pilot uses 0x5A/0xA5 pattern to actiavte deactivate config access. */ +static void pnp_enter_ext_func_mode_pilot(u16 dev) +{ +outb(0x5A, dev); +} + +static void pnp_exit_ext_func_mode_pilot(u16 dev) +{ +outb(0xA5, dev); +} + + + +static void southbridge_init(void) +{ + u16 reg16; + u32 reg32; + + // Set up RCBA (CHECKED RUUD) + pci_write_config32(PCI_ADDR(0, 0x1f, 0, 0xf0), RCBA | 1); + +#if 1 + // port80 writes go to LPC: + reg32 = RCBA32(GCS); + reg32 = reg32 & ~0x04; + RCBA32(GCS) = reg32; + outb(0x23, 0x80); +#endif + + // Enable Serial IRQ +#define SIRQ_CNTL 0x64 + pci_write_config8(PCI_ADDR(0, 0x1f, 0, SIRQ_CNTL), 0xd0); + // Set COM1 decode range + // (COMA DECODE RANGE 3F8, COMB DECODE RANGE 2F8) +#define LPC_IO_DEC 0x80 + pci_write_config16(PCI_ADDR(0, 0x1f, 0, LPC_IO_DEC), 0x0010); + +#define LPC_EN 0x82 + // Enable COM1 (RUUD: why not COMB as well?) + // COMA enable, COMB disable LPT enable, FDD enable, KPOC enable, + // superIO enable +// pci_write_config16(PCI_ADDR(0, 0x1f, 0, LPC_EN), 0x140d); + pci_write_config16(PCI_ADDR(0, 0x1f, 0, LPC_EN), 0x3f0f); + + // Enable SIO PM Events at 0x680 + // bit0: enable=1 + // bit2-15 range (0xCA1) + // bit18-23 mask (0x000) +#define GEN1_DEC 0x84 + pci_write_config32(PCI_ADDR(0, 0x1f, 0, GEN1_DEC), 0x00000CA1); + // bit0: enable=1 + // bit2-15 range (0x680) + // bit18-23 mask (0x07c) +#define GEN2_DEC 0x88 + pci_write_config32(PCI_ADDR(0, 0x1f, 0, GEN2_DEC), 0x007c0681); +#define GEN3_DEC 0x8C +// pci_write_config32(PCI_ADDR(0, 0x1f, 0, GEN3_DEC), 0x000F00A1); + + + // Disable watchdog +#define PMBASE 0x500 +#define TCOBASE (PMBASE + 0x60) + pci_write_config32(PCI_ADDR(0, 0x1f, 0, 0x40), PMBASE | 1); + pci_write_config8(PCI_ADDR(0, 0x1f, 0, 0x44), 0x80); + reg16 = inw(TCOBASE + 0x08); + reg16 |= (1 << 11); + outw(reg16, TCOBASE + 0x08); + outw(0x0008, TCOBASE + 0x04); + outw(0x0002, TCOBASE + 0x06); +} + +static void superio_init(void) +{ + pnp_enter_ext_func_mode_pilot(0x2e); + + pnp_set_logical_device(0x2e, 2); // COM-A + pnp_set_enable(0x2e, 0); + pnp_set_iobase0(0x2e, 0x3f8); + pnp_set_irq0(0x2e, 4); + pnp_set_enable(0x2e, 1); + + pnp_exit_ext_func_mode_pilot(0x2e); + pnp_enter_ext_func_mode_pilot(0x2e); + + pnp_set_logical_device(0x2e, 8 ); // IPMI ?? protocol + pnp_set_enable(0x2e, 0); + pnp_set_iobase0(0x2e, 0xCA0); + pnp_set_iobase1(0x2e, 0xCA1); + pnp_set_enable(0x2e, 1); + + pnp_exit_ext_func_mode_pilot(0x2e); + pnp_enter_ext_func_mode_pilot(0x2e); + + pnp_set_logical_device(0x2e, 9 ); // IPMI kb protocol + pnp_set_enable(0x2e, 0); + pnp_set_iobase0(0x2e, 0xCA2); + pnp_set_iobase1(0x2e, 0xCA3); + pnp_set_enable(0x2e, 1); +/* + outb(pnp_read_register(0x2e,0x60),0x80); + outb(pnp_read_register(0x2e,0x61),0x80); + outb(pnp_read_register(0x2e,0x62),0x80); + outb(pnp_read_register(0x2e,0x63),0x80); + READBACK TEST gives expected result +*/ + pnp_exit_ext_func_mode_pilot(0x2e); + +} + +static void chipset_init(void) +{ + outb(0x01,0x80); + southbridge_init(); + outb(0x02,0x80); + superio_init(); + outb(0x03,0x80); + setup_early_ipmi_serial(); + outb(0x04,0x80); +/* + { + int b; + for (b=0;b<0x10;b++) + { + outb(b,0x80); + int c; + for(c=0;c<32000;c++) + (void) inb(0x80); + }; + }; +*/ +} + diff --git a/SerialICE/mainboard/ipmi.c b/SerialICE/mainboard/ipmi.c new file mode 100644 index 0000000..06f5476 --- /dev/null +++ b/SerialICE/mainboard/ipmi.c @@ -0,0 +1,253 @@ +/* + * SerialICE + * + * Copyright (C) 2011 Netherlands Forensic Institute + * + * 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; version 2 of the License. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * This is an example of lowlevel code for disabeling the BMC serial + * communication. + */ + +#define nftransport 0xc + +#define OBF (1 << 0) +#define IBF (1 << 1) + +#define ipmidata 0xca2 +#define ipmicsr 0xca3 + +#if 0 +static u8 i_n_b_debug(u16 port) +{ + u8 d=inb(port); + outb(d,0x80); + return d; +} + +#define inb i_n_b_debug +#endif + +#if 0 +static char * print_binary(char val) +{ + static char strbuf[20]; + char *dat=strbuf; + unsigned char mask=0x80; + while (mask!=0) { + *dat= (val & mask) ? '1' : '0'; + mask = mask>>1; + dat++; + }; + *dat=0; + return strbuf; +}; +#endif + +static int writestateQ(void) +{ + return ((inb(ipmicsr)>>6)==0x10); +} + +static int readstateQ(void) +{ + return ((inb(ipmicsr)>>6)==0x01); +} + +static int idlestateQ(void) +{ + return ((inb(ipmicsr)>>6)==0x00); +} + +static inline void ibfzero(void) +{ + while(inb(ipmicsr) & IBF) + ; +} +static inline void clearobf(void) +{ + (void) inb(ipmidata); +} + +static inline void waitobf(void) +{ + while((inb(ipmicsr) & OBF) == 0) + ; +} + +/* quite possibly the stupidest interface ever designed. */ +static inline void first_cmd_byte(unsigned char byte) +{ + ibfzero(); + clearobf(); + outb(0x61, ipmicsr); + ibfzero(); + clearobf(); + outb(byte, ipmidata); +} + +static inline void next_cmd_byte(unsigned char byte) +{ + ibfzero(); + clearobf(); + outb(byte, ipmidata); +} + +static inline void last_cmd_byte(unsigned char byte) +{ + ibfzero(); + clearobf(); + outb(0x62, ipmicsr); + + ibfzero(); + clearobf(); + outb(byte, ipmidata); +} + +static inline void getStatus(void ) +{ + do { + ibfzero(); + outb(0x60, ipmicsr); + ibfzero(); + clearobf(); + outb(0, ipmidata); + ibfzero(); + } while (!readstateQ()); + waitobf(); + + int val=inb(ipmidata); + outb(val,ipmidata); + ibfzero(); + waitobf(); + clearobf(); +} + + +static inline void read_response_byte(void) +{ + int val = -1; + if ((inb(ipmicsr)>>6) != 1) //Check state=0x01 (READ); + return; + + ibfzero(); + waitobf(); + val = inb(ipmidata); + outb(0x68, ipmidata); + + /* see if it is done */ + if ((inb(ipmicsr)>>6) != 1){ + /* wait for the dummy read. Which describes this protocol */ + waitobf(); + (void)inb(ipmidata); + } +} + +static inline void ipmidelay(void) +{ + int i; + for(i = 0; i < 10; i++) { + inb(0x80); + } +} + +static void earlydbg(char POST) +{ + outb(POST,0x80); +} + +static inline void ipmi_request(const char *Start, const char *End) +{ + unsigned char c; + /* be safe; make sure it is really ready */ + while ((inb(ipmicsr)>>6)) { //Not IDLE + outb(inb(ipmicsr),0x80); + outb(0x60, ipmicsr); //abort + + }; + + first_cmd_byte(*Start); + ipmidelay(); + Start++; + + while( (int) Start< ((int) End -1)) { + next_cmd_byte(*Start); + ipmidelay(); + Start++; + }; + + last_cmd_byte(*Start); + ipmidelay(); +} + +static void ipmi_transaction(const char *Start, const char *End) +{ + ipmi_request(Start,End); + ibfzero(); + while(readstateQ()) { + char val; + waitobf(); + val=inb(ipmidata); + outb(0x68,ipmidata); + ipmidelay(); + ibfzero(); + }; + if (idlestateQ()) { +// char val; +// waitobf(); +// val = inb(ipmidata); + } else { + getStatus(); + } +} + + + +const char channel_access[]={0x06<<2,0x40,0x04,0x80,0x05}; +const char serialmodem_conf[]={0x0c<<2,0x10,0x04,0x08,0x00,0x0f}; +const char serial_mux1[]={0x0c<<2,0x12,0x04,0x06}; +const char serial_mux2[]={0x0c<<2,0x12,0x04,0x03}; +const char serial_mux3[]={0x0c<<2,0x12,0x04,0x07}; + +static void setup_early_ipmi_serial(void ) +{ +// earlydbg(0x0d); + //set channel access system only +// ipmi_transaction(channel_access,channel_access+sizeof(channel_access)); + while ((inb(ipmicsr)>>6)) { //Not IDLE + outb(inb(ipmicsr),0x80); + outb(0x60, ipmicsr); //abort + getStatus(); + }; + + //Set serial/modem config +// ipmi_transaction(serialmodem_conf,serialmodem_conf+sizeof(serialmodem_conf)); +// earlydbg(result); + + //Set serial mux 1 +// ipmi_transaction(serial_mux1,serial_mux1+sizeof(serial_mux1)); +// earlydbg(result); + + //Set serial mux 2 + ipmi_transaction(serial_mux2,serial_mux2+sizeof(serial_mux2)); + + //Set serial mux 3 +// ipmi_transaction(serial_mux3,serial_mux3+sizeof(serial_mux3)); + + earlydbg(0x0e); + +} + diff --git a/SerialICE/mainboard/ipmi_disable.c b/SerialICE/mainboard/ipmi_disable.c new file mode 100644 index 0000000..5ea1bbf --- /dev/null +++ b/SerialICE/mainboard/ipmi_disable.c @@ -0,0 +1,37 @@ +/* + * SerialICE + * + * Copyright (C) 2011 Netherlands Forensic Institute + * + * 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; version 2 of the License. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * This is an example of lowlevel code for disabeling the BMC serial + * communication. + */ +#include <stdio.h> +#include <sys/io.h> + +#include "ipmi.c" + +int main(int argc, char **argv) +{ + iopl(3); + ioperm(0x80, 0x20 , 1); + earlydbg(0x12); + getStatus(); + setup_early_ipmi_serial(); +}; + diff --git a/SerialICE/serial.c b/SerialICE/serial.c index 9aaecb6..4728703 100644 --- a/SerialICE/serial.c +++ b/SerialICE/serial.c @@ -57,6 +57,11 @@ static void sio_putc(u8 data) while (!(inb(SIO_PORT + UART_LSR) & 0x40)) ; } +static u8 sio_dataready(void) +{ + return ((inb(SIO_PORT + UART_LSR) & 0x01)); +} + static u8 sio_getc(void) { u8 val; diff --git a/SerialICE/serialice.c b/SerialICE/serialice.c index 34c62e9..961483e 100644 --- a/SerialICE/serialice.c +++ b/SerialICE/serialice.c @@ -17,6 +17,24 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#define STACKTOP 0x20000 + +#ifdef COMPRESS + +#define u8 lzf_u8 +#define u16 lzf_u16 + +#define INIT_HTAB 1 +#define HLOG 13 +#define AVOID_ERRNO 1 + +#include "lzf/liblzf-3.6/lzf_c.c" + +#undef u8 +#undef u16 + +#endif + #include <types.h> #include <serialice.h> #include <io.h> @@ -28,7 +46,281 @@ #include "chipset.c" +#ifdef COMPRESS +//Above 1Meg +#define COMPRESSBUF 0x100000 +//1.1 Meg buffer +#define COMPRESSBUFSIZE ((512*1024)) +#define COMPRESSBLOCKSIZE ((256*1024)) + +#define PAGETABLE (COMPRESSBUF+COMPRESSBUFSIZE) + +#define PAE + +#ifdef PAE +/* This implementation targets huge (2M pages) */ + +/* This code assumes the sizeof an long int == 8 */ + +typedef struct { + long long int pagedirptr[512]; //Actually 4, but must be page alligned + long long int pagedir[512*4]; +} pagetbl; + +void __flush_tlb_global(unsigned int pt) +{ +/* + * Intel CPU features in CR4 + */ +#define X86_CR4_VME 0x00000001 /* enable vm86 extensions */ +#define X86_CR4_PVI 0x00000002 /* virtual interrupts flag enable */ +#define X86_CR4_TSD 0x00000004 /* disable time stamp at ipl 3 */ +#define X86_CR4_DE 0x00000008 /* enable debugging extensions */ +#define X86_CR4_PSE 0x00000010 /* enable page size extensions */ +#define X86_CR4_PAE 0x00000020 /* enable physical address extensions */ +#define X86_CR4_MCE 0x00000040 /* Machine check enable */ +#define X86_CR4_PGE 0x00000080 /* enable global pages */ +#define X86_CR4_PCE 0x00000100 /* enable performance counters at ipl 3 */ +#define X86_CR4_OSFXSR 0x00000200 /* enable fast FPU save and restore */ +#define X86_CR4_OSXMMEXCPT 0x00000400 /* enable unmasked SSE exceptions */ +#define X86_CR4_VMXE 0x00002000 /* enable VMX virtualization */ +#define X86_CR4_OSXSAVE 0x00040000 /* enable xsave and xrestore */ + + do { + unsigned int mmu_cr4_features; + unsigned int mmu_cr0; + long long int local_idt=0; + + __asm__ __volatile__( + "lidt %0; \n" + : + : "m" (local_idt) + : "memory"); + __asm__ __volatile__( + "movl %%cr4, %0; \n" + "movl %%cr0, %1; \n" + : "=&r" (mmu_cr4_features), + "=&r" (mmu_cr0) + : + : "memory"); + + mmu_cr4_features = mmu_cr4_features | X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE; + mmu_cr0 = mmu_cr0 | 0x80000000; //Paging On + + __asm__ __volatile__( + "movl %1, %%cr4; # turn on extensions \n" + "movl %0, %%cr3; # Set Pagetable \n" + "movl %2, %%cr0; # Enable paging \n" + "ljmp $0x08,$1f\n" + "1:\n" + : + : "r" (pt), + "r" (mmu_cr4_features), + "r" (mmu_cr0) + : "memory"); + } while (0); +}; + +#define _PAGE_BIT_PRESENT 0 /* is present */ +#define _PAGE_BIT_RW 1 /* writeable */ +#define _PAGE_BIT_USER 2 /* userspace addressable */ +#define _PAGE_BIT_PWT 3 /* page write through */ +#define _PAGE_BIT_PCD 4 /* page cache disabled */ +#define _PAGE_BIT_ACCESSED 5 /* was accessed (raised by CPU) */ +#define _PAGE_BIT_DIRTY 6 /* was written to (raised by CPU) */ +#define _PAGE_BIT_PSE 7 /* 4 MB (or 2MB) page */ +#define _PAGE_BIT_PAT 7 /* on 4KB pages */ +#define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */ +#define _PAGE_BIT_UNUSED1 9 /* available for programmer */ +#define _PAGE_BIT_IOMAP 10 /* flag used to indicate IO mapping */ +#define _PAGE_BIT_HIDDEN 11 /* hidden by kmemcheck */ +#define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */ +#define _PAGE_BIT_SPECIAL _PAGE_BIT_UNUSED1 +#define _PAGE_BIT_CPA_TEST _PAGE_BIT_UNUSED1 +#define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */ + +int paged_gigabyte; + +void enter_pae() +{ + u8 windowed_gig; //The area starting at 0x40000000 is a window to a specified gig of memory + //Entering 01 will give a linear view of the lowest + //4G of mem, + //Entering 04 will show the area between 4 and 5G at + //the address 0x40000000 + windowed_gig=sio_get8(); + paged_gigabyte=windowed_gig; + + unsigned long long int windowbase= ((unsigned long long int )windowed_gig)*0x40000000L; + if (sizeof (long long int)!=8) + { + sio_putstring("ERROR INT SIZE"); + return ; + }; + long long int pagenr; + pagetbl *PTBL=(pagetbl *) PAGETABLE; + PTBL->pagedirptr[0]=0x1 | (long long int) &PTBL->pagedir[0*512] ; + PTBL->pagedirptr[1]=0x1 | (long long int) &PTBL->pagedir[1*512] ; + PTBL->pagedirptr[2]=0x1 | (long long int) &PTBL->pagedir[2*512] ; + PTBL->pagedirptr[3]=0x1 | (long long int) &PTBL->pagedir[3*512] ; + for (pagenr=0;pagenr<(4*512);pagenr++) + PTBL->pagedir[pagenr]=0x8F | pagenr*(2*1024*1024); + for (pagenr=512;pagenr<(2*512);pagenr++) + PTBL->pagedir[pagenr]=0x8F | ((pagenr-512) *(2*1024*1024)) | windowbase ; +//0x8F +//_PAGE_BIT_PSE _PAGE_BIT_PWT _PAGE_BIT_USER _PAGE_BIT_RW _PAGE_BIT_PRESENT + __flush_tlb_global((int) PTBL); +}; + +#endif //PAE + + +void *memset(void *s, int c, size_t n) +{ + int i; + char *ss=(char *) s; + for(i=0;i<n;i++) + { + *ss=c; + ss++; + }; +}; + +static void post_putc(u8 c) +{ + outb(c,0x80); +} + +static void post_putstring(char *str) +{ + while(*str!=0) + post_putc(*str++); +} + +static void post_put8(u32 data) +{ + int i; + for (i=4; i >= 0; i -= 4) { + u8 c = (data >> i) & 0xf; + if (c > 9) \ + c += ('a' - 10); \ + else \ + c += '0'; \ + post_putc(c); + }; +} + +static void post_put32(u32 data) +{ + int i; + for (i=28; i >= 0; i -= 4) { + u8 c = (data >> i) & 0xf; + if (c > 9) \ + c += ('a' - 10); \ + else \ + c += '0'; \ + post_putc(c); + }; +} + +static void serialice_dump_compressed2(u8 * addr) +{ + unsigned int outsize; + u8 *data; + u32 checksum=0; + for(data = addr;data<(addr+COMPRESSBLOCKSIZE);data++) + checksum += *data; + + outsize = lzf_compress ((void *) addr,COMPRESSBLOCKSIZE, (void *) COMPRESSBUF, COMPRESSBUFSIZE); + + sio_putstring("COMP"); + sio_put8((u8) paged_gigabyte); + sio_put32((u32) addr); + sio_put32((u32) COMPRESSBLOCKSIZE); + sio_put32((u32) outsize); + sio_put32((u32) checksum); + for(data = (u8 *) COMPRESSBUF ;data<(u8 *) (COMPRESSBUF+outsize);data++) + sio_putc(*data); +}; + +static void serialice_dump_compressed(void) +{ + u32 addr; + u32 endaddr; + addr = sio_get32(); + sio_getc(); // skip . + endaddr = sio_get32(); + while ((!sio_dataready()) && (addr < endaddr)) { + serialice_dump_compressed2((char *) addr); + addr+=COMPRESSBLOCKSIZE; + }; +}; + +static void post_dump_compressed2(u8 * addr) +{ + unsigned int outsize; + u8 *data; + u32 checksum=0; + for(data = addr;data<(addr+COMPRESSBLOCKSIZE);data++) + checksum += *data; + + outsize = lzf_compress ((void *) addr,COMPRESSBLOCKSIZE, (void *) COMPRESSBUF, COMPRESSBUFSIZE); + + post_putstring("COMP"); + post_put8((u8) paged_gigabyte); + post_put32((u32) addr); + post_put32((u32) COMPRESSBLOCKSIZE); + post_put32((u32) outsize); + post_put32((u32) checksum); + for(data = (u8 *) COMPRESSBUF ;data<(u8 *) (COMPRESSBUF+outsize);data++) + post_putc(*data); +}; + +static void post_dump_compressed(void) +{ + u32 addr; + u32 endaddr; + addr = sio_get32(); + sio_getc(); // skip . + endaddr = sio_get32(); + while ((!sio_dataready()) && (addr < endaddr)) { + post_dump_compressed2((char *) addr); + addr+=COMPRESSBLOCKSIZE; + }; +}; + /* Accessor functions */ +static void serialice_dump_post(void) +{ + u32 addr; + + // Format: + // *rm00000000.w + addr = sio_get32(); + while (!sio_dataready()) { + int b; + for (b=0;b<0x1000;b++) + { + outb(read8(addr),0x80); + addr++; + }; + }; +} + +#endif + +static int serialice_run_from_ram(void) +{ +/* Copy to ram */ + __asm__ volatile ("movl $_shadow_dst_begin,%%edi"::); + __asm__ volatile ("movl $_shadow_src_begin,%%esi"::); + __asm__ volatile ("movl $_shadow_dst_end, %%ecx"::); + __asm__ volatile ("subl $_shadow_dst_begin, %%ecx"::); + __asm__ volatile ("cld ; rep ; movsb"); + //STACKTOP + __asm__ volatile ("movl $0x20000,%%esp\n\tcall _rammain\n\t"::); + return 0; +} static void serialice_read_memory(void) { @@ -50,6 +342,68 @@ static void serialice_read_memory(void) } } +#if 0 + +static void serialice_scan_memory(void) +{ + u32 addr; + + // Format: + // *dm00000000 + addr = sio_get32(); + while (!sio_dataready()) { + u8 byte; + sio_putc('\r'); + sio_putc('\n'); + sio_put32(addr); + sio_putc(' '); + do { + byte=read8(addr); + if ((byte>='a') && (byte<'z')) sio_putc(byte); + if (byte>='A' && byte<='Z') sio_putc(byte); + if (byte>='0' && byte<='9') sio_putc(byte); + addr++; + } while ((addr & 0x1F) !=0); + addr += (0x2000-0x20); + }; + + sio_putc('\r'); sio_putc('\n'); +} + +#endif + +static void serialice_dump_memory(void) +{ + u32 addr; + u32 checksum; + + // Format: + // *dm00000000 + addr = sio_get32(); + checksum=0; + while (!sio_dataready()) { + u8 byte; + if ( (addr & 0xFFFF) == 0) { + sio_putc(checksum); + sio_putc(checksum>>8); + sio_putc(checksum>>16); + sio_putc(checksum>>24); + checksum=0; + sio_putc('S'); + sio_putc('T'); + sio_putc('R'); + sio_putc('T'); + sio_put32(addr); + }; + byte=read8(addr); + sio_putc(byte); + checksum+=byte; + addr++; + }; + sio_putc('\r'); sio_putc('\n'); +} + + static void serialice_write_memory(void) { u8 width; @@ -194,6 +548,10 @@ int main(void) sio_putstring("\nSerialICE v" VERSION " (" __DATE__ ")\n"); +#ifdef COMPRESS + paged_gigabyte=1; +#endif + while(1) { u16 c; sio_putstring("\n> "); @@ -212,6 +570,14 @@ int main(void) case (('w' << 8)|'m'): // Write Memory *wm serialice_write_memory(); break; + case (('d' << 8)|'m'): // Dump Memory *dm + serialice_dump_memory(); + break; +#ifdef COMPRESS + case (('c' << 8)|'m'): // Dump Memory compressed *cm + serialice_dump_compressed(); + break; +#endif case (('r' << 8)|'i'): // Read IO *ri serialice_read_io(); break; @@ -227,6 +593,22 @@ int main(void) case (('c' << 8)|'i'): // Read CPUID *ci serialice_cpuinfo(); break; +#ifdef COMPRESS + case (('d' << 8)|'p'): // Post Write + serialice_dump_post(); + break; + case (('c' << 8)|'p'): // Compressed Post Dump + post_dump_compressed(); + break; +#endif + case (('r' << 8)|'r'): // Post Write + serialice_run_from_ram(); + break; +#ifdef PAE + case (('p' << 8)|'a'): // Post Write + enter_pae(); + break; +#endif default: sio_putstring("ERROR\n"); break; diff --git a/SerialICE/serialice.ld b/SerialICE/serialice.ld index 9dd1591..6cf18b0 100644 --- a/SerialICE/serialice.ld +++ b/SerialICE/serialice.ld @@ -20,19 +20,37 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) +_PHYS_LOCATION = 0x1000; +_FLASHSIZE = (2 * 1024 * 1024); _ROMSIZE = (1024 * 64); +_FLASHBASE = 0x100000000 - (_FLASHSIZE); +_ROMCOPY = 0x100000000 - (2 * _ROMSIZE); _ROMBASE = 0x100000000 - (_ROMSIZE); SECTIONS { + . = _FLASHBASE ; + .empty : { + BYTE(0xFF); + FILL(0xFF); + . = _ROMCOPY - 1; + BYTE(0xFF); + } + . = _ROMCOPY ; + .romcopy : { + _shadow_src_begin = . ; + _ram_shadow_src_begin = . ; + } . = _ROMBASE; .rom : { _main = . ; + _ram_rammain = . ; *(.rom.text); - *(.text); *(.rom.data); - *(.data); + + *(.text); + *(.data); *(.rodata); - *(.rodata.*); + *(.rodata.*); } . = 0xffffff40; @@ -55,6 +73,19 @@ SECTIONS { BYTE(0x00); } + .shadow _PHYS_LOCATION : AT (_ROMCOPY) { + _shadow_dst_begin = . ; + _ram_shadow_dst_begin = . ; + + *(.ram.rom.text); + *(.ram.text); + *(.ram.rom.data); + *(.ram.data); + *(.ram.rodata); + *(.ram.rodata.*); + _shadow_dst_end = . ; + _ram_shadow_dst_end = . ; + } /DISCARD/ : { *(.comment) *(.note.*) diff --git a/SerialICE/start.S b/SerialICE/start.S index e751bab..ac6d6f5 100644 --- a/SerialICE/start.S +++ b/SerialICE/start.S @@ -19,6 +19,9 @@ #include "serialice.h" + /* Messages */ + .section ".rom.text" + .globl _c_main .code32 _c_main:
1
0
0
0
Results per page:
10
25
50
100
200