coreboot-kgpe-d16/util
Curt Brune 3c12cb0384 cbfstool:linux_trampoline: config CS and DS segment descriptors
The Linux trampoline code does not set up the segment descriptors for
__BOOT_CS and __BOOT_DS as described in the Linux kernel
documentation:

  ... a GDT must be loaded with the descriptors for selectors
  __BOOT_CS(0x10) and __BOOT_DS(0x18); both descriptors must be 4G
  flat segment; __BOOT_CS must have execute/read permission, and
  __BOOT_DS must have read/write permission;

This is not a problem when launching a Linux payload from coreboot, as
coreboot configures the segment descriptors at selectors 0x10 and
0x18.  Coreboot configures these selectors in the ramstage to match
what the Linux kernel expects (see
coreboot/src/arch/x86/lib/c_start.S).

When the cbfs payload is launched in other environments, SeaBIOS for
example, the segment descriptors are configured differently and the
cbfs Linux payload does not work.

If the cbfs Linux payload is to be used in multiple environments
should the trampoline needs to take care of the descriptors that Linux
requires.

This patch updates the Linux trampoline code to configure the 4G flat
descriptors that Linux expects.  The configuration is borrowed from
the descriptor configs in coreboot/src/arch/x86/lib/c_start.S for
selectors 0x10 and 0x18.

The linux_trampoline code is slightly refractored by defining the
trampoline entry address, 0x40000, as TRAMPOLINE_ENTRY_LOC.  This
definition is moved into a separate header file, linux_trampoline.h.
This header file is now included by both the trampoline assembly
language code and the trampoline loader C code.

The trampoline assembly language code can now use TRAMPOLINE_ENTRY_LOC
as scratch space for the sgdt CPU instruction.

Testing Done:

Verified the Linux payload is booted correctly in the following
environments:

1.  Coreboot -> Linux Payload

2.  Coreboot -> SeaBIOS -> Linux Payload: (previously did not work)

Change-Id: I888f74ff43073a6b7318f6713a8d4ecb804c0162
Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
Reviewed-on: http://review.coreboot.org/6796
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2014-09-04 23:34:32 +02:00
..
abuild abuild: make build directory configurable with a variable 2014-05-23 08:35:31 +02:00
acpi GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
amdtools Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
arm_boot_tools/mksunxiboot util: replace fseek/ftell/rewind with fstat 2014-08-12 11:53:24 +02:00
board_status board-status: be protocol agnostic on upload 2014-08-12 11:52:49 +02:00
cbfstool cbfstool:linux_trampoline: config CS and DS segment descriptors 2014-09-04 23:34:32 +02:00
cbmem cbmem: Terminate the cbmem console at the cursor position. 2014-07-30 11:49:45 +02:00
crossgcc crossgcc: Support OSX 10.9 built-in tar utility program. 2014-04-29 21:23:10 +02:00
dtd_parser GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
dumpmmcr dumpmmcr: Fix compilation warnings in printf 2012-01-26 09:57:56 +01:00
ectool GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
fletcher AMD Steppe Eagle: Add 32-bit Fletcher's Checksum computation 2014-08-30 00:28:06 +02:00
genprof util/genprof: improve handling of command line arguments 2014-08-12 09:02:44 +02:00
getpir GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
gitconfig gitconfig: Match the Change-Id line more exactly 2012-08-27 15:41:33 +02:00
i915tool util/i915tool: close the file also when fread() returned an error 2014-07-30 13:16:53 +02:00
ifdfake ifdfake - Create an IFD with just a section layout 2013-06-24 17:56:42 +02:00
ifdtool ifdtool: Provide bounds on string parser 2014-08-10 18:50:30 +02:00
inteltool util/inteltool: fix typo 2014-08-26 10:08:30 +02:00
k8resdump GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
kconfig kconfig: update to follow upstream more closely 2014-05-07 19:39:28 +02:00
lbtdump lbtdump: Dump forwarded tables. 2014-03-09 21:19:29 +01:00
lint lint: simplify board-status check 2014-09-03 00:23:26 +02:00
mkelfImage GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
mptable mptable: realign comments with code 2012-06-20 12:46:55 +02:00
msrtool msrtool: Fix verbose ignored by cpuid(). 2013-07-08 19:39:00 +02:00
nvramtool nvramtool: plug some memory leaks 2014-08-12 22:15:20 +02:00
optionlist GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
resetcf Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
romcc util: replace fseek/ftell/rewind with fstat 2014-08-12 11:53:24 +02:00
runfw Add a clean target to the run firmware (runfw) Makefile 2013-01-30 21:22:04 +01:00
sconfig sconfig: improve argument parsing 2014-08-04 20:57:12 +02:00
showdevicetree Show the device tree. 2013-03-16 04:30:16 +01:00
spkmodem_recv Add spkmodem receiver 2013-06-12 05:18:24 +02:00
superiotool util/superiotool: Add initial support for Fintek F71869ED. 2014-03-27 10:15:28 +01:00
vgabios Rename devices -> device 2012-11-30 23:59:58 +01:00
viatool viatool: Add utility to read various configuration bits on VIA systems 2013-06-04 22:36:26 +02:00
xcompile xcompile: always use -march=i686 2014-08-25 23:33:20 +02:00