IKC and test handler

This commit is contained in:
Taku Shimosawa
2011-10-18 19:18:45 +09:00
parent 4c51abf066
commit 4585e81cd9
3 changed files with 54 additions and 1 deletions

View File

@ -6,9 +6,58 @@
#include <aal/ikc.h>
#include <ikc/master.h>
static unsigned long read_tsc(void)
{
unsigned int low, high;
asm volatile("rdtsc" : "=a"(low), "=d"(high));
return (low | ((unsigned long)high << 32));
}
void testmem(void *v, unsigned long size)
{
unsigned long i, st, ed, s = 0;
unsigned long *p = v;
for (i = 0; i < size; i += 8) {
s += *(unsigned long *)((char *)p + i);
}
st = read_tsc();
for (i = 0; i < size; i += 64) {
s += *(unsigned long *)((char *)p + i);
}
ed = read_tsc();
kprintf("%ld, %ld\n", ed - st, s);
}
static int test_packet_handler(struct aal_ikc_channel_desc *c,
void *__packet, void *__os)
{
struct ikc_test_packet *packet = __packet;
struct ikc_test_packet p;
unsigned long a, pp, *v;
if (packet->msg == 0x11110011) {
kprintf("Test msg : %x, %x\n", packet->msg);
a = (unsigned long)packet->param1 << 12;
pp = aal_mc_map_memory(NULL, a, 4 * 1024 * 1024);
v = aal_mc_map_virtual(pp, 4 * 1024,
PTATTR_UNCACHABLE);
testmem(v, 4 * 1024 * 1024);
aal_mc_unmap_virtual(v, 4 * 1024);
aal_mc_unmap_memory(NULL, pp, 4 * 1024 * 1024);
} else if (packet->msg == 0x11110012) {
p.msg = 0x11110013;
aal_ikc_send(c, &p, 0);
}
return 0;
}

View File

@ -83,7 +83,7 @@ static struct aal_page_allocator_desc *vmap_allocator;
static void virtual_allocator_init(void)
{
vmap_allocator = aal_pagealloc_init(MAP_VMAP_START,
MAP_VMAP_SIZE, LARGE_PAGE_SIZE);
MAP_VMAP_SIZE, PAGE_SIZE);
}
void *aal_mc_map_virtual(unsigned long phys, int npages,

View File

@ -32,3 +32,7 @@ static int arch_master_channel_packet_handler(struct aal_ikc_channel_desc *c,
return 0;
}
struct aal_ikc_channel_desc *aal_mc_get_master_channel(void)
{
return &mchannel;
}