Change the generation strategy from code to type descriptors.
This changes the way marshalling/unmarshalling is done.
Previously the code generator would produce a C function
for each structure. With this change, the layout of a
structure is encoded in an array of bytes, and a piece
of generic code traverses the array and performs the
required operations.
The main reason to do this is a reduced footprint, at the expense
of some marshal/unmarshal overhead (but the TPM is so slow that
the impact of this overhead should be negligible).
Version with generated marshallers:
semenzato@semenzato:~/trunks$ size tpmc
text data bss dec hex filename
188243 4172 48 192463 2efcf tpmc
version with interpreter-based marshalling:
semenzato@semenzato:~/trunks$ size tpmc
text data bss dec hex filename
64655 8404 48 73107 11d93 tpmc
Both of them contain the marshalling/unmarshalling code for all commands.
For a small subset of commands, the generated-code version is probably
still smaller, but the interpreted version is small enough that
this won't be a concern even in the firmware.
This change also adds the command TPM_GetTestResults.
BUG=chromium-os:19488
TEST=none
Change-Id: I2f5b30b480a0efcc4aa3db280aab20ec25681bab
Reviewed-on: https://gerrit.chromium.org/gerrit/37040
Reviewed-by: Darren Krahn <dkrahn@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
12 files changed