--- Gnu-Mach/kern/exception.c 2020/09/02 04:36:56 1.1.1.1 +++ Gnu-Mach/kern/exception.c 2020/09/02 04:45:13 1.1.1.5 @@ -1,39 +1,38 @@ -/* +/* * Mach Operating System * Copyright (c) 1993,1992,1991,1990,1989,1988,1987 Carnegie Mellon University. * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ -#include -#include - #include #include #include #include #include +#include #include #include +#include #include #include #include @@ -41,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -51,15 +51,15 @@ -extern void exception(); -extern void exception_try_task(); -extern void exception_no_server(); +extern void exception() __attribute__ ((noreturn)); +extern void exception_try_task() __attribute__ ((noreturn)); +extern void exception_no_server() __attribute__ ((noreturn)); -extern void exception_raise(); +extern void exception_raise() __attribute__ ((noreturn)); extern kern_return_t exception_parse_reply(); -extern void exception_raise_continue(); -extern void exception_raise_continue_slow(); -extern void exception_raise_continue_fast(); +extern void exception_raise_continue() __attribute__ ((noreturn)); +extern void exception_raise_continue_slow() __attribute__ ((noreturn)); +extern void exception_raise_continue_fast() __attribute__ ((noreturn)); #if MACH_KDB extern void thread_kdb_return(); @@ -76,7 +76,7 @@ boolean_t debug_user_with_kdb = FALSE; * The exception function is expected to return. * So the return statements along the slow paths are important. */ -#endif KEEP_STACKS +#endif /* KEEP_STACKS */ /* * Routine: exception @@ -113,7 +113,6 @@ exception(_exception, code, subcode) ith_unlock(self); exception_try_task(_exception, code, subcode); /*NOTREACHED*/ - return; } ip_lock(exc_port); @@ -122,7 +121,6 @@ exception(_exception, code, subcode) ip_unlock(exc_port); exception_try_task(_exception, code, subcode); /*NOTREACHED*/ - return; } /* @@ -183,7 +181,6 @@ exception_try_task(_exception, code, sub itk_unlock(task); exception_no_server(); /*NOTREACHED*/ - return; } ip_lock(exc_port); @@ -192,7 +189,6 @@ exception_try_task(_exception, code, sub ip_unlock(exc_port); exception_no_server(); /*NOTREACHED*/ - return; } /* @@ -244,8 +240,10 @@ exception_no_server() thread_halt_self(); +#if 0 if (thread_suspend (self) == KERN_SUCCESS) thread_exception_return (); +#endif #if MACH_KDB if (debug_user_with_kdb) { @@ -258,7 +256,7 @@ exception_no_server() db_printf("No exception server, calling kdb...\n"); thread_kdb_return(); } -#endif MACH_KDB +#endif /* MACH_KDB */ /* * All else failed; terminate task. @@ -266,6 +264,7 @@ exception_no_server() (void) task_terminate(self->task); thread_halt_self(); + panic("terminating the task didn't kill us"); /*NOTREACHED*/ } @@ -418,9 +417,6 @@ exception_raise(dest_port, thread_port, } if (!ip_active(dest_port) || -#if NORMA_IPC - IP_NORMA_IS_PROXY(dest_port) || -#endif NORMA_IPC (dest_port->ip_receiver == ipc_space_kernel)) { imq_unlock(reply_mqueue); ip_unlock(dest_port); @@ -697,7 +693,7 @@ exception_raise(dest_port, thread_port, ikm_check_initialized(kmsg, kmsg->ikm_size); assert(kmsg->ikm_size == IKM_SAVED_KMSG_SIZE); - if (copyoutmsg((vm_offset_t) &kmsg->ikm_header, (vm_offset_t)receiver->ith_msg, + if (copyoutmsg(&kmsg->ikm_header, receiver->ith_msg, sizeof(struct mach_exception)) || (ikm_cache() != IKM_NULL)) { mr = ipc_kmsg_put(receiver->ith_msg, kmsg, @@ -759,7 +755,6 @@ exception_raise(dest_port, thread_port, ip_unlock(reply_port); exception_raise_continue_slow(MACH_RCV_PORT_DIED, IKM_NULL, /*dummy*/0); /*NOTREACHED*/ - return; } imq_lock(reply_mqueue); @@ -934,7 +929,6 @@ exception_raise_continue_slow(mr, kmsg, (mr == MACH_RCV_PORT_DIED)) { thread_exception_return(); /*NOTREACHED*/ - return; } if (self->ith_exc != KERN_SUCCESS) { @@ -942,7 +936,6 @@ exception_raise_continue_slow(mr, kmsg, self->ith_exc_code, self->ith_exc_subcode); /*NOTREACHED*/ - return; } exception_no_server(); @@ -992,7 +985,6 @@ exception_raise_continue_fast(reply_port if (kr == KERN_SUCCESS) { thread_exception_return(); /*NOTREACHED*/ - return; /* help for the compiler */ } if (self->ith_exc != KERN_SUCCESS) {