Kernel uses ARCH_CL_SIZE (XCC)
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 20 Mar 2013 23:28:56 +0000 (16:28 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 20 Mar 2013 23:28:56 +0000 (16:28 -0700)
Instead of the older HW_CACHE_ALIGN or whatever.

Reinstall kernel headers.

kern/arch/i686/arch.h
kern/arch/riscv/arch.h
kern/arch/riscv/atomic.c
kern/arch/sparc/arch.h
kern/include/ros/ucq.h
kern/include/smp.h
kern/src/process.c
kern/src/trap.c

index c1e7647..99efed8 100644 (file)
@@ -8,7 +8,7 @@
 #include <arch/apic.h>
 
 /* Arch Constants */
-#define HW_CACHE_ALIGN                          64
+#define ARCH_CL_SIZE                            64
 /* Top of the kernel virtual mapping area (KERNBASE) */
 /* For sanity reasons, I don't plan to map the top page */
 #define KERN_VMAP_TOP                          0xfffff000
index d1b7d08..240b03b 100644 (file)
@@ -10,7 +10,7 @@
 #include <arch/time.h>
 
 /* Arch Constants */
-#define HW_CACHE_ALIGN 64
+#define ARCH_CL_SIZE 64
 
 #ifdef __riscv64
 # define KERN64
index 025f8d9..d4b8ac6 100644 (file)
@@ -10,11 +10,11 @@ bool atomic_cas(atomic_t *addr, long exp_val, long new_val)
        
   #define K 17
        /* TODO: not sure if this initialization works. */
-       static spinlock_t cas_locks[K*HW_CACHE_ALIGN/sizeof(spinlock_t)] =
+       static spinlock_t cas_locks[K*ARCH_CL_SIZE/sizeof(spinlock_t)] =
                          {SPINLOCK_INITIALIZER_IRQSAVE};
 
   uintptr_t bucket = (uintptr_t)addr / sizeof(uintptr_t) % K;
-       spinlock_t* lock = &cas_locks[bucket*HW_CACHE_ALIGN/sizeof(spinlock_t)];
+       spinlock_t* lock = &cas_locks[bucket*ARCH_CL_SIZE/sizeof(spinlock_t)];
        
        bool retval = 0;
        spin_lock_irqsave(lock);
@@ -39,11 +39,11 @@ bool atomic_cas_u32(uint32_t *addr, uint32_t exp_val, uint32_t new_val)
        
   #define K 17
        /* TODO: not sure if this initialization works. */
-       static spinlock_t cas_locks[K*HW_CACHE_ALIGN/sizeof(spinlock_t)] =
+       static spinlock_t cas_locks[K*ARCH_CL_SIZE/sizeof(spinlock_t)] =
                          {SPINLOCK_INITIALIZER_IRQSAVE};
 
   uintptr_t bucket = (uintptr_t)addr / sizeof(uintptr_t) % K;
-       spinlock_t* lock = &cas_locks[bucket*HW_CACHE_ALIGN/sizeof(spinlock_t)];
+       spinlock_t* lock = &cas_locks[bucket*ARCH_CL_SIZE/sizeof(spinlock_t)];
        
        bool retval = 0;
        spin_lock_irqsave(lock);
index e9c12ba..81222fd 100644 (file)
@@ -4,7 +4,7 @@
 #include <ros/arch/arch.h>
 
 /* Arch Constants */
-#define HW_CACHE_ALIGN         64
+#define ARCH_CL_SIZE           64
 #define KERN_VMAP_TOP          0xFEC00000 // max virtual address
 
 #include <arch/mmu.h>
index a125550..510b722 100644 (file)
@@ -21,6 +21,7 @@
 #include <ros/common.h>
 #include <ros/atomic.h>
 #include <ros/arch/mmu.h>
+#include <arch/arch.h>                 /* both user and kernel have arch/arch.h */
 /* #include <ros/event.h> included below */
 
 /* The main UCQ structure, contains indexes and start points (for the indexes),
index 5010b46..42a0f0a 100644 (file)
@@ -53,7 +53,7 @@ struct per_cpu_info {
        struct kernel_msg_list NTPTV(a0t) NTPTV(a1t) NTPTV(a2t) immed_amsgs;
        spinlock_t routine_amsg_lock;
        struct kernel_msg_list NTPTV(a0t) NTPTV(a1t) NTPTV(a2t) routine_amsgs;
-}__attribute__((aligned(HW_CACHE_ALIGN)));
+}__attribute__((aligned(ARCH_CL_SIZE)));
 
 /* Allows the kernel to figure out what process is running on this core.  Can be
  * used just like a pointer to a struct proc. */
index 7354d81..1dea2f6 100644 (file)
@@ -169,7 +169,7 @@ void proc_init(void)
        /* Catch issues with the vcoremap and TAILQ_ENTRY sizes */
        static_assert(sizeof(TAILQ_ENTRY(vcore)) == sizeof(void*) * 2);
        proc_cache = kmem_cache_create("proc", sizeof(struct proc),
-                    MAX(HW_CACHE_ALIGN, __alignof__(struct proc)), 0, 0, 0);
+                    MAX(ARCH_CL_SIZE, __alignof__(struct proc)), 0, 0, 0);
        /* Init PID mask and hash.  pid 0 is reserved. */
        SET_BITMASK_BIT(pid_bmask, 0);
        spinlock_init(&pid_hash_lock);
index 628a1a7..9a200dd 100644 (file)
@@ -18,7 +18,7 @@ struct kmem_cache *kernel_msg_cache;
 void kernel_msg_init(void)
 {
        kernel_msg_cache = kmem_cache_create("kernel_msgs",
-                          sizeof(struct kernel_message), HW_CACHE_ALIGN, 0, 0, 0);
+                          sizeof(struct kernel_message), ARCH_CL_SIZE, 0, 0, 0);
 }
 
 uint32_t send_kernel_message(uint32_t dst, amr_t pc, long arg0, long arg1,