Rev 503 |
Rev 534 |
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 <kernel/kern.h>
#include <stdlib.h>
SYS_FLAGS FTracef
;
extern FTrace_Chunk_Ptr ActualChunk
;
extern BYTE OSD_pointers
[FTRACE_OSD_CHUNK_HEAD
];
void FTrace_fsave
()
{
FTracef
= kern_fsave
();
}
void FTrace_frestore
()
{
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
04 - Actual Chunk Position
08 - Actual Chunk Start
12 - Actual Chunk Size
16 - Actual Chunk Emergency Size
20 - Actual Chunk Flags
24 - Next1 Chunk Position
28 - Next1 Chunk Start
32 - Next1 Chunk Size
36 - Next1 Chunk Emergency Size
40 - Next1 Chunk Flags
*/
int FTrace_OSD_chunk_init
(FTrace_Chunk_Ptr c
, int size
, int emergency_size
, FTrace_flags flags
)
{
*(DWORD
*)(c
->osd
) = 4;
*(DWORD
*)(c
->osd
+ 4) = (DWORD
)(c
->osd
+ FTRACE_OSD_CHUNK_HEAD
);
*(DWORD
*)(c
->osd
+ 8) = (DWORD
)(c
->osd
+ FTRACE_OSD_CHUNK_HEAD
);
*(DWORD
*)(c
->osd
+ 12) = (DWORD
)(c
->size
);
*(DWORD
*)(c
->osd
+ 16) = (DWORD
)(c
->emergency_size
);
*(DWORD
*)(c
->osd
+ 20) = (DWORD
)(c
->flags
);
*(DWORD
*)(c
->osd
+ 24) = 0;
*(DWORD
*)(c
->osd
+ 28) = 0;
*(DWORD
*)(c
->osd
+ 32) = 0;
*(DWORD
*)(c
->osd
+ 36) = 0;
*(DWORD
*)(c
->osd
+ 40) = 0;
*(DWORD
*)(c
->osd
+ 44) = 0;
*(DWORD
*)(c
->osd
+ 48) = 0;
*(DWORD
*)(c
->osd
+ 52) = 0;
*(DWORD
*)(c
->osd
+ 56) = 0;
*(DWORD
*)(c
->osd
+ 60) = 0;
return 0;
}
/* OSD Chunk Link */
int FTrace_OSD_chunk_link
(FTrace_Chunk_Ptr a
, FTrace_Chunk_Ptr b
, int osd_flags
)
{
int delta
= 0;
if (osd_flags
== FTRACE_OSD_NEXT1
)
delta
= 24;
if (osd_flags
== FTRACE_OSD_NEXT2
)
delta
= 44;
if (delta
== 0) return -1;
memcpy((void *)(a
->osd
+delta
),(void *)(b
->osd
+4),20);
return 0;
}
int FTrace_OSD_update_chunk_flags
(FTrace_Chunk_Ptr c
)
{
*(DWORD
*)(c
->osd
+ 20) = (DWORD
)(c
->flags
);
return 0;
}
int FTrace_OSD_load_pointers
()
{
if (ActualChunk
== NULL
) return -1;
memcpy((void *)OSD_pointers
,(void *)ActualChunk
->osd
,FTRACE_OSD_CHUNK_HEAD
);
return 0;
}
int FTrace_OSD_save_pointers
()
{
if (ActualChunk
== NULL
) return -1;
memcpy((void *)ActualChunk
->osd
,(void *)OSD_pointers
,FTRACE_OSD_CHUNK_HEAD
);
return 0;
}
int FTrace_OSD_compress_chunk
(int number
, void *temp_data
, int *data_size
)
{
return 0;
}
int FTrace_OSD_send_chunk
(int number
, int osd_flag
)
{
return 0;
}