git-svn-id: https://spexeah.com:8443/svn/Asuro@497 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c

This commit is contained in:
kieron
2018-04-11 17:13:34 +00:00
parent 82a497430f
commit 44d31235d7
65 changed files with 33 additions and 20 deletions

View File

@ -15,6 +15,7 @@ const
KERNEL_VIRTUAL_BASE = $C0000000;
KERNEL_PAGE_NUMBER = KERNEL_VIRTUAL_BASE SHR 22;
BSOD_ENABLE = true;
TRACER_ENABLE = true;
type
//internal types

View File

@ -22,7 +22,7 @@ var
procedure freeze;
begin
t_ready:= false;
if TRACER_ENABLE then t_ready:= false;
end;
procedure push_trace(t_name : pchar);
@ -30,24 +30,28 @@ var
mem : void;
begin
if t_ready then begin
if not Locked then begin
Locked:= true;
mem:= LL_Insert(TraceStack, 0);
memset(uint32(mem), 0, StringSize(t_name) + 5);
memcpy(uint32(t_name), uint32(mem), StringSize(t_name) + 1);
Locked:= false;
if TRACER_ENABLE then begin
if t_ready then begin
if not Locked then begin
Locked:= true;
mem:= LL_Insert(TraceStack, 0);
memset(uint32(mem), 0, StringSize(t_name) + 5);
memcpy(uint32(t_name), uint32(mem), StringSize(t_name) + 1);
Locked:= false;
end;
end;
end;
end;
procedure pop_trace;
begin
if t_ready then begin
if not Locked then begin
Locked:= true;
LL_Delete(TraceStack, 0);
Locked:= false;
if TRACER_ENABLE then begin
if t_ready then begin
if not Locked then begin
Locked:= true;
LL_Delete(TraceStack, 0);
Locked:= false;
end;
end;
end;
end;
@ -55,26 +59,34 @@ end;
function get_last_trace : pchar;
begin
get_last_trace:= nil;
if t_ready then begin
get_last_trace:= pchar(LL_Get(TraceStack, 0));
if TRACER_ENABLE then begin
if t_ready then begin
get_last_trace:= pchar(LL_Get(TraceStack, 0));
end;
end;
end;
procedure init;
begin
TraceStack:= LL_New(255);
t_ready:= true;
push_trace('kmain');
if TRACER_ENABLE then begin
TraceStack:= LL_New(255);
t_ready:= true;
push_trace('kmain');
end;
end;
function get_trace_count : uint32;
begin
get_trace_count:= LL_Size(TraceStack);
if TRACER_ENABLE then begin
get_trace_count:= LL_Size(TraceStack);
end;
end;
function get_trace_N(idx : uint32) : pchar;
begin
get_trace_N:= pchar(LL_Get(TraceStack, idx));
if TRACER_ENABLE then begin
get_trace_N:= pchar(LL_Get(TraceStack, idx));
end;
end;
end.