ååèªäœã¯åæ¥çã§ããããã®æè¡ã®éèŠãªç¹æ§ã«ã€ããŠäžçäžã«ç¥ãããããã«ããŒã±ãã£ã³ã°æ åœè ã«ãã£ãŠèæ¡ãããŸããã 圌ãã®èãã«ãããšãç§ãã¡ã¯ããçš®ã®ä¿¡é Œã§ãããä¿è·ããããéåžžã«ä¿¡é Œã§ããå ŽæãæäŸãã¹ãã§ãã ããšãã°ãç§ãã¡ããã¢ãéããæãããç¹ããŠãå¿«é©ã§å®å šã ãšæãã家ã
ãããã£ãŠã TrustZoneãããã»ããµãŒã®ãå Žæãã§ã¯ãªããšããäºå®ããå§ããŸã ã ãã£ãã·ã¥ãALUã®ããã«ããããäžã§èŠã€ããããšãã§ããŸããã å®éãä¿¡é Œã§ããããã°ã©ã ã¯ãç©ççã«å²ãåœãŠãããããã»ããµã®ãŸãŒã³ã§ã¯å®è¡ãããŸããã
ARMã³ã¢ã®ãœãŒã¹ã³ãŒãã調ã¹ãŠããTrustZoneãæ確ã«ç¹å®ã§ããŸããã§ããã ããããããã°ã©ã ãšã®é¡æšã«ãããTrustZoneã¯ãããã»ããµãŒã®ä»ã®ã»ãšãã©ãã¹ãŠã®éšåã®ããã®ããã€ãã®ã¢ãžã¥ãŒã«ãšãããã®ã»ããã§ãã
ãã®èšäºã§ã¯ãARM Cortex-Aããã»ããµïŒARMv7AïŒã®ããŒããŠã§ã¢ã¬ãã«ã§TrustZoneãå®è£ ããæ¹æ³ã«ã€ããŠèª¬æããŸãã
ARMv8Aã§ã¯ã»ãŒåãã§ãããARMv7Mã§ã¯ãã¹ãŠãå®å šã«ç°ãªããŸãã ããŒã±ãã£ã³ã°ã®ããã«ãTrustZoneããããŸããããã1ã€ãããŸãã
ã¢ãŒã
TrustZoneã®æåã®ã³ã³ããŒãã³ãã¯ããã»ããµã¢ãŒãã§ãã ããã¯ãSCRïŒã»ãã¥ã¢ã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ã¬ãžã¹ã¿ïŒã®NSïŒéã»ãã¥ã¢ïŒãããã§æå®ãããŸãã NS = 1ã®å Žåãéã»ãã¥ã¢ã¢ãŒãã«ãªããŸããNS= 0ã®å Žåãä¿¡é Œã§ãããã€ãŸãã»ãã¥ã¢ã¢ãŒãã«ãªããŸãã
Cortex-A5 SCRã¬ãžã¹ã¿
NSã«é¢ä¿ãªããéåžžã®ããã»ããµã¢ãŒãã¯ãã¹ãŠãã®ãŸãŸã§ãã æã人æ°ã®ãããã®ïŒ
- ãŠãŒã¶ãŒ-ã¢ããªã±ãŒã·ã§ã³ã³ãã³ãå®è¡ã¢ãŒãã
- ã¹ãŒããŒãã€ã¶ãŒ-OSã«ãŒãã«ã®åäœã¢ãŒãã
- IRQ-å²ã蟌ã¿åŠçæã®ã¢ãŒãã
NSã®ãããã§ãã»ãã¥ã¢ãŠãŒã¶ãŒãéã»ãã¥ã¢ãŠãŒã¶ãŒãã»ãã¥ã¢ã¹ãŒããŒãã€ã¶ãŒãéã»ãã¥ã¢ã¹ãŒããŒãã€ã¶ãŒãªã©ããããŸãã
é衚瀺ã®ããã¹ã
ããã§æå®ããããŠãŒã¶ãŒ/ã¹ãŒããŒãã€ã¶ãŒåã¯ãARMv7ãŸã§ã®ãã¹ãŠã®32ãããARMã«äœ¿çšãããŸãã ARMv8ã¯ãä»ã®æå®EL0 / EL1ããã³PL0 / PL1ã䜿çšããŸãã ããã¯æ¬è³ªãå€ããŸããã
NSãããã¯ãåã ã®ããã»ããµæ©èœã®å®è¡ã«åœ±é¿ãåãŒããåã ã®ãããã¯ãžã®ã¢ã¯ã»ã¹ãçŠæ¢ããããã»ããµã³ã¢ãšåšèŸºããã€ã¹ã®äž¡æ¹ã®ã¬ãžã¹ã¿ã®äžéšã®åäœãå€æŽããŸãã
ããã«ãéåžžã®ããã»ããµã¢ãŒãã§ã¯NSãããã®å€ãååŸããŠå€æŽããããšã¯äžå¯èœã§ããããšãå€æããŠããŸããããã¯çŠæ¢ãããŠããŸãã NSå€ãå€æŽããããã«ãããã»ããµãå¥åã®ã»ãã¥ã¢ã¢ãã¿ã¢ãŒãã«å ¥ãã»ã¬ã¢ãã¢ã«ãæäŸãããŸãããã®ã¢ãŒãã¯ãã»ãã¥ã¢ãŸãã¯éã»ãã¥ã¢ã«æ確ã«å±ããŸããã ãã ããããã«ã€ããŠã¯æ¬¡ã®èšäºã§èª¬æããŸãã
NSã¯ããã»ããµãåå²ãã2ã€ã®ç°ãªãåäœã¢ãŒããäœæããããšãããããŸããïŒã»ãã¥ã¢ãšéã»ãã¥ã¢ã ãã ããåã¢ãŒãã«ã¯ãOSãšããã°ã©ã ãå®è¡ããããã«å¿ èŠãªãã®ããã¹ãŠãããŸããCPUãšåšèŸºæ©åšã®äžéšã®æ©èœã«ã¢ã¯ã»ã¹ããããã®ç¹æš©ã ããç°ãªããŸãã
ã¢ãŒãããŸãŒã³ã§ã¯ãããŸããïŒ
ã«ãŒãã³ãåãå€ãç¶ããŸãã
ä¿¡é Œã§ããããã°ã©ã å®è¡ã¢ãŒããšã¯ãNS = 0ã®å Žåã®ã¢ãŒãã§ãã
è¿œå ã®ã³ãã³ããã€ãã©ã€ã³ãALUãåå¥ã®ããã°ã©ã ã¡ã¢ãªã¯ãããŸãããTrustZoneãšããååãèããŠãæ³åã§ãããã®ã¯äœããããŸããã ãã®ãŸãŒã³ã«å¢çã¯ãããŸãã;äŸµå ¥è ã®ããŒã ã¯ã现èèãééãããŠã€ã«ã¹ã®ããã«ãä¿¡é Œã§ãããŸãŒã³ã«ãã¯ããŒã«ãããããšããŸããã
äžè¬çãªã±ãŒã¹ã§ã¯ããã€ãã©ã€ã³ã¯ä¿¡é Œã§ããªãããã°ã©ã ã®ã³ãã³ããå®è¡ãïŒNS = 1ïŒããã®åŸïŒbangïŒïŒå²ã蟌ã¿ãçºçããããã»ããµã¯ä¿¡é Œã¢ãŒãã«ãªãïŒNS = 0ïŒãããã«ä¿¡é Œã§ããã³ãŒããå®è¡ããŸããã
å®éãTrustZoneãã¯ãããžãŒã¯ãä¿¡é Œã§ããããã°ã©ã ãšä¿¡é Œã§ããªãããã°ã©ã ã®ã¡ã¢ãªãå ±æããåšèŸºæ©åšãžã®ã¢ã¯ã»ã¹ãå ±æããå€ãã®æ段ãè¬ããããŒã«ãæäŸããŸãã ãããããã®éå£ã®ä¿¡é Œæ§ã¯ãä¿¡é Œã§ãããœãããŠã§ã¢ã®å®è£ ã®å質ãšå®å šæ§ã«äŸåããŸãã
ã«ãŒãã³ã®åãå€ãã®çµããã
NSä¿¡å·
NSãããã¯ãåäœããã¢ãŒããããã»ããµã³ã¢ã«äŒããã ãã§ã¯ãããŸããã ãŸããããã»ããµããã»ãšãã©ãã¹ãŠã®åšèŸºæ©åšã«æ¥ç¶ãããå€éšä¿¡å·ã§ãã
ãããæ瀺ããæ¹æ³ã¯ïŒ äžè¬çãªå ŽåãåšèŸºæ©åšã¯ã¢ãã¬ã¹ãããŒã¿ãããã³å¶åŸ¡ãã¹ã«ãã£ãŠCPUã«æ¥ç¶ããããšæ³åããŸãã NSã¯ãTrustZoneãå®è£ ãããŠããããã»ããµã®å¶åŸ¡ä¿¡å·ã®äžéšã§ãã ãããã£ãŠãCPUããããã€ã¹ãžã®èªã¿åããæžã蟌ã¿ã ãã§ãªããå®å šãªèªã¿åããéå®å šãªèªã¿åããå®å šãªæžã蟌ã¿ãéå®å šãªæžã蟌ã¿ã³ãã³ãã§ãã
Cortex-Aã¯ãã·ã¹ãã ãªã³ãããïŒSoCïŒãšããŠæäŸããã
ã©ã®åšèŸºæ©åšãã»ãã¥ã¢/éã»ãã¥ã¢ã¢ã¯ã»ã¹ããµããŒãããŠããŸããïŒ ããšãã°ãããã¯GICå²ã蟌ã¿ã³ã³ãããŒã©ãŒã§ããARMã§ã¯ãSoCã®äžéšãšããŠã®åšèŸºæ©åšã§ãã ã»ãã¥ã¢ã¢ãŒãã§ã¯ãããã€ãã®å²ã蟌ã¿ã®é ä¿¡ãã»ãã¥ã¢FIQã¢ãŒãã«èšå®ãããã®ãœãããŠã§ã¢èšå®ãéã»ãã¥ã¢ã¢ãŒãããå€æŽããããšãçŠæ¢ã§ããŸãã
ããã¯ãCPUãGICã§åäœããå Žåã«çºçããããšã§ããGICã¬ãžã¹ã¿ãCPUããã»ãã¥ã¢ã¢ãŒãã§æžã蟌ãŸãããšãä¿¡å·NS = 0ãã¬ãžã¹ã¿ã¢ãã¬ã¹ãšããŒã¿ãšãšãã«éä¿¡ãããŸãã GICã¯ããšã³ããªãä¿¡é Œã§ããããšãç解ããå®å šãªã¢ã¯ã»ã¹ãèš±å¯ããŸãã NS = 1ã®å ŽåãGICã¯æžã蟌ã¿ãšèªã¿åãã®äž¡æ¹ã«ã€ããŠãã¬ãžã¹ã¿ã®äžéšãžã®ã¢ã¯ã»ã¹ãå¶éããŸãã
NSä¿¡å·ããµããŒãããä»ã®ããã»ããµãŠãããïŒã¡ã¢ãªã³ã³ãããŒã©ãŒããªã¢ã«ã¿ã€ã ã¯ããã¯ïŒRTCïŒãããŒã¹ãã¬ãŒãžããªã»ããã³ã³ãããŒã©ãŒãããã³é»æºç®¡çã
ARMv7Aã§ã¯TrustZoneã®ãµããŒãã¯ãªãã·ã§ã³ã§ãããSoCãäœæããå ŽåãSecure Extensionsãªãã·ã§ã³ïŒReadïŒTrustZoneïŒãç¡å¹ã«ã§ããããšã«æ³šæããŠãã ããã åæã«ãäžèŠãªãããã¯ãšéä¿¡ããããããåé€ãããŸããç¹ã«ããããå šäœã§NSã©ã€ã³ããã¬ãŒã¹ããå¿ èŠã¯ãããŸããã ãã®å ŽåãNSããªãã§ã©ã«ã®å ¥åã¯0ã«æ¥ç¶ãããŸãïŒå°ãªããšããã®ããã«æ³åã§ããŸãïŒã ãããããããžã¯ããç°¡åã«ãªã£ãŠããŸãã
ãã«ãããã»ãã·ã³ã°
SoCã«è€æ°ã®ããã»ããµã³ã¢ãå«ãŸããŠããå Žåã¯ã©ããªããŸããïŒ åã³ã¢ïŒéåžžãARMããã¥ã¡ã³ãã§ã¯ã³ã¢ãšåŒã°ããŸãïŒã¯ãã»ãã¥ã¢ã¢ãŒããŸãã¯éã»ãã¥ã¢ã¢ãŒãã§åäœã§ããŸãã ãã€ã§ããäžéšã®ã³ã¢ã¯å®å šã§ããããä»ã®ã³ã¢ã¯å®å šã§ãªãããšãå€æããå ŽåããããŸãã
é衚瀺ã®ããã¹ã
ããã§ããTrustZoneããµããŒãããªãã«ãŒãã«ã¯ã1ã€ã®SoCã§TrustZoneããµããŒãããã«ãŒãã«ãšçµã¿åãããããšãã§ããŸãã
ãã®å ŽåãTrustZoneãã©ã®ããã«æ©èœããããç解ããããã«ãææ°ã®ARMã®å éšãèŠãŠã¿ãŸãããã
ARMããã»ããµã§ã¯ããã¹ãŠã®ããã»ããµã³ã¢ãã¡ã¢ãªãããã³åšèŸºæ©åšãAMBAãšåŒã°ããå éšãã¹ïŒ https://en.wikipedia.org/wiki/Advanced_Microcontroller_Bus_Architecture ïŒã«ãã£ãŠæ¥ç¶ãããŠããŸã ã ãããARMv4以éãAMBAãã¹ã«ã¯ã¹ã€ããã³ã°ãŠããããããããã¹ãã¹ã¿ãšåŒã°ãããŠããããããŸããŸãªã¹ã¬ãŒãããã€ã¹ã«æ¥ç¶ããŸãã
AXIãšAMBAã®åäœã®è©³çŽ°ãç解ããã®ã¯éåžžã«é£ãããããã ãã§ãããå šäœåãææ¡ããã«ã¯ãAHBãAPBãè¿œå ããç°ãªãã¢ãŒããã¯ãã£ã®å®è£ ã®è©³çŽ°ãèæ ®ããå¿ èŠããããŸãã ããããäžè¬çãªèãæ¹ã¯éåžžã«è¿ éã«ææ¡ãããŸãã
ããšãã°ãããã»ããµã³ã¢ïŒãŸãã¯ããã®ããã»ããµã®Dãã£ãã·ã¥ãšIãã£ãã·ã¥ïŒã¯ãã¹ãã¹ã¿ãŒã§ãããäžéšã®I2Cã³ã³ãããŒã©ãŒã¯ã¹ã¬ãŒãã§ãã ãã¹ãã¹ã¿ã¯ããã¹äžã§ãã©ã³ã¶ã¯ã·ã§ã³ãã€ãŸãèªã¿åããŸãã¯æžã蟌ã¿ãéå§ããŸãã ã¹ã¬ãŒã-ããã¯ãæžã蟌ã¿ãŸãã¯èªã¿åããè¡ããããã¯ã§ãã ã¡ãªã¿ã«ããã¹ã¿ãŒã®ã»ããã¯æ¬¡ã®ãšããã§ããããã»ããµã³ã¢ãDMAã³ã³ãããŒã©ãããã³DMAãå èµããåšèŸºæ©åšïŒUSBãã¹ããªã©ïŒã
ãã¹ã¿ãŒã¹ã¬ãŒãã¹ã€ããã³ã°ãŠãããã«ã€ããŠããã«è©³ããæ€èšããŸãã ARMv7Aã§ã¯ãã€ã³ã¿ãŒã³ãã¯ããšåŒã°ããAXIïŒAdvanced eXtensible InterfaceïŒã®å®è£ èŠçŽ ã§ãã ARM926ã§ã¯ããã®ãŠãããã¯ãã¹ãããªãã¯ã¹ãšåŒã°ããAHBïŒAdvanced High-Performance BusïŒå éšãã¹ã€ã³ã¿ãŒãã§ã€ã¹ã®å®è£ ã®äžéšã§ããã å®éãããã¯åãã§ãã
MÃãã¹ã¿ãŒãšNÃã¹ã¬ãŒããããã1çªç®ãš2çªç®ãæ¥ç¶ããã¹ã€ããã³ã°ãããªãã¯ã¹ããããŸãã åæç¹ã§ãåãã¹ã¿ãŒã1ã€ã®ã¹ã¬ãŒãã«æ¥ç¶ãããããŸã£ããç¡å¹ã«ããããšãã§ããŸãã ãã ããç°ãªãããã€ã¹ã«æ¥ç¶ãããŠããå Žåãè€æ°ã®ãã¹ã¿ãŒãåæã«ã¢ã¯ãã£ãã«ããããšãã§ããŸãã
äžè¬ã«ããã¹ãŠã®æ¥ç¶ãå¯èœãšããããã§ã¯ãããŸããã ç¹ã«ãã·ã¹ãã èšèšè ã¯äžèŠãªæ¥ç¶ãæé€ã§ããŸããããšãã°ãã€ãŒãµãããã³ã³ãããŒã©ãŒïŒãã¹ã¿ãŒïŒã«çç±ããªãå Žåã¯ãI2Cã³ã³ãããŒã©ãŒïŒã¹ã¬ãŒãïŒã«çŽæ¥æžã蟌ãããšãã§ããŸãã
ããã«ãäžéšã®ããã€ã¹ã¯ãã¹ã¿ãŒãŸãã¯ã¹ã¬ãŒãã®ããããã§ãã ããšãã°ãUSBãã¹ãã¯ãDMAãä»ããŠã¡ã¢ãªã«ããŒã¿ãä¿åããå Žåã¯ãã¹ã¿ãŒã§ãããã¬ãžã¹ã¿ãæ§æããå Žåã¯ã¹ã¬ãŒãã§ãã
ããã«ãåãã¹ã¿ãŒã¯NSä¿¡å·ã®ãœãŒã¹ã§ããããã¹ã¬ãŒãã¯ãã®ä¿¡å·ã®åä¿¡è ã§ãã AXIã¯ãNSä¿¡å·ãã€ã³ã¿ãŒã³ãã¯ãçµç±ã§ãã¹ã¿ãŒãã察å¿ããã¹ã¬ãŒãã«éä¿¡ããŸããããã«ãããã»ãã¥ã¢ãã©ã³ã¶ã¯ã·ã§ã³ãšéã»ãã¥ã¢ãã©ã³ã¶ã¯ã·ã§ã³ã®äž¡æ¹ãSoCã§åæã«çºçããŸãã
åšèŸºæ©åš
ããã§ãARM Cortex-Aãè€æ°ã®ããã»ããµã³ã¢ãšå€ãã®åšèŸºæ©åšã®å éšãã¹ã§ãã»ãã¥ã¢ã¢ãŒããšéã»ãã¥ã¢ã¢ãŒãã§åæã«åäœããæ¹æ³ã確èªã§ããŸãã ããå°ãè€éã«ããŸããïŒ
SoCãäœæããéãéçºè ã¯ARMã®ãããã¯ããµãŒãããŒãã£ã®ã¡ãŒã«ãŒã®ãããã¯ãããã³ç¬èªã®èšèšã®ãããã¯ãååŸããããããåäžã®ã·ã¹ãã ã«çµåããŸãã
ARMããååŸãããŸãã
- Cortex-AãCortex-M4ãªã©ã®ããã»ããµã³ã¢ããŸãã¯Cortex-A9 MPCoreãªã©ã®ãã«ãããã»ããµã·ã¹ãã å
šäœã
- PL390ãªã©ã®GICå²ã蟌ã¿ã³ã³ãããŒã©ãŒã
- ãã£ãã·ã¥ã³ã³ãããŒã©ãŒãããšãã°ãL2C-310ã
ãããã¯ãã¹ãŠTrustZoneããµããŒãããŠãããNSã¢ã¯ã»ã¹ãä¿¡é Œã§ãããã®ãšä¿¡é Œã§ããªããã®ãšã§å éšçã«å ±æããŠããŸãã
ããšãã°ããã£ãã·ã¥ã³ã³ãããŒã©ãŒã¯ãä¿¡é Œã§ããã¢ãŒãã§ä¿åãããŠããè¡ãšä¿¡é ŒãããŠããªãã¢ãŒãã§ä¿åãããŠããè¡ãèªèãã察å¿ããAXIãã©ã³ã¶ã¯ã·ã§ã³ãå®è¡ããŠããŒã¿ãç©çã¡ã¢ãªã«ãã³ãããŸãã
ããã«ãå€ãã®ããã»ããµãŠãããã¯ãµãŒãããŒãã£ã®ïŒä¿¡é Œæ§ãé«ããæåãªïŒéçºè ããè³Œå ¥ãããŠããŸãããç°ãªãã¡ãŒã«ãŒã®ããã»ããµã§ãåãã§ãã ããã¯ãããšãã°ãUSBãã¹ããSDHCãã¹ãã§ãã SoCéçºè ã¯ãã»ãšãã©å€æŽããããšãªããèªåã®ãã¹ãŠã®ããã»ããµã§ä»ã®ãããã¯ã䜿çšããŸãã ããã¯ãããšãã°ãã€ãŒãµãããMACãI2CãUARTãSPIã³ã³ãããŒã©ãŒã§ãã
ãããã¯è³Œå ¥ããããã®ãŠãããã«ã¯TrustZoneã®ãµããŒãããŸã£ãããªãå ŽåããããŸãã ããã¯ç解ã§ããŸã-ã»ãã¥ã¢ãšéã»ãã¥ã¢ã®éã§UARTãžã®ã¢ã¯ã»ã¹ãå ±æããå¿ èŠãããçç±ã¯æ³åã§ããŸããã ãããããã®ãããªããã€ã¹ãTrustZoneã«çµ±åããåé¡ã¯ç©ºäžã«æµ®ããã§ããŸãã
ãããã®ããã€ã¹ã®çµ±åã¯ãã¡ãŒã«ãŒSoCã«ãã£ãŠåå¥ã«æ±ºå®ãããŸãã å®éãã¡ãŒã«ãŒã¯2ã€ã®åé¡ã解決ããå¿ èŠããããŸãã
- TrustZoneããµããŒãããªãBus Masterã®å Žåã¯ãæ£ããNSãããã«çœ®ãæããŠãã ããã
- ãã¹ã¹ã¬ãŒãã®å Žåãæš©éãæ§æããã³ç¢ºèªããŸãã
TrustZoneããµããŒãããªãã¢ã¯ã»ã¹ãã¹ãã¹ã¿ãŒ
ã¡ã¢ãªããããŒã¿ãååŸãããããçŽæ¥HDMIã«è»¢éãããããªã³ã³ãããŒã©ãŒã®äŸã䜿çšããŠããããBus Masterã«ãšã£ãŠäœãæå³ããããèŠãŠã¿ãŸãããã
æªåé«ãDRMãæäŸãããïŒæå·åããããããªã¹ããªãŒã ã¯LinuxããSecure OSã«éãããããã§åŸ©å·åãããŠç»é¢ã«è¡šç€ºãããŸãã 埩å·åãããããŒã¿ã¯ãã»ãã¥ã¢ãªèªã¿åã/æžã蟌ã¿ã®ã¿ã«ã¢ã¯ã»ã¹å¯èœãªã¡ã¢ãªé åã«é 眮ãããŸãããã®é åãLinuxïŒéã»ãã¥ã¢ïŒããèªã¿åããšãã¢ã¯ã»ã¹ãšã©ãŒãçºçããŸãã ãããã£ãŠãLinuxã«åŸ©å·åãããã¹ããªãŒã ãã³ããŒãããŸããã ã»ãã¥ã¢ã¢ã¯ã»ã¹ã®æš©å©ãæã€ãããªã¢ããã¿ã¯ã埩å·åããããããªããŒã¿ãèªç±ã«èªã¿åããç»é¢ã«è¡šç€ºããŸãã
ãããªã¢ããã¿ãAXIãä»ããŠã»ãã¥ã¢ã¡ã¢ãªããããŒã¿ãåä¿¡ããã«ã¯ãNS = 0ã§ã¢ã¯ã»ã¹ããå¿ èŠããããŸãã ãã ããDRMãå¿ èŠãªãå Žåã¯ããããªã³ã³ãããŒã©ãŒãžã®ç¹æš©ã¢ã¯ã»ã¹ãæäŸããããªãå ŽåããããŸãã
ã³ã³ãããŒã©ãŒããã®ããã«ããŸããã®ããã«æ©èœããããã«ãèšå®ãã·ã¹ãã ã«å°å ¥ãããŸãïŒTrustZoneããµããŒãããªãåãã¹ãã¹ã¿ãŒã®ã¢ã¯ã»ã¹ã®çš®é¡ã ã€ãŸãããã¹ãã¹ã¿ãŒããšã«å°ãªããšã1ãããã§ãã ããããããã¯ãã£ã1ã€ã®ã¬ãžã¹ã¿ãŒã§ãããããã¯SoCã®äœæè ã圌ã®è²¬ä»»ã®ããã®ä»äºã§ãã ãããŠãããã¯ãã¡ãããç°ãªãã¡ãŒã«ãŒã®ããã»ããµãŒéã®éäºææ§ã®åå ã§ãã
TrustZoneããµããŒãããªãã¢ã¯ã»ã¹ãã¹ã¹ã¬ãŒã
åã¹ã¬ãŒãããã€ã¹ã«ã€ããŠãAXIã䜿çšããéã«æ¬¡ã®ã¢ã¯ã»ã¹æš©ã決å®ããã®ãè³¢æã§ãã
- å®å
šãªèªã¿åãã¢ã¯ã»ã¹ãèš±å¯ãããŠãããã©ããã
- Secure Writeã¢ã¯ã»ã¹ãèš±å¯ãããŠãããã©ããã
- ã¢ã¯ã»ã¹ãéã»ãã¥ã¢èªã¿åããèš±å¯ããããã©ããã
- éã»ãã¥ã¢æžã蟌ã¿ã¢ã¯ã»ã¹ãèš±å¯ããããã©ããã
ãã®ã»ããã¯ãèªã¿åã/æžã蟌ã¿æäœãšã»ãã¥ã¢/éã»ãã¥ã¢ã¢ãŒãã®éãåããã«ç±æ¥ããŸãã
å®éããã®å Žåã®æš©å©ã®å ±ææ¹æ³ã¯ãSoCã¡ãŒã«ãŒã«ãã£ãŠåå¥ã«æ±ºå®ãããŸãã ããšãã°ãåžžã«å®å šãªã¢ã¯ã»ã¹ãèš±å¯ããããšã«ãããèšå®ã®æ°ãæžããããšãã§ããŸãã ãŸãããŠãŒã¶ãŒ/ã¹ãŒããŒãã€ã¶ãŒã¢ã¯ã»ã¹ã¿ã€ãã®å èš³ãè¿œå ããããšã§ããããå¢ããããšãã§ããŸãã
ãã®ãããªã¢ã¯ã»ã¹å¶åŸ¡ã§ã¯ãã¢ã¯ã»ã¹ã¢ãŒãã«å¿ããŠãããã€ã¹ãžã®ã¢ã¯ã»ã¹ãèš±å¯ãŸãã¯çŠæ¢ãã2-4-8ãããã®ã¬ãžã¹ã¿ãåãã¹ã¹ã¬ãŒãã«æäŸã§ããŸãã
ãããŠãããã§å¥ã®ãããã¯ã«è¡ããŸãïŒãã¹ãã¹ã¿ãŒãã¢ã¯ã»ã¹ãéå§ãããããã¹ã¹ã¬ãŒããã¢ã¯ã»ã¹ãèš±å¯ããªãã£ãå Žåã¯ã©ããªããŸããïŒ
ã¢ã¯ã»ã¹ãšã©ãŒ
å¶éãããå ŽåãéåããããŸãã ããã€ã¹ãžã®äœããã®ã¿ã€ãã®ã¢ã¯ã»ã¹ãçŠæ¢ãããŠããå Žåããããå®è£ ãããŠãããšäœããçºçããå¿ èŠããããŸãã
å®éãåžžã«ã§ã¯ãããŸããã ããšãã°ãåãGICïŒå²ã蟌ã¿ã³ã³ãããŒã©ãŒïŒã§ãéã»ãã¥ã¢ã«å¯ŸããŠçŠæ¢ãããŠããæžã蟌ã¿æäœã¯ïŒéãã«ãéãã«ïŒå®è¡ããããèªã¿åãæäœã¯ãŒããè¿ããŸãã äœãèµ·ããããç¹å¥ã«èæ¡ãããŠããŸããããã«ãããã»ãã¥ã¢ã¢ãŒããšéã»ãã¥ã¢ã¢ãŒãã®äž¡æ¹ã§åãOSïŒLinuxãªã©ïŒãå®è¡ã§ããŸãã
ã»ãã¥ã¢ã¢ãŒãã§ã¯ãLinuxã¯ãã¹ãŠãéã»ãã¥ã¢ã§ç¬èªã«æ§æããŸããã³ã³ãããŒã©ãŒã¯äºåã«æ§æãããLinuxã¯æ®ãã®æ§æã®ã¿ãæ§æã§ããŸãã ããããGICã¯çŠæ¢åºåã«æžã蟌ãéã«ãšã©ãŒãåºããªãã®ã§ã圌女ã¯ç®ãç¬ããããããã£ããã«æ°ä»ãããããŸããã
ããŸãæŽç·ŽãããŠããªãã¹ããŒãããã€ã¹ã䜿çšãããšã©ããªããŸããïŒ æ¬¡ã«ãããšãã°ãéã»ãã¥ã¢ãã»ãã¥ã¢ã¡ã¢ãªé åã«æžã蟌ã¿ãè¡ããšãäžæ¢ãçºçããŸãã äžæ¢ã¯ãäžéšã®ããã€ã¹ãŸãã¯ã¡ã¢ãªé åã«ã¢ã¯ã»ã¹ã§ããªãå Žåã«çºçããARMäŸå€ã¿ã€ãã§ãã
ã»ãšãã©ã®å ŽåãéåæããŒã¿ã¢ããŒãããŸãã¯ãã·ã¢èªã§ã¯éåæã¢ããŒããçºçããŸãã
ããŒã¿ã®äžæ¢-ããã»ããµã®åœä»€ã§ã¯ãªããããŒã¿ã®èªã¿åã/æžã蟌ã¿äžã«çºçããããã ãšã©ãŒã®æç¹ã§ã¯ããã«çºçããã®ã§ã¯ãªãããã°ããããŠããçºçãããããéåæã§ãã ãããŠããã®å Žæããããã«è©³çŽ°ã«ãªããŸãã
äžè¬ã«ãã¢ã¯ã»ã¹ã«éåãããšãåæããã³éåæã®äž¡æ¹ã®äžæãçºçããå¯èœæ§ããããŸãã
ããšãã°ãLinuxãã¢ããªã±ãŒã·ã§ã³ãããŠã³ããŒããããšããã¢ããªã±ãŒã·ã§ã³å šäœãããŒããããããŒãžã®äžéšã®ã¿ãç©çã¡ã¢ãªã«é 眮ããã¢ã¯ã»ã¹æã«ã¢ããŒããçæããããã«æ®ããæ§æããå ŽåããããŸãã ã¢ããªã±ãŒã·ã§ã³ãèµ·åããç©çã¡ã¢ãªã«ããŒããããŠããªãããŒãžã«å°éãããšãåæäžæãçºçããŸãã ã¡ã¢ãªã¢ã¯ã»ã¹ãè¡ã£ãåœä»€ã§æ£ç¢ºã«çºçãããããåæçã§ãã ããã»ããµãäžæ¢ã¢ãŒãã«å ¥ããšãLinuxã¯ç®çã®ã¡ã¢ãªããŒãžãããŒãããäžæ¢ãåŒã³åºããã®ãšåãåœä»€ã«å¶åŸ¡ãæ»ããŸãã çµæ-ããã°ã©ã ã¯ããããèµ·ãããªãã£ãããã«ãæ©èœãç¶ããŸãã
ããããTrustZoneã®å Žåããã¹ãŠãããã»ã©ã¹ã ãŒãºã§ã¯ãããŸããã äžéšã®ããã»ããµã¯åæäŸå€ãã¹ããŒããŸãããã»ãšãã©ã®ã¢ã¯ã»ã¹ãšã©ãŒã«å¯ŸããŠéåæã¢ããŒããã¹ããŒãããŸãã
é衚瀺ã®ããã¹ã
ååãšããŠãã»ãã¥ãªãã£æ¡åŒµæ©èœãšä»®æ³åæ¡åŒµæ©èœã®äž¡æ¹ãåããARMv7Aããã»ããµã¯ãåæã¢ããŒããçæããããã«æ§æã§ããŸãã ããã¯ãããšãã°Cortex-A17ã§ãããARMv7Aã®å€§éšåïŒçç£ããããããã®æ°ã«ããïŒã«ã¯ä»®æ³åããããŸããã
2ã€ã®è³ªåã«çããŸãã
- ãªãéåæäžçµ¶ãèµ·ããã®ã§ããïŒ
- ãªããããæªãã®ã§ããïŒ
ãªãéåæã§ããïŒ
ãããããARMv7Aã¯ã³ãã³ããã€ãã©ã€ã³ãåããã¢ãŒããã¯ãã£ã§ãããåœä»€ã¯ããã»ããµã«ãã£ãŠäºåã«äžæãããå³å¯ã«é£ç¶ããŠå®è¡ãããããã§ã¯ãããŸããã åœä»€ã®äžéšã¯ãä»ã®åœä»€ãšäžŠè¡ããŠå®è¡ã§ããŸãã äŸïŒ
STR r1ã[r2] // * r2 = r1; ADD r2ãr2ãïŒ16 // r2 = r2 + 16;
ããã§ãæåã®ã³ãã³ãã¯ã¢ãã¬ã¹r2ã«r1ãæ ŒçŽãã2çªç®ã®ã³ãã³ãã¯r2ãå¢ãããŸãã éåžžãæåã®ã³ãã³ããå®è¡ãããåŸãã¡ã¢ãªãžã®ä¿åã¯2çªç®ã®åœä»€ãå®å šã«å®è¡ããããšãã«ã®ã¿éå§ãã ããããããŸã éå§ãããŠããŸããã
ããã«ãããã»ããµã«ã¯ãèšé²ãããã»ã«ãç¡æéã«ã¹ã¿ãã¯ãããã£ãã·ã¥ãããããã£ãã·ã¥ãã¡ã¢ãªãšåæããŠããå Žåã«ã®ã¿ã¢ã¯ã»ã¹ãšã©ãŒãçºçããå¯èœæ§ããããŸãã
次ã«ãã¡ã¢ãªé åããã£ãã·ã¥ãããŠããªãå Žåã§ããARMã®ã¡ã¢ãªã¯NormalãStrongly Orderedãããã³Device Memoryã«åå²ãããããã»ããµåŽã®ããŸããŸãªèªç±åºŠã«ãããAXIãä»ããã¡ã¢ãªããã³ããã€ã¹ãžã®å®éã®ã¢ã¯ã»ã¹ã®é åºãå€æŽã§ããŸãã ãã®çµæãããã€ã¹ãžã®ã¢ã¯ã»ã¹ãå¥ã®åŒã³åºãã§ããžãŒã§ãããšããäºå®ã«ãããAXIãä»ãããã©ã³ã¶ã¯ã·ã§ã³ãããã«çºçããªãå ŽåããããŸãã
ãããŠæåŸã«ãäžæ¢ãéåžžã®ãã¹ã¹ã¬ãŒããžã®ã¢ã¯ã»ã¹ãåŒãèµ·ãããå Žåãããã¯ããã»ããµã³ã¢ã®å€éšã®è«çä¿¡å·ã«ãªããŸãã ã«ãŒãã«ã¯ããã®ä¿¡å·ãã³ãã³ããã€ãã©ã€ã³ã§çŸåšçºçããŠãããã®ãšåæããŠããããšãæåŸ ããŠããŸãããããã¯å®å šã«çå®ã§ããã«ãŒãã«ã¯ããã®ãããªäžæã®åå ã100ïŒ å€æããããšããã§ããŸããã
ãããã®ç¶æ³ã®ãããã«ãããŠããARMã¯éåæã¢ããŒããçæãã ã¢ã¯ã»ã¹ããããã¯ããããšããããäœãµã€ã¯ã«åã®ã¯ããã¯ãµã€ã¯ã«ãŸãã¯åœä»€ãåãããªãããéç¥ããŸãã
éåæã¢ããŒããæªãã®ã¯ãªãã§ããïŒ
ã¯ããæ éç¹ãç¹å®ã§ãããäœãä¿®æ£ã§ããªãããã§ãã 誀ã£ãã¢ã¯ã»ã¹ã®åŸãããã°ã©ã ã¯12ãµã€ã¯ã«ä»¥äžå®è¡ããå¯èœæ§ãããããã®éãããã°ã©ã ã¯æ£åžžã«æ©èœããªããªããããåæ¢ããŠåèµ·åããå¿ èŠãããã ãã§ãã ãããããããã»ããµã®å®å šãªãªã»ããã«ãããOSã®åšèŸºæ©åšãŸãã¯å éšæ§é ããäžæ¢åŸã®ããã°ã©ã ã®åäœã«èŠããã§ããå Žåã
...ãããŠãããã®ã©ããçµè«ã¥ããããããšãã§ããã
TrustZoneã䜿çšããå Žåãæåã¯ãã®ãã¯ãããžãŒãããŒããŠã§ã¢ä»®æ³åãã¯ãããžãŒãšããŠäœ¿çšããããšãé åçã§ãã ããããéåæã¢ããŒãã«ãããããã¯æ©èœããŸããã
å®éãã»ãã¥ã¢ã¢ãŒããšéã»ãã¥ã¢ã¢ãŒãã®2ã€ã®ã¢ãŒãããããŸãã ã»ãã¥ã¢ã¢ãŒãã¯ãéã»ãã¥ã¢ã®ãµã³ãããã¯ã¹ã®é¡äŒŒç©ãäœæããåšèŸºæ©åšãžã®ã¢ã¯ã»ã¹ãå¶éã§ããŸãã
ãã ãã次ã®ã¹ãããã¯ãåšèŸºæ©åšã®äžéšãããšãã°ãã²ã¹ãOSãšãã€ããŒãã€ã¶ãŒã®äž¡æ¹ãåäœãããã©ãã·ã¥ã¡ã¢ãªã®ä»®æ³åã§ãã ãããŠããã§ãã²ã¹ãOSã®ããã€ã¹ã«ã¢ã¯ã»ã¹ããŠã¢ã¯ã»ã¹ãéããããšã¯äžå¯èœã§ãããšããäºå®ã«åºäŒããŸãã
åžæããæ¹æ³ïŒ
- ã²ã¹ãOSãããã€ã¹ã«ã¢ã¯ã»ã¹ãããšãäžæ¢ïŒåæïŒãçºçããŸãã
- ãã€ããŒãã€ã¶ãŒã¯äœãèµ·ãã£ãããç解ããŸãã
- ãã€ããŒãã€ã¶ãŒã¯ãã²ã¹ãOSã«ããããã€ã¹ã®äºæ³ãããåäœããšãã¥ã¬ãŒãããŸãã
- ãã€ããŒãã€ã¶ãŒã¯ã²ã¹ãOSã«å¶åŸ¡ãè¿ããäœãèµ·ãããªãã£ããã®ããã«æ©èœãç¶ããŸãã
ãããŠããããã©ã®ããã«è¡ããã§ãïŒ
- ã²ã¹ãOSã¯ããã€ã¹ã«ã¢ã¯ã»ã¹ããŠãããéåæäžçµ¶ã®æ¡ä»¶ãäœæãããŠããŸãã
- ã²ã¹ãOSã¯çããªãåäœãç¶ããŸãã
- çªç¶ã®äžæ¢ã¯ãã¹ãŠã·ã¹ãã ã«ãã£ãŠçæãããŸãã
- ãã€ããŒãã€ã¶ãŒã¯ãã¢ããŒããéåæã§ããããšãç解ããŠãããã©ã®åœä»€ã§ãã©ã®ã¢ãã¬ã¹ã§ãã©ã®ããã€ã¹ãžã®ã¢ã¯ã»ã¹ãçºçããããèšç®ã§ããŸããã
- ãã€ããŒãã€ã¶ãŒã¯ã²ã¹ãOSãåæ¢ããŸãã
çµè«ïŒTrustZoneãã¯ãããžãŒã ããããŒããŠã§ã¢ä»®æ³åã«äœ¿çšããããšã¯ã§ããŸããã
ã²ã¹ãOSã«ã»ãã¥ã¢OSã匷å¶çã«ããã¯ãããŠãçŠæ¢ãããããã€ã¹ã«ã¢ã¯ã»ã¹ããããšãã§ããŸããããã¯ãã»ãã¥ã¢OSãšã²ã¹ãOSã®éã§ããã€ã¹ãåå²ããäž»ãªæ¹æ³ã§ãã ãããããã®ããšã«ã€ããŠã¯æ¬¡åã話ããŸãã
ãããŠãã¡ã¢ãªãã¡ã¢ãªïŒ
ãããŠãéåžžã®ã¡ã¢ãªãžã®ã¢ã¯ã»ã¹ã¯ã©ãã§ããïŒ å®å šãªã¢ã¯ã»ã¹ã®ããã«ã·ã¹ãã DDRAMã®äžéšãå²ãåœãŠãããšã¯ã§ããŸããïŒ
ARMã¯ãããªããäºæ³ãããããããã®é¢åãèŠãŠãããŸããã§ããïŒ
ã¡ã¢ãªã³ã³ãããŒã©ãŒã¯ç°ãªããŸããããšãã°ã
- éçã¡ã¢ãªã³ã³ãããŒã©ãSRAMãå€ãã®å Žåãå
éšSoCã¡ã¢ãªã
- ãã€ãããã¯ã¡ã¢ãªã³ã³ãããŒã©ãŒãããšãã°ãDDR3ã
- ãã©ã¬ã«ã¡ã¢ãªã«ã¢ã¯ã»ã¹ããããã®ãŠãããŒãµã«ã³ã³ãããŒã©ã¯ãSRAMãNORãã©ãã·ã¥ã«äœ¿çšã§ããŸãã
ãããã®ã³ã³ãããŒã©ãŒã¯ãã¹ãŠãå žåçãªãã¹ã¹ã¬ãŒãã§ãã ARMã¯ããããéçºããªããããäžèšã®ã¹ããŒã ã«åŸã£ãŠãã»ãã¥ã¢/éã»ãã¥ã¢ãžã®ã¢ã¯ã»ã¹ã®åé¢ã¯SoCéçºè ã®è©ã«ããã£ãŠããŸãã
æãåºæ¬çãªãªãã·ã§ã³ã¯ã»ãšãã©åžžã«-å èµSRAMãžã®ã¢ã¯ã»ã¹ã¯ã»ãã¥ã¢ãšããŠæ§æãããDDRãžã®ã¢ã¯ã»ã¹ã¯éã»ãã¥ã¢ãšããŠæ§æãããŠããŸãã
ããã¯ããªãå®å šãªæ¹æ³ã§ãããã¹ãŠã®ã»ãã¥ã¢ããŒã¿ã¯ãããå ã«ä¿åãããããããã®åšèŸºããåºãªãã§ãã ããã ãã ããå èµSRAMã¯æ°åãŸãã¯æ°çŸãããã€ãã®æ²æšãªãã®ã§ãããããã¯æ¬æ Œçãªã»ãã¥ã¢OSããã³ä¿è·ãããããŒã¿ã«ã¯äžååãªå ŽåããããŸãã
SoCã¡ãŒã«ãŒããã®è£éã§ãNS = 0/1åºæºã«åŸã£ãŠã¡ã¢ãªãŸãŒãã³ã°ããµããŒãããDDRã³ã³ãããŒã©ãŒãå®è£ ããå Žåãããæè»ãªæ¹æ³ã衚瀺ãããŸãã å®éãå®è£ ã«ã¯å€ãã®ãªãã·ã§ã³ããããŸãããããã¯æ¬è³ªãå€ãããã®ã§ã¯ãããŸããã
äžè¬ã«ããã®ãããªã¡ã¢ãªã¯ãå°ãªããšã次ã®ãã®ãæäŸããŸãã
- 3ããã®çªå·ã®ç°ãªãã¢ã¯ã»ã¹æš©ãæã€ãŸãŒã³ããããŸãã
- 1ã€ã®ãŸãŒã³ãéã»ãã¥ã¢ãšããŠæ§æã§ããŸããLinuxãŸãã¯å¥ã®ã²ã¹ãOSãããã§åäœããŸãã ããã¯ã¡ã¢ãªã®æ倧éšåã§ãã
- ä»ã®ãŸãŒã³ã¯ã»ãã¥ã¢ãšããŠæ§æã§ããã»ãã¥ã¢OSããŒã¿ããããŸãã ãã®é åã¯ãã£ãšå°ãããªã£ãŠããŸãã
- 3çªç®ã®ãŸãŒã³ã¯ãã»ãã¥ã¢ããã³éã»ãã¥ã¢ã®äž¡æ¹ã«ã¢ã¯ã»ã¹ã§ããããã«æ§æå¯èœã§ãã LinuxãšSecure OSã®éã§å€§éã®ããŒã¿ã亀æããããã«äœ¿çšãããŸãããã»ãã®æ°MBã§ãã
- ããæè»ãªèšå®ã«ãããé åãSecure Write / Non-Secure Readã«ã§ããéã«ãåæ¹åããŒã¿äº€æçšã«ã§ããŸãã
幞ããªããšã«ãã¡ãŒã«ãŒã¯ãã®ãããªã³ã³ãããŒã©ãŒãSoCã«å«ããŠããŸãã
ARMããããåŠçããªãã£ãããšã¯æ®å¿µã§ãããããŸããŸãªãœãªã¥ãŒã·ã§ã³ããããŸãã
ãã®å®è£ ã«ã¯ãã€ãã¹ç¹ããããŸããARMã®éåžžã®ããã°ã©ã ããã³ããŒã¿ã¡ã¢ãªã¯ãã£ãã·ã¥ãããã¡ã¢ãªã³ã³ãããŒã©ãŒã¯éåžžã®ãã¹ã¹ã¬ãŒãã§ãããããçŠæ¢ã¢ãã¬ã¹ãžã®æžã蟌ã¿ããã£ãããšãããã«ã¯ããããŸããã éåæã¢ããŒããçºçããããã°ã©ã ã®ãã©ã°ã¡ã³ããã¯ãªãŒã³ã¢ããããã ãã§æžã¿ãŸãã
ãããã«
ãã®èšäºã§ã¯ãARMv7Aã§ã®TrustZoneã®ããŒããŠã§ã¢å®è£ ã確èªãããã®ãã¯ãããžãŒã«é¢é£ãã誀解ã®ããã€ãã解æ¶ããŸããã
èæ ®ïŒ
- ã»ãã¥ã¢ã¢ãŒããšéã»ãã¥ã¢ã¢ãŒã
- 1ã€ãŸãã¯è€æ°ã®ã³ã¢ã®æäœã
- AXIãä»ããŠåšèŸºæ©åšãæäœããŸãã
- TrustZoneã®ãµããŒããªãã§éçºãããåšèŸºæ©åšãšé£æºããŸãã
- çºçããã¢ã¯ã»ã¹ãšã©ãŒã®çš®é¡ã
- ç©çã¡ã¢ãªãžã®ã¢ã¯ã»ã¹ã®å·®å¥åã
ç§ãã¡ã¯ãã³ãããã®äžã§ç解ãããšèšãããšãã§ããŸãããç¹ç«ã¯ãŸã ãªã³ã«ãªã£ãŠããŸããã 次ã®èšäºã§ã¯ãããã»ããµãèµ·åããã»ãã¥ã¢ã¢ãŒããéã»ãã¥ã¢ã¢ãŒãã§ã®åäœãæ€èšããã»ãã¥ã¢ã¢ãã¿ã¢ãŒãã§åãæ¿ããŸãã