{"action":"created","comment":{"url":"https://api.github.com/repos/OP-TEE/optee_os/pulls/comments/133633660","pull_request_review_id":56836591,"id":133633660,"diff_hunk":"@@ -644,59 +658,111 @@ UNWIND(\t.fnend)\n END_FUNC thread_unwind_user_mode\n \n LOCAL_FUNC thread_abort_handler , :\n-thread_abort_handler:\n thread_und_handler:\n UNWIND(\t.fnstart)\n UNWIND(\t.cantunwind)\n-\t/*\n-\t * Switch to abort mode to use that stack instead.\n-\t */\n-\tcps\t#CPSR_MODE_ABT\n-\tpush\t{r0-r11, ip}\n-\tcps\t#CPSR_MODE_UND\n-\tmrs\tr0, spsr\n-\ttst\tr0, #CPSR_T\n-\tsubne\tr1, lr, #2\n-\tsubeq\tr1, lr, #4\n-\tcps\t#CPSR_MODE_ABT\n-\tpush\t{r0, r1}\n-\tmsr\tspsr_fsxc, r0\t/* In case some code reads spsr directly */\n+\tstrd\tr0, r1, [sp, #THREAD_CORE_LOCAL_R0]\n+\tmrs\tr1, spsr\n+\ttst\tr1, #CPSR_T\n+\tsubne\tlr, lr, #2\n+\tsubeq\tlr, lr, #4\n \tmov\tr0, #ABORT_TYPE_UNDEF\n \tb\t.thread_abort_generic\n \n thread_dabort_handler:\n-\tpush\t{r0-r11, ip}\n-\tsub\tr1, lr, #8\n-\tmrs\tr0, spsr\n-\tpush\t{r0, r1}\n+\tstrd\tr0, r1, [sp, #THREAD_CORE_LOCAL_R0]\n+\tsub\tlr, lr, #8\n \tmov\tr0, #ABORT_TYPE_DATA\n \tb\t.thread_abort_generic\n \n thread_pabort_handler:\n-\tpush\t{r0-r11, ip}\n-\tsub\tr1, lr, #4\n-\tmrs\tr0, spsr\n-\tpush\t{r0, r1}\n+\tstrd\tr0, r1, [sp, #THREAD_CORE_LOCAL_R0]\n+\tsub\tlr, lr, #4\n \tmov\tr0, #ABORT_TYPE_PREFETCH\n-\tb\t.thread_abort_generic\n \n .thread_abort_generic:\n+\t/*\n+\t * At this label:\n+\t * cpsr is in mode undef or abort\n+\t * sp is still pointing to struct thread_core_local belonging to\n+\t * this core.\n+\t * {r0-r3} are saved in struct thread_core_local pointed to by sp\n+\t * {r4-r11, ip} are untouched.\n+\t * r0 holds the first argument for abort_handler()\n+\t */\n+\n+\t/*\n+\t * Update core local flags.\n+\t * flags = (flags << THREAD_CLF_SAVED_SHIFT) | THREAD_CLF_ABORT;\n+\t */\n+\tldr\tr1, [sp, #THREAD_CORE_LOCAL_FLAGS]\n+\tlsl\tr1, r1, #THREAD_CLF_SAVED_SHIFT\n+\torr\tr1, r1, #THREAD_CLF_ABORT\n+\n+\t/*\n+\t * Select stack and update flags accordingly\n+\t *\n+\t * Normal case:\n+\t * If the abort stack is unused select that.\n+\t *\n+\t * Fatal error handling:\n+\t * If we're already using the abort stack as noted by bit\n+\t * (THREAD_CLF_SAVED_SHIFT + THREAD_CLF_ABORT_SHIFT) in the flags\n+\t * field we're selecting the temporary stack instead to be able to\n+\t * make a stack trace of the abort in abort mode.\n+\t *\n+\t * r1 is initialized as a temporary stack pointer until we've\n+\t * switched to system mode.\n+\t */\n+\ttst\tr1, #(THREAD_CLF_SAVED_SHIFT + THREAD_CLF_ABORT_SHIFT)","path":"core/arch/arm/kernel/thread_a32.S","position":118,"original_position":118,"commit_id":"2531f34c995d9ed5196a9a40154e946cd4545bd1","original_commit_id":"2531f34c995d9ed5196a9a40154e946cd4545bd1","user":{"login":"jenswi-linaro","id":6150306,"avatar_url":"https://avatars0.githubusercontent.com/u/6150306?v=4","gravatar_id":"","url":"https://api.github.com/users/jenswi-linaro","html_url":"https://github.com/jenswi-linaro","followers_url":"https://api.github.com/users/jenswi-linaro/followers","following_url":"https://api.github.com/users/jenswi-linaro/following{/other_user}","gists_url":"https://api.github.com/users/jenswi-linaro/gists{/gist_id}","starred_url":"https://api.github.com/users/jenswi-linaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenswi-linaro/subscriptions","organizations_url":"https://api.github.com/users/jenswi-linaro/orgs","repos_url":"https://api.github.com/users/jenswi-linaro/repos","events_url":"https://api.github.com/users/jenswi-linaro/events{/privacy}","received_events_url":"https://api.github.com/users/jenswi-linaro/received_events","type":"User","site_admin":false},"body":"Thanks, I'll fix.","created_at":"2017-08-17T06:44:17Z","updated_at":"2017-08-17T06:44:17Z","html_url":"https://github.com/OP-TEE/optee_os/pull/1703#discussion_r133633660","pull_request_url":"https://api.github.com/repos/OP-TEE/optee_os/pulls/1703","_links":{"self":{"href":"https://api.github.com/repos/OP-TEE/optee_os/pulls/comments/133633660"},"html":{"href":"https://github.com/OP-TEE/optee_os/pull/1703#discussion_r133633660"},"pull_request":{"href":"https://api.github.com/repos/OP-TEE/optee_os/pulls/1703"}}},"pull_request":{"url":"https://api.github.com/repos/OP-TEE/optee_os/pulls/1703","id":131109453,"html_url":"https://github.com/OP-TEE/optee_os/pull/1703","diff_url":"https://github.com/OP-TEE/optee_os/pull/1703.diff","patch_url":"https://github.com/OP-TEE/optee_os/pull/1703.patch","issue_url":"https://api.github.com/repos/OP-TEE/optee_os/issues/1703","number":1703,"state":"open","locked":false,"title":"core: arm32: handle aborts in system mode","user":{"login":"jenswi-linaro","id":6150306,"avatar_url":"https://avatars0.githubusercontent.com/u/6150306?v=4","gravatar_id":"","url":"https://api.github.com/users/jenswi-linaro","html_url":"https://github.com/jenswi-linaro","followers_url":"https://api.github.com/users/jenswi-linaro/followers","following_url":"https://api.github.com/users/jenswi-linaro/following{/other_user}","gists_url":"https://api.github.com/users/jenswi-linaro/gists{/gist_id}","starred_url":"https://api.github.com/users/jenswi-linaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenswi-linaro/subscriptions","organizations_url":"https://api.github.com/users/jenswi-linaro/orgs","repos_url":"https://api.github.com/users/jenswi-linaro/repos","events_url":"https://api.github.com/users/jenswi-linaro/events{/privacy}","received_events_url":"https://api.github.com/users/jenswi-linaro/received_events","type":"User","site_admin":false},"body":"Switch to handle aborts in system mode in order to be able to give a\r\nstack trace in case an abort occurs in the abort handler.\r\n\r\nIn a manner similar to the AArch64 implementation are abort and undef\r\nmode stack pointers pointing to the struct thread_core_local of\r\ncorresponding cpu.\r\n\r\nTested-by: Jens Wiklander <jens.wiklander@linaro.org> (Hikey)\r\nSigned-off-by: Jens Wiklander <jens.wiklander@linaro.org>","created_at":"2017-07-18T14:55:21Z","updated_at":"2017-08-17T06:44:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"34aada99e5bdd237c5ede294e35dd40c0b26a971","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/OP-TEE/optee_os/pulls/1703/commits","review_comments_url":"https://api.github.com/repos/OP-TEE/optee_os/pulls/1703/comments","review_comment_url":"https://api.github.com/repos/OP-TEE/optee_os/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OP-TEE/optee_os/issues/1703/comments","statuses_url":"https://api.github.com/repos/OP-TEE/optee_os/statuses/2531f34c995d9ed5196a9a40154e946cd4545bd1","head":{"label":"jenswi-linaro:system_mode","ref":"system_mode","sha":"2531f34c995d9ed5196a9a40154e946cd4545bd1","user":{"login":"jenswi-linaro","id":6150306,"avatar_url":"https://avatars0.githubusercontent.com/u/6150306?v=4","gravatar_id":"","url":"https://api.github.com/users/jenswi-linaro","html_url":"https://github.com/jenswi-linaro","followers_url":"https://api.github.com/users/jenswi-linaro/followers","following_url":"https://api.github.com/users/jenswi-linaro/following{/other_user}","gists_url":"https://api.github.com/users/jenswi-linaro/gists{/gist_id}","starred_url":"https://api.github.com/users/jenswi-linaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenswi-linaro/subscriptions","organizations_url":"https://api.github.com/users/jenswi-linaro/orgs","repos_url":"https://api.github.com/users/jenswi-linaro/repos","events_url":"https://api.github.com/users/jenswi-linaro/events{/privacy}","received_events_url":"https://api.github.com/users/jenswi-linaro/received_events","type":"User","site_admin":false},"repo":{"id":20770355,"name":"optee_os","full_name":"jenswi-linaro/optee_os","owner":{"login":"jenswi-linaro","id":6150306,"avatar_url":"https://avatars0.githubusercontent.com/u/6150306?v=4","gravatar_id":"","url":"https://api.github.com/users/jenswi-linaro","html_url":"https://github.com/jenswi-linaro","followers_url":"https://api.github.com/users/jenswi-linaro/followers","following_url":"https://api.github.com/users/jenswi-linaro/following{/other_user}","gists_url":"https://api.github.com/users/jenswi-linaro/gists{/gist_id}","starred_url":"https://api.github.com/users/jenswi-linaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenswi-linaro/subscriptions","organizations_url":"https://api.github.com/users/jenswi-linaro/orgs","repos_url":"https://api.github.com/users/jenswi-linaro/repos","events_url":"https://api.github.com/users/jenswi-linaro/events{/privacy}","received_events_url":"https://api.github.com/users/jenswi-linaro/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jenswi-linaro/optee_os","description":"Trusted side of the TEE","fork":true,"url":"https://api.github.com/repos/jenswi-linaro/optee_os","forks_url":"https://api.github.com/repos/jenswi-linaro/optee_os/forks","keys_url":"https://api.github.com/repos/jenswi-linaro/optee_os/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenswi-linaro/optee_os/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenswi-linaro/optee_os/teams","hooks_url":"https://api.github.com/repos/jenswi-linaro/optee_os/hooks","issue_events_url":"https://api.github.com/repos/jenswi-linaro/optee_os/issues/events{/number}","events_url":"https://api.github.com/repos/jenswi-linaro/optee_os/events","assignees_url":"https://api.github.com/repos/jenswi-linaro/optee_os/assignees{/user}","branches_url":"https://api.github.com/repos/jenswi-linaro/optee_os/branches{/branch}","tags_url":"https://api.github.com/repos/jenswi-linaro/optee_os/tags","blobs_url":"https://api.github.com/repos/jenswi-linaro/optee_os/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenswi-linaro/optee_os/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenswi-linaro/optee_os/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenswi-linaro/optee_os/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenswi-linaro/optee_os/statuses/{sha}","languages_url":"https://api.github.com/repos/jenswi-linaro/optee_os/languages","stargazers_url":"https://api.github.com/repos/jenswi-linaro/optee_os/stargazers","contributors_url":"https://api.github.com/repos/jenswi-linaro/optee_os/contributors","subscribers_url":"https://api.github.com/repos/jenswi-linaro/optee_os/subscribers","subscription_url":"https://api.github.com/repos/jenswi-linaro/optee_os/subscription","commits_url":"https://api.github.com/repos/jenswi-linaro/optee_os/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenswi-linaro/optee_os/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenswi-linaro/optee_os/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenswi-linaro/optee_os/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenswi-linaro/optee_os/contents/{+path}","compare_url":"https://api.github.com/repos/jenswi-linaro/optee_os/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenswi-linaro/optee_os/merges","archive_url":"https://api.github.com/repos/jenswi-linaro/optee_os/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenswi-linaro/optee_os/downloads","issues_url":"https://api.github.com/repos/jenswi-linaro/optee_os/issues{/number}","pulls_url":"https://api.github.com/repos/jenswi-linaro/optee_os/pulls{/number}","milestones_url":"https://api.github.com/repos/jenswi-linaro/optee_os/milestones{/number}","notifications_url":"https://api.github.com/repos/jenswi-linaro/optee_os/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenswi-linaro/optee_os/labels{/name}","releases_url":"https://api.github.com/repos/jenswi-linaro/optee_os/releases{/id}","deployments_url":"https://api.github.com/repos/jenswi-linaro/optee_os/deployments","created_at":"2014-06-12T14:26:39Z","updated_at":"2016-01-15T08:39:54Z","pushed_at":"2017-08-17T06:21:27Z","git_url":"git://github.com/jenswi-linaro/optee_os.git","ssh_url":"git@github.com:jenswi-linaro/optee_os.git","clone_url":"https://github.com/jenswi-linaro/optee_os.git","svn_url":"https://github.com/jenswi-linaro/optee_os","homepage":null,"size":8541,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"OP-TEE:master","ref":"master","sha":"9aea3dc83a965fda0af1e6e06e6f678757aa60c8","user":{"login":"OP-TEE","id":7488961,"avatar_url":"https://avatars1.githubusercontent.com/u/7488961?v=4","gravatar_id":"","url":"https://api.github.com/users/OP-TEE","html_url":"https://github.com/OP-TEE","followers_url":"https://api.github.com/users/OP-TEE/followers","following_url":"https://api.github.com/users/OP-TEE/following{/other_user}","gists_url":"https://api.github.com/users/OP-TEE/gists{/gist_id}","starred_url":"https://api.github.com/users/OP-TEE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OP-TEE/subscriptions","organizations_url":"https://api.github.com/users/OP-TEE/orgs","repos_url":"https://api.github.com/users/OP-TEE/repos","events_url":"https://api.github.com/users/OP-TEE/events{/privacy}","received_events_url":"https://api.github.com/users/OP-TEE/received_events","type":"Organization","site_admin":false},"repo":{"id":20193261,"name":"optee_os","full_name":"OP-TEE/optee_os","owner":{"login":"OP-TEE","id":7488961,"avatar_url":"https://avatars1.githubusercontent.com/u/7488961?v=4","gravatar_id":"","url":"https://api.github.com/users/OP-TEE","html_url":"https://github.com/OP-TEE","followers_url":"https://api.github.com/users/OP-TEE/followers","following_url":"https://api.github.com/users/OP-TEE/following{/other_user}","gists_url":"https://api.github.com/users/OP-TEE/gists{/gist_id}","starred_url":"https://api.github.com/users/OP-TEE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OP-TEE/subscriptions","organizations_url":"https://api.github.com/users/OP-TEE/orgs","repos_url":"https://api.github.com/users/OP-TEE/repos","events_url":"https://api.github.com/users/OP-TEE/events{/privacy}","received_events_url":"https://api.github.com/users/OP-TEE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OP-TEE/optee_os","description":"Trusted side of the TEE","fork":false,"url":"https://api.github.com/repos/OP-TEE/optee_os","forks_url":"https://api.github.com/repos/OP-TEE/optee_os/forks","keys_url":"https://api.github.com/repos/OP-TEE/optee_os/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OP-TEE/optee_os/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OP-TEE/optee_os/teams","hooks_url":"https://api.github.com/repos/OP-TEE/optee_os/hooks","issue_events_url":"https://api.github.com/repos/OP-TEE/optee_os/issues/events{/number}","events_url":"https://api.github.com/repos/OP-TEE/optee_os/events","assignees_url":"https://api.github.com/repos/OP-TEE/optee_os/assignees{/user}","branches_url":"https://api.github.com/repos/OP-TEE/optee_os/branches{/branch}","tags_url":"https://api.github.com/repos/OP-TEE/optee_os/tags","blobs_url":"https://api.github.com/repos/OP-TEE/optee_os/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OP-TEE/optee_os/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OP-TEE/optee_os/git/refs{/sha}","trees_url":"https://api.github.com/repos/OP-TEE/optee_os/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OP-TEE/optee_os/statuses/{sha}","languages_url":"https://api.github.com/repos/OP-TEE/optee_os/languages","stargazers_url":"https://api.github.com/repos/OP-TEE/optee_os/stargazers","contributors_url":"https://api.github.com/repos/OP-TEE/optee_os/contributors","subscribers_url":"https://api.github.com/repos/OP-TEE/optee_os/subscribers","subscription_url":"https://api.github.com/repos/OP-TEE/optee_os/subscription","commits_url":"https://api.github.com/repos/OP-TEE/optee_os/commits{/sha}","git_commits_url":"https://api.github.com/repos/OP-TEE/optee_os/git/commits{/sha}","comments_url":"https://api.github.com/repos/OP-TEE/optee_os/comments{/number}","issue_comment_url":"https://api.github.com/repos/OP-TEE/optee_os/issues/comments{/number}","contents_url":"https://api.github.com/repos/OP-TEE/optee_os/contents/{+path}","compare_url":"https://api.github.com/repos/OP-TEE/optee_os/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OP-TEE/optee_os/merges","archive_url":"https://api.github.com/repos/OP-TEE/optee_os/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OP-TEE/optee_os/downloads","issues_url":"https://api.github.com/repos/OP-TEE/optee_os/issues{/number}","pulls_url":"https://api.github.com/repos/OP-TEE/optee_os/pulls{/number}","milestones_url":"https://api.github.com/repos/OP-TEE/optee_os/milestones{/number}","notifications_url":"https://api.github.com/repos/OP-TEE/optee_os/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OP-TEE/optee_os/labels{/name}","releases_url":"https://api.github.com/repos/OP-TEE/optee_os/releases{/id}","deployments_url":"https://api.github.com/repos/OP-TEE/optee_os/deployments","created_at":"2014-05-26T17:18:57Z","updated_at":"2017-08-11T02:29:44Z","pushed_at":"2017-08-16T16:29:57Z","git_url":"git://github.com/OP-TEE/optee_os.git","ssh_url":"git@github.com:OP-TEE/optee_os.git","clone_url":"https://github.com/OP-TEE/optee_os.git","svn_url":"https://github.com/OP-TEE/optee_os","homepage":null,"size":11351,"stargazers_count":275,"watchers_count":275,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":248,"mirror_url":null,"open_issues_count":135,"forks":248,"open_issues":135,"watchers":275,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OP-TEE/optee_os/pulls/1703"},"html":{"href":"https://github.com/OP-TEE/optee_os/pull/1703"},"issue":{"href":"https://api.github.com/repos/OP-TEE/optee_os/issues/1703"},"comments":{"href":"https://api.github.com/repos/OP-TEE/optee_os/issues/1703/comments"},"review_comments":{"href":"https://api.github.com/repos/OP-TEE/optee_os/pulls/1703/comments"},"review_comment":{"href":"https://api.github.com/repos/OP-TEE/optee_os/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OP-TEE/optee_os/pulls/1703/commits"},"statuses":{"href":"https://api.github.com/repos/OP-TEE/optee_os/statuses/2531f34c995d9ed5196a9a40154e946cd4545bd1"}}}}
{"actor":{"display_login":"jenswi-linaro"}}