Author: andrew
Date: Sun Jun 10 01:13:04 2012
New Revision: 236828
URL: http://svn.freebsd.org/changeset/base/236828

Log:
  Pull out the common code to initialise proc0 & thread0 from initarm to a
  common function.
  
  Reviewed by:  imp

Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm/at91/at91_machdep.c
  head/sys/arm/econa/econa_machdep.c
  head/sys/arm/include/machdep.h
  head/sys/arm/mv/mv_machdep.c
  head/sys/arm/s3c2xx0/s3c24x0_machdep.c
  head/sys/arm/sa11x0/assabet_machdep.c
  head/sys/arm/xscale/i80321/ep80219_machdep.c
  head/sys/arm/xscale/i80321/iq31244_machdep.c
  head/sys/arm/xscale/i8134x/crb_machdep.c
  head/sys/arm/xscale/ixp425/avila_machdep.c
  head/sys/arm/xscale/pxa/pxa_machdep.c

Modified: head/sys/arm/arm/machdep.c
==============================================================================
--- head/sys/arm/arm/machdep.c  Sat Jun  9 22:44:49 2012        (r236827)
+++ head/sys/arm/arm/machdep.c  Sun Jun 10 01:13:04 2012        (r236828)
@@ -92,6 +92,8 @@ __FBSDID("$FreeBSD$");
 #include <machine/vmparam.h>
 #include <machine/sysarch.h>
 
+static struct trapframe proc0_tf;
+
 uint32_t cpu_reset_address = 0;
 int cold = 1;
 vm_offset_t vector_page;
@@ -709,3 +711,19 @@ fake_preload_metadata(void)
 
        return (lastaddr);
 }
+
+/*
+ * Initialize proc0
+ */
+void
+init_proc0(vm_offset_t kstack)
+{
+       proc_linkup0(&proc0, &thread0);
+       thread0.td_kstack = kstack;
+       thread0.td_pcb = (struct pcb *)
+               (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
+       thread0.td_pcb->pcb_flags = 0;
+       thread0.td_frame = &proc0_tf;
+       pcpup->pc_curpcb = thread0.td_pcb;
+}
+

Modified: head/sys/arm/at91/at91_machdep.c
==============================================================================
--- head/sys/arm/at91/at91_machdep.c    Sat Jun  9 22:44:49 2012        
(r236827)
+++ head/sys/arm/at91/at91_machdep.c    Sun Jun 10 01:13:04 2012        
(r236828)
@@ -132,8 +132,6 @@ struct pv_addr undstack;
 struct pv_addr abtstack;
 struct pv_addr kernelstack;
 
-static struct trapframe proc0_tf;
-
 /* Static device mappings. */
 const struct pmap_devmap at91_devmap[] = {
        /*
@@ -550,13 +548,7 @@ initarm(struct arm_boot_params *abp)
        undefined_handler_address = (u_int)undefinedinstruction_bounce;
        undefined_init();
 
-       proc_linkup0(&proc0, &thread0);
-       thread0.td_kstack = kernelstack.pv_va;
-       thread0.td_pcb = (struct pcb *)
-               (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
-       thread0.td_pcb->pcb_flags = 0;
-       thread0.td_frame = &proc0_tf;
-       pcpup->pc_curpcb = thread0.td_pcb;
+       init_proc0(kernelstack.pv_va);
 
        arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
 

Modified: head/sys/arm/econa/econa_machdep.c
==============================================================================
--- head/sys/arm/econa/econa_machdep.c  Sat Jun  9 22:44:49 2012        
(r236827)
+++ head/sys/arm/econa/econa_machdep.c  Sun Jun 10 01:13:04 2012        
(r236828)
@@ -123,8 +123,6 @@ struct pv_addr undstack;
 struct pv_addr abtstack;
 struct pv_addr kernelstack;
 
-static struct trapframe proc0_tf;
-
 /* Static device mappings. */
 static const struct pmap_devmap econa_devmap[] = {
        {
@@ -341,13 +339,7 @@ initarm(struct arm_boot_params *abp)
        undefined_handler_address = (u_int)undefinedinstruction_bounce;
        undefined_init();
 
-       proc_linkup0(&proc0, &thread0);
-       thread0.td_kstack = kernelstack.pv_va;
-       thread0.td_pcb = (struct pcb *)
-               (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
-       thread0.td_pcb->pcb_flags = 0;
-       thread0.td_frame = &proc0_tf;
-       pcpup->pc_curpcb = thread0.td_pcb;
+       init_proc0(kernelstack.pv_va);
 
        arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
 

Modified: head/sys/arm/include/machdep.h
==============================================================================
--- head/sys/arm/include/machdep.h      Sat Jun  9 22:44:49 2012        
(r236827)
+++ head/sys/arm/include/machdep.h      Sun Jun 10 01:13:04 2012        
(r236828)
@@ -7,6 +7,7 @@
 /* misc prototypes used by the many arm machdeps */
 void arm_lock_cache_line(vm_offset_t);
 vm_offset_t fake_preload_metadata(void);
+void init_proc0(vm_offset_t kstack);
 void halt(void);
 void data_abort_handler(trapframe_t *);
 void prefetch_abort_handler(trapframe_t *);

Modified: head/sys/arm/mv/mv_machdep.c
==============================================================================
--- head/sys/arm/mv/mv_machdep.c        Sat Jun  9 22:44:49 2012        
(r236827)
+++ head/sys/arm/mv/mv_machdep.c        Sun Jun 10 01:13:04 2012        
(r236828)
@@ -145,8 +145,6 @@ struct pv_addr undstack;
 struct pv_addr abtstack;
 struct pv_addr kernelstack;
 
-static struct trapframe proc0_tf;
-
 static struct mem_region availmem_regions[FDT_MEM_REGIONS];
 static int availmem_regions_sz;
 
@@ -576,14 +574,7 @@ initarm(struct arm_boot_params *abp)
        undefined_handler_address = (u_int)undefinedinstruction_bounce;
        undefined_init();
 
-       proc_linkup0(&proc0, &thread0);
-       thread0.td_kstack = kernelstack.pv_va;
-       thread0.td_kstack_pages = KSTACK_PAGES;
-       thread0.td_pcb = (struct pcb *)
-           (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
-       thread0.td_pcb->pcb_flags = 0;
-       thread0.td_frame = &proc0_tf;
-       pcpup->pc_curpcb = thread0.td_pcb;
+       init_proc0(kernelstack.pv_va);
 
        arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
 

Modified: head/sys/arm/s3c2xx0/s3c24x0_machdep.c
==============================================================================
--- head/sys/arm/s3c2xx0/s3c24x0_machdep.c      Sat Jun  9 22:44:49 2012        
(r236827)
+++ head/sys/arm/s3c2xx0/s3c24x0_machdep.c      Sun Jun 10 01:13:04 2012        
(r236828)
@@ -138,8 +138,6 @@ struct pv_addr undstack;
 struct pv_addr abtstack;
 struct pv_addr kernelstack;
 
-static struct trapframe proc0_tf;
-
 #define        _A(a)   ((a) & ~L1_S_OFFSET)
 #define        _S(s)   (((s) + L1_S_SIZE - 1) & ~(L1_S_SIZE-1))
 
@@ -406,14 +404,8 @@ initarm(struct arm_boot_params *abp)
        prefetch_abort_handler_address = (u_int)prefetch_abort_handler;
        undefined_handler_address = (u_int)undefinedinstruction_bounce;
        undefined_init();
-                               
-       proc_linkup(&proc0, &thread0);
-       thread0.td_kstack = kernelstack.pv_va;
-       thread0.td_pcb = (struct pcb *)
-               (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
-       thread0.td_pcb->pcb_flags = 0;
-       thread0.td_frame = &proc0_tf;
-       pcpup->pc_curpcb = thread0.td_pcb;
+       
+       init_proc0(kernelstack.pv_va);                  
        
        arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
 

Modified: head/sys/arm/sa11x0/assabet_machdep.c
==============================================================================
--- head/sys/arm/sa11x0/assabet_machdep.c       Sat Jun  9 22:44:49 2012        
(r236827)
+++ head/sys/arm/sa11x0/assabet_machdep.c       Sun Jun 10 01:13:04 2012        
(r236828)
@@ -147,7 +147,6 @@ struct pv_addr irqstack;
 struct pv_addr undstack;
 struct pv_addr abtstack;
 struct pv_addr kernelstack;
-static struct trapframe proc0_tf;
 
 /* Static device mappings. */
 static const struct pmap_devmap assabet_devmap[] = {
@@ -387,12 +386,7 @@ initarm(struct arm_boot_params *abp)
 
        /* Set stack for exception handlers */
        
-       proc_linkup0(&proc0, &thread0);
-       thread0.td_kstack = kernelstack.pv_va;
-       thread0.td_pcb = (struct pcb *)
-               (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
-       thread0.td_pcb->pcb_flags = 0;
-       thread0.td_frame = &proc0_tf;
+       init_proc0(kernelstack.pv_va);
        
        
        /* Enable MMU, I-cache, D-cache, write buffer. */

Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c
==============================================================================
--- head/sys/arm/xscale/i80321/ep80219_machdep.c        Sat Jun  9 22:44:49 
2012        (r236827)
+++ head/sys/arm/xscale/i80321/ep80219_machdep.c        Sun Jun 10 01:13:04 
2012        (r236828)
@@ -136,8 +136,6 @@ struct pv_addr abtstack;
 struct pv_addr kernelstack;
 struct pv_addr minidataclean;
 
-static struct trapframe proc0_tf;
-
 
 /* #define IQ80321_OBIO_BASE 0xfe800000UL */
 /* #define IQ80321_OBIO_SIZE 0x00100000UL */
@@ -379,13 +377,7 @@ initarm(struct arm_boot_params *abp)
        undefined_handler_address = (u_int)undefinedinstruction_bounce;
        undefined_init();
                                
-       proc_linkup0(&proc0, &thread0);
-       thread0.td_kstack = kernelstack.pv_va;
-       thread0.td_pcb = (struct pcb *)
-               (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
-       thread0.td_pcb->pcb_flags = 0;
-       thread0.td_frame = &proc0_tf;
-       pcpup->pc_curpcb = thread0.td_pcb;
+       init_proc0(kernelstack.pv_va);
        
        /* Enable MMU, I-cache, D-cache, write buffer. */
 

Modified: head/sys/arm/xscale/i80321/iq31244_machdep.c
==============================================================================
--- head/sys/arm/xscale/i80321/iq31244_machdep.c        Sat Jun  9 22:44:49 
2012        (r236827)
+++ head/sys/arm/xscale/i80321/iq31244_machdep.c        Sun Jun 10 01:13:04 
2012        (r236828)
@@ -136,8 +136,6 @@ struct pv_addr abtstack;
 struct pv_addr kernelstack;
 struct pv_addr minidataclean;
 
-static struct trapframe proc0_tf;
-
 #define IQ80321_OBIO_BASE 0xfe800000UL
 #define IQ80321_OBIO_SIZE 0x00100000UL
 /* Static device mappings. */
@@ -377,13 +375,7 @@ initarm(struct arm_boot_params *abp)
        undefined_handler_address = (u_int)undefinedinstruction_bounce;
        undefined_init();
                                
-       proc_linkup0(&proc0, &thread0);
-       thread0.td_kstack = kernelstack.pv_va;
-       thread0.td_pcb = (struct pcb *)
-               (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
-       thread0.td_pcb->pcb_flags = 0;
-       thread0.td_frame = &proc0_tf;
-       pcpup->pc_curpcb = thread0.td_pcb;
+       init_proc0(kernelstack.pv_va);
        
        /* Enable MMU, I-cache, D-cache, write buffer. */
 

Modified: head/sys/arm/xscale/i8134x/crb_machdep.c
==============================================================================
--- head/sys/arm/xscale/i8134x/crb_machdep.c    Sat Jun  9 22:44:49 2012        
(r236827)
+++ head/sys/arm/xscale/i8134x/crb_machdep.c    Sun Jun 10 01:13:04 2012        
(r236828)
@@ -135,8 +135,6 @@ struct pv_addr undstack;
 struct pv_addr abtstack;
 struct pv_addr kernelstack;
 
-static struct trapframe proc0_tf;
-
 /* Static device mappings. */
 static const struct pmap_devmap iq81342_devmap[] = {
            {
@@ -353,13 +351,7 @@ initarm(struct arm_boot_params *abp)
        undefined_handler_address = (u_int)undefinedinstruction_bounce;
        undefined_init();
                                
-       proc_linkup0(&proc0, &thread0);
-       thread0.td_kstack = kernelstack.pv_va;
-       thread0.td_pcb = (struct pcb *)
-               (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
-       thread0.td_pcb->pcb_flags = 0;
-       thread0.td_frame = &proc0_tf;
-       pcpup->pc_curpcb = thread0.td_pcb;
+       init_proc0(kernelstack.pv_va);
        
        arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
 

Modified: head/sys/arm/xscale/ixp425/avila_machdep.c
==============================================================================
--- head/sys/arm/xscale/ixp425/avila_machdep.c  Sat Jun  9 22:44:49 2012        
(r236827)
+++ head/sys/arm/xscale/ixp425/avila_machdep.c  Sun Jun 10 01:13:04 2012        
(r236828)
@@ -140,8 +140,6 @@ struct pv_addr abtstack;
 struct pv_addr kernelstack;
 struct pv_addr minidataclean;
 
-static struct trapframe proc0_tf;
-
 /* Static device mappings. */
 static const struct pmap_devmap ixp425_devmap[] = {
        /* Physical/Virtual address for I/O space */
@@ -443,13 +441,7 @@ initarm(struct arm_boot_params *abp)
        undefined_handler_address = (u_int)undefinedinstruction_bounce;
        undefined_init();
 
-       proc_linkup0(&proc0, &thread0);
-       thread0.td_kstack = kernelstack.pv_va;
-       thread0.td_pcb = (struct pcb *)
-               (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
-       thread0.td_pcb->pcb_flags = 0;
-       thread0.td_frame = &proc0_tf;
-       pcpup->pc_curpcb = thread0.td_pcb;
+       init_proc0(kernelstack.pv_va);
 
        arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
 

Modified: head/sys/arm/xscale/pxa/pxa_machdep.c
==============================================================================
--- head/sys/arm/xscale/pxa/pxa_machdep.c       Sat Jun  9 22:44:49 2012        
(r236827)
+++ head/sys/arm/xscale/pxa/pxa_machdep.c       Sun Jun 10 01:13:04 2012        
(r236828)
@@ -136,8 +136,6 @@ struct pv_addr abtstack;
 struct pv_addr kernelstack;
 struct pv_addr minidataclean;
 
-static struct trapframe proc0_tf;
-
 static void    pxa_probe_sdram(bus_space_tag_t, bus_space_handle_t,
                    uint32_t *, uint32_t *);
 
@@ -367,13 +365,7 @@ initarm(struct arm_boot_params *abp)
        undefined_handler_address = (u_int)undefinedinstruction_bounce;
        undefined_init();
 
-       proc_linkup(&proc0, &thread0);
-       thread0.td_kstack = kernelstack.pv_va;
-       thread0.td_pcb = (struct pcb *)
-               (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
-       thread0.td_pcb->pcb_flags = 0;
-       thread0.td_frame = &proc0_tf;
-       pcpup->pc_curpcb = thread0.td_pcb;
+       init_proc0(kernelstack.pv_va);
 
        /* Enable MMU, I-cache, D-cache, write buffer. */
        arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to