Compare commits

...
3 Commits
Author SHA1 Message Date
admin 924305a1ab Merge pull request 'Migration from FPC 2.6.4 to FPC 3.2.2' (#9) from feature/fpc-3.2.2 into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #9
2026-02-26 12:51:09 +00:00
t3hn3rd 4ef61b0d3b Drone failing due to webhook stage
- Added ignore failure to discord webhook stage.
2026-02-26 12:23:42 +00:00
t3hn3rd 2b071a58c7 feature: Upgrade FPC from 2.6.4 to 3.2.2
continuous-integration/drone Build was killed
Migrate the build toolchain from Free Pascal Compiler 2.6.4 to 3.2.2.
FPC 3.2.2 requires a significantly expanded custom system unit and
several syntactic adjustments across the codebase.

Dockerfile:
- Bump FPC_VERSION from 2.6.4 to 3.2.2

compile_sources.sh:
- Replace obsolete -Op3 flag with -OpPENTIUM3

linker.script:
- Add /DISCARD/ section for .init_array, .fini_array, .ctors, .dtors,
  .eh_frame, .gcc_except_table, and .note.GNU-stack sections emitted
  by FPC 3.2.2

system.pas:
- Fix hresult to 'type longint' (was cardinal, incompatible with 3.2.2)
- Add required types: SizeInt, SizeUInt, PtrInt, PtrUInt, NativeInt,
  NativeUInt, CodePointer, TTypeKind, jmp_buf, TExceptAddr, TGuid,
  FileRec, TextRec
- Add required globals: ExceptAddrStack, ExitCode, ErrorAddr, ErrorCode,
  ExitProc, StackBottom, StackLength, RandSeed
- Implement compilerprocs: fpc_initializeunits, fpc_do_exit,
  fpc_handleerror, fpc_rangeerror, fpc_overflow, fpc_divbyzero,
  fpc_objecterror, fpc_abstracterror, fpc_stackcheck, fpc_iocheck,
  fpc_pushexceptaddr, fpc_popaddrstack, fpc_setjmp (asm),
  fpc_longjmp (asm), fpc_shortstr_assign, fpc_mul_int64 (asm),
  fpc_getmem, fpc_freemem, fpc_reraise, fpc_raiseexception,
  fpc_catches, fpc_doneexception
- Add move() procedure with FPC_MOVE alias

util.pas, serial.pas:
- Fix inline asm functions (getESP, inl, inw, inb, sinb) to use temp
  variables instead of function-name result — FPC 3.2.2 no longer
  allows 'MOV funcname, reg' syntax in inline asm blocks

lmemorymanager.pas:
- Export kalloc/kfree with public aliases (kernel_kalloc, kernel_kfree)
  so system.pas fpc_getmem/fpc_freemem can link to them
2026-02-26 00:01:40 +00:00
8 changed files with 383 additions and 10 deletions

No files matched your search

+1
View File
@@ -53,6 +53,7 @@ steps:
- name: msg status - name: msg status
image: appleboy/drone-discord image: appleboy/drone-discord
failure: ignore
depends_on: depends_on:
- compile - compile
when: when:
+1 -1
View File
@@ -9,7 +9,7 @@ RUN apt-get update && apt-get install -y \
apt-get clean my room apt-get clean my room
SHELL ["/bin/bash", "-c"] SHELL ["/bin/bash", "-c"]
ARG FPC_VERSION=2.6.4 ARG FPC_VERSION=3.2.2
RUN curl -sL https://sourceforge.net/projects/freepascal/files/Linux/$FPC_VERSION/fpc-$FPC_VERSION.i386-linux.tar/download | tar -xf - && \ RUN curl -sL https://sourceforge.net/projects/freepascal/files/Linux/$FPC_VERSION/fpc-$FPC_VERSION.i386-linux.tar/download | tar -xf - && \
pushd fpc-$FPC_VERSION.i386-linux && ./install.sh && popd && \ pushd fpc-$FPC_VERSION.i386-linux && ./install.sh && popd && \
rm -rf fpc-$FPC_VERSION.i386-linux rm -rf fpc-$FPC_VERSION.i386-linux
+1 -1
View File
@@ -4,4 +4,4 @@ echo "======================="
echo " " echo " "
echo "Compiling FPC Sources..." echo "Compiling FPC Sources..."
echo " " echo " "
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 fpc -Aelf -gw -g -gl -n -vlewn -O3 -OpPENTIUM3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ -Fusrc/* -Fusrc/driver/* -Fusrc/driver/net/* src/kernel.pas
+10
View File
@@ -34,4 +34,14 @@ SECTIONS
} }
end = .; _end = .; __end = .; end = .; _end = .; __end = .;
kernel_end = .; kernel_end = .;
/DISCARD/ : {
*(.init_array*)
*(.fini_array*)
*(.ctors)
*(.dtors)
*(.eh_frame*)
*(.gcc_except_table*)
*(.note.GNU-stack)
}
} }
+4 -1
View File
@@ -58,16 +58,19 @@ begin
end; end;
function sinb(port : uint16) : uint8; function sinb(port : uint16) : uint8;
var
tmp : uint8;
begin begin
asm asm
PUSH EAX PUSH EAX
PUSH EDX PUSH EDX
MOV DX, port MOV DX, port
IN AL, DX IN AL, DX
MOV sinb, AL MOV tmp, AL
POP EDX POP EDX
POP EAX POP EAX
end; end;
sinb := tmp;
io_wait; io_wait;
end; end;
+348 -1
View File
File diff suppressed because it is too large. Load diff
+16 -4
View File
@@ -130,10 +130,13 @@ begin
end; end;
function getESP : uint32; function getESP : uint32;
var
tmp: uint32;
begin begin
asm asm
MOV getESP, ESP MOV tmp, ESP
end; end;
getESP := tmp;
end; end;
function HexCharToDecimal(hex : char) : uint8; function HexCharToDecimal(hex : char) : uint8;
@@ -362,6 +365,8 @@ begin
end; end;
function inl(port : uint16) : uint32; [public, alias: 'util_inl']; function inl(port : uint16) : uint32; [public, alias: 'util_inl'];
var
tmp : uint32;
begin begin
//serial.sendString('[inl]'); //serial.sendString('[inl]');
//serial.sendHex(port); //serial.sendHex(port);
@@ -370,14 +375,17 @@ begin
PUSH EDX PUSH EDX
MOV DX, port MOV DX, port
IN EAX, DX IN EAX, DX
MOV inl, EAX MOV tmp, EAX
POP EDX POP EDX
POP EAX POP EAX
end; end;
inl := tmp;
io_wait; io_wait;
end; end;
function inw(port : uint16) : uint16; [public, alias: 'util_inw']; function inw(port : uint16) : uint16; [public, alias: 'util_inw'];
var
tmp : uint16;
begin begin
//serial.sendString('[inw]'); //serial.sendString('[inw]');
//serial.sendHex(port); //serial.sendHex(port);
@@ -386,14 +394,17 @@ begin
PUSH EDX PUSH EDX
MOV DX, port MOV DX, port
IN AX, DX IN AX, DX
MOV inw, AX MOV tmp, AX
POP EDX POP EDX
POP EAX POP EAX
end; end;
inw := tmp;
io_wait; io_wait;
end; end;
function inb(port : uint16) : uint8; [public, alias: 'util_inb']; function inb(port : uint16) : uint8; [public, alias: 'util_inb'];
var
tmp : uint8;
begin begin
//serial.sendString('[inb]'); //serial.sendString('[inb]');
//serial.sendHex(port); //serial.sendHex(port);
@@ -402,10 +413,11 @@ begin
PUSH EDX PUSH EDX
MOV DX, port MOV DX, port
IN AL, DX IN AL, DX
MOV inb, AL MOV tmp, AL
POP EDX POP EDX
POP EAX POP EAX
end; end;
inb := tmp;
io_wait; io_wait;
end; end;
+2 -2
View File
@@ -170,7 +170,7 @@ begin
klalloc:= Address; klalloc:= Address;
end; end;
function kalloc(size : uint32) : void; function kalloc(size : uint32) : void; [public, alias: 'kernel_kalloc'];
var var
Heap_Entries : uint32; Heap_Entries : uint32;
i, j : uint32; i, j : uint32;
@@ -217,7 +217,7 @@ begin
//pop_trace; //pop_trace;
end; end;
procedure kfree(area : void); procedure kfree(area : void); [public, alias: 'kernel_kfree'];
var var
hp : PHeapPage; hp : PHeapPage;
entry : uint32; entry : uint32;