/branches/tracing/kernel/generic/include/lib/rd.h |
---|
66,16 → 66,18 |
#define RE_UNSUPPORTED 2 /* Non-supported image (e.g. wrong version) */ |
/** RAM disk header */ |
typedef struct { |
struct rd_header { |
uint8_t magic[RD_MAGIC_SIZE]; |
uint8_t version; |
uint8_t data_type; |
uint32_t header_size; |
uint64_t data_size; |
} rd_header; |
} __attribute__ ((packed)); |
extern int init_rd(rd_header * addr, size_t size); |
typedef struct rd_header rd_header_t; |
extern int init_rd(rd_header_t *addr, size_t size); |
#endif |
/** @} |
/branches/tracing/kernel/generic/include/ipc/ipc.h |
---|
211,6 → 211,8 |
#define IPC_MAX_PHONES 16 |
#include <synch/spinlock.h> |
#include <synch/mutex.h> |
#include <synch/waitq.h> |
struct answerbox; |
231,7 → 233,7 |
/** Structure identifying phone (in TASK structure) */ |
typedef struct { |
SPINLOCK_DECLARE(lock); |
mutex_t lock; |
link_t link; |
struct answerbox *callee; |
ipc_phone_state_t state; |
/branches/tracing/kernel/generic/src/main/kinit.c |
---|
178,7 → 178,7 |
if (!ipc_phone_0) |
ipc_phone_0 = &utask->answerbox; |
} else { |
int rd = init_rd((rd_header *) init.tasks[i].addr, |
int rd = init_rd((rd_header_t *) init.tasks[i].addr, |
init.tasks[i].size); |
if (rd != RE_OK) |
/branches/tracing/kernel/generic/src/lib/rd.c |
---|
42,7 → 42,6 |
#include <mm/frame.h> |
#include <sysinfo/sysinfo.h> |
#include <ddi/ddi.h> |
#include <print.h> |
#include <align.h> |
static parea_t rd_parea; /**< Physical memory area for rd. */ |
52,7 → 51,7 |
* and information about the share is provided as sysinfo values to the userspace |
* tasks. |
*/ |
int init_rd(rd_header * header, size_t size) |
int init_rd(rd_header_t *header, size_t size) |
{ |
/* Identify RAM disk */ |
if ((header->magic[0] != RD_MAG0) || (header->magic[1] != RD_MAG1) || |
81,9 → 80,6 |
if ((hsize % FRAME_SIZE) || (dsize % FRAME_SIZE)) |
return RE_UNSUPPORTED; |
if (dsize % FRAME_SIZE) |
return RE_UNSUPPORTED; |
if (hsize > size) |
return RE_INVALID; |
/branches/tracing/kernel/generic/src/ipc/sysipc.c |
---|
169,7 → 169,7 |
/* In case of forward, hangup the forwared phone, |
* not the originator |
*/ |
spinlock_lock(&answer->data.phone->lock); |
mutex_lock(&answer->data.phone->lock); |
spinlock_lock(&TASK->answerbox.lock); |
if (answer->data.phone->state == IPC_PHONE_CONNECTED) { |
list_remove(&answer->data.phone->link); |
176,7 → 176,7 |
answer->data.phone->state = IPC_PHONE_SLAMMED; |
} |
spinlock_unlock(&TASK->answerbox.lock); |
spinlock_unlock(&answer->data.phone->lock); |
mutex_unlock(&answer->data.phone->lock); |
} |
if (!olddata) |
/branches/tracing/kernel/generic/src/ipc/ipc.c |
---|
37,7 → 37,9 |
* First the answerbox, then the phone. |
*/ |
#include <synch/synch.h> |
#include <synch/spinlock.h> |
#include <synch/mutex.h> |
#include <synch/waitq.h> |
#include <synch/synch.h> |
#include <ipc/ipc.h> |
141,7 → 143,7 |
*/ |
void ipc_phone_connect(phone_t *phone, answerbox_t *box) |
{ |
spinlock_lock(&phone->lock); |
mutex_lock(&phone->lock); |
phone->state = IPC_PHONE_CONNECTED; |
phone->callee = box; |
150,7 → 152,7 |
list_append(&phone->link, &box->connected_phones); |
spinlock_unlock(&box->lock); |
spinlock_unlock(&phone->lock); |
mutex_unlock(&phone->lock); |
} |
/** Initialize a phone structure. |
159,7 → 161,7 |
*/ |
void ipc_phone_init(phone_t *phone) |
{ |
spinlock_initialize(&phone->lock, "phone_lock"); |
mutex_initialize(&phone->lock); |
phone->callee = NULL; |
phone->state = IPC_PHONE_FREE; |
atomic_set(&phone->active_calls, 0); |
262,9 → 264,9 |
{ |
answerbox_t *box; |
spinlock_lock(&phone->lock); |
mutex_lock(&phone->lock); |
if (phone->state != IPC_PHONE_CONNECTED) { |
spinlock_unlock(&phone->lock); |
mutex_unlock(&phone->lock); |
if (call->flags & IPC_CALL_FORWARDED) { |
IPC_SET_RETVAL(call->data, EFORWARD); |
_ipc_answer_free_call(call); |
279,7 → 281,7 |
box = phone->callee; |
_ipc_call(phone, box, call); |
spinlock_unlock(&phone->lock); |
mutex_unlock(&phone->lock); |
return 0; |
} |
298,11 → 300,11 |
answerbox_t *box; |
call_t *call; |
spinlock_lock(&phone->lock); |
mutex_lock(&phone->lock); |
if (phone->state == IPC_PHONE_FREE || |
phone->state == IPC_PHONE_HUNGUP || |
phone->state == IPC_PHONE_CONNECTING) { |
spinlock_unlock(&phone->lock); |
mutex_unlock(&phone->lock); |
return -1; |
} |
box = phone->callee; |
321,7 → 323,7 |
} |
phone->state = IPC_PHONE_HUNGUP; |
spinlock_unlock(&phone->lock); |
mutex_unlock(&phone->lock); |
return 0; |
} |
447,7 → 449,7 |
while (!list_empty(&box->connected_phones)) { |
phone = list_get_instance(box->connected_phones.next, |
phone_t, link); |
if (!spinlock_trylock(&phone->lock)) { |
if (SYNCH_FAILED(mutex_trylock(&phone->lock))) { |
spinlock_unlock(&box->lock); |
interrupts_restore(ipl); |
DEADLOCK_PROBE(p_phonelck, DEADLOCK_THRESHOLD); |
461,7 → 463,7 |
phone->state = IPC_PHONE_SLAMMED; |
if (notify_box) { |
spinlock_unlock(&phone->lock); |
mutex_unlock(&phone->lock); |
spinlock_unlock(&box->lock); |
interrupts_restore(ipl); |
482,7 → 484,7 |
goto restart_phones; |
} |
spinlock_unlock(&phone->lock); |
mutex_unlock(&phone->lock); |
} |
spinlock_unlock(&box->lock); |
625,7 → 627,10 |
/* Print opened phones & details */ |
printf("PHONE:\n"); |
for (i = 0; i < IPC_MAX_PHONES; i++) { |
spinlock_lock(&task->phones[i].lock); |
if (SYNCH_FAILED(mutex_trylock(&task->phones[i].lock))) { |
printf("%d: mutex busy\n", i); |
continue; |
} |
if (task->phones[i].state != IPC_PHONE_FREE) { |
printf("%d: ", i); |
switch (task->phones[i].state) { |
650,7 → 655,7 |
printf("active: %d\n", |
atomic_get(&task->phones[i].active_calls)); |
} |
spinlock_unlock(&task->phones[i].lock); |
mutex_unlock(&task->phones[i].lock); |
} |
/branches/tracing/kernel/arch/amd64/include/memstr.h |
---|
88,7 → 88,7 |
"movq %3, %0\n\t" |
"addq $1, %0\n\t" |
"1:\n" |
: "=a" (ret), "=%S" (d0), "=&D" (d1), "=&c" (d2) |
: "=a" (ret), "=&S" (d0), "=&D" (d1), "=&c" (d2) |
: "0" (0), "1" (src), "2" (dst), "3" ((unative_t)cnt) |
); |
110,7 → 110,7 |
asm volatile ( |
"rep stosw\n\t" |
: "=&D" (d0), "=&c" (d1), "=a" (x) |
: "=&D" (d0), "=&c" (d1), "=&a" (x) |
: "0" (dst), "1" ((unative_t)cnt), "2" (x) |
: "memory" |
); |
132,7 → 132,7 |
asm volatile ( |
"rep stosb\n\t" |
: "=&D" (d0), "=&c" (d1), "=a" (x) |
: "=&D" (d0), "=&c" (d1), "=&a" (x) |
: "0" (dst), "1" ((unative_t)cnt), "2" (x) |
: "memory" |
); |
/branches/tracing/kernel/arch/mips32/include/atomic.h |
---|
63,7 → 63,7 |
" sc %0, %1\n" |
" beq %0, %4, 1b\n" /* if the atomic operation failed, try again */ |
" nop\n" |
: "=r" (tmp), "=m" (val->count), "=r" (v) |
: "=&r" (tmp), "=m" (val->count), "=&r" (v) |
: "i" (i), "i" (0) |
); |
/branches/tracing/kernel/arch/ia32/include/memstr.h |
---|
94,7 → 94,7 |
"movl %3, %0\n\t" |
"addl $1, %0\n\t" |
"1:\n" |
: "=a" (ret), "=%S" (d0), "=&D" (d1), "=&c" (d2) |
: "=a" (ret), "=&S" (d0), "=&D" (d1), "=&c" (d2) |
: "0" (0), "1" ((unative_t) src), "2" ((unative_t) dst), "3" ((unative_t) cnt) |
); |
116,7 → 116,7 |
asm volatile ( |
"rep stosw\n\t" |
: "=&D" (d0), "=&c" (d1), "=a" (x) |
: "=&D" (d0), "=&c" (d1), "=&a" (x) |
: "0" (dst), "1" (cnt), "2" (x) |
: "memory" |
); |
138,7 → 138,7 |
asm volatile ( |
"rep stosb\n\t" |
: "=&D" (d0), "=&c" (d1), "=a" (x) |
: "=&D" (d0), "=&c" (d1), "=&a" (x) |
: "0" (dst), "1" (cnt), "2" (x) |
: "memory" |
); |