--- Gnu-Mach/kern/machine.c 2020/09/02 04:42:45 1.1.1.2 +++ Gnu-Mach/kern/machine.c 2020/09/02 04:49:53 1.1.1.5 @@ -34,16 +34,14 @@ * Support for machine independent machine abstraction. */ -#include -#include -#include - +#include #include #include #include #include #include #include +#include #include #include #include @@ -53,6 +51,7 @@ #include #include #include /* for splsched */ +#include #include @@ -68,71 +67,16 @@ queue_head_t action_queue; /* assign/shu decl_simple_lock_data(,action_lock); /* - * xxx_host_info: - * - * Return the host_info structure. This routine is exported to the - * user level. - */ -kern_return_t xxx_host_info(task, info) - task_t task; - machine_info_t info; -{ -#ifdef lint - task++; -#endif /* lint */ - *info = machine_info; - return(KERN_SUCCESS); -} - -/* - * xxx_slot_info: - * - * Return the slot_info structure for the specified slot. This routine - * is exported to the user level. - */ -kern_return_t xxx_slot_info(task, slot, info) - task_t task; - int slot; - machine_slot_t info; -{ -#ifdef lint - task++; -#endif /* lint */ - if ((slot < 0) || (slot >= NCPUS)) - return(KERN_INVALID_ARGUMENT); - *info = machine_slot[slot]; - return(KERN_SUCCESS); -} - -/* - * xxx_cpu_control: - * - * Support for user control of cpus. The user indicates which cpu - * he is interested in, and whether or not that cpu should be running. - */ -kern_return_t xxx_cpu_control(task, cpu, runnable) - task_t task; - int cpu; - boolean_t runnable; -{ -#ifdef lint - task++; cpu++; runnable++; -#endif /* lint */ - return(KERN_FAILURE); -} - -/* * cpu_up: * * Flag specified cpu as up and running. Called when a processor comes * online. */ -void cpu_up(cpu) - int cpu; +void cpu_up(int cpu) { - register struct machine_slot *ms; - register processor_t processor; - register spl_t s; + struct machine_slot *ms; + processor_t processor; + spl_t s; processor = cpu_to_processor(cpu); pset_lock(&default_pset); @@ -157,12 +101,11 @@ void cpu_up(cpu) * Flag specified cpu as down. Called when a processor is about to * go offline. */ -void cpu_down(cpu) - int cpu; +void cpu_down(int cpu) { - register struct machine_slot *ms; - register processor_t processor; - register spl_t s; + struct machine_slot *ms; + processor_t processor; + spl_t s; s = splsched(); processor = cpu_to_processor(cpu); @@ -181,14 +124,13 @@ void cpu_down(cpu) kern_return_t host_reboot(host, options) - host_t host; - int options; + const host_t host; + int options; { if (host == HOST_NULL) return (KERN_INVALID_HOST); if (options & RB_DEBUGGER) { - extern void Debugger(); Debugger("Debugger"); } else { #ifdef parisc @@ -209,11 +151,11 @@ host_reboot(host, options) * a reference. */ void -processor_request_action(processor, new_pset) -processor_t processor; -processor_set_t new_pset; +processor_request_action( + processor_t processor, + processor_set_t new_pset) { - register processor_set_t pset; + processor_set_t pset; /* * Processor must be in a processor set. Must lock its idle lock to @@ -284,10 +226,10 @@ processor_set_t new_pset; * Synchronizes with assignment completion if wait is TRUE. */ kern_return_t -processor_assign(processor, new_pset, wait) -processor_t processor; -processor_set_t new_pset; -boolean_t wait; +processor_assign( + processor_t processor, + processor_set_t new_pset, + boolean_t wait) { spl_t s; @@ -328,7 +270,7 @@ Retry: assert_wait((event_t) processor, TRUE); processor_unlock(processor); splx(s); - thread_block((void(*)()) 0); + thread_block(thread_no_continuation); goto Retry; } @@ -357,7 +299,7 @@ Retry: assert_wait((event_t)processor, TRUE); processor_unlock(processor); splx(s); - thread_block((void (*)()) 0); + thread_block(thread_no_continuation); s = splsched(); processor_lock(processor); } @@ -371,14 +313,11 @@ Retry: #else /* MACH_HOST */ kern_return_t -processor_assign(processor, new_pset, wait) -processor_t processor; -processor_set_t new_pset; -boolean_t wait; +processor_assign( + processor_t processor, + processor_set_t new_pset, + boolean_t wait) { -#ifdef lint - processor++; new_pset++; wait++; -#endif return KERN_FAILURE; } @@ -390,8 +329,7 @@ boolean_t wait; * with the shutdown (can be called from interrupt level). */ kern_return_t -processor_shutdown(processor) -processor_t processor; +processor_shutdown(processor_t processor) { spl_t s; @@ -420,12 +358,10 @@ processor_t processor; /* * action_thread() shuts down processors or changes their assignment. */ -void processor_doaction(); /* forward */ - -void action_thread_continue() +void action_thread_continue(void) { - register processor_t processor; - register spl_t s; + processor_t processor; + spl_t s; while (TRUE) { s = splsched(); @@ -451,7 +387,7 @@ void action_thread_continue() } } -void action_thread() +void __attribute__((noreturn)) action_thread(void) { action_thread_continue(); /*NOTREACHED*/ @@ -462,21 +398,15 @@ void action_thread() * is to schedule ourselves onto a cpu and then save our * context back into the runqs before taking out the cpu. */ -#ifdef __GNUC__ -__volatile__ -#endif -void processor_doshutdown(); /* forward */ - -void processor_doaction(processor) -register processor_t processor; +void processor_doaction(processor_t processor) { thread_t this_thread; spl_t s; - register processor_set_t pset; + processor_set_t pset; #if MACH_HOST - register processor_set_t new_pset; - register thread_t thread; - register thread_t prev_thread = THREAD_NULL; + processor_set_t new_pset; + thread_t thread; + thread_t prev_thread = THREAD_NULL; boolean_t have_pset_ref = FALSE; #endif /* MACH_HOST */ @@ -485,7 +415,7 @@ register processor_t processor; */ this_thread = current_thread(); thread_bind(this_thread, processor); - thread_block((void (*)()) 0); + thread_block(thread_no_continuation); pset = processor->processor_set; #if MACH_HOST @@ -642,7 +572,7 @@ Restart_pset: thread_deallocate(prev_thread); thread_bind(this_thread, PROCESSOR_NULL); - thread_block((void (*)()) 0); + thread_block(thread_no_continuation); return; } @@ -689,17 +619,10 @@ Restart_pset: * running on the processor's shutdown stack. */ -#ifdef __GNUC__ -extern __volatile__ void halt_cpu(); -#endif - -#ifdef __GNUC__ -__volatile__ -#endif void processor_doshutdown(processor) -register processor_t processor; +processor_t processor; { - register int cpu = processor->slot_num; + int cpu = processor->slot_num; timer_switch(&kernel_timer[cpu]); @@ -723,23 +646,20 @@ register processor_t processor; #else /* NCPUS > 1 */ kern_return_t -processor_assign(processor, new_pset, wait) -processor_t processor; -processor_set_t new_pset; -boolean_t wait; +processor_assign( + processor_t processor, + processor_set_t new_pset, + boolean_t wait) { -#ifdef lint - processor++; new_pset++; wait++; -#endif /* lint */ return(KERN_FAILURE); } #endif /* NCPUS > 1 */ kern_return_t -host_get_boot_info(priv_host, boot_info) - host_t priv_host; - kernel_boot_info_t boot_info; +host_get_boot_info( + host_t priv_host, + kernel_boot_info_t boot_info) { char *src = ""; @@ -747,19 +667,6 @@ host_get_boot_info(priv_host, boot_info) return KERN_INVALID_HOST; } -#if NORMA_ETHER -{ - extern char *norma_ether_boot_info(); - src = norma_ether_boot_info(); -} -#endif /* NORMA_ETHER */ -#if defined(iPSC386) || defined(iPSC860) -{ - extern char *ipsc_boot_environ(); - src = ipsc_boot_environ(); -} -#endif /* defined(iPSC386) || defined(iPSC860) */ - (void) strncpy(boot_info, src, KERNEL_BOOT_INFO_MAX); return KERN_SUCCESS; }