Commit Graph
184 Commits
Author SHA1 Message Date
t3hn3rd beb4b253ab fix: guard against uint32 underflow in memset/memcpy and strings unit
When size=0 was passed to memset() or memcpy(), the loop bound
`0 to size-1` underflowed to $FFFFFFFF, iterating ~4 billion times
and causing an immediate page fault.

Added `if size = 0 then exit` guards to both memset() and memcpy()
in util.pas.

Also guarded all `for i:=0 to X-1` loops in strings.pas where X
could be 0 on empty string inputs:
- stringToUpper: wrap loop in `if stringSize > 0`
- stringToLower: wrap loop in `if stringSize > 0`
- stringEquals: early exit when both sizes are 0
- stringToInt: early exit when string is empty

Additionally fixed all previously identified bugs in strings.pas:
- hexStringToInt: guard against empty string underflow
- stringConcat: cache stringSize calls to avoid redundant O(n) scans
- stringTrim: clamp length to source string size
- stringSub: bounds check start/size against source length
- stringReplace: complete rewrite - was using stringEquals() for
  substring matching (only matched at string end), dropped prefix
  chars, had dangling assignment overwriting valid result with
  uninitialized pointer, and had unused variable
- stringIndexOf: rewritten to use new stringMatchAt() helper for
  correct substring matching
- stringContains: simplified to delegate to fixed stringIndexOf(),
  also fixing uint32 underflow when sub was empty
- stringToInt: removed always-true `v >= 0` check on uint32
- intToString: implemented (was a stub returning ' ')
- Added stringMatchAt() helper for prefix comparison
- Added comprehensive UnitTest procedure with 77 assertions
  including adversarial empty/nil/boundary inputs
2026-03-01 02:33:28 +00:00
t3hn3rd f752be48ce refactor/feature/fix: Major refactor of codebase
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
refactor(stdio): replace console/terminal command system with buffer-based stdio
- Introduced stdio.pas as the unified command I/O layer.
- All 31 command procedures across 15 files now receive stdin_buf,
  stdout_buf, and stderr_buf (POutBuf) instead of a single outbuf.
- vterminal.pas creates all three buffers per command invocation and
  displays both stdout and stderr.
- Deleted console.pas, terminal.pas, and 9 obsolete windowing programs
  (shell, splash, edit, memview, themer, netlog, vmlog, vmstate, udpcat).
- Migrated all registerCommand calls to stdio, rewrote vterminal
  processCommand to use stdio.findCommand, and added proper error
  routing to stderr for invalid params, bad paths, and system errors.

refactor(syslog): replace console logging with serial-backed syslog
- Introduced syslog.pas for kernel-level logging over serial/dev.
- Migrated all boot logging in kernel.pas from console.outputln/
  writestringln to syslog.logln/writestringln.
- Converted 19 fault handlers, hashmap, lists, scheduler, tracer, net,
  udp, and all driver init paths to use syslog.
- Rewrote BSOD in util.pas (50+ calls) from console to syslog.
- Removed CONSOLE_SLOW_REDRAW, TRGB565, TRGB565Pair, and HWND
  from system.pas.

fix(keyboard): add ring buffer and proper press/release cycling for LVGL input
- Replaced the single last_key/key_pressed slot in lvgl.pas with a
  16-entry ring buffer (kb_buf, kb_head, kb_tail) to prevent ISR
  overwrites when typing fast.
- Added a kb_pending_release flag so each keystroke gets a
  full PRESSED->RELEASED cycle before the next key is consumed —
  LVGL requires this pairing and was silently dropping intermediate
  keys when receiving consecutive PRESSED events without
  intervening releases.

feat(vterminal): use Hack monospace font for terminal output
- Added Hack Regular 14px (hack_14.c) as a custom LVGL font.
- Removed the .static_bitmap field from the generated font file
  (not present in LVGL 9.2 lv_font_t struct).
- Declared the hack_14 external symbol in lvgl.pas and switched
  vterminal's text label from lv_font_montserrat_14 to hack_14
  for proper monospace terminal rendering.
2026-03-01 02:06:31 +00:00
t3hn3rd 989e36ffe2 Initial LVGL modifications
Basic LVGL wrapper with an example desktop & windowing system.
2026-02-27 16:30:31 +00:00
t3hn3rd ceb03a9d7e Merge branch 'feature/fpc-3.2.2' into feature/lvgl
# Conflicts:
#	.drone.yml
#	virtualbox-wrapper.ps1
2026-02-26 15:51:37 +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
Aaron 28846af43c Merge pull request 'feature/dynamic-lists' (#6) from feature/dynamic-lists into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #6
Reviewed-by: t3hn3rd <[email protected]>
2025-03-22 19:24:52 +00:00
Aaron 7e00e23801 Fixed and expanded dynamic lists, commented whole file 2025-03-22 19:02:43 +00:00
Aaron dbc5105b9b Dynamic lists fixes and additions 2022-02-08 21:28:47 +00:00
Aaron a61289a318 Dynamic list/array inital commit.- 2022-02-07 21:37:36 +00:00
t3hn3rd d7a54d858d TARGA & Texture Units
Added TARGA and Texture units to represent & parse TARGA into and provide a standard texture format for use when drawing.
2022-02-07 19:48:00 +00:00
t3hn3rd 4e991c3e6f Double Buffer with SSE 128 copy working 2022-02-07 19:48:00 +00:00
t3hn3rd a3217de71a SSE MOVUPS/128bit Memcpy + Fixed Doublebuffer 2022-02-07 19:48:00 +00:00
t3hn3rd 19b433a19f Vesa32 additions + util functions to support 2022-02-07 19:48:00 +00:00
t3hn3rd 3ae349fbc8 New modular driver set for video
Started outlining how the modular driver set will look for video drawing routines. Currently supports Drawing pixels to the screen & Flushing backbuffer -> frontbuffer.
Still very much test code, tracer is used everywhere for debugging, NOT DEVELOP READY.
Many more draw routines need implementing - such as, but not limited to; drawRect, drawBitmap, drawLine, drawCurve, drawCircle.

TODO: Implement the aforementioned routines in all VESA modes + WindowManager.
2022-02-07 19:48:00 +00:00
t3hn3rd beeeabd441 Expaneded Video.pas and addec color.pas
Backbuffer will need modification to lmemorymanager to remove the limits to allocation size.
2022-02-07 19:48:00 +00:00
t3hn3rd b73c66f6d6 Started work on refactored video. 2022-02-07 19:48:00 +00:00
Aaron 189526cab8 Merge branch 'feature/kernel-size-awareness' into 'develop'
Kernel Size Awareness

See merge request spexeah/asuro!32
2022-02-07 19:43:45 +00:00
t3hn3rd 208bda92c8 Kernel Size Awareness
Modified the linker script + Added an init function to System.pas to be called at system boot, this allows tracking of the Kernel start & end addresses, and thus, allows us to calculate the kernel size.
2022-02-06 13:29:29 +00:00
Aaron 98481ea1ce Added new String functions
(cherry picked from commit 24c371cab1)
2022-01-31 00:36:22 +00:00
goose 2f3ad81959 Fix base64 decode function
Added check for out_len nil size
2021-06-25 20:30:40 +01:00
Aaron d4ea9c52ff Fixed line endings 2021-06-22 23:57:27 +01:00
t3hn3rd 64b3c9a7ba Apache License
Added the apache license to all source files, accounting for authors. Also added a license.md containing the apache license + contributors.md listing all contributors.
2021-06-22 21:31:17 +01:00
t3hn3rd 57ba2f515a Added Asuro.pas to .gitignore
Asuro.pas is generated at compile-time by the compilation script.
2021-06-20 21:04:51 +01:00
t3hn3rd bd9fbd2da6 Added lots of stuff
Added stuff to vfs + Dockerized the compilation & added some vscode cfg.
2021-06-20 02:49:56 +01:00
kieron 99fc00450e git-svn-id: https://spexeah.com:8443/svn/Asuro@1441 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c 2020-07-21 22:06:41 +00:00
kieron d642eafe24 Added relative/absolute path functions to vfs.pas
Implemented stringContains in strings.pas

git-svn-id: https://spexeah.com:8443/svn/Asuro@1432 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2020-07-20 22:34:28 +00:00
aaron c7c49f24d9 git-svn-id: https://spexeah.com:8443/svn/Asuro@1319 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c 2020-07-18 21:01:29 +00:00
kieron 6b6129b769 Added VFS
git-svn-id: https://spexeah.com:8443/svn/Asuro@1318 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2020-07-18 21:00:31 +00:00
kieron 06c50df49d Hashmap new & newEx
git-svn-id: https://spexeah.com:8443/svn/Asuro@1311 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2020-07-18 00:34:30 +00:00
kieron 984b6a89c8 Hashmaps now autoexpand based on loadFactor.
git-svn-id: https://spexeah.com:8443/svn/Asuro@1298 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2020-07-17 22:29:27 +00:00
kieron 57f5e6928d git-svn-id: https://spexeah.com:8443/svn/Asuro@1243 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c 2020-07-17 16:01:53 +00:00
kieron a7ee8c6d34 Hashmap added.
git-svn-id: https://spexeah.com:8443/svn/Asuro@1235 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2020-07-15 23:03:32 +00:00
kieron fbc59a1617 DHCP Works now.
git-svn-id: https://spexeah.com:8443/svn/Asuro@1034 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2020-07-12 17:02:14 +00:00
goose 8b3d59918d Addition of base64 module and prog
git-svn-id: https://spexeah.com:8443/svn/Asuro@975 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2020-07-11 18:51:52 +00:00
kieron b9666fb196 git-svn-id: https://spexeah.com:8443/svn/Asuro@974 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c 2020-07-11 18:50:23 +00:00
kieron 739898068b md5 complete + md5sum added as a prog.
git-svn-id: https://spexeah.com:8443/svn/Asuro@971 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2020-07-11 00:44:05 +00:00
goose 2d4791cd52 Addition of MD5 module
git-svn-id: https://spexeah.com:8443/svn/Asuro@936 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2020-07-10 21:19:15 +00:00
goose 53f6f72a45 Forward decleration of Rol and Ror
git-svn-id: https://spexeah.com:8443/svn/Asuro@935 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2020-07-10 17:21:23 +00:00
kieron 0b14835608 Rol & Ror
git-svn-id: https://spexeah.com:8443/svn/Asuro@933 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2020-07-10 17:13:57 +00:00
kieron 29f986a8e4 Started work on DHCP.
git-svn-id: https://spexeah.com:8443/svn/Asuro@926 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2020-07-10 14:51:48 +00:00
kieron 5d26e199aa git-svn-id: https://spexeah.com:8443/svn/Asuro@918 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c 2020-07-09 21:06:52 +00:00
kieron c3fe1ca707 UDP Recieve now works.
git-svn-id: https://spexeah.com:8443/svn/Asuro@837 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2020-07-08 00:16:17 +00:00
kieron 0248ab2a90 UDP Implemented.
git-svn-id: https://spexeah.com:8443/svn/Asuro@818 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2020-07-07 22:52:42 +00:00
kieron 4935fbc9aa Tried fixes for IDE on VMWare Workbench - doesn't crash on start anymore, but does crash after format.
git-svn-id: https://spexeah.com:8443/svn/Asuro@796 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2019-03-12 11:12:12 +00:00
kieron 18e93ff39d git-svn-id: https://spexeah.com:8443/svn/Asuro@792 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c 2019-03-12 09:25:19 +00:00
aaron 1ddb6bc6d9 git-svn-id: https://spexeah.com:8443/svn/Asuro@760 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c 2019-01-25 15:24:42 +00:00
aaron 6330b1bc72 git-svn-id: https://spexeah.com:8443/svn/Asuro@759 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c 2019-01-25 15:20:48 +00:00
aaron 775733ff51 git-svn-id: https://spexeah.com:8443/svn/Asuro@758 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c 2019-01-25 15:15:04 +00:00
kieron db58264fa6 Comments now conform to PasDoc specifications.
git-svn-id: https://spexeah.com:8443/svn/Asuro@749 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2018-10-12 20:49:03 +00:00
kieron 877ef01b80 git-svn-id: https://spexeah.com:8443/svn/Asuro@748 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c 2018-09-29 14:32:04 +00:00