Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: src/trusted/service_runtime/arch/mips/sel_rt.c

Issue 1536713003: [MIPS] Make $t8 point to the address of TLS pointers (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client@master
Patch Set: Move EditMipsCode() below EditArmCode(). Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/trusted/service_runtime/arch/mips/sel_rt.c
diff --git a/src/trusted/service_runtime/arch/mips/sel_rt.c b/src/trusted/service_runtime/arch/mips/sel_rt.c
index adadca994e5fb446cf1e40c69b0c97fe3f3255de..7fdef43b9c1601aa010cdfa2e48a75eb2d0633ae 100644
--- a/src/trusted/service_runtime/arch/mips/sel_rt.c
+++ b/src/trusted/service_runtime/arch/mips/sel_rt.c
@@ -8,6 +8,7 @@
* NaCl Secure Runtime
*/
#include "native_client/src/include/portability_string.h"
+#include "native_client/src/shared/platform/nacl_global_secure_random.h"
#include "native_client/src/trusted/service_runtime/nacl_app_thread.h"
#include "native_client/src/trusted/service_runtime/nacl_signal.h"
#include "native_client/src/trusted/service_runtime/nacl_tls.h"
@@ -15,9 +16,11 @@
#include "native_client/src/trusted/service_runtime/sel_rt.h"
#include "native_client/src/trusted/service_runtime/arch/mips/sel_ldr_mips.h"
+uint32_t nacl_guard_token;
+
void NaClInitGlobals(void) {
- NaClLog(2, "NaClInitGlobals\n");
- /* intentionally left empty */
+ NaClLog(2, "NaClInitGlobals\n");
+ nacl_guard_token = NaClGlobalSecureRngUint32();
}
@@ -38,6 +41,8 @@ int NaClAppThreadInitArchSpecific(struct NaClAppThread *natp,
ntcp->tls_idx = NaClTlsAllocate(natp);
if (ntcp->tls_idx == NACL_TLS_INDEX_INVALID)
return 0;
+ ntcp->t8 = (uintptr_t) &ntcp->tls_value1;
+ ntcp->guard_token = nacl_guard_token;
NaClLog(4, "user.tls_idx: 0x%08"NACL_PRIxNACL_REG"\n", ntcp->tls_idx);
NaClLog(4, "user.stack_ptr: 0x%08"NACL_PRIxNACL_REG"\n", ntcp->stack_ptr);
« no previous file with comments | « src/trusted/service_runtime/arch/mips/sel_rt.h ('k') | tests/thread_capture/arch/mips/thread_capture_test_injection.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698