/branches/rcu/kernel/generic/include/print.h |
---|
40,7 → 40,7 |
#include <arch/arg.h> |
/* We need this address in spinlock to avoid deadlock in deadlock detection */ |
SPINLOCK_EXTERN(printflock); |
SPINLOCK_EXTERN(printf_lock); |
#define EOF (-1) |
/branches/rcu/kernel/generic/include/time/clock.h |
---|
35,8 → 35,19 |
#ifndef KERN_CLOCK_H_ |
#define KERN_CLOCK_H_ |
#include <arch/types.h> |
#define HZ 100 |
/** Uptime structure */ |
typedef struct { |
unative_t seconds1; |
unative_t useconds; |
unative_t seconds2; |
} uptime_t; |
extern uptime_t *uptime; |
extern void clock(void); |
extern void clock_counter_init(void); |
/branches/rcu/kernel/generic/include/proc/task.h |
---|
90,10 → 90,10 |
* Active asynchronous messages. It is used for limiting uspace to |
* certain extent. |
*/ |
atomic_t active_calls; |
atomic_t active_calls; |
/** Architecture specific task data. */ |
task_arch_t arch; |
task_arch_t arch; |
/** |
* Serializes access to the B+tree of task's futexes. This mutex is |
111,6 → 111,7 |
extern btree_t tasks_btree; |
extern void task_init(void); |
extern void task_done(void); |
extern task_t *task_create(as_t *as, char *name); |
extern void task_destroy(task_t *t); |
extern task_t *task_run_program(void *program_addr, char *name); |
/branches/rcu/kernel/generic/include/proc/thread.h |
---|
53,7 → 53,11 |
/* Thread flags */ |
/** Thread cannot be migrated to another CPU. */ |
/** Thread cannot be migrated to another CPU. |
* |
* When using this flag, the caller must set cpu in the thread_t |
* structure manually before calling thread_ready (even on uniprocessor). |
*/ |
#define THREAD_FLAG_WIRED (1 << 0) |
/** Thread was migrated to another CPU and has not run yet. */ |
#define THREAD_FLAG_STOLEN (1 << 1) |
193,7 → 197,7 |
/** Thread's priority. Implemented as index to CPU->rq */ |
int priority; |
/** Thread ID. */ |
uint32_t tid; |
thread_id_t tid; |
/** Architecture-specific data. */ |
thread_arch_t arch; |
248,8 → 252,9 |
extern slab_cache_t *fpu_context_slab; |
/* Thread syscall prototypes. */ |
unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name); |
unative_t sys_thread_exit(int uspace_status); |
extern unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, thread_id_t *uspace_thread_id); |
extern unative_t sys_thread_exit(int uspace_status); |
extern unative_t sys_thread_get_id(thread_id_t *uspace_thread_id); |
#endif |
/branches/rcu/kernel/generic/include/interrupt.h |
---|
48,7 → 48,7 |
#define fault_if_from_uspace(istate, cmd, ...) \ |
{ \ |
if (istate_from_uspace(istate)) { \ |
klog_printf("Task %lld killed due to an exception at %p.", TASK->taskid, istate_get_pc(istate)); \ |
klog_printf("Task %llu killed due to an exception at %p.", TASK->taskid, istate_get_pc(istate)); \ |
klog_printf(" " cmd, ##__VA_ARGS__); \ |
task_kill(TASK->taskid); \ |
thread_exit(); \ |
/branches/rcu/kernel/generic/include/synch/mutex.h |
---|
44,13 → 44,11 |
} mutex_t; |
#define mutex_lock(mtx) \ |
_mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE) |
_mutex_lock_timeout((mtx), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE) |
#define mutex_trylock(mtx) \ |
_mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING) |
#define mutex_lock_timeout(mtx,usec) \ |
_mutex_lock_timeout((mtx),(usec),SYNCH_FLAGS_NON_BLOCKING) |
#define mutex_lock_active(mtx) \ |
while (mutex_trylock((mtx)) != ESYNCH_OK_ATOMIC) |
_mutex_lock_timeout((mtx), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING) |
#define mutex_lock_timeout(mtx, usec) \ |
_mutex_lock_timeout((mtx), (usec), SYNCH_FLAGS_NON_BLOCKING) |
extern void mutex_initialize(mutex_t *mtx); |
extern int _mutex_lock_timeout(mutex_t *mtx, uint32_t usec, int flags); |
/branches/rcu/kernel/generic/include/synch/spinlock.h |
---|
101,8 → 101,26 |
preemption_enable(); |
} |
#ifdef CONFIG_DEBUG_SPINLOCK |
extern int printf(const char *, ...); |
#define DEADLOCK_THRESHOLD 100000000 |
#define DEADLOCK_PROBE_INIT(pname) count_t pname = 0 |
#define DEADLOCK_PROBE(pname, value) \ |
if ((pname)++ > (value)) { \ |
(pname) = 0; \ |
printf("Deadlock probe %s: exceeded threshold %d\n", \ |
"cpu%d: function=%s, line=%d\n", \ |
#pname, (value), CPU->id, __FUNCTION__, __LINE__); \ |
} |
#else |
#define DEADLOCK_PROBE_INIT(pname) |
#define DEADLOCK_PROBE(pname, value) |
#endif |
#else |
/* On UP systems, spinlocks are effectively left out. */ |
#define SPINLOCK_DECLARE(name) |
#define SPINLOCK_EXTERN(name) |
113,6 → 131,9 |
#define spinlock_trylock(x) (preemption_disable(), 1) |
#define spinlock_unlock(x) preemption_enable() |
#define DEADLOCK_PROBE_INIT(pname) |
#define DEADLOCK_PROBE(pname, value) |
#endif |
#endif |
/branches/rcu/kernel/generic/include/ddi/irq.h |
---|
121,6 → 121,14 |
* this lock must not be taken first. |
*/ |
SPINLOCK_DECLARE(lock); |
/** Send EOI before processing the interrupt. |
* This is essential for timer interrupt which |
* has to be acknowledged before doing preemption |
* to make sure another timer interrupt will |
* be eventually generated. |
*/ |
bool preack; |
/** Unique device number. -1 if not yet assigned. */ |
devno_t devno; |
127,7 → 135,7 |
/** Actual IRQ number. -1 if not yet assigned. */ |
inr_t inr; |
/** Trigger level of the IRQ.*/ |
/** Trigger level of the IRQ. */ |
irq_trigger_t trigger; |
/** Claim ownership of the IRQ. */ |
irq_ownership_t (* claim)(void); |
/branches/rcu/kernel/generic/include/printf/printf_core.h |
---|
47,7 → 47,7 |
}; |
int printf_core(const char *fmt, struct printf_spec *ps ,va_list ap); |
int printf_core(const char *fmt, struct printf_spec *ps, va_list ap); |
#endif |
/branches/rcu/kernel/generic/include/arch.h |
---|
74,8 → 74,12 |
extern void arch_post_cpu_init(void); |
extern void arch_pre_smp_init(void); |
extern void arch_post_smp_init(void); |
extern void calibrate_delay_loop(void); |
extern void reboot(void); |
extern void arch_reboot(void); |
#endif |
/** @} |
/branches/rcu/kernel/generic/include/mm/as.h |
---|
101,11 → 101,11 |
*/ |
asid_t asid; |
/** Number of references (i.e tasks that reference this as). */ |
atomic_t refcount; |
mutex_t lock; |
/** Number of references (i.e tasks that reference this as). */ |
count_t refcount; |
/** B+tree of address space areas. */ |
btree_t as_area_btree; |
147,11 → 147,11 |
*/ |
asid_t asid; |
/** Number of references (i.e tasks that reference this as). */ |
atomic_t refcount; |
mutex_t lock; |
/** Number of references (i.e tasks that reference this as). */ |
count_t refcount; |
/** B+tree of address space areas. */ |
btree_t as_area_btree; |
/branches/rcu/kernel/generic/include/syscall/syscall.h |
---|
40,6 → 40,7 |
SYS_TLS_SET = 1, /* Hardcoded in AMD64, IA32 uspace - psthread.S */ |
SYS_THREAD_CREATE, |
SYS_THREAD_EXIT, |
SYS_THREAD_GET_ID, |
SYS_TASK_GET_ID, |
SYS_FUTEX_SLEEP, |
SYS_FUTEX_WAKEUP, |