Major changes for supporting multihost, including some code refactoring.

Local Unit Test:
https://paste.googleplex.com/5874223018672128

Tested on AMD single-host:
https://paste.googleplex.com/5323461163220992

Tested on ARM multi-host:
https://paste.googleplex.com/5179956709294080

Google-Bug-Id: 378795793
Change-Id: I904a3dee8a5c1812649bd1ba610b328d16f98e09
28 files changed