Rev 503 | Rev 532 | 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 | |||
5 | #include <kernel/kern.h> |
||
6 | #include <stdlib.h> |
||
7 | |||
8 | SYS_FLAGS FTracef; |
||
9 | |||
10 | extern FTrace_Chunk_Ptr ActualChunk; |
||
11 | extern BYTE OSD_pointers[FTRACE_OSD_CHUNK_HEAD]; |
||
12 | |||
13 | void FTrace_fsave() |
||
14 | { |
||
15 | |||
16 | FTracef = kern_fsave(); |
||
17 | |||
18 | } |
||
19 | |||
20 | void FTrace_frestore() |
||
21 | { |
||
22 | |||
23 | kern_frestore(FTracef); |
||
24 | |||
25 | } |
||
26 | |||
27 | void FTrace_lock() |
||
28 | { |
||
29 | |||
30 | } |
||
31 | |||
32 | void FTrace_unlock() |
||
33 | { |
||
34 | |||
35 | } |
||
36 | |||
37 | void *FTrace_malloc(int size) |
||
38 | { |
||
39 | |||
40 | return malloc(size); |
||
41 | |||
42 | } |
||
43 | |||
44 | void FTrace_free(void *ptr) |
||
45 | { |
||
46 | |||
47 | free(ptr); |
||
48 | |||
49 | } |
||
50 | |||
51 | int FTrace_OSD_init() |
||
52 | { |
||
53 | |||
54 | return 0; |
||
55 | |||
56 | } |
||
57 | |||
501 | giacomo | 58 | /* OSD_pointers |
59 | |||
504 | giacomo | 60 | 04 - Actual Chunk Position |
61 | 08 - Actual Chunk Start |
||
62 | 12 - Actual Chunk Size |
||
63 | 16 - Actual Chunk Emergency Size |
||
64 | 20 - Actual Chunk Flags |
||
501 | giacomo | 65 | |
504 | giacomo | 66 | 24 - Next1 Chunk Position |
67 | 28 - Next1 Chunk Start |
||
68 | 32 - Next1 Chunk Size |
||
69 | 36 - Next1 Chunk Emergency Size |
||
70 | 40 - Next1 Chunk Flags |
||
501 | giacomo | 71 | |
72 | */ |
||
73 | |||
74 | int FTrace_OSD_chunk_init(FTrace_Chunk_Ptr c, int size, int emergency_size, FTrace_flags flags) |
||
498 | giacomo | 75 | { |
76 | |||
501 | giacomo | 77 | *(DWORD *)(c->osd) = 4; |
498 | giacomo | 78 | |
501 | giacomo | 79 | *(DWORD *)(c->osd + 4) = (DWORD)(c->osd + FTRACE_OSD_CHUNK_HEAD); |
80 | *(DWORD *)(c->osd + 8) = (DWORD)(c->osd + FTRACE_OSD_CHUNK_HEAD); |
||
81 | *(DWORD *)(c->osd + 12) = (DWORD)(c->size); |
||
82 | *(DWORD *)(c->osd + 16) = (DWORD)(c->emergency_size); |
||
83 | *(DWORD *)(c->osd + 20) = (DWORD)(c->flags); |
||
84 | |||
498 | giacomo | 85 | *(DWORD *)(c->osd + 24) = 0; |
86 | *(DWORD *)(c->osd + 28) = 0; |
||
87 | *(DWORD *)(c->osd + 32) = 0; |
||
88 | *(DWORD *)(c->osd + 36) = 0; |
||
501 | giacomo | 89 | *(DWORD *)(c->osd + 40) = 0; |
498 | giacomo | 90 | |
91 | *(DWORD *)(c->osd + 44) = 0; |
||
92 | *(DWORD *)(c->osd + 48) = 0; |
||
93 | *(DWORD *)(c->osd + 52) = 0; |
||
94 | *(DWORD *)(c->osd + 56) = 0; |
||
501 | giacomo | 95 | *(DWORD *)(c->osd + 60) = 0; |
498 | giacomo | 96 | |
97 | return 0; |
||
98 | |||
99 | } |
||
100 | |||
101 | /* OSD Chunk Link */ |
||
102 | int FTrace_OSD_chunk_link(FTrace_Chunk_Ptr a, FTrace_Chunk_Ptr b, int osd_flags) |
||
103 | { |
||
104 | |||
105 | int delta = 0; |
||
106 | |||
107 | if (osd_flags == FTRACE_OSD_NEXT1) |
||
501 | giacomo | 108 | delta = 24; |
498 | giacomo | 109 | if (osd_flags == FTRACE_OSD_NEXT2) |
501 | giacomo | 110 | delta = 44; |
498 | giacomo | 111 | |
112 | if (delta == 0) return -1; |
||
113 | |||
503 | giacomo | 114 | memcpy((void *)(a->osd+delta),(void *)(b->osd+4),20); |
498 | giacomo | 115 | |
116 | return 0; |
||
117 | |||
118 | } |
||
119 | |||
503 | giacomo | 120 | int FTrace_OSD_update_chunk_flags(FTrace_Chunk_Ptr c) |
121 | { |
||
122 | |||
123 | *(DWORD *)(c->osd + 20) = (DWORD)(c->flags); |
||
124 | |||
125 | return 0; |
||
126 | |||
127 | } |
||
128 | |||
498 | giacomo | 129 | int FTrace_OSD_load_pointers() |
130 | { |
||
131 | |||
132 | if (ActualChunk == NULL) return -1; |
||
133 | |||
134 | memcpy((void *)OSD_pointers,(void *)ActualChunk->osd,FTRACE_OSD_CHUNK_HEAD); |
||
135 | |||
136 | return 0; |
||
137 | |||
138 | } |
||
139 | |||
140 | int FTrace_OSD_save_pointers() |
||
141 | { |
||
142 | |||
143 | if (ActualChunk == NULL) return -1; |
||
144 | |||
145 | memcpy((void *)ActualChunk->osd,(void *)OSD_pointers,FTRACE_OSD_CHUNK_HEAD); |
||
146 | |||
147 | return 0; |
||
148 | |||
149 | } |
||
150 | |||
151 | int FTrace_OSD_compress_chunk(int number, void *temp_data, int *data_size) |
||
152 | { |
||
153 | |||
154 | return 0; |
||
155 | |||
156 | } |
||
157 | |||
158 | int FTrace_OSD_send_chunk(int number, int osd_flag) |
||
159 | { |
||
160 | |||
161 | return 0; |
||
162 | |||
163 | } |
||
164 | |||
165 |