Compare commits
37
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8be364c990 | ||
|
|
0e2c6b2936 | ||
|
|
632c3fa66b | ||
|
|
875e3e4765 | ||
|
|
e28d68128d | ||
|
|
a9969d58f8 | ||
|
|
d7a54d858d | ||
|
|
4e991c3e6f | ||
|
|
a3217de71a | ||
|
|
19b433a19f | ||
|
|
69d1d22a18 | ||
|
|
5c15343ed0 | ||
|
|
3ae349fbc8 | ||
|
|
78c060c114 | ||
|
|
cd925e96c2 | ||
|
|
142dd486dd | ||
|
|
beeeabd441 | ||
|
|
b73c66f6d6 | ||
|
|
189526cab8 | ||
|
|
595dd4fbac | ||
|
|
ba6d8037d2 | ||
|
|
208bda92c8 | ||
|
|
a7111d3cac | ||
|
|
d182fd7f46 | ||
|
|
4c5038b001 | ||
|
|
98481ea1ce | ||
|
|
b5582b1284 | ||
|
|
161cea4920 | ||
|
|
6b81c4ece0 | ||
|
|
ee17f69115 | ||
|
|
81c19bff16 | ||
|
|
e7cda58113 | ||
|
|
44f18554e1 | ||
|
|
52b42ec975 | ||
|
|
2815dd9e4d | ||
|
|
d057bfc3ff | ||
|
|
e4621c8aaa |
No files matched your search
+52
@@ -0,0 +1,52 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: build
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build-image
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
repo: t3hn3rd/asuro-build
|
||||||
|
tags: latest
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
registry: docker.io
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
|
||||||
|
- name: compile
|
||||||
|
image: t3hn3rd/asuro-build:latest
|
||||||
|
depends_on:
|
||||||
|
- build-image
|
||||||
|
commands:
|
||||||
|
- git fetch --tags
|
||||||
|
- find . -type f -print0 | xargs -0 dos2unix
|
||||||
|
- chmod +x /drone/src/*.sh
|
||||||
|
- /drone/src/compile.sh
|
||||||
|
|
||||||
|
- name: upload-iso-artifact
|
||||||
|
image: alpine/git
|
||||||
|
depends_on:
|
||||||
|
- compile
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
environment:
|
||||||
|
GITEA_TOKEN:
|
||||||
|
from_secret: gitea_token
|
||||||
|
commands:
|
||||||
|
- apk add --no-cache curl
|
||||||
|
- chmod +w Asuro.iso
|
||||||
|
- cp Asuro.iso "Asuro-$(git rev-parse --short HEAD).iso"
|
||||||
|
- echo "Uploading Asuro-$(git rev-parse --short HEAD).iso to Gitea Packages..."
|
||||||
|
- |
|
||||||
|
curl -X PUT "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/$(git rev-parse --short HEAD)/Asuro.iso" \
|
||||||
|
-H "Authorization: token $GITEA_TOKEN" --upload-file "Asuro-$(git rev-parse --short HEAD).iso"
|
||||||
|
- echo "Updating latest ISO reference..."
|
||||||
|
- |
|
||||||
|
curl -X DELETE https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso \
|
||||||
|
-H "Authorization: token $GITEA_TOKEN" || echo "No previous latest version found."
|
||||||
|
- |
|
||||||
|
curl -X PUT https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso \
|
||||||
|
-H "Authorization: token $GITEA_TOKEN" --upload-file "Asuro-$(git rev-parse --short HEAD).iso"
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
stages:
|
|
||||||
- Compile Versions
|
|
||||||
- Compile Sources
|
|
||||||
- Link
|
|
||||||
- Generate Documentation
|
|
||||||
- Deploy
|
|
||||||
|
|
||||||
cache:
|
|
||||||
- key: ${CI_COMMIT_REF_SLUG}
|
|
||||||
paths:
|
|
||||||
- lib/*.o
|
|
||||||
- bin/kernel.bin
|
|
||||||
- doc
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- chmod +x *.sh
|
|
||||||
|
|
||||||
versions:
|
|
||||||
stage: Compile Versions
|
|
||||||
script:
|
|
||||||
- ./compile_vergen.sh
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- release/*.svg
|
|
||||||
- src/include/asuro.pas
|
|
||||||
|
|
||||||
compile_sources:
|
|
||||||
stage: Compile Sources
|
|
||||||
script:
|
|
||||||
- rm -f lib/*.so
|
|
||||||
- ./compile_sources.sh
|
|
||||||
needs:
|
|
||||||
- versions
|
|
||||||
|
|
||||||
link:
|
|
||||||
stage: Link
|
|
||||||
script:
|
|
||||||
- ./compile_stub.sh
|
|
||||||
- ./compile_link.sh
|
|
||||||
needs:
|
|
||||||
- versions
|
|
||||||
- compile_sources
|
|
||||||
|
|
||||||
isogen:
|
|
||||||
stage: Deploy
|
|
||||||
script:
|
|
||||||
- ./compile_isogen.sh
|
|
||||||
- ./compile_sumgen.sh
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- ./Asuro.iso
|
|
||||||
- ./release/checksum.svg
|
|
||||||
needs:
|
|
||||||
- link
|
|
||||||
|
|
||||||
docgen:
|
|
||||||
stage: Generate Documentation
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
script:
|
|
||||||
- ./compile_sourcelist.sh
|
|
||||||
- ./compile_docs.sh
|
|
||||||
# Remove comments when we want to use gitlab pages.
|
|
||||||
#- cp doc public
|
|
||||||
allow_failure: true
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- doc
|
|
||||||
#- public/*
|
|
||||||
#- ./sources.list
|
|
||||||
needs:
|
|
||||||
- versions
|
|
||||||
+1
-1
@@ -16,7 +16,7 @@ RUN curl -sL https://sourceforge.net/projects/freepascal/files/Linux/$FPC_VERSIO
|
|||||||
|
|
||||||
COPY compile.sh /compile.sh
|
COPY compile.sh /compile.sh
|
||||||
ADD https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver /usr/bin/semver
|
ADD https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver /usr/bin/semver
|
||||||
RUN mkdir /code && chmod +x /usr/bin/semver
|
RUN chmod +x /usr/bin/semver
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
RUN find . -type f -print0 | xargs -0 dos2unix
|
RUN find . -type f -print0 | xargs -0 dos2unix
|
||||||
ENTRYPOINT ["/bin/bash", "-c"]
|
ENTRYPOINT ["/bin/bash", "-c"]
|
||||||
|
|||||||
+18
-14
@@ -20,26 +20,30 @@ runOrFail() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
runOrFail $(pwd)/compile_stub.sh "Failed to compile stub!"
|
declare -a run_steps=(
|
||||||
|
"compile_stub.sh" "Failed to compile stub!"
|
||||||
|
"compile_vergen.sh" "Versions failed to compile"
|
||||||
|
"compile_sources.sh" "Failed to compile FPC Sources!"
|
||||||
|
"compile_link.sh" "Failed linking!"
|
||||||
|
"compile_isogen.sh" "Failed to create ISO!"
|
||||||
|
)
|
||||||
|
|
||||||
#Generate .pas with versioning headers.
|
for ((i=0; i<${#run_steps[@]}; i+=2))
|
||||||
runOrFail $(pwd)/compile_vergen.sh "Versions failed to compile"
|
do
|
||||||
|
if [ "$ERRCOUNT" -eq "0" ]
|
||||||
#Compile all .pas sources
|
then
|
||||||
runOrFail $(pwd)/compile_sources.sh "Failed to compile FPC Sources!"
|
script=$(pwd)/"${run_steps[$i]}"
|
||||||
|
message="${run_steps[$i+1]}"
|
||||||
#Link into a binary.
|
runOrFail "$script" "$message"
|
||||||
runOrFail $(pwd)/compile_link.sh "Failed linking!"
|
fi
|
||||||
|
done
|
||||||
#Generate an ISO with GRUB as the Bootloader.
|
|
||||||
runOrFail ./compile_isogen.sh "Failed to create ISO!"
|
|
||||||
|
|
||||||
#Call generate final artifacts based on failure or success of the above.
|
#Call generate final artifacts based on failure or success of the above.
|
||||||
if [ "$ERRCOUNT" -ne "0" ]
|
if [ "$ERRCOUNT" -ne "0" ]
|
||||||
then
|
then
|
||||||
./compile_finish.sh "failed"
|
. ./compile_finish.sh "failed"
|
||||||
else
|
else
|
||||||
./compile_finish.sh "success"
|
. ./compile_finish.sh "success"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
+1
-1
@@ -4,4 +4,4 @@ echo "======================="
|
|||||||
echo " "
|
echo " "
|
||||||
echo "Compiling FPC Sources..."
|
echo "Compiling FPC Sources..."
|
||||||
echo " "
|
echo " "
|
||||||
fpc -Aelf -gw -n -va -O3 -Op3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ -Fusrc/* -Fusrc/driver/* -Fusrc/driver/net/* src/kernel.pas
|
fpc -Aelf -gw -g -gl -n -vlewn -O3 -Op3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ -Fusrc/* -Fusrc/driver/* -Fusrc/driver/net/* src/kernel.pas
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
#Flat filesystem
|
|
||||||
|
|
||||||
A super simple filesystem for asuro. Folders are emulated in filenames.
|
|
||||||
|
|
||||||
Starts with disk info sector, sector 0 of volume
|
|
||||||
|
|
||||||
---
|
|
||||||
#### disk info
|
|
||||||
|
|
||||||
jmp2boot : ubit24;
|
|
||||||
OEMName : array[0..7] of char;
|
|
||||||
version : uint16 // numerical version of filesystem
|
|
||||||
sectorCount : uint16;
|
|
||||||
fileCount : uint16
|
|
||||||
signature : uint32 = 0x0B00B1E5
|
|
||||||
|
|
||||||
|
|
||||||
the Rest of the sector is reserved
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
Starting from sector 1 is the file table. Table size is determined by entry size (64) * fileCount
|
|
||||||
|
|
||||||
---
|
|
||||||
####File entry
|
|
||||||
|
|
||||||
name : array[0..59] of char //file name max 60 chars
|
|
||||||
fileStart : 16bit // start sector of data
|
|
||||||
fileSize : 16bit // data size in sectors
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
+2
-1
@@ -2,7 +2,7 @@ ENTRY(loader)
|
|||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
. = 0xC0100000;
|
. = 0xC0100000;
|
||||||
|
kernel_start = .;
|
||||||
.text : AT(ADDR(.text) - 0xC0000000)
|
.text : AT(ADDR(.text) - 0xC0000000)
|
||||||
{
|
{
|
||||||
text = .; _text = .; __text = .;
|
text = .; _text = .; __text = .;
|
||||||
@@ -33,4 +33,5 @@ SECTIONS
|
|||||||
. = ALIGN(4096);
|
. = ALIGN(4096);
|
||||||
}
|
}
|
||||||
end = .; _end = .; __end = .;
|
end = .; _end = .; __end = .;
|
||||||
|
kernel_end = .;
|
||||||
}
|
}
|
||||||
+3
-2
@@ -1776,14 +1776,15 @@ var
|
|||||||
fb: puint32;
|
fb: puint32;
|
||||||
|
|
||||||
Begin
|
Begin
|
||||||
|
Ready:= False;
|
||||||
fb:= puint32(uint32(multibootinfo^.framebuffer_addr));
|
fb:= puint32(uint32(multibootinfo^.framebuffer_addr));
|
||||||
Console_Properties.Width:= multibootinfo^.framebuffer_width;
|
Console_Properties.Width:= multibootinfo^.framebuffer_width;
|
||||||
Console_Properties.Height:= multibootinfo^.framebuffer_height;
|
Console_Properties.Height:= multibootinfo^.framebuffer_height;
|
||||||
Console_Properties.BitsPerPixel:= multibootinfo^.framebuffer_bpp;
|
Console_Properties.BitsPerPixel:= multibootinfo^.framebuffer_bpp;
|
||||||
Console_Properties.MAX_CELL_X:= (Console_Properties.Width div 8) - 1;
|
Console_Properties.MAX_CELL_X:= (Console_Properties.Width div 8) - 1;
|
||||||
Console_Properties.MAX_CELL_Y:= (Console_Properties.Height div 16) - 1;
|
Console_Properties.MAX_CELL_Y:= (Console_Properties.Height div 16) - 1;
|
||||||
If Console_Properties.BitsPerPixel <> 16 then while true do begin
|
If Console_Properties.BitsPerPixel <> 16 then begin
|
||||||
|
exit;
|
||||||
end;
|
end;
|
||||||
kpalloc(uint32(fb));
|
kpalloc(uint32(fb));
|
||||||
keyboard.hook(@keyhook);
|
keyboard.hook(@keyhook);
|
||||||
|
|||||||
+23
@@ -291,6 +291,28 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure enableAVX();
|
||||||
|
begin
|
||||||
|
if CPUID.Capabilities1^.AVX then begin
|
||||||
|
asm
|
||||||
|
PUSH EAX
|
||||||
|
PUSH ECX
|
||||||
|
PUSH EDX
|
||||||
|
XOR ECX, ECX
|
||||||
|
db $0F
|
||||||
|
db $01
|
||||||
|
db $D0
|
||||||
|
OR EAX, 7
|
||||||
|
db $0F
|
||||||
|
db $01
|
||||||
|
db $D1
|
||||||
|
POP EDX
|
||||||
|
POP ECX
|
||||||
|
POP EAX
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure init();
|
procedure init();
|
||||||
begin
|
begin
|
||||||
terminal.registerCommand('CPU', @Terminal_Command_CPU, 'CPU Info.');
|
terminal.registerCommand('CPU', @Terminal_Command_CPU, 'CPU Info.');
|
||||||
@@ -300,6 +322,7 @@ begin
|
|||||||
getCPUCapabilities;
|
getCPUCapabilities;
|
||||||
getCPUClockSpeed;
|
getCPUClockSpeed;
|
||||||
enableSSE;
|
enableSSE;
|
||||||
|
enableAVX;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
+380
-287
File diff suppressed because it is too large.
Load diff
@@ -1,81 +0,0 @@
|
|||||||
{
|
|
||||||
Driver->Storage->MBR Master boot record
|
|
||||||
|
|
||||||
@author(Aaron Hance [email protected])
|
|
||||||
}
|
|
||||||
unit mbr;
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
uses
|
|
||||||
tracer;
|
|
||||||
|
|
||||||
type
|
|
||||||
|
|
||||||
PMaster_Boot_Record = ^TMaster_Boot_Record;
|
|
||||||
PPartition_table = ^TPartition_table;
|
|
||||||
|
|
||||||
TPartition_table = bitpacked record
|
|
||||||
attributes : uint8;
|
|
||||||
CHS_start : array[0..2] of uint8;
|
|
||||||
system_id : uint8;
|
|
||||||
CHS_end : array[0..2] of uint8;
|
|
||||||
LBA_start : uInt32;
|
|
||||||
sector_count : uInt32;
|
|
||||||
end;
|
|
||||||
|
|
||||||
TMaster_Boot_Record = bitpacked record
|
|
||||||
bootstrap : array[0..439] of uint8;
|
|
||||||
signature : uint32;
|
|
||||||
rsv : uint16;
|
|
||||||
partition : array[0..3] of TPartition_table;
|
|
||||||
boot_sector : uint16;
|
|
||||||
end;
|
|
||||||
|
|
||||||
T24bit = array[0..2] of uint8;
|
|
||||||
|
|
||||||
function get_bootable(partition_table : PPartition_table) : boolean;
|
|
||||||
procedure set_bootable(partition_table : PPartition_table);
|
|
||||||
procedure setup_partition(partition_table : PPartition_table; address : uint32; sectorSize : uint32);
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
{ convert LBA address to CHS address}
|
|
||||||
function LBA_2_CHS(lba : uint32) : T24bit;
|
|
||||||
var
|
|
||||||
dat : T24bit;
|
|
||||||
begin
|
|
||||||
//TODO impliment procedure
|
|
||||||
LBA_2_CHS := dat;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ Set a partition struct to be bootable}
|
|
||||||
procedure set_bootable(partition_table : PPartition_table);
|
|
||||||
begin
|
|
||||||
push_trace('MBR.set_bootable');
|
|
||||||
//set the bootble bit in attributes
|
|
||||||
partition_table^.attributes := (partition_table^.attributes and $80);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ Check a partitions bootable bit }
|
|
||||||
function get_bootable(partition_table : PPartition_table) : boolean;
|
|
||||||
begin
|
|
||||||
push_trace('MBR.get_bootable');
|
|
||||||
//get the bootble bit in attributes
|
|
||||||
get_bootable := (partition_table^.attributes and $80) = $80;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ Setup a partition table struct }
|
|
||||||
procedure setup_partition(partition_table : PPartition_table; address : uint32; sectorSize : uint32);
|
|
||||||
begin
|
|
||||||
push_trace('MBR.setup_partition');
|
|
||||||
//set values in both LBA and CHS addressing schemes
|
|
||||||
partition_table^.LBA_start := address;
|
|
||||||
partition_table^.sector_count := sectorSize;
|
|
||||||
partition_table^.CHS_start := LBA_2_CHS(address);
|
|
||||||
partition_table^.CHS_start := LBA_2_CHS(address + sectorSize);
|
|
||||||
push_trace('MBR.setup_partition.end');
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
end.
|
|
||||||
File diff suppressed because it is too large.
Load diff
Whitespace-only changes.
File diff suppressed because it is too large.
Load diff
@@ -10,16 +10,14 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
console,
|
console,
|
||||||
util,
|
storagemanagement,
|
||||||
terminal,
|
util, terminal,
|
||||||
lmemorymanager,
|
lmemorymanager,
|
||||||
strings,
|
strings,
|
||||||
lists,
|
lists,
|
||||||
tracer,
|
tracer,
|
||||||
serial,
|
serial,
|
||||||
rtc,
|
rtc;
|
||||||
volumemanager,
|
|
||||||
storagetypes;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@@ -91,7 +89,7 @@ var
|
|||||||
filesystem : TFilesystem;
|
filesystem : TFilesystem;
|
||||||
|
|
||||||
procedure init;
|
procedure init;
|
||||||
procedure create_volume(volume : PStorage_Volume; sectors : uint32; start : uint32; config : puint32);
|
procedure create_volume(disk : PStorage_Device; sectors : uint32; start : uint32; config : puint32);
|
||||||
procedure detect_volumes(disk : PStorage_Device);
|
procedure detect_volumes(disk : PStorage_Device);
|
||||||
//function writeDirectory(volume : PStorage_volume; directory : pchar; attributes : uint32) : uint8; // need to handle parent table cluster overflow, need to take attributes
|
//function writeDirectory(volume : PStorage_volume; directory : pchar; attributes : uint32) : uint8; // need to handle parent table cluster overflow, need to take attributes
|
||||||
//function readDirectory(volume : PStorage_volume; directory : pchar; listPtr : PLinkedListBase) : uint8; //returns: 0 = success, 1 = dir not exsist, 2 = not directory, 3 = error
|
//function readDirectory(volume : PStorage_volume; directory : pchar; listPtr : PLinkedListBase) : uint8; //returns: 0 = success, 1 = dir not exsist, 2 = not directory, 3 = error
|
||||||
@@ -753,7 +751,7 @@ end;
|
|||||||
|
|
||||||
//TODO check directory commands for errors with a clean disk
|
//TODO check directory commands for errors with a clean disk
|
||||||
|
|
||||||
procedure create_volume(volume : PStorage_Volume; sectors : uint32; start : uint32; config : puint32);
|
procedure create_volume(disk : PStorage_Device; sectors : uint32; start : uint32; config : puint32);
|
||||||
var
|
var
|
||||||
buffer : puint32;
|
buffer : puint32;
|
||||||
bt: puint32;
|
bt: puint32;
|
||||||
@@ -774,18 +772,9 @@ var
|
|||||||
programFileArray : byteArray8 = ('P','R','O','G','R','A','M','S');
|
programFileArray : byteArray8 = ('P','R','O','G','R','A','M','S');
|
||||||
rootCluster : uint32 = 1;
|
rootCluster : uint32 = 1;
|
||||||
|
|
||||||
sysArray : byteArray8 = ('S','Y','S','T','E','M',' ',' ');
|
|
||||||
progArray : byteArray8 = ('P','R','O','G','R','A','M','S');
|
|
||||||
userArray : byteArray8 = ('U','S','E','R',' ',' ',' ',' ');
|
|
||||||
|
|
||||||
status : puint32;
|
|
||||||
disk : PStorage_device;
|
|
||||||
|
|
||||||
begin //maybe increase buffer size by one?
|
begin //maybe increase buffer size by one?
|
||||||
push_trace('fat32.create_volume()');
|
push_trace('fat32.create_volume()');
|
||||||
|
|
||||||
disk := volume^.device;
|
|
||||||
|
|
||||||
// zeroBuffer:= puint32(kalloc( disk^.sectorSize * 4 ));
|
// zeroBuffer:= puint32(kalloc( disk^.sectorSize * 4 ));
|
||||||
// memset(uint32(zeroBuffer), 0, disk^.sectorSize * 4);
|
// memset(uint32(zeroBuffer), 0, disk^.sectorSize * 4);
|
||||||
|
|
||||||
@@ -822,7 +811,7 @@ begin //maybe increase buffer size by one?
|
|||||||
bootRecord^.jmp2boot := $0; //TODO impliment boot jump
|
bootRecord^.jmp2boot := $0; //TODO impliment boot jump
|
||||||
bootRecord^.OEMName := asuroArray;
|
bootRecord^.OEMName := asuroArray;
|
||||||
bootRecord^.sectorSize := disk^.sectorsize;
|
bootRecord^.sectorSize := disk^.sectorsize;
|
||||||
bootRecord^.spc := 1;
|
bootRecord^.spc := config^;
|
||||||
bootRecord^.rsvSectors := 32; //32 is standard
|
bootRecord^.rsvSectors := 32; //32 is standard
|
||||||
bootRecord^.numFats := 1;
|
bootRecord^.numFats := 1;
|
||||||
bootRecord^.mediaDescp := $F8;
|
bootRecord^.mediaDescp := $F8;
|
||||||
@@ -884,16 +873,8 @@ begin //maybe increase buffer size by one?
|
|||||||
|
|
||||||
disk^.writecallback(disk, dataStart + (config^ * rootCluster), 1, buffer);
|
disk^.writecallback(disk, dataStart + (config^ * rootCluster), 1, buffer);
|
||||||
|
|
||||||
memset(uint32(buffer), 0, disk^.sectorsize);
|
|
||||||
|
|
||||||
status := puint32(kalloc(sizeof(uint32)));
|
|
||||||
writeDirectory(volume, '', sysArray, $10, status, '');
|
|
||||||
|
|
||||||
|
|
||||||
kfree(buffer);
|
kfree(buffer);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure detect_volumes(disk : PStorage_Device);
|
procedure detect_volumes(disk : PStorage_Device);
|
||||||
@@ -922,11 +903,11 @@ begin
|
|||||||
if (puint32(buffer)[127] = $55AA) and (PBootRecord(buffer)^.bsignature = $29) then begin //TODO partition table
|
if (puint32(buffer)[127] = $55AA) and (PBootRecord(buffer)^.bsignature = $29) then begin //TODO partition table
|
||||||
console.writestringln('FAT32: volume found!');
|
console.writestringln('FAT32: volume found!');
|
||||||
volume^.device:= disk;
|
volume^.device:= disk;
|
||||||
volume^.sectorStart:= 1; //THIS MAKE SURE IF NOT FUCKY, cos im getting info from 2
|
volume^.sectorStart:= 1;
|
||||||
volume^.sectorSize:= PBootRecord(buffer)^.sectorSize;
|
volume^.sectorSize:= PBootRecord(buffer)^.sectorSize;
|
||||||
volume^.freeSectors:= 1000000; //TODO implement get free sectors need FSINFO implemented first
|
volume^.freeSectors:= 1000000; //TODO implement get free sectors need FSINFO implemented first
|
||||||
volume^.filesystem := @filesystem;
|
volume^.filesystem := @filesystem;
|
||||||
// storagemanagement.register_volume(disk, volume); TODO repalce with new thing
|
storagemanagement.register_volume(disk, volume);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
kfree(buffer);
|
kfree(buffer);
|
||||||
@@ -936,7 +917,6 @@ procedure init();
|
|||||||
begin
|
begin
|
||||||
push_trace('fat32.init()');
|
push_trace('fat32.init()');
|
||||||
filesystem.sName:= 'FAT32';
|
filesystem.sName:= 'FAT32';
|
||||||
filesystem.system_id:= $01;
|
|
||||||
filesystem.readDirCallback:= @readDirectoryGen;
|
filesystem.readDirCallback:= @readDirectoryGen;
|
||||||
filesystem.createDirCallback:= @writeDirectoryGen;
|
filesystem.createDirCallback:= @writeDirectoryGen;
|
||||||
filesystem.createcallback:= @create_volume;
|
filesystem.createcallback:= @create_volume;
|
||||||
@@ -944,7 +924,7 @@ begin
|
|||||||
filesystem.writecallback:= @writeFile;
|
filesystem.writecallback:= @writeFile;
|
||||||
filesystem.readcallback := @readFile;
|
filesystem.readcallback := @readFile;
|
||||||
|
|
||||||
volumemanager.register_filesystem(@filesystem);
|
storagemanagement.register_filesystem(@filesystem);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,140 +0,0 @@
|
|||||||
// Copyright 2021 Aaron Hance
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
{
|
|
||||||
Driver->Storage->IDE->idetypes - IDE device types and constants.
|
|
||||||
|
|
||||||
@author(Aaron Hance <[email protected]>)
|
|
||||||
}
|
|
||||||
unit idetypes;
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
const
|
|
||||||
|
|
||||||
ATA_SR_BUSY = $80; //BUSY
|
|
||||||
ATA_SR_DRDY = $40; //DRIVE READY
|
|
||||||
ATA_SR_DF = $20; //DRIVE WRITE FAULT
|
|
||||||
ATA_SR_DSC = $10; //DRIVE SEEK COMPLETE
|
|
||||||
ATA_SR_DRQ = $08; //DATA REQUEST READY
|
|
||||||
ATA_SR_CORR = $04; //CORRECTED DATA
|
|
||||||
ATA_SR_IDX = $02; //INLEX
|
|
||||||
ATA_SR_ERR = $01; //ERROR
|
|
||||||
|
|
||||||
ATA_ER_BBK = $80; //BAD SECTOR
|
|
||||||
ATA_ER_UNC = $40; //UNCORRECTABLE DATA
|
|
||||||
ATA_ER_MC = $20; //NO MEDIA
|
|
||||||
ATA_ER_IDNF = $10; //ID MARK NOT FOUND
|
|
||||||
ATA_ER_MCR = $08; //NO MEDIA
|
|
||||||
ATA_ER_ABRT = $04; //COMMAND ABORTED
|
|
||||||
ATA_ER_TK0NF = $02; //TRACK 0 NOT FOUND
|
|
||||||
ATA_ER_AMNF = $01; //NO ADDRESS MARK
|
|
||||||
|
|
||||||
ATA_CMD_READ_PIO = $20;
|
|
||||||
ATA_CMD_READ_PIO_EXT = $24;
|
|
||||||
ATA_CMD_READ_DMA = $C8;
|
|
||||||
ATA_CMD_READ_DMA_EXT = $25;
|
|
||||||
ATA_CMD_WRITE_PIO = $30;
|
|
||||||
ATA_CMD_WRITE_PIO_EXT = $34;
|
|
||||||
ATA_CMD_WRITE_DMA = $CA;
|
|
||||||
ATA_CMD_WRITE_DMA_EXT = $35;
|
|
||||||
ATA_CMD_CACHE_FLUSH = $E7;
|
|
||||||
ATA_CMD_CACHE_FLUSH_EXT = $EA;
|
|
||||||
ATA_CMD_PACKET = $A0;
|
|
||||||
ATA_CMD_IDENTIFY_PACKET = $A1;
|
|
||||||
ATA_CMD_IDENTIFY = $EC;
|
|
||||||
|
|
||||||
ATAPI_CMD_READ = $A8;
|
|
||||||
ATAPI_CMD_EJECT = $1B;
|
|
||||||
|
|
||||||
ATA_IDENT_DEVICETYPE = $0;
|
|
||||||
ATA_IDENT_CYLINDERS = $2;
|
|
||||||
ATA_IDENT_HEADS = $6;
|
|
||||||
ATA_IDENT_SECOTRS = $12;
|
|
||||||
ATA_IDENT_SERIAL = $20;
|
|
||||||
ATA_IDENT_MODEL = $54;
|
|
||||||
ATA_IDENT_CAPABILITIES = $98;
|
|
||||||
ATA_IDENT_FIELDVALID = $106;
|
|
||||||
ATA_IDENT_MAX_LBA = $120;
|
|
||||||
ATA_IDENT_COMMANDSETS = $164;
|
|
||||||
ATA_IDENT_MAX_LBA_EXT = $200;
|
|
||||||
|
|
||||||
ATA_REG_DATA = $00;
|
|
||||||
ATA_REG_ERROR = $01;
|
|
||||||
ATA_REG_FEATURES = $01;
|
|
||||||
ATA_REG_SECCOUNT = $02;
|
|
||||||
ATA_REG_LBA0 = $03;
|
|
||||||
ATA_REG_LBA1 = $04;
|
|
||||||
ATA_REG_LBA2 = $05;
|
|
||||||
ATA_REG_HDDEVSEL = $06;
|
|
||||||
ATA_REG_COMMAND = $07;
|
|
||||||
ATA_REG_STATUS = $07;
|
|
||||||
ATA_REG_SECCOUNT1 = $08;
|
|
||||||
ATA_REG_LBA3 = $09;
|
|
||||||
ATA_REG_LBA4 = $0A;
|
|
||||||
ATA_REG_LBA5 = $0B;
|
|
||||||
ATA_REG_CONTROL = $0C;
|
|
||||||
ATA_REG_ALTSTATUS = $0C;
|
|
||||||
ATA_REG_DEVADDRESS = $0D;
|
|
||||||
|
|
||||||
ATA_DEVICE_MASTER = $A0;
|
|
||||||
ATA_DEVICE_SLAVE = $B0;
|
|
||||||
|
|
||||||
ATA_PRIMARY_BASE = $1F0;
|
|
||||||
ATA_PRIMARY_BASE1 = $3F6;
|
|
||||||
ATA_SECONDARY_BASE = $170; //todo check this
|
|
||||||
ATA_SECONDARY_BASE1 = $376; //todo check this
|
|
||||||
|
|
||||||
ATA_INTERRUPT_PRIMARY = $3F6;
|
|
||||||
ATA_INTERRUPT_SECONDARY = $376;
|
|
||||||
|
|
||||||
type
|
|
||||||
TPortMode = (P_READ, P_WRITE);
|
|
||||||
|
|
||||||
TIdentResponse = array[0..255] of uint16;
|
|
||||||
PIdentResponse = ^TIdentResponse;
|
|
||||||
|
|
||||||
TIDE_Channel_Registers = record
|
|
||||||
base : uint16;
|
|
||||||
ctrl : uint16;
|
|
||||||
bmide : uint16;
|
|
||||||
noInter : uint8
|
|
||||||
end;
|
|
||||||
|
|
||||||
TIDE_Status = bitpacked record
|
|
||||||
Busy : Boolean;
|
|
||||||
Ready : Boolean;
|
|
||||||
Fault : Boolean;
|
|
||||||
Seek : Boolean;
|
|
||||||
DRQ : Boolean;
|
|
||||||
CORR : Boolean;
|
|
||||||
IDDEX : Boolean;
|
|
||||||
ERROR : Boolean;
|
|
||||||
end;
|
|
||||||
PIDE_Status = ^TIDE_Status;
|
|
||||||
|
|
||||||
TIDE_Device = record
|
|
||||||
exists : boolean;
|
|
||||||
isPrimary : boolean;
|
|
||||||
isMaster : boolean;
|
|
||||||
isATAPI : boolean;
|
|
||||||
status : TIDE_Status;
|
|
||||||
base : uint16;
|
|
||||||
info : PIdentResponse;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
end.
|
|
||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,64 +0,0 @@
|
|||||||
// Copyright 2021 Aaron Hance
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
{
|
|
||||||
Driver->Storage->Include->storagetypes - Structs & Data Shared Across Storage Drivers.
|
|
||||||
|
|
||||||
@author(Aaron Hance <[email protected]>)
|
|
||||||
}
|
|
||||||
unit storagetypes;
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
uses
|
|
||||||
lists;
|
|
||||||
|
|
||||||
type
|
|
||||||
|
|
||||||
TControllerType = (ControllerATA, ControllerATAPI, ControllerUSB, ControllerAHCI,
|
|
||||||
ControllerNET, ControllerRAM, rsvctr1, rsvctr2, rsvctr3);
|
|
||||||
|
|
||||||
PStorage_device = ^TStorage_Device;
|
|
||||||
PDrive_Error = ^TDrive_Error;
|
|
||||||
|
|
||||||
PPHIOHook = procedure(drive : PStorage_device; addr : uint32; sectors : uint32; buffer : puint32);
|
|
||||||
PPHIOHook_ = procedure;
|
|
||||||
|
|
||||||
byteArray8 = array[0..7] of char;
|
|
||||||
PByteArray8 = ^byteArray8;
|
|
||||||
|
|
||||||
{ Generic storage device }
|
|
||||||
TStorage_Device = record
|
|
||||||
id : uint8;
|
|
||||||
controller : TControllerType;
|
|
||||||
controllerId0 : uint32;
|
|
||||||
writable : boolean;
|
|
||||||
volumes : PLinkedListBase;
|
|
||||||
writeCallback : PPHIOHook;
|
|
||||||
readCallback : PPHIOHook;
|
|
||||||
maxSectorCount : uint32;
|
|
||||||
sectorSize : uint32;
|
|
||||||
end;
|
|
||||||
|
|
||||||
TDrive_Error = record
|
|
||||||
code : uint16;
|
|
||||||
description : pchar;
|
|
||||||
recoverable : boolean;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
|
|
||||||
end.
|
|
||||||
Loaded 20 of 36 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user