Subversion Repositories HelenOS

Compare Revisions

No changes between revisions

Ignore whitespace Rev 1349 → Rev 1350

/uspace/trunk/kbd/include/arch
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:special
-*
\ No newline at end of property
/uspace/trunk/libipc/include/ipc.h
68,5 → 68,6
extern int ipc_register_irq(int irq, irq_code_t *code);
extern int ipc_unregister_irq(int irq);
extern int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method, ipcarg_t arg1);
extern void _ipc_init(void);
 
#endif
/uspace/trunk/libipc/generic/ipc.c
33,6 → 33,7
#include <list.h>
#include <stdio.h>
#include <unistd.h>
#include <futex.h>
 
/** Structure used for keeping track of sent async msgs
* and queing unsent msgs
55,6 → 56,13
LIST_INITIALIZE(dispatched_calls);
LIST_INITIALIZE(queued_calls);
 
static atomic_t ipc_futex;
 
void _ipc_init(void)
{
futex_initialize(&ipc_futex, 1);
}
 
int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1,
ipcarg_t *result)
{
137,13 → 145,17
IPC_SET_METHOD(call->u.msg.data, method);
IPC_SET_ARG1(call->u.msg.data, arg1);
IPC_SET_ARG2(call->u.msg.data, arg2);
 
futex_down(&ipc_futex);
list_append(&call->list, &queued_calls);
futex_up(&ipc_futex);
return;
}
call->u.callid = callid;
/* Add call to list of dispatched calls */
futex_down(&ipc_futex);
list_append(&call->list, &dispatched_calls);
futex_up(&ipc_futex);
}
 
 
184,6 → 196,7
async_call_t *call;
ipc_callid_t callid;
 
futex_down(&ipc_futex);
while (!list_empty(&queued_calls)) {
call = list_get_instance(queued_calls.next, async_call_t,
list);
193,14 → 206,18
if (callid == IPC_CALLRET_TEMPORARY)
break;
list_remove(&call->list);
 
if (callid == IPC_CALLRET_FATAL) {
futex_up(&ipc_futex);
call->callback(call->private, ENOENT, NULL);
free(call);
futex_down(&ipc_futex);
} else {
call->u.callid = callid;
list_append(&call->list, &dispatched_calls);
}
}
futex_up(&ipc_futex);
}
 
/** Handle received answer
216,11 → 233,13
 
callid &= ~IPC_CALLID_ANSWERED;
futex_down(&ipc_futex);
for (item = dispatched_calls.next; item != &dispatched_calls;
item = item->next) {
call = list_get_instance(item, async_call_t, list);
if (call->u.callid == callid) {
list_remove(&call->list);
futex_up(&ipc_futex);
call->callback(call->private,
IPC_GET_RETVAL(*data),
data);
227,6 → 246,7
return;
}
}
futex_up(&ipc_futex);
printf("Received unidentified answer: %P!!!\n", callid);
}
 
301,11 → 321,43
return __SYSCALL4(SYS_IPC_FORWARD_FAST, callid, phoneid, method, arg1);
}
 
 
/** Open shared memory connection over specified phoneid
*
*
* Allocates AS_area, notify the other side about our intention
* to open the connection
*
* @return Connection id identifying this connection
*/
//int ipc_dgr_open(int pohoneid, size_t bufsize)
//{
/* Find new file descriptor in local descriptor table */
/* Create AS_area, initialize structures */
/* Send AS to other side, handle error states */
 
//}
/*
int ipc_open_dgrconn(int pohoneid, size_t max_dgram)
void ipc_dgr_close(int cid)
{
}
 
void * ipc_dgr_alloc(int cid, size_t size)
{
}
 
void ipc_dgr_free(int cid, void *area)
{
 
}
 
int ipc_dgr_send(int cid, void *area)
{
}
 
 
int ipc_dgr_send_data(int cid, void *data, size_t size)
{
}
 
*/
/uspace/trunk/libc/generic/libc.c
32,11 → 32,13
#include <malloc.h>
#include <psthread.h>
 
/* We should probably merge libc and libipc together */
extern void _ipc_init(void);
 
void _exit(int status) {
thread_exit(status);
}
 
#include <stdio.h>
void __main(void) {
tcb_t *tcb;
43,6 → 45,7
tcb = __make_tls();
__tcb_set(tcb);
psthread_setup(tcb);
_ipc_init();
}
 
void __exit(void) {