Kernel updates since December 2009

This commit is contained in:
Bahadir Balban
2010-03-25 01:12:40 +02:00
parent 16818191b3
commit 74b5963fcb
487 changed files with 22477 additions and 3857 deletions

View File

@@ -68,6 +68,7 @@ static inline void list_remove_init(struct link *link)
struct link *prev = link->prev;
struct link *next = link->next;
//BUG_ON(prev == NULL || next == NULL || link == NULL);
prev->next = next;
next->prev = prev;
@@ -87,6 +88,26 @@ static inline struct link *list_detach(struct link *head)
return next;
}
/* append new_list to list given by head/end pair */
static inline void list_attach(struct link *new_list, struct link *head, struct link *end)
{
/* attach new list at the end of original list */
end->next = new_list;
new_list->prev = end;
/* go to the end of list to be attached */
while (new_list->next != end->next)
new_list = new_list->next;
/* set end nodes properly */
new_list->next = head;
head->prev = new_list;
/* set end to new end */
end = new_list;
}
static inline int list_empty(struct link *list)
{
return list->prev == list && list->next == list;

View File

@@ -1,6 +1,16 @@
#ifndef __LIB_MATH_H__
#define __LIB_MATH_H__
/* Take the power */
static inline int pow(int val, int exp)
{
int res = 1;
for (int i = 0; i < exp; i++)
res *= val;
return res;
}
static inline int min(int x, int y)
{
return x < y ? x : y;

View File

@@ -4,15 +4,12 @@
#include <stdarg.h>
#if defined(ARCH_TEST)
/* For host tests all printks mean printf using the host C library */
#include <stdio.h>
#define printk printf
#elif !defined(__KERNEL__)
#if !defined(__KERNEL__)
#define printk printf
#else
int printk(char *format, ...) __attribute__((format (printf, 1, 2)));
extern void putc(char c);
void init_printk_lock(void);
#endif
#endif /* __PRINTK_H__ */

View File

@@ -3,12 +3,21 @@
#include <l4/lib/string.h>
#include <l4/generic/preempt.h>
#include INC_ARCH(exception.h)
#include INC_ARCH(irq.h)
#include INC_ARCH(mutex.h)
struct spinlock {
unsigned int lock;
};
#define DECLARE_SPINLOCK(lockname) \
struct spinlock lockname = { \
.lock = 0, \
}
void spin_lock_record_check(void *lock_addr);
void spin_unlock_delete_check(void *lock_addr);
static inline void spin_lock_init(struct spinlock *s)
{
memset(s, 0, sizeof(struct spinlock));
@@ -22,6 +31,10 @@ static inline void spin_lock(struct spinlock *s)
{
preempt_disable(); /* This must disable local preempt */
#if defined(CONFIG_SMP)
#if defined (CONFIG_DEBUG_SPINLOCKS)
spin_lock_record_check(s);
#endif
__spin_lock(&s->lock);
#endif
}
@@ -29,6 +42,10 @@ static inline void spin_lock(struct spinlock *s)
static inline void spin_unlock(struct spinlock *s)
{
#if defined(CONFIG_SMP)
#if defined (CONFIG_DEBUG_SPINLOCKS)
spin_unlock_delete_check(s);
#endif
__spin_unlock(&s->lock);
#endif
preempt_enable();
@@ -44,6 +61,10 @@ static inline void spin_lock_irq(struct spinlock *s,
{
irq_local_disable_save(state);
#if defined(CONFIG_SMP)
#if defined (CONFIG_DEBUG_SPINLOCKS)
spin_lock_record_check(s);
#endif
__spin_lock(&s->lock);
#endif
}
@@ -52,6 +73,11 @@ static inline void spin_unlock_irq(struct spinlock *s,
unsigned long state)
{
#if defined(CONFIG_SMP)
#if defined (CONFIG_DEBUG_SPINLOCKS)
spin_unlock_delete_check(s);
#endif
__spin_unlock(&s->lock);
#endif
irq_local_restore(state);