|
|
1.1 root 1: #include <cpus.h>
2:
3: #if MULTIPROCESSOR
4:
5: #include <oskit/smp.h>
6: #include <machine/mp_desc.h>
7: #include <kern/cpu_number.h>
8: #include <mach/kern_return.h>
9: #include <mach/machine.h>
10:
11: extern void slave_main (void) __attribute__ ((noreturn)); /* kern/startup.c */
12:
13:
14: void
15: interrupt_processor (int which_cpu)
16: {
17: smp_message_pass (which_cpu);
18: }
19:
20: static void
21: secondary_cpu (void *arg)
22: {
23: const int mycpu = (int) arg;
24:
25: assert (mycpu == smp_find_cur_cpu ());
26:
27: mp_desc_load (mp_desc_init (mycpu));
28: setup_machine_slot (mycpu);
29:
30: smp_message_pass_enable[mycpu] = 1;
31:
32: slave_main ();
33: /* NOTREACHED */
34: }
35:
36: void
37: start_other_cpus (void)
38: {
39: int cpu;
40:
41: smp_message_pass_enable[master_cpu] = 1;
42:
43: cpu = 0;
44: while ((cpu = smp_find_cpu (cpu)) >= 0)
45: if (cpu != master_cpu)
46: smp_start_cpu (cpu,
47: &secondary_cpu, (void *) cpu,
48: (void *) int_stack_top[cpu]);
49: }
50:
51: kern_return_t
52: cpu_control(int cpu, int *info, int count)
53: {
54: printf("cpu_control %d\n", cpu);
55: return KERN_FAILURE;
56: }
57:
58: kern_return_t
59: cpu_start(int cpu)
60: {
61: if (machine_slot[cpu].running)
62: return KERN_FAILURE;
63:
64: smp_start_cpu (cpu,
65: &secondary_cpu, (void *) cpu,
66: (void *) int_stack_top[cpu]);
67:
68: return KERN_SUCCESS; /* not synchronous */
69: }
70:
71: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.