[GOOD] BUILD 0.1.0.551 DATE 9/03/2011 AT 9:25 AM
==================================================== Mainly changed: HAL.FSs + Updated 'mount' call in floppy driver, now done after controller is initialized + Added 'detect' function for FAT file systems + Implemented 'initdr' driver, however still bugged + Improved logger
This commit is contained in:
		@@ -18,7 +18,7 @@ uint32 _malloc_init1 (uint32 size, uint8 page_aligned)
 | 
			
		||||
	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);
 | 
			
		||||
	Log("Mem","%#Allocated %u bytes (%spage aligned) at end of kernel (0x%x).\n", ColorLightMagenta, size, ((page_aligned) ? "" : "not "), ret);
 | 
			
		||||
	return (ret);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -31,11 +31,11 @@ uint32 _malloc_init2 (uint32 size, uint8 page_aligned, uint32* 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);
 | 
			
		||||
		Log("Mem","%#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);
 | 
			
		||||
		Log("Mem","%#Allocated %u bytes (%spage aligned) at address 0x%x.\n", ColorLightMagenta, size, ((page_aligned) ? "" : "not "), ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ extern uint8 mem_initialized;
 | 
			
		||||
void kfree(void* addr)
 | 
			
		||||
{
 | 
			
		||||
	if (mem_initialized < 2) {
 | 
			
		||||
		ErrorMem("%#Tried to free at address 0x%x when memory manager is uninitialized.\n", ColorLightRed, (uint32)addr);
 | 
			
		||||
		Error("Mem", "%#Tried to free at address 0x%x when memory manager is uninitialized.\n", ColorLightRed, (uint32)addr);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ uint32 _memory_get_total_mem(MultibootInfo* info)
 | 
			
		||||
	high = CmosRead(0x31);
 | 
			
		||||
	total = (uint32)(low | high<<8) + 1024;
 | 
			
		||||
 | 
			
		||||
	ErrorMem("%#Missing memory info from bootloader. Reading from CMOS: %ukb\n", ColorLightRed, total);
 | 
			
		||||
	Error("Mem", "%#Missing memory info from bootloader. Reading from CMOS: %ukb\n", ColorLightRed, total);
 | 
			
		||||
 | 
			
		||||
	return total;
 | 
			
		||||
}
 | 
			
		||||
@@ -50,7 +50,7 @@ void _memory_reserve_system(MultibootInfo* info)
 | 
			
		||||
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		ErrorMem("%#Missing %#memory map%# info from bootloader.\n", ColorLightRed, ColorWhite, ColorLightRed);
 | 
			
		||||
		Error("Mem", "%#Missing %#memory map%# info from bootloader.\n", ColorLightRed, ColorWhite, ColorLightRed);
 | 
			
		||||
 | 
			
		||||
		// Standard memory hole at 15mb
 | 
			
		||||
		MemPhReserveFrames(0x00F00000, 0x00100000);
 | 
			
		||||
@@ -75,7 +75,7 @@ void MemoryInitialize (MultibootInfo* info)
 | 
			
		||||
	KernelHeap = MemHeapCreate(KERNEL_HEAP_START, KERNEL_HEAP_START
 | 
			
		||||
			+ KERNEL_HEAP_INITIAL_SIZE, 0xCFFFF000, 3);	// is kernel, writeable
 | 
			
		||||
 | 
			
		||||
	LogMem("Done initializing memory!");
 | 
			
		||||
	Log("Mem", "Done initializing memory!");
 | 
			
		||||
	
 | 
			
		||||
	mem_initialized = 2;
 | 
			
		||||
}
 | 
			
		||||
@@ -84,5 +84,5 @@ 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);
 | 
			
		||||
	Log("Mem", "Initialized temporary memory manager, allocating from %#0x%x.\n", kernel_end);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,7 @@
 | 
			
		||||
 *      Author: Tiberiu
 | 
			
		||||
 */
 | 
			
		||||
#include <types.h>
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
 | 
			
		||||
uint32 strlen (string s)
 | 
			
		||||
{
 | 
			
		||||
@@ -28,6 +29,19 @@ int32 strcmp (string a, string b)
 | 
			
		||||
	return ((c1 < c2) ? -1 : (c1 > c2));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int32 strcasecmp (string a, string b)
 | 
			
		||||
{
 | 
			
		||||
	unsigned char c1, c2;
 | 
			
		||||
 | 
			
		||||
	while (*a != '\0' && *b != '\0' && tolower(*a) == tolower(*b)) {
 | 
			
		||||
		a++; b++;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	c1 = tolower(*(unsigned char*) a);
 | 
			
		||||
	c2 = tolower(*(unsigned char*) b);
 | 
			
		||||
	return ((c1 < c2) ? -1 : (c1 > c2));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
string strcpy (string s1, const string s2)
 | 
			
		||||
{
 | 
			
		||||
	char *dst = s1;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user