git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kernel/x86 - Add IP/SP output to thread dump
[tpg/acess2.git]
/
KernelLand
/
Kernel
/
arch
/
x86
/
proc.c
diff --git
a/KernelLand/Kernel/arch/x86/proc.c
b/KernelLand/Kernel/arch/x86/proc.c
index
2869c3c
..
5637985
100644
(file)
--- a/
KernelLand/Kernel/arch/x86/proc.c
+++ b/
KernelLand/Kernel/arch/x86/proc.c
@@
-24,11
+24,14
@@
#define DEBUG_DISABLE_DOUBLEFAULT 1
#define DEBUG_VERY_SLOW_PERIOD 0
#define DEBUG_NOPREEMPT 1
#define DEBUG_DISABLE_DOUBLEFAULT 1
#define DEBUG_VERY_SLOW_PERIOD 0
#define DEBUG_NOPREEMPT 1
+#define DISABLE_PIT 0
// === CONSTANTS ===
// Base is 1193182
#define TIMER_BASE 1193182
// === CONSTANTS ===
// Base is 1193182
#define TIMER_BASE 1193182
-#if DEBUG_VERY_SLOW_PERIOD
+#if DISABLE_PIT
+# define TIMER_DIVISOR 0xFFFF
+#elif DEBUG_VERY_SLOW_PERIOD
# define TIMER_DIVISOR 1193 //~10Hz switch, with 10 quantum = 1s per thread
#else
# define TIMER_DIVISOR 11932 //~100Hz
# define TIMER_DIVISOR 1193 //~10Hz switch, with 10 quantum = 1s per thread
#else
# define TIMER_DIVISOR 11932 //~100Hz
@@
-210,7
+213,7
@@
void ArchThreads_Init(void)
gProcessZero.MemState.CR3 = (Uint)gaInitPageDir - KERNEL_BASE;
// Create Per-Process Data Block
gProcessZero.MemState.CR3 = (Uint)gaInitPageDir - KERNEL_BASE;
// Create Per-Process Data Block
- if(
!MM_Allocate(MM_PPD_CFG)
)
+ if(
MM_Allocate( (void*)MM_PPD_CFG ) == 0
)
{
Panic("OOM - No space for initial Per-Process Config");
}
{
Panic("OOM - No space for initial Per-Process Config");
}
@@
-550,27
+553,28
@@
tThread *Proc_SpawnWorker(void (*Fcn)(void*), void *Data)
*/
Uint Proc_MakeUserStack(void)
{
*/
Uint Proc_MakeUserStack(void)
{
- int i;
- Uint base = USER_STACK_TOP - USER_STACK_SZ;
+ tPage *base = (void*)(USER_STACK_TOP - USER_STACK_SZ);
// Check Prospective Space
// Check Prospective Space
- for( i = USER_STACK_SZ >> 12; i--; )
- if( MM_GetPhysAddr( (void*)(base + (i<<12)) ) != 0 )
- break;
-
- if(i != -1) return 0;
-
+ for( Uint i = USER_STACK_SZ/PAGE_SIZE; i--; )
+ {
+ if( MM_GetPhysAddr( base + i ) != 0 )
+ {
+ Warning("Proc_MakeUserStack: Address %p in use", base + i);
+ return 0;
+ }
+ }
// Allocate Stack - Allocate incrementally to clean up MM_Dump output
// Allocate Stack - Allocate incrementally to clean up MM_Dump output
- for(
i = 0; i < USER_STACK_SZ/0x1000
; i++ )
+ for(
Uint i = 0; i < USER_STACK_SZ/PAGE_SIZE
; i++ )
{
{
- if(
!MM_Allocate( base + (i<<12) )
)
+ if(
MM_Allocate( base + i ) == 0
)
{
Warning("OOM: Proc_MakeUserStack");
return 0;
}
}
{
Warning("OOM: Proc_MakeUserStack");
return 0;
}
}
- return
base + USER_STACK_SZ
;
+ return
(tVAddr)( base + USER_STACK_SZ/PAGE_SIZE )
;
}
void Proc_StartUser(Uint Entrypoint, Uint Base, int ArgC, const char **ArgV, int DataSize)
}
void Proc_StartUser(Uint Entrypoint, Uint Base, int ArgC, const char **ArgV, int DataSize)
@@
-725,7
+729,9
@@
void Proc_DumpThreadCPUState(tThread *Thread)
Error_Backtrace(regs->eip, regs->ebp);
return ;
}
Error_Backtrace(regs->eip, regs->ebp);
return ;
}
-
+
+ Log(" Saved = %p (SP=%p)", Thread->SavedState.EIP, Thread->SavedState.ESP);
+
tVAddr diffFromScheduler = Thread->SavedState.EIP - (tVAddr)SwitchTasks;
tVAddr diffFromClone = Thread->SavedState.EIP - (tVAddr)Proc_CloneInt;
tVAddr diffFromSpawn = Thread->SavedState.EIP - (tVAddr)NewTaskHeader;
tVAddr diffFromScheduler = Thread->SavedState.EIP - (tVAddr)SwitchTasks;
tVAddr diffFromClone = Thread->SavedState.EIP - (tVAddr)Proc_CloneInt;
tVAddr diffFromSpawn = Thread->SavedState.EIP - (tVAddr)NewTaskHeader;
UCC
git Repository :: git.ucc.asn.au