Rev 552 |
Rev 1027 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
#include <FTrace_chunk.h>
#include <FTrace_OSD.h>
#include <FTrace_types.h>
#include <FTrace_udp.h>
#include <kernel/kern.h>
#include <stdlib.h>
SYS_FLAGS FTracef
;
extern FTrace_Chunk_Ptr ActualChunk
;
extern void *OSD_current_pointer
;
void FTrace_fsave
()
{
__asm__
("cpuid\n\t":::"eax","ebx","ecx","edx");
FTracef
= kern_fsave
();
}
void FTrace_frestore
()
{
__asm__
("cpuid\n\t":::"eax","ebx","ecx","edx");
kern_frestore
(FTracef
);
}
void FTrace_lock
()
{
}
void FTrace_unlock
()
{
}
void *FTrace_malloc
(int size
)
{
return malloc(size
);
}
void FTrace_free
(void *ptr
)
{
free(ptr
);
}
int FTrace_OSD_init
()
{
return 0;
}
/* OSD_pointers
00 - Actual Chunk Position
04 - Actual Chunk Start
08 - Actual Chunk Size
12 - Actual Chunk Emergency Size
16 - Actual Chunk Flags
20 - Next Chunk OSD Pointer
*/
int FTrace_OSD_chunk_init
(FTrace_Chunk_Ptr c
, int size
, int emergency_size
, FTrace_flags flags
)
{
*(DWORD
*)(c
->osd
) = (DWORD
)(c
->osd
+ FTRACE_OSD_CHUNK_HEAD
);
*(DWORD
*)(c
->osd
+ 4) = (DWORD
)(c
->osd
+ FTRACE_OSD_CHUNK_HEAD
);
*(DWORD
*)(c
->osd
+ 8) = (DWORD
)(c
->size
);
*(DWORD
*)(c
->osd
+ 12) = (DWORD
)(c
->emergency_size
);
*(DWORD
*)(c
->osd
+ 16) = (DWORD
)(c
->flags
);
*(DWORD
*)(c
->osd
+ 20) = 0;
return 0;
}
/* OSD Chunk Link */
int FTrace_OSD_chunk_link
(FTrace_Chunk_Ptr a
, FTrace_Chunk_Ptr b
)
{
*(DWORD
*)(a
->osd
+ 20) = (DWORD
)(b
->osd
);
return 0;
}
int FTrace_OSD_update_chunk_flags
(FTrace_Chunk_Ptr c
)
{
*(DWORD
*)(c
->osd
+ 16) = (DWORD
)(c
->flags
);
return 0;
}
int FTrace_OSD_compress_chunk
(int number
, void *temp_data
, int *data_size
)
{
return 0;
}
int FTrace_OSD_send_chunk
(FTrace_Chunk_Ptr c
, int osd_flag
)
{
extern volatile int sending_flag
;
FTrace_OSD_create_udp_task
(c
);
while(sending_flag
);
return 0;
}
int FTrace_OSD_chunk_dump
(FTrace_Chunk_Ptr c
)
{
FTrace_printf
("Position : %x\n",*(int *)(c
->osd
));
FTrace_printf
("Start : %x\n",*(int *)(c
->osd
+4));
FTrace_printf
("Size : %d\n",*(int *)(c
->osd
+8));
FTrace_printf
("Em-Size : %d\n",*(int *)(c
->osd
+12));
FTrace_printf
("Flags : %x\n",*(int *)(c
->osd
+16));
FTrace_printf
("Next : %x\n\n",*(int *)(c
->osd
+20));
return 0;
}