Changed Memory Management, working on Virtual Memory Management for next rev.

git-svn-id: https://spexeah.com:8443/svn/Asuro@116 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron
2017-05-19 21:13:26 +00:00
parent da0401a21e
commit 278c2e8fa7
45 changed files with 31 additions and 23 deletions

View File

@ -13,9 +13,9 @@ uses
console,
bios_data_area,
keyboard,
memorymanager,
scheduler,
paging;
vmemorymanager,
pmemorymanager,
scheduler;
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
@ -51,19 +51,21 @@ begin
idt.init();
isr.init();
irq.init();
memorymanager.init();
pmemorymanager.init();
scheduler.init();
STI;
isr32.hook(uint32(@bios_data_area.tick_update));
{z:= 1;
z:= 1;
while true do begin
console.writeintln(z);
pint:= kalloc(65000);
console.writeword(z);
console.writestring(': ');
pint:= kalloc(1024*4);
console.writewordln(uint32(pint));
if pint = nil then while true do begin end else pint^:= 1234;
z:=z+1;
end;}
end;
//drivers
keyboard.init(keyboard_layout);

View File

@ -1,14 +1,15 @@
unit memorymanager;
unit pmemorymanager;
interface
uses
util,
console;
console,
vmemorymanager;
const
ALLOC_SPACE = 8; //64-Bit Allocations
MAX_ENTRIES = $FFFF;
MAX_ENTRIES = $FFFFF;
procedure init;
function kalloc(size : uint32) : void;
@ -41,7 +42,7 @@ end;
function kalloc(size : uint32) : void;
var
blocks : uint8;
blocks : uint32;
rem : uint32;
i,j : uint32;
miss : boolean;
@ -66,11 +67,11 @@ begin
Memory_Manager[i+j].Length:= 0;
if j = 0 then Memory_Manager[i+j].Length:= blocks;
end;
//console.writestring('Allocated ');
//console.writeint(blocks);
//console.writestring(' Block(s). [Block: ');
//console.writeint(i);
//console.writestringln(']');
console.writestring('Allocated ');
console.writeint(blocks);
console.writestring(' Block(s). [Block: ');
console.writeint(i);
console.writestringln(']');
break;
end;
end;

View File

@ -5,12 +5,16 @@ interface
uses
console,
isr32,
memorymanager;
pmemorymanager;
const
Quantum = 64;
type
TTask_State_Segment = packed record
end;
TScheduler_Entry = packed record
ThreadID : uint32;
Priority : uint8;

View File

@ -97,5 +97,6 @@ section .bss
; Kernel stack location
;
align 32
global KERNEL_STACK
KERNEL_STACK:
resb KERNEL_STACKSIZE

View File

@ -34,6 +34,7 @@ procedure psleep(t : uint16);
var
endptr : uint32; external name '__end';
stack : uint32; external name 'KERNEL_STACK';
implementation
@ -135,7 +136,7 @@ begin
asm
PUSH EAX
PUSH EDX
MOV DX, port
MOV DX, port$FFFF
IN EAX, DX
MOV inl, EAX
POP EDX

View File

@ -1,10 +1,9 @@
unit paging;
unit vmemorymanager;
interface
type
PPageTableEntry = ^TPageTableEntry;
{PPageTableEntry = ^TPageTableEntry;
TPageTableEntry = bitpacked record
Present,
Writable,
@ -17,7 +16,7 @@ type
GlobalPage: Boolean;
Available: UBit3;
FrameAddress: UBit20;
end;
end;}
PPageDirEntry = ^TPageDirEntry;
TPageDirEntry = bitpacked record