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 | |||
563 | giacomo | 18 | __asm__("cpuid\n\t":::"eax","ebx","ecx","edx"); |
498 | giacomo | 19 | FTracef = kern_fsave(); |
20 | |||
21 | } |
||
22 | |||
23 | void FTrace_frestore() |
||
24 | { |
||
563 | giacomo | 25 | __asm__("cpuid\n\t":::"eax","ebx","ecx","edx"); |
498 | giacomo | 26 | kern_frestore(FTracef); |
27 | |||
28 | } |
||
29 | |||
30 | void FTrace_lock() |
||
31 | { |
||
32 | |||
33 | } |
||
34 | |||
35 | void FTrace_unlock() |
||
36 | { |
||
37 | |||
38 | } |
||
39 | |||
40 | void *FTrace_malloc(int size) |
||
41 | { |
||
42 | |||
43 | return malloc(size); |
||
44 | |||
45 | } |
||
46 | |||
47 | void FTrace_free(void *ptr) |
||
48 | { |
||
49 | |||
50 | free(ptr); |
||
51 | |||
52 | } |
||
53 | |||
54 | int FTrace_OSD_init() |
||
55 | { |
||
56 | |||
57 | return 0; |
||
58 | |||
59 | } |
||
60 | |||
501 | giacomo | 61 | /* OSD_pointers |
532 | giacomo | 62 | |
534 | giacomo | 63 | 00 - Actual Chunk Position |
64 | 04 - Actual Chunk Start |
||
65 | 08 - Actual Chunk Size |
||
66 | 12 - Actual Chunk Emergency Size |
||
67 | 16 - Actual Chunk Flags |
||
501 | giacomo | 68 | |
534 | giacomo | 69 | 20 - Next Chunk OSD Pointer |
501 | giacomo | 70 | |
71 | */ |
||
72 | |||
73 | int FTrace_OSD_chunk_init(FTrace_Chunk_Ptr c, int size, int emergency_size, FTrace_flags flags) |
||
498 | giacomo | 74 | { |
75 | |||
532 | giacomo | 76 | *(DWORD *)(c->osd) = (DWORD)(c->osd + FTRACE_OSD_CHUNK_HEAD); |
501 | giacomo | 77 | *(DWORD *)(c->osd + 4) = (DWORD)(c->osd + FTRACE_OSD_CHUNK_HEAD); |
534 | giacomo | 78 | *(DWORD *)(c->osd + 8) = (DWORD)(c->size); |
79 | *(DWORD *)(c->osd + 12) = (DWORD)(c->emergency_size); |
||
80 | *(DWORD *)(c->osd + 16) = (DWORD)(c->flags); |
||
81 | *(DWORD *)(c->osd + 20) = 0; |
||
501 | giacomo | 82 | |
498 | giacomo | 83 | return 0; |
84 | |||
85 | } |
||
86 | |||
87 | /* OSD Chunk Link */ |
||
532 | giacomo | 88 | int FTrace_OSD_chunk_link(FTrace_Chunk_Ptr a, FTrace_Chunk_Ptr b) |
498 | giacomo | 89 | { |
90 | |||
534 | giacomo | 91 | *(DWORD *)(a->osd + 20) = (DWORD)(b->osd); |
498 | giacomo | 92 | |
93 | return 0; |
||
94 | |||
95 | } |
||
96 | |||
503 | giacomo | 97 | int FTrace_OSD_update_chunk_flags(FTrace_Chunk_Ptr c) |
98 | { |
||
99 | |||
534 | giacomo | 100 | *(DWORD *)(c->osd + 16) = (DWORD)(c->flags); |
503 | giacomo | 101 | |
102 | return 0; |
||
103 | |||
104 | } |
||
105 | |||
498 | giacomo | 106 | int FTrace_OSD_compress_chunk(int number, void *temp_data, int *data_size) |
107 | { |
||
108 | |||
109 | return 0; |
||
110 | |||
111 | } |
||
112 | |||
550 | giacomo | 113 | int FTrace_OSD_send_chunk(FTrace_Chunk_Ptr c, int osd_flag) |
498 | giacomo | 114 | { |
115 | |||
552 | giacomo | 116 | extern volatile int sending_flag; |
117 | |||
551 | giacomo | 118 | FTrace_OSD_create_udp_task(c); |
550 | giacomo | 119 | |
552 | giacomo | 120 | while(sending_flag); |
121 | |||
498 | giacomo | 122 | return 0; |
123 | |||
124 | } |
||
125 | |||
534 | giacomo | 126 | int FTrace_OSD_chunk_dump(FTrace_Chunk_Ptr c) |
127 | { |
||
498 | giacomo | 128 | |
534 | giacomo | 129 | FTrace_printf("Position : %x\n",*(int *)(c->osd)); |
130 | FTrace_printf("Start : %x\n",*(int *)(c->osd+4)); |
||
131 | FTrace_printf("Size : %d\n",*(int *)(c->osd+8)); |
||
132 | FTrace_printf("Em-Size : %d\n",*(int *)(c->osd+12)); |
||
133 | FTrace_printf("Flags : %x\n",*(int *)(c->osd+16)); |
||
134 | FTrace_printf("Next : %x\n\n",*(int *)(c->osd+20)); |
||
135 | |||
136 | return 0; |
||
137 | |||
138 | } |
||
139 | |||
140 |