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

BIN
Asuro.iso

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/pmemorymanager.ppu Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/vmemorymanager.ppu Normal file

Binary file not shown.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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