Hello to all,
I'm working on L4 fiasco. In that I want to read the virtual hardware devies. for tha I'm running the code from l4/pkg/example/sys/ux-vhw/main.c
10 #include <l4/sys/ipc.h>
11 #include <l4/sys/vhw.h>
12 #include <l4/util/util.h>
13 #include <l4/util/kip.h>
14 #include <l4/re/env.h>
15
16 #include <stdlib.h>
17 #include <stdio.h>
18
19 static void print_entry(struct l4_vhw_entry *e)
20 {
21 printf("type: %d mem start: %08lx end: %08lx\n"
22 "irq: %d pid %d\n",
23 e->type, e->mem_start, e->mem_size,
24 e->irq_no, e->provider_pid);
25 }
26
27 int main(void)
28 {
29 l4_kernel_info_t *kip = l4re_kip();
30 struct l4_vhw_descriptor *vhw;
31 int i;
32
33 if (!kip)
34 {
35
36 printf("KIP not available!\n");
37 return 1;
38 }
39
40 vhw = l4_vhw_get(kip);
41
42 if(vhw)
43 {
44 printf("kip at %p, vhw at %p\n", kip, vhw);
45 printf("magic: %08x, version: %08x, count: %02d\n",
46 vhw->magic, vhw->version, vhw->count);
47
48 for (i = 0; i < vhw->count; i++)
49 print_entry(l4_vhw_get_entry(vhw, i));
50 }
51 return 0;
52 }
In the above code at line no 40 after calling inline function l4_vhw_get(kip) I'm getting vhw=NULL. and the definition of inline function is from l4sys/include/vhw.h is as follows
80 enum {
81 L4_VHW_MAGIC = 0x56687765,
82 };
83
84 static inline struct l4_vhw_descriptor *
85 l4_vhw_get(l4_kernel_info_t *kip) L4_NOTHROW
86 {
87 struct l4_vhw_descriptor *v
88 = (struct l4_vhw_descriptor *)(((unsigned long)kip) + kip->vhw_offset);
89
90 if (v->magic == L4_VHW_MAGIC)
91 return v;
92
93 return NULL;
94 }
Here at line no 90, the v->magic is having a value of 0x4BE6344C which is not equal to L4_VHW_MAGIC
My qestion is why I'm getting different magic value Instead of 0x56687765, and how can I get correct magic value.
If there are no virtual hardware device how can i create and integrate into my system........
Thanks,
Raja Sekhar