- Darn, there's still a requirement for proc.asm to know the structure
of tThread
*/
tVAddr MM_NewKStack(void)
{
*/
tVAddr MM_NewKStack(void)
{
- tVAddr base = KERNEL_STACKS;
- for(;base<KERNEL_STACKS_END;base+=KERNEL_STACK_SIZE)
+ for(base = KERNEL_STACKS; base < KERNEL_STACKS_END; base += KERNEL_STACK_SIZE)
{
if(MM_GetPhysAddr(base) != 0) continue;
{
if(MM_GetPhysAddr(base) != 0) continue;
- for(i=0;i<KERNEL_STACK_SIZE;i+=0x1000) {
+ for(i = 0; i < KERNEL_STACK_SIZE; i += 0x1000) {
+ Log("MM_NewKStack - Allocated %p", base + KERNEL_STACK_SIZE);
return base+KERNEL_STACK_SIZE;
}
Warning("MM_NewKStack - No address space left\n");
return base+KERNEL_STACK_SIZE;
}
Warning("MM_NewKStack - No address space left\n");
; EAX is the current thread
mov ebx, eax
; EAX is the current thread
mov ebx, eax
- mov eax, [ebx+40] ; Get Kernel Stack
+ mov eax, [ebx+12*4] ; Get Kernel Stack
sub eax, KSTACK_USERSTATE_SIZE
;
sub eax, KSTACK_USERSTATE_SIZE
;
Uint tmpEbp, oldEsp = esp;
// Set CR3
Uint tmpEbp, oldEsp = esp;
// Set CR3
+ #if USE_PAE
+ # warning "PAE Unimplemented"
+ #else
newThread->MemState.CR3 = cur->MemState.CR3;
newThread->MemState.CR3 = cur->MemState.CR3;
// Create new KStack
newThread->KernelStack = MM_NewKStack();
// Create new KStack
newThread->KernelStack = MM_NewKStack();
__asm__ __volatile__ ("mov %0, %%db0" : : "r" (newThread) );
#if USE_MP
// ACK the interrupt
__asm__ __volatile__ ("mov %0, %%db0" : : "r" (newThread) );
#if USE_MP
// ACK the interrupt
gpMP_LocalAPIC->EOI.Val = 0;
else
#endif
gpMP_LocalAPIC->EOI.Val = 0;
else
#endif
// Wake new owner
Mutex->Owner->Status = THREAD_STAT_ACTIVE;
Threads_AddActive(Mutex->Owner);
// Wake new owner
Mutex->Owner->Status = THREAD_STAT_ACTIVE;
Threads_AddActive(Mutex->Owner);
- Log("Mutex %p Woke %p", Mutex, Mutex->Owner);
+ //Log("Mutex %p Woke %p", Mutex, Mutex->Owner);
}
else {
Mutex->Owner = NULL;
}
else {
Mutex->Owner = NULL;
// === EXPORTS ===
EXPORT(Threads_GetUID);
// === EXPORTS ===
EXPORT(Threads_GetUID);
+EXPORT(Mutex_Acquire);
+EXPORT(Mutex_Release);
+EXPORT(Mutex_IsLocked);
{
case 'f':
gbForkBomb = 1;
{
case 'f':
gbForkBomb = 1;
CPPFLAGS +=
CFLAGS += -Wall -Werror -O3
CPPFLAGS +=
CFLAGS += -Wall -Werror -O3
-LDFLAGS += -lspiderscript
+LDFLAGS +=
+# -lspiderscript
BIN = ../init
OBJ = main.o
BIN = ../init
OBJ = main.o
#include <acess/sys.h>
#include <stdlib.h>
#include <stdio.h>
#include <acess/sys.h>
#include <stdlib.h>
#include <stdio.h>
-#include <spiderscript.h>
+//#include <spiderscript.h>
//#include "common.h"
// === CONSTANTS ===
//#include "common.h"
// === CONSTANTS ===
#define ARRAY_SIZE(x) ((sizeof(x))/(sizeof((x)[0])))
// === PROTOTYPES ===
#define ARRAY_SIZE(x) ((sizeof(x))/(sizeof((x)[0])))
// === PROTOTYPES ===
tSpiderVariable *Script_System_IO_Open(tSpiderScript *, int, tSpiderVariable *);
tSpiderVariable *Script_System_IO_Open(tSpiderScript *, int, tSpiderVariable *);
tSpiderFunction gaScriptNS_IO_Fcns[] = {
{"Open", Script_System_IO_Open}
};
tSpiderFunction gaScriptNS_IO_Fcns[] = {
{"Open", Script_System_IO_Open}
};
"init", 0,
ARRAY_SIZE(gaScriptNamespaces), gaScriptNamespaces
};
"init", 0,
ARRAY_SIZE(gaScriptNamespaces), gaScriptNamespaces
};
*/
void ExecuteScript(const char *Filename)
{
*/
void ExecuteScript(const char *Filename)
{
tSpiderScript *script;
script = SpiderScript_ParseFile(&gScriptVariant, Filename);
SpiderScript_ExecuteMethod(script, "");
SpiderScript_Free(script);
tSpiderScript *script;
script = SpiderScript_ParseFile(&gScriptVariant, Filename);
SpiderScript_ExecuteMethod(script, "");
SpiderScript_Free(script);
}
/**
* \brief Open a file
*/
}
/**
* \brief Open a file
*/
tSpiderVariable *Script_System_IO_Open(tSpiderScript *Script, int NArgs, tSpiderVariable *Args)
{
return NULL;
}
tSpiderVariable *Script_System_IO_Open(tSpiderScript *Script, int NArgs, tSpiderVariable *Args)
{
return NULL;
}
-/**
- * \fn EXPORT int strncmp(const char *s1, const char *s2, size_t len)
- * \brief Compare two strings with a limit
- */
-EXPORT int strncmp(const char *s1, const char *s2, size_t len)
-{
- while(--len && *s1 == *s2 && *s1 != '\0' && *s2 != '\0') {
- s1++; s2++;
- }
- return (int)*s1 - (int)*s2;
-}
-
/**
* \fn EXPORT char *strdup(const char *str)
* \brief Duplicate a string using heap memory
/**
* \fn EXPORT char *strdup(const char *str)
* \brief Duplicate a string using heap memory