Commit graph

39 commits

Author SHA1 Message Date
Max Raulea
a02a0a25fd Port hyperlog to the Linux kernel module
Logging.c and UnloadDll.c compile and link into HyperDbg.ko, along with
the two components that were waiting on the logging layer (BinarySearch,
OptimizationsExamples).

- new PlatformStr.{h,c}: PlatformVsnprintf/Sprintf/Strnlen replace
  vsprintf_s/sprintf_s/strnlen_s; PlatformSprintf moved here out of
  PlatformMem so both spellings return -1 on truncation
- BasicTypes.h: IRP/IO_STACK_LOCATION/IO_STATUS_BLOCK/UNICODE_STRING
  grow the members shared code touches, plus the NT status and access
  constants the notify path needs
- Environment.h: RTL_NUMBER_OF, _Analysis_assume_, ASSERT -> WARN_ON
- PlatformEvent: ExEventObjectType placeholder token
- HyperLogCallback.c stays out of the module: it defines the same
  LogCallback* entry points as Logging.c (it is the per-DLL forwarding
  shim on Windows), so in one link unit it is a duplicate symbol
2026-08-14 16:25:37 +02:00
Max Raulea
4dc132937f Port components/Spinlock.c to Linux kernel module
Route Spinlock.c's three MSVC intrinsics through the platform
intrinsics layer instead of the Windows builtins:
  _mm_pause                 -> CpuPause (already existed)
  _interlockedbittestandset -> CpuInterlockedBitTestAndSet (new)
  InterlockedCompareExchange-> CpuInterlockedCompareExchange (new, 32-bit)

Add the two new Cpu* wrappers to the kernel PlatformIntrinsics
{.h,.c} with win + linux arms (Linux uses __atomic_* builtins,
mirroring the existing 64-bit CAS), keeping the Cpu* wrappers the
single intrinsic boundary.
2026-08-14 11:35:21 +02:00
Max Raulea
2a23d05ce6 Filled in the time stubs for platformtime functions for linux 2026-08-11 13:13:07 +02:00
Max Raulea
33571e2c51 Implementationb of the platform spinlocks file for linux kernel module 2026-08-11 13:02:16 +02:00
Max Raulea
786cb1775d Filled in PlatformProcess.c for linux module build 2026-08-11 12:53:18 +02:00
Max Raulea
b0de162deb Added linux part of PlatformIrql
Added the linux part of PlatformIrql by adding preempt_enable() and preempt_disable.
2026-08-11 12:20:50 +02:00
Max Raulea
9ea26e4f8b PlatformIO stub
Empty stubs for PLatform IO and added some types to the linux build
2026-08-11 12:00:27 +02:00
Max Raulea
d64ce241f7 Added stub for the PLatform event file
Added a  empty stub for the event functions on linux, since they don't
have a one to one mapping. also removed some redundant guards.
2026-08-11 11:17:35 +02:00
Max Raulea
6bb174b006 linux BHqueue for windows DPC port
In order for PlatformDpc to compile on linux I stubbed out the DPC part
and made a skeleton for the linux implementation using the BHqueue.
2026-08-11 10:53:17 +02:00
Max Raulea
652721be62 Added Printk in rhw platformDBG file
For debug printing added printk for linux kernel logging.
2026-08-01 17:06:58 +02:00
Max Raulea
953af9388a PlatformCPU Linux Implementation
Filled in the stubs for the windows functions:
KeQueryActiveProcessorCount(0) and KeGetCurrentProcessorNumberEx(NULL).
KeQueryActiveProcessorCount(0) maps one to one to num_online_cpus()
KeGetCurrentProcessorNumberEx(NULL) maps to raw_smp_processor_id(),
however this can also be smp_processor_id(), we have to decide based on
preemption, the latter checks for preemption and throws a warning if it
is executed in preemptible code. (I dont know the kernel code well
enough so this may need some discussion)
2026-08-01 16:54:08 +02:00
maxraulea
6c97d86610 Hopefully fix build errors V2 2026-06-10 16:29:35 +02:00
sina
90337d37f7 refactoring codes for platform independence of hyperlog and hypertrace and script-eval 2026-05-10 00:58:47 +02:00
sina
af3b3e2f71 fix compiling error for user and kernel intrinsics in Linux 2026-05-08 18:58:20 +02:00
sina
10dd66d416 add synchronization functions for DPC routines of Windows 2026-05-08 16:44:42 +02:00
sina
9bf3916909 add user level modifications for intrinsics support in mock 2026-05-06 00:50:29 +02:00
sina
ef1a9cd1f7 add linux implementation of intrinsics functions 2026-05-05 23:59:31 +02:00
sina
de0c56b466 create platform independent intrinsics functions 2026-05-05 21:25:20 +02:00
sina
ee72dd5f3f convert all VMX instructions to platform independent functions 2026-05-02 19:04:09 +02:00
sina
0ef8a15ed4 port intrinsics functions to linux 2026-05-02 17:38:33 +02:00
sina
02e459d5f6 change setting LBR kernel status code 2026-05-02 16:53:36 +02:00
sina
b35e0dd43c clearing the headers for Windows and Linux 2026-04-28 01:24:43 +02:00
sina
f1f0e50e08 create empty pch hearder for linux compiler 2026-04-27 23:23:01 +02:00
sina
d3cfd7b5d9 create different headers for basic types in Linux 2026-04-27 21:22:43 +02:00
sina
71fedff180 add basic structure of intrinsics functions 2026-04-27 16:53:36 +02:00
sina
7c6ca98358 change git ignore for linux kernel modules 2026-04-27 16:17:46 +02:00
Alireza moradi
ae8ce290c1 change dummy file header location and some changes in makefile 2026-02-13 12:25:26 +03:30
alish14
9e8dcba265 add dummy pch for handling error in linux 2026-02-13 12:25:26 +03:30
alish14
44f79b6bb9 add if condition macro in PlatformMem for including header only in windows 2026-02-13 12:25:26 +03:30
alish14
f40f1d8183 fix dependecies after changing file names and now it work 2026-02-13 12:25:05 +03:30
alish14
0ffe8c714c change arch and file names 2026-02-13 12:12:44 +03:30
alish14
b12e3d06a9 fixed comment 2026-02-13 12:12:44 +03:30
alish14
8f97858987 refactor(Mem.c): cross-platform memory API and fix build system 2026-02-13 12:12:44 +03:30
Alireza moradi
85a3a48cd2 delete not needed file 2026-02-13 12:12:44 +03:30
Alireza moradi
79f39a35a6 delete not needed file 2026-02-13 12:12:44 +03:30
Alireza moradi
a25f81483c link files in mock to platform/kernel/ 2026-02-13 12:12:44 +03:30
unknown
53059bbac0 add pre-compiled headers for hyperlog and add platform 2024-05-11 22:03:55 +09:00
unknown
20307ecdcb change memory platform functions for kd 2024-05-11 20:22:52 +09:00
unknown
3ea7973810 add separate platform APIs 2024-05-11 19:46:51 +09:00