2 * ARM signal handling routines
4 * Copyright 2002 Marcus Meissner, SuSE Linux AG
5 * Copyright 2010, 2011 André Hentschel
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #include "wine/port.h"
36 #ifdef HAVE_SYS_PARAM_H
37 # include <sys/param.h>
42 # ifdef HAVE_SYS_SYSCALL_H
43 # include <sys/syscall.h>
46 #ifdef HAVE_SYS_SIGNAL_H
47 # include <sys/signal.h>
51 #define WIN32_NO_STATUS
54 #include "wine/library.h"
55 #include "wine/exception.h"
56 #include "ntdll_misc.h"
57 #include "wine/debug.h"
60 WINE_DEFAULT_DEBUG_CHANNEL(seh);
62 static pthread_key_t teb_key;
64 /***********************************************************************
65 * signal context platform-specific definitions
69 /* All Registers access - only for local access */
70 # define REG_sig(reg_name, context) ((context)->uc_mcontext.reg_name)
71 # define REGn_sig(reg_num, context) ((context)->uc_mcontext.arm_r##reg_num)
73 /* Special Registers access */
74 # define SP_sig(context) REG_sig(arm_sp, context) /* Stack pointer */
75 # define LR_sig(context) REG_sig(arm_lr, context) /* Link register */
76 # define PC_sig(context) REG_sig(arm_pc, context) /* Program counter */
77 # define CPSR_sig(context) REG_sig(arm_cpsr, context) /* Current State Register */
78 # define IP_sig(context) REG_sig(arm_ip, context) /* Program counter (2?) */
79 # define FP_sig(context) REG_sig(arm_fp, context) /* Frame pointer */
83 typedef int (*wine_signal_handler)(unsigned int sig);
85 static wine_signal_handler handlers[256];
87 /***********************************************************************
90 static inline int dispatch_signal(unsigned int sig)
92 if (handlers[sig] == NULL) return 0;
93 return handlers[sig](sig);
96 /*******************************************************************
99 static inline BOOL is_valid_frame( void *frame )
101 if ((ULONG_PTR)frame & 3) return FALSE;
102 return (frame >= NtCurrentTeb()->Tib.StackLimit &&
103 (void **)frame < (void **)NtCurrentTeb()->Tib.StackBase - 1);
106 /***********************************************************************
109 * Set the register values from a sigcontext.
111 static void save_context( CONTEXT *context, const ucontext_t *sigcontext )
113 #define C(x) context->R##x = REGn_sig(x,sigcontext)
114 /* Save normal registers */
115 C(0); C(1); C(2); C(3); C(4); C(5); C(6); C(7); C(8); C(9); C(10);
118 context->ContextFlags = CONTEXT_FULL;
119 context->Sp = SP_sig(sigcontext); /* Stack pointer */
120 context->Lr = LR_sig(sigcontext); /* Link register */
121 context->Pc = PC_sig(sigcontext); /* Program Counter */
122 context->Cpsr = CPSR_sig(sigcontext); /* Current State Register */
123 context->Ip = IP_sig(sigcontext); /* Intra-Procedure-call scratch register */
124 context->Fp = FP_sig(sigcontext); /* Frame pointer */
128 /***********************************************************************
131 * Build a sigcontext from the register values.
133 static void restore_context( const CONTEXT *context, ucontext_t *sigcontext )
135 #define C(x) REGn_sig(x,sigcontext) = context->R##x
136 /* Restore normal registers */
137 C(0); C(1); C(2); C(3); C(4); C(5); C(6); C(7); C(8); C(9); C(10);
140 SP_sig(sigcontext) = context->Sp; /* Stack pointer */
141 LR_sig(sigcontext) = context->Lr ; /* Link register */
142 PC_sig(sigcontext) = context->Pc; /* Program Counter */
143 CPSR_sig(sigcontext) = context->Cpsr; /* Current State Register */
144 IP_sig(sigcontext) = context->Ip; /* Intra-Procedure-call scratch register */
145 FP_sig(sigcontext) = context->Fp; /* Frame pointer */
149 /***********************************************************************
152 * Set the FPU context from a sigcontext.
154 static inline void save_fpu( CONTEXT *context, const ucontext_t *sigcontext )
156 FIXME("not implemented\n");
160 /***********************************************************************
163 * Restore the FPU context to a sigcontext.
165 static inline void restore_fpu( CONTEXT *context, const ucontext_t *sigcontext )
167 FIXME("not implemented\n");
171 /***********************************************************************
172 * RtlCaptureContext (NTDLL.@)
174 /* FIXME: Use the Stack instead of the actual register values */
175 __ASM_STDCALL_FUNC( RtlCaptureContext, 4,
177 "stmfd SP!, {r1}\n\t"
178 "mov r1, #0x40\n\t" /* CONTEXT_ARM */
179 "add r1, r1, #0x3\n\t" /* CONTEXT_FULL */
180 "str r1, [r0]\n\t" /* context->ContextFlags */
181 "ldmfd SP!, {r1}\n\t"
182 "str r0, [r0, #0x4]\n\t" /* context->R0 */
183 "str r1, [r0, #0x8]\n\t" /* context->R1 */
184 "str r2, [r0, #0xc]\n\t" /* context->R2 */
185 "str r3, [r0, #0x10]\n\t" /* context->R3 */
186 "str r4, [r0, #0x14]\n\t" /* context->R4 */
187 "str r5, [r0, #0x18]\n\t" /* context->R5 */
188 "str r6, [r0, #0x1c]\n\t" /* context->R6 */
189 "str r7, [r0, #0x20]\n\t" /* context->R7 */
190 "str r8, [r0, #0x24]\n\t" /* context->R8 */
191 "str r9, [r0, #0x28]\n\t" /* context->R9 */
192 "str r10, [r0, #0x2c]\n\t" /* context->R10 */
193 "str r11, [r0, #0x30]\n\t" /* context->Fp */
194 "str IP, [r0, #0x34]\n\t" /* context->Ip */
195 "str SP, [r0, #0x38]\n\t" /* context->Sp */
196 "str LR, [r0, #0x3c]\n\t" /* context->Lr */
197 "str LR, [r0, #0x40]\n\t" /* context->Pc */
199 "str r1, [r0, #0x44]\n\t" /* context->Cpsr */
204 /***********************************************************************
207 * Set the new CPU context.
209 void set_cpu_context( const CONTEXT *context )
211 FIXME("not implemented\n");
216 /***********************************************************************
219 * Copy a register context according to the flags.
221 void copy_context( CONTEXT *to, const CONTEXT *from, DWORD flags )
223 flags &= ~CONTEXT_ARM; /* get rid of CPU id */
224 if (flags & CONTEXT_CONTROL)
229 to->Cpsr = from->Cpsr;
231 if (flags & CONTEXT_INTEGER)
250 /***********************************************************************
253 * Convert a register context to the server format.
255 NTSTATUS context_to_server( context_t *to, const CONTEXT *from )
257 DWORD flags = from->ContextFlags & ~CONTEXT_ARM; /* get rid of CPU id */
259 memset( to, 0, sizeof(*to) );
262 if (flags & CONTEXT_CONTROL)
264 to->flags |= SERVER_CTX_CONTROL;
265 to->ctl.arm_regs.sp = from->Sp;
266 to->ctl.arm_regs.lr = from->Lr;
267 to->ctl.arm_regs.pc = from->Pc;
268 to->ctl.arm_regs.cpsr = from->Cpsr;
270 if (flags & CONTEXT_INTEGER)
272 to->flags |= SERVER_CTX_INTEGER;
273 to->integer.arm_regs.r[0] = from->R0;
274 to->integer.arm_regs.r[1] = from->R1;
275 to->integer.arm_regs.r[2] = from->R2;
276 to->integer.arm_regs.r[3] = from->R3;
277 to->integer.arm_regs.r[4] = from->R4;
278 to->integer.arm_regs.r[5] = from->R5;
279 to->integer.arm_regs.r[6] = from->R6;
280 to->integer.arm_regs.r[7] = from->R7;
281 to->integer.arm_regs.r[8] = from->R8;
282 to->integer.arm_regs.r[9] = from->R9;
283 to->integer.arm_regs.r[10] = from->R10;
284 to->integer.arm_regs.r[11] = from->Fp;
285 to->integer.arm_regs.r[12] = from->Ip;
287 return STATUS_SUCCESS;
291 /***********************************************************************
292 * context_from_server
294 * Convert a register context from the server format.
296 NTSTATUS context_from_server( CONTEXT *to, const context_t *from )
298 if (from->cpu != CPU_ARM) return STATUS_INVALID_PARAMETER;
300 to->ContextFlags = CONTEXT_ARM;
301 if (from->flags & SERVER_CTX_CONTROL)
303 to->ContextFlags |= CONTEXT_CONTROL;
304 to->Sp = from->ctl.arm_regs.sp;
305 to->Lr = from->ctl.arm_regs.lr;
306 to->Pc = from->ctl.arm_regs.pc;
307 to->Cpsr = from->ctl.arm_regs.cpsr;
309 if (from->flags & SERVER_CTX_INTEGER)
311 to->ContextFlags |= CONTEXT_INTEGER;
312 to->R0 = from->integer.arm_regs.r[0];
313 to->R1 = from->integer.arm_regs.r[1];
314 to->R2 = from->integer.arm_regs.r[2];
315 to->R3 = from->integer.arm_regs.r[3];
316 to->R4 = from->integer.arm_regs.r[4];
317 to->R5 = from->integer.arm_regs.r[5];
318 to->R6 = from->integer.arm_regs.r[6];
319 to->R7 = from->integer.arm_regs.r[7];
320 to->R8 = from->integer.arm_regs.r[8];
321 to->R9 = from->integer.arm_regs.r[9];
322 to->R10 = from->integer.arm_regs.r[10];
323 to->Fp = from->integer.arm_regs.r[11];
324 to->Ip = from->integer.arm_regs.r[12];
326 return STATUS_SUCCESS;
330 /**********************************************************************
331 * call_stack_handlers
333 * Call the stack handlers chain.
335 static NTSTATUS call_stack_handlers( EXCEPTION_RECORD *rec, CONTEXT *context )
337 EXCEPTION_REGISTRATION_RECORD *frame, *dispatch, *nested_frame;
340 frame = NtCurrentTeb()->Tib.ExceptionList;
342 while (frame != (EXCEPTION_REGISTRATION_RECORD*)~0UL)
344 /* Check frame address */
345 if (!is_valid_frame( frame ))
347 rec->ExceptionFlags |= EH_STACK_INVALID;
352 TRACE( "calling handler at %p code=%x flags=%x\n",
353 frame->Handler, rec->ExceptionCode, rec->ExceptionFlags );
354 res = frame->Handler( rec, frame, context, &dispatch );
355 TRACE( "handler at %p returned %x\n", frame->Handler, res );
357 if (frame == nested_frame)
359 /* no longer nested */
361 rec->ExceptionFlags &= ~EH_NESTED_CALL;
366 case ExceptionContinueExecution:
367 if (!(rec->ExceptionFlags & EH_NONCONTINUABLE)) return STATUS_SUCCESS;
368 return STATUS_NONCONTINUABLE_EXCEPTION;
369 case ExceptionContinueSearch:
371 case ExceptionNestedException:
372 if (nested_frame < dispatch) nested_frame = dispatch;
373 rec->ExceptionFlags |= EH_NESTED_CALL;
376 return STATUS_INVALID_DISPOSITION;
380 return STATUS_UNHANDLED_EXCEPTION;
384 /*******************************************************************
387 * Implementation of NtRaiseException.
389 static NTSTATUS raise_exception( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance )
397 for (c = 0; c < rec->NumberParameters; c++)
398 TRACE( " info[%d]=%08lx\n", c, rec->ExceptionInformation[c] );
399 if (rec->ExceptionCode == EXCEPTION_WINE_STUB)
401 if (rec->ExceptionInformation[1] >> 16)
402 MESSAGE( "wine: Call from %p to unimplemented function %s.%s, aborting\n",
403 rec->ExceptionAddress,
404 (char*)rec->ExceptionInformation[0], (char*)rec->ExceptionInformation[1] );
406 MESSAGE( "wine: Call from %p to unimplemented function %s.%ld, aborting\n",
407 rec->ExceptionAddress,
408 (char*)rec->ExceptionInformation[0], rec->ExceptionInformation[1] );
412 TRACE(" Pc:%04x Sp:%04x Lr:%04x Cpsr:%04x r0:%04x r1:%04x r2:%04x r3:%04x\n",
413 context->Pc, context->Sp, context->Lr, context->Cpsr,
414 context->R0, context->R1, context->R2, context->R3);
415 TRACE(" r4:%04x r5:%04x r6:%04x r7:%04x r8:%04x r9:%04x r10:%04x Fp:%04x Ip:%04x\n",
416 context->R4, context->R5, context->R6, context->R7, context->R8,
417 context->R9, context->R10, context->Fp, context->Ip );
420 status = send_debug_event( rec, TRUE, context );
421 if (status == DBG_CONTINUE || status == DBG_EXCEPTION_HANDLED)
422 return STATUS_SUCCESS;
424 if (call_vectored_handlers( rec, context ) == EXCEPTION_CONTINUE_EXECUTION)
425 return STATUS_SUCCESS;
427 if ((status = call_stack_handlers( rec, context )) != STATUS_UNHANDLED_EXCEPTION)
431 /* last chance exception */
433 status = send_debug_event( rec, FALSE, context );
434 if (status != DBG_CONTINUE)
436 if (rec->ExceptionFlags & EH_STACK_INVALID)
437 ERR("Exception frame is not in stack limits => unable to dispatch exception.\n");
438 else if (rec->ExceptionCode == STATUS_NONCONTINUABLE_EXCEPTION)
439 ERR("Process attempted to continue execution after noncontinuable exception.\n");
441 ERR("Unhandled exception code %x flags %x addr %p\n",
442 rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress );
443 NtTerminateProcess( NtCurrentProcess(), rec->ExceptionCode );
445 return STATUS_SUCCESS;
449 /**********************************************************************
452 * Handler for SIGSEGV and related errors.
454 static void segv_handler( int signal, siginfo_t *info, void *ucontext )
456 EXCEPTION_RECORD rec;
460 rec.ExceptionCode = EXCEPTION_ACCESS_VIOLATION;
462 /* we want the page-fault case to be fast */
463 if ( info->si_code == SEGV_ACCERR )
464 if (!(rec.ExceptionCode = virtual_handle_fault( info->si_addr, 0 ))) return;
466 save_context( &context, ucontext );
467 rec.ExceptionRecord = NULL;
468 rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
469 rec.ExceptionAddress = (LPVOID)context.Pc;
470 rec.NumberParameters = 2;
471 rec.ExceptionInformation[0] = 0; /* FIXME: read/write access ? */
472 rec.ExceptionInformation[1] = (ULONG_PTR)info->si_addr;
474 status = raise_exception( &rec, &context, TRUE );
475 if (status) raise_status( status, &rec );
476 restore_context( &context, ucontext );
479 /**********************************************************************
482 * Handler for SIGTRAP.
484 static void trap_handler( int signal, siginfo_t *info, void *ucontext )
486 EXCEPTION_RECORD rec;
490 switch ( info->si_code )
493 rec.ExceptionCode = EXCEPTION_SINGLE_STEP;
497 rec.ExceptionCode = EXCEPTION_BREAKPOINT;
501 save_context( &context, ucontext );
502 rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
503 rec.ExceptionRecord = NULL;
504 rec.ExceptionAddress = (LPVOID)context.Pc;
505 rec.NumberParameters = 0;
506 status = raise_exception( &rec, &context, TRUE );
507 if (status) raise_status( status, &rec );
508 restore_context( &context, ucontext );
511 /**********************************************************************
514 * Handler for SIGFPE.
516 static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext )
518 EXCEPTION_RECORD rec;
522 save_fpu( &context, sigcontext );
523 save_context( &context, sigcontext );
525 switch (siginfo->si_code & 0xffff )
529 rec.ExceptionCode = EXCEPTION_ARRAY_BOUNDS_EXCEEDED;
534 rec.ExceptionCode = EXCEPTION_INT_DIVIDE_BY_ZERO;
539 rec.ExceptionCode = EXCEPTION_INT_OVERFLOW;
544 rec.ExceptionCode = EXCEPTION_FLT_DIVIDE_BY_ZERO;
549 rec.ExceptionCode = EXCEPTION_FLT_OVERFLOW;
554 rec.ExceptionCode = EXCEPTION_FLT_UNDERFLOW;
559 rec.ExceptionCode = EXCEPTION_FLT_INEXACT_RESULT;
566 rec.ExceptionCode = EXCEPTION_FLT_INVALID_OPERATION;
569 rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
570 rec.ExceptionRecord = NULL;
571 rec.ExceptionAddress = (LPVOID)context.Pc;
572 rec.NumberParameters = 0;
573 status = raise_exception( &rec, &context, TRUE );
574 if (status) raise_status( status, &rec );
576 restore_context( &context, sigcontext );
577 restore_fpu( &context, sigcontext );
580 /**********************************************************************
583 * Handler for SIGINT.
585 static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext )
587 if (!dispatch_signal(SIGINT))
589 EXCEPTION_RECORD rec;
593 save_context( &context, sigcontext );
594 rec.ExceptionCode = CONTROL_C_EXIT;
595 rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
596 rec.ExceptionRecord = NULL;
597 rec.ExceptionAddress = (LPVOID)context.Pc;
598 rec.NumberParameters = 0;
599 status = raise_exception( &rec, &context, TRUE );
600 if (status) raise_status( status, &rec );
601 restore_context( &context, sigcontext );
606 /**********************************************************************
609 * Handler for SIGABRT.
611 static void abrt_handler( int signal, siginfo_t *siginfo, void *sigcontext )
613 EXCEPTION_RECORD rec;
617 save_context( &context, sigcontext );
618 rec.ExceptionCode = EXCEPTION_WINE_ASSERTION;
619 rec.ExceptionFlags = EH_NONCONTINUABLE;
620 rec.ExceptionRecord = NULL;
621 rec.ExceptionAddress = (LPVOID)context.Pc;
622 rec.NumberParameters = 0;
623 status = raise_exception( &rec, &context, TRUE );
624 if (status) raise_status( status, &rec );
625 restore_context( &context, sigcontext );
629 /**********************************************************************
632 * Handler for SIGQUIT.
634 static void quit_handler( int signal, siginfo_t *siginfo, void *sigcontext )
640 /**********************************************************************
643 * Handler for SIGUSR1, used to signal a thread that it got suspended.
645 static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext )
649 save_context( &context, sigcontext );
650 wait_suspend( &context );
651 restore_context( &context, sigcontext );
655 /***********************************************************************
656 * __wine_set_signal_handler (NTDLL.@)
658 int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh)
660 if (sig > sizeof(handlers) / sizeof(handlers[0])) return -1;
661 if (handlers[sig] != NULL) return -2;
667 /**********************************************************************
668 * signal_alloc_thread
670 NTSTATUS signal_alloc_thread( TEB **teb )
672 static size_t sigstack_zero_bits;
676 if (!sigstack_zero_bits)
678 size_t min_size = getpagesize(); /* this is just for the TEB, we don't use a signal stack yet */
679 /* find the first power of two not smaller than min_size */
680 while ((1u << sigstack_zero_bits) < min_size) sigstack_zero_bits++;
681 assert( sizeof(TEB) <= min_size );
684 size = 1 << sigstack_zero_bits;
686 if (!(status = NtAllocateVirtualMemory( NtCurrentProcess(), (void **)teb, sigstack_zero_bits,
687 &size, MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE )))
689 (*teb)->Tib.Self = &(*teb)->Tib;
690 (*teb)->Tib.ExceptionList = (void *)~0UL;
696 /**********************************************************************
699 void signal_free_thread( TEB *teb )
703 if (teb->DeallocationStack)
706 NtFreeVirtualMemory( GetCurrentProcess(), &teb->DeallocationStack, &size, MEM_RELEASE );
709 NtFreeVirtualMemory( NtCurrentProcess(), (void **)&teb, &size, MEM_RELEASE );
713 /**********************************************************************
716 void signal_init_thread( TEB *teb )
718 static int init_done;
722 pthread_key_create( &teb_key, NULL );
725 pthread_setspecific( teb_key, teb );
729 /**********************************************************************
730 * signal_init_process
732 void signal_init_process(void)
734 struct sigaction sig_act;
736 sig_act.sa_mask = server_block_set;
737 sig_act.sa_flags = SA_RESTART | SA_SIGINFO;
739 sig_act.sa_sigaction = int_handler;
740 if (sigaction( SIGINT, &sig_act, NULL ) == -1) goto error;
741 sig_act.sa_sigaction = fpe_handler;
742 if (sigaction( SIGFPE, &sig_act, NULL ) == -1) goto error;
743 sig_act.sa_sigaction = abrt_handler;
744 if (sigaction( SIGABRT, &sig_act, NULL ) == -1) goto error;
745 sig_act.sa_sigaction = quit_handler;
746 if (sigaction( SIGQUIT, &sig_act, NULL ) == -1) goto error;
747 sig_act.sa_sigaction = usr1_handler;
748 if (sigaction( SIGUSR1, &sig_act, NULL ) == -1) goto error;
750 sig_act.sa_sigaction = segv_handler;
751 if (sigaction( SIGSEGV, &sig_act, NULL ) == -1) goto error;
752 if (sigaction( SIGILL, &sig_act, NULL ) == -1) goto error;
754 if (sigaction( SIGBUS, &sig_act, NULL ) == -1) goto error;
758 sig_act.sa_sigaction = trap_handler;
759 if (sigaction( SIGTRAP, &sig_act, NULL ) == -1) goto error;
769 /**********************************************************************
770 * __wine_enter_vm86 (NTDLL.@)
772 void __wine_enter_vm86( CONTEXT *context )
774 MESSAGE("vm86 mode not supported on this platform\n");
777 /***********************************************************************
778 * RtlUnwind (NTDLL.@)
780 void WINAPI RtlUnwind( PVOID pEndFrame, PVOID targetIp, PEXCEPTION_RECORD pRecord, PVOID retval )
782 FIXME( "Not implemented on ARM\n" );
785 /*******************************************************************
786 * NtRaiseException (NTDLL.@)
788 NTSTATUS WINAPI NtRaiseException( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance )
790 NTSTATUS status = raise_exception( rec, context, first_chance );
791 if (status == STATUS_SUCCESS) NtSetContextThread( GetCurrentThread(), context );
795 /***********************************************************************
796 * RtlRaiseException (NTDLL.@)
798 void WINAPI RtlRaiseException( EXCEPTION_RECORD *rec )
803 RtlCaptureContext( &context );
804 rec->ExceptionAddress = (LPVOID)context.Pc;
805 status = raise_exception( rec, &context, TRUE );
806 if (status) raise_status( status, rec );
809 /*************************************************************************
810 * RtlCaptureStackBackTrace (NTDLL.@)
812 USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, ULONG *hash )
814 FIXME( "(%d, %d, %p, %p) stub!\n", skip, count, buffer, hash );
818 /***********************************************************************
819 * call_thread_entry_point
821 void call_thread_entry_point( LPTHREAD_START_ROUTINE entry, void *arg )
825 exit_thread( entry( arg ));
827 __EXCEPT(unhandled_exception_filter)
829 NtTerminateThread( GetCurrentThread(), GetExceptionCode() );
832 abort(); /* should not be reached */
835 /***********************************************************************
836 * RtlExitUserThread (NTDLL.@)
838 void WINAPI RtlExitUserThread( ULONG status )
840 exit_thread( status );
843 /***********************************************************************
846 void abort_thread( int status )
848 terminate_thread( status );
851 /**********************************************************************
852 * DbgBreakPoint (NTDLL.@)
854 void WINAPI DbgBreakPoint(void)
856 kill(getpid(), SIGTRAP);
859 /**********************************************************************
860 * DbgUserBreakPoint (NTDLL.@)
862 void WINAPI DbgUserBreakPoint(void)
864 kill(getpid(), SIGTRAP);
867 /**********************************************************************
868 * NtCurrentTeb (NTDLL.@)
870 TEB * WINAPI NtCurrentTeb(void)
872 return pthread_getspecific( teb_key );