git-svn-id: https://spexeah.com:8443/svn/Asuro@172 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron 2017-05-21 20:45:05 +00:00
parent b7d7f17c3a
commit 781914b160
9 changed files with 93 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.

View File

@ -17,7 +17,7 @@ uses
console;
type
TTaskStateSegment = packed record
{
Res1 : uint16;
IOPBOffset : uint16;
LDTR : uint16;
@ -54,6 +54,92 @@ type
ESP0 : uint32;
LINK : uint16;
Res12 : uint16;
}
{
Res12 : uint16;
LINK : uint16;
ESP0 : uint32;
Res11 : uint16;
SS0 : uint16;
Res10 : uint16;
SS1 : uint16;
Res9 : uint16;
SS2 : uint16;
CR3 : uint32;
EIP : uint32;
EFLAGS : uint32;
EAX : uint32;
ECX : uint32;
EDX : uint32;
EBX : uint32;
ESP : uint32;
EBP : uint32;
ESI : uint32;
EDI : uint32;
Res8 : uint16;
ES : uint16;
Res7 : uint16;
CS : uint16;
Res6 : uint16;
SS : uint16;
Res5 : uint16;
DS : uint16;
Res4 : uint16;
FS : uint16;
Res3 : uint16;
GS : uint16;
Res2 : uint16;
LDTR : uint16;
IOPBOffset : uint16;
Res1 : uint16;
}
TTaskStateSegment = packed record
link : uint16;
link_h : uint16;
esp0 : uint32;
ss0 : uint16;
ss0_h : uint16;
esp1 : uint32;
ss1 : uint16;
ss1_h : uint16;
esp2 : uint32;
ss2 : uint16;
ss2_h : uint16;
cr3 : uint32;
eip : uint32;
eflags : uint32;
eax : uint32;
ecx : uint32;
edx : uint32;
ebx : uint32;
esp : uint32;
ebp : uint32;
esi : uint32;
edi : uint32;
es : uint16;
es_h : uint16;
cs : uint16;
cs_h : uint16;
ss : uint16;
ss_h : uint16;
ds : uint16;
ds_h : uint16;
fs : uint16;
fs_h : uint16;
gs : uint16;
gs_h : uint16;
ldt : uint16;
ldt_h : uint16;
trap : uint16;
iomap : uint16;
end;
PTaskStateSegment = ^TTaskStateSegment;
@ -67,38 +153,22 @@ implementation
procedure init;
var
i : uint32;
cESP : uint32;
begin
console.writestringln('A');
i:=KERNEL_PAGE_NUMBER+4;
console.writestringln('B');
while not vmemorymanager.new_page(i) do begin
i:= i + 1;
end;
console.writestringln('C');
ptrTaskStateSegment:= PTaskStateSegment(i SHL 22);
console.writestringln('D');
ptrTaskStateSegment^.SS0:= $10;
console.writestringln('E');
ptrTaskStateSegment^.ESP0:= $00;
console.writestringln('F');
ptrTaskStateSegment^.IOPBOffset:= sizeof(TTaskStateSegment);
console.writestringln('G');
gdt.set_gate($05, i SHL 22 - KERNEL_VIRTUAL_BASE, sizeof(TTaskStateSegment), $89, $40); //OFFSET: 40
console.writestringln('H');
ptrTaskStateSegment^.ss0:= $10;
ptrTaskStateSegment^.iomap:= sizeof(TTaskStateSegment);
gdt.set_gate($05, uint32(ptrTaskStateSegment) - KERNEL_VIRTUAL_BASE, sizeof(TTaskStateSegment), $89, $40); //OFFSET: 40
asm
MOV cESP, ESP
end;
console.writestringln('I');
ptrTaskStateSegment^.ESP0:= cESP;
console.writestringln('J');
ptrTaskStateSegment^.esp0:= cESP;
console.writestringln('A');
asm
mov AX, 40
ltr AX
end;
console.writestringln('K');
console.writestringln('B');
end;
end.