mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 10:53:16 +01:00
Fixed various minor issues.
Tag setting before ipc via l4 libraries don't seem to work, whereas c0 internally generated ipcs do it correctly.
This commit is contained in:
@@ -7,24 +7,15 @@
|
||||
|
||||
#define L4_IPC_TAG_MR_OFFSET 0
|
||||
|
||||
|
||||
/* To synchronise two threads */
|
||||
#define L4_IPC_TAG_WAIT 0
|
||||
|
||||
/* Pagefault */
|
||||
#define L4_IPC_TAG_PFAULT 2
|
||||
#define L4_IPC_TAG_PFAULT 0
|
||||
|
||||
#if defined (__KERNEL__) /* These are kernel internal calls */
|
||||
/* A helper call for sys_ipc() or internally created ipc paths. */
|
||||
#if defined (__KERNEL__)
|
||||
|
||||
/* These are for internally created ipc paths. */
|
||||
int ipc_send(l4id_t to);
|
||||
int ipc_sendrecv(l4id_t to, l4id_t from);
|
||||
|
||||
/*
|
||||
* This version sends an extra wait ipc to its receiver so that
|
||||
* the receiver can explicitly make it runnable later by accepting
|
||||
* this wait ipc.
|
||||
*/
|
||||
int ipc_sendwait(l4id_t tid);
|
||||
#endif
|
||||
|
||||
#endif /* __IPC_H__ */
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#define MAP_SVC_DEFAULT_FLAGS MAP_SVC_RW_FLAGS
|
||||
#define MAP_IO_DEFAULT_FLAGS MAP_SVC_IO_FLAGS
|
||||
|
||||
#if defined (__KERNEL__)
|
||||
int check_access(unsigned long vaddr, unsigned long size, unsigned int flags);
|
||||
#endif
|
||||
|
||||
#endif /* __SPACE_H__ */
|
||||
|
||||
@@ -139,20 +139,6 @@ int ipc_recv(l4id_t senderid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME: REMOVE: remove this completely and replace by ipc_sendrecv() */
|
||||
int ipc_sendwait(l4id_t to)
|
||||
{
|
||||
unsigned int *mregs = KTCB_REF_MR0(current);
|
||||
|
||||
/* Send actual message */
|
||||
ipc_send(to);
|
||||
|
||||
/* Send wait message */
|
||||
mregs[L4_IPC_TAG_MR_OFFSET] = L4_IPC_TAG_WAIT;
|
||||
ipc_send(to);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Both sends and receives mregs in the same call. This is mainly by user
|
||||
* tasks for client server communication with system servers.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* for all ipc parties.
|
||||
*/
|
||||
#define MR_TAG 0
|
||||
#define MR_SENDERID 1
|
||||
#define MR_SENDER 1
|
||||
#define MR_UNUSED_START 2
|
||||
|
||||
/* Send data fault ipc to the faulty task's pager */
|
||||
@@ -30,7 +30,7 @@ void fault_ipc_to_pager(u32 faulty_pc, u32 fsr, u32 far)
|
||||
{
|
||||
/* mr[0] has the fault tag. The rest is the fault structure */
|
||||
u32 mr[MR_TOTAL] = { [MR_TAG] = L4_IPC_TAG_PFAULT,
|
||||
[MR_SENDERID] = current->tid };
|
||||
[MR_SENDER] = current->tid };
|
||||
fault_kdata_t *fault = (fault_kdata_t *)&mr[MR_UNUSED_START];
|
||||
|
||||
/* Fill in fault information to pass over during ipc */
|
||||
|
||||
@@ -71,7 +71,8 @@ void handle_fs_requests(void)
|
||||
|
||||
void main(void)
|
||||
{
|
||||
// printf("\n%s: Started.\n", __FUNCTION__);
|
||||
printf("\n\n%s: Started.\n", __TASKNAME__);
|
||||
|
||||
initialise();
|
||||
|
||||
wait_pager(PAGER_TID);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
/*** IPC Tags used between server tasks ***/
|
||||
|
||||
/* For ping ponging */
|
||||
#define L4_IPC_TAG_PINGPONG 3
|
||||
#define L4_IPC_TAG_WAIT 3
|
||||
|
||||
/* To negotiate a shared memory mapping */
|
||||
#define L4_IPC_TAG_SHM 4
|
||||
|
||||
@@ -104,8 +104,8 @@ void handle_requests(void)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
printf("%s: Unrecognised ipc tag (%d)"
|
||||
"received. Ignoring.\n", __TASKNAME__, mr[MR_TAG]);
|
||||
printf("%s: Unrecognised ipc tag (%d) "
|
||||
"received. Ignoring.\n", __TASKNAME__, tag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,28 +9,31 @@
|
||||
#include <l4lib/arch/syslib.h>
|
||||
#include <l4lib/kip.h>
|
||||
#include <l4lib/utcb.h>
|
||||
#include <l4/api/ipc.h>
|
||||
#include <l4lib/ipcdefs.h>
|
||||
#include <tests.h>
|
||||
|
||||
#define __TASKNAME__ "test0"
|
||||
|
||||
void wait_pager(l4id_t partner)
|
||||
{
|
||||
u32 tag = L4_IPC_TAG_WAIT;
|
||||
printf("%s: Syncing with pager.\n", __TASKNAME__);
|
||||
l4_send(partner, tag);
|
||||
l4_send(partner, L4_IPC_TAG_WAIT);
|
||||
printf("Pager synced with us.\n");
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
printf("\n%s: Started.\n", __TASKNAME__);
|
||||
/* Sync with pager */
|
||||
wait_pager(0);
|
||||
while (1)
|
||||
wait_pager(0);
|
||||
|
||||
#if 0
|
||||
/* Check mmap/munmap */
|
||||
mmaptest();
|
||||
|
||||
/* Check shmget/shmat/shmdt */
|
||||
shmtest();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user