/SPARTAN/trunk/test/synch/rwlock5/test.c |
---|
75,7 → 75,7 |
void test(void) |
{ |
int i, j, k; |
int readers, writers; |
count_t readers, writers; |
printf("Read/write locks test #5\n"); |
/SPARTAN/trunk/test/fpu/mips1/test.c |
---|
41,7 → 41,7 |
#define DELAY 10000L |
#define ATTEMPTS 5 |
static volatile int threads_ok; |
static atomic_t threads_ok; |
static waitq_t can_start; |
static void testit1(void *data) |
/SPARTAN/trunk/test/fpu/fpu1/test.c |
---|
45,7 → 45,7 |
static inline double sqrt(double x) { double v; __asm__ ("fsqrt\n" : "=t" (v) : "0" (x)); return v; } |
static volatile int threads_ok; |
static atomic_t threads_ok; |
static waitq_t can_start; |
static void e(void *data) |
/SPARTAN/trunk/test/fpu/sse1/test.c |
---|
41,7 → 41,7 |
#define DELAY 10000L |
#define ATTEMPTS 5 |
static volatile int threads_ok; |
static atomic_t threads_ok; |
static waitq_t can_start; |
static void testit1(void *data) |
/SPARTAN/trunk/Makefile.config |
---|
36,12 → 36,12 |
# |
CONFIG_USERSPACE = n |
#CONFIG_TEST = |
CONFIG_TEST = |
#CONFIG_TEST = synch/rwlock1 |
#CONFIG_TEST = synch/rwlock2 |
#CONFIG_TEST = synch/rwlock3 |
#CONFIG_TEST = synch/rwlock4 |
CONFIG_TEST = synch/rwlock5 |
#CONFIG_TEST = synch/rwlock5 |
#CONFIG_TEST = synch/semaphore1 |
#CONFIG_TEST = synch/semaphore2 |
#CONFIG_TEST = fpu/fpu1 |
/SPARTAN/trunk/generic/include/synch/rwlock.h |
---|
43,7 → 43,7 |
struct rwlock { |
spinlock_t lock; |
mutex_t exclusive; /**< Mutex for writers, readers can bypass it if readers_in is positive. */ |
int readers_in; /**< Number of readers in critical section. */ |
count_t readers_in; /**< Number of readers in critical section. */ |
}; |
#define rwlock_write_lock(rwl) \ |
/SPARTAN/trunk/generic/include/config.h |
---|
35,8 → 35,8 |
#define STACK_SIZE PAGE_SIZE |
#define CONFIG_MEMORY_SIZE 8*1024*1024 |
#define CONFIG_HEAP_SIZE 300*1024 |
#define CONFIG_MEMORY_SIZE (8*1024*1024) |
#define CONFIG_HEAP_SIZE (300*1024) |
#define CONFIG_STACK_SIZE STACK_SIZE |
struct config { |
/SPARTAN/trunk/generic/include/arch.h |
---|
52,7 → 52,7 |
* the bottom of the stack. |
*/ |
struct the { |
int preemption_disabled; /**< Preemption disabled counter. */ |
count_t preemption_disabled; /**< Preemption disabled counter. */ |
thread_t *thread; /**< Current thread. */ |
task_t *task; /**< Current task. */ |
cpu_t *cpu; /**< Executing cpu. */ |
/SPARTAN/trunk/generic/include/proc/scheduler.h |
---|
38,10 → 38,11 |
#define RQ_COUNT 16 |
#define NEEDS_RELINK_MAX (HZ) |
/** Scheduler run queue structure. */ |
struct runq { |
spinlock_t lock; |
link_t rq_head; /**< List of ready threads. */ |
int n; /**< Number of threads in rq_ready. */ |
count_t n; /**< Number of threads in rq_ready. */ |
}; |
extern atomic_t nrdy; |
51,11 → 52,12 |
extern void scheduler(void); |
extern void kcpulb(void *arg); |
extern void before_thread_runs(void); |
/* |
* To be defined by architectures: |
*/ |
extern void before_thread_runs(void); |
extern void before_thread_runs_arch(void); |
#endif |
/SPARTAN/trunk/generic/include/typedefs.h |
---|
39,7 → 39,6 |
typedef unsigned int index_t; |
typedef struct config config_t; |
typedef struct cpu_private_data cpu_private_data_t; |
typedef struct cpu_info cpu_info_t; |
typedef struct cpu cpu_t; |
/SPARTAN/trunk/generic/include/cpu.h |
---|
45,9 → 45,9 |
spinlock_t lock; |
context_t saved_context; |
volatile int nrdy; |
volatile count_t nrdy; |
runq_t rq[RQ_COUNT]; |
volatile int needs_relink; |
volatile count_t needs_relink; |
spinlock_t timeoutlock; |
link_t timeout_active_head; |
/SPARTAN/trunk/generic/src/proc/scheduler.c |
---|
50,7 → 50,6 |
atomic_t nrdy; |
/** Take actions before new thread runs |
* |
* Perform actions that need to be |
116,7 → 115,7 |
* @return Thread to be scheduled. |
* |
*/ |
static struct thread *find_best_thread(void) |
static thread_t *find_best_thread(void) |
{ |
thread_t *t; |
runq_t *r; |
/SPARTAN/trunk/arch/sparc64/Makefile.inc |
---|
38,7 → 38,7 |
## Make some default assumptions |
# |
CFLAGS += -mcpu=ultrasparc -m64 |
CFLAGS += -mcpu=ultrasparc -m64 -O3 |
LFLAGS += -no-check-sections -N |
## Own configuration directives |
/SPARTAN/trunk/arch/ia64/Makefile.inc |
---|
38,7 → 38,7 |
## Make some default assumptions |
# |
CFLAGS += -mconstant-gp -fno-unwind-tables |
CFLAGS += -mconstant-gp -fno-unwind-tables -minline-int-divide-min-latency -O3 |
LFLAGS += -EL |
AFLAGS += -mconstant-gp |
/SPARTAN/trunk/arch/ppc32/Makefile.inc |
---|
38,6 → 38,7 |
## Make some default assumptions |
# |
CFLAGS += -O3 |
LFLAGS += -no-check-sections -N |
## Own configuration directives |
/SPARTAN/trunk/arch/amd64/Makefile.inc |
---|
42,7 → 42,7 |
CPU = opteron |
endif |
CFLAGS += -fno-unwind-tables -m64 -mcmodel=kernel -mno-red-zone |
CFLAGS += -fno-unwind-tables -m64 -mcmodel=kernel -mno-red-zone -O3 |
DEFS += -D_CPU=${CPU} |
## Accepted CPUs |
/SPARTAN/trunk/arch/mips32/include/atomic.h |
---|
31,82 → 31,42 |
#include <arch/types.h> |
#define atomic_inc(x) (a_add(x,1)) |
#define atomic_dec(x) (a_sub(x,1)) |
#define atomic_inc(x) ((void) atomic_add(x, 1)) |
#define atomic_dec(x) ((void) atomic_add(x, -1)) |
#define atomic_inc_pre(x) (a_add(x,1)-1) |
#define atomic_dec_pre(x) (a_sub(x,1)+1) |
#define atomic_inc_pre(x) (atomic_add(x, 1) - 1) |
#define atomic_dec_pre(x) (atomic_add(x, -1) + 1) |
#define atomic_inc_post(x) (a_add(x,1)) |
#define atomic_dec_post(x) (a_sub(x,1)) |
#define atomic_inc_post(x) atomic_add(x, 1) |
#define atomic_dec_post(x) atomic_add(x, -1) |
typedef volatile __u32 atomic_t; |
/* |
* Atomic addition |
/* Atomic addition of immediate value. |
* |
* This case is harder, and we have to use the special LL and SC operations |
* to achieve atomicity. The instructions are similar to LW (load) and SW |
* (store), except that the LL (load-linked) instruction loads the address |
* of the variable to a special register and if another process writes to |
* the same location, the SC (store-conditional) instruction fails. |
Returns (*val)+i |
* @param val Memory location to which will be the immediate value added. |
* @param i Signed immediate that will be added to *val. |
* |
* @return Value after addition. |
*/ |
static inline atomic_t a_add(atomic_t *val, int i) |
static inline atomic_t atomic_add(atomic_t *val, int i) |
{ |
atomic_t tmp, tmp2; |
atomic_t tmp, v; |
asm volatile ( |
" .set push\n" |
" .set noreorder\n" |
" nop\n" |
__asm__ volatile ( |
"1:\n" |
" ll %0, %1\n" |
" addu %0, %0, %3\n" |
" addiu %0, %0, %3\n" /* same as addi, but never traps on overflow */ |
" move %2, %0\n" |
" sc %0, %1\n" |
" beq %0, 0x0, 1b\n" |
" move %0, %2\n" |
" .set pop\n" |
: "=&r" (tmp), "=o" (*val), "=r" (tmp2) |
: "r" (i) |
" beq %0, %4, 1b\n" /* if the atomic operation failed, try again */ |
/* nop */ /* nop is inserted automatically by compiler */ |
: "=r" (tmp), "=m" (*val), "=r" (v) |
: "i" (i), "i" (0) |
); |
return tmp; |
} |
/* |
* Atomic subtraction |
* |
* Implemented in the same manner as a_add, except we substract the value. |
Returns (*val)-i |
*/ |
static inline atomic_t a_sub(atomic_t *val, int i) |
{ |
atomic_t tmp, tmp2; |
asm volatile ( |
" .set push\n" |
" .set noreorder\n" |
" nop\n" |
"1:\n" |
" ll %0, %1\n" |
" subu %0, %0, %3\n" |
" move %2, %0\n" |
" sc %0, %1\n" |
" beq %0, 0x0, 1b\n" |
" move %0, %2\n" |
" .set pop\n" |
: "=&r" (tmp), "=o" (*val), "=r" (tmp2) |
: "r" (i) |
); |
return tmp; |
return v; |
} |
/SPARTAN/trunk/arch/mips32/include/cpu.h |
---|
29,9 → 29,11 |
#ifndef __mips32_CPU_H__ |
#define __mips32_CPU_H__ |
#include <arch/types.h> |
struct cpu_arch { |
int imp_num; |
int rev_num; |
__u32 imp_num; |
__u32 rev_num; |
}; |
#endif |
/SPARTAN/trunk/arch/mips32/Makefile.inc |
---|
41,7 → 41,7 |
endif |
KERNEL_LOAD_ADDRESS = 0x80100000 |
CFLAGS += -mno-abicalls -G 0 -fno-zero-initialized-in-bss |
CFLAGS += -mno-abicalls -G 0 -fno-zero-initialized-in-bss -O2 |
DEFS += -DMACHINE=${MACHINE} -DKERNEL_LOAD_ADDRESS=${KERNEL_LOAD_ADDRESS} |
## Accepted MACHINEs |
/SPARTAN/trunk/arch/mips32/src/interrupt.c |
---|
114,6 → 114,7 |
case 4: /* IRQ2 */ |
case 5: /* IRQ3 */ |
case 6: /* IRQ4 */ |
default: |
print_regdump(pstate); |
panic("unhandled interrupt %d\n", i); |
break; |
/SPARTAN/trunk/arch/ia32/Makefile.inc |
---|
42,6 → 42,7 |
CPU = pentium4 |
endif |
CFLAGS += -O3 |
DEFS += -D_CPU=${CPU} |
## Accepted CPUs |
/SPARTAN/trunk/Makefile |
---|
47,7 → 47,7 |
# |
DEFS = -DARCH=$(ARCH) -DRELEASE=\"$(RELEASE)\" "-DNAME=\"$(NAME)\"" |
CFLAGS = -fno-builtin -fomit-frame-pointer -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -nostdlib -nostdinc -Igeneric/include/ |
CFLAGS = -fno-builtin -fomit-frame-pointer -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -nostdlib -nostdinc -Igeneric/include/ |
LFLAGS = -M |
AFLAGS = |