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
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@ RUN apt-get update && apt-get install -y \
|
||||
apt-get clean my room
|
||||
|
||||
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 - && \
|
||||
pushd fpc-$FPC_VERSION.i386-linux && ./install.sh && popd && \
|
||||
rm -rf fpc-$FPC_VERSION.i386-linux
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ echo "======================="
|
||||
echo " "
|
||||
echo "Compiling FPC Sources..."
|
||||
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
|
||||
@@ -34,4 +34,14 @@ SECTIONS
|
||||
}
|
||||
end = .; _end = .; __end = .;
|
||||
kernel_end = .;
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.init_array*)
|
||||
*(.fini_array*)
|
||||
*(.ctors)
|
||||
*(.dtors)
|
||||
*(.eh_frame*)
|
||||
*(.gcc_except_table*)
|
||||
*(.note.GNU-stack)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,16 +58,19 @@ begin
|
||||
end;
|
||||
|
||||
function sinb(port : uint16) : uint8;
|
||||
var
|
||||
tmp : uint8;
|
||||
begin
|
||||
asm
|
||||
PUSH EAX
|
||||
PUSH EDX
|
||||
MOV DX, port
|
||||
IN AL, DX
|
||||
MOV sinb, AL
|
||||
MOV tmp, AL
|
||||
POP EDX
|
||||
POP EAX
|
||||
end;
|
||||
sinb := tmp;
|
||||
io_wait;
|
||||
end;
|
||||
|
||||
|
||||
+348
-1
File diff suppressed because it is too large
Load Diff
+16
-4
@@ -130,10 +130,13 @@ begin
|
||||
end;
|
||||
|
||||
function getESP : uint32;
|
||||
var
|
||||
tmp: uint32;
|
||||
begin
|
||||
asm
|
||||
MOV getESP, ESP
|
||||
MOV tmp, ESP
|
||||
end;
|
||||
getESP := tmp;
|
||||
end;
|
||||
|
||||
function HexCharToDecimal(hex : char) : uint8;
|
||||
@@ -362,6 +365,8 @@ begin
|
||||
end;
|
||||
|
||||
function inl(port : uint16) : uint32; [public, alias: 'util_inl'];
|
||||
var
|
||||
tmp : uint32;
|
||||
begin
|
||||
//serial.sendString('[inl]');
|
||||
//serial.sendHex(port);
|
||||
@@ -370,14 +375,17 @@ begin
|
||||
PUSH EDX
|
||||
MOV DX, port
|
||||
IN EAX, DX
|
||||
MOV inl, EAX
|
||||
MOV tmp, EAX
|
||||
POP EDX
|
||||
POP EAX
|
||||
end;
|
||||
inl := tmp;
|
||||
io_wait;
|
||||
end;
|
||||
|
||||
function inw(port : uint16) : uint16; [public, alias: 'util_inw'];
|
||||
var
|
||||
tmp : uint16;
|
||||
begin
|
||||
//serial.sendString('[inw]');
|
||||
//serial.sendHex(port);
|
||||
@@ -386,14 +394,17 @@ begin
|
||||
PUSH EDX
|
||||
MOV DX, port
|
||||
IN AX, DX
|
||||
MOV inw, AX
|
||||
MOV tmp, AX
|
||||
POP EDX
|
||||
POP EAX
|
||||
end;
|
||||
inw := tmp;
|
||||
io_wait;
|
||||
end;
|
||||
|
||||
function inb(port : uint16) : uint8; [public, alias: 'util_inb'];
|
||||
var
|
||||
tmp : uint8;
|
||||
begin
|
||||
//serial.sendString('[inb]');
|
||||
//serial.sendHex(port);
|
||||
@@ -402,10 +413,11 @@ begin
|
||||
PUSH EDX
|
||||
MOV DX, port
|
||||
IN AL, DX
|
||||
MOV inb, AL
|
||||
MOV tmp, AL
|
||||
POP EDX
|
||||
POP EAX
|
||||
end;
|
||||
inb := tmp;
|
||||
io_wait;
|
||||
end;
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ begin
|
||||
klalloc:= Address;
|
||||
end;
|
||||
|
||||
function kalloc(size : uint32) : void;
|
||||
function kalloc(size : uint32) : void; [public, alias: 'kernel_kalloc'];
|
||||
var
|
||||
Heap_Entries : uint32;
|
||||
i, j : uint32;
|
||||
@@ -217,7 +217,7 @@ begin
|
||||
//pop_trace;
|
||||
end;
|
||||
|
||||
procedure kfree(area : void);
|
||||
procedure kfree(area : void); [public, alias: 'kernel_kfree'];
|
||||
var
|
||||
hp : PHeapPage;
|
||||
entry : uint32;
|
||||
|
||||
Reference in New Issue
Block a user