5 Commits

Author SHA1 Message Date
1db74f791a Merge branch 'develop' into 'master'
Pipeline Cleanup & Expansion

See merge request spexeah/asuro!28
2021-07-06 20:00:31 +00:00
372fda3afc Pipeline Cleanup & Expansion 2021-07-06 20:00:31 +00:00
749ffe6d73 Merge branch 'develop' into 'master'
Develop

See merge request spexeah/asuro!21
2021-07-05 15:50:43 +00:00
76b399f3b5 Merge branch 'develop' into 'master'
klalloc & pipeline changes

Added a klalloc and a klfree (not yet implemented) to lmemorymanager.
Added a page_mappable method to vmemorymanager to check if a page is mappable before trying to map, this supports klalloc.
Added a streamlined pipeline
Added documentation generation to the pipeline.

See merge request spexeah/asuro!19
2021-07-05 15:27:55 +00:00
83f7ebb223 Merge branch 'develop' into 'master'
Develop

See merge request spexeah/asuro!12
2021-06-22 22:47:58 +00:00
3 changed files with 3 additions and 350 deletions

View File

@ -31,11 +31,11 @@ We welcome everyone to give building/breaking/fixing/shooting Asuro a go, feel f
7. Clone this repository. 7. Clone this repository.
8. Run the following command in the root of the repo to build the docker image: 8. Run the following command in the root of the repo to build the docker image:
```powershell ```powershell
docker compose build builder docker-compose build builder
``` ```
9. Run the following command to compile Asuro: 9. Run the following command to compile Asuro:
```powershell ```powershell
docker compose run builder docker-compose run builder
``` ```
10. Create a new virtual machine in Virtualbox and mount the `Asuro.iso` generated in step 9 as a boot image. 10. Create a new virtual machine in Virtualbox and mount the `Asuro.iso` generated in step 9 as a boot image.
11. Add the virtualbox installation directory to your `%PATH%` environment variable, usually: 11. Add the virtualbox installation directory to your `%PATH%` environment variable, usually:
@ -78,4 +78,4 @@ We welcome everyone to give building/breaking/fixing/shooting Asuro a go, feel f
14. Congratulations! You can now play with Asuro! 14. Congratulations! You can now play with Asuro!
### Gotchas ### Gotchas
- It was noted that Windows builds above `20H2` seem to have issues installing WSL2. We may have to wait for a patch from Microsoft to fix this. Our devs are currently using build `20H2`. - It was noted that Windows builds above `20H2` seem to have issues installing WSL2. We may have to wait for a patch from Microsoft to fix this. Our devs are currently using build `20H2`.

View File

@ -44,19 +44,6 @@ type
ElementSize : uint32; ElementSize : uint32;
end; end;
{ Dynamic List }
PDList = ^TDList;
TDList = record
Count : uint32;
Data : void;
ElementSize : uint32;
DataSize : uint32;
end;
{ Dynamic List Iterator }
{ String Linked List } { String Linked List }
procedure STRLL_Add(LinkedList : PLinkedListBase; str : pchar); procedure STRLL_Add(LinkedList : PLinkedListBase; str : pchar);
@ -79,24 +66,6 @@ function LL_Get(LinkedList : PLinkedListBase; idx : uint32) : Void;
procedure LL_Free(LinkedList : PLinkedListBase); procedure LL_Free(LinkedList : PLinkedListBase);
function LL_FromString(str : pchar; delimter : char) : PLinkedListBase; function LL_FromString(str : pchar; delimter : char) : PLinkedListBase;
{ Dynamic List }
function DL_New(ElementSize : uint32) : PDList;
function DL_Add(DList : PDList) : Void;
function DL_Delete(DList : PDList; idx : uint32) : boolean;
function DL_Size(DList : PDList) : uint32;
function DL_Set(DList : PDList; idx : uint32; elm : puint32) : boolean;
function DL_Get(DList : PDList; idx : uint32) : Void;
procedure DL_Free(DList : PDList);
function DL_IndexOf(DList : PDList; elm : puint32) : uint32;
function DL_Contains(DList : PDList; elm : puint32) : boolean;
function DL_Concat(DList1 : PDList; DList2 : PDList) : PDList;
{ Dynamic List Iterator }
implementation implementation
uses uses
@ -382,227 +351,4 @@ begin
end; end;
end; end;
{ Dynamic List }
function DL_New(ElementSize : uint32) : PDList;
var
DL : PDList;
begin
DL := PDList(kalloc(sizeof(DL)));
DL^.ElementSize:= ElementSize;
DL^.count := 0;
if ElementSize > 128 then begin
DL^.data := kalloc(ElementSize * 4);
Dl^.DataSize:= ElementSize * 4;
end else if ElementSize > 64 then begin
DL^.data := kalloc(ElementSize * 8);
Dl^.DataSize:= ElementSize * 8;
end else if ElementSize > 32 then begin
DL^.data := kalloc(ElementSize * 16);
Dl^.DataSize:= ElementSize * 16;
end else if ElementSize > 16 then begin
DL^.data := kalloc(ElementSize * 32);
Dl^.DataSize:= ElementSize * 32;
end else begin
DL^.data := kalloc(ElementSize * 64);
Dl^.DataSize:= ElementSize * 64;
end;
DL_New := DL;
end;
function DL_Add(DList : PDList) : Void;
var
elm : puint32;
tempList : puint32;
begin
//check if we need to resize
if (DList^.count + 1) * DList^.ElementSize > DList^.DataSize then begin
push_trace('lists.DL_Add: Resizing');
tempList := DList^.Data;
DList^.Data := kalloc(DList^.DataSize * 2);
memset(uint32(DList^.Data), 0, DList^.DataSize * 2);
memcpy(uint32(tempList), uint32(DList^.Data), DList^.DataSize);
DList^.DataSize:= DList^.DataSize * 2;
kfree(void(tempList));
end;
push_trace('lists.DL_Add');
elm := puint32(@puint8(DList^.Data)[(DList^.count * DList^.ElementSize)]);
elm^ := 0;
push_trace('lists.DL_Add: Adding');
DList^.count := DList^.count + 1;
DL_Add := elm;
end;
function DL_Delete(DList : PDList; idx : uint32) : boolean;
var
elm : puint32;
tempList : puint32;
begin
if idx >= DList^.count then begin
DL_Delete := false;
exit;
end;
elm := puint32( puint8(DList^.Data) + (idx * DList^.ElementSize));
memcpy(uint32( puint8(elm) + DList^.ElementSize), uInt32(elm), (DList^.count - idx) * DList^.ElementSize);
DList^.count := DList^.count - 1;
if (DList^.count * DList^.ElementSize) < DList^.DataSize DIV 2 then begin
tempList := DList^.Data;
DList^.DataSize:= DList^.DataSize DIV 2;
DList^.Data := kalloc(DList^.DataSize);
memcpy(uint32(tempList), uint32(DList^.Data), DList^.DataSize);
kfree(void(tempList));
end;
DL_Delete := true;
end;
function DL_Get(DList : PDList; idx : uint32) : Void;
var
elm : puint32;
begin
if idx >= DList^.count then begin
DL_Get := nil;
exit;
end;
elm := puint32(DList^.Data + (idx * DList^.ElementSize));
DL_Get := elm;
end;
function DL_Set(DList : PDList; idx : uint32; elm : puint32) : boolean;
var
tempList : PuInt32;
size : uint32;
begin
if idx >= DList^.count then begin
DL_Set := false;
exit;
end;
//check if we need to resize
if (idx + 1) * Dlist^.ElementSize > DList^.DataSize then begin
console.writestring('resising thisthinghere');
size := idx * DList^.ElementSize * 2;
tempList := DList^.Data;
DList^.Data := kalloc(size);
memset(uint32(DList^.Data), 0, size);
memcpy(uint32(tempList), uint32(DList^.Data), DList^.DataSize);
DList^.DataSize := size;
kfree(void(tempList));
end;
console.writeString('offset: ');
console.writeintln(idx * DList^.ElementSize);
memcpy(uint32(elm), uint32( PuInt8(DList^.Data) + (idx * DList^.ElementSize)), DList^.ElementSize);
//check if count is smaller than idx and if so, increase count
if DList^.count < idx then DList^.count := idx;
DL_Set := true;
end;
function DL_Size(DList : PDList) : uint32;
begin
DL_Size := DList^.count;
end;
procedure DL_Free(DList : PDList);
begin
kfree(void(DList^.Data));
kfree(void(DList));
end;
function DL_IndexOf(DList : PDList; elm : puint32) : uint32;
var
i : uint32;
temp : puint32;
begin
for i := 0 to DList^.count - 1 do begin
temp := puint32( puint8(DList^.Data) + (i * DList^.ElementSize));
if temp = elm then begin
DL_IndexOf := i;
exit;
end;
end;
DL_IndexOf := -1;
end;
function DL_Contains(DList : PDList; elm : puint32) : boolean;
var
i : uint32;
begin
i := DL_IndexOf(DList, elm);
if i = -1 then begin
DL_Contains := false;
exit;
end;
DL_Contains := true;
end;
function DL_Concat(DList1 : PDList; DList2 : PDList) : PDList;
var
i : uint32;
temp : puint32;
begin
//check element size
if DList1^.ElementSize <> DList2^.ElementSize then begin
DL_Concat := nil;
exit;
end;
//check if we need to resize
while true do begin
if (DList1^.count + DList2^.count) * DList1^.ElementSize > DList1^.DataSize then begin
temp := DList1^.Data;
DList1^.Data := kalloc(DList1^.DataSize * 2);
memset(uint32(DList1^.Data), 0, DList1^.DataSize * 2);
memcpy(uint32(temp), uint32(DList1^.Data), DList1^.DataSize);
DList1^.DataSize:= DList1^.DataSize * 2;
kfree(void(temp));
end else Break;
end;
for i := 0 to DList2^.count - 1 do begin
temp := DL_Add(DList1);
memcpy(uint32(DL_Get(DList2, i)), uint32(temp), DList1^.ElementSize);
end;
DL_Concat := DList1;
end;
end. end.

View File

@ -16,7 +16,6 @@
Include->Strings - String Manipulation. Include->Strings - String Manipulation.
@author(Kieron Morris <kjm@kieronmorris.me>) @author(Kieron Morris <kjm@kieronmorris.me>)
@author(Aaron Hance <ah@aaronhance.me>)
} }
unit strings; unit strings;
@ -34,10 +33,6 @@ function stringCopy(str : pchar) : pchar;
function stringNew(size : uint32) : pchar; function stringNew(size : uint32) : pchar;
function stringSize(str : pchar) : uint32; function stringSize(str : pchar) : uint32;
function stringConcat(str1, str2 : pchar) : pchar; function stringConcat(str1, str2 : pchar) : pchar;
function stringTrim(str : pchar; length : uint32) : pchar;
function stringSub(str : pchar; start, size : uint32) : pchar;
function stringReplace(str, find, replace : pchar) : pchar;
function stringIndexOf(str, find : pchar) : sint32;
function stringContains(str : pchar; sub : pchar) : boolean; function stringContains(str : pchar; sub : pchar) : boolean;
function stringToInt(str : pchar) : uint32; function stringToInt(str : pchar) : uint32;
function hexStringToInt(str : pchar) : uint32; function hexStringToInt(str : pchar) : uint32;
@ -156,94 +151,6 @@ begin
stringConcat:= result; stringConcat:= result;
end; end;
// Trim the string to the specified length.
function stringTrim(str : pchar; length : uInt32) : pchar;
var
result : pchar;
begin
result:= stringNew(length);
memcpy(uint32(str), uint32(result), length);
stringTrim:= result;
end;
// Return a substring of the string.
function stringSub(str : pchar; start, size : uint32) : pchar;
var
result : pchar;
begin
result:= stringNew(size);
memcpy(uint32(str)+start, uint32(result), size);
stringSub:= result;
end;
// Replace first instance of a string with another.
function stringReplace(str, find, replace : pchar) : pchar;
var
result : pchar;
i, j, k : uint32;
found : boolean;
begin
// Find the first instance of the find string.
i:= 0;
found:= false;
while (i < stringSize(str)) and (not found) do begin
if stringEquals(str+i, find) then begin
found:= true;
end else begin
inc(i);
end;
end;
// If we found the find string, replace it.
if found then begin
result:= stringNew(stringSize(str) - stringSize(find) + stringSize(replace));
j:= 0;
k:= 0;
while i < stringSize(str) do begin
if stringEquals(str+i, find) then begin
memcpy(uint32(replace), uint32(result+j), stringSize(replace));
j:= j + stringSize(replace);
inc(i, stringSize(find));
end else begin
result[j]:= str[i];
inc(j);
inc(i);
end;
end;
stringReplace:= result;
end else begin
stringReplace:= stringCopy(str);
end;
// Return the result.
stringReplace:= result;
end;
// Find the index of the first instance of a string.
function stringIndexOf(str, find : pchar) : sint32;
var
i : uint32;
found : boolean;
begin
i:= 0;
found:= false;
while (i < stringSize(str)) and (not found) do begin
if stringEquals(str+i, find) then begin
found:= true;
end else begin
inc(i);
end;
end;
if found then begin
stringIndexOf:= i;
end else begin
stringIndexOf:= -1;
end;
end;
function stringContains(str : pchar; sub : pchar) : boolean; function stringContains(str : pchar; sub : pchar) : boolean;
var var
strEnd, subEnd, i, j, count : uint32; strEnd, subEnd, i, j, count : uint32;