*/
tVAddr MM_NewKStack(void)
{
- tVAddr base = KERNEL_STACKS;
+ tVAddr base;
Uint i;
- 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;
- for(i=0;i<KERNEL_STACK_SIZE;i+=0x1000) {
+ for(i = 0; i < KERNEL_STACK_SIZE; i += 0x1000) {
MM_Allocate(base+i);
}
+ Log("MM_NewKStack - Allocated %p", base + KERNEL_STACK_SIZE);
return base+KERNEL_STACK_SIZE;
}
Warning("MM_NewKStack - No address space left\n");
; 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
;
Uint tmpEbp, oldEsp = esp;
// Set CR3
+ #if USE_PAE
+ # warning "PAE Unimplemented"
+ #else
newThread->MemState.CR3 = cur->MemState.CR3;
+ #endif
// Create new KStack
newThread->KernelStack = MM_NewKStack();
__asm__ __volatile__ ("mov %0, %%db0" : : "r" (newThread) );
#if USE_MP
// ACK the interrupt
- if(GetCPUNum())
+ if( GetCPUNum() )
gpMP_LocalAPIC->EOI.Val = 0;
else
#endif
// 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;
// === EXPORTS ===
EXPORT(Threads_GetUID);
+EXPORT(Mutex_Acquire);
+EXPORT(Mutex_Release);
+EXPORT(Mutex_IsLocked);
return 1;
}
- switch( argv[i][0] )
+ switch( argv[i][1] )
{
case 'f':
gbForkBomb = 1;
CPPFLAGS +=
CFLAGS += -Wall -Werror -O3
-LDFLAGS += -lspiderscript
+LDFLAGS +=
+# -lspiderscript
BIN = ../init
OBJ = main.o
#include <acess/sys.h>
#include <stdlib.h>
#include <stdio.h>
-#include <spiderscript.h>
+//#include <spiderscript.h>
//#include "common.h"
// === CONSTANTS ===
#define ARRAY_SIZE(x) ((sizeof(x))/(sizeof((x)[0])))
// === PROTOTYPES ===
+/*
tSpiderVariable *Script_System_IO_Open(tSpiderScript *, int, tSpiderVariable *);
+*/
// === GLOBALS ===
+/*
tSpiderFunction gaScriptNS_IO_Fcns[] = {
{"Open", Script_System_IO_Open}
};
"init", 0,
ARRAY_SIZE(gaScriptNamespaces), gaScriptNamespaces
};
+*/
// === CODE ===
/**
*/
void ExecuteScript(const char *Filename)
{
+ /*
tSpiderScript *script;
script = SpiderScript_ParseFile(&gScriptVariant, Filename);
SpiderScript_ExecuteMethod(script, "");
SpiderScript_Free(script);
+ */
}
/**
* \brief Open a file
*/
+/*
tSpiderVariable *Script_System_IO_Open(tSpiderScript *Script, int NArgs, tSpiderVariable *Args)
{
return NULL;
}
+*/
return retval;
}
-/**
- * \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