profile/ivi/syslinux.git
15 years agoMerge branch 'master' into core32
H. Peter Anvin [Tue, 26 May 2009 16:20:17 +0000 (09:20 -0700)]
Merge branch 'master' into core32

15 years agoMerge branch 'for-3.81'
H. Peter Anvin [Tue, 26 May 2009 16:20:05 +0000 (09:20 -0700)]
Merge branch 'for-3.81'

15 years agoisohdpfx: don't clear %ds before parsing partiting info syslinux-3.81-pre15
H. Peter Anvin [Tue, 26 May 2009 16:14:41 +0000 (09:14 -0700)]
isohdpfx: don't clear %ds before parsing partiting info

The partition information is pointed to by ds:si; although ds
will *usually* be 0 it isn't guaranteed (in particular, it may
very well be 0x40 or 0x60); therefore, move the partition parsing
up before the reset of %ds and %es.  As a side benefit, we get
to use push again...

Also, fix the ordering of the two halves of the GPT LBA!

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agodos: uninline far data accessor functions
H. Peter Anvin [Tue, 26 May 2009 06:20:06 +0000 (23:20 -0700)]
dos: uninline far data accessor functions

Forcibly uninline the far data accessor functions.  This significantly
reduces the size of the code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agorelocs: handle R_386_NONE; better error messages
H. Peter Anvin [Tue, 26 May 2009 05:48:57 +0000 (22:48 -0700)]
relocs: handle R_386_NONE; better error messages

Handle R_386_NONE, which apparently can end up being generated by
binutils in certain circumstances involving sections being removed
completely.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMerge branch 'master' into core32
H. Peter Anvin [Tue, 26 May 2009 04:51:23 +0000 (21:51 -0700)]
Merge branch 'master' into core32

15 years agodoc: add the Linux kernel coding style document
H. Peter Anvin [Tue, 26 May 2009 04:45:53 +0000 (21:45 -0700)]
doc: add the Linux kernel coding style document

We expect to use Linux kernel coding style, minus the indentation
level.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoNindent: indent script from the NASM project
H. Peter Anvin [Tue, 26 May 2009 04:41:43 +0000 (21:41 -0700)]
Nindent: indent script from the NASM project

Add an indentation script from the NASM project.  This is expected to
be the Syslinux coding style for the future.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMerge branch 'master' into core32
H. Peter Anvin [Tue, 26 May 2009 04:05:21 +0000 (21:05 -0700)]
Merge branch 'master' into core32

15 years agoisohybrid: we are backwards compatible again, change the error msg
H. Peter Anvin [Tue, 26 May 2009 04:04:09 +0000 (21:04 -0700)]
isohybrid: we are backwards compatible again, change the error msg

We are backwards compatible again, at least as long as -partok is not
used.  However, there is no minor version number, so we can't check
for that at this time.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMerge branch 'master' into core32
H. Peter Anvin [Tue, 26 May 2009 02:16:55 +0000 (19:16 -0700)]
Merge branch 'master' into core32

15 years agoaltmbr: cap at 439 bytes so the partition select byte follows
H. Peter Anvin [Tue, 26 May 2009 02:13:04 +0000 (19:13 -0700)]
altmbr: cap at 439 bytes so the partition select byte follows

Cap altmbr at 439 bytes, so that the partition select byte is not part
of the file.  This means that:

a) updating the altmbr doesn't clobber the configuration;
b) it is easier to simply concatenate the select byte to the file.

This also matches gptmbr behavior.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agodos installer: reuse ldlinux_seg
H. Peter Anvin [Tue, 26 May 2009 01:31:13 +0000 (18:31 -0700)]
dos installer: reuse ldlinux_seg

Make ldlinux_seg a global variable, and use it in syslxmod.c.  This
reduces the size of syslxmod.o fairly significantly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMerge branch 'master' into core32
H. Peter Anvin [Tue, 26 May 2009 01:14:06 +0000 (18:14 -0700)]
Merge branch 'master' into core32

15 years agoisohybrid: revert to a stack format compatible with previous version syslinux-3.81-pre14
H. Peter Anvin [Tue, 26 May 2009 00:48:58 +0000 (17:48 -0700)]
isohybrid: revert to a stack format compatible with previous version

Revert the isohybrid handover protocol so that it has a stack format
compatible with the previous versions; that way we can also revert the
magic number to a compatible one.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMerge branch 'master' into core32
H. Peter Anvin [Mon, 25 May 2009 22:50:12 +0000 (15:50 -0700)]
Merge branch 'master' into core32

Conflicts:
com32/MCONFIG

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocom32: add dependency on com32.ld -> *.elf syslinux-3.81-pre13
H. Peter Anvin [Mon, 25 May 2009 22:43:10 +0000 (15:43 -0700)]
com32: add dependency on com32.ld -> *.elf

All the *.elf files depend on com32.ld, so make that explicit.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoNEWS: document altmbr fix
H. Peter Anvin [Mon, 25 May 2009 22:42:57 +0000 (15:42 -0700)]
NEWS: document altmbr fix

15 years agoaltmbr: fix accounting of logical partitions
H. Peter Anvin [Mon, 25 May 2009 22:37:28 +0000 (15:37 -0700)]
altmbr: fix accounting of logical partitions

Unlike the main MBR, we need to keep careful count when we process
logical partitions... and we weren't.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocom32r: verify the COM32R magic number
H. Peter Anvin [Mon, 25 May 2009 21:56:11 +0000 (14:56 -0700)]
com32r: verify the COM32R magic number

Since we might be having COM32 and COM32R in the same filesystem, do
check for the appropriate COM32R magic before doing anything else.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocom32r: allow absolute and relative symbols based on regex
H. Peter Anvin [Mon, 25 May 2009 17:33:12 +0000 (10:33 -0700)]
com32r: allow absolute and relative symbols based on regex

Allow relocs.c to sort linker-assigned absolute symbols into true
absolute and relative symbols based on regular expressions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agogitignore: add *.raw
H. Peter Anvin [Mon, 25 May 2009 05:01:31 +0000 (22:01 -0700)]
gitignore: add *.raw

*.raw files are generated; ignore them.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: remove *.raw files when cleaning up
H. Peter Anvin [Mon, 25 May 2009 05:00:51 +0000 (22:00 -0700)]
core: remove *.raw files when cleaning up

*.raw files are intermediate between .elf and .bin, remove on cleanup.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocom32r: properly pass the command line string to __parse_argv
H. Peter Anvin [Mon, 25 May 2009 04:10:32 +0000 (21:10 -0700)]
com32r: properly pass the command line string to __parse_argv

Fix incorrect passing of the command line string to __parse_argv; what
was an leal should have been movl.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoAlign free_high_memory to a 64K boundary
H. Peter Anvin [Mon, 25 May 2009 03:54:26 +0000 (20:54 -0700)]
Align free_high_memory to a 64K boundary

There might be some minor performance gains from aligning
free_high_memory to a 64K boundary... so we might as well do so.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoAdd missing com32/tools/Makefile
H. Peter Anvin [Mon, 25 May 2009 03:51:15 +0000 (20:51 -0700)]
Add missing com32/tools/Makefile

Add missing file com32/tools/Makefile from earlier checkins.  I really
need to pay better attention here...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoAvoid clobbering PM code when loading the kernel
H. Peter Anvin [Mon, 25 May 2009 02:18:02 +0000 (19:18 -0700)]
Avoid clobbering PM code when loading the kernel

We can't safely use 1 MB to directly load the kernel, so shift the
kernel just as we do when loading low.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: load the PM code at 1 MB, COM32R code follows
H. Peter Anvin [Mon, 25 May 2009 02:09:32 +0000 (19:09 -0700)]
core: load the PM code at 1 MB, COM32R code follows

Load our own (core) PM code at 1 MB; when loading a COM32R module let
it follow our own PM code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoDocument the COM32R format
H. Peter Anvin [Mon, 25 May 2009 02:04:14 +0000 (19:04 -0700)]
Document the COM32R format

15 years agocom32: make com32 modules self-relocating (COM32R)
H. Peter Anvin [Mon, 25 May 2009 02:01:02 +0000 (19:01 -0700)]
com32: make com32 modules self-relocating (COM32R)

Introduce a new "COM32R" format, which is exactly like COM32 except
that they contain position-independent code.  Therefore, the core can
load them at any sufficiently aligned address; by protocol select 4K
as the alignment.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoisolinux: handle a core file greater than 64K
H. Peter Anvin [Sun, 24 May 2009 20:06:33 +0000 (13:06 -0700)]
isolinux: handle a core file greater than 64K

Handle a core file greater than 64K, and handle the case of a BIOS
which can't handle 64K wraparounds.  The latter is messy with CD-ROMs,
since the standard load address (0x7c00) is not 2K aligned.  We will
have to do something similar for disk-based derivatives when dealing
with 4K sector drives.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoprepcore: fix ISOLINUX padding, cleanups
H. Peter Anvin [Sun, 24 May 2009 04:39:53 +0000 (21:39 -0700)]
prepcore: fix ISOLINUX padding, cleanups

Fix the calculation of the ISOLINUX padding size.  Add stylistic
cleanups and remove code that we don't care about (e.g. LZO1Y).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: make decompression of the PM code actually work
H. Peter Anvin [Sun, 24 May 2009 04:38:51 +0000 (21:38 -0700)]
core: make decompression of the PM code actually work

We would correctly decompress the PM code, and then reject it because
of an incorrect length comparison.  Fix.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: fix mismerges with the master branch
H. Peter Anvin [Sun, 24 May 2009 04:13:11 +0000 (21:13 -0700)]
core: fix mismerges with the master branch

Fix a couple of minor issues caused by mismerge with the master
branch.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMerge branch 'master' into core32
H. Peter Anvin [Sun, 24 May 2009 02:44:46 +0000 (19:44 -0700)]
Merge branch 'master' into core32

Conflicts:
core/bcopy32.inc
core/cleanup.inc
core/conio.inc

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoDon't set the autocr flag on the serial console; clean up crap syslinux-3.81-pre12
H. Peter Anvin [Sun, 24 May 2009 02:33:36 +0000 (19:33 -0700)]
Don't set the autocr flag on the serial console; clean up crap

libutil would set the autocr flag on the serial console, which really
never was any point -- we already do \n -> \r\n conversion explicitly
in the serial code.  This was always very annoying to deal with if the
menu was interrupted.

Furthermore, drop completely unnecessary
initialization/deinitialization routines that completely duplicated
other code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: don't flush the serial port queue for a serial command
H. Peter Anvin [Sun, 24 May 2009 02:20:01 +0000 (19:20 -0700)]
core: don't flush the serial port queue for a serial command

Don't flush the serial port queue when encountering a "serial"
command.  We don't actually want to lose data due to a repeated
"serial", since it's quite likely it's exactly the same as before.

Do flush the queue on hardware cleanup, however.

Also fix some minor bugs, including a bunch of code in the .data
segment.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: add file missing from previous checkin (serirq.inc) syslinux-3.81-pre11
H. Peter Anvin [Sun, 24 May 2009 00:40:17 +0000 (17:40 -0700)]
core: add file missing from previous checkin (serirq.inc)

Add the file serirq.inc missing from previous checkin.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: remove obsolete comment
H. Peter Anvin [Sun, 24 May 2009 00:39:12 +0000 (17:39 -0700)]
core: remove obsolete comment

Remove comment about flipping A20 for each 64K block copied.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: add a proper interrupt handler for the serial console
H. Peter Anvin [Sun, 24 May 2009 00:37:18 +0000 (17:37 -0700)]
core: add a proper interrupt handler for the serial console

If we enable interrupts for the serial console, add a proper interrupt
handler.  Since we don't know what vector we'll end up using, or if we
are shared with other devices, simply hook *all* the interrupts and
poll the serial port then.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMerge branch 'master' into core32
H. Peter Anvin [Thu, 21 May 2009 23:17:52 +0000 (16:17 -0700)]
Merge branch 'master' into core32

Conflicts:
core/idle.inc

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoidle: set NoHalt back to 0 as it should be syslinux-3.81-pre10
H. Peter Anvin [Thu, 21 May 2009 23:15:42 +0000 (16:15 -0700)]
idle: set NoHalt back to 0 as it should be

NoHalt was set to 1 temporarily for debugging; return it to 0.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoisohybrid: add missing isohdppx.S file
H. Peter Anvin [Thu, 21 May 2009 23:07:44 +0000 (16:07 -0700)]
isohybrid: add missing isohdppx.S file

Add a file missing from previous checkin
e462c28ffaca0132c1761736bc93cb06a41dc7a6.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoDrop support for ACPI 3 E820 extended memory attributes
H. Peter Anvin [Thu, 21 May 2009 23:03:15 +0000 (16:03 -0700)]
Drop support for ACPI 3 E820 extended memory attributes

Drop all support for ACPI 3 E820 extended memory attributes.  There
are BIOSes in the field that report completely bogus information here,
resulting in no memory at all being detected (we then fall back to
E801 detection, but that is problematic in its own ways.)

There is strong reasons to believe at this point that the extended
memory attributes are not usable in their current form, so drop them
and revert back to simple 20-byte support, including for MEMDISK
spoofing.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoNEWS: update isohybrid changes
H. Peter Anvin [Thu, 21 May 2009 22:39:22 +0000 (15:39 -0700)]
NEWS: update isohybrid changes

15 years agoisohybrid: support booting from partition; fix CBIOS booting
H. Peter Anvin [Thu, 21 May 2009 22:36:50 +0000 (15:36 -0700)]
isohybrid: support booting from partition; fix CBIOS booting

Fix CBIOS in isohybrid mode.  Also allow an isohybrid image to be
booted from a partition.  Unfortunately this breaks compatibility
between differing versions of isohybrid and isolinux.bin.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoisohybrid: allow selecting the _c and _f versions of the prefix
H. Peter Anvin [Thu, 21 May 2009 20:34:12 +0000 (13:34 -0700)]
isohybrid: allow selecting the _c and _f versions of the prefix

Allow selecting the _f or _c versions of the prefix in addition to the
default one.  This is specified with the -forcehd0 or -ctrlhd0
options.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoidle: handle PXE stacks which improperly disable interrupts syslinux-3.81-pre9
H. Peter Anvin [Thu, 21 May 2009 17:25:43 +0000 (10:25 -0700)]
idle: handle PXE stacks which improperly disable interrupts

At least Etherboot (and all-but-super-recent versions of gPXE) PXE
ROMs improperly disable interrupts when calling an intercepted version
of INT 15h and 1Ah; this is due to the old trick of using "ret 2" to
return... this avoids resetting the flags for status, but it also
doesn't restore the value of the interrupt flag.  Needless to say,
this causes serious issues.

Work around it by adding explicit pushf/popf or STI in places known to
have issues, but also add an STI in reset_idle, and add an error alert
in do_idle if we ever get called with interrupts disabled.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agochain.c32: remove clobber of drivename/partition
H. Peter Anvin [Thu, 21 May 2009 14:22:53 +0000 (07:22 -0700)]
chain.c32: remove clobber of drivename/partition

Remove a clobber of drivename and partition, after we have spent time
computing what the should have been...

Reported-by: Luciano Miguel Ferreira Rocha <strange@nsk.no-ip.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoisohybrid: add options, change default ptype to 0x17 syslinux-3.81-pre8
H. Peter Anvin [Thu, 21 May 2009 02:06:42 +0000 (19:06 -0700)]
isohybrid: add options, change default ptype to 0x17

Add support for setting a variety of options in isohybrid.  Also
change the default partition type to 0x17, "Windows hidden IFS", as
that seems to make Windows less unhappy.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: drop double clearing of .uibss
H. Peter Anvin [Wed, 20 May 2009 23:09:05 +0000 (16:09 -0700)]
core: drop double clearing of .uibss

The .uibss and .auxseg are cleared together now, but .uibss was also
cleared separately.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMerge branch 'master' into core32
H. Peter Anvin [Wed, 20 May 2009 23:08:04 +0000 (16:08 -0700)]
Merge branch 'master' into core32

15 years agoNEWS: add note about linux.c32 having a quiet command
H. Peter Anvin [Wed, 20 May 2009 22:56:02 +0000 (15:56 -0700)]
NEWS: add note about linux.c32 having a quiet command

15 years agomeminfo: distinguish between no flags and flags=1 syslinux-3.81-pre7
H. Peter Anvin [Wed, 20 May 2009 22:49:36 +0000 (15:49 -0700)]
meminfo: distinguish between no flags and flags=1

For debugging reasons it's important to know if we have no flags at
all or if we get flags = 1.  Print [-] in the case of no flags at all.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: LZO compress the PM part of the core
H. Peter Anvin [Wed, 20 May 2009 09:15:01 +0000 (02:15 -0700)]
core: LZO compress the PM part of the core

Use LZO to compress the PM part of the core.  LZO is not the best
compression algorithm, but it is very fast, and the decompressor is
only 447 bytes long.  The LZO code is part of the LZO 2.03 library.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: fill unused space in .text with NOP not zero
H. Peter Anvin [Wed, 20 May 2009 04:44:29 +0000 (21:44 -0700)]
core: fill unused space in .text with NOP not zero

Fill unused space in the .text section with NOP, not with zero.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoupx: try --lzma first, since --ultra-brute doesn't... sigh
H. Peter Anvin [Wed, 20 May 2009 02:57:39 +0000 (19:57 -0700)]
upx: try --lzma first, since --ultra-brute doesn't... sigh

You'd think upx --ultra-brute would test everything that is possible,
but not so.  --lzma needs to be specified separately.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agodos: run UPX on the DOS installer binary if we have it
H. Peter Anvin [Wed, 20 May 2009 00:03:02 +0000 (17:03 -0700)]
dos: run UPX on the DOS installer binary if we have it

If UPX is installed on the host system, we might as well use it to
compress the DOS installer binary.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agodos: add a prototype for calloc()
H. Peter Anvin [Tue, 19 May 2009 23:50:30 +0000 (16:50 -0700)]
dos: add a prototype for calloc()

Add a prototype for calloc() to the DOS installer library.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoStandardize the names SECTOR_SIZE and SECTOR_SHIFT
H. Peter Anvin [Tue, 19 May 2009 23:48:19 +0000 (16:48 -0700)]
Standardize the names SECTOR_SIZE and SECTOR_SHIFT

Use the names SECTOR_SIZE and SECTOR_SHIFT everywhere, instead of an
odd mix of symbols and hard-coded constants.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoFAT: change DOS installer to EXE; additional 32K limit fixes
H. Peter Anvin [Tue, 19 May 2009 23:30:09 +0000 (16:30 -0700)]
FAT: change DOS installer to EXE; additional 32K limit fixes

Additional fixes for the 32K limits in the installers.  In the case
of the DOS installer, that means changing it from COM format to EXE
format (since COM format has a 63K hard limit); retain the name
syslinux.com for user compatibility, though (DOS doesn't care what the
extension except for pathname search; if it finds an MZ EXE header it
will use it.)

With the change to EXE means having to handle more than one segment.
Since we don't have a real DOS compiler we have to wing it a bit.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agolibinstaller: "nsect" is the size of ldlinux.sys, not the total
H. Peter Anvin [Tue, 19 May 2009 19:48:11 +0000 (12:48 -0700)]
libinstaller: "nsect" is the size of ldlinux.sys, not the total

"nsect" here is the size of ldlinux.sys, not the total structure;
therefore it should not be decremented.  Again, all this should really
be unified.

With this patch the FAT derivatives boot with the current code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agolibinstaller: fix definition of bsHeadLen
H. Peter Anvin [Tue, 19 May 2009 19:41:31 +0000 (12:41 -0700)]
libinstaller: fix definition of bsHeadLen

Correct the definition of bsHeadLen, the size of the region at the
start of the boot sector that should always be copied.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoFAT: update the FAT installers to match the new diskstart.inc
H. Peter Anvin [Tue, 19 May 2009 19:29:11 +0000 (12:29 -0700)]
FAT: update the FAT installers to match the new diskstart.inc

Update the FAT installers to match the new patch area format in
diskstart.inc.  Also, update the coding style to match extlinux; this
code should eventually get unified.

This does not resolve the current issues with the DOS installer when
ldlinux.sys exceeds about 48K, at which point the DOS installer needs
to become a segment-aware EXE program.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agopxelinux: revert to a separate stack implementation
H. Peter Anvin [Tue, 19 May 2009 01:34:55 +0000 (18:34 -0700)]
pxelinux: revert to a separate stack implementation

Return to using a private stack, except immediately around a pxenv
call.  The systems on which this broke has been lost in time, and with
more code in 32-bit space there is a risk of deeper stacks (due to
more mode-switch calls.)

It is still a single configuration variable to flip back to the
unified 16-bit stack, however.  If most of the code is in 32-bit mode
and there is small likelihood of several transitions, it might still
be the best option in the end.

Note: the PXE stack is 1.5K in size (and we must account for the
possibility of receiving an interrupt.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agopxelinux: set StackTop == StackBuf
H. Peter Anvin [Tue, 19 May 2009 01:24:34 +0000 (18:24 -0700)]
pxelinux: set StackTop == StackBuf

We need StackTop to be <= StackBuf since we use memory immediately
above StackBuf during replace_bootstrap.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: use reserved stack space only for replace_bootstrap
H. Peter Anvin [Tue, 19 May 2009 00:13:08 +0000 (17:13 -0700)]
core: use reserved stack space only for replace_bootstrap

When running replace_bootstrap, our regular stack is still live.
Therefore, (a) make sure we have 44 bytes reserved above the normal
stack, and (b) use those, i.e. StackBuf, not StackTop.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMerge branch 'master' into core32
H. Peter Anvin [Mon, 18 May 2009 23:35:49 +0000 (16:35 -0700)]
Merge branch 'master' into core32

15 years agoDon't run to comboot API with interrupts off syslinux-3.81-pre6
H. Peter Anvin [Mon, 18 May 2009 23:29:30 +0000 (16:29 -0700)]
Don't run to comboot API with interrupts off

We have historically run the comboot API with interrupts off due to
concerns about stack overflow.  However, this is a really bad idea: we
can easily spend a fair bit of time servicing one of these routines,
especially when doing things like waiting for I/O.

In particular, do_idle should *never* be run with interrupts disabled.

Switch to running with interrupts enabled everywhere unless we have
specific reasons not to do so.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMerge branch 'master' into core32
H. Peter Anvin [Mon, 18 May 2009 22:05:20 +0000 (15:05 -0700)]
Merge branch 'master' into core32

15 years agocore/conio.inc: when reading the serial port, drop read of IIR syslinux-3.81-pre5
H. Peter Anvin [Mon, 18 May 2009 21:57:37 +0000 (14:57 -0700)]
core/conio.inc: when reading the serial port, drop read of IIR

Drop the read of the IIR when reading the serial port.  First of all,
we weren't protecting AL so we clobbered the actual data; second of
all, this isn't actually necessary as reading RDR will clear the
interrupt condition per the UART spec.

It's worth noting that enabling interrupts here will do bad things if
the interrupts aren't edge-triggered (since we don't actually have an
interrupt routine to clear the interrupt condition); this also means
bad things will happen if the interrupt line is shared.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMerge branch 'master' into core32
H. Peter Anvin [Mon, 18 May 2009 21:34:05 +0000 (14:34 -0700)]
Merge branch 'master' into core32

15 years agoMerge branch 'master' into core32
H. Peter Anvin [Mon, 18 May 2009 21:32:57 +0000 (14:32 -0700)]
Merge branch 'master' into core32

Conflicts:
core/extlinux.asm
core/isolinux.asm
core/ldlinux.asm
core/pxeidle.inc
core/pxelinux.asm

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore/pxeidle.inc: fix pops with no matching push
H. Peter Anvin [Mon, 18 May 2009 21:28:18 +0000 (14:28 -0700)]
core/pxeidle.inc: fix pops with no matching push

In check_for_arp, we dropped the segment register pushes, but we need
to drop the pops, too.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoTry to HLT the processor during idle syslinux-3.81-pre4
H. Peter Anvin [Mon, 18 May 2009 20:42:19 +0000 (13:42 -0700)]
Try to HLT the processor during idle

Try to HLT the processor during idle.  All the events we care about
should have interrupts associated with them, except possibly the
serial console.  Try to deal with the serial console by waiting some
time before going into HLT, and giving the user the option of enabling
the serial console interrupt, on the assumption that the BIOS will
simply IRET.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: change "Linux needs..." to "Syslinux needs..."
H. Peter Anvin [Mon, 18 May 2009 19:07:23 +0000 (12:07 -0700)]
core: change "Linux needs..." to "Syslinux needs..."

Linux really only needs about 64K or so of low memory these days, but
Syslinux needs more.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoversion: set this version to 4.00
H. Peter Anvin [Mon, 18 May 2009 19:02:16 +0000 (12:02 -0700)]
version: set this version to 4.00

Assume that whatever version ends up using the core32 stuff it will be
called 4.00.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMove the NASM debugging options to a separate variable
H. Peter Anvin [Mon, 18 May 2009 00:03:43 +0000 (17:03 -0700)]
Move the NASM debugging options to a separate variable

Move the NASM debugging options to a separate Makefile variable,
NASMDEBUG, so they can be overridden if necessary.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: move common module includes to common.inc
H. Peter Anvin [Sun, 17 May 2009 23:52:03 +0000 (16:52 -0700)]
core: move common module includes to common.inc

A lot of modules are common to *all* the derivatives (as opposed to
just "most"); move those to common.inc.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: move real-mode callback code to callback.inc
H. Peter Anvin [Sun, 17 May 2009 23:41:10 +0000 (16:41 -0700)]
core: move real-mode callback code to callback.inc

The real-mode callbacks are not specific to the comboot API, nor are
they com32-specific anymore.  Move them to a separate file, and let
com32.inc be only the items related to comboot files proper.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: add .textnr to layout.inc
H. Peter Anvin [Sun, 17 May 2009 23:25:38 +0000 (16:25 -0700)]
core: add .textnr to layout.inc

Add .textnr to layout.inc, so it gets the proper flags.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: move 32-bit code out of the .text16 segment
H. Peter Anvin [Sun, 17 May 2009 20:39:42 +0000 (13:39 -0700)]
core: move 32-bit code out of the .text16 segment

Move all 32-bit code out of the .text16 segment.  The code that is
used during the relocation of the .text segment (i.e. anywhere on the
bcopy path) is moved to .textnr (other than the code already in
.bcopyxx) for "no relocate", the rest of the code to .text.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: move "-g -F stabs" to NASMOPT
H. Peter Anvin [Sun, 17 May 2009 05:12:41 +0000 (22:12 -0700)]
core: move "-g -F stabs" to NASMOPT

Move -g -F stabs to NASMOPT.  Eventually we might need to disable them
for older versions of NASM, since the linker seems to get unhappy
about mixing older NASM stabs with gcc stabs.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMerge branch 'master' into core32
H. Peter Anvin [Sun, 17 May 2009 02:14:17 +0000 (19:14 -0700)]
Merge branch 'master' into core32

Conflicts:
core/graphics.inc

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agobcopyxx: remove 16-bitisms syslinux-3.81-pre3
H. Peter Anvin [Sun, 17 May 2009 02:07:19 +0000 (19:07 -0700)]
bcopyxx: remove 16-bitisms

Remove a couple of 16-bitisms in the bcopy code, since it is now
running in perfectly ordinary 32-bit mode.  In particular,
prefer 32-bit registers to 16-bit registers, and drop "a32" prefixes
(which do nothing.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agobcopyxx/memmove: fix alignment logic for reverse moves
H. Peter Anvin [Sun, 17 May 2009 02:02:38 +0000 (19:02 -0700)]
bcopyxx/memmove: fix alignment logic for reverse moves

The alignment logic for reverse moves is reversed, because the initial
edi, and therefore edx, points to the last byte, not to one byte
beyond the end.  Therefore, in the fully aligned case it will end in
11 binary, not in 00 binary as for the forward case.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoFix clobber of the command line when using F-keys+LSS graphics
H. Peter Anvin [Fri, 15 May 2009 23:24:34 +0000 (16:24 -0700)]
Fix clobber of the command line when using F-keys+LSS graphics

Fix a half-entered command line when getting clobbered when pressing
an F key that in turn invokes an LSS graphic.  This was used by
duplexing the command line buffer as LSS decompression space.

Allocate a separate buffer, but move the legacy graphic variables to
.bss2 to avoid overflow.

Reported-by: Михаил <from.miha@gmail.com>
Debugged-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: make auxseg a piece of address space assigned by the linker
H. Peter Anvin [Fri, 15 May 2009 20:34:17 +0000 (13:34 -0700)]
core: make auxseg a piece of address space assigned by the linker

Let the linker assign a place for the auxseg using normal linking
rules.  Place it between the main 16-bit and 32-bit code.  Eventually
the fontbuf will probably move into the 32-bit bss.

This also avoids the weirdly aligned real_mode_seg.

In the future, expect xfer_buf_seg and real_mode_seg to merge into a
single 16-bit bounce buffer and cache_seg to go away.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: add pm_call convenience macro
H. Peter Anvin [Fri, 15 May 2009 17:43:25 +0000 (10:43 -0700)]
core: add pm_call convenience macro

Add a pm_call convenience macro, instead of using stub routines
everywhere.  Stubs would still make sense if we have a routine which
gets invoked from a lot of places, though, since the pm_call expands
to 9 bytes as opposed to 3 bytes per call site plus a 10-byte stub.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: make the intcall/farcall/cfarcall routines reentrant
H. Peter Anvin [Fri, 15 May 2009 17:33:02 +0000 (10:33 -0700)]
core: make the intcall/farcall/cfarcall routines reentrant

Make the intcall/farcall/cfarcall routines reentrant, by dropping the
use of RealModeEAX and by saving/restoring Com32SysSP on the PM stack.

Furthermore, drop the saving and restoring of EAX, EDX, ECX; trying to
save all registers complicates the code, and those registers will be
assumed clobbered by the caller anyway.  Might as well save a little
bit of stack space, too.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: make the COMBOOT API available to in-kernel PM code
H. Peter Anvin [Fri, 15 May 2009 03:17:43 +0000 (20:17 -0700)]
core: make the COMBOOT API available to in-kernel PM code

Make it possible to call the COMBOOT API from in-kernel PM code,
simply by setting up the COMBOOT API earlier and only tearing it down
during final shutdown.

WARNING: the COMBOOT API is quite possibly probably not reentrant; I
haven't checked it...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: move core definitions to include/core.h
H. Peter Anvin [Fri, 15 May 2009 02:09:11 +0000 (19:09 -0700)]
core: move core definitions to include/core.h

Create a new include file for core-specific definitions, and put it in
the include directory.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: rewrite rllpack in C
H. Peter Anvin [Fri, 15 May 2009 02:01:35 +0000 (19:01 -0700)]
core: rewrite rllpack in C

Rewrite the rllpack implementation in C, as a first step and test
case.

In particular, this illustrates how to access real-mode registers from
protected-mode C.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: link with libcom32 and libgcc
H. Peter Anvin [Fri, 15 May 2009 01:14:20 +0000 (18:14 -0700)]
core: link with libcom32 and libgcc

Link libcom32 and libgcc into the core.  That doesn't mean all the
functionality of libcom32 is usable in the core!!!

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore/diskstart.inc: break transactions on 64K boundaries
H. Peter Anvin [Fri, 15 May 2009 01:07:30 +0000 (18:07 -0700)]
core/diskstart.inc: break transactions on 64K boundaries

getlinsec doesn't watch for 64K boundaries, so we need to do it
ourselves.  Break a loading run if we reach a 64K boundary.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore/diskstart: handle more than 2^16 dwords
H. Peter Anvin [Fri, 15 May 2009 01:04:25 +0000 (18:04 -0700)]
core/diskstart: handle more than 2^16 dwords

Handle more than 2^16 dwords in the checksumming loop.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoBUGS, TODO: deleted outdated, no longer maintained files
H. Peter Anvin [Thu, 14 May 2009 23:50:11 +0000 (16:50 -0700)]
BUGS, TODO: deleted outdated, no longer maintained files

These files are outdated and haven't been updated for years.  This
kind of stuff probably would work better on the wiki anyway.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: handle more than 32K of code for disk-based derivatives
H. Peter Anvin [Thu, 14 May 2009 23:33:37 +0000 (16:33 -0700)]
core: handle more than 32K of code for disk-based derivatives

Handle more than 32K worth of code for disk-based derivatives.  We do
this by allowing the sector pointers to overflow past sector 1; this
is OK because we limit a run to be based on only the pointers that we
have read so far.

XXX: This is implemented for EXTLINUX, but breaks SYSLINUX.  Need to
update (and unify!) the SYSLINUX installers to cope.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: adopt the naming convention core_* for exported symbols
H. Peter Anvin [Thu, 14 May 2009 19:21:46 +0000 (12:21 -0700)]
core: adopt the naming convention core_* for exported symbols

Adopt the naming convention core_* for symbols exported from the core
code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocore: syslinux.ld: explicitly mark .adv and .uibss as NOLOAD
H. Peter Anvin [Thu, 14 May 2009 19:20:36 +0000 (12:20 -0700)]
core: syslinux.ld: explicitly mark .adv and .uibss as NOLOAD

Explicitly mark the .adv and .uibss sections as NOLOAD; this seems to
avoid a linker error for reasons (VMA of these sections colliding with
the LMA of the 32-bit code.)

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