Rev 550 | Rev 552 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
498 | giacomo | 1 | #include <FTrace_chunk.h> |
2 | #include <FTrace_OSD.h> |
||
3 | #include <FTrace_types.h> |
||
4 | |||
550 | giacomo | 5 | #include <FTrace_udp.h> |
6 | |||
498 | giacomo | 7 | #include <kernel/kern.h> |
8 | #include <stdlib.h> |
||
9 | |||
10 | SYS_FLAGS FTracef; |
||
11 | |||
12 | extern FTrace_Chunk_Ptr ActualChunk; |
||
532 | giacomo | 13 | extern void *OSD_current_pointer; |
498 | giacomo | 14 | |
15 | void FTrace_fsave() |
||
16 | { |
||
17 | |||
18 | FTracef = kern_fsave(); |
||
19 | |||
20 | } |
||
21 | |||
22 | void FTrace_frestore() |
||
23 | { |
||
24 | |||
25 | kern_frestore(FTracef); |
||
26 | |||
27 | } |
||
28 | |||
29 | void FTrace_lock() |
||
30 | { |
||
31 | |||
32 | } |
||
33 | |||
34 | void FTrace_unlock() |
||
35 | { |
||
36 | |||
37 | } |
||
38 | |||
39 | void *FTrace_malloc(int size) |
||
40 | { |
||
41 | |||
42 | return malloc(size); |
||
43 | |||
44 | } |
||
45 | |||
46 | void FTrace_free(void *ptr) |
||
47 | { |
||
48 | |||
49 | free(ptr); |
||
50 | |||
51 | } |
||
52 | |||
53 | int FTrace_OSD_init() |
||
54 | { |
||
55 | |||
56 | return 0; |
||
57 | |||
58 | } |
||
59 | |||
501 | giacomo | 60 | /* OSD_pointers |
532 | giacomo | 61 | |
534 | giacomo | 62 | 00 - Actual Chunk Position |
63 | 04 - Actual Chunk Start |
||
64 | 08 - Actual Chunk Size |
||
65 | 12 - Actual Chunk Emergency Size |
||
66 | 16 - Actual Chunk Flags |
||
501 | giacomo | 67 | |
534 | giacomo | 68 | 20 - Next Chunk OSD Pointer |
501 | giacomo | 69 | |
70 | */ |
||
71 | |||
72 | int FTrace_OSD_chunk_init(FTrace_Chunk_Ptr c, int size, int emergency_size, FTrace_flags flags) |
||
498 | giacomo | 73 | { |
74 | |||
532 | giacomo | 75 | *(DWORD *)(c->osd) = (DWORD)(c->osd + FTRACE_OSD_CHUNK_HEAD); |
501 | giacomo | 76 | *(DWORD *)(c->osd + 4) = (DWORD)(c->osd + FTRACE_OSD_CHUNK_HEAD); |
534 | giacomo | 77 | *(DWORD *)(c->osd + 8) = (DWORD)(c->size); |
78 | *(DWORD *)(c->osd + 12) = (DWORD)(c->emergency_size); |
||
79 | *(DWORD *)(c->osd + 16) = (DWORD)(c->flags); |
||
80 | *(DWORD *)(c->osd + 20) = 0; |
||
501 | giacomo | 81 | |
498 | giacomo | 82 | return 0; |
83 | |||
84 | } |
||
85 | |||
86 | /* OSD Chunk Link */ |
||
532 | giacomo | 87 | int FTrace_OSD_chunk_link(FTrace_Chunk_Ptr a, FTrace_Chunk_Ptr b) |
498 | giacomo | 88 | { |
89 | |||
534 | giacomo | 90 | *(DWORD *)(a->osd + 20) = (DWORD)(b->osd); |
498 | giacomo | 91 | |
92 | return 0; |
||
93 | |||
94 | } |
||
95 | |||
503 | giacomo | 96 | int FTrace_OSD_update_chunk_flags(FTrace_Chunk_Ptr c) |
97 | { |
||
98 | |||
534 | giacomo | 99 | *(DWORD *)(c->osd + 16) = (DWORD)(c->flags); |
503 | giacomo | 100 | |
101 | return 0; |
||
102 | |||
103 | } |
||
104 | |||
498 | giacomo | 105 | int FTrace_OSD_compress_chunk(int number, void *temp_data, int *data_size) |
106 | { |
||
107 | |||
108 | return 0; |
||
109 | |||
110 | } |
||
111 | |||
550 | giacomo | 112 | int FTrace_OSD_send_chunk(FTrace_Chunk_Ptr c, int osd_flag) |
498 | giacomo | 113 | { |
114 | |||
551 | giacomo | 115 | FTrace_OSD_create_udp_task(c); |
550 | giacomo | 116 | |
498 | giacomo | 117 | return 0; |
118 | |||
119 | } |
||
120 | |||
534 | giacomo | 121 | int FTrace_OSD_chunk_dump(FTrace_Chunk_Ptr c) |
122 | { |
||
498 | giacomo | 123 | |
534 | giacomo | 124 | FTrace_printf("Position : %x\n",*(int *)(c->osd)); |
125 | FTrace_printf("Start : %x\n",*(int *)(c->osd+4)); |
||
126 | FTrace_printf("Size : %d\n",*(int *)(c->osd+8)); |
||
127 | FTrace_printf("Em-Size : %d\n",*(int *)(c->osd+12)); |
||
128 | FTrace_printf("Flags : %x\n",*(int *)(c->osd+16)); |
||
129 | FTrace_printf("Next : %x\n\n",*(int *)(c->osd+20)); |
||
130 | |||
131 | FTrace_dump_ipoints(c->osd); |
||
132 | |||
133 | return 0; |
||
134 | |||
135 | } |
||
136 | |||
137 |