Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aac376fa22 | ||
|
|
51a29244ed |
+4
-1
@@ -5,9 +5,12 @@ VOLUME ["/code"]
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN dpkg --add-architecture i386
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl dos2unix wget git make nasm binutils:i386 xorriso grub-pc-bin && \
|
||||
curl dos2unix wget git make nasm binutils xorriso grub-pc-bin \
|
||||
gcc-multilib g++-multilib && \
|
||||
apt-get clean my room
|
||||
|
||||
RUN git clone --depth=1 --recurse-submodules https://github.com/cimgui/cimgui.git /cimgui
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
ARG FPC_VERSION=2.6.4
|
||||
RUN curl -sL https://sourceforge.net/projects/freepascal/files/Linux/$FPC_VERSION/fpc-$FPC_VERSION.i386-linux.tar/download | tar -xf - && \
|
||||
|
||||
@@ -23,6 +23,7 @@ runOrFail() {
|
||||
declare -a run_steps=(
|
||||
"compile_stub.sh" "Failed to compile stub!"
|
||||
"compile_vergen.sh" "Versions failed to compile"
|
||||
"compile_imgui.sh" "Failed to compile ImGui!"
|
||||
"compile_sources.sh" "Failed to compile FPC Sources!"
|
||||
"compile_link.sh" "Failed linking!"
|
||||
"compile_isogen.sh" "Failed to create ISO!"
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env bash
|
||||
echo " "
|
||||
echo "======================="
|
||||
echo " "
|
||||
echo "Compiling ImGui (cimgui)..."
|
||||
echo " "
|
||||
|
||||
IMGUI_DIR=/cimgui
|
||||
IMGUI_SRC=$IMGUI_DIR/imgui
|
||||
BRIDGE_SRC=src/driver/video/imgui
|
||||
|
||||
# Flags shared by all C/C++ compilation units:
|
||||
# -m32 -> i386 target
|
||||
# -ffreestanding -> no implicit stdlib inclusion
|
||||
# -fno-builtin -> don't inline memcpy/memset/etc. so our stubs are used
|
||||
# -O2 -> optimise for speed
|
||||
# -ffunction-sections -fdata-sections -> allow --gc-sections in linker
|
||||
C_FLAGS="-m32 -ffreestanding -fno-builtin -O2 -ffunction-sections -fdata-sections"
|
||||
|
||||
# Extra flags for C++ translation units (cimgui/imgui sources):
|
||||
# -fno-exceptions -> no stack-unwinding machinery
|
||||
# -fno-rtti -> no typeinfo / dynamic_cast
|
||||
# -fno-use-cxa-atexit -> don't emit __cxa_atexit calls for static dtors
|
||||
# -fno-threadsafe-statics -> no guard-variable emission for local statics
|
||||
# NOTE: *not* -ffreestanding / -fno-builtin here — imgui includes <cmath> and
|
||||
# other hosted headers that refuse to compile in freestanding mode.
|
||||
# The object files are archived into a static lib and linked freestanding;
|
||||
# any hosted-stdlib calls (malloc/free/sin/cos/…) resolve to crtshim.c.
|
||||
CPP_FLAGS="-m32 -O2 -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti -fno-use-cxa-atexit -fno-threadsafe-statics -fno-stack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -DNDEBUG -DIMGUI_ENABLE_STB_TRUETYPE"
|
||||
|
||||
INCLUDE="-I$IMGUI_DIR -I$IMGUI_SRC"
|
||||
|
||||
echo "Compiling C runtime shim..."
|
||||
gcc $C_FLAGS $INCLUDE \
|
||||
-c $BRIDGE_SRC/crtshim.c \
|
||||
-o lib/imgui_crtshim.o || { echo "Failed: crtshim.c"; exit 1; }
|
||||
|
||||
echo "Compiling render bridge..."
|
||||
# imgbridge is compiled as C++ so it sees cimgui.h function declarations
|
||||
# (C++ mode is required; the .c extension is overridden with -x c++)
|
||||
g++ $CPP_FLAGS $INCLUDE \
|
||||
-x c++ \
|
||||
-DCIMGUI_DEFINE_ENUMS_AND_STRUCTS \
|
||||
-c $BRIDGE_SRC/imgbridge.c \
|
||||
-o lib/imgui_bridge.o || { echo "Failed: imgbridge.c"; exit 1; }
|
||||
|
||||
echo "Compiling cimgui wrapper..."
|
||||
g++ $CPP_FLAGS $INCLUDE \
|
||||
-c $IMGUI_DIR/cimgui.cpp \
|
||||
-o lib/imgui_cimgui.o || { echo "Failed: cimgui.cpp"; exit 1; }
|
||||
|
||||
echo "Compiling imgui core..."
|
||||
g++ $CPP_FLAGS $INCLUDE \
|
||||
-c $IMGUI_SRC/imgui.cpp \
|
||||
-o lib/imgui_core.o || { echo "Failed: imgui.cpp"; exit 1; }
|
||||
|
||||
echo "Compiling imgui draw..."
|
||||
g++ $CPP_FLAGS $INCLUDE \
|
||||
-c $IMGUI_SRC/imgui_draw.cpp \
|
||||
-o lib/imgui_draw.o || { echo "Failed: imgui_draw.cpp"; exit 1; }
|
||||
|
||||
echo "Compiling imgui tables..."
|
||||
g++ $CPP_FLAGS $INCLUDE \
|
||||
-c $IMGUI_SRC/imgui_tables.cpp \
|
||||
-o lib/imgui_tables.o || { echo "Failed: imgui_tables.cpp"; exit 1; }
|
||||
|
||||
echo "Compiling imgui widgets..."
|
||||
g++ $CPP_FLAGS $INCLUDE \
|
||||
-c $IMGUI_SRC/imgui_widgets.cpp \
|
||||
-o lib/imgui_widgets.o || { echo "Failed: imgui_widgets.cpp"; exit 1; }
|
||||
|
||||
echo "Compiling imgui demo..."
|
||||
g++ $CPP_FLAGS $INCLUDE \
|
||||
-c $IMGUI_SRC/imgui_demo.cpp \
|
||||
-o lib/imgui_demo.o || { echo "Failed: imgui_demo.cpp"; exit 1; }
|
||||
|
||||
echo "Archiving cimgui.a..."
|
||||
# NOTE: imgui_bridge.o and imgui_crtshim.o are NOT in the archive because
|
||||
# compile_link.sh already picks them up individually via find lib/ -name "*.o".
|
||||
# Including them here would cause duplicate symbol errors.
|
||||
ar rcs lib/cimgui.a \
|
||||
lib/imgui_cimgui.o \
|
||||
lib/imgui_core.o \
|
||||
lib/imgui_draw.o \
|
||||
lib/imgui_tables.o \
|
||||
lib/imgui_widgets.o \
|
||||
lib/imgui_demo.o || { echo "Failed: ar"; exit 1; }
|
||||
|
||||
echo "ImGui compiled successfully."
|
||||
exit 0
|
||||
+3
-1
@@ -14,4 +14,6 @@ done;
|
||||
objstring=lib/stub.o" "$objstring
|
||||
echo "Object Files: "$objstring
|
||||
echo " "
|
||||
ld -m elf_i386 -s --gc-sections -Tlinker.script -o bin/kernel.bin $objstring
|
||||
LIBGCC=$(gcc -m32 -print-libgcc-file-name)
|
||||
ld -m elf_i386 -s --gc-sections -Tlinker.script -o bin/kernel.bin $objstring \
|
||||
--start-group lib/cimgui.a $LIBGCC --end-group
|
||||
+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 -Op3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ -Fusrc/* -Fusrc/driver/* -Fusrc/driver/net/* -Fusrc/driver/video/* -Fusrc/driver/video/imgui/* src/kernel.pas
|
||||
@@ -0,0 +1,20 @@
|
||||
4023:CIMGUI_API float igGetWindowDpiScale(void);
|
||||
4081:CIMGUI_API const ImVec4_c* igGetStyleColorVec4(ImGuiCol idx);
|
||||
4082:CIMGUI_API ImVec2_c igGetCursorScreenPos(void);
|
||||
4084:CIMGUI_API ImVec2_c igGetContentRegionAvail(void);
|
||||
4085:CIMGUI_API ImVec2_c igGetCursorPos(void);
|
||||
4086:CIMGUI_API float igGetCursorPosX(void);
|
||||
4087:CIMGUI_API float igGetCursorPosY(void);
|
||||
4091:CIMGUI_API ImVec2_c igGetCursorStartPos(void);
|
||||
4350:CIMGUI_API void igBeginDisabled(bool disabled);
|
||||
4372:CIMGUI_API ImVec2_c igGetItemRectMin(void);
|
||||
4373:CIMGUI_API ImVec2_c igGetItemRectMax(void);
|
||||
4374:CIMGUI_API ImVec2_c igGetItemRectSize(void);
|
||||
4377:CIMGUI_API ImDrawList* igGetBackgroundDrawList(ImGuiViewport* viewport);
|
||||
4378:CIMGUI_API ImDrawList* igGetForegroundDrawList_ViewportPtr(ImGuiViewport* viewport);
|
||||
4387:CIMGUI_API ImVec2_c igCalcTextSize(const char* text,const char* text_end,bool hide_text_after_double_hash,float wrap_width);
|
||||
4388:CIMGUI_API ImVec4_c igColorConvertU32ToFloat4(ImU32 in);
|
||||
4405:CIMGUI_API bool igIsMouseDoubleClicked_Nil(ImGuiMouseButton button);
|
||||
5092:CIMGUI_API ImDrawList* igGetForegroundDrawList_WindowPtr(ImGuiWindow* window);
|
||||
5161:CIMGUI_API void igBeginDisabledOverrideReenable(void);
|
||||
5244:CIMGUI_API bool igIsMouseDoubleClicked_ID(ImGuiMouseButton button,ImGuiID owner_id);
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -838,6 +838,18 @@ const
|
||||
MAX_WINDOWS = 255; //< Maximum number of Windows open.
|
||||
DefaultWND = 0; //< The Window assigned for output when no Window is specified. (Default).
|
||||
|
||||
type
|
||||
TWNDCaptureCallback = procedure(s: pchar);
|
||||
|
||||
var
|
||||
WND_CaptureActive : boolean = false;
|
||||
WND_CaptureHWND : uint32 = 0;
|
||||
WND_CaptureBuf : array[0..511] of char;
|
||||
WND_CaptureBufIdx : uint32 = 0;
|
||||
WND_CaptureCallback : TWNDCaptureCallback = nil;
|
||||
|
||||
procedure flushCapture;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@@ -2259,6 +2271,7 @@ var
|
||||
x,y: Byte;
|
||||
|
||||
begin
|
||||
if WND_CaptureActive and (WND = WND_CaptureHWND) then exit;
|
||||
if WindowManager.Windows[WND] <> nil then begin
|
||||
for y:=0 to Console_Properties.MAX_CELL_Y do begin
|
||||
for x:=0 to Console_Properties.MAX_CELL_X do begin
|
||||
@@ -2419,8 +2432,26 @@ begin
|
||||
console.writeintlnexWND(i, Console_Properties.Default_Attribute, WND);
|
||||
end;
|
||||
|
||||
procedure flushCapture;
|
||||
begin
|
||||
if WND_CaptureActive and (WND_CaptureCallback <> nil) and (WND_CaptureBufIdx > 0) then begin
|
||||
WND_CaptureBuf[WND_CaptureBufIdx] := #0;
|
||||
WND_CaptureCallback(@WND_CaptureBuf[0]);
|
||||
WND_CaptureBufIdx := 0;
|
||||
WND_CaptureBuf[0] := #0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure writecharexWND(character: char; attributes: uint32; WND : uint32);
|
||||
begin
|
||||
if WND_CaptureActive and (WND = WND_CaptureHWND) and (WND_CaptureCallback <> nil) then begin
|
||||
if WND_CaptureBufIdx < 511 then begin
|
||||
WND_CaptureBuf[WND_CaptureBufIdx] := character;
|
||||
inc(WND_CaptureBufIdx);
|
||||
WND_CaptureBuf[WND_CaptureBufIdx] := #0;
|
||||
end;
|
||||
exit;
|
||||
end;
|
||||
if WindowManager.Windows[WND] <> nil then begin
|
||||
WindowManager.Windows[WND]^.Buffer[WindowManager.Windows[WND]^.Cursor.Y][WindowManager.Windows[WND]^.Cursor.X].Character:= character;
|
||||
WindowManager.Windows[WND]^.Buffer[WindowManager.Windows[WND]^.Cursor.Y][WindowManager.Windows[WND]^.Cursor.X].Attributes:= attributes;
|
||||
@@ -2603,6 +2634,13 @@ end;
|
||||
|
||||
procedure backspaceWND(WND : uint32);
|
||||
begin
|
||||
if WND_CaptureActive and (WND = WND_CaptureHWND) then begin
|
||||
if WND_CaptureBufIdx > 0 then begin
|
||||
dec(WND_CaptureBufIdx);
|
||||
WND_CaptureBuf[WND_CaptureBufIdx] := #0;
|
||||
end;
|
||||
exit;
|
||||
end;
|
||||
if WindowManager.Windows[WND] <> nil then begin
|
||||
Dec(WindowManager.Windows[WND]^.Cursor.X);
|
||||
writecharWND(' ', WND);
|
||||
@@ -2659,6 +2697,13 @@ end;
|
||||
|
||||
procedure _safeincrement_y_WND(WND : uint32);
|
||||
begin
|
||||
if WND_CaptureActive and (WND = WND_CaptureHWND) and (WND_CaptureCallback <> nil) then begin
|
||||
WND_CaptureBuf[WND_CaptureBufIdx] := #0;
|
||||
WND_CaptureCallback(@WND_CaptureBuf[0]);
|
||||
WND_CaptureBufIdx := 0;
|
||||
WND_CaptureBuf[0] := #0;
|
||||
exit;
|
||||
end;
|
||||
if WindowManager.Windows[WND] <> nil then begin
|
||||
WindowManager.Windows[WND]^.Cursor.Y:= WindowManager.Windows[WND]^.Cursor.Y+1;
|
||||
if WindowManager.Windows[WND]^.Cursor.Y > WindowManager.Windows[WND]^.WND_H-1 then begin
|
||||
|
||||
+38
-33
@@ -49,8 +49,12 @@ type
|
||||
y : sint32;
|
||||
end;
|
||||
|
||||
{ Mouse hook callback: receives absolute position and button states }
|
||||
TMouseHook = procedure(x, y: sint32; lmb, rmb, mmb: boolean);
|
||||
|
||||
procedure init();
|
||||
procedure DrawCursor;
|
||||
procedure setHook(h: TMouseHook);
|
||||
|
||||
implementation
|
||||
|
||||
@@ -67,6 +71,7 @@ var
|
||||
LMouseDownPos : TMousePos;
|
||||
LMouseDown : Boolean;
|
||||
RMouseDown : Boolean;
|
||||
MouseHookCB : TMouseHook = nil;
|
||||
|
||||
procedure DrawCursor;
|
||||
var
|
||||
@@ -174,43 +179,38 @@ begin
|
||||
if Current.y > (Console.getConsoleProperties^.Height-8) then Current.y:= (Console.getConsoleProperties^.Height-8);
|
||||
end;
|
||||
Cycle:= 0;
|
||||
if Packet.LMB_Down then begin
|
||||
if not LMouseDown then begin
|
||||
LMouseDown:= true;
|
||||
LMouseDownPos.x:= Current.x;
|
||||
LMouseDownPos.y:= Current.y;
|
||||
//MouseDownEvent
|
||||
console._mouseDown();
|
||||
end;
|
||||
{ Track button transitions }
|
||||
if Packet.LMB_Down and (not LMouseDown) then begin
|
||||
LMouseDown:= true;
|
||||
LMouseDownPos.x:= Current.x;
|
||||
LMouseDownPos.y:= Current.y;
|
||||
end;
|
||||
if not Packet.LMB_Down then begin
|
||||
if LMouseDown then begin
|
||||
If (Current.x = LMouseDownPos.x) and (Current.y = LMouseDownPos.y) then begin
|
||||
Console._MouseClick(true);
|
||||
end;
|
||||
//MouseUpEvent
|
||||
Console._MouseUp();
|
||||
LMouseDown:= false;
|
||||
end;
|
||||
if (not Packet.LMB_Down) and LMouseDown then
|
||||
LMouseDown:= false;
|
||||
if Packet.RMB_Down and (not RMouseDown) then begin
|
||||
RMouseDown:= true;
|
||||
RMouseDownPos.x:= Current.x;
|
||||
RMouseDownPos.y:= Current.y;
|
||||
end;
|
||||
if Packet.RMB_Down then begin
|
||||
if not RMouseDown then begin
|
||||
RMouseDown:= true;
|
||||
RMouseDownPos.x:= Current.x;
|
||||
RMouseDownPos.y:= Current.y;
|
||||
end;
|
||||
end;
|
||||
|
||||
if not Packet.RMB_Down then begin
|
||||
if RMouseDown then begin
|
||||
if (Current.x = RMouseDownPos.x) and (Current.y = RMouseDownPos.y) then begin
|
||||
Console._MouseClick(false);
|
||||
end;
|
||||
end;
|
||||
if (not Packet.RMB_Down) and RMouseDown then
|
||||
RMouseDown:= false;
|
||||
|
||||
{ Dispatch to hook or console }
|
||||
if MouseHookCB <> nil then
|
||||
MouseHookCB(Current.x, Current.y, Packet.LMB_Down, Packet.RMB_Down, Packet.MMB_Down)
|
||||
else begin
|
||||
if Packet.LMB_Down and (not LMouseDown) then console._mouseDown();
|
||||
if (not Packet.LMB_Down) and LMouseDown then begin
|
||||
if (Current.x = LMouseDownPos.x) and (Current.y = LMouseDownPos.y) then
|
||||
Console._MouseClick(true);
|
||||
Console._MouseUp();
|
||||
end;
|
||||
if (not Packet.RMB_Down) and RMouseDown then begin
|
||||
if (Current.x = RMouseDownPos.x) and (Current.y = RMouseDownPos.y) then
|
||||
Console._MouseClick(false);
|
||||
end;
|
||||
console.setMousePosition(Current.x, Current.y);
|
||||
end;
|
||||
|
||||
console.setMousePosition(Current.x, Current.y);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@@ -242,6 +242,11 @@ begin
|
||||
pop_trace;
|
||||
end;
|
||||
|
||||
procedure setHook(h: TMouseHook);
|
||||
begin
|
||||
MouseHookCB := h;
|
||||
end;
|
||||
|
||||
procedure init();
|
||||
var
|
||||
devid : TDeviceIdentifier;
|
||||
|
||||
@@ -92,6 +92,7 @@ var
|
||||
Root : PVFSObject;
|
||||
CurrentDirectory : pchar = nil;
|
||||
PushPopDirectory : PLinkedListBase;
|
||||
MountDepth : uint32 = 0;
|
||||
|
||||
procedure init();
|
||||
Function OpenFile(Filename : pchar; OpenMode : TOpenMode; WriteMode : TWriteMode; Lock : Boolean; Error : PError) : TFileHandle;
|
||||
@@ -104,6 +105,7 @@ function GetDirectories(Handle : uint32; Path : pchar) : PHashMap;
|
||||
function PathValid(Path : pchar) : TIsPathValid;
|
||||
function changeDirectory(Path : pchar) : TIsPathValid;
|
||||
function getWorkingDirectory : pchar;
|
||||
function GetDirectoryListing(Path : pchar) : PHashMap;
|
||||
|
||||
//VFS Functions
|
||||
function newVirtualDirectory(Path : pchar) : TError;
|
||||
@@ -288,6 +290,7 @@ begin
|
||||
NewObj:= PVFSObject(hashmap.get(ht, item));
|
||||
if NewObj = nil then begin
|
||||
GetObjectFromPath:= nil;
|
||||
STRLL_Free(SplitPath);
|
||||
tracer.push_trace('vfs.GetObjectFromPath.shortexit_1');
|
||||
exit;
|
||||
end;
|
||||
@@ -304,6 +307,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
GetObjectFromPath:= Obj;
|
||||
STRLL_Free(SplitPath);
|
||||
tracer.push_trace('vfs.GetObjectFromPath.exit');
|
||||
end;
|
||||
|
||||
@@ -348,7 +352,17 @@ begin
|
||||
GetDirectoryListing:= nil;
|
||||
end;
|
||||
otMOUNT:begin
|
||||
GetDirectoryListing:= GetDirectoryListing(PVFSMount(Obj^.Reference)^.Path);
|
||||
{ Safety: cap mount-follow depth to prevent infinite recursion
|
||||
from circular mounts. Use a simple static counter. }
|
||||
if MountDepth < 16 then begin
|
||||
Inc(MountDepth);
|
||||
GetDirectoryListing:= GetDirectoryListing(PVFSMount(Obj^.Reference)^.Path);
|
||||
Dec(MountDepth);
|
||||
end else
|
||||
GetDirectoryListing:= nil;
|
||||
end;
|
||||
else begin
|
||||
GetDirectoryListing:= nil;
|
||||
end;
|
||||
end;
|
||||
end else begin
|
||||
@@ -420,7 +434,7 @@ begin
|
||||
|
||||
NewObj^.Reference:= void(NewDev);
|
||||
|
||||
hashmap.add(ht, stringCopy(DeviceName), void(NewDev));
|
||||
hashmap.add(ht, stringCopy(DeviceName), void(NewObj));
|
||||
end;
|
||||
|
||||
{ Filesystem Functions }
|
||||
|
||||
@@ -54,13 +54,8 @@ end;
|
||||
|
||||
procedure Flush(FrontBuffer : PVideoBuffer; BackBuffer : PVideoBuffer);
|
||||
var
|
||||
idx : uint32;
|
||||
Back,Front : uint32;
|
||||
BufferSize : uint32;
|
||||
|
||||
const
|
||||
//COPY_WIDTH = 64; //Use this for 64bit copies
|
||||
COPY_WIDTH = 128; //Use this for SSE copies
|
||||
Count64 : uint32;
|
||||
|
||||
begin
|
||||
//tracer.push_trace('doublebuffer.Flush.enter');
|
||||
@@ -68,11 +63,32 @@ begin
|
||||
if ((FrontBuffer^.Width > BackBuffer^.Width) or (FrontBuffer^.Height > BackBuffer^.Height)) then exit;
|
||||
Back:= BackBuffer^.Location;
|
||||
Front:= FrontBuffer^.Location;
|
||||
BufferSize:= ( ( BackBuffer^.Width * BackBuffer^.Height * BackBuffer^.BitsPerPixel) div COPY_WIDTH ) - 1;
|
||||
for idx:=0 to BufferSize do begin
|
||||
//Front[idx]:= Back[idx];
|
||||
// -- TODO: Get SSE working here for 128bit copies --
|
||||
__SSE_128_memcpy(Back + (idx * 16), Front + (idx * 16));
|
||||
{ Number of 64-byte blocks: total_bytes / 64 = (W * H * BPP/8) / 64 }
|
||||
Count64:= ( BackBuffer^.Width * BackBuffer^.Height * BackBuffer^.BitsPerPixel) div 512;
|
||||
if Count64 = 0 then exit;
|
||||
{ Bulk SSE copy: 4 x MOVAPS (64 bytes) per iteration.
|
||||
4x fewer loop iterations than the old per-16-byte function-call loop. }
|
||||
asm
|
||||
PUSH ESI
|
||||
PUSH EDI
|
||||
MOV ESI, Back
|
||||
MOV EDI, Front
|
||||
MOV ECX, Count64
|
||||
@sseloop:
|
||||
MOVAPS XMM0, [ESI]
|
||||
MOVAPS XMM1, [ESI + 16]
|
||||
MOVAPS XMM2, [ESI + 32]
|
||||
MOVAPS XMM3, [ESI + 48]
|
||||
MOVAPS [EDI], XMM0
|
||||
MOVAPS [EDI + 16], XMM1
|
||||
MOVAPS [EDI + 32], XMM2
|
||||
MOVAPS [EDI + 48], XMM3
|
||||
ADD ESI, 64
|
||||
ADD EDI, 64
|
||||
DEC ECX
|
||||
JNZ @sseloop
|
||||
POP EDI
|
||||
POP ESI
|
||||
end;
|
||||
//tracer.push_trace('doublebuffer.Flush.exit');
|
||||
end;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -40,6 +40,7 @@ function frontBufferBpp : uint8;
|
||||
function backBufferWidth : uint32;
|
||||
function backBufferHeight : uint32;
|
||||
function backBufferBpp : uint8;
|
||||
function backBufferLocation : uint32;
|
||||
|
||||
Procedure basicFDrawTexture(Buffer : PVideoBuffer; X : uint32; Y : uint32; Texture : PTexture);
|
||||
|
||||
@@ -315,4 +316,9 @@ begin
|
||||
backBufferBpp:= VideoInterface.BackBuffer.BitsPerPixel;
|
||||
end;
|
||||
|
||||
function backBufferLocation : uint32;
|
||||
begin
|
||||
backBufferLocation:= VideoInterface.BackBuffer.Location;
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -35,10 +35,26 @@ implementation
|
||||
procedure Main();
|
||||
var
|
||||
i : integer;
|
||||
faulting_addr : uint32;
|
||||
|
||||
begin
|
||||
CLI;
|
||||
{ Read CR2 — the linear address that caused the page fault }
|
||||
asm
|
||||
MOV EAX, CR2
|
||||
MOV faulting_addr, EAX
|
||||
end;
|
||||
correctInterruptRegisters(true);
|
||||
console.writestring('[PF] Faulting address: ');
|
||||
console.writehexln(faulting_addr);
|
||||
if IntSpec <> nil then begin
|
||||
console.writestring('[PF] Faulting EIP: ');
|
||||
console.writehexln(IntSpec^.EIP);
|
||||
end;
|
||||
if IntErr <> nil then begin
|
||||
console.writestring('[PF] Error code: ');
|
||||
console.writehexln(IntErr^.Error);
|
||||
end;
|
||||
BSOD('PF', 'Page Fault.');
|
||||
console.writestringln('Page Fault.');
|
||||
util.halt_and_catch_fire;
|
||||
|
||||
@@ -22,7 +22,7 @@ unit multiboot;
|
||||
interface
|
||||
|
||||
const
|
||||
KERNEL_STACKSIZE = $4000;
|
||||
KERNEL_STACKSIZE = $40000;
|
||||
MULTIBOOT_BOOTLOADER_MAGIC = $2BADB002;
|
||||
|
||||
type
|
||||
|
||||
@@ -152,8 +152,38 @@ var
|
||||
|
||||
procedure init();
|
||||
|
||||
{ 64-bit multiply compilerproc required by FPC on i386 when
|
||||
any int64/uint64 arithmetic occurs (e.g. sint32 * uint32 promotion).
|
||||
Must live in the system unit so the compiler can resolve it. }
|
||||
function fpc_mul_int64(f1, f2: int64): int64; compilerproc;
|
||||
|
||||
implementation
|
||||
|
||||
function fpc_mul_int64(f1, f2: int64): int64; [public, alias: 'FPC_MUL_INT64']; compilerproc;
|
||||
{ 64×64→64 multiply using three 32-bit MUL instructions.
|
||||
We only keep the low 64 bits of the 128-bit product. }
|
||||
var
|
||||
res: int64;
|
||||
begin
|
||||
asm
|
||||
MOV EAX, DWORD [f1] { f1_lo }
|
||||
MUL DWORD [f2] { EDX:EAX = f1_lo * f2_lo }
|
||||
MOV DWORD [res], EAX { result_lo }
|
||||
MOV ECX, EDX { carry = high(f1_lo * f2_lo) }
|
||||
|
||||
MOV EAX, DWORD [f1] { f1_lo }
|
||||
MUL DWORD [f2+4] { EDX:EAX = f1_lo * f2_hi }
|
||||
ADD ECX, EAX { carry += low(f1_lo * f2_hi) }
|
||||
|
||||
MOV EAX, DWORD [f1+4] { f1_hi }
|
||||
MUL DWORD [f2] { EDX:EAX = f1_hi * f2_lo }
|
||||
ADD ECX, EAX { carry += low(f1_hi * f2_lo) }
|
||||
|
||||
MOV DWORD [res+4], ECX { result_hi }
|
||||
end;
|
||||
fpc_mul_int64 := res;
|
||||
end;
|
||||
|
||||
procedure init();
|
||||
begin
|
||||
ASURO_KERNEL_START := uint32(@AK_START);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user