Get things to build with Ivy.
authorZach Anderson <zra@zra-intrepid.(none)>
Tue, 27 Oct 2009 22:49:18 +0000 (15:49 -0700)
committerZach Anderson <zra@zra-intrepid.(none)>
Tue, 27 Oct 2009 22:49:18 +0000 (15:49 -0700)
Please make sure things compile with Ivy even if you have to use nodeputy, nosharc, TC() or TRUSTEDBLOCK.
That makes it much easier for me to go back and fix things.
I have also turned off the error logging, so compilation with Ivy should be a bit faster, now.

kern/arch/i386/atomic.h
kern/arch/i386/trap.c
kern/include/atomic.h
kern/include/smp.h
kern/include/sys/queue.h
kern/include/trap.h
kern/src/process.c
user/apps/roslib/mproctests.c

index 41e93ee..1674f86 100644 (file)
 #define wmb_f() ({ asm volatile("sfence"); })
 
 typedef void * RACY atomic_t;
-typedef struct spinlock {
+struct spinlock {
        volatile uint32_t RACY rlock;
 #ifdef SPINLOCK_DEBUG
        void *call_site;        
        uint32_t calling_core;
 #endif
-} spinlock_t;
+};
+typedef struct spinlock RACY spinlock_t;
 #define SPINLOCK_INITIALIZER {0}
 
 static inline void atomic_init(atomic_t *number, int32_t val);
@@ -98,7 +99,7 @@ static inline void spin_lock(spinlock_t *lock)
 {
        __spin_lock(&lock->rlock);
 #ifdef SPINLOCK_DEBUG
-       lock->call_site = (void*)read_eip();
+       lock->call_site = (void RACY*CT(1))TC(read_eip());
        lock->calling_core = core_id();
 #endif
 }
@@ -109,6 +110,11 @@ static inline void spin_unlock(spinlock_t *lock)
 }
 
 static inline void spinlock_init(spinlock_t *lock)
+#ifdef SPINLOCK_DEBUG
+WRITES(lock->rlock,lock->call_site,lock->calling_core)
+#else
+WRITES(lock->rlock)
+#endif
 {
        lock->rlock = 0;
 #ifdef SPINLOCK_DEBUG
index 6c32ca6..2b90f03 100644 (file)
@@ -1,5 +1,6 @@
 #ifdef __SHARC__
-//#pragma nosharc
+#pragma nosharc
+#define SINIT(x) x
 #endif
 
 #include <arch/mmu.h>
@@ -398,7 +399,7 @@ uint32_t send_active_message(uint32_t dst, amr_t pc,
        active_message_t *a_msg;
        assert(pc);
        // note this will be freed on the destination core
-       a_msg = kmem_cache_alloc(active_msg_cache, 0);
+       a_msg = (active_message_t *CT(1))TC(kmem_cache_alloc(active_msg_cache, 0));
        a_msg->srcid = core_id();
        a_msg->pc = pc;
        a_msg->arg0 = arg0;
@@ -440,7 +441,7 @@ void __active_message(trapframe_t *tf)
                spin_unlock_irqsave(&myinfo->amsg_lock);
                // copy in, and then free, in case we don't return
                my_msg = *a_msg;
-               kmem_cache_free(active_msg_cache, a_msg);
+               kmem_cache_free(active_msg_cache, (void *CT(1))TC(a_msg));
                assert(my_msg.pc);
                /* In case the function doesn't return (which is common: __startcore,
                 * __death, etc), there is a chance we could lose an amsg.  We can only
index 4338729..e8205cc 100644 (file)
@@ -7,9 +7,9 @@
 #include <arch/arch.h>
 
 static inline void
-(SLOCK(0) spin_lock_irqsave)(spinlock_t SRACY*SAFE lock);
+(SLOCK(0) spin_lock_irqsave)(spinlock_t RACY*SAFE lock);
 static inline void
-(SUNLOCK(0) spin_unlock_irqsave)(spinlock_t SRACY*SAFE lock);
+(SUNLOCK(0) spin_unlock_irqsave)(spinlock_t RACY*SAFE lock);
 
 /*********************** Checklist stuff **********************/
 typedef struct checklist_mask {
index 2df1054..1114feb 100644 (file)
@@ -35,7 +35,7 @@ struct per_cpu_info {
 #endif
 
        spinlock_t amsg_lock;
-       struct active_msg_list active_msgs;
+       struct active_msg_list NTPTV(a0t) NTPTV(a1t) NTPTV(a2t) active_msgs;
 }__attribute__((aligned(HW_CACHE_ALIGN)));
 
 typedef struct per_cpu_info NTPTV(t) NTPTV(a0t) NTPTV(a1t) NTPTV(a2t) per_cpu_info_t;
index fd2c60f..3ed0684 100644 (file)
@@ -192,6 +192,12 @@ struct {                                                           \
        struct type *stqe_next NOINIT;  /* next element */                      \
 }
 
+#define        STAILQ_ENTRY_WITH_ATTRS(type,attrs)                                             \
+struct type##_link {                                                           \
+       struct type attrs *stqe_next NOINIT;    /* next element */                      \
+};\
+typedef struct type##_link attrs type##_link_t;
+
 /*
  * Singly-linked Tail queue functions.
  */
index 35b8868..00ad179 100644 (file)
@@ -56,14 +56,15 @@ typedef void (*amr_t)(trapframe_t* tf, uint32_t srcid,
 
 struct active_message
 {
-       STAILQ_ENTRY(active_message) link;
+       STAILQ_ENTRY(active_message NTPTV(a0t) NTPTV(a1t) NTPTV(a2t))
+               NTPTV(a0t) NTPTV(a1t) NTPTV(a2t) link;
        uint32_t srcid;
        amr_t pc;
        TV(a0t) arg0;
        TV(a1t) arg1;
        TV(a2t) arg2;
 };
-STAILQ_HEAD(active_msg_list, active_message);
+STAILQ_HEAD(active_msg_list, active_message NTPTV(a0t) NTPTV(a1t) NTPTV(a2t));
 typedef struct active_message NTPTV(a0t) NTPTV(a1t) NTPTV(a2t) active_message_t;
 
 uint32_t send_active_message(uint32_t dst, amr_t pc,
index 2d6f39c..e481fcc 100644 (file)
@@ -550,7 +550,7 @@ error_t proc_give_cores(struct proc *SAFE p, uint32_t corelist[], size_t *num)
                                        send_active_message(p->vcoremap[0], __startcore,
                                                            (uint32_t)p, (uint32_t)&p->env_tf, 0);
                                else */
-                               send_active_msg_sync(corelist[i], __startcore, p,
+                               send_active_message(corelist[i], __startcore, p,
                                                     (struct Trapframe *)0,
                                                     (void*SNT)free_vcoreid);
                                //send_active_message(corelist[i], __startcore, p,
@@ -606,7 +606,7 @@ error_t proc_take_cores(struct proc *SAFE p, uint32_t corelist[], size_t *num,
                vcoreid = get_vcoreid(p, corelist[i]);
                assert(p->vcoremap[vcoreid] == corelist[i]);
                if (message)
-                       send_active_msg_sync(corelist[i], message, arg0, arg1, arg2);
+                       send_active_message(corelist[i], message, arg0, arg1, arg2);
                // give the pcore back to the idlecoremap
                idlecoremap[num_idlecores++] = corelist[i];
                p->vcoremap[vcoreid] = -1;
@@ -641,7 +641,7 @@ error_t proc_take_allcores(struct proc *SAFE p, amr_t message,
                // find next active vcore
                active_vcoreid = get_busy_vcoreid(p, active_vcoreid);
                if (message)
-                       send_active_msg_sync(p->vcoremap[active_vcoreid], message,
+                       send_active_message(p->vcoremap[active_vcoreid], message,
                                             arg0, arg1, arg2);
                // give the pcore back to the idlecoremap
                idlecoremap[num_idlecores++] = p->vcoremap[active_vcoreid];
index 33e5d73..b99d7e9 100644 (file)
@@ -47,7 +47,7 @@ int main(int argc, char** argv)
                switch (test) {
                        case TEST_MMAP:
                                cprintf("Testing MMAP\n");
-                               void* addr;
+                               void *CT(8*PGSIZE) addr;
                                addr = sys_mmap((void*SNT)USTACKTOP - 20*PGSIZE, 8*PGSIZE, 3,
                                                MAP_FIXED, 0, 0);
                                cprintf("got addr = 0x%08x\n", addr);
@@ -58,7 +58,9 @@ int main(int argc, char** argv)
                                cprintf("reading addr+3pg: 0x%08x\n", *(int*)(addr + 3*PGSIZE));
                                // this should fault
                                cprintf("Should page fault and die now.\n");
+                               { TRUSTEDBLOCK
                                *(int*)(addr - 3*PGSIZE) = 0xdeadbeef;
+                               }
                                cprintf("Should not see me!!!!!!!!!!!!!!!!!!\n");
                                while(1);
                        case TEST_ONE_CORE: