OP-TEE: User TAs
2024-11-17
| 2025-1-12
本文字數 527閱讀時長 2 分鐘
type
status
date
slug
summary
tags
category
icon
password
⚠️
The code is based on: https://gitlab.com/riseproject/riscv-optee/optee_os/-/tree/dev-optee-mpxy Commit ID: 75df9ba41a404aec897399ead0ff0aebcbff48ca
  • tee_ta_init_user_ta_session()
    • Initialize user TA for the UUID, assign ctx->ts_ctx.ops to user_ta_ops by calling set_ta_ctx_ops(). user_ta_ops will be the global callbacks for the user TAs; assign tee_ta_session->ts_sess.handle_scall to scall_handle_user_ta(). scall_handle_user_ta() will be the default callback to handle the syscall from user TA:


    • user_ta_enter_open_session()

    • user_ta_enter_invoke_cmd()

    • user_ta_enter()
      • Call thread_enter_user_mode() to switch to U-mode. utc->utcx.entry_func (user TA’s entry function address, filled by ldelf) will be called after switching to U-mode.
        • E.g. For optee_example_hello_world, i.e. 8aaaf200-2450-11e4-abe2-0002a5d5c51b.elf, the entry_func is 0x400405f8 => __ta_entry().
          • __ta_entry() is the first user TA API called from TEE core (defined in ta/user_ta_header.c).
            • It’s assigned in TA’s Makefile:
              • __ta_entry() will call __utee_entry() (defined in lib/libutee/user_ta_entry.c) to invoke the function (e.g. TA_OpenSessionEntryPoint(), TA_InvokeCommandEntryPoint()… etc) defined by user TA based on function ID.
                • User TA is linked with libutee.
              • And the end, __ta_entry() will call __utee_return() (defined in lib/libutee/user_ta_entry.c), to return from user TA.
                • __utee_return() is actually a syscall, syscall ID: TEE_SCN_RETURN. Therefore, tee_ta_session->ts_sess.handle_scall, e.g. scall_handle_user_ta(), will eventually be called.

      • scall_handle_user_ta():
        • Handle syscall according to tee_syscall_table:
    • OP-TEE
    • OP-TEE: REE filesystem TAOP-TEE: Pseudo TAs
      Loading...
      目錄