[GOOD] BUILD 0.1.0.470 DATE 8/30/2011 AT 6:40 PM
==================================================== Mainly changed: HAL.VFS + Designed virtual file system + Completed the VFS + Added verbose mode for VFS + Updated shell script, now shows build number when building ? TODO: Implement one file system (most likely FAT12) ? TODO: Mount floppy device
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								Build/loader.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Build/loader.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Build/main.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Build/main.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -54,7 +54,7 @@ void CommandTime()
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	Time time = TimeConvertToTime(TimeGetInternalTime());
 | 
			
		||||
	Time time = ConvertTimeSystemToTime(TimeGetInternalTime());
 | 
			
		||||
 | 
			
		||||
	ConsoleWrite ("Current time: ");
 | 
			
		||||
	ConsoleWrite ("%#%d:%d%d:%d%d.%d%d%d\n", Color(0,ColorLightGreen) ,(int)time.Hour,
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@ void DriversInstall_Clock()
 | 
			
		||||
	Time time;
 | 
			
		||||
	CmosGetRTC(&time);
 | 
			
		||||
 | 
			
		||||
	TimeSetInternalTime(TimeConvertToTimeSystem(time));
 | 
			
		||||
	TimeSetInternalTime(ConvertTimeToTimeSystem(time));
 | 
			
		||||
 | 
			
		||||
	Log("%#[Drivers] %#Read RTC time: ", ColorWhite, ColorLightGray);
 | 
			
		||||
	Log("%#%u/%u/%u %u:%u:%u.%u\n", ColorLightCyan, time.Month, time.Day,
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								Kernel/hal/filesys/fat12.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Kernel/hal/filesys/fat12.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
/*
 | 
			
		||||
 * fat12.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Created on: Aug 29, 2011
 | 
			
		||||
 *      Author: Tiberiu
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -8,6 +8,7 @@
 | 
			
		||||
#include "keyboard/keyboard.h"
 | 
			
		||||
#include "mouse/mouse.h"
 | 
			
		||||
 | 
			
		||||
#include <fileio.h>
 | 
			
		||||
#include <debugio.h>
 | 
			
		||||
 | 
			
		||||
void HalInitialize()
 | 
			
		||||
@@ -32,4 +33,7 @@ void HalInitialize()
 | 
			
		||||
 | 
			
		||||
	// Install mouse driver
 | 
			
		||||
	MouseInstall();		Log("%#[HAL] %#Installed mouse driver\n", ColorYellow, ColorLightGreen);
 | 
			
		||||
 | 
			
		||||
	// Install VFS
 | 
			
		||||
	VfsInstall();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -8,13 +8,9 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <multiboot.h>
 | 
			
		||||
#include <debugio.h>
 | 
			
		||||
#include <memory.h>
 | 
			
		||||
 | 
			
		||||
#include <../drivers/cmos/cmos.h>
 | 
			
		||||
 | 
			
		||||
#include "keyboard/keyboard.h"
 | 
			
		||||
 | 
			
		||||
void SystemReboot()
 | 
			
		||||
{
 | 
			
		||||
	Log("Rebooting system...\n");
 | 
			
		||||
							
								
								
									
										208
									
								
								Kernel/hal/vfs.c
									
									
									
									
									
								
							
							
						
						
									
										208
									
								
								Kernel/hal/vfs.c
									
									
									
									
									
								
							@@ -1,40 +1,208 @@
 | 
			
		||||
#include<fileio.h>
 | 
			
		||||
#include<storage.h>
 | 
			
		||||
#include <memory.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <fileio.h>
 | 
			
		||||
#include <debugio.h>
 | 
			
		||||
 | 
			
		||||
#define MAX_FS_COUNT 64
 | 
			
		||||
#define BAD 0xffffffff
 | 
			
		||||
 | 
			
		||||
uint32 FsRead(FsNode *node, uint32 offset, uint32 size, uint8 *buffer)
 | 
			
		||||
FileSystem* fsArray;
 | 
			
		||||
uint32 fsCount;
 | 
			
		||||
 | 
			
		||||
MountPoint* mpArray;
 | 
			
		||||
uint32 mpCount;
 | 
			
		||||
uint32 mpAllocated;
 | 
			
		||||
 | 
			
		||||
#define LogVfs(...) { Log("%#[Vfs] ", ColorLightBlue); Log(__VA_ARGS__); }
 | 
			
		||||
#define ErrorVfs(...) { Error("%#[Vfs] ", ColorLightBlue); Error(__VA_ARGS__); }
 | 
			
		||||
 | 
			
		||||
void VfsInstall ()
 | 
			
		||||
{
 | 
			
		||||
	if (node->Read != NULL) return node->Read(node, offset, size, buffer);
 | 
			
		||||
	return NULL;
 | 
			
		||||
	fsArray = (FileSystem*) kmalloc(MAX_FS_COUNT * sizeof(FileSystem));
 | 
			
		||||
	fsCount = 0;
 | 
			
		||||
 | 
			
		||||
	mpArray = (MountPoint*) kmalloc(32 * sizeof(MountPoint));
 | 
			
		||||
	mpCount = 0;
 | 
			
		||||
	mpAllocated = 32;
 | 
			
		||||
 | 
			
		||||
	LogVfs("%#VFS now in business.\n", ColorLightGreen);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32 FsWrite(FsNode *node, uint32 offset, uint32 size, uint8 *buffer)
 | 
			
		||||
uint8 VfsInstallFs (FileSystem* fs)
 | 
			
		||||
{
 | 
			
		||||
	if (node->Write != NULL) return node->Write(node, offset, size, buffer);
 | 
			
		||||
	return NULL;
 | 
			
		||||
	if (fsCount >= MAX_FS_COUNT) {
 | 
			
		||||
		ErrorVfs("%#Failed to install file system '%s': FS count reached.\n", ColorLightRed, fs->Name);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	memcpy(&fsArray[fsCount], fs, sizeof(FileSystem));
 | 
			
		||||
	fsArray[fsCount].Id = fsCount;
 | 
			
		||||
 | 
			
		||||
	++fsCount;
 | 
			
		||||
	LogVfs("Installed file system %#.\n", ColorWhite, fs->Name);
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void FsOpen(FsNode *node, uint8 read, uint8 write)
 | 
			
		||||
uint32 VfsFindDevice (string dev)
 | 
			
		||||
{
 | 
			
		||||
	if (node->Open != NULL) return node->Open(node, read, write);
 | 
			
		||||
	uint32 i;
 | 
			
		||||
	for (i = 0; i < mpCount; i++)
 | 
			
		||||
		if (strcmp(dev, mpArray[i].Name) == 0)
 | 
			
		||||
			return i;
 | 
			
		||||
 | 
			
		||||
	return BAD;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void FsClose(FsNode *node)
 | 
			
		||||
 | 
			
		||||
// Returns mount point index, removes dev name from path
 | 
			
		||||
uint32 VfsParsePath (string* path)
 | 
			
		||||
{
 | 
			
		||||
	if (node->Close != NULL) return node->Close();
 | 
			
		||||
	// Sanity check
 | 
			
		||||
	if (!path || !(*path)) return BAD;
 | 
			
		||||
 | 
			
		||||
	string dev = *path, p = strchr(*path, ':');
 | 
			
		||||
	if (p == NULL) return BAD; // invalid path
 | 
			
		||||
 | 
			
		||||
	// Split string
 | 
			
		||||
	*path = p+1; *p = '\0';
 | 
			
		||||
 | 
			
		||||
	return VfsFindDevice(dev);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
DirectoryEntry *FsReadDir(FsNode *node, uint32 index)
 | 
			
		||||
uint8 VfsMount (string Name, DevReadRoutine R, DevWriteRoutine W, uint32 BlockSize)
 | 
			
		||||
{
 | 
			
		||||
	if (node->ReadDir != NULL && (node->Flags&7) == FsDirectory)
 | 
			
		||||
		return node->ReadDir(node, index);
 | 
			
		||||
	return NULL;
 | 
			
		||||
	uint32 i, fsId = BAD, mpIndex = BAD;
 | 
			
		||||
 | 
			
		||||
	// Try to figure out the file system
 | 
			
		||||
	for (i = 0; i < fsCount && fsId == BAD; i++)
 | 
			
		||||
		if (fsArray->Detect && fsArray->Detect(R, BlockSize)) fsId = i;
 | 
			
		||||
 | 
			
		||||
	if (fsId == BAD) {
 | 
			
		||||
		ErrorVfs("%#Failed to mount device %s: no file system found.\n", ColorLightRed, Name)
 | 
			
		||||
		return 0;			// No file system, no good
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Try to find an empty slot to fill
 | 
			
		||||
	for (i = 0; i < mpCount && mpIndex == BAD; i++)
 | 
			
		||||
		if (mpArray[i].Id == BAD) mpIndex = i;
 | 
			
		||||
 | 
			
		||||
	// No empty slots?
 | 
			
		||||
	if (mpIndex == BAD)
 | 
			
		||||
	{
 | 
			
		||||
		// Make sure we have enough space
 | 
			
		||||
		if (mpCount == mpAllocated) 		{
 | 
			
		||||
			mpAllocated += 4;
 | 
			
		||||
			mpArray = kmrealloc(mpArray, mpAllocated * sizeof(MountPoint));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		mpIndex = mpCount++;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Add to mount point list, set up data
 | 
			
		||||
	mpArray[mpIndex].Id = mpIndex;
 | 
			
		||||
	mpArray[mpIndex].FsId = fsId;
 | 
			
		||||
	mpArray[mpIndex].BlockSize = BlockSize;
 | 
			
		||||
	mpArray[mpIndex].Read = R;
 | 
			
		||||
	mpArray[mpIndex].Write = W;
 | 
			
		||||
 | 
			
		||||
	// Change name if it already exists
 | 
			
		||||
	uint32 find = VfsFindDevice(Name);
 | 
			
		||||
	if (find != BAD)
 | 
			
		||||
	{
 | 
			
		||||
		uint32 len = strlen(Name);
 | 
			
		||||
		uint8 success = 0;
 | 
			
		||||
		Name[len+1] = '\0';
 | 
			
		||||
 | 
			
		||||
		// Try to find a number index
 | 
			
		||||
		for (find = '0'; find <= '9' && !success; find++)
 | 
			
		||||
		{
 | 
			
		||||
			Name[len] = find;
 | 
			
		||||
			if (VfsFindDevice(Name) == BAD) success = 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// What? Haven't found anything yet? Try the alphabet
 | 
			
		||||
		for (find = 'a'; find <= 'z' && !success; find++)
 | 
			
		||||
		{
 | 
			
		||||
			Name[len] = find;
 | 
			
		||||
			if (VfsFindDevice(Name) == BAD) success = 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Still nothing? How in the world is this even possible ?!?!?!
 | 
			
		||||
		if (!success) return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	memcpy(mpArray[mpCount].Name, Name, sizeof(char) * 128);
 | 
			
		||||
 | 
			
		||||
	LogVfs("Mounted device %#%s", ColorWhite, Name);
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
FsNode *FsFindDir(FsNode *node, char *name)
 | 
			
		||||
void VfsUnmount (uint32 dev_id)
 | 
			
		||||
{
 | 
			
		||||
	if (node->FindDir != NULL && (node->Flags&7) == FsDirectory)
 | 
			
		||||
		return node->FindDir(node, name);
 | 
			
		||||
	return NULL;
 | 
			
		||||
	mpArray[dev_id].Id = BAD;
 | 
			
		||||
	mpCount--;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Returns pointer to FILE structure that was inputed if success, null otherwise
 | 
			
		||||
FILE* VfsOpen (FILE* file, string path)
 | 
			
		||||
{
 | 
			
		||||
	if (!file) return NULL;
 | 
			
		||||
 | 
			
		||||
	// Parse string
 | 
			
		||||
	uint32 dev = VfsParsePath(&path);
 | 
			
		||||
	file->DeviceId = dev;
 | 
			
		||||
 | 
			
		||||
	// Device not found, or Open routine doesn't exist
 | 
			
		||||
	if (dev == BAD || !fsArray[mpArray[dev].FsId].Open) return NULL;
 | 
			
		||||
 | 
			
		||||
	// Ask the FS to do the 'opening'
 | 
			
		||||
	return fsArray[mpArray[dev].FsId].Open(&mpArray[dev],file,path);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
DirectoryEntry* VfsTest (string path)
 | 
			
		||||
{
 | 
			
		||||
	// Parse string
 | 
			
		||||
	uint32 dev = VfsParsePath(&path);
 | 
			
		||||
 | 
			
		||||
	// Device not found, or Open routine doesn't exist
 | 
			
		||||
	if (dev == BAD || !fsArray[mpArray[dev].FsId].Test) return NULL;
 | 
			
		||||
 | 
			
		||||
	// Ask the FS to do the 'opening'
 | 
			
		||||
	return fsArray[mpArray[dev].FsId].Test(&mpArray[dev],path);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
FILE* VfsClose (FILE* file)
 | 
			
		||||
{
 | 
			
		||||
	if (!file) return NULL;
 | 
			
		||||
	MountPoint* mp = &(mpArray[file->DeviceId]);
 | 
			
		||||
 | 
			
		||||
	if (!fsArray[mp->FsId].Close) return NULL;
 | 
			
		||||
	return fsArray[mp->FsId].Close(mp,file);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32 VfsRead (FILE* file, uint32 bsz, uint32 n, uint8* buffer)
 | 
			
		||||
{
 | 
			
		||||
	if (!file) return NULL;
 | 
			
		||||
	MountPoint* mp = &(mpArray[file->DeviceId]);
 | 
			
		||||
 | 
			
		||||
	if (!fsArray[mp->FsId].Read) return NULL;
 | 
			
		||||
	return fsArray[mp->FsId].Read(mp, file, bsz, n, buffer);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32 VfsWrite (FILE* file, uint32 bsz, uint32 n, uint8* buffer)
 | 
			
		||||
{
 | 
			
		||||
	if (!file) return NULL;
 | 
			
		||||
	MountPoint* mp = &(mpArray[file->DeviceId]);
 | 
			
		||||
 | 
			
		||||
	if (!fsArray[mp->FsId].Write) return NULL;
 | 
			
		||||
	return fsArray[mp->FsId].Write(mp, file, bsz, n, buffer);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
DirectoryEntry* VfsReadDirectory (FILE* handle, uint32 index)
 | 
			
		||||
{
 | 
			
		||||
	if (!handle) return NULL;
 | 
			
		||||
	MountPoint* mp = &(mpArray[handle->DeviceId]);
 | 
			
		||||
 | 
			
		||||
	if (!fsArray[mp->FsId].ReadDirectory) return NULL;
 | 
			
		||||
	return fsArray[mp->FsId].ReadDirectory(mp, handle, index);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,62 +9,114 @@
 | 
			
		||||
#define FILEIO_H_
 | 
			
		||||
 | 
			
		||||
#include <types.h>
 | 
			
		||||
#include <time.h>
 | 
			
		||||
 | 
			
		||||
enum FsFlags
 | 
			
		||||
// Device routines, will read/write 'BlockSize' bytes per call
 | 
			
		||||
typedef uint32 (*DevReadRoutine)(uint32 offset, void* buffer);
 | 
			
		||||
typedef uint32 (*DevWriteRoutine)(uint32 offset, void* buffer);
 | 
			
		||||
 | 
			
		||||
enum FileFlags
 | 
			
		||||
{
 | 
			
		||||
	FsFile			= 0x1,
 | 
			
		||||
	FsDirectory		= 0x2,
 | 
			
		||||
	FsCharDevice	= 0x3,
 | 
			
		||||
	FsBlockDevice	= 0x4,
 | 
			
		||||
	FsPipe			= 0x5,
 | 
			
		||||
	FsSymbolLink	= 0x6,
 | 
			
		||||
	FsMountPoint	= 0x8
 | 
			
		||||
	FileFile			= 0x1,
 | 
			
		||||
	FileDirectory		= 0x2,
 | 
			
		||||
	FileCharDevice		= 0x3,
 | 
			
		||||
	FileBlockDevice		= 0x4,
 | 
			
		||||
	FilePipe			= 0x5,
 | 
			
		||||
	FileSymbolLink		= 0x6,
 | 
			
		||||
	FileMountPoint		= 0x7,
 | 
			
		||||
	FileOwnerRead		= 0x8,
 | 
			
		||||
	FileOwnerWrite		= 0x10,
 | 
			
		||||
	FileOwnerExecute	= 0x20,
 | 
			
		||||
	FileGroupRead		= 0x40,
 | 
			
		||||
	FileGroupWrite		= 0x80,
 | 
			
		||||
	FileGroupExecute	= 0x100,
 | 
			
		||||
	FileOtherRead		= 0x200,
 | 
			
		||||
	FileOtherWrite		= 0x400,
 | 
			
		||||
	FileOtherExecute	= 0x800,
 | 
			
		||||
	FileHidden			= 0x1000,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef uint32 (*ReadRoutine)(struct _FsNode*, uint32, uint32, uint8*);
 | 
			
		||||
typedef uint32 (*WriteRoutine)(struct _FsNode*, uint32, uint32, uint8*);
 | 
			
		||||
typedef void (*OpenRoutine)(struct _FsNode*);
 | 
			
		||||
typedef void (*CloseRoutine)(struct _FsNode*);
 | 
			
		||||
typedef struct _DirectoryEntry (*ReadDirRoutine)(struct _FsNode*,uint32);
 | 
			
		||||
typedef struct _FsNode* (*FindDirRoutine)(struct _FsNode*,char *name);
 | 
			
		||||
 | 
			
		||||
typedef struct _FsNode
 | 
			
		||||
typedef struct _FILE
 | 
			
		||||
{
 | 
			
		||||
   char Name[128];			// The filename.
 | 
			
		||||
   uint32 Permissions;		// The permissions mask.
 | 
			
		||||
   uint32 UserId;			// The owning user.
 | 
			
		||||
   uint32 GroupId;			// The owning group.
 | 
			
		||||
   uint32 Flags;			// Includes the node type. See enum above.
 | 
			
		||||
   uint32 INode;			// This is device-specific - provides a way for a filesystem to identify files.
 | 
			
		||||
   uint32 Length;			// Size of the file, in bytes.
 | 
			
		||||
   uint32 Implementation;	// An implementation-defined number.
 | 
			
		||||
   ReadRoutine Read;
 | 
			
		||||
   WriteRoutine Write;
 | 
			
		||||
   OpenRoutine Open;
 | 
			
		||||
   CloseRoutine Close;
 | 
			
		||||
   ReadDirRoutine ReadDir;
 | 
			
		||||
   FindDirRoutine FindDir;
 | 
			
		||||
   struct _FsNode *Ptr; 			// Used by mountpoints and symlinks.
 | 
			
		||||
} FsNode;
 | 
			
		||||
	uint32 DeviceId;	// The VFS identifies the mounted device that uses this
 | 
			
		||||
	uint32 Id;			// The FS idenitifies files using this field
 | 
			
		||||
	char Name[128];
 | 
			
		||||
 | 
			
		||||
	/*** Looks like this:
 | 
			
		||||
	 *	bits  description
 | 
			
		||||
	 *	0-2   file type
 | 
			
		||||
	 *  3-5   owner permissions (rwx)
 | 
			
		||||
	 *  6-8   group permissions (rwx)
 | 
			
		||||
	 *  9-11  other permissions (rwx)
 | 
			
		||||
	 *  12    hidden
 | 
			
		||||
	 *  13-31 (unassigned yet)
 | 
			
		||||
	 *
 | 
			
		||||
	 *  Note: In windows FS, the readonly and system attributes are set using permissions and userid */
 | 
			
		||||
	uint32 Flags;
 | 
			
		||||
	uint32 OwnerId, GroupId;
 | 
			
		||||
	uint32 Size;
 | 
			
		||||
} FILE;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef struct _DirectoryEntry
 | 
			
		||||
{
 | 
			
		||||
	char Name[128];
 | 
			
		||||
	uint32 INode;
 | 
			
		||||
	uint32 Flags, OwnerId, GroupId, Size;
 | 
			
		||||
	TimeSystem TimeCreated, TimeModified, TimeAccessed;
 | 
			
		||||
 | 
			
		||||
} DirectoryEntry;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
extern uint32 FsRead(FsNode *node, uint32 offset, uint32 size, uint8 *buffer);
 | 
			
		||||
extern uint32 FsWrite(FsNode *node, uint32 offset, uint32 size, uint8 *buffer);
 | 
			
		||||
extern void FsOpen(FsNode *node, uint8 read, uint8 write);
 | 
			
		||||
extern void FsClose(FsNode *node);
 | 
			
		||||
extern DirectoryEntry *FsReadDir(FsNode *node, uint32 index);
 | 
			
		||||
extern FsNode *FsFindDir(FsNode *node, char *name);
 | 
			
		||||
typedef struct {
 | 
			
		||||
	uint32 Id;
 | 
			
		||||
	uint32 FsId;
 | 
			
		||||
	char Name[128];
 | 
			
		||||
 | 
			
		||||
	uint32 BlockSize;
 | 
			
		||||
	DevReadRoutine Read;
 | 
			
		||||
	DevWriteRoutine Write;
 | 
			
		||||
} MountPoint;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// File system routines
 | 
			
		||||
typedef uint32 (*FsReadRoutine)(const MountPoint*, FILE*, uint32, uint32, uint8*);
 | 
			
		||||
typedef uint32 (*FsWriteRoutine)(const MountPoint*, FILE*, uint32, uint32, uint8*);
 | 
			
		||||
typedef FILE* (*FsOpenRoutine)(const MountPoint*, FILE*,string);
 | 
			
		||||
typedef DirectoryEntry* (*FsTestRoutine)(const MountPoint*, string);	// Test if a file exists, and returns info
 | 
			
		||||
typedef FILE* (*FsCloseRoutine)(const MountPoint*, FILE*);
 | 
			
		||||
typedef DirectoryEntry* (*FsReadDirRoutine)(const MountPoint*,FILE*,uint32);
 | 
			
		||||
 | 
			
		||||
typedef uint32 (*FsDetectRoutine) (DevReadRoutine, uint32 blocksz);
 | 
			
		||||
 | 
			
		||||
// File system structure
 | 
			
		||||
typedef struct {
 | 
			
		||||
	uint32 Id;
 | 
			
		||||
	char Name[16];
 | 
			
		||||
 | 
			
		||||
	FsDetectRoutine Detect;
 | 
			
		||||
	FsOpenRoutine Open;
 | 
			
		||||
	FsCloseRoutine Close;
 | 
			
		||||
	FsReadRoutine Read;
 | 
			
		||||
	FsWriteRoutine Write;
 | 
			
		||||
	FsTestRoutine Test;		// See if file exists without having to open it
 | 
			
		||||
	FsReadDirRoutine ReadDirectory;
 | 
			
		||||
} FileSystem;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Vfs routines
 | 
			
		||||
extern void   VfsInstall ();
 | 
			
		||||
extern uint8  VfsInstallFs (FileSystem* fs);
 | 
			
		||||
extern uint32 VfsFindDevice (string dev);
 | 
			
		||||
extern uint32 VfsParsePath (string* path);
 | 
			
		||||
extern uint8  VfsMount (string Name, DevReadRoutine R, DevWriteRoutine W, uint32 BlockSize);
 | 
			
		||||
extern void VfsUnmount (uint32 dev_id);
 | 
			
		||||
extern FILE* VfsOpen (FILE* file, string path);
 | 
			
		||||
extern DirectoryEntry* VfsTest (string path);
 | 
			
		||||
extern FILE* VfsClose (FILE* file);
 | 
			
		||||
extern uint32 VfsRead (FILE* file, uint32 bsz, uint32 n, uint8* buffer);
 | 
			
		||||
extern uint32 VfsWrite (FILE* file, uint32 bsz, uint32 n, uint8* buffer);
 | 
			
		||||
extern DirectoryEntry* VfsReadDirectory (FILE* handle, uint32 index);
 | 
			
		||||
 | 
			
		||||
#ifdef NEVER
 | 
			
		||||
void VfsRegisterFilesys();
 | 
			
		||||
void VfsMount();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif /* FILEIO_H_ */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,96 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * memory-add.h
 | 
			
		||||
 *
 | 
			
		||||
 *  Created on: Aug 27, 2011
 | 
			
		||||
 *      Author: Tiberiu
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef MEMORY_ADD_H_
 | 
			
		||||
#define MEMORY_ADD_H_
 | 
			
		||||
 | 
			
		||||
#include <memory.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <debugio.h>
 | 
			
		||||
 | 
			
		||||
/***************************************************
 | 
			
		||||
 * Paging                                          *
 | 
			
		||||
 ***************************************************/
 | 
			
		||||
typedef uint32 Page;
 | 
			
		||||
 | 
			
		||||
enum PageFlags
 | 
			
		||||
{
 | 
			
		||||
	PagePresent = 0x1,
 | 
			
		||||
	PageWriteable = 0x2,
 | 
			
		||||
	PageUser = 0x4,
 | 
			
		||||
	PageWriteThough = 0x8,
 | 
			
		||||
	PageNotCacheable = 0x10,
 | 
			
		||||
	PageAccessed = 0x20,
 | 
			
		||||
	PageDirty = 0x40,
 | 
			
		||||
	PagePAT = 0x80,
 | 
			
		||||
	PageCpuGlobal = 0x100,
 | 
			
		||||
	PageLvl4Global = 0x200,
 | 
			
		||||
	PageFrame = 0xFFFFF000
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
	Page Pages[1024];
 | 
			
		||||
} PageTable;
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
	PageTable* Tables[1024];
 | 
			
		||||
	uint32 TablesPhysical[1024];
 | 
			
		||||
	uint32 PhysicalAddr;
 | 
			
		||||
} PageDirectory;
 | 
			
		||||
 | 
			
		||||
extern PageDirectory* CurrentDirectory;
 | 
			
		||||
extern PageDirectory* KernelDirectory;
 | 
			
		||||
 | 
			
		||||
extern void PagingInitialize(uint32 SystemMemory);
 | 
			
		||||
extern void PagingSwitchPageDirectory (PageDirectory* dir);
 | 
			
		||||
extern Page* PagingGetPage(uint32 addr, uint8 make, PageDirectory* dir);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/***************************************************
 | 
			
		||||
 * Physical memory manager                         *
 | 
			
		||||
 ***************************************************/
 | 
			
		||||
extern uint32 TotalFrames;
 | 
			
		||||
extern uint32 TotalMemory;
 | 
			
		||||
 | 
			
		||||
void MemPhInitialize(uint32 SystemMemoryKb);
 | 
			
		||||
extern void MemPhSetFrame (uint32 frame, uint8 value);
 | 
			
		||||
uint32 MemPhGetFrame (uint32 frame);
 | 
			
		||||
uint32 MemPhFindFreeFrame();
 | 
			
		||||
void MemPhAllocFrame(Page* page, uint8 isKernel, uint8 isWriteable);
 | 
			
		||||
void MemPhFreeFrame(Page* page);
 | 
			
		||||
void MemPhReserveFrames (uint32 address, uint32 length);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/***************************************************
 | 
			
		||||
 * Memory heap                                     *
 | 
			
		||||
 ***************************************************/
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
	OrderedArray Index;
 | 
			
		||||
	uint32 StartAddress, EndAddress, MaxAddress;
 | 
			
		||||
	// bit 0: supervisor-only  bit 1: read-only
 | 
			
		||||
	uint8 Flags;
 | 
			
		||||
} MemHeap;
 | 
			
		||||
 | 
			
		||||
extern MemHeap* KernelHeap;
 | 
			
		||||
 | 
			
		||||
extern uint32 MemHeapFindSmallestHole (uint32 size, uint8 page_align, MemHeap* heap);
 | 
			
		||||
extern int32 MemHeapCompare (uint32 a, uint32 b);
 | 
			
		||||
extern MemHeap* MemHeapCreate(uint32 start, uint32 end, uint32 max, uint8 flags);
 | 
			
		||||
extern void MemHeapExpand(uint32 newsz, MemHeap* heap, PageDirectory* pd);
 | 
			
		||||
extern uint32 MemHeapContract(uint32 newsz, MemHeap* heap, PageDirectory* pd);
 | 
			
		||||
extern uint32 MemHeapAlloc (uint32 size, uint8 isPageAligned, MemHeap* heap, PageDirectory* pd);
 | 
			
		||||
extern void MemHeapFree (uint32 address, MemHeap* heap, PageDirectory* pd);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define LogMem(...) { Log("%#[Mem] ", ColorLightCyan); Log(__VA_ARGS__); }
 | 
			
		||||
#define ErrorMem(...) { Error("%#[Mem] ", ColorLightCyan); Error(__VA_ARGS__); }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif /* MEMORY_ADD_H_ */
 | 
			
		||||
@@ -12,6 +12,7 @@ extern void* kmalloc (uint32 size);
 | 
			
		||||
extern void* kmalloc_a (uint32 size);
 | 
			
		||||
extern void* kmalloc_p (uint32 size, uint32* phys);
 | 
			
		||||
extern void* kmalloc_ap (uint32 size, uint32* phys);
 | 
			
		||||
extern void* kmrealloc (void* original, uint32 newsz);
 | 
			
		||||
extern void kfree (void* addr);
 | 
			
		||||
 | 
			
		||||
extern void MemoryTempInitialize (uint32 kernel_end);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,29 +0,0 @@
 | 
			
		||||
#ifndef __MEMORY__H
 | 
			
		||||
#define __MEMORY__H
 | 
			
		||||
 | 
			
		||||
#include <types.h>
 | 
			
		||||
#include <settings.h>
 | 
			
		||||
#include <multiboot.h>
 | 
			
		||||
 | 
			
		||||
/***************************************************
 | 
			
		||||
 * Basic memory operations: alloc, free            *
 | 
			
		||||
 ***************************************************/
 | 
			
		||||
extern void* kmalloc (uint32 size);
 | 
			
		||||
extern void* kmalloc_a (uint32 size);
 | 
			
		||||
extern void* kmalloc_p (uint32 size, uint32* phys);
 | 
			
		||||
extern void* kmalloc_ap (uint32 size, uint32* phys);
 | 
			
		||||
extern void kfree (void* addr);
 | 
			
		||||
 | 
			
		||||
extern void MemoryTempInitialize (uint32 kernel_end);
 | 
			
		||||
extern void MemoryInitialize (MultibootInfo* info);
 | 
			
		||||
 | 
			
		||||
extern uint32 MemoryGetTotal();
 | 
			
		||||
extern uint32 MemoryGetFree(); // Returns total free physical memory in bytes
 | 
			
		||||
extern uint32 MemoryGetUsed(); // Total used physical memory in bytes
 | 
			
		||||
extern uint32 MemoryGetFrameSize(); // Same as above functions, but in frames
 | 
			
		||||
extern uint32 MemoryGetFramesTotal();
 | 
			
		||||
extern uint32 MemoryGetFramesUsed();
 | 
			
		||||
extern uint32 MemoryGetFramesFree();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,37 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * settings.h
 | 
			
		||||
 *
 | 
			
		||||
 *  Created on: Aug 16, 2011
 | 
			
		||||
 *      Author: Tiberiu
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef SETTINGS_H_
 | 
			
		||||
#define SETTINGS_H_
 | 
			
		||||
 | 
			
		||||
// OS info
 | 
			
		||||
#define OS_STRING "lux"
 | 
			
		||||
#define OS_VERSION "0.1 [pre-Alpha]"
 | 
			
		||||
#define OS_BUILD_DATE __DATE__
 | 
			
		||||
#define OS_BUILD_TIME __TIME__
 | 
			
		||||
 | 
			
		||||
#include <version.h>
 | 
			
		||||
 | 
			
		||||
// Logger
 | 
			
		||||
#define VERBOSE_MODE 1
 | 
			
		||||
#define VERBOSE_ERROR 1
 | 
			
		||||
#define VERBOSE_PANIC 1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Clock
 | 
			
		||||
#define PIT_FREQUENCY 100
 | 
			
		||||
 | 
			
		||||
// Console
 | 
			
		||||
#define CONSOLE_MAX_PARAMS 32
 | 
			
		||||
#define CONSOLE_DEFAULT_COLOR 0x7
 | 
			
		||||
 | 
			
		||||
// Memory manager
 | 
			
		||||
#define KERNEL_HEAP_START 0xC0000000
 | 
			
		||||
#define KERNEL_HEAP_END 0xCFFFF000
 | 
			
		||||
#define KERNEL_HEAP_INITIAL_SIZE 0x100000
 | 
			
		||||
 | 
			
		||||
#endif /* SETTINGS_H_ */
 | 
			
		||||
@@ -24,6 +24,8 @@
 | 
			
		||||
extern uint32 strlen (string s);
 | 
			
		||||
extern int32  strcmp (string a, string b);
 | 
			
		||||
extern string strcpy (string s1, const string s2);
 | 
			
		||||
extern char* strchr (string s, int c);
 | 
			
		||||
extern char* strrchr (string s, int c);
 | 
			
		||||
 | 
			
		||||
/***************************************************
 | 
			
		||||
 * Number operations: len                          *
 | 
			
		||||
 
 | 
			
		||||
@@ -1,69 +0,0 @@
 | 
			
		||||
#ifndef __STDLIB__H
 | 
			
		||||
#define __STDLIB__H
 | 
			
		||||
 | 
			
		||||
#include <types.h>
 | 
			
		||||
 | 
			
		||||
#define IsDigit(c) 		(c >= '0' && c <= '9')
 | 
			
		||||
#define IsHexDigit(c) 	( (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') )
 | 
			
		||||
#define IsUpper(c) 		(c >= 'A' && c <= 'Z')
 | 
			
		||||
#define IsLower(c) 		(c >= 'a' && c <= 'z')
 | 
			
		||||
 | 
			
		||||
#define IsAlpha(c) 		(IsLower(c) || IsUpper(c))
 | 
			
		||||
#define IsAlphaNum(c) 	(IsAlpha(c) || IsDigit(c))
 | 
			
		||||
 | 
			
		||||
#define ToLower(c) ((IsUpper(c)) ? (c - 'A' + 'a') : c)
 | 
			
		||||
#define ToUpper(c) ((IsLower(c)) ? (c - 'a' + 'A') : c)
 | 
			
		||||
 | 
			
		||||
#define Max(a,b) ((a > b) ? (a) : (b))
 | 
			
		||||
#define Min(a,b) ((a < b) ? (a) : (b))
 | 
			
		||||
#define Abs(a)   ((a < 0) ? (a * -1) : (a))
 | 
			
		||||
 | 
			
		||||
/***************************************************
 | 
			
		||||
 * String operations: len, cmp, cpy                *
 | 
			
		||||
 ***************************************************/
 | 
			
		||||
extern uint32 strlen (string s);
 | 
			
		||||
extern int32  strcmp (string a, string b);
 | 
			
		||||
extern string strcpy (string s1, const string s2);
 | 
			
		||||
 | 
			
		||||
/***************************************************
 | 
			
		||||
 * Number operations: len                          *
 | 
			
		||||
 ***************************************************/
 | 
			
		||||
extern uint32 numlen  (int32 number, int32 base);
 | 
			
		||||
extern uint32 unumlen (uint32 number, int32 base);
 | 
			
		||||
 | 
			
		||||
/***************************************************
 | 
			
		||||
 * Memory operations: cpy, cmp, set                *
 | 
			
		||||
 ***************************************************/
 | 
			
		||||
void* 	memcpy (void *dest, const void *src, uint32 count);
 | 
			
		||||
int32 	memcmp (const void *s1, const void *s2, uint32 count);
 | 
			
		||||
void* 	memset (void *dest, uint8 val, uint32 count);
 | 
			
		||||
 | 
			
		||||
/***************************************************
 | 
			
		||||
 * Conversion operations: num-str/str-num          *
 | 
			
		||||
 ***************************************************/
 | 
			
		||||
extern int32 	ConvertIntToString 		(string buffer, int32 number, int32 base);
 | 
			
		||||
extern uint32 	ConvertUIntToString 	(string buffer, uint32 number, int32 base);
 | 
			
		||||
extern int32 	ConvertStringToInt 		(string buffer);
 | 
			
		||||
extern uint32	ConvertStringToUInt 	(string buffer);
 | 
			
		||||
extern uint32 	ConvertStringToIntHex 	(string buffer);
 | 
			
		||||
 | 
			
		||||
/***************************************************
 | 
			
		||||
 * Ordered array implementation                    *
 | 
			
		||||
 ***************************************************/
 | 
			
		||||
typedef int (*ComparePredicate) (uint32, uint32);
 | 
			
		||||
typedef struct {
 | 
			
		||||
	uint32* Data;
 | 
			
		||||
	uint32 Size;
 | 
			
		||||
	uint32 SizeLimit;
 | 
			
		||||
	ComparePredicate Compare;
 | 
			
		||||
} OrderedArray;
 | 
			
		||||
 | 
			
		||||
extern OrderedArray OrderedArrayCreate 		(uint32 maxSize, ComparePredicate p);
 | 
			
		||||
extern OrderedArray OrderedArrayPlace 		(uint32 addr, uint32 maxSize, ComparePredicate p);
 | 
			
		||||
extern void 		OrderedArrayDispose 	(OrderedArray* arr);
 | 
			
		||||
extern uint32 		OrderedArraySearch 		(uint32 key, OrderedArray* arr, ComparePredicate predicate);
 | 
			
		||||
extern void 		OrderedArrayInsert 		(uint32 item, OrderedArray* arr);
 | 
			
		||||
extern uint32 		OrderedArrayLookup 		(uint32 index, OrderedArray* arr);
 | 
			
		||||
extern void 		OrderedArrayDeleteIndex (uint32 index, OrderedArray* arr);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@@ -10,56 +10,6 @@
 | 
			
		||||
 | 
			
		||||
#include <types.h>
 | 
			
		||||
 | 
			
		||||
// Storage device
 | 
			
		||||
typedef struct {
 | 
			
		||||
 | 
			
		||||
	char MountPointName[32];// E.g. "fd0"; you should avoid spaces, or special chars, or otherwise get weird paths like "Mom's floppy\virus.exe"
 | 
			
		||||
	uint32 DeviceID;		// Autocompleted by VFS
 | 
			
		||||
 | 
			
		||||
	uint32 BlockSize;		// E.g. sector size
 | 
			
		||||
	uint32 BlockCount;		// How many blocks are loaded in memory per read
 | 
			
		||||
 | 
			
		||||
	/********************************************************
 | 
			
		||||
	 * READ DATA											*
 | 
			
		||||
	 * Params:												*
 | 
			
		||||
	 * 		> offset: read starting from block ~			*
 | 
			
		||||
	 * Returns: address to data, NULL for error				*
 | 
			
		||||
	 ********************************************************/
 | 
			
		||||
	uint32 (*ReadData) (uint32 offset);
 | 
			
		||||
 | 
			
		||||
	/********************************************************
 | 
			
		||||
	 * WRITE DATA											*
 | 
			
		||||
	 * Params:												*
 | 
			
		||||
	 * 		> offset: write starting from block ~			*
 | 
			
		||||
	 * 		> address: where to write from					*
 | 
			
		||||
	 * Returns: NULL for error  							*
 | 
			
		||||
	 ********************************************************/
 | 
			
		||||
	uint32 (*WriteData) (uint32 offset, uint32 address);
 | 
			
		||||
 | 
			
		||||
	uint32 FileSystemID;	// Autocompleted by 'mount'... at least should be
 | 
			
		||||
 | 
			
		||||
} StorageDevice;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
	uint32 FileSystemID;	// Autocompleted by VFS
 | 
			
		||||
 | 
			
		||||
	/********************************************************
 | 
			
		||||
	 * DETECT IF THIS IS THE FS ON STORAGE DEVICE			*
 | 
			
		||||
	 * Params:												*
 | 
			
		||||
	 * 		> *s: Pointer to device info & routines			*
 | 
			
		||||
	 * Returns: positive if match, NULL otherwise			*
 | 
			
		||||
	 ********************************************************/
 | 
			
		||||
	uint32 (*Detect) (StorageDevice *s);
 | 
			
		||||
 | 
			
		||||
	uint32 (*Open) (StorageDevice *s, string path);
 | 
			
		||||
	uint32 (*CreateNode) (StorageDevice *s, string path);
 | 
			
		||||
	uint32 (*DeleteNode) (StorageDevice *s, string path);
 | 
			
		||||
 | 
			
		||||
} FileSystem;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
extern void ConvertLbaToChs(uint32 SectorsPerTrack, uint32 lba, uint32 *cyl, uint32 *head, uint32 *sector);
 | 
			
		||||
 | 
			
		||||
#endif /* STORAGE_H_ */
 | 
			
		||||
 
 | 
			
		||||
@@ -21,8 +21,8 @@ typedef struct _Time Time;
 | 
			
		||||
typedef struct _TimeSystem TimeSystem;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
extern TimeSystem	TimeConvertToTimeSystem (Time t);
 | 
			
		||||
extern Time			TimeConvertToTime (TimeSystem InternalTime);
 | 
			
		||||
extern TimeSystem	ConvertTimeToTimeSystem (Time t);
 | 
			
		||||
extern Time			ConvertTimeSystemToTime (TimeSystem InternalTime);
 | 
			
		||||
extern uint16		TimeCalculateWeekday (Time t);
 | 
			
		||||
 | 
			
		||||
extern TimeSystem	TimeGetInternalTime();
 | 
			
		||||
 
 | 
			
		||||
@@ -1 +1 @@
 | 
			
		||||
#define OS_BUILD "0.1.0.450"
 | 
			
		||||
#define OS_BUILD "0.1.0.470"
 | 
			
		||||
 
 | 
			
		||||
@@ -1 +0,0 @@
 | 
			
		||||
-e #define OS_BUILD "0.1.0.418"
 | 
			
		||||
@@ -82,3 +82,12 @@ void* kmalloc_ap(uint32 size, uint32* phys)
 | 
			
		||||
	else ret = _malloc_init2(size,1,phys);
 | 
			
		||||
	return (void*)ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void* kmrealloc (void* original, uint32 newsz)
 | 
			
		||||
{
 | 
			
		||||
	void* re = kmalloc(newsz);
 | 
			
		||||
	memcpy (re, original, newsz);
 | 
			
		||||
	kfree(original);
 | 
			
		||||
 | 
			
		||||
	return re;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,87 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * memory_alloc.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Created on: Aug 27, 2011
 | 
			
		||||
 *      Author: Tiberiu
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <memory-add.h>
 | 
			
		||||
 | 
			
		||||
extern uint32 mem_kernel_end;
 | 
			
		||||
extern uint8 mem_initialized;
 | 
			
		||||
 | 
			
		||||
// Used prior to proper initialization
 | 
			
		||||
uint32 _malloc_init1 (uint32 size, uint8 page_aligned)
 | 
			
		||||
{
 | 
			
		||||
	uint32 ret = mem_kernel_end;
 | 
			
		||||
 | 
			
		||||
	if (page_aligned && (ret & 0xfff)) ret = (ret & 0xfffff000) + 0x1000;
 | 
			
		||||
	mem_kernel_end = size + ret;
 | 
			
		||||
 | 
			
		||||
	LogMem("%#Allocated %u bytes (%spage aligned) at end of kernel (0x%x).\n", ColorLightMagenta, size, ((page_aligned) ? "" : "not "), ret);
 | 
			
		||||
	return (ret);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32 _malloc_init2 (uint32 size, uint8 page_aligned, uint32* phys)
 | 
			
		||||
{
 | 
			
		||||
	uint32 ret = MemHeapAlloc(size, page_aligned, KernelHeap, KernelDirectory);
 | 
			
		||||
 | 
			
		||||
	if (phys)
 | 
			
		||||
	{
 | 
			
		||||
		Page *pg = PagingGetPage(ret, 0, KernelDirectory);
 | 
			
		||||
		*phys = (*pg & PageFrame) + (ret & 0xFFF);
 | 
			
		||||
 | 
			
		||||
		LogMem("%#Allocated %u bytes (%spage aligned) at address 0x%x (phys=%x).\n", ColorLightMagenta, size, ((page_aligned) ? "" : "not "), ret, *phys);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	else {
 | 
			
		||||
		LogMem("%#Allocated %u bytes (%spage aligned) at address 0x%x.\n", ColorLightMagenta, size, ((page_aligned) ? "" : "not "), ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Allocate 'size' bytes
 | 
			
		||||
void* kmalloc (uint32 size)
 | 
			
		||||
{
 | 
			
		||||
	if (!mem_initialized) return 0;
 | 
			
		||||
	if (mem_initialized == 1) return (void*)_malloc_init1(size, 0);
 | 
			
		||||
 | 
			
		||||
	return (void*)_malloc_init2(size,0,0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Allocate 'size' bytes, page aligned
 | 
			
		||||
void* kmalloc_a(uint32 size)
 | 
			
		||||
{
 | 
			
		||||
	if (!mem_initialized) return 0;
 | 
			
		||||
	if (mem_initialized == 1) return (void*)_malloc_init1(size, 1);
 | 
			
		||||
 | 
			
		||||
	return (void*)_malloc_init2(size,1,0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void* kmalloc_p(uint32 size, uint32* phys)
 | 
			
		||||
{
 | 
			
		||||
	if (!mem_initialized) return 0;
 | 
			
		||||
	if (mem_initialized == 1) 	{
 | 
			
		||||
		*phys = _malloc_init1(size,0);
 | 
			
		||||
		return (void*)(*phys);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return (void*)_malloc_init2(size,0,phys);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void* kmalloc_ap(uint32 size, uint32* phys)
 | 
			
		||||
{
 | 
			
		||||
	if (!mem_initialized) return 0;
 | 
			
		||||
	
 | 
			
		||||
	uint32 ret;
 | 
			
		||||
	if (mem_initialized == 1) 	{
 | 
			
		||||
		*phys = ret = _malloc_init1(size,1);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	else ret = _malloc_init2(size,1,phys);
 | 
			
		||||
	
 | 
			
		||||
	LogMem("%#kmalloc_ap requested, returned 0x%x, phys = 0x%x.\n", ColorMagenta, ret, *phys);
 | 
			
		||||
 | 
			
		||||
	return (void*)ret;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,48 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * memory_info.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Created on: Aug 27, 2011
 | 
			
		||||
 *      Author: Tiberiu
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <memory-add.h>
 | 
			
		||||
// MemoryGetFree(), MemoryGetTotal(), MemoryGet blah blah...
 | 
			
		||||
 | 
			
		||||
// Returns total physical memory in bytes
 | 
			
		||||
uint32 MemoryGetTotal()
 | 
			
		||||
{
 | 
			
		||||
	return (TotalMemory);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Returns total free physical memory in bytes
 | 
			
		||||
uint32 MemoryGetFree()
 | 
			
		||||
{
 | 
			
		||||
	return (TotalFrames - UsedFrames) * 0x4;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Total used physical memory in bytes
 | 
			
		||||
uint32 MemoryGetUsed()
 | 
			
		||||
{
 | 
			
		||||
	return UsedFrames * 0x4;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Same as above functions, but in frames
 | 
			
		||||
uint32 MemoryGetFrameSize()
 | 
			
		||||
{
 | 
			
		||||
	return 0x1000;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32 MemoryGetFramesTotal()
 | 
			
		||||
{
 | 
			
		||||
	return TotalFrames;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32 MemoryGetFramesUsed()
 | 
			
		||||
{
 | 
			
		||||
	return UsedFrames;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32 MemoryGetFramesFree()
 | 
			
		||||
{
 | 
			
		||||
	return (TotalFrames - UsedFrames);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,92 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * memory-init.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Created on: Aug 27, 2011
 | 
			
		||||
 *      Author: Tiberiu
 | 
			
		||||
 */
 | 
			
		||||
#include <memory-add.h>
 | 
			
		||||
#include <multiboot.h>
 | 
			
		||||
#include <debugio.h>
 | 
			
		||||
#include "../../drivers/cmos/cmos.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
uint32 mem_kernel_end = 0;
 | 
			
		||||
uint8 mem_initialized = 0;
 | 
			
		||||
 | 
			
		||||
uint32 _memory_get_total_mem(MultibootInfo* info)
 | 
			
		||||
{
 | 
			
		||||
	// Grub was nice enough to give us info
 | 
			
		||||
	if (info->Flags & MultibootInfo_MEMORY) return (1024 + info->MemoryUpper);
 | 
			
		||||
 | 
			
		||||
	// No? Get info from CMOS
 | 
			
		||||
	uint8 low, high;
 | 
			
		||||
	uint32 total;
 | 
			
		||||
 | 
			
		||||
	low = CmosRead(0x30);
 | 
			
		||||
	high = CmosRead(0x31);
 | 
			
		||||
	total = (uint32)(low | high<<8) + 1024;
 | 
			
		||||
 | 
			
		||||
	ErrorMem("%#Missing memory info from bootloader. Reading from CMOS: %ukb\n", ColorLightRed, total);
 | 
			
		||||
 | 
			
		||||
	return total;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _memory_reserve_system(MultibootInfo* info)
 | 
			
		||||
{
 | 
			
		||||
	MagicBreakpoint();
 | 
			
		||||
	if ((info->Flags & MultibootInfo_MEM_MAP) != 0)
 | 
			
		||||
	{
 | 
			
		||||
		MultibootMemoryMapEntry* location = (MultibootMemoryMapEntry*)info->MemoryMapAddress;
 | 
			
		||||
 | 
			
		||||
		while ((uint32)location < (info->MemoryMapAddress + info->MemoryMapLength))
 | 
			
		||||
		{
 | 
			
		||||
			if (location->Type > 1)
 | 
			
		||||
				MemPhReserveFrames((uint32)location->Address, (uint32)location->Length);
 | 
			
		||||
 | 
			
		||||
			location = (MultibootMemoryMapEntry*) ((uint32)location + location->Size + sizeof(uint32));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		ErrorMem("%#Missing %#memory map%# info from bootloader.\n", ColorLightRed, ColorWhite, ColorLightRed);
 | 
			
		||||
 | 
			
		||||
		// Standard memory hole at 15mb
 | 
			
		||||
		MemPhReserveFrames(0x00F00000, 0x00100000);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Standard reserved memory areas
 | 
			
		||||
	MemPhReserveFrames(0x0, 0x400 + 256);	// Real mode IVT, BDA
 | 
			
		||||
	MemPhReserveFrames(0x1000, 0x2400);		// DMA buffer
 | 
			
		||||
	MemPhReserveFrames(0x9FC00, 385*1024); // EBDA, Video memory, ROM area
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void MemoryInitialize (MultibootInfo* info)
 | 
			
		||||
{
 | 
			
		||||
	uint32 totalSystemMemory = _memory_get_total_mem(info);
 | 
			
		||||
 | 
			
		||||
	MemPhInitialize(totalSystemMemory);
 | 
			
		||||
	PagingInitialize(0x200000);
 | 
			
		||||
 | 
			
		||||
	LogMem("Reserving important areas...\n");
 | 
			
		||||
	
 | 
			
		||||
	_memory_reserve_system(info);
 | 
			
		||||
 | 
			
		||||
	LogMem("Allocating kernel heap...\n");
 | 
			
		||||
	
 | 
			
		||||
	KernelHeap = MemHeapCreate(KERNEL_HEAP_START, KERNEL_HEAP_START
 | 
			
		||||
			+ KERNEL_HEAP_INITIAL_SIZE, 0xCFFFF000, 3);	// is kernel, writeable
 | 
			
		||||
 | 
			
		||||
	LogMem("Done initializing memory!");
 | 
			
		||||
	
 | 
			
		||||
	mem_initialized = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MemoryTempInitialize (uint32 kernel_end)
 | 
			
		||||
{
 | 
			
		||||
	mem_initialized = 1;
 | 
			
		||||
	mem_kernel_end = kernel_end;
 | 
			
		||||
	LogMem("Initialized temporary memory manager, allocating from %#0x%x.\n", kernel_end);
 | 
			
		||||
}
 | 
			
		||||
@@ -37,3 +37,20 @@ string strcpy (string s1, const string s2)
 | 
			
		||||
 | 
			
		||||
	return s1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
char* strchr (string s, int c)
 | 
			
		||||
{
 | 
			
		||||
	while (*s != '\0' && *s != (char)c) s++;
 | 
			
		||||
	return ((*s == (char)c) ? (char*)s : NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
char* strrchr (string s, int c)
 | 
			
		||||
{
 | 
			
		||||
	string last = NULL;
 | 
			
		||||
 | 
			
		||||
	if (c == '\0') return strchr(s, c);
 | 
			
		||||
	while ((s = strchr(s, c)) != NULL)
 | 
			
		||||
		last = s; s++;
 | 
			
		||||
 | 
			
		||||
	return (char*)last;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ extern uint32 _internal_frequency_hz;
 | 
			
		||||
const int16 MonthLen[] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TimeSystem TimeConvertToTimeSystem (Time t)
 | 
			
		||||
TimeSystem ConvertTimeToTimeSystem (Time t)
 | 
			
		||||
{
 | 
			
		||||
	TimeSystem sys = {0,0};
 | 
			
		||||
	
 | 
			
		||||
@@ -22,7 +22,7 @@ TimeSystem TimeConvertToTimeSystem (Time t)
 | 
			
		||||
	return sys;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Time TimeConvertToTime (TimeSystem InternalTime)
 | 
			
		||||
Time ConvertTimeSystemToTime (TimeSystem InternalTime)
 | 
			
		||||
{
 | 
			
		||||
	Time t;
 | 
			
		||||
	t.Milisecond = InternalTime.Time % 1000;
 | 
			
		||||
 
 | 
			
		||||
@@ -12,14 +12,16 @@ extern uint32 _end;
 | 
			
		||||
void k_main(MultibootInfo* info)
 | 
			
		||||
{
 | 
			
		||||
	uint32 KernelEnd = (uint32)&_end;
 | 
			
		||||
	MemoryTempInitialize(KernelEnd);
 | 
			
		||||
 | 
			
		||||
	ConsoleClear();
 | 
			
		||||
	MemoryTempInitialize(KernelEnd);
 | 
			
		||||
	MemoryInitialize(info);
 | 
			
		||||
 | 
			
		||||
	HalInitialize();
 | 
			
		||||
	DriversInstall();
 | 
			
		||||
	
 | 
			
		||||
	// Set up memory manager
 | 
			
		||||
	MemoryInitialize(info);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	Log("All ready. Starting console...\n\n");
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -68,6 +68,7 @@ cp floppy/original.img luxos.img
 | 
			
		||||
mkdir /media/floppy1
 | 
			
		||||
mount -o loop luxos.img /media/floppy1
 | 
			
		||||
cp kernel.bin /media/floppy1/
 | 
			
		||||
sleep 1
 | 
			
		||||
umount /media/floppy1
 | 
			
		||||
rm -r /media/floppy1
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										34
									
								
								build.sh
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								build.sh
									
									
									
									
									
								
							@@ -2,8 +2,9 @@
 | 
			
		||||
 | 
			
		||||
# ----------------- lux Operating System -----------------
 | 
			
		||||
OBJ=build
 | 
			
		||||
COMPILER=gcc
 | 
			
		||||
LINKER=ld
 | 
			
		||||
COMPILER=i586-elf-gcc
 | 
			
		||||
LINKER=i586-elf-ld
 | 
			
		||||
BUILD_VER="0.1.0"
 | 
			
		||||
 | 
			
		||||
BuildC()
 | 
			
		||||
{
 | 
			
		||||
@@ -41,18 +42,20 @@ BuildAsm()
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
echo "lux operating system v0.1"
 | 
			
		||||
 | 
			
		||||
# Clean up
 | 
			
		||||
echo "[  1%] CLEANUP"
 | 
			
		||||
rm $OBJ/* 2>/dev/null
 | 
			
		||||
 | 
			
		||||
# Calculate version number
 | 
			
		||||
read buildno < ./scripts/version.txt
 | 
			
		||||
buildno=$(($buildno + 1))
 | 
			
		||||
echo $buildno > ./scripts/version.txt
 | 
			
		||||
echo "#define OS_BUILD \"0.1.0.$buildno\"" > ./Kernel/include/version.h
 | 
			
		||||
echo "#define OS_BUILD \"$BUILD_VER.$buildno\"" > ./Kernel/include/version.h
 | 
			
		||||
 | 
			
		||||
# On the screen
 | 
			
		||||
echo "========================================================"
 | 
			
		||||
echo "LUX Operating System build $BUILD_VER.$buildno"
 | 
			
		||||
echo "========================================================"
 | 
			
		||||
 | 
			
		||||
# Clean up
 | 
			
		||||
echo "[  1%] CLEANUP"
 | 
			
		||||
rm $OBJ/* 2>/dev/null
 | 
			
		||||
 | 
			
		||||
# Build kernel
 | 
			
		||||
BuildC "filelistC.txt"
 | 
			
		||||
@@ -64,16 +67,11 @@ $LINKER -T link.ld $OBJ/*.o
 | 
			
		||||
 | 
			
		||||
# Make floppy image
 | 
			
		||||
echo "[ 97%] WRITING FLOPPY IMAGE..."
 | 
			
		||||
cp floppy/original.img luxos.img
 | 
			
		||||
mkdir /media/floppy1
 | 
			
		||||
mount -o loop luxos.img /media/floppy1
 | 
			
		||||
cp kernel.bin /media/floppy1/
 | 
			
		||||
sleep 1
 | 
			
		||||
umount /media/floppy1
 | 
			
		||||
rm -r /media/floppy1
 | 
			
		||||
mount A: /mnt/floppy 2>/dev/null >/dev/null
 | 
			
		||||
cp kernel.bin /mnt/floppy/
 | 
			
		||||
 | 
			
		||||
# DONE
 | 
			
		||||
echo "[100%] DONE!\n"
 | 
			
		||||
echo "[100%] DONE!"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								build/clock.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/clock.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/cmos.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/cmos.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/console.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/console.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/crash.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/crash.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/ctype.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/ctype.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/dma.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/dma.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/drivers.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/drivers.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/fat12.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/fat12.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/floppy.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/floppy.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/gdt.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/gdt.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/hal.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/hal.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/idt.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/idt.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/irq-asm.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/irq-asm.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/irq.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/irq.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/isrs-asm.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/isrs-asm.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/isrs.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/isrs.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/keyboard.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/keyboard.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/mem-heap.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/mem-heap.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/mem-phys.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/mem-phys.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/mem_ops.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/mem_ops.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/mouse.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/mouse.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/num_ops.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/num_ops.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/ord_arr.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/ord_arr.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/pic.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/pic.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/pit.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/pit.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/reboot.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/reboot.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/stdio.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/stdio.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/storage.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/storage.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/str_ops.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/str_ops.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/sysinfo.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/sysinfo.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/time.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/time.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								build/vfs.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								build/vfs.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										22
									
								
								change.log
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								change.log
									
									
									
									
									
								
							@@ -1,5 +1,16 @@
 | 
			
		||||
[GOOD] BUILD 0.1.0.470 DATE 8/30/2011 AT 6:40 PM
 | 
			
		||||
====================================================
 | 
			
		||||
Mainly changed: HAL.VFS
 | 
			
		||||
+ Designed virtual file system
 | 
			
		||||
+ Completed the VFS
 | 
			
		||||
+ Added verbose mode for VFS
 | 
			
		||||
+ Updated shell script, now shows build number when building
 | 
			
		||||
? TODO: Implement one file system (most likely FAT12)
 | 
			
		||||
? TODO: Mount floppy device
 | 
			
		||||
 | 
			
		||||
[GOOD] BUILD 0.1.0.450 DATE 8/29/2011 AT 10:30 AM
 | 
			
		||||
====================================================
 | 
			
		||||
Mainly changed: Memory Manager, Library.Memory
 | 
			
		||||
+ Changed 'align 0x4' line above multiboot header in loader.asm to 'align 4'
 | 
			
		||||
+ Removed -e option for echo in build.sh
 | 
			
		||||
+ Modified build.sh for linux
 | 
			
		||||
@@ -12,6 +23,7 @@
 | 
			
		||||
 | 
			
		||||
[ BAD] BUILD 0.1.0.390 DATE 8/27/2011 AT 10:54 PM
 | 
			
		||||
====================================================
 | 
			
		||||
Mainly changed: Memory Manager, Library
 | 
			
		||||
+ Added stdlib routines, separated in different files
 | 
			
		||||
+ Rewritten physical memory manager
 | 
			
		||||
+ Added virtual mem manager
 | 
			
		||||
@@ -20,9 +32,7 @@
 | 
			
		||||
+ Added temporary allocation (at end of kernel), until paging is started
 | 
			
		||||
- Removed functionality from debug console function 'mem'
 | 
			
		||||
- Removed system.h, the one remaining function now in stdio.h
 | 
			
		||||
 | 
			
		||||
TODO: 
 | 
			
		||||
Debug initialization
 | 
			
		||||
Bug hunt
 | 
			
		||||
Implement verbose mode for memmgr
 | 
			
		||||
Fix function 'mem'
 | 
			
		||||
? TODO: Debug initialization
 | 
			
		||||
? TODO: Bug hunt
 | 
			
		||||
? TODO: Implement verbose mode for memmgr
 | 
			
		||||
? TODO: Fix function 'mem'
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										24
									
								
								change.log~
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								change.log~
									
									
									
									
									
								
							@@ -1,24 +0,0 @@
 | 
			
		||||
[????] BUILD 0.1.0.??? DATE 8/27/2011 AT ??:?? ??
 | 
			
		||||
====================================================
 | 
			
		||||
+ Changed 'align 0x4' line above multiboot header in loader.asm to 'align 4'
 | 
			
		||||
+ Removed -e option for echo in build.sh
 | 
			
		||||
+ Modified build.sh for linux
 | 
			
		||||
+ Fixed triple fault when enabling paging
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
[ BAD] BUILD 0.1.0.390 DATE 8/27/2011 AT 10:54 PM
 | 
			
		||||
====================================================
 | 
			
		||||
+ Added stdlib routines, separated in different files
 | 
			
		||||
+ Rewritten physical memory manager
 | 
			
		||||
+ Added virtual mem manager
 | 
			
		||||
+ Added memory allocation/freeing
 | 
			
		||||
+ Added memory library
 | 
			
		||||
+ Added temporary allocation (at end of kernel), until paging is started
 | 
			
		||||
- Removed functionality from debug console function 'mem'
 | 
			
		||||
- Removed system.h, the one remaining function now in stdio.h
 | 
			
		||||
 | 
			
		||||
TODO: 
 | 
			
		||||
Debug initialization
 | 
			
		||||
Bug hunt
 | 
			
		||||
Implement verbose mode for memmgr
 | 
			
		||||
Fix function 'mem'
 | 
			
		||||
@@ -58,8 +58,14 @@ Kernel/hal/keyboard/keyboard.c
 | 
			
		||||
HAL :: Mouse
 | 
			
		||||
Kernel/hal/mouse/mouse.c
 | 
			
		||||
 | 
			
		||||
HAL :: System info and tools
 | 
			
		||||
Kernel/hal/sysinfo.c
 | 
			
		||||
HAL :: System reboot
 | 
			
		||||
Kernel/hal/reboot.c
 | 
			
		||||
 | 
			
		||||
HAL :: File systems :: Virtual file system
 | 
			
		||||
Kernel/hal/vfs.c
 | 
			
		||||
 | 
			
		||||
HAL :: File systems :: FAT12
 | 
			
		||||
Kernel/hal/filesys/fat12.c
 | 
			
		||||
 | 
			
		||||
Libraries :: Character types
 | 
			
		||||
Kernel/library/ctype.c
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								kernel.bin
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								kernel.bin
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -1 +1 @@
 | 
			
		||||
450
 | 
			
		||||
470
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user