OP-TEE / optee_os

Trusted side of the TEE
Other
1.56k stars 1.05k forks source link

core: riscv: Simplify SP setup in setup_unwind_user_mode() #6993

Closed gagachang closed 3 weeks ago

gagachang commented 1 month ago

The parameter "regs" is the stack pointer which is allocated to store system call registers when calling thread_scall_handler(). Thus, we can simply get the original stack pointer by "regs + 1" equation, and use when exiting user mode.

The code is referenced from ARM's setup_unwind_user_mode().

gagachang commented 1 month ago

This PR depends on https://github.com/OP-TEE/optee_os/pull/6819, which improves the stack usage of trap handlers.

gagachang commented 1 month ago

Hi @maroueneboubakri , would you like to review this small patch ?

gagachang commented 1 month ago

Hi @jforissier , seems the CI failure is related to fetching or hafnium.

error: RPC failed; curl 18 transfer closed with outstanding read data remaining
error: 60833 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
fatal: Fetched in submodule path 'prebuilts', but it did not contain 5cd8406945e7f8f4bc9814167113886ae2a206fc. Direct fetching of that commit failed.
fatal: 
make: *** [Makefile:398: .hafnium_checkout] Error 128
make: *** Waiting for unfinished jobs....
jforissier commented 1 month ago

@gagachang yes, some temporary error with the Hafnium repository. I tried make .hafnium_checkout on my machine and it worked so I have restarted the CI job and hopefully it should complete this time. Anyways, it is not the first time that git.trustedfirmware.org has caused transient problems so I am leaning towards replacing all the TFO links with their GitHub mirrors. GitHub has always been rock solid.

gagachang commented 3 weeks ago

Hi @maroueneboubakri , do you have time to review this PR ?

gagachang commented 3 weeks ago

Hi @jforissier , if there is no reviewer's feedback, we want to merge this PR. I think the modification is simple.

jforissier commented 3 weeks ago

Hi @jforissier , if there is no reviewer's feedback, we want to merge this PR. I think the modification is simple.

Sure, and the commit has a Reviewed-by from your colleague so it's fine.