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

Unified Diff: src/nonsfi/linux/irt_signal_handling.h

Issue 1212613002: Non-SFI mode: Add Linux asynchronous signal support (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 5 years, 6 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/nonsfi/linux/irt_signal_handling.h
diff --git a/src/nonsfi/linux/irt_signal_handling.h b/src/nonsfi/linux/irt_signal_handling.h
new file mode 100644
index 0000000000000000000000000000000000000000..42e7f9e3af01f2ff97ddf6ed547dd22dea40d4bb
--- /dev/null
+++ b/src/nonsfi/linux/irt_signal_handling.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2015 The Native Client Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef NATIVE_CLIENT_SRC_NONSFI_LINUX_IRT_SIGNAL_HANDLING_H_
+#define NATIVE_CLIENT_SRC_NONSFI_LINUX_IRT_SIGNAL_HANDLING_H_ 1
+
+#include <pthread.h>
+
+#include "native_client/src/include/nacl/nacl_exception.h"
+
+EXTERN_C_BEGIN
+
+#if defined(__i386__)
+
+/* From linux/arch/x86/include/uapi/asm/sigcontext32.h */
+struct sigcontext_ia32 {
+ unsigned short gs, __gsh;
+ unsigned short fs, __fsh;
+ unsigned short es, __esh;
+ unsigned short ds, __dsh;
+ unsigned int di;
+ unsigned int si;
+ unsigned int bp;
+ unsigned int sp;
+ unsigned int bx;
+ unsigned int dx;
+ unsigned int cx;
+ unsigned int ax;
+ unsigned int trapno;
+ unsigned int err;
+ unsigned int ip;
+ unsigned short cs, __csh;
+ unsigned int flags;
+ unsigned int sp_at_signal;
+ unsigned short ss, __ssh;
+ unsigned int fpstate;
+ unsigned int oldmask;
+ unsigned int cr2;
+};
+
+typedef struct sigcontext_ia32 linux_mcontext_t;
+
+#elif defined(__arm__)
+
+/* From linux/arch/arm/include/uapi/asm/sigcontext.h */
+struct sigcontext_arm {
+ uint32_t trap_no;
+ uint32_t error_code;
+ uint32_t oldmask;
+ uint32_t arm_r0;
+ uint32_t arm_r1;
+ uint32_t arm_r2;
+ uint32_t arm_r3;
+ uint32_t arm_r4;
+ uint32_t arm_r5;
+ uint32_t arm_r6;
+ uint32_t arm_r7;
+ uint32_t arm_r8;
+ uint32_t arm_r9;
+ uint32_t arm_r10;
+ uint32_t arm_r11; /* fp */
+ uint32_t arm_r12; /* ip */
+ uint32_t arm_sp;
+ uint32_t arm_lr;
+ uint32_t arm_pc;
+ uint32_t arm_cpsr;
+ uint32_t fault_address;
+};
+
+typedef struct sigcontext_arm linux_mcontext_t;
+
+#else
+#error "unsupported architecture"
+#endif
+
+struct NonSfiExceptionFrame {
+ struct NaClExceptionContext context;
+ struct NaClExceptionPortableContext portable;
+};
+
+extern pthread_mutex_t g_signal_handler_mutex;
+void nonsfi_initialize_signal_handler_locked(void);
+void nonsfi_install_exception_handler_locked(void);
+void exception_frame_from_signal_context(
+ struct NonSfiExceptionFrame *frame,
+ const void *raw_ctx);
+
+EXTERN_C_END
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698