Hi,

we don't have SMP, but there are a few things one could start with
already.  For instance allowing the code to work/compile, even though
not all components are there yet.

This diff allows allocating the idle pcb / kernelstack.  Rename of
idlepcb to idle_pcb to be comparable with amd64.

ok?

Patrick

diff --git a/sys/arch/arm/arm/cpu.c b/sys/arch/arm/arm/cpu.c
index 66596231528..91dd49bb00c 100644
--- a/sys/arch/arm/arm/cpu.c
+++ b/sys/arch/arm/arm/cpu.c
@@ -48,6 +48,7 @@
 #include <sys/systm.h>
 #include <sys/malloc.h>
 #include <sys/device.h>
+#include <sys/user.h>
 #include <sys/proc.h>
 #include <sys/conf.h>
 #include <sys/sched.h>
@@ -293,24 +294,23 @@ identify_arm_cpu(struct device *dv, struct cpu_info *ci)
 
 #ifdef MULTIPROCESSOR
 int
-cpu_alloc_idlepcb(struct cpu_info *ci)
+cpu_alloc_idle_pcb(struct cpu_info *ci)
 {
        vaddr_t uaddr;
        struct pcb *pcb;
        struct trapframe *tf;
-       int error;
 
        /*
         * Generate a kernel stack and PCB (in essence, a u-area) for the
         * new CPU.
         */
-       if (uvm_uarea_alloc(&uaddr)) {
-               error = uvm_fault_wire(kernel_map, uaddr, uaddr + USPACE,
-                   VM_FAULT_WIRE, PROT_READ | PROT_WRITE);
-               if (error)
-                       return error;
+       uaddr = (vaddr_t)km_alloc(USPACE, &kv_any, &kp_zero, &kd_nowait);
+       if (uaddr == 0) {
+               printf("%s: unable to allocate idle stack\n",
+                   __func__);
+               return ENOMEM;
        }
-       ci->ci_idlepcb = pcb = (struct pcb *)uaddr;
+       ci->ci_idle_pcb = pcb = (struct pcb *)uaddr;
 
        /*
         * This code is largely derived from cpu_fork(), with which it
diff --git a/sys/arch/arm/include/cpu.h b/sys/arch/arm/include/cpu.h
index f56c12b7d90..aa8360abcfb 100644
--- a/sys/arch/arm/include/cpu.h
+++ b/sys/arch/arm/include/cpu.h
@@ -187,6 +187,7 @@ struct cpu_info {
        u_int32_t ci_randseed;
 
        struct pcb *ci_curpcb;
+       struct pcb *ci_idle_pcb;
 
        u_int32_t ci_arm_cpuid;         /* aggregate CPU id */
        u_int32_t ci_arm_cputype;       /* CPU type */
@@ -283,8 +284,8 @@ extern int want_resched;    /* resched() was called */
  */
 
 struct device;
-void   cpu_attach      (struct device *);
-int    cpu_alloc_idlepcb       (struct cpu_info *);
+void   cpu_attach(struct device *);
+int    cpu_alloc_idle_pcb(struct cpu_info *);
 
 /*
  * Random cruft

Reply via email to