Hardening and Adapting Trusted Execution Environments for Emerging Platforms