Rev 532 | Rev 551 | 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; |
||
532 | giacomo | 11 | extern void *OSD_current_pointer; |
498 | giacomo | 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 |
532 | giacomo | 59 | |
534 | giacomo | 60 | 00 - Actual Chunk Position |
61 | 04 - Actual Chunk Start |
||
62 | 08 - Actual Chunk Size |
||
63 | 12 - Actual Chunk Emergency Size |
||
64 | 16 - Actual Chunk Flags |
||
501 | giacomo | 65 | |
534 | giacomo | 66 | 20 - Next Chunk OSD Pointer |
501 | giacomo | 67 | |
68 | */ |
||
69 | |||
70 | int FTrace_OSD_chunk_init(FTrace_Chunk_Ptr c, int size, int emergency_size, FTrace_flags flags) |
||
498 | giacomo | 71 | { |
72 | |||
532 | giacomo | 73 | *(DWORD *)(c->osd) = (DWORD)(c->osd + FTRACE_OSD_CHUNK_HEAD); |
501 | giacomo | 74 | *(DWORD *)(c->osd + 4) = (DWORD)(c->osd + FTRACE_OSD_CHUNK_HEAD); |
534 | giacomo | 75 | *(DWORD *)(c->osd + 8) = (DWORD)(c->size); |
76 | *(DWORD *)(c->osd + 12) = (DWORD)(c->emergency_size); |
||
77 | *(DWORD *)(c->osd + 16) = (DWORD)(c->flags); |
||
78 | *(DWORD *)(c->osd + 20) = 0; |
||
501 | giacomo | 79 | |
498 | giacomo | 80 | return 0; |
81 | |||
82 | } |
||
83 | |||
84 | /* OSD Chunk Link */ |
||
532 | giacomo | 85 | int FTrace_OSD_chunk_link(FTrace_Chunk_Ptr a, FTrace_Chunk_Ptr b) |
498 | giacomo | 86 | { |
87 | |||
534 | giacomo | 88 | *(DWORD *)(a->osd + 20) = (DWORD)(b->osd); |
498 | giacomo | 89 | |
90 | return 0; |
||
91 | |||
92 | } |
||
93 | |||
503 | giacomo | 94 | int FTrace_OSD_update_chunk_flags(FTrace_Chunk_Ptr c) |
95 | { |
||
96 | |||
534 | giacomo | 97 | *(DWORD *)(c->osd + 16) = (DWORD)(c->flags); |
503 | giacomo | 98 | |
99 | return 0; |
||
100 | |||
101 | } |
||
102 | |||
498 | giacomo | 103 | int FTrace_OSD_compress_chunk(int number, void *temp_data, int *data_size) |
104 | { |
||
105 | |||
106 | return 0; |
||
107 | |||
108 | } |
||
109 | |||
110 | int FTrace_OSD_send_chunk(int number, int osd_flag) |
||
111 | { |
||
112 | |||
113 | return 0; |
||
114 | |||
115 | } |
||
116 | |||
534 | giacomo | 117 | int FTrace_OSD_chunk_dump(FTrace_Chunk_Ptr c) |
118 | { |
||
498 | giacomo | 119 | |
534 | giacomo | 120 | FTrace_printf("Position : %x\n",*(int *)(c->osd)); |
121 | FTrace_printf("Start : %x\n",*(int *)(c->osd+4)); |
||
122 | FTrace_printf("Size : %d\n",*(int *)(c->osd+8)); |
||
123 | FTrace_printf("Em-Size : %d\n",*(int *)(c->osd+12)); |
||
124 | FTrace_printf("Flags : %x\n",*(int *)(c->osd+16)); |
||
125 | FTrace_printf("Next : %x\n\n",*(int *)(c->osd+20)); |
||
126 | |||
127 | FTrace_dump_ipoints(c->osd); |
||
128 | |||
129 | return 0; |
||
130 | |||
131 | } |
||
132 | |||
133 |