%macro ISR_ERRNO 1
[global Isr%1]
Isr%1:
- xchg bx, bx
+ ;xchg bx, bx
push %1
jmp ErrorCommon
%endmacro
%macro ISR_NOERR 1
[global Isr%1]
Isr%1:
- xchg bx, bx
+ ;xchg bx, bx
push 0
push %1
jmp ErrorCommon
va_start(args, Fmt);
Debug_DbgOnlyFmt(Fmt, args);
va_end(args);
+ Debug_PutCharDebug('\r');
Debug_PutCharDebug('\n');
}
/**
va_start(args, Fmt);
Debug_Fmt(Fmt, args);
va_end(args);
+ Debug_Putchar('\r');
Debug_Putchar('\n');
}
void Warning(char *Fmt, ...)
va_start(args, Fmt);
Debug_Fmt(Fmt, args);
va_end(args);
+ Debug_Putchar('\r');
Debug_Putchar('\n');
}
void Panic(char *Fmt, ...)
va_start(args, Fmt);
Debug_Fmt(Fmt, args);
va_end(args);
+ Debug_Putchar('\r');
Debug_Putchar('\n');
Threads_Dump();
}
va_end(args);
- Debug_Putchar(')'); Debug_Putchar('\n');
+ Debug_Putchar(')'); Debug_Putchar('\n'); Debug_Putchar('\r');
}
void Debug_Log(char *FuncName, char *Fmt, ...)
Debug_Fmt(Fmt, args);
va_end(args);
+ Debug_Putchar('\r');
Debug_Putchar('\n');
}
// No Return
if(RetType == '-') {
+ Debug_Putchar('\r');
Debug_Putchar('\n');
return;
}
// Extended (64-Bit)
case 'X': Debug_Fmt("0x%llx", args); break;
}
+ Debug_Putchar('\r');
Debug_Putchar('\n');
va_end(args);
Uint8 *cdat = Data;
Uint pos = 0;
Debug_Puts(1, Header);
- LogF(" (Hexdump of %p)\n", Data);
+ LogF(" (Hexdump of %p)\r\n", Data);
while(Length >= 16)
{
Length--;
cdat ++;
}
+ Debug_Putchar('\r');
Debug_Putchar('\n');
}
void Log_Int_PrintMessage(tLogEntry *Entry)
{
//LOCK( &glLogOutput );
- LogF("%s%014lli%s [%+8s] %s\x1B[0m\n",
+ LogF("%s%014lli%s [%+8s] %s\x1B[0m\r\n",
csaLevelColours[Entry->Level],
Entry->Time,
csaLevelCodes[Entry->Level],
{
Uint64 ret = 0;
Uint err = -EOK;
+ int callNum = Regs->Num;
- ENTER("iThread iNum", Threads_GetTID(), Regs->Num);
- if(Regs->Num < NUM_SYSCALLS)
- LOG("Syscall %s", cSYSCALL_NAMES[Regs->Num]);
+ #if DEBUG < 2
+ if(callNum != SYS_READ && callNum != SYS_WRITE) {
+ #endif
+ ENTER("iThread iNum", Threads_GetTID(), callNum);
+ if(callNum < NUM_SYSCALLS)
+ LOG("Syscall %s", cSYSCALL_NAMES[callNum]);
LOG("Arg1: 0x%x, Arg2: 0x%x, Arg3: 0x%x, Arg4: 0x%x", Regs->Arg1, Regs->Arg2, Regs->Arg3, Regs->Arg4);
+ #if DEBUG < 2
+ }
+ #endif
switch(Regs->Num)
{
ret = -1;
break;
}
+ LOG("VFS_Open(\"%s\", 0x%x)", (char*)Regs->Arg1, Regs->Arg2 | VFS_OPENFLAG_USER);
ret = VFS_Open((char*)Regs->Arg1, Regs->Arg2 | VFS_OPENFLAG_USER);
break;
case SYS_CLOSE:
+ LOG("VFS_Close(%i)", Regs->Arg1);
VFS_Close( Regs->Arg1 );
break;
#endif
Regs->Error = err;
#if DEBUG
+ # if DEBUG < 2
+ if( callNum != SYS_READ && callNum != SYS_WRITE ) {
+ # endif
LOG("err = %i", err);
if(Regs->Num != SYS_EXECVE)
LEAVE('x', ret);
else
LOG("Actual %i", ret);
+ # if DEBUG < 2
+ }
+ # endif
#endif
}
argc ++; // Count last argument
// --- Parse Arguments (Pass 1) ---
- for( i = 1; i < argc; i++ )
+ for( i = 0; i < argc; i++ )
{
switch(argv[i][0])
{
void System_ExecuteCommandLine(void)
{
int i;
- for( i = 1; i < argc; i++ )
+ for( i = 0; i < argc; i++ )
{
+ Log("argv[%i] = '%s'", i, argv[i]);
switch(argv[i][0])
{
// --- VFS ---
#include "initrd.h"
#include <modules.h>
+#define DUMP_ON_MOUNT 1
+
// === IMPORTS ==
extern tVFS_Node gInitRD_RootNode;
Uint64 InitRD_ReadFile(tVFS_Node *Node, Uint64 Offset, Uint64 Size, void *Buffer);
char *InitRD_ReadDir(tVFS_Node *Node, int ID);
tVFS_Node *InitRD_FindDir(tVFS_Node *Node, char *Name);
+void InitRD_DumpDir(tVFS_Node *Node, int Indent);
// === GLOBALS ===
MODULE_DEFINE(0, 0x0A, FS_InitRD, InitRD_Install, NULL);
int InitRD_Install(char **Arguments)
{
VFS_AddDriver( &gInitRD_FSInfo );
+
return MODULE_ERR_OK;
}
*/
tVFS_Node *InitRD_InitDevice(char *Device, char **Arguments)
{
+ #if DUMP_ON_MOUNT
+ InitRD_DumpDir( &gInitRD_RootNode, 0 );
+ #endif
return &gInitRD_RootNode;
}
return NULL;
}
+
+void InitRD_DumpDir(tVFS_Node *Node, int Indent)
+{
+ int i;
+ char indent[Indent+1];
+ tInitRD_File *dir = Node->ImplPtr;
+
+ for( i = 0; i < Indent; i++ ) indent[i] = ' ';
+ indent[i] = '\0';
+
+ for( i = 0; i < Node->Size; i++ )
+ {
+ //Log("%s- %p %s", indent, dir[i].Node, dir[i].Name);
+ if(dir[i].Node->Flags & VFS_FFLAG_DIRECTORY)
+ InitRD_DumpDir(dir[i].Node, Indent+1);
+ }
+}
-/* Acess2 RTL8139 Driver
+/*
+ * Acess2 RTL8139 Driver
* - By John Hodge (thePowersGang)
*
* main.c - Driver Core
} tCard;
// === PROTOTYPES ===
+ int RTL8139_Install(char **Options);
+char *RTL8139_ReadDir(tVFS_Node *Node, int Pos);
+tVFS_Node *RTL8139_FindDir(tVFS_Node *Node, const char *Filename);
+ int RTL8139_RootIOCtl(tVFS_Node *Node, int ID, void *Arg);
+Uint64 RTL8139_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer);
+Uint64 RTL8139_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer);
+void RTL8139_IRQHandler(int Num);
// === GLOBALS ===
MODULE_DEFINE(0, VERSION, RTL8139, RTL8139_Install, NULL, NULL);
+tDevFS_Driver gRTL8139_DriverInfo = {
+ NULL, "RTL8139",
+ {
+ .NumACLs = 1,
+ .ACLs = &gVFS_ACL_EveryoneRX,
+ .Flags = VFS_FFLAG_DIRECTORY,
+ .ReadDir = RTL8139_ReadDir,
+ .FindDir = RTL8139_FindDir,
+ .IOCtl = RTL8139_RootIOCtl
+ }
+};
int giRTL8139_CardCount;
-tCard gpRTL8139_Cards;
+tCard *gpRTL8139_Cards;
// === CODE ===
/**
// Reset (0x10 to CMD)
outb( base + CMD, 0x10 );
- gpRTL8139_Cards[i].ReceiveBuffer = MM_AllocDMA( 2, 32, &gpRTL8139_Cards[i].PhysReceiveBuffer );
+ while( inb(base + CMD) & 0x10 ) ;
+
+ // Allocate 3 pages below 4GiB for the recieve buffer (Allows 8k+16+1500)
+ gpRTL8139_Cards[i].ReceiveBuffer = MM_AllocDMA( 3, 32, &gpRTL8139_Cards[i].PhysReceiveBuffer );
// Set up recieve buffer
outl(base + RBSTART, (Uint32)gpRTL8139_Cards[i].PhysReceiveBuffer);
// Set IMR to Transmit OK and Receive OK
outw(base + IMR, 0x5);
- // Set recieve buffer size, buffer wrap and recieve mask
- outl(base + RCR, 0x8F);
+ // Set recieve buffer size and recieve mask
+ outl(base + RCR, 0x0F);
outb(base + CMD, 0x0C); // Recive Enable and Transmit Enable
+ // Get the card's MAC address
gpRTL8139_Cards[ i ].MacAddr[0] = inb(base+MAC0);
gpRTL8139_Cards[ i ].MacAddr[1] = inb(base+MAC1);
gpRTL8139_Cards[ i ].MacAddr[2] = inb(base+MAC2);
}
return MODULE_ERR_OK;
}
+
+// --- Root Functions ---
+char *RTL8139_ReadDir(tVFS_Node *Node, int Pos)
+{
+ return NULL;
+}
+
+tVFS_Node *RTL8139_FindDir(tVFS_Node *Node, const char *Filename)
+{
+ return NULL;
+}
+
+int RTL8139_RootIOCtl(tVFS_Node *Node, int ID, void *Arg)
+{
+ return 0;
+}
+
+// --- File Functions ---
+Uint64 RTL8139_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
+{
+ return 0;
+}
+
+Uint64 RTL8139_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
+{
+ return 0;
+}
+
+int RTL8139_IOCtl(tVFS_Node *Node, int ID, void *Arg)
+{
+ return 0;
+}