Commit Graph

13 Commits

Author SHA1 Message Date
Hung-Te Lin d51557ade2 lib: Prevent unaligned memory access and fix endianess in LZMA decode library.
LZMA decode library used to retrieve output size by:
  outSize = *(UInt32 *)(src + LZMA_PROPERTIES_SIZE);

'src' is aligned but LZMA_PROPERTIES_SIZE may refer to an unaligned address like
src+5, and using that as integer pointer may fail on platforms like ARM. Also
this will fail on systems using big-endian (outSize was encoded in
little-endian).

To fix this, reconstruct outSize in little-endian way.

Change-Id: If678e735cb270c3e5e29f36f1fad318096bf7d59
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: http://review.coreboot.org/2246
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2013-02-01 06:15:49 +01:00
Ronald G. Minnich 3a8cad3c14 Shrink the stack sizes we need in coreboot
We accomplish this goal by getting rid of the huge auto array in the
ram stage. This will in turn let us reduce CONFIG_STACK_SIZE.

We have to leave it on the stack in CAR as that's the simple way to
keep it private. It does not matter then as there is only one core
that is active.

Change-Id: Ie37a057ccae088b7f3bb4aab6de2713e64d96df6
Signed-off-by: Ronald G. Minnich <rminnich@chromium.org>
Reviewed-on: http://review.coreboot.org/1271
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2012-07-24 19:52:53 +02:00
Stefan Reinauer d6b4f1cd0a Fix some wrong capitalizations, reformat comments, fix a typo.
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5829 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
2010-09-23 18:29:40 +00:00
Stefan Reinauer 14e2277962 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
2010-04-27 06:56:47 +00:00
Stefan Reinauer c02b4fc9db printk_foo -> printk(BIOS_FOO, ...)
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5266 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
2010-03-22 11:42:32 +00:00
Myles Watson 581707811c Create lib.h for homeless prototypes.
Signed-off-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4878 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
2009-10-28 16:13:28 +00:00
Maciej Pijanka ea92185755 Add few missing prototypes, and remove few unused (thus lonelly) variables.
TODO
 - x86emu need (imo) some common header with prototypes at least
 - clog2, ulzma, hardwaremain prototypes added by this patch probably should 
   be moved to some header too.
 - in src/devices/device_util.c prototype is before function because seems, 
   it is used only within same file, if not it should be moved to debug
   section of prototypes in include/device/device.h

Signed-off-by: Maciej Pijanka <maciej.pijanka@gmail.com>
Acked-by: Myles Watson <mylesgw@gmail.com>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4871 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
2009-10-27 14:29:29 +00:00
Stefan Reinauer 0a181fd642 improve lzma error messages. When coreboot panics because lzma decompression
goes wrong, it might not be clear that it's lzma that failed, if the log level
is low enough..

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



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4676 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
2009-09-25 21:57:25 +00:00
Patrick Georgi 7994164a0e Remove the inclusion of lzma.c (which really contains code)
from another (rom_stream.c and others), instead linking it like any
source file should be linked.

The same should (and will) be done with nrv2b.c, but that has some
deeper implications as various CAR implementations include that
directly, and thus requires more care.

It fixes an issue with the cbfs code.

Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4206 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
2009-04-24 16:44:34 +00:00
Ward Vandewege ec2bd53c37 If you have
option CONFIG_COMPRESSED_PAYLOAD_LZMA=1
  option CONFIG_PRECOMPRESSED_PAYLOAD=1

set in Config.lb but accidentally use an uncompressed payload, coreboot (v2)
bombs out like this:

  elfboot: Attempting to load payload.
  rom_stream: 0xfffc0000 - 0xfffdefff
  Uncompressing to RAM 0x01000000 Decoder scratchpad too small!
  Decoding error = 1
  Unexpected Exception: 6 @ 10:04000408 - Halting
  Code: 0 eflags: 00010057
  eax: 00000101 ebx: 04000400 ecx: 000003d4 edx: fffc0000
  edi: 04000400 esi: 04000401 ebp: 04000400 esp: 0013dfb4

The attached patch modifies v2's lzma code so that it assumes an uncompressed
payload if it fails to find a properly compressed payload.

Compare with the fatal error above:

  elfboot: Attempting to load payload.
  rom_stream: 0xfffc0000 - 0xfffdefff
  Uncompressing to RAM 0x01000000 Decoder scratchpad too small!
   olen = 0x00000000 done.
  Decompression failed. Assuming payload is uncompressed...
  Found ELF candidate at offset 0
  header_offset is 0
  Try to load at offset 0x0

If you don't have CONFIG_COMPRESSED_PAYLOAD_LZMA and
CONFIG_PRECOMPRESSED_PAYLOAD set and use an uncompressed payload, things are as
before:

  elfboot: Attempting to load payload.
  rom_stream: 0xfffc0000 - 0xfffdefff
  Found ELF candidate at offset 0
  header_offset is 0
  Try to load at offset 0x0

One can argue that this is a case of 'builder beware', but my counter argument
is that anything that causes unexpected runtime breakage is really, really,
really bad, and should be avoided where possible.

This patch also fixes one erroneous comment.

Signed-off-by: Ward Vandewege <ward@gnu.org>
Acked-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3542 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
2008-08-27 21:53:11 +00:00
Carl-Daniel Hailfinger fa510c7878 Clarify LZMA code license.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3161 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
2008-03-17 01:37:27 +00:00
Stefan Reinauer f8ee1806ac Rename almost all occurences of LinuxBIOS to coreboot.
Due to the automatic nature of this update, I am self-acking. It worked in
abuild.

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



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3053 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
2008-01-18 15:08:58 +00:00
Carl-Daniel Hailfinger cba07dd682 additions and mods for lzma.
Signed-off-by: Carl-Daniel Hailfinger
Signed-off-by: Ronald G. Minnich


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2413 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
2006-09-14 15:12:36 +00:00