Since some people disapprove of white space cleanups mixed in regular commits
while others dislike them being extra commits, let's clean them up once and for all for the existing code. If it's ugly, let it only be ugly once :-) Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5507 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
committed by
Stefan Reinauer
parent
0e1e8065e3
commit
14e2277962
@@ -10,7 +10,7 @@
|
||||
# This file is subject to the terms and conditions of the GNU General
|
||||
# Public License. See the file COPYING in the main directory of this
|
||||
# archive for more details.
|
||||
#
|
||||
#
|
||||
|
||||
#set -x # Turn echo on....
|
||||
|
||||
@@ -99,10 +99,10 @@ function xml
|
||||
|
||||
function xmlfile
|
||||
{
|
||||
test "$mode" == "xml" && {
|
||||
test "$mode" == "xml" && {
|
||||
printf '<![CDATA[\n'
|
||||
cat $1
|
||||
printf ']]>\n'
|
||||
printf ']]>\n'
|
||||
} >> $XMLFILE
|
||||
}
|
||||
|
||||
@@ -119,9 +119,9 @@ function mainboards
|
||||
{
|
||||
# make this a function so we can easily select
|
||||
# without breaking readability
|
||||
|
||||
|
||||
VENDOR=$1
|
||||
|
||||
|
||||
ls -1 $ROOT/src/mainboard/$VENDOR | grep -v Kconfig
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ function create_config
|
||||
build_dir=$TARGET/${VENDOR}_${MAINBOARD}
|
||||
|
||||
# get a working payload for the board if we have one.
|
||||
# the --payload option expects a directory containing
|
||||
# the --payload option expects a directory containing
|
||||
# a shell script payload.sh
|
||||
# Usage: payload.sh [VENDOR] [DEVICE]
|
||||
# the script returns an absolute path to the payload binary.
|
||||
@@ -253,7 +253,7 @@ function create_buildenv
|
||||
}
|
||||
|
||||
function compile_target
|
||||
{
|
||||
{
|
||||
VENDOR=$1
|
||||
MAINBOARD=$2
|
||||
|
||||
@@ -381,17 +381,17 @@ function build_target
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# TBD: look for suitable cross compiler suite
|
||||
# cross-$TARCH-gcc and cross-$TARCH-ld
|
||||
|
||||
|
||||
# Check result:
|
||||
if [ $found_crosscompiler == "false" ]; then
|
||||
printf "$TARCH: skipped, we're $ARCH\n\n"
|
||||
xml " <status>notbuilt</status>"
|
||||
xml ""
|
||||
xml "</mainboard>"
|
||||
|
||||
|
||||
return 0
|
||||
else
|
||||
printf "$TARCH: ok, $ARCH using ${CROSS_COMPILE}gcc\n"
|
||||
@@ -426,14 +426,14 @@ function build_target
|
||||
xml "</mainboard>"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
stime=`perl -e 'print time();' 2>/dev/null || date +%s`
|
||||
create_buildenv $VENDOR $MAINBOARD $CONFIG
|
||||
if [ $? -eq 0 -a $configureonly -eq 0 ]; then
|
||||
if [ "$scanbuild" = "true" ]; then
|
||||
rm -rf $TARGET/scan-build-results-tmp
|
||||
fi
|
||||
compile_target $VENDOR $MAINBOARD &&
|
||||
compile_target $VENDOR $MAINBOARD &&
|
||||
xml " <status>ok</status>" ||
|
||||
xml "<status>broken</status>"
|
||||
if [ "$scanbuild" = "true" ]; then
|
||||
@@ -541,7 +541,7 @@ function myhelp
|
||||
printf " (defaults to $ROOT)\n\n"
|
||||
}
|
||||
|
||||
function myversion
|
||||
function myversion
|
||||
{
|
||||
cat << EOF
|
||||
|
||||
|
@@ -50,13 +50,13 @@ and will be created in the current directory.
|
||||
.TP
|
||||
.B "\-T, \-\-test"
|
||||
Submit generated image(s) to the automated test system.
|
||||
The results of the tests will be made available at
|
||||
The results of the tests will be made available at
|
||||
.B http://qa.coreboot.org/log_manual.php
|
||||
.TP
|
||||
.B "\-c, \-\-cpus [<numcpus>|max]"
|
||||
Build on
|
||||
Build on
|
||||
.B numcpus
|
||||
cpus at the same time, or on all available with
|
||||
cpus at the same time, or on all available with
|
||||
.B max\fR.
|
||||
.TP
|
||||
.B "\-s, \-\-silent"
|
||||
|
@@ -24,9 +24,9 @@ Finally run the txt file through the parse-bkdg.pl script like so:
|
||||
Now we have the bkdg.data file that is used by the other scripts.
|
||||
|
||||
If you want to test the scripts without doing all this work, you can use some
|
||||
sample input files from the 'example_input/' directory.
|
||||
sample input files from the 'example_input/' directory.
|
||||
|
||||
--
|
||||
--
|
||||
Ward Vandewege, 2009-10-28.
|
||||
ward@jhvc.com
|
||||
|
||||
|
||||
|
@@ -55,7 +55,7 @@ sub parse_file {
|
||||
next if (!(/^([a-f0-9]{2}): ([[a-f0-9 ]+)$/i));
|
||||
# Line format
|
||||
# 00: 22 10 02 11 00 00 00 00 00 00 00 06 00 00 80 00
|
||||
#print STDERR hex($1) . " ($1): $2\n";
|
||||
#print STDERR hex($1) . " ($1): $2\n";
|
||||
my $regoffset = hex($1);
|
||||
my @values = split(/ /,$2);
|
||||
for (my $i=0;$i<=$#values;$i++) {
|
||||
@@ -93,7 +93,7 @@ sub parse_file_old {
|
||||
if ($tmp[1] eq '98.l') {
|
||||
$register = ($tmp[2] =~ /(..)$/)[0]; # last 2 digits are (hex) of what we wrote to the register, if second field is 98.l
|
||||
$devreg = "$device $register";
|
||||
if ("$binrep" =~ /^1/) {
|
||||
if ("$binrep" =~ /^1/) {
|
||||
# bit 31 *must* be 1 if readout is to be correct
|
||||
print "$tmp[0] - $register<br>\n" if ($DEBUG);
|
||||
} else {
|
||||
@@ -107,7 +107,7 @@ sub parse_file_old {
|
||||
$data{$devreg}{$filename} = $packed;
|
||||
}
|
||||
}
|
||||
return %data;
|
||||
return %data;
|
||||
}
|
||||
|
||||
sub interpret_differences {
|
||||
|
@@ -63,7 +63,7 @@ sub parse_file {
|
||||
if ($tmp[1] eq '98.l') {
|
||||
$register = ($tmp[2] =~ /(..)$/)[0]; # last 2 digits are (hex) of what we wrote to the register, if second field is 98.l
|
||||
$devreg = "$device $register";
|
||||
if ("$binrep" =~ /^1/) {
|
||||
if ("$binrep" =~ /^1/) {
|
||||
# bit 31 *must* be 1 if readout is to be correct
|
||||
print "$tmp[0] - $register<br>\n" if ($DEBUG);
|
||||
} else {
|
||||
@@ -77,7 +77,7 @@ sub parse_file {
|
||||
$data{$devreg}{$filename} = $packed;
|
||||
}
|
||||
}
|
||||
return %data;
|
||||
return %data;
|
||||
}
|
||||
|
||||
sub interpret_differences {
|
||||
|
@@ -191,7 +191,7 @@ while (<>) {
|
||||
$previous_start = $start;
|
||||
$previous_stop = $stop;
|
||||
|
||||
# the 'range' field is not useful in this instance, but used in the 'fields' version of this block to easily go
|
||||
# the 'range' field is not useful in this instance, but used in the 'fields' version of this block to easily go
|
||||
# from a bit position to the corresponding range.
|
||||
my $str = "
|
||||
\$info{'$registers[0]'}{'ranges'}{'" . $f[0] . "'}{'function'} = \"" . $f[2] . "\";
|
||||
@@ -260,7 +260,7 @@ sub multiply {
|
||||
my $tmp = $str;
|
||||
$tmp =~ s/\{'$range'\}/{'$i'}/g;
|
||||
$tmp =~ s/\{'ranges'\}/{'fields'}/g;
|
||||
$tmp .=
|
||||
$tmp .=
|
||||
$output .= $tmp;
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
rm coreboot.rom;
|
||||
rm coreboot.rom;
|
||||
./cbfstool coreboot.rom create 0x80000 0x10000 /tmp/coreboot.strip
|
||||
./cbfstool coreboot.rom add-payload /tmp/filo.elf normal/payload l
|
||||
./cbfstool coreboot.rom print
|
||||
|
@@ -41,7 +41,7 @@ all: $(BINARY)
|
||||
clean:
|
||||
rm -f $(COMMON) $(BINARY)
|
||||
|
||||
tags:
|
||||
tags:
|
||||
ctags *.[ch]
|
||||
|
||||
CXXFLAGS=-DCOMPACT -g
|
||||
|
@@ -79,12 +79,12 @@ struct cbfs_payload {
|
||||
|
||||
/* The deleted type is chosen to be a value
|
||||
* that can be written in a FLASH from all other
|
||||
* values.
|
||||
* values.
|
||||
*/
|
||||
#define CBFS_COMPONENT_DELETED 0
|
||||
|
||||
/* for all known FLASH, this value can be changed
|
||||
* to all other values. This allows NULL files to be
|
||||
/* for all known FLASH, this value can be changed
|
||||
* to all other values. This allows NULL files to be
|
||||
* changed without a block erase
|
||||
*/
|
||||
#define CBFS_COMPONENT_NULL 0xFFFFFFFF
|
||||
|
@@ -183,10 +183,10 @@ void print_cbfs_directory(const char *filename)
|
||||
(struct cbfs_file *)phys_to_virt(current);
|
||||
uint32_t length = ntohl(thisfile->len);
|
||||
char *fname = (char *)(phys_to_virt(current) + sizeof(struct cbfs_file));
|
||||
if (strlen(fname) == 0)
|
||||
if (strlen(fname) == 0)
|
||||
fname = "(empty)";
|
||||
|
||||
printf("%-30s 0x%-8x %-12s %d\n", fname,
|
||||
printf("%-30s 0x%-8x %-12s %d\n", fname,
|
||||
current - phys_start, strfiletype(ntohl(thisfile->type)),
|
||||
length);
|
||||
current =
|
||||
|
@@ -38,7 +38,7 @@ public:
|
||||
|
||||
bool Create(UInt32 bufferSize);
|
||||
void Free();
|
||||
|
||||
|
||||
void SetStream(ISequentialInStream *stream);
|
||||
void Init();
|
||||
void ReleaseStream() { _stream.Release(); }
|
||||
|
@@ -43,9 +43,9 @@ void COutBuffer::Init()
|
||||
}
|
||||
|
||||
UInt64 COutBuffer::GetProcessedSize() const
|
||||
{
|
||||
{
|
||||
UInt64 res = _processedSize + _pos - _streamPos;
|
||||
if (_streamPos > _pos)
|
||||
if (_streamPos > _pos)
|
||||
res += _bufferSize;
|
||||
return res;
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ public:
|
||||
|
||||
COutBuffer(): _buffer(0), _pos(0), _stream(0), _buffer2(0) {}
|
||||
~COutBuffer() { Free(); }
|
||||
|
||||
|
||||
bool Create(UInt32 bufferSize);
|
||||
void Free();
|
||||
|
||||
|
@@ -6,4 +6,4 @@
|
||||
#include "../../Common/MyWindows.h"
|
||||
#include "../../Common/NewHandler.h"
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -11,7 +11,7 @@ HRESULT ReadStream(ISequentialInStream *stream, void *data, UInt32 size, UInt32
|
||||
*processedSize = 0;
|
||||
while(size != 0)
|
||||
{
|
||||
UInt32 processedSizeLoc;
|
||||
UInt32 processedSizeLoc;
|
||||
HRESULT res = stream->Read(data, size, &processedSizeLoc);
|
||||
if (processedSize != 0)
|
||||
*processedSize += processedSizeLoc;
|
||||
@@ -30,7 +30,7 @@ HRESULT WriteStream(ISequentialOutStream *stream, const void *data, UInt32 size,
|
||||
*processedSize = 0;
|
||||
while(size != 0)
|
||||
{
|
||||
UInt32 processedSizeLoc;
|
||||
UInt32 processedSizeLoc;
|
||||
HRESULT res = stream->Write(data, size, &processedSizeLoc);
|
||||
if (processedSize != 0)
|
||||
*processedSize += processedSizeLoc;
|
||||
|
@@ -2,13 +2,13 @@
|
||||
|
||||
#include "../LZInWindow.h"
|
||||
#include "../IMatchFinder.h"
|
||||
|
||||
|
||||
namespace BT_NAMESPACE {
|
||||
|
||||
typedef UInt32 CIndex;
|
||||
const UInt32 kMaxValForNormalize = (UInt32(1) << 31) - 1;
|
||||
|
||||
class CMatchFinder:
|
||||
class CMatchFinder:
|
||||
public IMatchFinder,
|
||||
public CLZInWindow,
|
||||
public CMyUnknownImp,
|
||||
@@ -40,7 +40,7 @@ class CMatchFinder:
|
||||
STDMETHOD_(Int32, NeedChangeBufferPos)(UInt32 numCheckBytes);
|
||||
STDMETHOD_(void, ChangeBufferPos)();
|
||||
|
||||
STDMETHOD(Create)(UInt32 historySize, UInt32 keepAddBufferBefore,
|
||||
STDMETHOD(Create)(UInt32 historySize, UInt32 keepAddBufferBefore,
|
||||
UInt32 matchMaxLen, UInt32 keepAddBufferAfter);
|
||||
STDMETHOD(GetMatches)(UInt32 *distances);
|
||||
STDMETHOD(Skip)(UInt32 num);
|
||||
|
@@ -25,7 +25,7 @@ namespace BT_NAMESPACE {
|
||||
static const UInt32 kMinMatchCheck = kNumHashBytes;
|
||||
static const UInt32 kStartMaxLen = 1;
|
||||
#else
|
||||
#ifdef HASH_ZIP
|
||||
#ifdef HASH_ZIP
|
||||
#define kNumHashDirectBytes 0
|
||||
static const UInt32 kNumHashBytes = 3;
|
||||
static const UInt32 kHashSize = 1 << 16;
|
||||
@@ -73,11 +73,11 @@ void CMatchFinder::FreeMemory()
|
||||
}
|
||||
|
||||
CMatchFinder::~CMatchFinder()
|
||||
{
|
||||
{
|
||||
FreeMemory();
|
||||
}
|
||||
|
||||
STDMETHODIMP CMatchFinder::Create(UInt32 historySize, UInt32 keepAddBufferBefore,
|
||||
STDMETHODIMP CMatchFinder::Create(UInt32 historySize, UInt32 keepAddBufferBefore,
|
||||
UInt32 matchMaxLen, UInt32 keepAddBufferAfter)
|
||||
{
|
||||
if (historySize > kMaxValForNormalize - 256)
|
||||
@@ -85,15 +85,15 @@ STDMETHODIMP CMatchFinder::Create(UInt32 historySize, UInt32 keepAddBufferBefore
|
||||
FreeMemory();
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
_cutValue =
|
||||
_cutValue =
|
||||
#ifdef _HASH_CHAIN
|
||||
8 + (matchMaxLen >> 2);
|
||||
#else
|
||||
16 + (matchMaxLen >> 1);
|
||||
#endif
|
||||
UInt32 sizeReserv = (historySize + keepAddBufferBefore +
|
||||
UInt32 sizeReserv = (historySize + keepAddBufferBefore +
|
||||
matchMaxLen + keepAddBufferAfter) / 2 + 256;
|
||||
if (CLZInWindow::Create(historySize + keepAddBufferBefore,
|
||||
if (CLZInWindow::Create(historySize + keepAddBufferBefore,
|
||||
matchMaxLen + keepAddBufferAfter, sizeReserv))
|
||||
{
|
||||
_matchMaxLen = matchMaxLen;
|
||||
@@ -161,8 +161,8 @@ STDMETHODIMP CMatchFinder::Init()
|
||||
}
|
||||
|
||||
STDMETHODIMP_(void) CMatchFinder::ReleaseStream()
|
||||
{
|
||||
// ReleaseStream();
|
||||
{
|
||||
// ReleaseStream();
|
||||
}
|
||||
|
||||
#ifdef HASH_ARRAY_2
|
||||
@@ -173,7 +173,7 @@ STDMETHODIMP_(void) CMatchFinder::ReleaseStream()
|
||||
hash2Value = temp & (kHash2Size - 1); \
|
||||
hash3Value = (temp ^ (UInt32(cur[2]) << 8)) & (kHash3Size - 1); \
|
||||
hashValue = (temp ^ (UInt32(cur[2]) << 8) ^ (CCRC::Table[cur[3]] << 5)) & _hashMask; }
|
||||
|
||||
|
||||
#else // no HASH_ARRAY_3
|
||||
#define HASH_CALC { \
|
||||
UInt32 temp = CCRC::Table[cur[0]] ^ cur[1]; \
|
||||
@@ -181,12 +181,12 @@ STDMETHODIMP_(void) CMatchFinder::ReleaseStream()
|
||||
hashValue = (temp ^ (UInt32(cur[2]) << 8)) & _hashMask; }
|
||||
#endif // HASH_ARRAY_3
|
||||
#else // no HASH_ARRAY_2
|
||||
#ifdef HASH_ZIP
|
||||
#ifdef HASH_ZIP
|
||||
inline UInt32 Hash(const Byte *pointer)
|
||||
{
|
||||
return ((UInt32(pointer[0]) << 8) ^ CCRC::Table[pointer[1]] ^ pointer[2]) & (kHashSize - 1);
|
||||
}
|
||||
#else // no HASH_ZIP
|
||||
#else // no HASH_ZIP
|
||||
inline UInt32 Hash(const Byte *pointer)
|
||||
{
|
||||
return pointer[0] ^ (UInt32(pointer[1]) << 8);
|
||||
@@ -205,7 +205,7 @@ STDMETHODIMP CMatchFinder::GetMatches(UInt32 *distances)
|
||||
if(lenLimit < kMinMatchCheck)
|
||||
{
|
||||
distances[0] = 0;
|
||||
return MovePos();
|
||||
return MovePos();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,17 +298,17 @@ STDMETHODIMP CMatchFinder::GetMatches(UInt32 *distances)
|
||||
UInt32 cyclicPos = (delta <= _cyclicBufferPos) ?
|
||||
(_cyclicBufferPos - delta):
|
||||
(_cyclicBufferPos - delta + _cyclicBufferSize);
|
||||
CIndex *pair = son +
|
||||
CIndex *pair = son +
|
||||
#ifdef _HASH_CHAIN
|
||||
cyclicPos;
|
||||
#else
|
||||
(cyclicPos << 1);
|
||||
#endif
|
||||
|
||||
|
||||
// _mm_prefetch((const char *)pair, _MM_HINT_T0);
|
||||
|
||||
|
||||
const Byte *pb = _buffer + curMatch;
|
||||
UInt32 len =
|
||||
UInt32 len =
|
||||
#ifdef _HASH_CHAIN
|
||||
kNumHashDirectBytes;
|
||||
if (pb[maxLen] == cur[maxLen])
|
||||
@@ -369,7 +369,7 @@ STDMETHODIMP CMatchFinder::Skip(UInt32 num)
|
||||
#ifdef _HASH_CHAIN
|
||||
if (_streamPos - _pos < kNumHashBytes)
|
||||
{
|
||||
RINOK(MovePos());
|
||||
RINOK(MovePos());
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
@@ -425,18 +425,18 @@ STDMETHODIMP CMatchFinder::Skip(UInt32 num)
|
||||
*ptr0 = *ptr1 = kEmptyHashValue;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
UInt32 delta = _pos - curMatch;
|
||||
UInt32 cyclicPos = (delta <= _cyclicBufferPos) ?
|
||||
(_cyclicBufferPos - delta):
|
||||
(_cyclicBufferPos - delta + _cyclicBufferSize);
|
||||
CIndex *pair = son + (cyclicPos << 1);
|
||||
|
||||
|
||||
// _mm_prefetch((const char *)pair, _MM_HINT_T0);
|
||||
|
||||
|
||||
const Byte *pb = _buffer + curMatch;
|
||||
UInt32 len = MyMin(len0, len1);
|
||||
|
||||
|
||||
if (pb[len] == cur[len])
|
||||
{
|
||||
while(++len != lenLimit)
|
||||
@@ -479,7 +479,7 @@ void CMatchFinder::Normalize()
|
||||
{
|
||||
UInt32 subValue = _pos - _cyclicBufferSize;
|
||||
CIndex *items = _hash;
|
||||
UInt32 numItems = (_hashSizeSum + _cyclicBufferSize
|
||||
UInt32 numItems = (_hashSizeSum + _cyclicBufferSize
|
||||
#ifndef _HASH_CHAIN
|
||||
* 2
|
||||
#endif
|
||||
@@ -509,7 +509,7 @@ HRESULT CMatchFinder::MovePos()
|
||||
STDMETHODIMP_(Byte) CMatchFinder::GetIndexByte(Int32 index)
|
||||
{ return CLZInWindow::GetIndexByte(index); }
|
||||
|
||||
STDMETHODIMP_(UInt32) CMatchFinder::GetMatchLen(Int32 index,
|
||||
STDMETHODIMP_(UInt32) CMatchFinder::GetMatchLen(Int32 index,
|
||||
UInt32 back, UInt32 limit)
|
||||
{ return CLZInWindow::GetMatchLen(index, back, limit); }
|
||||
|
||||
@@ -527,5 +527,5 @@ STDMETHODIMP_(void) CMatchFinder::ChangeBufferPos()
|
||||
|
||||
#undef HASH_CALC
|
||||
#undef kNumHashDirectBytes
|
||||
|
||||
|
||||
}
|
||||
|
@@ -15,10 +15,10 @@ struct IInWindowStream: public IUnknown
|
||||
STDMETHOD_(Int32, NeedChangeBufferPos)(UInt32 numCheckBytes) PURE;
|
||||
STDMETHOD_(void, ChangeBufferPos)() PURE;
|
||||
};
|
||||
|
||||
|
||||
struct IMatchFinder: public IInWindowStream
|
||||
{
|
||||
STDMETHOD(Create)(UInt32 historySize, UInt32 keepAddBufferBefore,
|
||||
STDMETHOD(Create)(UInt32 historySize, UInt32 keepAddBufferBefore,
|
||||
UInt32 matchMaxLen, UInt32 keepAddBufferAfter) PURE;
|
||||
STDMETHOD(GetMatches)(UInt32 *distances) PURE;
|
||||
STDMETHOD(Skip)(UInt32 num) PURE;
|
||||
|
@@ -62,8 +62,8 @@ void CLZInWindow::ReleaseStream()
|
||||
// _streamPos >= _pos + _keepSizeAfter
|
||||
// _posLimit = _streamPos - _keepSizeAfter;
|
||||
// else
|
||||
//
|
||||
|
||||
//
|
||||
|
||||
HRESULT CLZInWindow::ReadBlock()
|
||||
{
|
||||
if(_streamEndWasReached)
|
||||
@@ -98,7 +98,7 @@ void CLZInWindow::MoveBlock()
|
||||
UInt32 offset = (UInt32)(_buffer - _bufferBase) + _pos - _keepSizeBefore;
|
||||
// we need one additional byte, since MovePos moves on 1 byte.
|
||||
if (offset > 0)
|
||||
offset--;
|
||||
offset--;
|
||||
UInt32 numBytes = (UInt32)(_buffer - _bufferBase) + _streamPos - offset;
|
||||
memmove(_bufferBase, _bufferBase + offset, numBytes);
|
||||
_buffer -= offset;
|
||||
|
@@ -56,7 +56,7 @@ public:
|
||||
// index + limit have not to exceed _keepSizeAfter;
|
||||
// -2G <= index < 2G
|
||||
UInt32 GetMatchLen(Int32 index, UInt32 distance, UInt32 limit) const
|
||||
{
|
||||
{
|
||||
if(_streamEndWasReached)
|
||||
if ((_pos + index) + limit > _streamPos)
|
||||
limit = _streamPos - (_pos + index);
|
||||
|
@@ -3,4 +3,4 @@
|
||||
#ifndef __STDAFX_H
|
||||
#define __STDAFX_H
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -27,10 +27,10 @@ public:
|
||||
bool IsCharState() const { return Index < 7; }
|
||||
};
|
||||
|
||||
const int kNumPosSlotBits = 6;
|
||||
const int kDicLogSizeMin = 0;
|
||||
const int kDicLogSizeMax = 32;
|
||||
const int kDistTableSizeMax = kDicLogSizeMax * 2;
|
||||
const int kNumPosSlotBits = 6;
|
||||
const int kDicLogSizeMin = 0;
|
||||
const int kDicLogSizeMax = 32;
|
||||
const int kDistTableSizeMax = kDicLogSizeMax * 2;
|
||||
|
||||
const UInt32 kNumLenToPosStates = 4;
|
||||
|
||||
|
@@ -47,7 +47,7 @@ namespace NLZMA {
|
||||
const int kDefaultDictionaryLogSize = 22;
|
||||
const UInt32 kNumFastBytesDefault = 0x20;
|
||||
|
||||
enum
|
||||
enum
|
||||
{
|
||||
kBT2,
|
||||
kBT3,
|
||||
@@ -55,7 +55,7 @@ enum
|
||||
kHC4
|
||||
};
|
||||
|
||||
static const wchar_t *kMatchFinderIDs[] =
|
||||
static const wchar_t *kMatchFinderIDs[] =
|
||||
{
|
||||
L"BT2",
|
||||
L"BT3",
|
||||
@@ -90,7 +90,7 @@ void CLiteralEncoder2::Encode(NRangeCoder::CEncoder *rangeEncoder, Byte symbol)
|
||||
{
|
||||
UInt32 context = 1;
|
||||
int i = 8;
|
||||
do
|
||||
do
|
||||
{
|
||||
i--;
|
||||
UInt32 bit = (symbol >> i) & 1;
|
||||
@@ -100,12 +100,12 @@ void CLiteralEncoder2::Encode(NRangeCoder::CEncoder *rangeEncoder, Byte symbol)
|
||||
while(i != 0);
|
||||
}
|
||||
|
||||
void CLiteralEncoder2::EncodeMatched(NRangeCoder::CEncoder *rangeEncoder,
|
||||
void CLiteralEncoder2::EncodeMatched(NRangeCoder::CEncoder *rangeEncoder,
|
||||
Byte matchByte, Byte symbol)
|
||||
{
|
||||
UInt32 context = 1;
|
||||
int i = 8;
|
||||
do
|
||||
do
|
||||
{
|
||||
i--;
|
||||
UInt32 bit = (symbol >> i) & 1;
|
||||
@@ -134,7 +134,7 @@ UInt32 CLiteralEncoder2::GetPrice(bool matchMode, Byte matchByte, Byte symbol) c
|
||||
int i = 8;
|
||||
if (matchMode)
|
||||
{
|
||||
do
|
||||
do
|
||||
{
|
||||
i--;
|
||||
UInt32 matchBit = (matchByte >> i) & 1;
|
||||
@@ -277,7 +277,7 @@ HRESULT CEncoder::Create()
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef COMPRESS_MF_HC
|
||||
case kHC4:
|
||||
{
|
||||
@@ -304,7 +304,7 @@ HRESULT CEncoder::Create()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if (!_literalEncoder.Create(_numLiteralPosStateBits, _numLiteralContextBits))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
@@ -342,7 +342,7 @@ static int FindMatchFinder(const wchar_t *s)
|
||||
return -1;
|
||||
}
|
||||
|
||||
STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs,
|
||||
STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs,
|
||||
const PROPVARIANT *properties, UInt32 numProperties)
|
||||
{
|
||||
for (UInt32 i = 0; i < numProperties; i++)
|
||||
@@ -372,7 +372,7 @@ STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs,
|
||||
if (prop.vt != VT_UI4)
|
||||
return E_INVALIDARG;
|
||||
UInt32 maximize = prop.ulVal;
|
||||
_fastMode = (maximize == 0);
|
||||
_fastMode = (maximize == 0);
|
||||
// _maxMode = (maximize >= 2);
|
||||
break;
|
||||
}
|
||||
@@ -483,7 +483,7 @@ STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs,
|
||||
}
|
||||
|
||||
STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream)
|
||||
{
|
||||
{
|
||||
const UInt32 kPropSize = 5;
|
||||
Byte properties[kPropSize];
|
||||
properties[0] = (_posStateBits * 5 + _numLiteralPosStateBits) * 9 + _numLiteralContextBits;
|
||||
@@ -587,7 +587,7 @@ UInt32 CEncoder::Backward(UInt32 &backRes, UInt32 cur)
|
||||
while(cur != 0);
|
||||
backRes = _optimum[0].BackPrev;
|
||||
_optimumCurrentIndex = _optimum[0].PosPrev;
|
||||
return _optimumCurrentIndex;
|
||||
return _optimumCurrentIndex;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -606,7 +606,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
return S_OK;
|
||||
}
|
||||
_optimumCurrentIndex = _optimumEndIndex = 0;
|
||||
|
||||
|
||||
UInt32 lenMain, numDistancePairs;
|
||||
if (!_longestMatchWasFound)
|
||||
{
|
||||
@@ -644,7 +644,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
continue;
|
||||
}
|
||||
UInt32 lenTest;
|
||||
for (lenTest = 2; lenTest < numAvailableBytes &&
|
||||
for (lenTest = 2; lenTest < numAvailableBytes &&
|
||||
data[lenTest] == data[(size_t)lenTest - backOffset]; lenTest++);
|
||||
repLens[i] = lenTest;
|
||||
if (lenTest > repLens[repMaxIndex])
|
||||
@@ -660,7 +660,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
UInt32 *matchDistances = _matchDistances + 1;
|
||||
if(lenMain >= _numFastBytes)
|
||||
{
|
||||
backRes = matchDistances[numDistancePairs - 1] + kNumRepDistances;
|
||||
backRes = matchDistances[numDistancePairs - 1] + kNumRepDistances;
|
||||
lenRes = lenMain;
|
||||
return MovePos(lenMain - 1);
|
||||
}
|
||||
@@ -678,7 +678,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
|
||||
UInt32 posState = (position & _posStateMask);
|
||||
|
||||
_optimum[1].Price = _isMatch[_state.Index][posState].GetPrice0() +
|
||||
_optimum[1].Price = _isMatch[_state.Index][posState].GetPrice0() +
|
||||
_literalEncoder.GetSubCoder(position, _previousByte)->GetPrice(!_state.IsCharState(), matchByte, currentByte);
|
||||
_optimum[1].MakeAsChar();
|
||||
|
||||
@@ -722,7 +722,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
{
|
||||
UInt32 curAndLenPrice = price + _repMatchLenEncoder.GetPrice(repLen - 2, posState);
|
||||
COptimal &optimum = _optimum[repLen];
|
||||
if (curAndLenPrice < optimum.Price)
|
||||
if (curAndLenPrice < optimum.Price)
|
||||
{
|
||||
optimum.Price = curAndLenPrice;
|
||||
optimum.PosPrev = 0;
|
||||
@@ -746,7 +746,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
UInt32 distance = matchDistances[offs + 1];
|
||||
UInt32 curAndLenPrice = normalMatchPrice + GetPosLenPrice(distance, len, posState);
|
||||
COptimal &optimum = _optimum[len];
|
||||
if (curAndLenPrice < optimum.Price)
|
||||
if (curAndLenPrice < optimum.Price)
|
||||
{
|
||||
optimum.Price = curAndLenPrice;
|
||||
optimum.PosPrev = 0;
|
||||
@@ -847,7 +847,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
curOptimum.State = state;
|
||||
for(UInt32 i = 0; i < kNumRepDistances; i++)
|
||||
curOptimum.Backs[i] = reps[i];
|
||||
UInt32 curPrice = curOptimum.Price;
|
||||
UInt32 curPrice = curOptimum.Price;
|
||||
const Byte *data = _matchFinder->GetPointerToCurrentPos() - 1;
|
||||
const Byte currentByte = *data;
|
||||
const Byte matchByte = data[(size_t)0 - reps[0] - 1];
|
||||
@@ -861,7 +861,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
COptimal &nextOptimum = _optimum[cur + 1];
|
||||
|
||||
bool nextIsChar = false;
|
||||
if (curAnd1Price < nextOptimum.Price)
|
||||
if (curAnd1Price < nextOptimum.Price)
|
||||
{
|
||||
nextOptimum.Price = curAnd1Price;
|
||||
nextOptimum.PosPrev = cur;
|
||||
@@ -871,7 +871,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
|
||||
UInt32 matchPrice = curPrice + _isMatch[state.Index][posState].GetPrice1();
|
||||
UInt32 repMatchPrice = matchPrice + _isRep[state.Index].GetPrice1();
|
||||
|
||||
|
||||
if(matchByte == currentByte &&
|
||||
!(nextOptimum.PosPrev < cur && nextOptimum.BackPrev == 0))
|
||||
{
|
||||
@@ -903,7 +903,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
UInt32 backOffset = reps[0] + 1;
|
||||
UInt32 limit = MyMin(numAvailableBytesFull, _numFastBytes + 1);
|
||||
UInt32 temp;
|
||||
for (temp = 1; temp < limit &&
|
||||
for (temp = 1; temp < limit &&
|
||||
data[temp] == data[(size_t)temp - backOffset]; temp++);
|
||||
UInt32 lenTest2 = temp - 1;
|
||||
if (lenTest2 >= 2)
|
||||
@@ -911,7 +911,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
CState state2 = state;
|
||||
state2.UpdateChar();
|
||||
UInt32 posStateNext = (position + 1) & _posStateMask;
|
||||
UInt32 nextRepMatchPrice = curAnd1Price +
|
||||
UInt32 nextRepMatchPrice = curAnd1Price +
|
||||
_isMatch[state2.Index][posStateNext].GetPrice1() +
|
||||
_isRep[state2.Index].GetPrice1();
|
||||
// for (; lenTest2 >= 2; lenTest2--)
|
||||
@@ -922,7 +922,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
UInt32 curAndLenPrice = nextRepMatchPrice + GetRepPrice(
|
||||
0, lenTest2, state2, posStateNext);
|
||||
COptimal &optimum = _optimum[offset];
|
||||
if (curAndLenPrice < optimum.Price)
|
||||
if (curAndLenPrice < optimum.Price)
|
||||
{
|
||||
optimum.Price = curAndLenPrice;
|
||||
optimum.PosPrev = cur + 1;
|
||||
@@ -933,8 +933,8 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UInt32 startLen = 2; // speed optimization
|
||||
|
||||
UInt32 startLen = 2; // speed optimization
|
||||
for(UInt32 repIndex = 0; repIndex < kNumRepDistances; repIndex++)
|
||||
{
|
||||
// UInt32 repLen = _matchFinder->GetMatchLen(0 - 1, reps[repIndex], newLen); // test it;
|
||||
@@ -943,7 +943,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
data[1] != data[(size_t)1 - backOffset])
|
||||
continue;
|
||||
UInt32 lenTest;
|
||||
for (lenTest = 2; lenTest < numAvailableBytes &&
|
||||
for (lenTest = 2; lenTest < numAvailableBytes &&
|
||||
data[lenTest] == data[(size_t)lenTest - backOffset]; lenTest++);
|
||||
while(lenEnd < cur + lenTest)
|
||||
_optimum[++lenEnd].Price = kIfinityPrice;
|
||||
@@ -953,7 +953,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
{
|
||||
UInt32 curAndLenPrice = price + _repMatchLenEncoder.GetPrice(lenTest - 2, posState);
|
||||
COptimal &optimum = _optimum[cur + lenTest];
|
||||
if (curAndLenPrice < optimum.Price)
|
||||
if (curAndLenPrice < optimum.Price)
|
||||
{
|
||||
optimum.Price = curAndLenPrice;
|
||||
optimum.PosPrev = cur;
|
||||
@@ -963,15 +963,15 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
}
|
||||
while(--lenTest >= 2);
|
||||
lenTest = lenTestTemp;
|
||||
|
||||
|
||||
if (repIndex == 0)
|
||||
startLen = lenTest + 1;
|
||||
|
||||
|
||||
// if (_maxMode)
|
||||
{
|
||||
UInt32 lenTest2 = lenTest + 1;
|
||||
UInt32 limit = MyMin(numAvailableBytesFull, lenTest2 + _numFastBytes);
|
||||
for (; lenTest2 < limit &&
|
||||
for (; lenTest2 < limit &&
|
||||
data[lenTest2] == data[(size_t)lenTest2 - backOffset]; lenTest2++);
|
||||
lenTest2 -= lenTest + 1;
|
||||
if (lenTest2 >= 2)
|
||||
@@ -979,17 +979,17 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
CState state2 = state;
|
||||
state2.UpdateRep();
|
||||
UInt32 posStateNext = (position + lenTest) & _posStateMask;
|
||||
UInt32 curAndLenCharPrice =
|
||||
price + _repMatchLenEncoder.GetPrice(lenTest - 2, posState) +
|
||||
UInt32 curAndLenCharPrice =
|
||||
price + _repMatchLenEncoder.GetPrice(lenTest - 2, posState) +
|
||||
_isMatch[state2.Index][posStateNext].GetPrice0() +
|
||||
_literalEncoder.GetSubCoder(position + lenTest, data[(size_t)lenTest - 1])->GetPrice(
|
||||
true, data[(size_t)lenTest - backOffset], data[lenTest]);
|
||||
state2.UpdateChar();
|
||||
posStateNext = (position + lenTest + 1) & _posStateMask;
|
||||
UInt32 nextRepMatchPrice = curAndLenCharPrice +
|
||||
UInt32 nextRepMatchPrice = curAndLenCharPrice +
|
||||
_isMatch[state2.Index][posStateNext].GetPrice1() +
|
||||
_isRep[state2.Index].GetPrice1();
|
||||
|
||||
|
||||
// for(; lenTest2 >= 2; lenTest2--)
|
||||
{
|
||||
UInt32 offset = cur + lenTest + 1 + lenTest2;
|
||||
@@ -998,7 +998,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
UInt32 curAndLenPrice = nextRepMatchPrice + GetRepPrice(
|
||||
0, lenTest2, state2, posStateNext);
|
||||
COptimal &optimum = _optimum[offset];
|
||||
if (curAndLenPrice < optimum.Price)
|
||||
if (curAndLenPrice < optimum.Price)
|
||||
{
|
||||
optimum.Price = curAndLenPrice;
|
||||
optimum.PosPrev = cur + lenTest + 1;
|
||||
@@ -1012,7 +1012,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// for(UInt32 lenTest = 2; lenTest <= newLen; lenTest++)
|
||||
if (newLen > numAvailableBytes)
|
||||
{
|
||||
@@ -1040,11 +1040,11 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
curAndLenPrice += _distancesPrices[lenToPosState][curBack];
|
||||
else
|
||||
curAndLenPrice += _posSlotPrices[lenToPosState][posSlot] + _alignPrices[curBack & kAlignMask];
|
||||
|
||||
|
||||
curAndLenPrice += _lenEncoder.GetPrice(lenTest - kMatchMinLen, posState);
|
||||
|
||||
|
||||
COptimal &optimum = _optimum[cur + lenTest];
|
||||
if (curAndLenPrice < optimum.Price)
|
||||
if (curAndLenPrice < optimum.Price)
|
||||
{
|
||||
optimum.Price = curAndLenPrice;
|
||||
optimum.PosPrev = cur;
|
||||
@@ -1058,7 +1058,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
UInt32 backOffset = curBack + 1;
|
||||
UInt32 lenTest2 = lenTest + 1;
|
||||
UInt32 limit = MyMin(numAvailableBytesFull, lenTest2 + _numFastBytes);
|
||||
for (; lenTest2 < limit &&
|
||||
for (; lenTest2 < limit &&
|
||||
data[lenTest2] == data[(size_t)lenTest2 - backOffset]; lenTest2++);
|
||||
lenTest2 -= lenTest + 1;
|
||||
if (lenTest2 >= 2)
|
||||
@@ -1066,16 +1066,16 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
CState state2 = state;
|
||||
state2.UpdateMatch();
|
||||
UInt32 posStateNext = (position + lenTest) & _posStateMask;
|
||||
UInt32 curAndLenCharPrice = curAndLenPrice +
|
||||
UInt32 curAndLenCharPrice = curAndLenPrice +
|
||||
_isMatch[state2.Index][posStateNext].GetPrice0() +
|
||||
_literalEncoder.GetSubCoder(position + lenTest, data[(size_t)lenTest - 1])->GetPrice(
|
||||
_literalEncoder.GetSubCoder(position + lenTest, data[(size_t)lenTest - 1])->GetPrice(
|
||||
true, data[(size_t)lenTest - backOffset], data[lenTest]);
|
||||
state2.UpdateChar();
|
||||
posStateNext = (posStateNext + 1) & _posStateMask;
|
||||
UInt32 nextRepMatchPrice = curAndLenCharPrice +
|
||||
UInt32 nextRepMatchPrice = curAndLenCharPrice +
|
||||
_isMatch[state2.Index][posStateNext].GetPrice1() +
|
||||
_isRep[state2.Index].GetPrice1();
|
||||
|
||||
|
||||
// for(; lenTest2 >= 2; lenTest2--)
|
||||
{
|
||||
UInt32 offset = cur + lenTest + 1 + lenTest2;
|
||||
@@ -1083,7 +1083,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes)
|
||||
_optimum[++lenEnd].Price = kIfinityPrice;
|
||||
UInt32 curAndLenPrice = nextRepMatchPrice + GetRepPrice(0, lenTest2, state2, posStateNext);
|
||||
COptimal &optimum = _optimum[offset];
|
||||
if (curAndLenPrice < optimum.Price)
|
||||
if (curAndLenPrice < optimum.Price)
|
||||
{
|
||||
optimum.Price = curAndLenPrice;
|
||||
optimum.PosPrev = cur + lenTest + 1;
|
||||
@@ -1122,7 +1122,7 @@ HRESULT CEncoder::ReadMatchDistances(UInt32 &lenRes, UInt32 &numDistancePairs)
|
||||
{
|
||||
lenRes = _matchDistances[1 + numDistancePairs - 2];
|
||||
if (lenRes == _numFastBytes)
|
||||
lenRes += _matchFinder->GetMatchLen(lenRes - 1, _matchDistances[1 + numDistancePairs - 1],
|
||||
lenRes += _matchFinder->GetMatchLen(lenRes - 1, _matchDistances[1 + numDistancePairs - 1],
|
||||
kMatchMaxLen - lenRes);
|
||||
}
|
||||
_additionalOffset++;
|
||||
@@ -1180,7 +1180,7 @@ HRESULT CEncoder::GetOptimumFast(UInt32 position, UInt32 &backRes, UInt32 &lenRe
|
||||
UInt32 *matchDistances = _matchDistances + 1;
|
||||
if(lenMain >= _numFastBytes)
|
||||
{
|
||||
backRes = matchDistances[numDistancePairs - 1] + kNumRepDistances;
|
||||
backRes = matchDistances[numDistancePairs - 1] + kNumRepDistances;
|
||||
lenRes = lenMain;
|
||||
return MovePos(lenMain - 1);
|
||||
}
|
||||
@@ -1203,7 +1203,7 @@ HRESULT CEncoder::GetOptimumFast(UInt32 position, UInt32 &backRes, UInt32 &lenRe
|
||||
|
||||
if (repLens[repMaxIndex] >= 2)
|
||||
{
|
||||
if (repLens[repMaxIndex] + 1 >= lenMain ||
|
||||
if (repLens[repMaxIndex] + 1 >= lenMain ||
|
||||
repLens[repMaxIndex] + 2 >= lenMain && (backMain > (1 << 9)) ||
|
||||
repLens[repMaxIndex] + 3 >= lenMain && (backMain > (1 << 15)))
|
||||
{
|
||||
@@ -1212,14 +1212,14 @@ HRESULT CEncoder::GetOptimumFast(UInt32 position, UInt32 &backRes, UInt32 &lenRe
|
||||
return MovePos(lenRes - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (lenMain >= 2 && numAvailableBytes > 2)
|
||||
{
|
||||
RINOK(ReadMatchDistances(_longestMatchLength, _numDistancePairs));
|
||||
if (_longestMatchLength >= 2)
|
||||
{
|
||||
UInt32 newDistance = matchDistances[_numDistancePairs - 1];
|
||||
if (_longestMatchLength >= lenMain && newDistance < backMain ||
|
||||
if (_longestMatchLength >= lenMain && newDistance < backMain ||
|
||||
_longestMatchLength == lenMain + 1 && !ChangePair(backMain, newDistance) ||
|
||||
_longestMatchLength > lenMain + 1 ||
|
||||
_longestMatchLength + 1 >= lenMain && lenMain >= 3 && ChangePair(newDistance, backMain))
|
||||
@@ -1250,7 +1250,7 @@ HRESULT CEncoder::GetOptimumFast(UInt32 position, UInt32 &backRes, UInt32 &lenRe
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
backRes = backMain + kNumRepDistances;
|
||||
backRes = backMain + kNumRepDistances;
|
||||
lenRes = lenMain;
|
||||
return MovePos(lenMain - 2);
|
||||
}
|
||||
@@ -1269,7 +1269,7 @@ HRESULT CEncoder::Flush(UInt32 nowPos)
|
||||
|
||||
void CEncoder::WriteEndMarker(UInt32 posState)
|
||||
{
|
||||
// This function for writing End Mark for stream version of LZMA.
|
||||
// This function for writing End Mark for stream version of LZMA.
|
||||
// In current version this feature is not used.
|
||||
if (!_writeEndMark)
|
||||
return;
|
||||
@@ -1289,7 +1289,7 @@ void CEncoder::WriteEndMarker(UInt32 posState)
|
||||
}
|
||||
|
||||
HRESULT CEncoder::CodeReal(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream,
|
||||
ISequentialOutStream *outStream,
|
||||
const UInt64 *inSize, const UInt64 *outSize,
|
||||
ICompressProgressInfo *progress)
|
||||
{
|
||||
@@ -1312,7 +1312,7 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream,
|
||||
}
|
||||
|
||||
HRESULT CEncoder::SetStreams(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream,
|
||||
ISequentialOutStream *outStream,
|
||||
const UInt64 *inSize, const UInt64 *outSize)
|
||||
{
|
||||
_inStream = inStream;
|
||||
@@ -1320,7 +1320,7 @@ HRESULT CEncoder::SetStreams(ISequentialInStream *inStream,
|
||||
RINOK(Create());
|
||||
RINOK(SetOutStream(outStream));
|
||||
RINOK(Init());
|
||||
|
||||
|
||||
// CCoderReleaser releaser(this);
|
||||
|
||||
/*
|
||||
@@ -1455,7 +1455,7 @@ HRESULT CEncoder::CodeOneBlock(UInt64 *inSize, UInt64 *outSize, Int32 *finished)
|
||||
pos -= kNumRepDistances;
|
||||
UInt32 posSlot = GetPosSlot(pos);
|
||||
_posSlotEncoder[GetLenToPosState(len)].Encode(&_rangeEncoder, posSlot);
|
||||
|
||||
|
||||
if (posSlot >= kStartPosModelIndex)
|
||||
{
|
||||
UInt32 footerBits = ((posSlot >> 1) - 1);
|
||||
@@ -1463,7 +1463,7 @@ HRESULT CEncoder::CodeOneBlock(UInt64 *inSize, UInt64 *outSize, Int32 *finished)
|
||||
UInt32 posReduced = pos - base;
|
||||
|
||||
if (posSlot < kEndPosModelIndex)
|
||||
NRangeCoder::ReverseBitTreeEncode(_posEncoders + base - posSlot - 1,
|
||||
NRangeCoder::ReverseBitTreeEncode(_posEncoders + base - posSlot - 1,
|
||||
&_rangeEncoder, footerBits, posReduced);
|
||||
else
|
||||
{
|
||||
@@ -1511,26 +1511,26 @@ STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream,
|
||||
ICompressProgressInfo *progress)
|
||||
{
|
||||
#ifndef _NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
#endif
|
||||
return CodeReal(inStream, outStream, inSize, outSize, progress);
|
||||
return CodeReal(inStream, outStream, inSize, outSize, progress);
|
||||
#ifndef _NO_EXCEPTIONS
|
||||
}
|
||||
catch(const COutBufferException &e) { return e.ErrorCode; }
|
||||
catch(...) { return E_FAIL; }
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void CEncoder::FillDistancesPrices()
|
||||
{
|
||||
UInt32 tempPrices[kNumFullDistances];
|
||||
for (UInt32 i = kStartPosModelIndex; i < kNumFullDistances; i++)
|
||||
{
|
||||
{
|
||||
UInt32 posSlot = GetPosSlot(i);
|
||||
UInt32 footerBits = ((posSlot >> 1) - 1);
|
||||
UInt32 base = ((2 | (posSlot & 1)) << footerBits);
|
||||
tempPrices[i] = NRangeCoder::ReverseBitTreeGetPrice(_posEncoders +
|
||||
tempPrices[i] = NRangeCoder::ReverseBitTreeGetPrice(_posEncoders +
|
||||
base - posSlot - 1, footerBits, i - base);
|
||||
}
|
||||
|
||||
|
@@ -39,11 +39,11 @@ struct COptimal
|
||||
bool Prev2;
|
||||
|
||||
UInt32 PosPrev2;
|
||||
UInt32 BackPrev2;
|
||||
UInt32 BackPrev2;
|
||||
|
||||
UInt32 Price;
|
||||
UInt32 Price;
|
||||
UInt32 PosPrev; // posNext;
|
||||
UInt32 BackPrev;
|
||||
UInt32 BackPrev;
|
||||
UInt32 Backs[kNumRepDistances];
|
||||
void MakeAsChar() { BackPrev = UInt32(-1); Prev1IsChar = false; }
|
||||
void MakeAsShortRep() { BackPrev = 0; ; Prev1IsChar = false; }
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
CLiteralEncoder(): _coders(0) {}
|
||||
~CLiteralEncoder() { Free(); }
|
||||
void Free()
|
||||
{
|
||||
{
|
||||
MyFree(_coders);
|
||||
_coders = 0;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
class CEncoder :
|
||||
class CEncoder :
|
||||
public ICompressCoder,
|
||||
public ICompressSetOutStream,
|
||||
public ICompressSetCoderProperties,
|
||||
@@ -195,7 +195,7 @@ class CEncoder :
|
||||
|
||||
CMyBitEncoder _posEncoders[kNumFullDistances - kEndPosModelIndex];
|
||||
NRangeCoder::CBitTreeEncoder<kNumMoveBits, kNumAlignBits> _posAlignEncoder;
|
||||
|
||||
|
||||
NLength::CPriceTableEncoder _lenEncoder;
|
||||
NLength::CPriceTableEncoder _repMatchLenEncoder;
|
||||
|
||||
@@ -206,7 +206,7 @@ class CEncoder :
|
||||
bool _fastMode;
|
||||
// bool _maxMode;
|
||||
UInt32 _numFastBytes;
|
||||
UInt32 _longestMatchLength;
|
||||
UInt32 _longestMatchLength;
|
||||
UInt32 _numDistancePairs;
|
||||
|
||||
UInt32 _additionalOffset;
|
||||
@@ -217,7 +217,7 @@ class CEncoder :
|
||||
bool _longestMatchWasFound;
|
||||
|
||||
UInt32 _posSlotPrices[kNumLenToPosStates][kDistTableSizeMax];
|
||||
|
||||
|
||||
UInt32 _distancesPrices[kNumLenToPosStates][kNumFullDistances];
|
||||
|
||||
UInt32 _alignPrices[kAlignTableSize];
|
||||
@@ -257,7 +257,7 @@ class CEncoder :
|
||||
setMfPasses = 0;
|
||||
_matchFinder.Release();
|
||||
}
|
||||
|
||||
|
||||
HRESULT ReadMatchDistances(UInt32 &len, UInt32 &numDistancePairs);
|
||||
|
||||
HRESULT MovePos(UInt32 num);
|
||||
@@ -266,7 +266,7 @@ class CEncoder :
|
||||
return _isRepG0[state.Index].GetPrice0() +
|
||||
_isRep0Long[state.Index][posState].GetPrice0();
|
||||
}
|
||||
|
||||
|
||||
UInt32 GetPureRepPrice(UInt32 repIndex, CState state, UInt32 posState) const
|
||||
{
|
||||
UInt32 price;
|
||||
@@ -307,7 +307,7 @@ class CEncoder :
|
||||
if (pos < kNumFullDistances)
|
||||
price = _distancesPrices[lenToPosState][pos];
|
||||
else
|
||||
price = _posSlotPrices[lenToPosState][GetPosSlot2(pos)] +
|
||||
price = _posSlotPrices[lenToPosState][GetPosSlot2(pos)] +
|
||||
_alignPrices[pos & kAlignMask];
|
||||
return price + _lenEncoder.GetPrice(len - kMatchMinLen, posState);
|
||||
}
|
||||
@@ -319,7 +319,7 @@ class CEncoder :
|
||||
if (pos < kNumFullDistances)
|
||||
price = _distancesPrices[lenToPosState][pos];
|
||||
else
|
||||
price = _posSlotPrices[lenToPosState][GetPosSlot2(pos)] +
|
||||
price = _posSlotPrices[lenToPosState][GetPosSlot2(pos)] +
|
||||
_alignPrices[pos & kAlignMask];
|
||||
return price + _lenEncoder.GetPrice(len - kMatchMinLen, posState);
|
||||
}
|
||||
@@ -330,7 +330,7 @@ class CEncoder :
|
||||
|
||||
void FillDistancesPrices();
|
||||
void FillAlignPrices();
|
||||
|
||||
|
||||
void ReleaseMFStream()
|
||||
{
|
||||
if (_matchFinder && _needReleaseMFStream)
|
||||
@@ -373,9 +373,9 @@ public:
|
||||
ICompressSetCoderProperties,
|
||||
ICompressWriteCoderProperties
|
||||
)
|
||||
|
||||
|
||||
HRESULT Init();
|
||||
|
||||
|
||||
// ICompressCoder interface
|
||||
HRESULT SetStreams(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream,
|
||||
@@ -383,20 +383,20 @@ public:
|
||||
HRESULT CodeOneBlock(UInt64 *inSize, UInt64 *outSize, Int32 *finished);
|
||||
|
||||
HRESULT CodeReal(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream,
|
||||
ISequentialOutStream *outStream,
|
||||
const UInt64 *inSize, const UInt64 *outSize,
|
||||
ICompressProgressInfo *progress);
|
||||
|
||||
// ICompressCoder interface
|
||||
STDMETHOD(Code)(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream,
|
||||
ISequentialOutStream *outStream,
|
||||
const UInt64 *inSize, const UInt64 *outSize,
|
||||
ICompressProgressInfo *progress);
|
||||
|
||||
// ICompressSetCoderProperties2
|
||||
STDMETHOD(SetCoderProperties)(const PROPID *propIDs,
|
||||
STDMETHOD(SetCoderProperties)(const PROPID *propIDs,
|
||||
const PROPVARIANT *properties, UInt32 numProperties);
|
||||
|
||||
|
||||
// ICompressWriteCoderProperties
|
||||
STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
|
||||
|
||||
|
@@ -34,7 +34,7 @@ public:
|
||||
|
||||
void FlushData()
|
||||
{
|
||||
// Low += 1;
|
||||
// Low += 1;
|
||||
for(int i = 0; i < 5; i++)
|
||||
ShiftLow();
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
|
||||
void ShiftLow()
|
||||
{
|
||||
if ((UInt32)Low < (UInt32)0xFF000000 || (int)(Low >> 32) != 0)
|
||||
if ((UInt32)Low < (UInt32)0xFF000000 || (int)(Low >> 32) != 0)
|
||||
{
|
||||
Byte temp = _cache;
|
||||
do
|
||||
@@ -65,12 +65,12 @@ public:
|
||||
temp = 0xFF;
|
||||
}
|
||||
while(--_cacheSize != 0);
|
||||
_cache = (Byte)((UInt32)Low >> 24);
|
||||
}
|
||||
_cacheSize++;
|
||||
Low = (UInt32)Low << 8;
|
||||
_cache = (Byte)((UInt32)Low >> 24);
|
||||
}
|
||||
_cacheSize++;
|
||||
Low = (UInt32)Low << 8;
|
||||
}
|
||||
|
||||
|
||||
void EncodeDirectBits(UInt32 value, int numTotalBits)
|
||||
{
|
||||
for (int i = numTotalBits - 1; i >= 0; i--)
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
Range <<= 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SetStream(ISequentialInStream *stream) { Stream.SetStream(stream); }
|
||||
void Init()
|
||||
{
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
UInt32 DecodeDirectBits(int numTotalBits)
|
||||
{
|
||||
UInt32 range = Range;
|
||||
UInt32 code = Code;
|
||||
UInt32 code = Code;
|
||||
UInt32 result = 0;
|
||||
for (int i = numTotalBits; i != 0; i--)
|
||||
{
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
if (range < kTopValue)
|
||||
{
|
||||
code = (code << 8) | Stream.ReadByte();
|
||||
range <<= 8;
|
||||
range <<= 8;
|
||||
}
|
||||
}
|
||||
Range = range;
|
||||
|
@@ -20,7 +20,7 @@ void CPriceTables::Init()
|
||||
UInt32 start = 1 << (kNumBits - i - 1);
|
||||
UInt32 end = 1 << (kNumBits - i);
|
||||
for (UInt32 j = start; j < end; j++)
|
||||
ProbPrices[j] = (i << kNumBitPriceShiftBits) +
|
||||
ProbPrices[j] = (i << kNumBitPriceShiftBits) +
|
||||
(((end - j) << kNumBitPriceShiftBits) >> (kNumBits - i - 1));
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ void CPriceTables::Init()
|
||||
for(UInt32 i = 1; i < (kBitModelTotal >> kNumMoveReducingBits) - 1; i++)
|
||||
ProbPrices[i] = kBitPrice;
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
const double kDummyMultMid = (1.0 / kBitPrice) / 2;
|
||||
const double kDummyMultMid = 0;
|
||||
@@ -39,7 +39,7 @@ void CPriceTables::Init()
|
||||
for(UInt32 i = 1; i < (kBitModelTotal >> kNumMoveReducingBits) - 1; i++)
|
||||
ProbPrices[i] = UInt32((fabs(lnAll - log(double(i))) / ln2 + kDummyMultMid) * kBitPrice);
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
// experimental, slow, solution:
|
||||
for(UInt32 i = 1; i < (kBitModelTotal >> kNumMoveReducingBits) - 1; i++)
|
||||
@@ -70,7 +70,7 @@ void CPriceTables::Init()
|
||||
range -= (1 << 31);
|
||||
}
|
||||
}
|
||||
ProbPrices[i] = (bitCount
|
||||
ProbPrices[i] = (bitCount
|
||||
// + (1 << (kCyclesBits - 1))
|
||||
) >> kCyclesBits;
|
||||
}
|
||||
|
@@ -108,7 +108,7 @@ public:
|
||||
};
|
||||
|
||||
template <int numMoveBits>
|
||||
void ReverseBitTreeEncode(CBitEncoder<numMoveBits> *Models,
|
||||
void ReverseBitTreeEncode(CBitEncoder<numMoveBits> *Models,
|
||||
CEncoder *rangeEncoder, int NumBitLevels, UInt32 symbol)
|
||||
{
|
||||
UInt32 modelIndex = 1;
|
||||
@@ -122,7 +122,7 @@ void ReverseBitTreeEncode(CBitEncoder<numMoveBits> *Models,
|
||||
}
|
||||
|
||||
template <int numMoveBits>
|
||||
UInt32 ReverseBitTreeGetPrice(CBitEncoder<numMoveBits> *Models,
|
||||
UInt32 ReverseBitTreeGetPrice(CBitEncoder<numMoveBits> *Models,
|
||||
UInt32 NumBitLevels, UInt32 symbol)
|
||||
{
|
||||
UInt32 price = 0;
|
||||
@@ -138,7 +138,7 @@ UInt32 ReverseBitTreeGetPrice(CBitEncoder<numMoveBits> *Models,
|
||||
}
|
||||
|
||||
template <int numMoveBits>
|
||||
UInt32 ReverseBitTreeDecode(CBitDecoder<numMoveBits> *Models,
|
||||
UInt32 ReverseBitTreeDecode(CBitDecoder<numMoveBits> *Models,
|
||||
CDecoder *rangeDecoder, int NumBitLevels)
|
||||
{
|
||||
UInt32 modelIndex = 1;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
#define RC_INIT_VAR \
|
||||
UInt32 range = rangeDecoder->Range; \
|
||||
UInt32 code = rangeDecoder->Code;
|
||||
UInt32 code = rangeDecoder->Code;
|
||||
|
||||
#define RC_FLUSH_VAR \
|
||||
rangeDecoder->Range = range; \
|
||||
|
@@ -1,21 +1,21 @@
|
||||
/*
|
||||
LzmaDecode.c
|
||||
LZMA Decoder (optimized for Speed version)
|
||||
|
||||
|
||||
LZMA SDK 4.22 Copyright (c) 1999-2005 Igor Pavlov (2005-06-10)
|
||||
http://www.7-zip.org/
|
||||
|
||||
LZMA SDK is licensed under two licenses:
|
||||
1) GNU Lesser General Public License (GNU LGPL)
|
||||
2) Common Public License (CPL)
|
||||
It means that you can select one of these two licenses and
|
||||
It means that you can select one of these two licenses and
|
||||
follow rules of that license.
|
||||
|
||||
SPECIAL EXCEPTION:
|
||||
Igor Pavlov, as the author of this Code, expressly permits you to
|
||||
statically or dynamically link your Code (or bind by name) to the
|
||||
interfaces of this file without subjecting your linked Code to the
|
||||
terms of the CPL or GNU LGPL. Any modifications or additions
|
||||
Igor Pavlov, as the author of this Code, expressly permits you to
|
||||
statically or dynamically link your Code (or bind by name) to the
|
||||
interfaces of this file without subjecting your linked Code to the
|
||||
terms of the CPL or GNU LGPL. Any modifications or additions
|
||||
to this file, however, are subject to the LGPL or CPL terms.
|
||||
*/
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
|
||||
|
||||
#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
|
||||
@@ -61,9 +61,9 @@
|
||||
|
||||
#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
|
||||
{ UpdateBit0(p); mi <<= 1; A0; } else \
|
||||
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
|
||||
|
||||
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
|
||||
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
|
||||
|
||||
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
|
||||
|
||||
#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
|
||||
{ int i = numLevels; res = 1; \
|
||||
@@ -86,7 +86,7 @@
|
||||
#define LenLow (LenChoice2 + 1)
|
||||
#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
|
||||
#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
|
||||
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
|
||||
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
|
||||
|
||||
|
||||
#define kNumStates 12
|
||||
@@ -172,7 +172,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
||||
int lc = vs->Properties.lc;
|
||||
|
||||
#ifdef _LZMA_OUT_READ
|
||||
|
||||
|
||||
UInt32 Range = vs->Range;
|
||||
UInt32 Code = vs->Code;
|
||||
#ifdef _LZMA_IN_CB
|
||||
@@ -214,7 +214,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
||||
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
|
||||
UInt32 i;
|
||||
for (i = 0; i < numProbs; i++)
|
||||
p[i] = kBitModelTotal >> 1;
|
||||
p[i] = kBitModelTotal >> 1;
|
||||
rep0 = rep1 = rep2 = rep3 = 1;
|
||||
state = 0;
|
||||
globalPos = 0;
|
||||
@@ -265,7 +265,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
||||
for (i = 0; i < numProbs; i++)
|
||||
p[i] = kBitModelTotal >> 1;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _LZMA_IN_CB
|
||||
RC_INIT;
|
||||
#else
|
||||
@@ -279,7 +279,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
||||
CProb *prob;
|
||||
UInt32 bound;
|
||||
int posState = (int)(
|
||||
(nowPos
|
||||
(nowPos
|
||||
#ifdef _LZMA_OUT_READ
|
||||
+ globalPos
|
||||
#endif
|
||||
@@ -291,9 +291,9 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
||||
{
|
||||
int symbol = 1;
|
||||
UpdateBit0(prob)
|
||||
prob = p + Literal + (LZMA_LIT_SIZE *
|
||||
prob = p + Literal + (LZMA_LIT_SIZE *
|
||||
(((
|
||||
(nowPos
|
||||
(nowPos
|
||||
#ifdef _LZMA_OUT_READ
|
||||
+ globalPos
|
||||
#endif
|
||||
@@ -342,7 +342,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
||||
else if (state < 10) state -= 3;
|
||||
else state -= 6;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
UpdateBit1(prob);
|
||||
prob = p + IsRep + state;
|
||||
@@ -369,14 +369,14 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
||||
UInt32 pos;
|
||||
#endif
|
||||
UpdateBit0(prob);
|
||||
|
||||
|
||||
#ifdef _LZMA_OUT_READ
|
||||
if (distanceLimit == 0)
|
||||
#else
|
||||
if (nowPos == 0)
|
||||
#endif
|
||||
return LZMA_RESULT_DATA_ERROR;
|
||||
|
||||
|
||||
state = state < kNumLitStates ? 9 : 11;
|
||||
#ifdef _LZMA_OUT_READ
|
||||
pos = dictionaryPos - rep0;
|
||||
@@ -412,7 +412,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
||||
UpdateBit0(prob);
|
||||
distance = rep1;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
UpdateBit1(prob);
|
||||
prob = p + IsRepG2 + state;
|
||||
@@ -473,7 +473,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
||||
int posSlot;
|
||||
state += kNumLitStates;
|
||||
prob = p + PosSlot +
|
||||
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
|
||||
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
|
||||
kNumPosSlotBits);
|
||||
RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
|
||||
if (posSlot >= kStartPosModelIndex)
|
||||
@@ -528,7 +528,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
||||
|
||||
len += kMatchMinLen;
|
||||
#ifdef _LZMA_OUT_READ
|
||||
if (rep0 > distanceLimit)
|
||||
if (rep0 > distanceLimit)
|
||||
#else
|
||||
if (rep0 > nowPos)
|
||||
#endif
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
LzmaDecode.h
|
||||
LZMA Decoder interface
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
LZMA SDK is licensed under two licenses:
|
||||
1) GNU Lesser General Public License (GNU LGPL)
|
||||
2) Common Public License (CPL)
|
||||
It means that you can select one of these two licenses and
|
||||
It means that you can select one of these two licenses and
|
||||
follow rules of that license.
|
||||
|
||||
SPECIAL EXCEPTION:
|
||||
Igor Pavlov, as the author of this code, expressly permits you to
|
||||
statically or dynamically link your code (or bind by name) to the
|
||||
interfaces of this file without subjecting your linked code to the
|
||||
terms of the CPL or GNU LGPL. Any modifications or additions
|
||||
Igor Pavlov, as the author of this code, expressly permits you to
|
||||
statically or dynamically link your code (or bind by name) to the
|
||||
interfaces of this file without subjecting your linked code to the
|
||||
terms of the CPL or GNU LGPL. Any modifications or additions
|
||||
to this file, however, are subject to the LGPL or CPL terms.
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
/* Use read function for output data */
|
||||
|
||||
/* #define _LZMA_PROB32 */
|
||||
/* It can increase speed on some 32-bit CPUs,
|
||||
/* It can increase speed on some 32-bit CPUs,
|
||||
but memory usage will be doubled in that case */
|
||||
|
||||
/* #define _LZMA_LOC_OPT */
|
||||
|
@@ -19,8 +19,8 @@ CODER_INTERFACE(ICompressProgressInfo, 0x04)
|
||||
CODER_INTERFACE(ICompressCoder, 0x05)
|
||||
{
|
||||
STDMETHOD(Code)(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream,
|
||||
const UInt64 *inSize,
|
||||
ISequentialOutStream *outStream,
|
||||
const UInt64 *inSize,
|
||||
const UInt64 *outSize,
|
||||
ICompressProgressInfo *progress) PURE;
|
||||
};
|
||||
@@ -28,9 +28,9 @@ CODER_INTERFACE(ICompressCoder, 0x05)
|
||||
CODER_INTERFACE(ICompressCoder2, 0x18)
|
||||
{
|
||||
STDMETHOD(Code)(ISequentialInStream **inStreams,
|
||||
const UInt64 **inSizes,
|
||||
const UInt64 **inSizes,
|
||||
UInt32 numInStreams,
|
||||
ISequentialOutStream **outStreams,
|
||||
ISequentialOutStream **outStreams,
|
||||
const UInt64 **outSizes,
|
||||
UInt32 numOutStreams,
|
||||
ICompressProgressInfo *progress) PURE;
|
||||
@@ -49,7 +49,7 @@ namespace NCoderPropID
|
||||
kNumFastBytes = 0x450,
|
||||
kMatchFinder,
|
||||
kMatchFinderCycles,
|
||||
kNumPasses = 0x460,
|
||||
kNumPasses = 0x460,
|
||||
kAlgorithm = 0x470,
|
||||
kMultiThread = 0x480,
|
||||
kNumThreads,
|
||||
@@ -59,7 +59,7 @@ namespace NCoderPropID
|
||||
|
||||
CODER_INTERFACE(ICompressSetCoderProperties, 0x20)
|
||||
{
|
||||
STDMETHOD(SetCoderProperties)(const PROPID *propIDs,
|
||||
STDMETHOD(SetCoderProperties)(const PROPID *propIDs,
|
||||
const PROPVARIANT *properties, UInt32 numProperties) PURE;
|
||||
};
|
||||
|
||||
@@ -124,7 +124,7 @@ CODER_INTERFACE(ICompressFilter, 0x40)
|
||||
// Filter return outSize (UInt32)
|
||||
// if (outSize <= size): Filter have converted outSize bytes
|
||||
// if (outSize > size): Filter have not converted anything.
|
||||
// and it needs at least outSize bytes to convert one block
|
||||
// and it needs at least outSize bytes to convert one block
|
||||
// (it's for crypto block algorithms).
|
||||
};
|
||||
|
||||
|
@@ -21,7 +21,7 @@ STREAM_INTERFACE(ISequentialInStream, 0x01)
|
||||
/*
|
||||
Out: if size != 0, return_value = S_OK and (*processedSize == 0),
|
||||
then there are no more bytes in stream.
|
||||
if (size > 0) && there are bytes in stream,
|
||||
if (size > 0) && there are bytes in stream,
|
||||
this function must read at least 1 byte.
|
||||
This function is allowed to read less than number of remaining bytes in stream.
|
||||
You must call Read function in loop, if you need exact amount of data
|
||||
|
@@ -35,7 +35,7 @@ void MyFree(void *address) throw()
|
||||
if (address != 0)
|
||||
fprintf(stderr, "\nFree; count = %10d", --g_allocCount);
|
||||
#endif
|
||||
|
||||
|
||||
::free(address);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ void MidFree(void *address) throw()
|
||||
::VirtualFree(address, 0, MEM_RELEASE);
|
||||
}
|
||||
|
||||
static SIZE_T g_LargePageSize =
|
||||
static SIZE_T g_LargePageSize =
|
||||
#ifdef _WIN64
|
||||
(1 << 21);
|
||||
#else
|
||||
@@ -92,10 +92,10 @@ void *BigAlloc(size_t size) throw()
|
||||
#ifdef _SZ_ALLOC_DEBUG
|
||||
fprintf(stderr, "\nAlloc_Big %10d bytes; count = %10d", size, g_allocCountBig++);
|
||||
#endif
|
||||
|
||||
|
||||
if (size >= (1 << 18))
|
||||
{
|
||||
void *res = ::VirtualAlloc(0, (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)),
|
||||
void *res = ::VirtualAlloc(0, (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)),
|
||||
MEM_COMMIT, PAGE_READWRITE);
|
||||
if (res != 0)
|
||||
return res;
|
||||
@@ -109,7 +109,7 @@ void BigFree(void *address) throw()
|
||||
if (address != 0)
|
||||
fprintf(stderr, "\nFree_Big; count = %10d", --g_allocCountBig);
|
||||
#endif
|
||||
|
||||
|
||||
if (address == 0)
|
||||
return;
|
||||
::VirtualFree(address, 0, MEM_RELEASE);
|
||||
|
@@ -14,9 +14,9 @@ void CCRC::InitTable()
|
||||
{
|
||||
UInt32 r = i;
|
||||
for (int j = 0; j < 8; j++)
|
||||
if (r & 1)
|
||||
if (r & 1)
|
||||
r = (r >> 1) ^ kCRCPoly;
|
||||
else
|
||||
else
|
||||
r >>= 1;
|
||||
CCRC::Table[i] = r;
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ public:
|
||||
void UpdateUInt32(UInt32 v);
|
||||
void UpdateUInt64(UInt64 v);
|
||||
void Update(const void *data, size_t size);
|
||||
UInt32 GetDigest() const { return _value ^ 0xFFFFFFFF; }
|
||||
UInt32 GetDigest() const { return _value ^ 0xFFFFFFFF; }
|
||||
static UInt32 CalculateDigest(const void *data, size_t size)
|
||||
{
|
||||
CCRC crc;
|
||||
|
@@ -26,11 +26,11 @@ public:
|
||||
// T& operator*() const { return *_p; }
|
||||
T** operator&() { return &_p; }
|
||||
T* operator->() const { return _p; }
|
||||
T* operator=(T* p)
|
||||
{
|
||||
T* operator=(T* p)
|
||||
{
|
||||
if (p != 0)
|
||||
p->AddRef();
|
||||
if (_p)
|
||||
if (_p)
|
||||
_p->Release();
|
||||
_p = p;
|
||||
return p;
|
||||
@@ -114,8 +114,8 @@ public:
|
||||
unsigned int Length() const { return ::SysStringLen(m_str); }
|
||||
operator BSTR() const { return m_str; }
|
||||
BSTR* operator&() { return &m_str; }
|
||||
BSTR MyCopy() const
|
||||
{
|
||||
BSTR MyCopy() const
|
||||
{
|
||||
int byteLen = ::SysStringByteLen(m_str);
|
||||
BSTR res = ::SysAllocStringByteLen(NULL, byteLen);
|
||||
memmove(res, m_str, byteLen);
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
};
|
||||
|
||||
#define MY_QUERYINTERFACE_BEGIN STDMETHOD(QueryInterface) \
|
||||
(REFGUID iid, void **outObject) {
|
||||
(REFGUID iid, void **outObject) {
|
||||
|
||||
#define MY_QUERYINTERFACE_ENTRY(i) if (iid == IID_ ## i) \
|
||||
{ *outObject = (void *)(i *)this; AddRef(); return S_OK; }
|
||||
|
@@ -23,7 +23,7 @@ typedef struct {
|
||||
|
||||
#ifdef __cplusplus
|
||||
inline bool operator==(REFGUID g1, REFGUID g2)
|
||||
{
|
||||
{
|
||||
for (int i = 0; i < (int)sizeof(g1); i++)
|
||||
if (((const unsigned char *)&g1)[i] != ((const unsigned char *)&g2)[i])
|
||||
return false;
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#if (_WIN32_WCE > 300)
|
||||
#include <basetyps.h>
|
||||
#else
|
||||
#define MIDL_INTERFACE(x) struct
|
||||
#define MIDL_INTERFACE(x) struct
|
||||
#endif
|
||||
#else
|
||||
#include <basetyps.h>
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
#include <unknwn.h>
|
||||
|
||||
#else
|
||||
#else
|
||||
#include "MyWindows.h"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -85,9 +85,9 @@ typedef LONG SCODE;
|
||||
#define E_INVALIDARG ((HRESULT)0x80070057L)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define STDMETHODCALLTYPE __stdcall
|
||||
#define STDMETHODCALLTYPE __stdcall
|
||||
#else
|
||||
#define STDMETHODCALLTYPE
|
||||
#define STDMETHODCALLTYPE
|
||||
#endif
|
||||
|
||||
#define STDMETHOD_(t, f) virtual t STDMETHODCALLTYPE f
|
||||
@@ -97,7 +97,7 @@ typedef LONG SCODE;
|
||||
|
||||
#define PURE = 0
|
||||
|
||||
#define MIDL_INTERFACE(x) struct
|
||||
#define MIDL_INTERFACE(x) struct
|
||||
|
||||
struct IUnknown
|
||||
{
|
||||
@@ -113,7 +113,7 @@ typedef IUnknown *LPUNKNOWN;
|
||||
#define VARIANT_FALSE ((VARIANT_BOOL)0)
|
||||
|
||||
enum VARENUM
|
||||
{
|
||||
{
|
||||
VT_EMPTY = 0,
|
||||
VT_NULL = 1,
|
||||
VT_I2 = 2,
|
||||
@@ -153,7 +153,7 @@ typedef struct tagPROPVARIANT
|
||||
PROPVAR_PAD1 wReserved1;
|
||||
PROPVAR_PAD2 wReserved2;
|
||||
PROPVAR_PAD3 wReserved3;
|
||||
union
|
||||
union
|
||||
{
|
||||
CHAR cVal;
|
||||
UCHAR bVal;
|
||||
@@ -191,7 +191,7 @@ MY_EXTERN_C LONG CompareFileTime(const FILETIME* ft1, const FILETIME* ft2);
|
||||
#define CP_OEMCP 1
|
||||
|
||||
typedef enum tagSTREAM_SEEK
|
||||
{
|
||||
{
|
||||
STREAM_SEEK_SET = 0,
|
||||
STREAM_SEEK_CUR = 1,
|
||||
STREAM_SEEK_END = 2
|
||||
|
@@ -6,11 +6,11 @@
|
||||
class CNewException {};
|
||||
|
||||
#ifdef _WIN32
|
||||
void
|
||||
void
|
||||
#ifdef _MSC_VER
|
||||
__cdecl
|
||||
__cdecl
|
||||
#endif
|
||||
operator delete(void *p) throw();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -6,4 +6,4 @@
|
||||
// #include "MyWindows.h"
|
||||
#include "NewHandler.h"
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
|
@@ -89,7 +89,7 @@ static UInt32 SelectDictionarySizeFor(unsigned datasize)
|
||||
if(datasize <= 512) return 512;
|
||||
if(datasize <= 1024) return 1024;
|
||||
if(datasize <= 4096) return 4096;
|
||||
if(datasize <= 16384) return 32768;
|
||||
if(datasize <= 16384) return 32768;
|
||||
if(datasize <= 65536) return 528288;
|
||||
if(datasize <= 528288) return 1048576*4;
|
||||
if(datasize <= 786432) reutrn 1048576*16;
|
||||
@@ -105,12 +105,12 @@ class CInStreamRam: public ISequentialInStream, public CMyUnknownImp
|
||||
size_t Pos;
|
||||
public:
|
||||
MY_UNKNOWN_IMP
|
||||
|
||||
|
||||
CInStreamRam(const std::vector<unsigned char>& buf) : input(buf), Pos(0)
|
||||
{
|
||||
}
|
||||
virtual ~CInStreamRam() {}
|
||||
|
||||
|
||||
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
|
||||
};
|
||||
|
||||
@@ -118,12 +118,12 @@ STDMETHODIMP CInStreamRam::Read(void *data, UInt32 size, UInt32 *processedSize)
|
||||
{
|
||||
UInt32 remain = input.size() - Pos;
|
||||
if (size > remain) size = remain;
|
||||
|
||||
|
||||
std::memcpy(data, &input[Pos], size);
|
||||
Pos += size;
|
||||
|
||||
|
||||
if(processedSize != NULL) *processedSize = size;
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -133,27 +133,27 @@ class COutStreamRam: public ISequentialOutStream, public CMyUnknownImp
|
||||
size_t Pos;
|
||||
public:
|
||||
MY_UNKNOWN_IMP
|
||||
|
||||
|
||||
COutStreamRam(): result(), Pos(0) { }
|
||||
virtual ~COutStreamRam() { }
|
||||
|
||||
|
||||
void Reserve(unsigned n) { result.reserve(n); }
|
||||
const std::vector<Byte>& Get() const { return result; }
|
||||
|
||||
|
||||
HRESULT WriteByte(Byte b)
|
||||
{
|
||||
if(Pos >= result.size()) result.resize(Pos+1);
|
||||
result[Pos++] = b;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
|
||||
};
|
||||
|
||||
STDMETHODIMP COutStreamRam::Write(const void *data, UInt32 size, UInt32 *processedSize)
|
||||
{
|
||||
if(Pos+size > result.size()) result.resize(Pos+size);
|
||||
|
||||
|
||||
std::memcpy(&result[Pos], data, size);
|
||||
if(processedSize != NULL) *processedSize = size;
|
||||
Pos += size;
|
||||
@@ -163,15 +163,15 @@ STDMETHODIMP COutStreamRam::Write(const void *data, UInt32 size, UInt32 *process
|
||||
const std::vector<unsigned char> LZMACompress(const std::vector<unsigned char>& buf)
|
||||
{
|
||||
if(buf.empty()) return buf;
|
||||
|
||||
|
||||
const UInt32 dictionarysize = SelectDictionarySizeFor(buf.size());
|
||||
|
||||
|
||||
NCompress::NLZMA::CEncoder *encoderSpec = new NCompress::NLZMA::CEncoder;
|
||||
CMyComPtr<ICompressCoder> encoder = encoderSpec;
|
||||
const PROPID propIDs[] =
|
||||
const PROPID propIDs[] =
|
||||
{
|
||||
NCoderPropID::kAlgorithm,
|
||||
NCoderPropID::kDictionarySize,
|
||||
NCoderPropID::kDictionarySize,
|
||||
NCoderPropID::kNumFastBytes,
|
||||
};
|
||||
const unsigned kNumProps = sizeof(propIDs) / sizeof(propIDs[0]);
|
||||
@@ -185,16 +185,16 @@ const std::vector<unsigned char> LZMACompress(const std::vector<unsigned char>&
|
||||
Error:
|
||||
return std::vector<unsigned char> ();
|
||||
}
|
||||
|
||||
|
||||
COutStreamRam *const outStreamSpec = new COutStreamRam;
|
||||
CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;
|
||||
CInStreamRam *const inStreamSpec = new CInStreamRam(buf);
|
||||
CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
|
||||
|
||||
|
||||
outStreamSpec->Reserve(buf.size());
|
||||
|
||||
if (encoderSpec->WriteCoderProperties(outStream) != S_OK) goto Error;
|
||||
|
||||
|
||||
for (unsigned i = 0; i < 8; i++)
|
||||
{
|
||||
UInt64 t = (UInt64)buf.size();
|
||||
@@ -203,7 +203,7 @@ const std::vector<unsigned char> LZMACompress(const std::vector<unsigned char>&
|
||||
|
||||
HRESULT lzmaResult = encoder->Code(inStream, outStream, 0, 0, 0);
|
||||
if (lzmaResult != S_OK) goto Error;
|
||||
|
||||
|
||||
return outStreamSpec->Get();
|
||||
}
|
||||
|
||||
@@ -216,22 +216,22 @@ const std::vector<unsigned char> LZMADeCompress
|
||||
(const std::vector<unsigned char>& buf)
|
||||
{
|
||||
if(buf.size() <= 5+8) return std::vector<unsigned char> ();
|
||||
|
||||
|
||||
uint_least64_t out_sizemax = R64(&buf[5]);
|
||||
|
||||
|
||||
std::vector<unsigned char> result(out_sizemax);
|
||||
|
||||
|
||||
CLzmaDecoderState state;
|
||||
LzmaDecodeProperties(&state.Properties, &buf[0], LZMA_PROPERTIES_SIZE);
|
||||
state.Probs = new CProb[LzmaGetNumProbs(&state.Properties)];
|
||||
|
||||
|
||||
SizeT in_done;
|
||||
SizeT out_done;
|
||||
LzmaDecode(&state, &buf[13], buf.size()-13, &in_done,
|
||||
&result[0], result.size(), &out_done);
|
||||
|
||||
|
||||
delete[] state.Probs;
|
||||
|
||||
|
||||
result.resize(out_done);
|
||||
return result;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ int main(int argc, char *argv[])
|
||||
char *s;
|
||||
FILE *f, *infile, *outfile;
|
||||
int c;
|
||||
|
||||
|
||||
if (argc != 4) {
|
||||
std::fprintf(stderr, "'lzma e file1 file2' encodes file1 into file2.\n"
|
||||
"'lzma d file2 file1' decodes file2 into file1.\n");
|
||||
@@ -270,9 +270,9 @@ int main(int argc, char *argv[])
|
||||
fread(Buf,si, 1, infile);
|
||||
|
||||
std::vector<unsigned char> result;
|
||||
if (toupper(*argv[1]) == 'E')
|
||||
if (toupper(*argv[1]) == 'E')
|
||||
result = LZMACompress(std::vector<unsigned char>(Buf,Buf+si));
|
||||
else
|
||||
else
|
||||
result = LZMADeCompress(std::vector<unsigned char>(Buf,Buf+si));
|
||||
|
||||
fwrite(&result[0], result.size(), 1, outfile);
|
||||
@@ -289,7 +289,7 @@ extern "C" {
|
||||
* @param in a pointer to the buffer
|
||||
* @param in_len the length in bytes
|
||||
* @param out a pointer to a buffer of at least size in_len
|
||||
* @param out_len a pointer to the compressed length of in
|
||||
* @param out_len a pointer to the compressed length of in
|
||||
*/
|
||||
|
||||
void do_lzma_compress(char *in, int in_len, char *out, int *out_len) {
|
||||
|
@@ -3,7 +3,7 @@
|
||||
# Copyright (C) 2008-2009 by coresystems GmbH
|
||||
# written by Patrick Georgi <patrick.georgi@coresystems.de> and
|
||||
# Stefan Reinauer <stefan.reinauer@coresystems.de>
|
||||
#
|
||||
#
|
||||
# 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.
|
||||
@@ -202,7 +202,7 @@ for PACKAGE in GMP MPFR GCC BINUTILS GDB $MINGW_PACKAGES; do
|
||||
archive=$PACKAGE"_ARCHIVE"
|
||||
archive=${!archive}
|
||||
dir=$PACKAGE"_DIR"
|
||||
test -d ${!dir} || (
|
||||
test -d ${!dir} || (
|
||||
printf " * `basename $archive`\n"
|
||||
FLAGS=zxf
|
||||
test ${archive:${#archive}-2:2} = "gz" && FLAGS=zxf
|
||||
|
@@ -1,11 +1,11 @@
|
||||
--- gcc-4.3.2/gcc/config/i386/unix.h~ 2009-01-20 16:05:45.000000000 +0100
|
||||
+++ gcc-4.3.2/gcc/config/i386/unix.h 2009-01-20 16:05:47.000000000 +0100
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
|
||||
/* String containing the assembler's comment-starter. */
|
||||
|
||||
|
||||
-#define ASM_COMMENT_START "/"
|
||||
+#define ASM_COMMENT_START "#"
|
||||
|
||||
|
||||
/* Output to assembler file text saying following lines
|
||||
may contain character constants, extra white space, comments, etc. */
|
||||
|
@@ -1,11 +1,11 @@
|
||||
--- gcc-4.3.3/gcc/config/i386/unix.h~ 2009-01-20 16:05:45.000000000 +0100
|
||||
+++ gcc-4.3.3/gcc/config/i386/unix.h 2009-01-20 16:05:47.000000000 +0100
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
|
||||
/* String containing the assembler's comment-starter. */
|
||||
|
||||
|
||||
-#define ASM_COMMENT_START "/"
|
||||
+#define ASM_COMMENT_START "#"
|
||||
|
||||
|
||||
/* Output to assembler file text saying following lines
|
||||
may contain character constants, extra white space, comments, etc. */
|
||||
|
@@ -3,7 +3,7 @@
|
||||
@@ -204,6 +204,7 @@
|
||||
= { (func_ptr) (-1) };
|
||||
#endif /* __DTOR_LIST__ alternatives */
|
||||
|
||||
|
||||
+#if 0
|
||||
#ifdef USE_EH_FRAME_REGISTRY
|
||||
/* Stick a label at the beginning of the frame unwind info so we can register
|
||||
@@ -13,13 +13,13 @@
|
||||
= { };
|
||||
#endif /* JCR_SECTION_NAME */
|
||||
+#endif
|
||||
|
||||
|
||||
#if defined(INIT_SECTION_ASM_OP) || defined(INIT_ARRAY_SECTION_ASM_OP)
|
||||
|
||||
|
||||
@@ -309,6 +311,7 @@
|
||||
}
|
||||
#endif /* !defined(FINI_ARRAY_SECTION_ASM_OP) */
|
||||
|
||||
|
||||
+#if 0
|
||||
#ifdef USE_EH_FRAME_REGISTRY
|
||||
#ifdef CRT_GET_RFIB_DATA
|
||||
@@ -29,13 +29,13 @@
|
||||
#endif
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
|
||||
completed = 1;
|
||||
}
|
||||
@@ -333,6 +337,7 @@
|
||||
= { __do_global_dtors_aux };
|
||||
#endif /* !defined(FINI_SECTION_ASM_OP) */
|
||||
|
||||
|
||||
+#if 0
|
||||
#if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME)
|
||||
/* Stick a call to __register_frame_info into the .init section. For some
|
||||
@@ -45,6 +45,6 @@
|
||||
#endif /* JCR_SECTION_NAME */
|
||||
}
|
||||
+#endif
|
||||
|
||||
|
||||
#ifdef INIT_SECTION_ASM_OP
|
||||
CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, frame_dummy)
|
||||
|
@@ -3,7 +3,7 @@
|
||||
@@ -204,6 +204,7 @@
|
||||
= { (func_ptr) (-1) };
|
||||
#endif /* __DTOR_LIST__ alternatives */
|
||||
|
||||
|
||||
+#if 0
|
||||
#ifdef USE_EH_FRAME_REGISTRY
|
||||
/* Stick a label at the beginning of the frame unwind info so we can register
|
||||
@@ -13,13 +13,13 @@
|
||||
= { };
|
||||
#endif /* JCR_SECTION_NAME */
|
||||
+#endif
|
||||
|
||||
|
||||
#if defined(INIT_SECTION_ASM_OP) || defined(INIT_ARRAY_SECTION_ASM_OP)
|
||||
|
||||
|
||||
@@ -309,6 +311,7 @@
|
||||
}
|
||||
#endif /* !defined(FINI_ARRAY_SECTION_ASM_OP) */
|
||||
|
||||
|
||||
+#if 0
|
||||
#ifdef USE_EH_FRAME_REGISTRY
|
||||
#ifdef CRT_GET_RFIB_DATA
|
||||
@@ -29,13 +29,13 @@
|
||||
#endif
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
|
||||
completed = 1;
|
||||
}
|
||||
@@ -333,6 +337,7 @@
|
||||
= { __do_global_dtors_aux };
|
||||
#endif /* !defined(FINI_SECTION_ASM_OP) */
|
||||
|
||||
|
||||
+#if 0
|
||||
#if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME)
|
||||
/* Stick a call to __register_frame_info into the .init section. For some
|
||||
@@ -45,6 +45,6 @@
|
||||
#endif /* JCR_SECTION_NAME */
|
||||
}
|
||||
+#endif
|
||||
|
||||
|
||||
#ifdef INIT_SECTION_ASM_OP
|
||||
CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, frame_dummy)
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* dump mmcr of Elan520 uController (incomplete, see 22005b pg23+).
|
||||
*
|
||||
* Copyright 2006 coresystems GmbH
|
||||
* Stefan Reinauer <stepan@coresystems.de>
|
||||
*
|
||||
* Copyright 2006 coresystems GmbH
|
||||
* Stefan Reinauer <stepan@coresystems.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
@@ -37,12 +37,12 @@ int print_mmcr(struct mmcr *mmcr)
|
||||
int i;
|
||||
printf("revid is 0x%x\n\n", val(mmcr, revid));
|
||||
printf("cpucontrol is 0x%x\n\n", val(mmcr, cpucontrol));
|
||||
|
||||
|
||||
printf("\n");
|
||||
printf("drcctl is 0x%x\n", val(mmcr, memregs.drcctl));
|
||||
printf("drctmctl is 0x%x\n", val(mmcr, memregs.drctmctl));
|
||||
printf("drccfg is 0x%x\n", val(mmcr, memregs.drccfg));
|
||||
printf("bendaddr is 0x%02x%02x%02x%02x\n",
|
||||
printf("bendaddr is 0x%02x%02x%02x%02x\n",
|
||||
val(mmcr, memregs.drcbendadr[3]),
|
||||
val(mmcr, memregs.drcbendadr[2]),
|
||||
val(mmcr, memregs.drcbendadr[1]),
|
||||
@@ -53,15 +53,15 @@ int print_mmcr(struct mmcr *mmcr)
|
||||
printf("cktest is 0x%x\n", val(mmcr, memregs.ecccktest));
|
||||
printf("sbadd is 0x%x\n", val(mmcr, memregs.eccsbadd));
|
||||
printf("mbadd is 0x%x\n", val(mmcr, memregs.eccmbadd));
|
||||
|
||||
|
||||
printf("\n");
|
||||
printf("dbctl is 0x%x\n", val(mmcr, dbctl.dbctl));
|
||||
|
||||
|
||||
printf("\n");
|
||||
printf("bootcs is 0x%x\n", val(mmcr, romregs.bootcs));
|
||||
printf("romcs1 is 0x%x\n", val(mmcr, romregs.romcs1));
|
||||
printf("romcs2 is 0x%x\n", val(mmcr, romregs.romcs2));
|
||||
|
||||
|
||||
printf("\n");
|
||||
printf("hbctl is 0x%x\n", val(mmcr, hostbridge.ctl));
|
||||
printf("hbtgtirqctl is 0x%x\n", val(mmcr, hostbridge.tgtirqctl));
|
||||
@@ -69,20 +69,20 @@ int print_mmcr(struct mmcr *mmcr)
|
||||
printf("hbmstirqctl is 0x%x\n", val(mmcr, hostbridge.mstirqctl));
|
||||
printf("hbmstirqsta is 0x%x\n", val(mmcr, hostbridge.mstirqsta));
|
||||
printf("mstintadd is 0x%x\n", val(mmcr, hostbridge.mstintadd));
|
||||
|
||||
|
||||
|
||||
|
||||
printf("\n");
|
||||
printf("sysarbctl is 0x%x\n", val(mmcr, sysarb.ctl));
|
||||
printf("pciarbsta is 0x%x\n", val(mmcr, sysarb.sta));
|
||||
printf("sysarbmenb is 0x%x\n", val(mmcr, sysarb.menb));
|
||||
printf("arbprictl is 0x%x\n", val(mmcr, sysarb.prictl));
|
||||
|
||||
|
||||
printf("\n");
|
||||
printf("adddecctl is 0x%x\n", val(mmcr, sysmap.adddecctl));
|
||||
printf("wpvsta is 0x%x\n", val(mmcr, sysmap.wpvsta));
|
||||
for (i=0; i<16; i++)
|
||||
printf("par %d is 0x%x\n", i, val(mmcr, sysmap.par[i]));
|
||||
|
||||
|
||||
printf("\n");
|
||||
printf("gpecho is 0x%x\n", val(mmcr, gpctl.gpecho));
|
||||
printf("gpcsdw is 0x%x\n", val(mmcr, gpctl.gpcsdw));
|
||||
@@ -96,9 +96,9 @@ int print_mmcr(struct mmcr *mmcr)
|
||||
printf("gpwroff is 0x%x\n", val(mmcr, gpctl.gpwroff));
|
||||
printf("gpalew is 0x%x\n", val(mmcr, gpctl.gpalew));
|
||||
printf("gpaleoff is 0x%x\n", val(mmcr, gpctl.gpaleoff));
|
||||
|
||||
|
||||
printf("\n");
|
||||
|
||||
|
||||
printf("piopfs15_0 is 0x%x\n", val(mmcr, pio.pfs15_0));
|
||||
printf("piopfs31_16 is 0x%x\n", val(mmcr, pio.pfs31_16));
|
||||
printf("cspfs is 0x%x\n", val(mmcr, pio.cspfs));
|
||||
@@ -112,19 +112,19 @@ int print_mmcr(struct mmcr *mmcr)
|
||||
printf("pioset31_16 is 0x%x\n", val(mmcr, pio.set31_16));
|
||||
printf("pioclr15_0 is 0x%x\n", val(mmcr, pio.clr15_0));
|
||||
printf("pioclr31_16 is 0x%x\n", val(mmcr, pio.clr31_16));
|
||||
|
||||
|
||||
printf("swtmrmilli is 0x%x\n", val(mmcr, swtmr.swtmrmilli));
|
||||
printf("swtmrmicro is 0x%x\n", val(mmcr, swtmr.swtmrmicro));
|
||||
printf("swtmrcfg is 0x%x\n", val(mmcr, swtmr.swtmrcfg));
|
||||
|
||||
|
||||
printf("status is 0x%x\n", val(mmcr, gptimers.status));
|
||||
printf("pad is 0x%x\n", val(mmcr, gptimers.pad));
|
||||
|
||||
|
||||
printf("timers[0].ctl is 0x%x\n", val(mmcr, gptimers.timer[0].ctl));
|
||||
printf("timers[0].cnt is 0x%x\n", val(mmcr, gptimers.timer[0].cnt));
|
||||
printf("timers[0].maxcmpa is 0x%x\n", val(mmcr, gptimers.timer[0].maxcmpa));
|
||||
printf("timers[0].maxcmpb is 0x%x\n", val(mmcr, gptimers.timer[0].maxcmpb));
|
||||
|
||||
|
||||
printf("timers[1].ctl is 0x%x\n", val(mmcr, gptimers.timer[1].ctl));
|
||||
printf("timers[1].cnt is 0x%x\n", val(mmcr, gptimers.timer[1].cnt));
|
||||
printf("timers[1].maxcmpa is 0x%x\n", val(mmcr, gptimers.timer[1].maxcmpa));
|
||||
@@ -132,24 +132,24 @@ int print_mmcr(struct mmcr *mmcr)
|
||||
printf("timers[2].ctl is 0x%x\n", val(mmcr, gptimers.ctl2));
|
||||
printf("timers[2].cnt is 0x%x\n", val(mmcr, gptimers.cnt2));
|
||||
printf("timers[2].maxcmpa is 0x%x\n", val(mmcr, gptimers.maxcmpa2));
|
||||
|
||||
|
||||
printf("ctl is 0x%x\n", val(mmcr, watchdog.ctl));
|
||||
printf("cntll is 0x%x\n", val(mmcr, watchdog.cntll));
|
||||
printf("cntlh is 0x%x\n", val(mmcr, watchdog.cntlh));
|
||||
|
||||
|
||||
printf("uart 1 ctl is 0x%x\n", val(mmcr, uarts.uart[0].ctl));
|
||||
printf("uart 1 sta is 0x%x\n", val(mmcr, uarts.uart[0].sta));
|
||||
printf("uart 1 fcrshad is 0x%x\n", val(mmcr, uarts.uart[0].fcrshad));
|
||||
printf("uart 2 ctl is 0x%x\n", val(mmcr, uarts.uart[1].ctl));
|
||||
printf("uart 2 sta is 0x%x\n", val(mmcr, uarts.uart[1].sta));
|
||||
printf("uart 2 fcrshad is 0x%x\n", val(mmcr, uarts.uart[1].fcrshad));
|
||||
|
||||
|
||||
printf("ssi ctl is 0x%x\n", val(mmcr, ssi.ctl));
|
||||
printf("ssi xmit is 0x%x\n", val(mmcr, ssi.xmit));
|
||||
printf("ssi cmd is 0x%x\n", val(mmcr, ssi.cmd));
|
||||
printf("ssi sta is 0x%x\n", val(mmcr, ssi.sta));
|
||||
printf("ssi rcv is 0x%x\n", val(mmcr, ssi.rcv));
|
||||
|
||||
|
||||
printf("pcicr is 0x%x\n", val(mmcr, pic.pcicr));
|
||||
printf("mpicmode is 0x%x\n", val(mmcr, pic.mpicmode));
|
||||
printf("sl1picmode is 0x%x\n", val(mmcr, pic.sl1picmode));
|
||||
@@ -189,12 +189,12 @@ int print_mmcr(struct mmcr *mmcr)
|
||||
printf("gp8imap is 0x%x\n", val(mmcr, pic.gp8imap));
|
||||
printf("gp9imap is 0x%x\n", val(mmcr, pic.gp9imap));
|
||||
printf("gp10imap is 0x%x\n", val(mmcr, pic.gp10imap));
|
||||
|
||||
|
||||
printf("sysinfo is 0x%x\n", val(mmcr, reset.sysinfo));
|
||||
printf("rescfg is 0x%x\n", val(mmcr, reset.rescfg));
|
||||
printf("ressta is 0x%x\n", val(mmcr, reset.ressta));
|
||||
|
||||
|
||||
|
||||
|
||||
printf("ctl is 0x%x\n", val(mmcr, dmacontrol.ctl));
|
||||
printf("mmio is 0x%x\n", val(mmcr, dmacontrol.mmio));
|
||||
printf("extchanmapa is 0x%x\n", val(mmcr, dmacontrol.extchanmapa));
|
||||
@@ -230,7 +230,7 @@ int print_mmcr(struct mmcr *mmcr)
|
||||
printf("nxtttch6 is 0x%x\n", val(mmcr, dmacontrol.nxtttch6));
|
||||
printf("nxtttcl7 is 0x%x\n", val(mmcr, dmacontrol.nxtttcl7));
|
||||
printf("nxtttch7 is 0x%x\n", val(mmcr, dmacontrol.nxtttch7));
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -248,15 +248,15 @@ int map_mmcr(void)
|
||||
if (getpagesize() > size) {
|
||||
size = getpagesize();
|
||||
}
|
||||
|
||||
|
||||
mmcr = mmap(0, size, PROT_WRITE | PROT_READ, MAP_SHARED,
|
||||
fd_mem, (off_t) (0xFFFEF000));
|
||||
|
||||
|
||||
if (mmcr == MAP_FAILED) {
|
||||
perror("Error MMAP /dev/mem");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
print_mmcr((struct mmcr *)mmcr);
|
||||
#if 0
|
||||
|
@@ -121,6 +121,6 @@ uint8_t ec_idx_read(uint16_t addr)
|
||||
|
||||
outb(addr & 0xff, lpc_idx + 2);
|
||||
outb(addr >> 8, lpc_idx + 1);
|
||||
|
||||
|
||||
return inb(lpc_idx + 3);
|
||||
}
|
||||
|
@@ -2,11 +2,11 @@ ABOUT:
|
||||
|
||||
This utility will help to create irq_table.c file, that is very hard to create
|
||||
manually, specialy when you are testing new motherboards, changing your
|
||||
hardware often, placing new cards, etc..
|
||||
hardware often, placing new cards, etc..
|
||||
|
||||
USAGE:
|
||||
|
||||
Steps
|
||||
Steps
|
||||
1. make distclean;
|
||||
2. make getpir
|
||||
3. ./getpir
|
||||
@@ -23,7 +23,7 @@ Steps
|
||||
checkpir.c Will verify the irq_tables.c, currently it only checks the
|
||||
checksum. In case of wrong checksum, a good value is proposed, so you can
|
||||
edit irq_tables.c manualy and replace checksum.
|
||||
|
||||
|
||||
|
||||
Do not run make checkpir and ./checkpir directly because it needs to be linked
|
||||
to irq_table.o first.
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Makefile for inteltool utility
|
||||
#
|
||||
# Copyright (C) 2008 by coresystems GmbH
|
||||
# written by Stefan Reinauer <stepan@coresystems.de>
|
||||
#
|
||||
# Copyright (C) 2008 by coresystems GmbH
|
||||
# written by Stefan Reinauer <stepan@coresystems.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
@@ -25,7 +25,7 @@ CC = gcc
|
||||
INSTALL = /usr/bin/install
|
||||
PREFIX = /usr/local
|
||||
CFLAGS = -O2 -g -Wall -W
|
||||
LDFLAGS = -lpci -lz
|
||||
LDFLAGS = -lpci -lz
|
||||
|
||||
OBJS = inteltool.o cpu.o gpio.o rootcmplx.o powermgt.o memory.o pcie.o
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* inteltool - dump all registers on an Intel CPU + chipset based system.
|
||||
*
|
||||
* Copyright (C) 2008-2010 by coresystems GmbH
|
||||
*
|
||||
* Copyright (C) 2008-2010 by coresystems GmbH
|
||||
*
|
||||
* 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.
|
||||
@@ -104,7 +104,7 @@ int print_intel_core_msrs(void)
|
||||
{ 0x002a, "EBL_CR_POWERON" },
|
||||
{ 0x0033, "TEST_CTL" },
|
||||
{ 0x003f, "THERM_DIODE_OFFSET" },
|
||||
//{ 0x0079, "IA32_BIOS_UPDT_TRIG" }, // Seems to be RO
|
||||
//{ 0x0079, "IA32_BIOS_UPDT_TRIG" }, // Seems to be RO
|
||||
{ 0x008b, "IA32_BIOS_SIGN_ID" },
|
||||
{ 0x00c1, "PERFCTR0" },
|
||||
{ 0x00c2, "PERFCTR1" },
|
||||
@@ -308,8 +308,8 @@ int print_intel_core_msrs(void)
|
||||
};
|
||||
|
||||
/* Pentium 4 and XEON */
|
||||
/*
|
||||
* All MSRs per
|
||||
/*
|
||||
* All MSRs per
|
||||
*
|
||||
* Intel<65> 64 and IA-32 Architectures
|
||||
* Software Developer.s Manual
|
||||
@@ -326,7 +326,7 @@ int print_intel_core_msrs(void)
|
||||
{ 0x002a, "MSR_EBC_HARD_POWERON" },
|
||||
{ 0x002b, "MSR_EBC_SOFT_POWRON" },
|
||||
{ 0x002c, "MSR_EBC_FREQUENCY_ID" },
|
||||
// WRITE ONLY { 0x0079, "IA32_BIOS_UPDT_TRIG" },
|
||||
// WRITE ONLY { 0x0079, "IA32_BIOS_UPDT_TRIG" },
|
||||
{ 0x019c, "IA32_THERM_STATUS" },
|
||||
{ 0x019d, "MSR_THERM2_CTL" },
|
||||
{ 0x01a0, "IA32_MISC_ENABLE" },
|
||||
@@ -365,7 +365,7 @@ int print_intel_core_msrs(void)
|
||||
{ 0x0303, "MSR_BPU_COUNTER3" },
|
||||
/* Skipped through 0x3ff for now*/
|
||||
|
||||
/* All MCX_ADDR AND MCX_MISC MSRs depend on a bit being
|
||||
/* All MCX_ADDR AND MCX_MISC MSRs depend on a bit being
|
||||
* set in MCX_STATUS */
|
||||
{ 0x400, "IA32_MC0_CTL" },
|
||||
{ 0x401, "IA32_MC0_STATUS" },
|
||||
@@ -374,7 +374,7 @@ int print_intel_core_msrs(void)
|
||||
{ 0x404, "IA32_MC1_CTL" },
|
||||
{ 0x405, "IA32_MC1_STATUS" },
|
||||
{ 0x406, "IA32_MC1_ADDR" },
|
||||
{ 0x407, "IA32_MC1_MISC" },
|
||||
{ 0x407, "IA32_MC1_MISC" },
|
||||
{ 0x408, "IA32_MC2_CTL" },
|
||||
{ 0x409, "IA32_MC2_STATUS" },
|
||||
{ 0x40a, "IA32_MC2_ADDR" },
|
||||
@@ -439,7 +439,7 @@ int print_intel_core_msrs(void)
|
||||
*/
|
||||
{ 0x0600, "IA32_DS_AREA" },
|
||||
/* 0x0680 - 0x06cf Branch Records Skipped */
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -461,7 +461,7 @@ int print_intel_core_msrs(void)
|
||||
|
||||
cpu_t *cpu = NULL;
|
||||
|
||||
/* Get CPU family and model, not the stepping
|
||||
/* Get CPU family and model, not the stepping
|
||||
* (TODO: extended family/model)
|
||||
*/
|
||||
id = cpuid(1) & 0xff0;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* inteltool - dump all registers on an Intel CPU + chipset based system.
|
||||
*
|
||||
* Copyright (C) 2008 by coresystems GmbH
|
||||
*
|
||||
* Copyright (C) 2008 by coresystems GmbH
|
||||
*
|
||||
* 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.
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* inteltool - dump all registers on an Intel CPU + chipset based system.
|
||||
*
|
||||
* Copyright (C) 2008-2010 by coresystems GmbH
|
||||
* written by Stefan Reinauer <stepan@coresystems.de>
|
||||
*
|
||||
* Copyright (C) 2008-2010 by coresystems GmbH
|
||||
* written by Stefan Reinauer <stepan@coresystems.de>
|
||||
*
|
||||
* 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.
|
||||
@@ -69,7 +69,7 @@ void *map_physical(unsigned long phys_addr, size_t len)
|
||||
|
||||
virt_addr = mmap(0, len, PROT_WRITE | PROT_READ, MAP_SHARED,
|
||||
fd_mem, (off_t) phys_addr);
|
||||
|
||||
|
||||
if (virt_addr == MAP_FAILED) {
|
||||
printf("Error mapping physical memory 0x%08lx[0x%x]\n", phys_addr, len);
|
||||
return NULL;
|
||||
@@ -214,11 +214,11 @@ int main(int argc, char *argv[])
|
||||
pci_scan_bus(pacc);
|
||||
|
||||
/* Find the required devices */
|
||||
for (dev = pacc->devices; dev; dev = dev->next) {
|
||||
for (dev = pacc->devices; dev; dev = dev->next) {
|
||||
pci_fill_info(dev, PCI_FILL_CLASS);
|
||||
/* The ISA/LPC bridge can be 0x1f, 0x07, or 0x04 so we probe. */
|
||||
if (dev->device_class == 0x0601) { /* ISA/LPC bridge */
|
||||
if (sb == NULL)
|
||||
if (sb == NULL)
|
||||
sb = dev;
|
||||
else
|
||||
fprintf(stderr, "Multiple devices with class ID"
|
||||
@@ -254,7 +254,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
id = cpuid(1);
|
||||
printf("Intel CPU: Family %x, Model %x\n",
|
||||
printf("Intel CPU: Family %x, Model %x\n",
|
||||
(id >> 8) & 0xf, (id >> 4) & 0xf);
|
||||
|
||||
/* Determine names */
|
||||
@@ -265,10 +265,10 @@ int main(int argc, char *argv[])
|
||||
if (sb->device_id == supported_chips_list[i].device_id)
|
||||
sbname = supported_chips_list[i].name;
|
||||
|
||||
printf("Intel Northbridge: %04x:%04x (%s)\n",
|
||||
printf("Intel Northbridge: %04x:%04x (%s)\n",
|
||||
nb->vendor_id, nb->device_id, nbname);
|
||||
|
||||
printf("Intel Southbridge: %04x:%04x (%s)\n",
|
||||
printf("Intel Southbridge: %04x:%04x (%s)\n",
|
||||
sb->vendor_id, sb->device_id, sbname);
|
||||
|
||||
/* Now do the deed */
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* inteltool - dump all registers on an Intel CPU + chipset based system.
|
||||
*
|
||||
* Copyright (C) 2008-2010 by coresystems GmbH
|
||||
*
|
||||
* Copyright (C) 2008-2010 by coresystems GmbH
|
||||
*
|
||||
* 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.
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* inteltool - dump all registers on an Intel CPU + chipset based system.
|
||||
*
|
||||
* Copyright (C) 2008-2010 by coresystems GmbH
|
||||
*
|
||||
* Copyright (C) 2008-2010 by coresystems GmbH
|
||||
*
|
||||
* 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.
|
||||
@@ -60,7 +60,7 @@ int print_mchbar(struct pci_dev *nb)
|
||||
}
|
||||
|
||||
mchbar = map_physical(mchbar_phys, size);
|
||||
|
||||
|
||||
if (mchbar == NULL) {
|
||||
perror("Error mapping MCHBAR");
|
||||
exit(1);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* inteltool - dump all registers on an Intel CPU + chipset based system.
|
||||
*
|
||||
* Copyright (C) 2008-2010 by coresystems GmbH
|
||||
*
|
||||
* Copyright (C) 2008-2010 by coresystems GmbH
|
||||
*
|
||||
* 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.
|
||||
@@ -57,7 +57,7 @@ int print_epbar(struct pci_dev *nb)
|
||||
}
|
||||
|
||||
epbar = map_physical(epbar_phys, size);
|
||||
|
||||
|
||||
if (epbar == NULL) {
|
||||
perror("Error mapping EPBAR");
|
||||
exit(1);
|
||||
@@ -109,7 +109,7 @@ int print_dmibar(struct pci_dev *nb)
|
||||
}
|
||||
|
||||
dmibar = map_physical(dmibar_phys, size);
|
||||
|
||||
|
||||
if (dmibar == NULL) {
|
||||
perror("Error mapping DMIBAR");
|
||||
exit(1);
|
||||
@@ -182,17 +182,17 @@ int print_pciexbar(struct pci_dev *nb)
|
||||
default: // RSVD
|
||||
printf("Undefined address base. Bailing out.\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
printf("PCIEXBAR: 0x%08llx\n", pciexbar_phys);
|
||||
|
||||
pciexbar = map_physical(pciexbar_phys, (max_busses * 1024 * 1024));
|
||||
|
||||
|
||||
if (pciexbar == NULL) {
|
||||
perror("Error mapping PCIEXBAR");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
for (bus = 0; bus < max_busses; bus++) {
|
||||
for (dev = 0; dev < 32; dev++) {
|
||||
for (fn = 0; fn < 8; fn++) {
|
||||
@@ -200,7 +200,7 @@ int print_pciexbar(struct pci_dev *nb)
|
||||
|
||||
if (*(uint16_t *)(pciexbar + devbase) == 0xffff)
|
||||
continue;
|
||||
|
||||
|
||||
/* This is a heuristics. Anyone got a better check? */
|
||||
if( (*(uint32_t *)(pciexbar + devbase + 256) == 0xffffffff) &&
|
||||
(*(uint32_t *)(pciexbar + devbase + 512) == 0xffffffff) ) {
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* inteltool - dump all registers on an Intel CPU + chipset based system.
|
||||
*
|
||||
* Copyright (C) 2008-2010 by coresystems GmbH
|
||||
* written by Stefan Reinauer <stepan@coresystems.de>
|
||||
*
|
||||
* Copyright (C) 2008-2010 by coresystems GmbH
|
||||
* written by Stefan Reinauer <stepan@coresystems.de>
|
||||
*
|
||||
* 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.
|
||||
@@ -145,7 +145,7 @@ static const io_register_t ich8_pm_registers[] = {
|
||||
{ 0x7c, 4, "RESERVED" },
|
||||
};
|
||||
|
||||
/*
|
||||
/*
|
||||
* INTEL I/O Controller Hub 6 Family
|
||||
* http://www.intel.com/assets/pdf/datasheet/301473.pdf
|
||||
*/
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* inteltool - dump all registers on an Intel CPU + chipset based system.
|
||||
*
|
||||
* Copyright (C) 2008 by coresystems GmbH
|
||||
* written by Stefan Reinauer <stepan@coresystems.de>
|
||||
*
|
||||
* Copyright (C) 2008 by coresystems GmbH
|
||||
* written by Stefan Reinauer <stepan@coresystems.de>
|
||||
*
|
||||
* 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.
|
||||
@@ -51,7 +51,7 @@ int print_rcba(struct pci_dev *sb)
|
||||
}
|
||||
|
||||
rcba = map_physical(rcba_phys, size);
|
||||
|
||||
|
||||
if (rcba == NULL) {
|
||||
perror("Error mapping RCBA");
|
||||
exit(1);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Makefile for k8redump utility
|
||||
#
|
||||
#
|
||||
# Original from Stefan Reinauer <stepan@openbios.org>
|
||||
#
|
||||
|
||||
@@ -14,9 +14,9 @@ PREFIX = /usr/local
|
||||
CFLAGS = -Os -Wall -Werror
|
||||
OS_ARCH = $(shell uname)
|
||||
ifeq ($(OS_ARCH), SunOS)
|
||||
LDFLAGS = -lpci
|
||||
LDFLAGS = -lpci
|
||||
else
|
||||
LDFLAGS = -lpci -lz -static
|
||||
LDFLAGS = -lpci -lz -static
|
||||
STRIP_ARGS = -s
|
||||
endif
|
||||
|
||||
@@ -33,7 +33,7 @@ clean:
|
||||
|
||||
distclean: clean
|
||||
rm -f $(PROGRAM) .dependencies
|
||||
|
||||
|
||||
dep:
|
||||
@$(CC) -MM *.c > .dependencies
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#define mkdir(x,y) mkdir(x)
|
||||
#define UNLINK_IF_NECESSARY(x) unlink(x)
|
||||
#else
|
||||
#define UNLINK_IF_NECESSARY(X)
|
||||
#define UNLINK_IF_NECESSARY(X)
|
||||
#endif
|
||||
|
||||
static void conf_warning(const char *fmt, ...)
|
||||
|
@@ -52,7 +52,7 @@
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
|
||||
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
*/
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS 1
|
||||
@@ -69,7 +69,7 @@ typedef uint32_t flex_uint32_t;
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
typedef int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
#endif /* ! C99 */
|
||||
@@ -179,7 +179,7 @@ extern FILE *zconfin, *zconfout;
|
||||
#define EOB_ACT_LAST_MATCH 2
|
||||
|
||||
#define YY_LESS_LINENO(n)
|
||||
|
||||
|
||||
/* Return all but the first "n" matched characters back to the input stream. */
|
||||
#define yyless(n) \
|
||||
do \
|
||||
@@ -246,7 +246,7 @@ struct yy_buffer_state
|
||||
|
||||
int yy_bs_lineno; /**< The line count. */
|
||||
int yy_bs_column; /**< The column count. */
|
||||
|
||||
|
||||
/* Whether to try to fill the input buffer when we reach the
|
||||
* end of it.
|
||||
*/
|
||||
@@ -866,7 +866,7 @@ extern int zconfwrap (void );
|
||||
#endif
|
||||
|
||||
static void yyunput (int c,char *buf_ptr );
|
||||
|
||||
|
||||
#ifndef yytext_ptr
|
||||
static void yy_flex_strncpy (char *,yyconst char *,int );
|
||||
#endif
|
||||
@@ -971,7 +971,7 @@ YY_DECL
|
||||
register yy_state_type yy_current_state;
|
||||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
|
||||
|
||||
int str = 0;
|
||||
int ts, i;
|
||||
|
||||
@@ -1574,7 +1574,7 @@ static int yy_get_next_buffer (void)
|
||||
{
|
||||
register yy_state_type yy_current_state;
|
||||
register char *yy_cp;
|
||||
|
||||
|
||||
yy_current_state = (yy_start);
|
||||
|
||||
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
|
||||
@@ -1593,7 +1593,7 @@ static int yy_get_next_buffer (void)
|
||||
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
|
||||
{
|
||||
register int yy_is_jam;
|
||||
|
||||
|
||||
yy_current_state = yy_nxt[yy_current_state][1];
|
||||
yy_is_jam = (yy_current_state <= 0);
|
||||
|
||||
@@ -1603,7 +1603,7 @@ static int yy_get_next_buffer (void)
|
||||
static void yyunput (int c, register char * yy_bp )
|
||||
{
|
||||
register char *yy_cp;
|
||||
|
||||
|
||||
yy_cp = (yy_c_buf_p);
|
||||
|
||||
/* undo effects of setting up zconftext */
|
||||
@@ -1646,7 +1646,7 @@ static int yy_get_next_buffer (void)
|
||||
|
||||
{
|
||||
int c;
|
||||
|
||||
|
||||
*(yy_c_buf_p) = (yy_hold_char);
|
||||
|
||||
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
|
||||
@@ -1713,12 +1713,12 @@ static int yy_get_next_buffer (void)
|
||||
|
||||
/** Immediately switch to a different input stream.
|
||||
* @param input_file A readable stream.
|
||||
*
|
||||
*
|
||||
* @note This function does not reset the start condition to @c INITIAL .
|
||||
*/
|
||||
void zconfrestart (FILE * input_file )
|
||||
{
|
||||
|
||||
|
||||
if ( ! YY_CURRENT_BUFFER ){
|
||||
zconfensure_buffer_stack ();
|
||||
YY_CURRENT_BUFFER_LVALUE =
|
||||
@@ -1731,11 +1731,11 @@ static int yy_get_next_buffer (void)
|
||||
|
||||
/** Switch to a different input buffer.
|
||||
* @param new_buffer The new input buffer.
|
||||
*
|
||||
*
|
||||
*/
|
||||
void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer )
|
||||
{
|
||||
|
||||
|
||||
/* TODO. We should be able to replace this entire function body
|
||||
* with
|
||||
* zconfpop_buffer_state();
|
||||
@@ -1775,13 +1775,13 @@ static void zconf_load_buffer_state (void)
|
||||
/** Allocate and initialize an input buffer state.
|
||||
* @param file A readable stream.
|
||||
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
|
||||
*
|
||||
*
|
||||
* @return the allocated buffer state.
|
||||
*/
|
||||
YY_BUFFER_STATE zconf_create_buffer (FILE * file, int size )
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
|
||||
|
||||
b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
|
||||
if ( ! b )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
|
||||
@@ -1804,11 +1804,11 @@ static void zconf_load_buffer_state (void)
|
||||
|
||||
/** Destroy the buffer.
|
||||
* @param b a buffer created with zconf_create_buffer()
|
||||
*
|
||||
*
|
||||
*/
|
||||
void zconf_delete_buffer (YY_BUFFER_STATE b )
|
||||
{
|
||||
|
||||
|
||||
if ( ! b )
|
||||
return;
|
||||
|
||||
@@ -1829,7 +1829,7 @@ static void zconf_load_buffer_state (void)
|
||||
|
||||
{
|
||||
int oerrno = errno;
|
||||
|
||||
|
||||
zconf_flush_buffer(b );
|
||||
|
||||
b->yy_input_file = file;
|
||||
@@ -1845,13 +1845,13 @@ static void zconf_load_buffer_state (void)
|
||||
}
|
||||
|
||||
b->yy_is_interactive = 0;
|
||||
|
||||
|
||||
errno = oerrno;
|
||||
}
|
||||
|
||||
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
|
||||
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
|
||||
*
|
||||
*
|
||||
*/
|
||||
void zconf_flush_buffer (YY_BUFFER_STATE b )
|
||||
{
|
||||
@@ -1880,7 +1880,7 @@ static void zconf_load_buffer_state (void)
|
||||
* the current state. This function will allocate the stack
|
||||
* if necessary.
|
||||
* @param new_buffer The new state.
|
||||
*
|
||||
*
|
||||
*/
|
||||
void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer )
|
||||
{
|
||||
@@ -1910,7 +1910,7 @@ void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer )
|
||||
|
||||
/** Removes and deletes the top of the stack, if present.
|
||||
* The next element becomes the new top.
|
||||
*
|
||||
*
|
||||
*/
|
||||
void zconfpop_buffer_state (void)
|
||||
{
|
||||
@@ -1934,7 +1934,7 @@ void zconfpop_buffer_state (void)
|
||||
static void zconfensure_buffer_stack (void)
|
||||
{
|
||||
int num_to_alloc;
|
||||
|
||||
|
||||
if (!(yy_buffer_stack)) {
|
||||
|
||||
/* First allocation is just for 2 elements, since we don't know if this
|
||||
@@ -1945,9 +1945,9 @@ static void zconfensure_buffer_stack (void)
|
||||
(yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc
|
||||
(num_to_alloc * sizeof(struct yy_buffer_state*)
|
||||
);
|
||||
|
||||
|
||||
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
|
||||
|
||||
|
||||
(yy_buffer_stack_max) = num_to_alloc;
|
||||
(yy_buffer_stack_top) = 0;
|
||||
return;
|
||||
@@ -1973,13 +1973,13 @@ static void zconfensure_buffer_stack (void)
|
||||
/** Setup the input buffer state to scan directly from a user-specified character buffer.
|
||||
* @param base the character buffer
|
||||
* @param size the size in bytes of the character buffer
|
||||
*
|
||||
* @return the newly allocated buffer state object.
|
||||
*
|
||||
* @return the newly allocated buffer state object.
|
||||
*/
|
||||
YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
|
||||
|
||||
if ( size < 2 ||
|
||||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
|
||||
base[size-1] != YY_END_OF_BUFFER_CHAR )
|
||||
@@ -2008,14 +2008,14 @@ YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
|
||||
/** Setup the input buffer state to scan a string. The next call to zconflex() will
|
||||
* scan from a @e copy of @a str.
|
||||
* @param str a NUL-terminated string to scan
|
||||
*
|
||||
*
|
||||
* @return the newly allocated buffer state object.
|
||||
* @note If you want to scan bytes that may contain NUL values, then use
|
||||
* zconf_scan_bytes() instead.
|
||||
*/
|
||||
YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr )
|
||||
{
|
||||
|
||||
|
||||
return zconf_scan_bytes(yystr,strlen(yystr) );
|
||||
}
|
||||
|
||||
@@ -2023,7 +2023,7 @@ YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr )
|
||||
* scan from a @e copy of @a bytes.
|
||||
* @param bytes the byte buffer to scan
|
||||
* @param len the number of bytes in the buffer pointed to by @a bytes.
|
||||
*
|
||||
*
|
||||
* @return the newly allocated buffer state object.
|
||||
*/
|
||||
YY_BUFFER_STATE zconf_scan_bytes (yyconst char * yybytes, int _yybytes_len )
|
||||
@@ -2032,7 +2032,7 @@ YY_BUFFER_STATE zconf_scan_bytes (yyconst char * yybytes, int _yybytes_len )
|
||||
char *buf;
|
||||
yy_size_t n;
|
||||
int i;
|
||||
|
||||
|
||||
/* Get memory for full buffer, including space for trailing EOB's. */
|
||||
n = _yybytes_len + 2;
|
||||
buf = (char *) zconfalloc(n );
|
||||
@@ -2086,16 +2086,16 @@ static void yy_fatal_error (yyconst char* msg )
|
||||
/* Accessor methods (get/set functions) to struct members. */
|
||||
|
||||
/** Get the current line number.
|
||||
*
|
||||
*
|
||||
*/
|
||||
int zconfget_lineno (void)
|
||||
{
|
||||
|
||||
|
||||
return zconflineno;
|
||||
}
|
||||
|
||||
/** Get the input stream.
|
||||
*
|
||||
*
|
||||
*/
|
||||
FILE *zconfget_in (void)
|
||||
{
|
||||
@@ -2103,7 +2103,7 @@ FILE *zconfget_in (void)
|
||||
}
|
||||
|
||||
/** Get the output stream.
|
||||
*
|
||||
*
|
||||
*/
|
||||
FILE *zconfget_out (void)
|
||||
{
|
||||
@@ -2111,7 +2111,7 @@ FILE *zconfget_out (void)
|
||||
}
|
||||
|
||||
/** Get the length of the current token.
|
||||
*
|
||||
*
|
||||
*/
|
||||
int zconfget_leng (void)
|
||||
{
|
||||
@@ -2119,7 +2119,7 @@ int zconfget_leng (void)
|
||||
}
|
||||
|
||||
/** Get the current token.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
char *zconfget_text (void)
|
||||
@@ -2129,18 +2129,18 @@ char *zconfget_text (void)
|
||||
|
||||
/** Set the current line number.
|
||||
* @param line_number
|
||||
*
|
||||
*
|
||||
*/
|
||||
void zconfset_lineno (int line_number )
|
||||
{
|
||||
|
||||
|
||||
zconflineno = line_number;
|
||||
}
|
||||
|
||||
/** Set the input stream. This does not discard the current
|
||||
* input buffer.
|
||||
* @param in_str A readable stream.
|
||||
*
|
||||
*
|
||||
* @see zconf_switch_to_buffer
|
||||
*/
|
||||
void zconfset_in (FILE * in_str )
|
||||
@@ -2194,7 +2194,7 @@ static int yy_init_globals (void)
|
||||
/* zconflex_destroy is for both reentrant and non-reentrant scanners. */
|
||||
int zconflex_destroy (void)
|
||||
{
|
||||
|
||||
|
||||
/* Pop the buffer stack, destroying each element. */
|
||||
while(YY_CURRENT_BUFFER){
|
||||
zconf_delete_buffer(YY_CURRENT_BUFFER );
|
||||
|
@@ -1,4 +1,4 @@
|
||||
This is NOT the official version of dialog. This version has been
|
||||
significantly modified from the original. It is for use by the Linux
|
||||
kernel configuration script. Please do not bother Savio Lam with
|
||||
kernel configuration script. Please do not bother Savio Lam with
|
||||
questions about this program.
|
||||
|
@@ -26,7 +26,7 @@
|
||||
*
|
||||
* *) A bugfix for the Page-Down problem
|
||||
*
|
||||
* *) Formerly when I used Page Down and Page Up, the cursor would be set
|
||||
* *) Formerly when I used Page Down and Page Up, the cursor would be set
|
||||
* to the first position in the menu box. Now lxdialog is a bit
|
||||
* smarter and works more like other menu systems (just have a look at
|
||||
* it).
|
||||
|
@@ -506,7 +506,7 @@ static void build_conf(struct menu *menu)
|
||||
if (def_menu) {
|
||||
item_add_str(" (%s)", _(menu_get_prompt(def_menu)));
|
||||
item_add_str(" --->");
|
||||
#if 0
|
||||
#if 0
|
||||
/* coreboot doesn't need this representation */
|
||||
if (def_menu->list) {
|
||||
indent += 2;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,7 @@ typedef unsigned reg_syntax_t;
|
||||
#define RE_BACKSLASH_ESCAPE_IN_LISTS (1)
|
||||
|
||||
/* If this bit is not set, then + and ? are operators, and \+ and \? are
|
||||
literals.
|
||||
literals.
|
||||
If set, then \+ and \? are operators and + and ? are literals. */
|
||||
#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
|
||||
|
||||
@@ -58,7 +58,7 @@ typedef unsigned reg_syntax_t;
|
||||
^ is an anchor if it is at the beginning of a regular
|
||||
expression or after an open-group or an alternation operator;
|
||||
$ is an anchor if it is at the end of a regular expression, or
|
||||
before a close-group or an alternation operator.
|
||||
before a close-group or an alternation operator.
|
||||
|
||||
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
|
||||
POSIX draft 11.2 says that * etc. in leading positions is undefined.
|
||||
@@ -69,7 +69,7 @@ typedef unsigned reg_syntax_t;
|
||||
/* If this bit is set, then special characters are always special
|
||||
regardless of where they are in the pattern.
|
||||
If this bit is not set, then special characters are special only in
|
||||
some contexts; otherwise they are ordinary. Specifically,
|
||||
some contexts; otherwise they are ordinary. Specifically,
|
||||
* + ? and intervals are only special when not after the beginning,
|
||||
open-group, or alternation operator. */
|
||||
#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
|
||||
@@ -91,7 +91,7 @@ typedef unsigned reg_syntax_t;
|
||||
#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
|
||||
|
||||
/* If this bit is set, either \{...\} or {...} defines an
|
||||
interval, depending on RE_NO_BK_BRACES.
|
||||
interval, depending on RE_NO_BK_BRACES.
|
||||
If not set, \{, \}, {, and } are literals. */
|
||||
#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
|
||||
|
||||
@@ -116,7 +116,7 @@ typedef unsigned reg_syntax_t;
|
||||
If not set, then \<digit> is a back-reference. */
|
||||
#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
|
||||
|
||||
/* If this bit is set, then | is an alternation operator, and \| is literal.
|
||||
/* If this bit is set, then | is an alternation operator, and \| is literal.
|
||||
If not set, then \| is an alternation operator, and | is literal. */
|
||||
#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
|
||||
|
||||
@@ -138,7 +138,7 @@ extern reg_syntax_t re_syntax_options;
|
||||
|
||||
/* Define combinations of the above bits for the standard possibilities.
|
||||
(The [[[ comments delimit what gets put into the Texinfo file, so
|
||||
don't delete them!) */
|
||||
don't delete them!) */
|
||||
/* [[[begin syntaxes]]] */
|
||||
#define RE_SYNTAX_EMACS 0
|
||||
|
||||
@@ -205,7 +205,7 @@ extern reg_syntax_t re_syntax_options;
|
||||
#ifdef RE_DUP_MAX
|
||||
#undef RE_DUP_MAX
|
||||
#endif
|
||||
#define RE_DUP_MAX ((1 << 15) - 1)
|
||||
#define RE_DUP_MAX ((1 << 15) - 1)
|
||||
|
||||
|
||||
/* POSIX `cflags' bits (i.e., information for `regcomp'). */
|
||||
@@ -217,7 +217,7 @@ extern reg_syntax_t re_syntax_options;
|
||||
/* If this bit is set, then ignore case when matching.
|
||||
If not set, then case is significant. */
|
||||
#define REG_ICASE (REG_EXTENDED << 1)
|
||||
|
||||
|
||||
/* If this bit is set, then anchors do not match at newline
|
||||
characters in the string.
|
||||
If not set, then anchors do match at newlines. */
|
||||
@@ -256,7 +256,7 @@ typedef enum
|
||||
REG_EESCAPE, /* Trailing backslash. */
|
||||
REG_ESUBREG, /* Invalid back reference. */
|
||||
REG_EBRACK, /* Unmatched left bracket. */
|
||||
REG_EPAREN, /* Parenthesis imbalance. */
|
||||
REG_EPAREN, /* Parenthesis imbalance. */
|
||||
REG_EBRACE, /* Unmatched \{. */
|
||||
REG_BADBR, /* Invalid contents of \{\}. */
|
||||
REG_ERANGE, /* Invalid range end. */
|
||||
@@ -287,7 +287,7 @@ struct re_pattern_buffer
|
||||
unsigned long allocated;
|
||||
|
||||
/* Number of bytes actually used in `buffer'. */
|
||||
unsigned long used;
|
||||
unsigned long used;
|
||||
|
||||
/* Syntax setting with which the pattern was compiled. */
|
||||
reg_syntax_t syntax;
|
||||
@@ -331,7 +331,7 @@ struct re_pattern_buffer
|
||||
unsigned no_sub : 1;
|
||||
|
||||
/* If set, a beginning-of-line anchor doesn't match at the
|
||||
beginning of the string. */
|
||||
beginning of the string. */
|
||||
unsigned not_bol : 1;
|
||||
|
||||
/* Similarly for an end-of-line anchor. */
|
||||
@@ -443,7 +443,7 @@ extern int re_match
|
||||
|
||||
|
||||
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
|
||||
extern int re_match_2
|
||||
extern int re_match_2
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
|
||||
int length1, const char *string2, int length2,
|
||||
int start, struct re_registers *regs, int stop));
|
||||
|
@@ -1393,7 +1393,7 @@ yyparse ()
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
|
||||
|
||||
int yystate;
|
||||
int yyn;
|
||||
int yyresult;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
TARGET=lbtdump
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-g -O -Wall
|
||||
CFLAGS=-g -O -Wall
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
|
@@ -48,8 +48,8 @@ unsigned long compute_checksum(void *addr, unsigned long length)
|
||||
(((char *)rec) < (((char *)head) + sizeof(*head) + head->table_bytes)) && \
|
||||
(rec->size >= 1) && \
|
||||
((((char *)rec) + rec->size) <= (((char *)head) + sizeof(*head) + head->table_bytes)); \
|
||||
rec = (struct lb_record *)(((char *)rec) + rec->size))
|
||||
|
||||
rec = (struct lb_record *)(((char *)rec) + rec->size))
|
||||
|
||||
|
||||
static int count_lb_records(struct lb_header *head)
|
||||
{
|
||||
@@ -72,7 +72,7 @@ struct lb_header *find_lb_table(void *base, unsigned long start, unsigned long e
|
||||
struct lb_record *recs = (struct lb_record *)(((char*)base) + addr + sizeof(*head));
|
||||
if (memcmp(head->signature, "LBIO", 4) != 0)
|
||||
continue;
|
||||
fprintf(stdout, "Found candidate at: %08lx-%08lx\n",
|
||||
fprintf(stdout, "Found candidate at: %08lx-%08lx\n",
|
||||
addr, addr + head->table_bytes);
|
||||
if (head->header_bytes != sizeof(*head)) {
|
||||
fprintf(stderr, "Header bytes of %d are incorrect\n",
|
||||
@@ -162,7 +162,7 @@ void print_memory(struct lb_record *ptr, unsigned long addr)
|
||||
(unsigned long long)start, (unsigned long long)end, mem_type);
|
||||
pretty_print_number(stdout, start);
|
||||
printf(" - ");
|
||||
pretty_print_number(stdout, end);
|
||||
pretty_print_number(stdout, end);
|
||||
printf(")\n");
|
||||
}
|
||||
}
|
||||
@@ -174,7 +174,7 @@ void print_mainboard(struct lb_record *ptr, unsigned long addr)
|
||||
rec = (struct lb_mainboard *)ptr;
|
||||
max_size = rec->size - sizeof(*rec);
|
||||
printf("vendor: %.*s part number: %.*s\n",
|
||||
max_size - rec->vendor_idx, rec->strings + rec->vendor_idx,
|
||||
max_size - rec->vendor_idx, rec->strings + rec->vendor_idx,
|
||||
max_size - rec->part_number_idx, rec->strings + rec->part_number_idx);
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ void print_option_checksum(struct lb_record *ptr, unsigned long addr)
|
||||
struct cmos_checksum *rec;
|
||||
rec = (struct cmos_checksum *)ptr;
|
||||
printf("checksum %d, rec len %d, range %d-%d location %d type %d\n",
|
||||
rec->tag, rec->size,
|
||||
rec->tag, rec->size,
|
||||
rec->range_start, rec->range_end, rec->location, rec->type);
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ static struct lb_record *next_record(struct lb_record *rec)
|
||||
return (struct lb_record *)(((char *)rec) + rec->size);
|
||||
}
|
||||
|
||||
void print_lb_records(struct lb_record *rec, struct lb_record *last,
|
||||
void print_lb_records(struct lb_record *rec, struct lb_record *last,
|
||||
unsigned long addr)
|
||||
{
|
||||
struct lb_record *next;
|
||||
@@ -279,8 +279,8 @@ void print_lb_records(struct lb_record *rec, struct lb_record *last,
|
||||
int count;
|
||||
count = 0;
|
||||
|
||||
for(next = next_record(rec); (rec < last) && (next <= last);
|
||||
rec = next, addr += rec->size) {
|
||||
for(next = next_record(rec); (rec < last) && (next <= last);
|
||||
rec = next, addr += rec->size) {
|
||||
next = next_record(rec);
|
||||
count++;
|
||||
for(i = 0; lb_types[i].print != 0; i++) {
|
||||
@@ -309,7 +309,7 @@ void print_lb_table(struct lb_header *head, unsigned long addr)
|
||||
print_lb_records(rec, last, addr + head->header_bytes);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
unsigned char *low_1MB;
|
||||
struct lb_header *lb_table;
|
||||
|
@@ -39,7 +39,7 @@ SRCS+=$(GENERATED_SRCS)
|
||||
PSRCS:=$(patsubst ./%,mkelfImage-$(VERSION)/%,$(SRCS))
|
||||
PSRCS+=./mkelfImage-$(VERSION).spec
|
||||
|
||||
SBIN_TARGETS=$(OBJDIR)/sbin/mkelfImage
|
||||
SBIN_TARGETS=$(OBJDIR)/sbin/mkelfImage
|
||||
MAN8_TARGETS=$(OBJDIR)/man/man8/mkelfImage.8
|
||||
|
||||
TARGETS:=$(SBIN_TARGETS) $(MAN8_TARGETS)
|
||||
@@ -56,7 +56,7 @@ include linux-ia64/Makefile
|
||||
clean::
|
||||
@$(RM) -rf objdir
|
||||
@$(RM) -rf rpm
|
||||
@$(RM) -f config.log config.status config.cache
|
||||
@$(RM) -f config.log config.status config.cache
|
||||
@$(RM) -f $(SBIN_TARGETS) $(MAN1_TARGETS)
|
||||
@$(RM) -f mkelfImage-$(VERSION) $(TARBALL)
|
||||
|
||||
|
@@ -67,9 +67,9 @@
|
||||
Better firmware detection, and stripping excess symbols from the
|
||||
generated object.
|
||||
|
||||
* 1.11 24 January 2002
|
||||
* 1.11 24 January 2002
|
||||
Bug fix to command line processing.
|
||||
|
||||
|
||||
* 1.10 21 January 2002
|
||||
Starting using the PHDRS directive which many versions of ld cannot
|
||||
handle correctly. The symptom is generally a file that is 9MB in
|
||||
@@ -103,7 +103,7 @@
|
||||
Code cleanup in bzImage support.
|
||||
|
||||
* 1.5 1 Febuary 2001
|
||||
Add support for bzImage
|
||||
Add support for bzImage
|
||||
|
||||
* 1.4 ???
|
||||
???
|
||||
@@ -113,7 +113,7 @@
|
||||
|
||||
* 1.2 18 December 2000
|
||||
Work around for some versions of ld not treating /dev/null and an
|
||||
empty file the same
|
||||
empty file the same
|
||||
|
||||
* 1.1 30 November 2000
|
||||
Fix for ramdisks and large amounts of memory with 2.2 series
|
||||
|
2
util/mkelfImage/config/config.guess
vendored
2
util/mkelfImage/config/config.guess
vendored
@@ -845,7 +845,7 @@ EOF
|
||||
;;
|
||||
a.out-i386-linux)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
||||
exit 0 ;;
|
||||
exit 0 ;;
|
||||
coff-i386)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
|
||||
exit 0 ;;
|
||||
|
@@ -115,7 +115,7 @@ fi
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
@@ -125,7 +125,7 @@ if [ x"$dir_arg" != x ]; then
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
@@ -135,7 +135,7 @@ else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
@@ -163,7 +163,7 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
@@ -202,17 +202,17 @@ else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
@@ -243,7 +243,7 @@ else
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
dnl
|
||||
dnl
|
||||
dnl configure.ac for mkelfImage
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
|
||||
dnl ---Required
|
||||
AC_INIT(Makefile.conf.in)
|
||||
@@ -16,11 +16,11 @@ AC_CANONICAL_HOST
|
||||
|
||||
|
||||
dnl Compute target cpu
|
||||
case $host_cpu in
|
||||
i?86 )
|
||||
case $host_cpu in
|
||||
i?86 )
|
||||
target_cpu="i386"
|
||||
;;
|
||||
* )
|
||||
* )
|
||||
target_cpu="$host_cpu"
|
||||
;;
|
||||
esac
|
||||
@@ -111,7 +111,7 @@ if test "$with_i386" != "no" ; then
|
||||
fi
|
||||
AC_CHECK_PROG([I386_CC], [$cc], [$cc], [""], [$PATH])
|
||||
if test "$I386_CC" = no; then
|
||||
|
||||
|
||||
AC_MSG_ERROR([$cc not found])
|
||||
fi
|
||||
AC_CHECK_PROG([I386_CPP], [$cpp], [$cpp], [""], [$PATH])
|
||||
@@ -148,7 +148,7 @@ if test "$with_ia64" != "no" ; then
|
||||
fi
|
||||
AC_CHECK_PROG([IA64_CC], [$cc], [$cc], [""], [$PATH])
|
||||
if test "$IA64_CC" = no; then
|
||||
|
||||
|
||||
AC_MSG_ERROR([$cc not found])
|
||||
fi
|
||||
AC_CHECK_PROG([IA64_CPP], [$cpp], [$cpp], [""], [$PATH])
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#ifndef ELF_BOOT_H
|
||||
#define ELF_BOOT_H
|
||||
#ifndef ELF_BOOT_H
|
||||
#define ELF_BOOT_H
|
||||
|
||||
|
||||
/* This defines the structure of a table of parameters useful for ELF
|
||||
@@ -35,7 +35,7 @@ typedef struct Elf_Bhdr
|
||||
Elf_Half b_records;
|
||||
} Elf_Bhdr;
|
||||
|
||||
/*
|
||||
/*
|
||||
* ELF Notes.
|
||||
*/
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
* is expected to be information that cannot be discovered by
|
||||
* other means, such as quering the hardware directly.
|
||||
*
|
||||
* All of the information should be Position Independent Data.
|
||||
* All of the information should be Position Independent Data.
|
||||
* That is it should be safe to relocated any of the information
|
||||
* without it's meaning/correctnes changing. For table that
|
||||
* can reasonably be used on multiple architectures the data
|
||||
@@ -63,7 +63,7 @@ struct lb_memory_range {
|
||||
uint32_t type;
|
||||
#define LB_MEM_RAM 1
|
||||
#define LB_MEM_RESERVED 2
|
||||
|
||||
|
||||
};
|
||||
|
||||
struct lb_memory {
|
||||
|
@@ -25,7 +25,7 @@ extern struct memelfphdr *add_program_headers(struct memelfheader *ehdr, int cou
|
||||
extern struct memelfnote *add_notes(struct memelfheader *ehdr, int count);
|
||||
|
||||
typedef char *(probe_t)(char *kernel_buf, off_t kernel_size);
|
||||
typedef int (mkelf_t)(int argc, char **argv,
|
||||
typedef int (mkelf_t)(int argc, char **argv,
|
||||
struct memelfheader *hdr, char *kernel_buf, off_t kernel_size);
|
||||
typedef void (usage_t)(void);
|
||||
struct file_type {
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
/* Exact integral types */
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
typedef signed char int8_t;
|
||||
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed short int16_t;
|
||||
@@ -17,7 +17,7 @@ typedef signed long int64_t;
|
||||
|
||||
/* Small types */
|
||||
typedef unsigned char uint_least8_t;
|
||||
typedef signed char int_least8_t;
|
||||
typedef signed char int_least8_t;
|
||||
|
||||
typedef unsigned short uint_least16_t;
|
||||
typedef signed short int_least16_t;
|
||||
@@ -30,7 +30,7 @@ typedef signed long int_least64_t;
|
||||
|
||||
/* Fast Types */
|
||||
typedef unsigned char uint_fast8_t;
|
||||
typedef signed char int_fast8_t;
|
||||
typedef signed char int_fast8_t;
|
||||
|
||||
typedef unsigned long uint_fast16_t;
|
||||
typedef signed long int_fast16_t;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
* These are not normal C functions: instead of the normal
|
||||
* calling sequence, these expect their arguments in registers
|
||||
* $24 and $25, and return the result in $27. Register $28 may
|
||||
* be clobbered (assembly temporary), anything else must be saved.
|
||||
* be clobbered (assembly temporary), anything else must be saved.
|
||||
*
|
||||
* In short: painful.
|
||||
*
|
||||
|
@@ -21,18 +21,18 @@ SECTIONS
|
||||
/* Global data */
|
||||
.data : {
|
||||
_data = .;
|
||||
*(.data)
|
||||
*(.data)
|
||||
CONSTRUCTORS
|
||||
*(.got)
|
||||
*(.sdata)
|
||||
_edata = .;
|
||||
}
|
||||
|
||||
|
||||
/* Important align _bss so bss may be zeroed with quadword access */
|
||||
. = ALIGN(BASIC_ALIGN);
|
||||
.bss : {
|
||||
_bss = .;
|
||||
*(.sbss)
|
||||
*(.sbss)
|
||||
*(.scommon)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
/* Exact integral types */
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
typedef signed char int8_t;
|
||||
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed short int16_t;
|
||||
@@ -16,7 +16,7 @@ typedef signed long long int64_t;
|
||||
|
||||
/* Small types */
|
||||
typedef unsigned char uint_least8_t;
|
||||
typedef signed char int_least8_t;
|
||||
typedef signed char int_least8_t;
|
||||
|
||||
typedef unsigned short uint_least16_t;
|
||||
typedef signed short int_least16_t;
|
||||
@@ -29,7 +29,7 @@ typedef signed long long int_least64_t;
|
||||
|
||||
/* Fast Types */
|
||||
typedef unsigned char uint_fast8_t;
|
||||
typedef signed char int_fast8_t;
|
||||
typedef signed char int_fast8_t;
|
||||
|
||||
typedef unsigned int uint_fast16_t;
|
||||
typedef signed int int_fast16_t;
|
||||
|
@@ -21,18 +21,18 @@ SECTIONS
|
||||
/* Global data */
|
||||
.data : {
|
||||
_data = .;
|
||||
*(.data)
|
||||
*(.data)
|
||||
CONSTRUCTORS
|
||||
*(.got)
|
||||
*(.sdata)
|
||||
_edata = .;
|
||||
}
|
||||
|
||||
|
||||
/* Important align _bss so bss may be zeroed with quadword access */
|
||||
. = ALIGN(BASIC_ALIGN);
|
||||
.bss : {
|
||||
_bss = .;
|
||||
*(.sbss)
|
||||
*(.sbss)
|
||||
*(.scommon)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
|
@@ -33,4 +33,3 @@ jmp_to_program_entry:
|
||||
movl 24+__original_registers, %esp
|
||||
movl 28+__original_registers, %ebp
|
||||
jmp *__entry
|
||||
|
@@ -136,7 +136,7 @@ void va_end (__gnuc_va_list); /* Defined in libgcc.a */
|
||||
/* Define va_list, if desired, from __gnuc_va_list. */
|
||||
/* We deliberately do not define va_list when called from
|
||||
stdio.h, because ANSI C says that stdio.h is not supposed to define
|
||||
va_list. stdio.h needs to have access to that data type,
|
||||
va_list. stdio.h needs to have access to that data type,
|
||||
but must not use that name. It should use the name __gnuc_va_list,
|
||||
which is safe because it is reserved for the implementation. */
|
||||
|
||||
|
@@ -3,23 +3,23 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
// yes, linux has fancy ones. We don't care. This stuff gets used
|
||||
// yes, linux has fancy ones. We don't care. This stuff gets used
|
||||
// hardly at all. And the pain of including those files is just too high.
|
||||
|
||||
//extern inline void strcpy(char *dst, char *src) {while (*src) *dst++ = *src++;}
|
||||
|
||||
//extern inline int strlen(char *src) { int i = 0; while (*src++) i++; return i;}
|
||||
|
||||
static inline size_t strnlen(const char *src, size_t max) {
|
||||
int i = 0;
|
||||
static inline size_t strnlen(const char *src, size_t max) {
|
||||
int i = 0;
|
||||
if (max<0) {
|
||||
while (*src++)
|
||||
i++;
|
||||
while (*src++)
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
else {
|
||||
while ((*src++) && (i < max))
|
||||
i++;
|
||||
while ((*src++) && (i < max))
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#define DEBG(x)
|
||||
#define DEBG1(x)
|
||||
#define DEBG(x)
|
||||
#define DEBG1(x)
|
||||
/* Taken from /usr/src/linux/lib/inflate.c [unmodified]
|
||||
Used for start32, 1/11/2000
|
||||
James Hendricks, Dale Webster */
|
||||
@@ -7,9 +7,9 @@
|
||||
/* inflate.c -- Not copyrighted 1992 by Mark Adler
|
||||
version c10p1, 10 January 1993 */
|
||||
|
||||
/*
|
||||
/*
|
||||
* Adapted for booting Linux by Hannu Savolainen 1993
|
||||
* based on gzip-1.0.3
|
||||
* based on gzip-1.0.3
|
||||
*
|
||||
* Nicolas Pitre <nico@cam.org>, 1999/04/14 :
|
||||
* Little mods for all variable to reside either into rodata or bss segments
|
||||
@@ -54,7 +54,7 @@
|
||||
chunks), otherwise the dynamic method is used. In the latter case, the
|
||||
codes are customized to the probabilities in the current block, and so
|
||||
can code it much better than the pre-determined fixed codes.
|
||||
|
||||
|
||||
The Huffman codes themselves are decoded using a multi-level table
|
||||
lookup, in order to maximize the speed of decoding plus the speed of
|
||||
building the decoding tables. See the comments below that precede the
|
||||
@@ -121,7 +121,7 @@ static char rcsid[] = "#Id: inflate.c,v 0.14 1993/06/10 13:27:04 jloup Exp #";
|
||||
#include "gzip.h"
|
||||
#define STATIC
|
||||
#endif /* !STATIC */
|
||||
|
||||
|
||||
#define slide window
|
||||
|
||||
/* Huffman code lookup table entry--this entry is four bytes for machines
|
||||
@@ -142,7 +142,7 @@ struct huft {
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
STATIC int huft_build OF((unsigned *, unsigned, unsigned,
|
||||
STATIC int huft_build OF((unsigned *, unsigned, unsigned,
|
||||
const ush *, const ush *, struct huft **, int *));
|
||||
STATIC int huft_free OF((struct huft *));
|
||||
STATIC int inflate_codes OF((struct huft *, struct huft *, int, int));
|
||||
@@ -188,7 +188,7 @@ static const ush cpdext[] = { /* Extra bits for distance codes */
|
||||
|
||||
/* Macros for inflate() bit peeking and grabbing.
|
||||
The usage is:
|
||||
|
||||
|
||||
NEEDBITS(j)
|
||||
x = b & mask_bits[j];
|
||||
DUMPBITS(j)
|
||||
@@ -315,7 +315,7 @@ DEBG("huft1 ");
|
||||
memzero(c, sizeof(c));
|
||||
p = b; i = n;
|
||||
do {
|
||||
Tracecv(*p, (stderr, (n-i >= ' ' && n-i <= '~' ? "%c %d\n" : "0x%x %d\n"),
|
||||
Tracecv(*p, (stderr, (n-i >= ' ' && n-i <= '~' ? "%c %d\n" : "0x%x %d\n"),
|
||||
n-i, *p));
|
||||
c[*p]++; /* assume all entries <= BMAX */
|
||||
p++; /* Can't combine with above line (Solaris bug) */
|
||||
@@ -509,7 +509,7 @@ struct huft *t; /* table to free */
|
||||
q = (--p)->v.t;
|
||||
free((char*)p);
|
||||
p = q;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -978,7 +978,7 @@ STATIC int inflate()
|
||||
hufts = 0;
|
||||
malloc_mark(&mark);
|
||||
if ((r = inflate_block(&e)) != 0) {
|
||||
malloc_release(&mark);
|
||||
malloc_release(&mark);
|
||||
return r;
|
||||
}
|
||||
malloc_release(&mark);
|
||||
@@ -1014,7 +1014,7 @@ static ulg crc; /* initialized in makecrc() so it'll reside in bss */
|
||||
#define CRC_VALUE (crc ^ 0xffffffffL)
|
||||
|
||||
/*
|
||||
* Code to compute the CRC-32 table. Borrowed from
|
||||
* Code to compute the CRC-32 table. Borrowed from
|
||||
* gzip-1.0.3/makecrc.c.
|
||||
*/
|
||||
|
||||
@@ -1122,7 +1122,7 @@ int gunzip(void)
|
||||
if ((flags & ORIG_NAME) != 0) {
|
||||
/* Discard the old name */
|
||||
while (get_byte() != 0) /* null */ ;
|
||||
}
|
||||
}
|
||||
|
||||
/* Discard file comment if any */
|
||||
if ((flags & COMMENT) != 0) {
|
||||
@@ -1148,7 +1148,7 @@ int gunzip(void)
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Get the crc and original length */
|
||||
/* crc32 (see algorithm.doc)
|
||||
* uncompressed input size modulo 2^32
|
||||
@@ -1157,12 +1157,12 @@ int gunzip(void)
|
||||
orig_crc |= (ulg) get_byte() << 8;
|
||||
orig_crc |= (ulg) get_byte() << 16;
|
||||
orig_crc |= (ulg) get_byte() << 24;
|
||||
|
||||
|
||||
orig_len = (ulg) get_byte();
|
||||
orig_len |= (ulg) get_byte() << 8;
|
||||
orig_len |= (ulg) get_byte() << 16;
|
||||
orig_len |= (ulg) get_byte() << 24;
|
||||
|
||||
|
||||
/* Validate decompression */
|
||||
if (orig_crc != CRC_VALUE) {
|
||||
error("crc error");
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
# define Trace(x)
|
||||
# define Trace(x)
|
||||
# define Tracev(x)
|
||||
# define Tracevv(x)
|
||||
# define Tracec(c,x)
|
||||
@@ -113,7 +113,7 @@ static void flush_window(void)
|
||||
limit = outcnt;
|
||||
}
|
||||
out = output_ptr;
|
||||
DBG(("flush 0x%08lx start 0x%08lx limit 0x%08lx\n",
|
||||
DBG(("flush 0x%08lx start 0x%08lx limit 0x%08lx\n",
|
||||
(unsigned long) out, (unsigned long)n, limit));
|
||||
for (; n < limit; n++) {
|
||||
ch = *out++ = *in++;
|
||||
|
@@ -11,8 +11,8 @@ SECTIONS
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
} = 0x9090
|
||||
.rodata (.): {
|
||||
*(.rodata)
|
||||
.rodata (.): {
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
}
|
||||
_etext = .; /* End of text section */
|
||||
@@ -28,7 +28,7 @@ SECTIONS
|
||||
}
|
||||
_end = . ;
|
||||
bss_sizex = _end - _bss;
|
||||
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.comment)
|
||||
*(.note)
|
||||
|
@@ -15,9 +15,9 @@ long user_stack [STACK_SIZE] = { 0 };
|
||||
unsigned long * stack_start = & user_stack[STACK_SIZE];
|
||||
|
||||
/* FIXME expand on drive_info_)struct... */
|
||||
struct drive_info_struct {
|
||||
uint8_t dummy[32];
|
||||
};
|
||||
struct drive_info_struct {
|
||||
uint8_t dummy[32];
|
||||
};
|
||||
struct sys_desc_table {
|
||||
uint16_t length;
|
||||
uint8_t table[318];
|
||||
@@ -150,7 +150,7 @@ struct parameters {
|
||||
uint16_t ramdisk_flags; /* 0x1f8 */
|
||||
#define RAMDISK_IMAGE_START_MASK 0x07FF
|
||||
#define RAMDISK_PROMPT_FLAG 0x8000
|
||||
#define RAMDISK_LOAD_FLAG 0x4000
|
||||
#define RAMDISK_LOAD_FLAG 0x4000
|
||||
uint8_t reserved8[2]; /* 0x1fa */
|
||||
uint16_t orig_root_dev; /* 0x1fc */
|
||||
uint8_t reserved9[1]; /* 0x1fe */
|
||||
@@ -292,7 +292,7 @@ static void printf(const char *fmt, ...)
|
||||
continue;
|
||||
}
|
||||
if (*++fmt == 's') {
|
||||
for(p = va_arg(args, char *); *p != '\0'; p++)
|
||||
for(p = va_arg(args, char *); *p != '\0'; p++)
|
||||
putchar(*p);
|
||||
}
|
||||
else { /* Length of item is bounded */
|
||||
@@ -314,7 +314,7 @@ static void printf(const char *fmt, ...)
|
||||
fmt++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Before each format q points to tmp buffer
|
||||
* After each format q points past end of item
|
||||
@@ -376,7 +376,7 @@ static void printf(const char *fmt, ...)
|
||||
}
|
||||
|
||||
/*
|
||||
* String Functions
|
||||
* String Functions
|
||||
* =============================================================================
|
||||
*/
|
||||
|
||||
@@ -408,7 +408,7 @@ void* memcpy(void *dest, const void *src, size_t len)
|
||||
d = dest;
|
||||
s = src;
|
||||
|
||||
for (i=0; i < len; i++)
|
||||
for (i=0; i < len; i++)
|
||||
d[i] = s[i];
|
||||
|
||||
return dest;
|
||||
@@ -426,7 +426,7 @@ int memcmp(void *src1, void *src2, size_t len)
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -510,7 +510,7 @@ void append_command_line(struct parameters *real_mode, char *arg, int arg_bytes)
|
||||
*dest++ = '\0';
|
||||
}
|
||||
|
||||
static void set_memsize_k(struct parameters *real_mode, unsigned long mem_k)
|
||||
static void set_memsize_k(struct parameters *real_mode, unsigned long mem_k)
|
||||
{
|
||||
/* ALT_MEM_K maxes out at 4GB */
|
||||
if (mem_k > 0x3fffff) {
|
||||
@@ -527,7 +527,7 @@ static void set_memsize_k(struct parameters *real_mode, unsigned long mem_k)
|
||||
}
|
||||
|
||||
static void add_e820_map(struct parameters *real_mode,
|
||||
unsigned long long addr, unsigned long long size,
|
||||
unsigned long long addr, unsigned long long size,
|
||||
unsigned long type)
|
||||
{
|
||||
unsigned long long high;
|
||||
@@ -628,8 +628,8 @@ static void convert_multiboot_memmap(
|
||||
multi_puts("size: "); multi_put_hex(size); multi_puts("\n");
|
||||
multi_puts("end: "); multi_put_hex((unsigned)end); multi_puts("\n");
|
||||
for(seg = info->mmap_addr; (seg < end); seg = next_seg(seg,size)) {
|
||||
multi_puts("multi-mem: ");
|
||||
multi_put_lhex(seg->size);
|
||||
multi_puts("multi-mem: ");
|
||||
multi_put_lhex(seg->size);
|
||||
multi_puts(" @ ");
|
||||
multi_put_lhex(seg->addr);
|
||||
multi_puts(" (");
|
||||
@@ -662,7 +662,7 @@ static void convert_multiboot(
|
||||
set_memsize_k(info->real_mode, mb_info->mem_upper + (1 << 10));
|
||||
}
|
||||
if (mb_info->flags & MULTIBOOT_CMDLINE_VALID) {
|
||||
append_command_line(info->real_mode, mb_info->command_line,
|
||||
append_command_line(info->real_mode, mb_info->command_line,
|
||||
MULTIBOOT_MAX_COMMAND_LINE);
|
||||
}
|
||||
if (info->need_mem_sizes && (mb_info->flags & MULTIBOOT_MMAP_VALID)) {
|
||||
@@ -699,8 +699,8 @@ static void convert_uniform_boot_memory(
|
||||
entries = (mem->size - sizeof(*mem))/sizeof(mem->map[0]);
|
||||
for(i = 0; (i < entries) && (i < E820MAX); i++) {
|
||||
unsigned long type;
|
||||
ube_puts("ube-mem: ");
|
||||
ube_put_lhex(mem->map[i].size);
|
||||
ube_puts("ube-mem: ");
|
||||
ube_put_lhex(mem->map[i].size);
|
||||
ube_puts(" @ ");
|
||||
ube_put_lhex(mem->map[i].start);
|
||||
ube_puts(" (");
|
||||
@@ -724,7 +724,7 @@ static void convert_uniform_boot_memory(
|
||||
break;
|
||||
}
|
||||
ube_puts(")\n");
|
||||
add_e820_map(real_mode,
|
||||
add_e820_map(real_mode,
|
||||
mem->map[i].start, mem->map[i].size, type);
|
||||
}
|
||||
}
|
||||
@@ -762,9 +762,9 @@ static void convert_uniform_boot(struct param_info *info,
|
||||
* =============================================================================
|
||||
*/
|
||||
|
||||
/* we're getting screwed again and again by this problem of the 8259.
|
||||
* so we're going to leave this lying around for inclusion into
|
||||
* crt0.S on an as-needed basis.
|
||||
/* we're getting screwed again and again by this problem of the 8259.
|
||||
* so we're going to leave this lying around for inclusion into
|
||||
* crt0.S on an as-needed basis.
|
||||
* well, that went ok, I hope. Now we have to reprogram the interrupts :-(
|
||||
* we put them right after the intel-reserved hardware interrupts, at
|
||||
* int 0x20-0x2F. There they won't mess up anything. Sadly IBM really
|
||||
@@ -786,7 +786,7 @@ static void setup_i8259(void)
|
||||
outb(0x02, 0xA1); /*! 8259-2 is slave*/
|
||||
|
||||
outb(0x01, 0x21); /*! 8086 mode for both*/
|
||||
outb(0x01, 0xA1);
|
||||
outb(0x01, 0xA1);
|
||||
|
||||
outb(0xFF, 0xA1); /*! mask off all interrupts for now*/
|
||||
outb(0xFB, 0x21); /*! mask all irq's but irq2 which is cascaded*/
|
||||
@@ -831,11 +831,11 @@ static int count_elf_notes(Elf_Bhdr *bhdr)
|
||||
printf("elf_note = %lx\n", (unsigned long)note);
|
||||
printf("elf_namesz = %x\n", hdr->n_namesz);
|
||||
printf("elf_descsz = %x\n", hdr->n_descsz);
|
||||
printf("elf_type = %x\n", hdr->n_type);
|
||||
printf("elf_type = %x\n", hdr->n_type);
|
||||
printf("elf_name = %lx\n", (unsigned long)n_name);
|
||||
printf("elf_desc = %lx\n", (unsigned long)n_desc);
|
||||
#endif
|
||||
if (next > end)
|
||||
if (next > end)
|
||||
break;
|
||||
count++;
|
||||
note = next;
|
||||
@@ -843,7 +843,7 @@ static int count_elf_notes(Elf_Bhdr *bhdr)
|
||||
return count;
|
||||
}
|
||||
|
||||
static Elf_Nhdr *find_elf_note(Elf_Bhdr *bhdr,
|
||||
static Elf_Nhdr *find_elf_note(Elf_Bhdr *bhdr,
|
||||
Elf_Word namesz, unsigned char *name, Elf_Word type)
|
||||
{
|
||||
unsigned char *note, *end;
|
||||
@@ -856,7 +856,7 @@ static Elf_Nhdr *find_elf_note(Elf_Bhdr *bhdr,
|
||||
n_name = note + sizeof(*hdr);
|
||||
n_desc = n_name + ((hdr->n_namesz + 3) & ~3);
|
||||
next = n_desc + ((hdr->n_descsz + 3) & ~3);
|
||||
if (next > end)
|
||||
if (next > end)
|
||||
break;
|
||||
if ((hdr->n_type == type) &&
|
||||
(hdr->n_namesz == namesz) &&
|
||||
@@ -897,7 +897,7 @@ static void convert_elf_boot(struct param_info *info, Elf_Bhdr *bhdr)
|
||||
n_name = note + sizeof(*hdr);
|
||||
n_desc = n_name + ((hdr->n_namesz + 3) & ~3);
|
||||
next = n_desc + ((hdr->n_descsz + 3) & ~3);
|
||||
if (next > end)
|
||||
if (next > end)
|
||||
break;
|
||||
for(i = 0; i < sizeof(elf_notes)/sizeof(elf_notes[0]); i++) {
|
||||
if ((hdr->n_type == elf_notes[i].type) &&
|
||||
@@ -935,7 +935,7 @@ static unsigned count_lb_records(void *start, unsigned long length)
|
||||
count = 0;
|
||||
end = ((char *)start) + length;
|
||||
for(rec = start; ((void *)rec < end) &&
|
||||
(rec->size <= (unsigned long)(end - (void *)rec));
|
||||
(rec->size <= (unsigned long)(end - (void *)rec));
|
||||
rec = (void *)(((char *)rec) + rec->size)) {
|
||||
count++;
|
||||
}
|
||||
@@ -948,7 +948,7 @@ static struct lb_header *__find_lb_table(void *start, void *end)
|
||||
/* For now be stupid.... */
|
||||
for(ptr = start; (void *)ptr < end; ptr += 16) {
|
||||
struct lb_header *head = (void *)ptr;
|
||||
if ((head->signature[0] == 'L') &&
|
||||
if ((head->signature[0] == 'L') &&
|
||||
(head->signature[1] == 'B') &&
|
||||
(head->signature[2] == 'I') &&
|
||||
(head->signature[3] == 'O') &&
|
||||
@@ -1001,10 +1001,10 @@ static void convert_lb_memory(struct param_info *info, struct lb_memory *mem)
|
||||
unsigned long type;
|
||||
unsigned long long end;
|
||||
end = mem->map[i].start + mem->map[i].size;
|
||||
lb_puts("lb-mem: ");
|
||||
lb_puts("lb-mem: ");
|
||||
lb_put_lhex(mem->map[i].start);
|
||||
lb_puts(" - ");
|
||||
lb_put_lhex(end);
|
||||
lb_put_lhex(end);
|
||||
lb_puts(" (");
|
||||
switch(mem->map[i].type) {
|
||||
case LB_MEM_RAM:
|
||||
@@ -1017,12 +1017,12 @@ static void convert_lb_memory(struct param_info *info, struct lb_memory *mem)
|
||||
break;
|
||||
}
|
||||
lb_puts(")\n");
|
||||
add_e820_map(info->real_mode,
|
||||
add_e820_map(info->real_mode,
|
||||
mem->map[i].start, mem->map[i].size, type);
|
||||
}
|
||||
info->need_mem_sizes = 0;
|
||||
}
|
||||
|
||||
|
||||
static void query_lb_values(struct param_info *info)
|
||||
{
|
||||
struct lb_header *head;
|
||||
@@ -1032,17 +1032,17 @@ static void query_lb_values(struct param_info *info)
|
||||
start = ((unsigned char *)head) + sizeof(*head);
|
||||
end = ((char *)start) + head->table_bytes;
|
||||
for(rec = start; ((void *)rec < end) &&
|
||||
(rec->size <= (unsigned long)(end - (void *)rec));
|
||||
(rec->size <= (unsigned long)(end - (void *)rec));
|
||||
rec = (void *)(((char *)rec) + rec->size)) {
|
||||
switch(rec->tag) {
|
||||
case LB_TAG_MEMORY:
|
||||
{
|
||||
struct lb_memory *mem;
|
||||
mem = (struct lb_memory *) rec;
|
||||
convert_lb_memory(info, mem);
|
||||
convert_lb_memory(info, mem);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
@@ -1087,7 +1087,7 @@ static void get_meminfo(struct param_info *info)
|
||||
struct e820entry *seg = meminfo.map + i;
|
||||
end = seg->addr + seg->size;
|
||||
pc_puts("BIOS-e820: ");
|
||||
pc_put_lhex(seg->addr);
|
||||
pc_put_lhex(seg->addr);
|
||||
pc_puts(" - ");
|
||||
pc_put_lhex(end);
|
||||
pc_puts(" (");
|
||||
@@ -1108,7 +1108,7 @@ static void get_meminfo(struct param_info *info)
|
||||
break;
|
||||
}
|
||||
pc_puts(")\n");
|
||||
add_e820_map(info->real_mode,
|
||||
add_e820_map(info->real_mode,
|
||||
seg->addr, seg->size, seg->type);
|
||||
}
|
||||
info->real_mode->alt_mem_k = meme801();
|
||||
@@ -1191,7 +1191,7 @@ static void query_bootloader_param_class(struct param_info *info)
|
||||
}
|
||||
}
|
||||
|
||||
static void query_bootloader_values(struct param_info *info)
|
||||
static void query_bootloader_values(struct param_info *info)
|
||||
{
|
||||
if (info->has_multiboot) {
|
||||
convert_multiboot(info, info->data);
|
||||
@@ -1252,7 +1252,7 @@ static int bootloader_query_firmware_class(struct param_info *info)
|
||||
detected_firmware_type = 1;
|
||||
}
|
||||
if (!detected_firmware_type && hdr &&
|
||||
(hdr->n_descsz == 1) &&
|
||||
(hdr->n_descsz == 1) &&
|
||||
(memcmp(n_desc, "", 1) == 0)) {
|
||||
/* No firmware is present */
|
||||
detected_firmware_type = 1;
|
||||
@@ -1305,7 +1305,7 @@ static void query_firmware_values(struct param_info *info)
|
||||
if (info->has_pcbios) {
|
||||
query_pcbios_values(info);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1325,59 +1325,59 @@ static void print_offsets(void)
|
||||
printf("orig_video_page =%x\n", (uint32_t)&real_mode->orig_video_page);
|
||||
printf("orig_video_mode =%x\n", (uint32_t)&real_mode->orig_video_mode);
|
||||
printf("orig_video_cols =%x\n", (uint32_t)&real_mode->orig_video_cols);
|
||||
printf("unused2 =%x\n", (uint32_t)&real_mode->unused2);
|
||||
printf("orig_video_ega_bx =%x\n", (uint32_t)&real_mode->orig_video_ega_bx);
|
||||
printf("unused2 =%x\n", (uint32_t)&real_mode->unused2);
|
||||
printf("orig_video_ega_bx =%x\n", (uint32_t)&real_mode->orig_video_ega_bx);
|
||||
printf("unused3 =%x\n", (uint32_t)&real_mode->unused3);
|
||||
printf("orig_video_lines =%x\n", (uint32_t)&real_mode->orig_video_lines);
|
||||
printf("orig_video_isVGA =%x\n", (uint32_t)&real_mode->orig_video_isVGA);
|
||||
printf("orig_video_lines =%x\n", (uint32_t)&real_mode->orig_video_lines);
|
||||
printf("orig_video_isVGA =%x\n", (uint32_t)&real_mode->orig_video_isVGA);
|
||||
printf("orig_video_points =%x\n", (uint32_t)&real_mode->orig_video_points);
|
||||
printf("lfb_width =%x\n", (uint32_t)&real_mode->lfb_width);
|
||||
printf("lfb_height =%x\n", (uint32_t)&real_mode->lfb_height);
|
||||
printf("lfb_depth =%x\n", (uint32_t)&real_mode->lfb_depth);
|
||||
printf("lfb_base =%x\n", (uint32_t)&real_mode->lfb_base);
|
||||
printf("lfb_size =%x\n", (uint32_t)&real_mode->lfb_size);
|
||||
printf("cl_magic =%x\n", (uint32_t)&real_mode->cl_magic);
|
||||
printf("lfb_depth =%x\n", (uint32_t)&real_mode->lfb_depth);
|
||||
printf("lfb_base =%x\n", (uint32_t)&real_mode->lfb_base);
|
||||
printf("lfb_size =%x\n", (uint32_t)&real_mode->lfb_size);
|
||||
printf("cl_magic =%x\n", (uint32_t)&real_mode->cl_magic);
|
||||
printf("cl_offset =%x\n", (uint32_t)&real_mode->cl_offset);
|
||||
printf("lfb_linelength =%x\n", (uint32_t)&real_mode->lfb_linelength);
|
||||
printf("red_size =%x\n", (uint32_t)&real_mode->red_size);
|
||||
printf("red_pos =%x\n", (uint32_t)&real_mode->red_pos);
|
||||
printf("red_pos =%x\n", (uint32_t)&real_mode->red_pos);
|
||||
printf("green_size =%x\n", (uint32_t)&real_mode->green_size);
|
||||
printf("green_pos =%x\n", (uint32_t)&real_mode->green_pos);
|
||||
printf("blue_size =%x\n", (uint32_t)&real_mode->blue_size);
|
||||
printf("blue_pos =%x\n", (uint32_t)&real_mode->blue_pos);
|
||||
printf("green_pos =%x\n", (uint32_t)&real_mode->green_pos);
|
||||
printf("blue_size =%x\n", (uint32_t)&real_mode->blue_size);
|
||||
printf("blue_pos =%x\n", (uint32_t)&real_mode->blue_pos);
|
||||
printf("rsvd_size =%x\n", (uint32_t)&real_mode->rsvd_size);
|
||||
printf("rsvd_pos =%x\n", (uint32_t)&real_mode->rsvd_pos);
|
||||
printf("rsvd_pos =%x\n", (uint32_t)&real_mode->rsvd_pos);
|
||||
printf("vesapm_seg =%x\n", (uint32_t)&real_mode->vesapm_seg);
|
||||
printf("vesapm_off =%x\n", (uint32_t)&real_mode->vesapm_off);
|
||||
printf("pages =%x\n", (uint32_t)&real_mode->pages);
|
||||
printf("reserved4 =%x\n", (uint32_t)&real_mode->reserved4);
|
||||
printf("pages =%x\n", (uint32_t)&real_mode->pages);
|
||||
printf("reserved4 =%x\n", (uint32_t)&real_mode->reserved4);
|
||||
printf("apm_bios_info =%x\n", (uint32_t)&real_mode->apm_bios_info);
|
||||
printf("drive_info =%x\n", (uint32_t)&real_mode->drive_info);
|
||||
printf("drive_info =%x\n", (uint32_t)&real_mode->drive_info);
|
||||
printf("sys_desc_table =%x\n", (uint32_t)&real_mode->sys_desc_table);
|
||||
printf("alt_mem_k =%x\n", (uint32_t)&real_mode->alt_mem_k);
|
||||
printf("reserved5 =%x\n", (uint32_t)&real_mode->reserved5);
|
||||
printf("e820_map_nr =%x\n", (uint32_t)&real_mode->e820_map_nr);
|
||||
printf("reserved6 =%x\n", (uint32_t)&real_mode->reserved6);
|
||||
printf("mount_root_rdonly =%x\n", (uint32_t)&real_mode->mount_root_rdonly);
|
||||
printf("alt_mem_k =%x\n", (uint32_t)&real_mode->alt_mem_k);
|
||||
printf("reserved5 =%x\n", (uint32_t)&real_mode->reserved5);
|
||||
printf("e820_map_nr =%x\n", (uint32_t)&real_mode->e820_map_nr);
|
||||
printf("reserved6 =%x\n", (uint32_t)&real_mode->reserved6);
|
||||
printf("mount_root_rdonly =%x\n", (uint32_t)&real_mode->mount_root_rdonly);
|
||||
printf("reserved7 =%x\n", (uint32_t)&real_mode->reserved7);
|
||||
printf("ramdisk_flags =%x\n", (uint32_t)&real_mode->ramdisk_flags);
|
||||
printf("reserved8 =%x\n", (uint32_t)&real_mode->reserved8);
|
||||
printf("reserved8 =%x\n", (uint32_t)&real_mode->reserved8);
|
||||
printf("orig_root_dev =%x\n", (uint32_t)&real_mode->orig_root_dev);
|
||||
printf("reserved9 =%x\n", (uint32_t)&real_mode->reserved9);
|
||||
printf("reserved9 =%x\n", (uint32_t)&real_mode->reserved9);
|
||||
printf("aux_device_info =%x\n", (uint32_t)&real_mode->aux_device_info);
|
||||
printf("reserved10 =%x\n", (uint32_t)&real_mode->reserved10);
|
||||
printf("reserved10 =%x\n", (uint32_t)&real_mode->reserved10);
|
||||
printf("param_block_signature=%x\n", (uint32_t)&real_mode->param_block_signature);
|
||||
printf("param_block_version =%x\n", (uint32_t)&real_mode->param_block_version);
|
||||
printf("reserved11 =%x\n", (uint32_t)&real_mode->reserved11);
|
||||
printf("param_block_version =%x\n", (uint32_t)&real_mode->param_block_version);
|
||||
printf("reserved11 =%x\n", (uint32_t)&real_mode->reserved11);
|
||||
printf("loader_type =%x\n", (uint32_t)&real_mode->loader_type);
|
||||
printf("loader_flags =%x\n", (uint32_t)&real_mode->loader_flags);
|
||||
printf("reserved12 =%x\n", (uint32_t)&real_mode->reserved12);
|
||||
printf("reserved12 =%x\n", (uint32_t)&real_mode->reserved12);
|
||||
printf("kernel_start =%x\n", (uint32_t)&real_mode->kernel_start);
|
||||
printf("initrd_start =%x\n", (uint32_t)&real_mode->initrd_start);
|
||||
printf("initrd_size =%x\n", (uint32_t)&real_mode->initrd_size);
|
||||
printf("reserved13 =%x\n", (uint32_t)&real_mode->reserved13);
|
||||
printf("e820_map =%x\n", (uint32_t)&real_mode->e820_map);
|
||||
printf("reserved16 =%x\n", (uint32_t)&real_mode->reserved16);
|
||||
printf("e820_map =%x\n", (uint32_t)&real_mode->e820_map);
|
||||
printf("reserved16 =%x\n", (uint32_t)&real_mode->reserved16);
|
||||
printf("command_line =%x\n", (uint32_t)&real_mode->command_line);
|
||||
printf("reserved17 =%x\n", (uint32_t)&real_mode->reserved17);
|
||||
}
|
||||
@@ -1397,7 +1397,7 @@ static void print_linux_params(struct param_info *info)
|
||||
printf("orig_video_ega_bx=%x\n", info->real_mode->orig_video_ega_bx);
|
||||
printf("orig_video_isVGA =%x\n", info->real_mode->orig_video_isVGA);
|
||||
printf("orig_video_points=%x\n", info->real_mode->orig_video_points);
|
||||
|
||||
|
||||
|
||||
/* System descriptor table... */
|
||||
printf("sys_dest_table_len=%x\n", info->real_mode->sys_desc_table.length);
|
||||
@@ -1407,27 +1407,27 @@ static void print_linux_params(struct param_info *info)
|
||||
printf("alt_mem_k =%x\n", info->real_mode->alt_mem_k);
|
||||
printf("e820_map_nr =%x\n", info->real_mode->e820_map_nr);
|
||||
for(i = 0; i < E820MAX; i++) {
|
||||
printf("addr[%x] =%Lx\n",
|
||||
printf("addr[%x] =%Lx\n",
|
||||
i, info->real_mode->e820_map[i].addr);
|
||||
printf("size[%x] =%Lx\n",
|
||||
printf("size[%x] =%Lx\n",
|
||||
i, info->real_mode->e820_map[i].size);
|
||||
printf("type[%x] =%Lx\n",
|
||||
printf("type[%x] =%Lx\n",
|
||||
i, info->real_mode->e820_map[i].type);
|
||||
}
|
||||
printf("mount_root_rdonly=%x\n", info->real_mode->mount_root_rdonly);
|
||||
printf("ramdisk_flags =%x\n", info->real_mode->ramdisk_flags);
|
||||
printf("orig_root_dev =%x\n", info->real_mode->orig_root_dev);
|
||||
printf("aux_device_info =%x\n", info->real_mode->aux_device_info);
|
||||
printf("mount_root_rdonly=%x\n", info->real_mode->mount_root_rdonly);
|
||||
printf("ramdisk_flags =%x\n", info->real_mode->ramdisk_flags);
|
||||
printf("orig_root_dev =%x\n", info->real_mode->orig_root_dev);
|
||||
printf("aux_device_info =%x\n", info->real_mode->aux_device_info);
|
||||
printf("param_block_signature=%x\n", *((uint32_t *)info->real_mode->param_block_signature));
|
||||
printf("loader_type =%x\n", info->real_mode->loader_type);
|
||||
printf("loader_type =%x\n", info->real_mode->loader_type);
|
||||
printf("loader_flags =%x\n", info->real_mode->loader_flags);
|
||||
printf("initrd_start =%x\n", info->real_mode->initrd_start);
|
||||
printf("initrd_size =%x\n", info->real_mode->initrd_size);
|
||||
printf("initrd_size =%x\n", info->real_mode->initrd_size);
|
||||
|
||||
/* Where I'm putting the command line */
|
||||
printf("cl_magic =%x\n", info->real_mode->cl_magic);
|
||||
printf("cl_magic =%x\n", info->real_mode->cl_magic);
|
||||
printf("cl_offset =%x\n", info->real_mode->cl_offset);
|
||||
|
||||
|
||||
/* Now print the command line */
|
||||
printf("command_line =%s\n", info->real_mode->command_line);
|
||||
}
|
||||
@@ -1445,7 +1445,7 @@ void initialize_linux_params(struct param_info *info)
|
||||
int len;
|
||||
/* First the defaults */
|
||||
memset(info->real_mode, 0, PAGE_SIZE);
|
||||
|
||||
|
||||
/* Default screen size */
|
||||
info->real_mode->orig_x = 0;
|
||||
info->real_mode->orig_y = 25;
|
||||
@@ -1456,10 +1456,10 @@ void initialize_linux_params(struct param_info *info)
|
||||
info->real_mode->orig_video_ega_bx = 0;
|
||||
info->real_mode->orig_video_isVGA = 1;
|
||||
info->real_mode->orig_video_points = 16;
|
||||
|
||||
|
||||
/* Fill this in later */
|
||||
info->real_mode->ext_mem_k = 0;
|
||||
|
||||
|
||||
/* Fill in later... */
|
||||
info->real_mode->e820_map_nr = 0;
|
||||
|
||||
@@ -1468,7 +1468,7 @@ void initialize_linux_params(struct param_info *info)
|
||||
info->real_mode->cl_offset = 2048;
|
||||
|
||||
info->real_mode->cmd_line_ptr = info->real_mode->cl_offset + (unsigned long) info->real_mode;
|
||||
|
||||
|
||||
/* Now set the command line */
|
||||
len = strnlen(info->image->cmdline, sizeof(info->real_mode->command_line) -1);
|
||||
memcpy(info->real_mode->command_line, info->image->cmdline, len);
|
||||
@@ -1476,49 +1476,49 @@ void initialize_linux_params(struct param_info *info)
|
||||
|
||||
/* from the bios initially */
|
||||
memset(&info->real_mode->apm_bios_info, 0, sizeof(info->real_mode->apm_bios_info));
|
||||
|
||||
|
||||
memset(&info->real_mode->drive_info, 0, sizeof(info->real_mode->drive_info));
|
||||
|
||||
/* forget it for now... */
|
||||
info->real_mode->sys_desc_table.length = 0;
|
||||
|
||||
info->real_mode->sys_desc_table.length = 0;
|
||||
|
||||
/* Fill this in later */
|
||||
info->real_mode->alt_mem_k = 0;
|
||||
info->real_mode->ext_mem_k = 0;
|
||||
|
||||
|
||||
/* default yes: this can be overridden on the command line */
|
||||
info->real_mode->mount_root_rdonly = 0xFFFF;
|
||||
|
||||
|
||||
/* old ramdisk options, These really should be command line
|
||||
* things...
|
||||
*/
|
||||
info->real_mode->ramdisk_flags = info->image->ramdisk_flags;
|
||||
|
||||
/* default to /dev/hda.
|
||||
* Override this on the command line if necessary
|
||||
* Override this on the command line if necessary
|
||||
*/
|
||||
info->real_mode->orig_root_dev = info->image->root_dev;
|
||||
|
||||
|
||||
/* Originally from the bios? */
|
||||
info->real_mode->aux_device_info = 0;
|
||||
|
||||
|
||||
/* Boot block magic */
|
||||
memcpy(info->real_mode->param_block_signature, "HdrS", 4);
|
||||
info->real_mode->param_block_version = 0x0201;
|
||||
|
||||
|
||||
/* Say I'm a kernel boot loader */
|
||||
info->real_mode->loader_type = (LOADER_TYPE_KERNEL << 4) + 0 /* version */;
|
||||
|
||||
|
||||
/* No loader flags */
|
||||
info->real_mode->loader_flags = 0;
|
||||
|
||||
|
||||
/* Ramdisk address and size ... */
|
||||
info->real_mode->initrd_start = 0;
|
||||
info->real_mode->initrd_size = 0;
|
||||
if (info->image->initrd_size) {
|
||||
info->real_mode->initrd_start = info->image->initrd_start;
|
||||
info->real_mode->initrd_size = info->image->initrd_size;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now remember those things that I need */
|
||||
info->need_mem_sizes = 1;
|
||||
@@ -1556,7 +1556,7 @@ void *convert_params(unsigned type, void *data, void *param, void *image)
|
||||
#if 0
|
||||
printf("info.real_mode = 0x%x\n", info.real_mode );
|
||||
printf("Jumping to Linux\n");
|
||||
#endif
|
||||
#endif
|
||||
return info.real_mode;
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Other parts were taken from etherboot-5.0.5
|
||||
*/
|
||||
|
||||
|
||||
#define ASSEMBLY 1
|
||||
|
||||
#define RELOC 0x10000
|
||||
@@ -37,7 +37,7 @@ startup_32:
|
||||
jz 1f
|
||||
movl 4(%esp), %eax
|
||||
movl %eax, boot_param
|
||||
1:
|
||||
1:
|
||||
|
||||
movl stack_start, %esp
|
||||
|
||||
@@ -63,7 +63,7 @@ startup_32:
|
||||
# Linux makes stupid assumptions about the segments
|
||||
# that are already setup, so setup a new gdt & ldt
|
||||
# and then reload the segment registers.
|
||||
|
||||
|
||||
lgdt gdt_48
|
||||
lidt idt_48
|
||||
|
||||
@@ -80,17 +80,17 @@ startup_32:
|
||||
pushl boot_data # boot data pointer as second arg
|
||||
pushl boot_type # boot data type as first argument
|
||||
call convert_params
|
||||
|
||||
|
||||
movl %eax, %esi # put the real mode pointer in a safe place
|
||||
addl $16, %esp # pop the arguments
|
||||
|
||||
|
||||
|
||||
# Setup the registers before jumping to linux
|
||||
|
||||
|
||||
# clear eflags
|
||||
pushl $0
|
||||
popfl
|
||||
popfl
|
||||
|
||||
# Flag to indicate we are the bootstrap processor
|
||||
xorl %ebx, %ebx
|
||||
@@ -231,7 +231,7 @@ jmpe820:
|
||||
cmpl $SMAP, %eax
|
||||
jne bail820
|
||||
|
||||
good820:
|
||||
good820:
|
||||
/* If this is useable memory, we save it by simply advancing %di by
|
||||
* sizeof(e820rec)
|
||||
*/
|
||||
@@ -250,7 +250,7 @@ bail820:
|
||||
popl %eax
|
||||
subl %esi, %eax /* Compute how many structure we read */
|
||||
|
||||
/* Restore everything else */
|
||||
/* Restore everything else */
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
@@ -260,7 +260,7 @@ bail820:
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
MEME801 - Determine size of extended memory
|
||||
MEME801 - Determine size of extended memory
|
||||
**************************************************************************/
|
||||
.globl meme801
|
||||
meme801:
|
||||
@@ -270,12 +270,12 @@ meme801:
|
||||
call _prot_to_real
|
||||
.code16
|
||||
|
||||
stc # fix to work around buggy
|
||||
xorw %cx,%cx # BIOSes which dont clear/set
|
||||
xorw %dx,%dx # carry on pass/error of
|
||||
# e801h memory size call
|
||||
# or merely pass cx,dx though
|
||||
# without changing them.
|
||||
stc # fix to work around buggy
|
||||
xorw %cx,%cx # BIOSes which dont clear/set
|
||||
xorw %dx,%dx # carry on pass/error of
|
||||
# e801h memory size call
|
||||
# or merely pass cx,dx though
|
||||
# without changing them.
|
||||
movw $0xe801,%ax
|
||||
int $0x15
|
||||
jc e801absent
|
||||
@@ -284,7 +284,7 @@ meme801:
|
||||
jne e801usecxdx # which report their extended
|
||||
cmpw $0x0, %dx # memory in AX/BX rather than
|
||||
jne e801usecxdx # CX/DX. The spec I have read
|
||||
movw %ax, %cx # seems to indicate AX/BX
|
||||
movw %ax, %cx # seems to indicate AX/BX
|
||||
movw %bx, %dx # are more reasonable anyway...
|
||||
|
||||
e801usecxdx:
|
||||
@@ -298,7 +298,7 @@ e801usecxdx:
|
||||
e801absent:
|
||||
xorl %eax,%eax
|
||||
|
||||
e801out:
|
||||
e801out:
|
||||
data32 call _real_to_prot
|
||||
.code32
|
||||
/* Restore Everything */
|
||||
@@ -308,7 +308,7 @@ e801out:
|
||||
ret
|
||||
|
||||
/**************************************************************************
|
||||
MEM88 - Determine size of extended memory
|
||||
MEM88 - Determine size of extended memory
|
||||
**************************************************************************/
|
||||
.globl mem88
|
||||
mem88:
|
||||
@@ -330,7 +330,7 @@ mem88:
|
||||
popl %esi
|
||||
popl %ebx
|
||||
ret
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
BASEMEMSIZE - Get size of the conventional (base) memory
|
||||
@@ -375,7 +375,7 @@ _real_to_prot:
|
||||
popl %eax /* Fix up return address */
|
||||
addl $RELOC,%eax
|
||||
pushl %eax
|
||||
|
||||
|
||||
/* switch to protected mode idt */
|
||||
cs
|
||||
lidt idt_48
|
||||
@@ -469,7 +469,7 @@ gdt:
|
||||
.byte (RELOC>>16),0x93,0x00,(RELOC>>24)
|
||||
|
||||
/* For 2.5.x the kernel segments have moved */
|
||||
|
||||
|
||||
/* 0x28 dummy */
|
||||
.quad 0
|
||||
|
||||
@@ -485,7 +485,7 @@ gdt:
|
||||
.quad 0
|
||||
/* 0x58 dummy */
|
||||
.quad 0
|
||||
|
||||
|
||||
|
||||
/* 0x60 */
|
||||
.word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb)
|
||||
@@ -534,7 +534,7 @@ gdt:
|
||||
* 20 - PNPBIOS support
|
||||
* 21 - APM BIOS support
|
||||
* 22 - APM BIOS support
|
||||
* 23 - APM BIOS support
|
||||
* 23 - APM BIOS support
|
||||
*/
|
||||
gdt_end:
|
||||
|
||||
@@ -546,7 +546,7 @@ gdt64:
|
||||
.quad 0x00af9a000000ffff /* __KERNEL_CS */
|
||||
.quad 0x00cf92000000ffff /* __KERNEL_DS */
|
||||
gdt64_end:
|
||||
|
||||
|
||||
.section ".trailer", "a"
|
||||
/* Constants set at build time, these are at the very end of my image */
|
||||
.balign 16
|
||||
|
@@ -228,7 +228,7 @@ static void parse_elf64_kernel(struct kernel_info *info, char *kernel_buf, size_
|
||||
|
||||
if(!phdrs)
|
||||
die("We need at least one phdr\n");
|
||||
|
||||
|
||||
info->phdrs = phdrs;
|
||||
info->entry = le64_to_cpu(ehdr->e_entry);
|
||||
#if 0
|
||||
@@ -296,7 +296,7 @@ void linux_i386_usage(void)
|
||||
|
||||
#define DEFAULT_RAMDISK_BASE (8*1024*1024)
|
||||
|
||||
int linux_i386_mkelf(int argc, char **argv,
|
||||
int linux_i386_mkelf(int argc, char **argv,
|
||||
struct memelfheader *ehdr, char *kernel_buf, off_t kernel_size)
|
||||
{
|
||||
const char *ramdisk, *cmdline;
|
||||
@@ -379,7 +379,7 @@ int linux_i386_mkelf(int argc, char **argv,
|
||||
strncpy(params->cmdline, cmdline, sizeof(params->cmdline));
|
||||
params->cmdline[sizeof(params->cmdline)-1]= '\0';
|
||||
|
||||
|
||||
|
||||
/* Add a program header for the note section */
|
||||
index = 4;
|
||||
index += (kinfo.phdrs - 1);
|
||||
@@ -388,7 +388,7 @@ int linux_i386_mkelf(int argc, char **argv,
|
||||
|
||||
/* Fill in the program headers*/
|
||||
phdr[0].p_type = PT_NOTE;
|
||||
|
||||
|
||||
/* Fill in the converter program headers */
|
||||
phdr[1].p_paddr = CONVERTLOC;
|
||||
phdr[1].p_vaddr = CONVERTLOC;
|
||||
@@ -420,7 +420,7 @@ int linux_i386_mkelf(int argc, char **argv,
|
||||
phdr[index].p_data = kinfo.kernel[i];
|
||||
index++;
|
||||
}
|
||||
|
||||
|
||||
/* Put the ramdisk at ramdisk base.
|
||||
*/
|
||||
params->initrd_start = params->initrd_size = 0;
|
||||
@@ -438,7 +438,7 @@ int linux_i386_mkelf(int argc, char **argv,
|
||||
params->initrd_size = phdr[index].p_filesz;
|
||||
index++;
|
||||
}
|
||||
|
||||
|
||||
/* Set the start location */
|
||||
params->entry = kinfo.entry;
|
||||
params->switch_64 = kinfo.switch_64;
|
||||
|
@@ -1,25 +1,25 @@
|
||||
#ifndef _LINUX_UNIFORM_BOOT_H
|
||||
#define _LINUX_UNIFORM_BOOT_H
|
||||
|
||||
/* The uniform boot environment information is restricted to
|
||||
/* The uniform boot environment information is restricted to
|
||||
* hardware information. In particular for a simple enough machine
|
||||
* all of the environment information should be able to reside in
|
||||
* a rom and not need to be moved. This information is the
|
||||
* information a trivial boot room can pass to linux to let it
|
||||
* run the hardware.
|
||||
* run the hardware.
|
||||
*
|
||||
* Also all of the information should be Position Independent Data.
|
||||
* Also all of the information should be Position Independent Data.
|
||||
* That is it should be safe to relocated any of the information
|
||||
* without it's meaning/correctnes changing. The exception is the
|
||||
* uniform_boot_header with it's two pointers arg & env.
|
||||
*
|
||||
*
|
||||
* The addresses in the arg & env pointers must be physical
|
||||
* addresses. A physical address is an address you put in the page
|
||||
* table.
|
||||
* table.
|
||||
*
|
||||
* The Command line is for user policy. Things like the default
|
||||
* root device.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
struct uniform_boot_header
|
||||
@@ -55,7 +55,7 @@ struct ube_memory_range {
|
||||
#define UBE_MEM_RESERVED 2
|
||||
#define UBE_MEM_ACPI 3
|
||||
#define UBE_MEM_NVS 4
|
||||
|
||||
|
||||
};
|
||||
|
||||
struct ube_memory {
|
||||
|
@@ -18,9 +18,9 @@ struct e820entry {
|
||||
} __attribute__((packed));
|
||||
|
||||
/* FIXME expand on drive_info_struct... */
|
||||
struct drive_info_struct {
|
||||
uint8_t dummy[32];
|
||||
};
|
||||
struct drive_info_struct {
|
||||
uint8_t dummy[32];
|
||||
};
|
||||
struct sys_desc_table {
|
||||
uint16_t length;
|
||||
uint8_t table[318];
|
||||
@@ -90,7 +90,7 @@ struct x86_linux_param_header {
|
||||
uint16_t ramdisk_flags; /* 0x1f8 */
|
||||
#define RAMDISK_IMAGE_START_MASK 0x07FF
|
||||
#define RAMDISK_PROMPT_FLAG 0x8000
|
||||
#define RAMDISK_LOAD_FLAG 0x4000
|
||||
#define RAMDISK_LOAD_FLAG 0x4000
|
||||
uint16_t vid_mode; /* 0x1fa */
|
||||
uint16_t root_dev; /* 0x1fc */
|
||||
uint8_t reserved9[1]; /* 0x1fe */
|
||||
|
@@ -58,7 +58,7 @@ static void printf(const char *fmt, ...)
|
||||
continue;
|
||||
}
|
||||
if (*++fmt == 's') {
|
||||
for(p = va_arg(args, char *); *p != '\0'; p++)
|
||||
for(p = va_arg(args, char *); *p != '\0'; p++)
|
||||
putchar(*p);
|
||||
}
|
||||
else { /* Length of item is bounded */
|
||||
@@ -76,7 +76,7 @@ static void printf(const char *fmt, ...)
|
||||
fmt++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Before each format q points to tmp buffer
|
||||
* After each format q points past end of item
|
||||
@@ -150,7 +150,7 @@ int memcmp(void *vs1, void *vs2, size_t size)
|
||||
return *s1 - *s2;
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void strappend(char *dest, const char *src, size_t max)
|
||||
@@ -229,7 +229,7 @@ static void convert_bhdr_params(Elf_Bhdr *bhdr)
|
||||
{
|
||||
unsigned char *note, *end;
|
||||
char *ldr_name, *ldr_version, *firmware;
|
||||
|
||||
|
||||
ldr_name = ldr_version = firmware = 0;
|
||||
|
||||
note = ((char *)bhdr) + sizeof(*bhdr);
|
||||
@@ -241,10 +241,10 @@ static void convert_bhdr_params(Elf_Bhdr *bhdr)
|
||||
n_name = note + sizeof(*hdr);
|
||||
n_desc = n_name + ((hdr->n_namesz + 3) & ~3);
|
||||
next = n_desc + ((hdr->n_descsz + 3) & ~3);
|
||||
if (next > end)
|
||||
if (next > end)
|
||||
break;
|
||||
#if 0
|
||||
printf("n_type: %x n_name(%d): n_desc(%d): \n",
|
||||
printf("n_type: %x n_name(%d): n_desc(%d): \n",
|
||||
hdr->n_type, hdr->n_namesz, hdr->n_descsz);
|
||||
#endif
|
||||
|
||||
@@ -302,7 +302,7 @@ static void convert_bhdr_params(Elf_Bhdr *bhdr)
|
||||
note = next;
|
||||
}
|
||||
if (ldr_name && ldr_version) {
|
||||
printf("Loader: %s version: %s\n",
|
||||
printf("Loader: %s version: %s\n",
|
||||
ldr_name, ldr_version);
|
||||
}
|
||||
if (firmware) {
|
||||
@@ -311,12 +311,12 @@ static void convert_bhdr_params(Elf_Bhdr *bhdr)
|
||||
}
|
||||
}
|
||||
|
||||
void *convert_params(unsigned long arg1, unsigned long r28,
|
||||
void *convert_params(unsigned long arg1, unsigned long r28,
|
||||
struct image_parameters *params)
|
||||
{
|
||||
struct ia64_boot_param *orig_bp;
|
||||
Elf_Bhdr *bhdr = (Elf_Bhdr*)arg1;
|
||||
|
||||
|
||||
/* handle the options I can easily deal with */
|
||||
bp.command_line = (unsigned long)¶ms->cmdline;
|
||||
bp.initrd_start = params->initrd_start;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#define ASSEMBLY 1
|
||||
|
||||
|
||||
.text
|
||||
|
||||
#include "convert.h"
|
||||
@@ -13,13 +13,13 @@ _start:
|
||||
movl r15=@gprel(_start)
|
||||
;;
|
||||
sub gp=r14,r15 /* gp = _start - @gprel(_start), current value of gp */
|
||||
;;
|
||||
;;
|
||||
mov out0=in0
|
||||
mov out1=r28
|
||||
add out2=@gprel(params),gp
|
||||
br.call.sptk.few rp=convert_params
|
||||
|
||||
|
||||
|
||||
mov r28=r8
|
||||
add r15=@gprel(entry), gp
|
||||
;;
|
||||
@@ -50,7 +50,7 @@ _start:
|
||||
#define UART_FCR 0x02
|
||||
#define UART_LCR 0x03
|
||||
#define UART_MCR 0x04
|
||||
|
||||
|
||||
#define UART_DLL 0x00
|
||||
#define UART_DLM 0x01
|
||||
/* Status */
|
||||
@@ -75,38 +75,38 @@ uart_init:
|
||||
/* set the UART_BASE */
|
||||
movl r31=UART_PHYS_BASE
|
||||
;;
|
||||
|
||||
|
||||
/* disable interrupts */
|
||||
add r30=UART_IER,r31
|
||||
mov r29=0x00
|
||||
;;
|
||||
;;
|
||||
st1 [r30]=r29
|
||||
|
||||
/* enable fifos */
|
||||
add r30=UART_FCR,r31
|
||||
mov r29=0x01
|
||||
;;
|
||||
;;
|
||||
st1 [r30]=r29
|
||||
|
||||
/* Set Baud Rate Divisor to UART_BAUD */
|
||||
add r30=UART_LCR,r31
|
||||
mov r29=0x83
|
||||
;;
|
||||
;;
|
||||
st1 [r30]=r29
|
||||
|
||||
add r30=UART_DLL,r31
|
||||
mov r29=UART_DIV_LO
|
||||
;;
|
||||
;;
|
||||
st1 [r30]=r29
|
||||
|
||||
|
||||
add r30=UART_DLM,r31
|
||||
mov r29=UART_DIV_HI
|
||||
;;
|
||||
;;
|
||||
st1 [r30]=r29
|
||||
|
||||
add r30=UART_LCR,r31
|
||||
mov r29=0x03
|
||||
;;
|
||||
;;
|
||||
st1 [r30]=r29
|
||||
|
||||
br.ret.sptk.few rp
|
||||
@@ -133,7 +133,7 @@ __uart_tx_byte:
|
||||
;;
|
||||
st1.rel.nta [r30]=r32
|
||||
;;
|
||||
|
||||
|
||||
/* Wait until the UART is empty to be certain the byte is flushed */
|
||||
add r30=UART_LSR,r31
|
||||
;;
|
||||
@@ -153,7 +153,7 @@ __uart_tx_hex_char:
|
||||
(p63) add r32=48,r32 /* digits*/
|
||||
(p62) add r32=55,r32 /* letters */
|
||||
br.cond.sptk.few __uart_tx_byte
|
||||
|
||||
|
||||
uart_tx_hex64:
|
||||
/* set the UART_bASE */
|
||||
movl r31=UART_PHYS_BASE
|
||||
@@ -212,7 +212,7 @@ uart_tx_hex64:
|
||||
;;
|
||||
mov ar.pfs = r26
|
||||
mov rp = r27
|
||||
;;
|
||||
;;
|
||||
br.ret.sptk.few rp
|
||||
#endif
|
||||
|
||||
|
@@ -112,8 +112,8 @@ static int populate_kernel_phdrs(struct kernel_info *info, struct memelfphdr *ph
|
||||
if (paddr > le64_to_cpu(info->phdr[j].p_paddr)) {
|
||||
continue;
|
||||
}
|
||||
if (hdr &&
|
||||
le64_to_cpu(hdr->p_paddr) <
|
||||
if (hdr &&
|
||||
le64_to_cpu(hdr->p_paddr) <
|
||||
le64_to_cpu(info->phdr[j].p_paddr)) {
|
||||
continue;
|
||||
}
|
||||
@@ -131,7 +131,7 @@ static int populate_kernel_phdrs(struct kernel_info *info, struct memelfphdr *ph
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void linux_ia64_usage(void)
|
||||
{
|
||||
@@ -192,7 +192,7 @@ int linux_ia64_mkelf(int argc, char **argv,
|
||||
ehdr->ei_data = ELFDATA2LSB;
|
||||
ehdr->e_type = ET_EXEC;
|
||||
ehdr->e_machine = EM_IA_64;
|
||||
|
||||
|
||||
/* locate the payload buffer */
|
||||
payload_buf = payload;
|
||||
payload_size = sizeof(payload);
|
||||
@@ -221,10 +221,10 @@ int linux_ia64_mkelf(int argc, char **argv,
|
||||
|
||||
/* Fill in the program headers*/
|
||||
phdr[0].p_type = PT_NOTE;
|
||||
|
||||
|
||||
/* Fill in the kernel program headers */
|
||||
index = 1 + populate_kernel_phdrs(&kinfo, phdr + 1);
|
||||
|
||||
index = 1 + populate_kernel_phdrs(&kinfo, phdr + 1);
|
||||
|
||||
/* Fill in the converter program header */
|
||||
phdr[index].p_paddr = roundup(phdr[index -1].p_paddr + phdr[index -1].p_memsz, 16);
|
||||
phdr[index].p_vaddr = phdr[index].p_paddr;
|
||||
|
@@ -71,7 +71,7 @@ uint16_t add_ipchksums(unsigned long offset, uint16_t sum, uint16_t new)
|
||||
sum = ~sum & 0xFFFF;
|
||||
new = ~new & 0xFFFF;
|
||||
if (offset & 1) {
|
||||
/* byte swap the sum if it came from an odd offset
|
||||
/* byte swap the sum if it came from an odd offset
|
||||
* since the computation is endian independant this
|
||||
* works.
|
||||
*/
|
||||
@@ -114,7 +114,7 @@ char *slurp_file(const char *filename, off_t *r_size)
|
||||
off_t size, progress;
|
||||
ssize_t result;
|
||||
struct stat stats;
|
||||
|
||||
|
||||
|
||||
if (!filename) {
|
||||
*r_size = 0;
|
||||
@@ -305,7 +305,7 @@ static void serialize_notes(char *buf, struct memelfheader *ehdr)
|
||||
notes = ehdr->e_notenum;
|
||||
size = sizeof_notes(note, notes);
|
||||
memset(buf, 0, size);
|
||||
|
||||
|
||||
/* Write the Elf Notes */
|
||||
offset = 0;
|
||||
for(i = 0; i < notes; i++) {
|
||||
@@ -317,11 +317,11 @@ static void serialize_notes(char *buf, struct memelfheader *ehdr)
|
||||
hdr.n_type = cpu_to_elf32(ehdr, note[i].n_type);
|
||||
|
||||
/* Copy the note into the buffer */
|
||||
memcpy(buf + offset, &hdr, sizeof(hdr));
|
||||
memcpy(buf + offset, &hdr, sizeof(hdr));
|
||||
offset += sizeof(hdr);
|
||||
memcpy(buf + offset, note[i].n_name, n_namesz);
|
||||
memcpy(buf + offset, note[i].n_name, n_namesz);
|
||||
offset += roundup(n_namesz, 4);
|
||||
memcpy(buf + offset, note[i].n_desc, note[i].n_descsz);
|
||||
memcpy(buf + offset, note[i].n_desc, note[i].n_descsz);
|
||||
offset += roundup(note[i].n_descsz, 4);
|
||||
|
||||
}
|
||||
@@ -382,7 +382,7 @@ static void serialize_phdrs(char *buf, struct memelfheader *ehdr, size_t note_si
|
||||
size_t offset, note_offset;
|
||||
if (ehdr->ei_class == ELFCLASS32) {
|
||||
Elf32_Phdr *phdr = (Elf32_Phdr *)buf;
|
||||
note_offset =
|
||||
note_offset =
|
||||
sizeof(Elf32_Ehdr) + (sizeof(Elf32_Phdr)*ehdr->e_phnum);
|
||||
offset = note_offset + note_size;
|
||||
for(i = 0; i < ehdr->e_phnum; i++) {
|
||||
@@ -406,7 +406,7 @@ static void serialize_phdrs(char *buf, struct memelfheader *ehdr, size_t note_si
|
||||
}
|
||||
else if (ehdr->ei_class == ELFCLASS64) {
|
||||
Elf64_Phdr *phdr = (Elf64_Phdr *)buf;
|
||||
note_offset =
|
||||
note_offset =
|
||||
sizeof(Elf64_Ehdr) + (sizeof(Elf64_Phdr)*ehdr->e_phnum);
|
||||
offset = note_offset + note_size;
|
||||
for(i = 0; i < ehdr->e_phnum; i++) {
|
||||
@@ -478,7 +478,7 @@ static void write_elf(struct memelfheader *ehdr, char *output)
|
||||
if (ehdr->ei_class == ELFCLASS32) {
|
||||
ehdr_size = sizeof(Elf32_Ehdr);
|
||||
phdr_size = sizeof(Elf32_Phdr) * ehdr->e_phnum;
|
||||
}
|
||||
}
|
||||
else if (ehdr->ei_class == ELFCLASS64) {
|
||||
ehdr_size = sizeof(Elf64_Ehdr);
|
||||
phdr_size = sizeof(Elf64_Phdr) * ehdr->e_phnum;
|
||||
@@ -505,7 +505,7 @@ static void write_elf(struct memelfheader *ehdr, char *output)
|
||||
|
||||
/* Compute the final form of the notes */
|
||||
serialize_notes(buf + ehdr_size + phdr_size, ehdr);
|
||||
|
||||
|
||||
/* Now write the elf image */
|
||||
fd = open(output, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IRGRP | S_IROTH);
|
||||
if (fd < 0) {
|
||||
@@ -612,7 +612,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
fileind = optind;
|
||||
|
||||
|
||||
/* Reset getopt for the next pass */
|
||||
opterr = 1;
|
||||
optind = 1;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
.\" Automatically generated by Pod::Man v1.3, Pod::Parser v1.13
|
||||
.\" But now manually maintained
|
||||
.\" But now manually maintained
|
||||
.\"
|
||||
.\" Standard preamble:
|
||||
.\" ========================================================================
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user