1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19: #include <mach/exc_server.h>
20: #include <hurd/signal.h>
21: #include <assert.h>
22:
23:
24:
25: kern_return_t
26: _S_catch_exception_raise (mach_port_t port,
27: thread_t thread,
28: task_t task,
29: #ifdef EXC_MASK_ALL
30: exception_type_t exception,
31: exception_data_t code,
32: mach_msg_type_number_t codeCnt
33: #else
34: integer_t exception,
35: integer_t code, integer_t subcode
36: #endif
37: )
38: {
39: struct hurd_sigstate *ss;
40: int signo;
41: struct hurd_signal_detail d;
42:
43: if (task != __mach_task_self ())
44:
45: return EPERM;
46:
47: d.exc = exception;
48: #ifdef EXC_MASK_ALL
49: assert (codeCnt >= 2);
50: d.exc_code = code[0];
51: d.exc_subcode = code[1];
52: #else
53: d.exc_code = code;
54: d.exc_subcode = subcode;
55: #endif
56:
57:
58:
59: _hurd_exception2signal (&d, &signo);
60:
61:
62: __mutex_lock (&_hurd_siglock);
63: for (ss = _hurd_sigstates; ss != NULL; ss = ss->next)
64: if (ss->thread == thread)
65: break;
66: __mutex_unlock (&_hurd_siglock);
67: if (ss == NULL)
68: ss = _hurd_thread_sigstate (thread);
69:
70: if (__spin_lock_locked (&ss->lock))
71: {
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83: __spin_unlock (&ss->critical_section_lock);
84: ss->context = NULL;
85: __spin_unlock (&ss->lock);
86: }
87:
88:
89: _hurd_internal_post_signal (ss, signo, &d,
90: MACH_PORT_NULL, MACH_MSG_TYPE_PORT_SEND,
91: 0);
92:
93: return KERN_SUCCESS;
94: }
95:
96: #ifdef EXC_MASK_ALL
97:
98:
99:
100:
101: kern_return_t
102: _S_catch_exception_raise_state (mach_port_t port,
103: exception_type_t exception,
104: exception_data_t code,
105: mach_msg_type_number_t codeCnt,
106: int *flavor,
107: thread_state_t old_state,
108: mach_msg_type_number_t old_stateCnt,
109: thread_state_t new_state,
110: mach_msg_type_number_t *new_stateCnt)
111: {
112: abort ();
113: return KERN_FAILURE;
114: }
115:
116: kern_return_t
117: _S_catch_exception_raise_state_identity (mach_port_t exception_port,
118: thread_t thread,
119: task_t task,
120: exception_type_t exception,
121: exception_data_t code,
122: mach_msg_type_number_t codeCnt,
123: int *flavor,
124: thread_state_t old_state,
125: mach_msg_type_number_t old_stateCnt,
126: thread_state_t new_state,
127: mach_msg_type_number_t *new_stateCnt)
128: {
129: abort ();
130: return KERN_FAILURE;
131: }
132: #endif