iso9660: Add support for Rock Ridge filenames

Add support for parsing SUSP and RRIP records, and support for Rock
Ridge filename extensions, thus avoiding the filename limitations
(length and character set) of plain iso9660.  This will be a part of
using UTF-8 for filenames and console.

[ hpa: manually rebased to the elflink branch ]
iso9660: Avoid arbitrarily large malloc()s

After explaining the slightly wasteful usage of malloc()/memcpy()
with multi-block CE entries, i noticed that i did not install a
safety cap on the malloc size.

I could not challenge this in practice but only by gdb manipulation.
My most CE-happy test image has 3 occasions of multi-block CE.
All three only span over 2 blocks each.
iso9660: read littleendian ISO 9660/SUSP numbers

Attached is a patch which switches susp_rr.c from reading the
big-endian ISO 9660 and SUSP numbers to reading the little-endian
ones.

Tested within libisofs on my collection of ISO images.

[ hpa: more mastering programs are known which botch the bigendian
  information than the littleendian information, so most systems only
  read the littleendian info regardless of the native byte order. ]
Generic facilities for byteswapping and unaligned references

For future portability, add functions to access both littleendian and
bigendian numbers, and to perform unaligned memory references.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
iso9660: use generic get_le32() accessor in SUSP/Rock Ridge code

Use the new get_le32() accessor in the SUSP/Rock Ridge code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Thomas Schmitt <scdbackup@gmx.net>
iso9660.c did not copy terminating 0 of Rock Ridge name

I noticed that the trailing 0-byte is not copied to the result of
iso_readdir(). The function iso_convert_name() does append a trailing 0.
Merge remote-tracking branch 'origin/rockridge'

Resolved Conflicts:
	com32/include/byteswap.h

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
efi: Suspicious size reduction in emalloc

It could happen on 32 bits architecture that the memory size really allocated
could be less than required. On 64 bits, allocate_pages may be called
more times than needed.

This closes bug #39.

Signed-off-by: Sylvain Gault <sylvain.gault@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
pxe: Export the initial stack and PXE(NV) structure, fix pxechn

Export the initial stack and PXE(NV) structure pointers properly, even
for users which need seg:offs.  Use this in pxechn.c rather than the
already-removed INT 22h AX=000Ah call.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: Gene Cumm <gene.cumm@gmail.com>
bios: Remove comapi calls related to the ADV

The only comapi calls left are the ones related to the ADV and to
shuffle and boot.  Remove the ADV-related ones as part of getting rid
of the comapi framework completely.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
bios: Remove shuffle and boot comapi call

Remove the shuffle and boot comapi call.  This is the last of the
comapi calls left; we should now be able to completely remove the
comapi support.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
comapi: Remove the comapi interfaces completely

Remove the last bits of the comapi interfaces completely.  This does
not install stub handlers for the INT 20-3Fh handlers, as we don't
support loading old COMBOOT/COM32/COM32R images anymore.

We could put those back if we really need them.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>