Compare commits

...

1177 commits

Author SHA1 Message Date
Sina Karvandi
bf974ffcc2 v0.21
Some checks failed
vs2026-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2026-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2026-ci / Deploy release (push) Has been cancelled
Merge pull request #634 from HyperDbg/dev
2026-07-05 15:41:02 +02:00
sina
a90513c71d update changelog for v0.21 release 2026-07-05 15:38:03 +02:00
Sina Karvandi
27838bf4e0
Merge pull request #633 from HyperDbg/pt
Pt
2026-07-05 15:25:35 +02:00
sina
9f113278ee add comment for run and trace
Some checks failed
vs2026-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2026-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2026-ci / Deploy release (push) Has been cancelled
2026-07-03 18:23:39 +02:00
sina
5739d0ee4c add PT thread helper 2026-07-03 17:26:01 +02:00
Sina Karvandi
ace4b331e7
Merge pull request #632 from HyperDbg/pt
Some checks failed
vs2026-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2026-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2026-ci / Deploy release (push) Has been cancelled
Pt
2026-07-02 22:00:48 +02:00
sina
ee01458bc4 Organized header files for the libhyperdbg project 2026-07-02 22:00:05 +02:00
sina
16aebb0c5d remove dependency on module details over global variables 2026-07-02 20:40:41 +02:00
sina
43cea334c2 add core and path interpretation of PT 2026-07-02 18:14:47 +02:00
Sina Karvandi
561ce0d559
Merge pull request #631 from HyperDbg/pt
Some checks are pending
vs2026-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2026-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2026-ci / Deploy release (push) Blocked by required conditions
Pt
2026-07-02 00:02:18 +02:00
sina
5bccbff58b fix IPT kernel structure based on the new model
Some checks are pending
vs2026-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2026-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2026-ci / Deploy release (push) Blocked by required conditions
2026-07-01 19:44:15 +02:00
sina
72a8aa325f add user mode PT parameter parser 2026-06-30 20:30:25 +02:00
sina
2b0cc18899 Fix concatenation error for hyperkd string on the hypertrace project
Some checks failed
vs2026-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2026-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2026-ci / Deploy release (push) Has been cancelled
2026-06-29 18:35:14 +02:00
sina
2b818a5116 fix load all command access denied error
Some checks are pending
vs2026-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2026-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2026-ci / Deploy release (push) Blocked by required conditions
2026-06-29 01:32:51 +02:00
sina
19e47c804f check if any module is loaded or not 2026-06-29 00:56:09 +02:00
sina
b537e36696 add hyperperf to version changer to fix CI CD and update changelog
Some checks failed
vs2026-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2026-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2026-ci / Deploy release (push) Has been cancelled
2026-06-24 18:48:56 +02:00
Sina Karvandi
e7cef36819
Merge pull request #629 from jtaw5649/fix/pool-manager-uninit-list-corruption
Fix pool manager uninit list corruption
2026-06-24 18:46:15 +02:00
jtaw5649
a0973894e8 fix: avoid pool list cursor use after free 2026-06-24 16:45:25 +01:00
sina
edf9f269d4 refactor Intel PT DPC broadcasting routines
Some checks are pending
vs2026-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2026-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2026-ci / Deploy release (push) Blocked by required conditions
2026-06-23 15:02:01 +02:00
sina
c17ebc09c4 add HyperPerf project structures
Some checks are pending
vs2026-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2026-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2026-ci / Deploy release (push) Blocked by required conditions
2026-06-22 16:19:49 +02:00
sina
7dfe5be985 change version to v0.21
Some checks are pending
vs2026-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2026-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2026-ci / Deploy release (push) Blocked by required conditions
2026-06-21 15:02:56 +02:00
Sina Karvandi
4e086328ee
v0.20-beta
Some checks failed
vs2026-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2026-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2026-ci / Deploy release (push) Has been cancelled
Merge pull request #628 from HyperDbg/dev
2026-06-21 14:31:43 +02:00
sina
aa18675760 update changelog and fix minor issues 2026-06-21 14:22:33 +02:00
Sina Karvandi
4bbb62d6fa
Merge pull request #627 from HyperDbg/linux
Linux guide and new progress
2026-06-21 13:23:43 +02:00
sina
5a0fad4901 add WDK and SDK NuGet packages and Fix CI/CD
Some checks are pending
vs2026-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2026-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2026-ci / Deploy release (push) Blocked by required conditions
2026-06-21 03:02:49 +02:00
maxraulea
3a8d8ab2d1 Add guidelines for contribution 2026-06-20 09:48:19 +02:00
maxraulea
83ae005c70 Added compatibility 2026-06-20 09:29:45 +02:00
maxraulea
81b16de62b added files for platform API 2026-06-20 09:28:37 +02:00
maxraulea
2d3941a43e signal handler platform independent API 2026-06-20 09:28:37 +02:00
sina
240feadc0c check for hyper-v as the top level hypervisor 2026-06-19 20:16:50 +02:00
Sina Karvandi
be59d1c9c2
Merge pull request #625 from Idov31/dev
Added VPID checking
2026-06-19 19:35:50 +02:00
Sina Karvandi
01106c82e0
Merge pull request #626 from HyperDbg/vs2026
Move to VS2026
2026-06-19 18:46:41 +02:00
sina
e94a86fcfb add vs2026 workflow and temporarily disabling CI CD 2026-06-19 18:45:50 +02:00
Sina Karvandi
63d509d422
Merge pull request #623 from HyperDbg/linux
Linux added new platform independent functions to the API
2026-06-19 18:22:19 +02:00
idov31
e56730ee25 Added check for whether hyper-v is the top level hypervisor 2026-06-17 20:45:32 +03:00
idov31
0f2a339e0b Added VPID check support 2026-06-17 20:34:09 +03:00
sina
70954f89b4 add v145 platform of zydis and pdbex 2026-06-15 22:55:40 +02:00
sina
622db82af5 remove old pdbex and zydis submodules 2026-06-15 22:24:36 +02:00
maxraulea
10576b064a Added typecast for wchar, mismatch on Linux and Windows 2026-06-15 16:21:12 +02:00
maxraulea
7586303ee8 revert w_char types 2026-06-15 15:57:57 +02:00
maxraulea
5e074a5cbd PE parsing compiles now 2026-06-15 15:52:50 +02:00
maxraulea
0b59876919 compiling dump.cpp and track.cpp 2026-06-15 15:18:56 +02:00
maxraulea
ced1ee94a4 Update platform-lib-calls.c 2026-06-15 14:47:42 +02:00
Sina Karvandi
b03a1f7ac2
Merge pull request #622 from HyperDbg/libipt
Some checks failed
vs2022-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2022-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2022-ci / Deploy release (push) Has been cancelled
Libipt
2026-06-15 00:06:38 +02:00
Sina Karvandi
47ee830867
Merge pull request #619 from maxraulea/gcc-libhyperdbg
Platform ioctl interface
2026-06-15 00:04:44 +02:00
sina
4db59dc013 fix changelog and pt app issues 2026-06-15 00:04:28 +02:00
Sina Karvandi
503988e3a7
Merge pull request #620 from masoudrahimi01/libipt
Fixed ioctl pt operation size bug
2026-06-14 19:16:21 +02:00
Masoud Rahimi Jafari
dabf132d31 Fixed ioctl pt operation size bug 2026-06-14 16:29:26 +02:00
maxraulea
54b5b5a42f Platform ioctl interface 2026-06-14 14:55:02 +02:00
Sina Karvandi
60ab87875c
Update CONTRIBUTING.md 2026-06-14 01:27:28 +02:00
sina
122a99a6fe commenting synthetic MSRs 2026-06-13 15:42:40 +02:00
sina
b11da036d1 fix name of example files 2026-06-13 15:22:34 +02:00
sina
e04ee4dcc3 add Intel PT libraries 2026-06-13 14:20:32 +02:00
sina
9ad48d30dc fix new form of loading and unloading in the example app
Some checks failed
vs2022-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2022-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2022-ci / Deploy release (push) Has been cancelled
2026-06-11 14:31:10 +02:00
sina
8803e6f495 remove unused DPC definitions
Some checks are pending
vs2022-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2022-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2022-ci / Deploy release (push) Blocked by required conditions
2026-06-11 00:13:25 +02:00
sina
df12e9fd79 Fix adding missing IOCTL for Intel PT 2026-06-10 23:56:36 +02:00
Sina Karvandi
ade6877a7d
Merge pull request #609 from masoudrahimi01/feat/intel-pt-integration
Feat/intel pt integration
2026-06-10 23:15:35 +02:00
Sina Karvandi
b38b43eef9
Merge branch 'dev' into feat/intel-pt-integration 2026-06-10 23:14:26 +02:00
maxraulea
f9b912d365 Fix Build files: Added new platform API filesa
Some checks are pending
vs2022-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2022-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2022-ci / Deploy release (push) Blocked by required conditions
2026-06-10 16:29:35 +02:00
maxraulea
6c97d86610 Hopefully fix build errors V2 2026-06-10 16:29:35 +02:00
maxraulea
6299161980 Hopefully fix build errors 2026-06-10 16:29:35 +02:00
maxraulea
31b514f8df Interface Linux for the serial port 2026-06-10 16:29:35 +02:00
maxraulea
853ae9d5fe added defs to linux environment 2026-06-10 16:29:35 +02:00
maxraulea
5a02c43cc1 New platform lib calls 2026-06-10 16:29:35 +02:00
maxraulea
c2c0030f1b Switching cores 2026-06-10 16:29:35 +02:00
maxraulea
e048f5b822 added call to platform api and new TODO 2026-06-10 16:29:35 +02:00
maxraulea
9c3e0ed23b added Linux distinction and pragmas together with new platform functions 2026-06-10 16:29:35 +02:00
maxraulea
0e39c24f28 updates to cmake file for linux 2026-06-10 16:29:35 +02:00
sina
25871f4e48 change version 2026-06-10 16:03:38 +02:00
Sina Karvandi
014d92dc13
v0.19
Some checks failed
vs2022-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2022-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2022-ci / Deploy release (push) Has been cancelled
Merge pull request #611 from HyperDbg/dev
2026-06-10 01:52:04 +02:00
sina
5e5f277e21 fix race condition error in pool manager 2026-06-09 19:34:58 +02:00
sina
f3c14063c3 add beta option for versioning 2026-06-09 17:24:55 +02:00
Sina Karvandi
763ee1b4ed
Merge pull request #610 from HyperDbg/trace-module
Trace module
2026-06-09 15:06:22 +02:00
sina
cd52174d82 fix and remove unused VMM callbacks 2026-06-09 15:04:20 +02:00
sina
bb3b09beb9 replace VMM callbacks 2026-06-09 01:37:48 +02:00
sina
a6421bec2b add module checks based on command requirements 2026-06-08 23:45:43 +02:00
Sina Karvandi
642933b3d9
Update README.md 2026-06-08 14:45:23 +02:00
Sina Karvandi
1100da1a1d
Merge pull request #607 from jtaw5649/upstream/rsds-relative-paths
Use relative RSDS fixture paths
2026-06-07 22:33:37 +02:00
jtaw5649
5cc166254d test: use relative RSDS fixture paths 2026-06-07 17:07:09 +01:00
Sina Karvandi
b6f93dbc7d
Merge pull request #600 from jtaw5649/pr-symbol-memory
Load symbol identity from in-memory PE CodeView data
2026-06-07 17:07:01 +02:00
sina
6a0782d962 add doxygen and clean up 2026-06-07 16:57:53 +02:00
sina
f065776565 add missing Hyper-V TLFS headers
Some checks failed
vs2022-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2022-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2022-ci / Deploy release (push) Has been cancelled
2026-06-07 14:03:02 +02:00
Sina Karvandi
277dbb1b71
Merge pull request #606 from HyperDbg/trace-module
Trace module
2026-06-07 13:37:18 +02:00
Sina Karvandi
e05d60be7d
Merge pull request #605 from Idov31/dev
Added synthetic MSR handling
2026-06-07 13:36:19 +02:00
Sina Karvandi
b0f3fa1ffd
Merge pull request #602 from jtaw5649/upstream/transparent-mode-mask-api
Add transparent-mode evade mask selection
2026-06-07 13:28:06 +02:00
sina
6b48fec247 add load and unload all 2026-06-07 01:04:04 +02:00
sina
aa09f9cde3 check to unload the trace module before unloading vmm 2026-06-06 23:45:18 +02:00
idov31
bd30a120ae Made it a little more readable (ref: 220940ebb7/NovaHypervisor/RegistersHandler.cpp (L4)) 2026-06-06 23:02:22 +03:00
idov31
8b725c190b Added synthetic MSR handling 2026-06-06 22:56:59 +03:00
sina
0aedc66ed0 add load and unload hyper trace module 2026-06-06 17:18:14 +02:00
Masoud Rahimi Jafari
81c8b88dc3 Added disassembler to hyperdbg app to show decoded intel pt buffers 2026-06-06 15:41:48 +02:00
Sina Karvandi
67d8d461bd
Merge pull request #603 from HyperDbg/trace-module
Some checks failed
vs2022-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2022-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2022-ci / Deploy release (push) Has been cancelled
Trace module
2026-06-06 00:34:16 +02:00
sina
5309211043 Fix pool manager corruption of linked lists 2026-06-06 00:33:21 +02:00
sina
f274e1aaa0 check for pool manager initialization 2026-06-05 20:12:30 +02:00
jtaw5649
9fd4034855 feat(hide): add transparent evade mask API 2026-06-05 19:01:14 +01:00
sina
003b63990f add start kd driver export in SDK 2026-06-05 19:21:41 +02:00
sina
2cd620b521 move IRP closing to basic IOCTLs 2026-06-05 18:29:00 +02:00
Sina Karvandi
0841b70dc4
Merge pull request #601 from jtaw5649/fix/debugger-action-cleanup
Some checks are pending
vs2022-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2022-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2022-ci / Deploy release (push) Blocked by required conditions
Fix action cleanup list removal in debugger events
2026-06-05 16:29:19 +02:00
jtaw5649
986ef9f085 fix(debugger): unlink actions before free 2026-06-05 14:59:18 +01:00
jtaw5649
d8ee4f1e32 test(symbols): cover .sym command parsing 2026-06-04 19:15:44 +01:00
jtaw5649
3eb1de4055 feat(symbols): bound loaded PDB identity reads 2026-06-04 19:15:44 +01:00
jtaw5649
0e4ae4d081 feat(symbols): harden loaded PDB identity 2026-06-04 19:15:44 +01:00
jtaw5649
95a3305bd4 fix(symbols): validate user module details 2026-06-04 19:15:44 +01:00
jtaw5649
f7d196f36d feat(symbols): prefer loaded CodeView PDB identity 2026-06-04 19:15:44 +01:00
jtaw5649
9887fbbdac feat(symbols): prefer file-backed CodeView PDB identity 2026-06-04 18:26:11 +01:00
jtaw5649
6aca81e534 refactor(symbols): isolate PDB identity formatting 2026-06-04 18:26:11 +01:00
jtaw5649
51d5584829 test(symbols): add CodeView RSDS parser fixtures 2026-06-04 18:25:24 +01:00
Masoud Rahimi Jafari
2dc1a26f1c Added user app example for pt tracing 2026-06-04 01:55:42 +02:00
sina
adfe5f7d14 uninit VMM and KD separately 2026-06-04 00:55:05 +02:00
sina
b6b8320518 moving pool mananger from hyperhv to hyperkd 2026-06-04 00:06:41 +02:00
Sina Karvandi
f270605936
Merge pull request #599 from HyperDbg/dev
Dev
2026-06-03 18:27:11 +02:00
sina
d2bc99189b add example for loading HyperDbg from VMI mode using libhyperdbg
Some checks failed
vs2022-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2022-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2022-ci / Deploy release (push) Has been cancelled
2026-06-03 17:18:35 +02:00
sina
4774db37bd add items to changelog and readme
Some checks are pending
vs2022-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2022-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2022-ci / Deploy release (push) Blocked by required conditions
2026-06-02 19:57:05 +02:00
Sina Karvandi
59f9907646
Merge pull request #596 from maxraulea/script-engine-gcc
Script engine gcc
2026-06-02 19:52:04 +02:00
sina
ffb0f8ac1d fix build error on script engine refactor for Linux 2026-06-02 19:51:27 +02:00
Sina Karvandi
a0b305a7e4
Merge pull request #598 from jtaw5649/upstream/pe-bounded-metadata
Complete .pe metadata parsing with bounded PE reader
2026-06-02 19:29:00 +02:00
sina
65bcf4f4c6 integrating the new enhanced PE parser 2026-06-02 19:28:19 +02:00
Sina Karvandi
6001cc3a41
Merge pull request #595 from jtaw5649/fix/synchronous-debugger-device-handles
Some checks are pending
vs2022-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2022-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2022-ci / Deploy release (push) Blocked by required conditions
Fix synchronous debugger device IOCTL handles
2026-06-02 14:56:45 +02:00
sina
0a874d31a9 create multiple IOCTL handlers for different modules 2026-06-02 14:04:47 +02:00
jtaw5649
6155304d7f feat(pe): expand PE metadata reporting 2026-06-02 12:37:30 +01:00
jtaw5649
ac78efff1b docs(pe): refresh command help 2026-06-02 12:26:20 +01:00
jtaw5649
f212c8b6b7 feat(pe): report overlay and malformed metadata 2026-06-02 12:14:53 +01:00
jtaw5649
930378058d feat(pe): parse TLS debug and load config metadata 2026-06-02 11:43:54 +01:00
jtaw5649
2ac63b85b9 feat(pe): print PE imports and exports 2026-06-02 11:39:53 +01:00
jtaw5649
a9d64010e3 feat(pe): print PE header metadata 2026-06-02 11:29:39 +01:00
jtaw5649
ab9f508ffc refactor(pe): add bounded image reader 2026-06-02 11:20:05 +01:00
maxraulea
757738bf23 Fix for cyclic dependency that broke gcc compilation 2026-06-01 22:48:12 +02:00
maxraulea
b56f970e0a Added headers for linux compilation 2026-06-01 22:47:00 +02:00
maxraulea
e923ec451e Fix paths 2026-06-01 22:45:49 +02:00
maxraulea
d3fe58bcc7 Added extern keyword for globals for linux compilation 2026-06-01 22:44:34 +02:00
maxraulea
7e002af3a9 Definitions not present on Linux, so created empty stub 2026-06-01 22:38:53 +02:00
maxraulea
b19432ee53 Cross platform API for platform specific functions in script-engine 2026-06-01 22:37:38 +02:00
maxraulea
2d1293ff51 Add argument to Newtemp for gcc compatibility 2026-06-01 22:34:11 +02:00
maxraulea
3d5ee41bb6 change order for compilation gcc 2026-06-01 22:28:46 +02:00
maxraulea
453537dc33 update paths 2026-06-01 22:28:03 +02:00
jtaw5649
8711881d3c fix: use synchronous debugger device handles 2026-06-01 20:30:31 +01:00
sina
bf2f752116 Fix hyperlog callback path in the project
Some checks are pending
vs2022-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2022-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2022-ci / Deploy release (push) Blocked by required conditions
2026-06-01 15:35:55 +02:00
sina
95cd3e7c64 Merge branch 'dev' of https://github.com/HyperDbg/HyperDbg into dev 2026-06-01 14:07:16 +02:00
sina
dd44025dde refactor doxygen, variables, function names 7 2026-06-01 14:07:01 +02:00
Sina Karvandi
e8181b4d9b
Merge pull request #593 from jtaw5649/fix/hyperevade-hide-gate
Fix !hide HyperEvade activation guard
2026-06-01 13:35:15 +02:00
jtaw5649
83b507e672 fix: correct HyperEvade hide guard 2026-06-01 11:46:43 +01:00
Sina Karvandi
e16c31517e
Merge pull request #592 from maxraulea/linux-stub
Linux stub
2026-06-01 11:26:23 +02:00
Masoud Rahimi Jafari
d6f56065d5 Changed intel pt files author email 2026-06-01 11:21:00 +02:00
maxraulea
25371439df Added Linux distinction for generating build files 2026-05-31 21:17:03 +02:00
maxraulea
6b0ebd3e47 Linux Compatibility script-engine headers 2026-05-31 21:16:07 +02:00
maxraulea
bca5a245a7 Linux Compatibility hyperdbg-cli.cpp 2026-05-31 21:16:07 +02:00
maxraulea
7592b12979 SDK export Linux compatibility 2026-05-31 21:16:06 +02:00
sina
e0af5afd4f fix independently unloading the kd module
Some checks are pending
vs2022-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2022-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2022-ci / Deploy release (push) Blocked by required conditions
2026-05-31 21:03:02 +02:00
Sina Karvandi
3753bcd43d
Merge pull request #591 from HyperDbg/trace-module
Trace module
2026-05-31 19:58:57 +02:00
sina
0cd11e136b Fix build issues of the Intel PT in hypertrace 2026-05-31 19:58:18 +02:00
Sina Karvandi
5b8076510a
Merge pull request #590 from HyperDbg/dev
Dev
2026-05-31 19:39:28 +02:00
Sina Karvandi
01e513c876
Merge branch 'trace-module' into dev 2026-05-31 19:39:14 +02:00
sina
cbb28edde3 refactor doxygen, variables, function names 7 2026-05-31 19:29:14 +02:00
Sina Karvandi
b7bcbf2f46
Merge pull request #589 from masoudrahimi01/feat/intel-pt-integration
Feat/intel pt integration
2026-05-31 19:14:10 +02:00
Sina Karvandi
34dfe5604b
Merge branch 'dev' into feat/intel-pt-integration 2026-05-31 19:13:36 +02:00
sina
ef2a482c45 refactor doxygen, variables, function names 6 2026-05-31 18:59:52 +02:00
sina
1e49d3f05c refactor doxygen, variables, function names 5 2026-05-31 18:34:03 +02:00
sina
eeeff45f70 fix refactoring issues 2026-05-31 16:38:21 +02:00
sina
6bcd4a3b10 refactor doxygen, variables, function names 4 2026-05-31 03:21:19 +02:00
sina
3bb181fb7d refactor doxygen, variables, function names 2 2026-05-31 03:17:53 +02:00
sina
5fb4c24fe4 refactor doxygen, variables, function names 2 2026-05-31 02:21:47 +02:00
sina
ff1f499b9f refactor doxygen, variables, function names 1 2026-05-30 20:58:09 +02:00
sina
6eca8c6c85 refactor code convention in hyperlog 2026-05-30 15:54:20 +02:00
sina
e31731cd37 remove unused extern variables 2026-05-29 00:34:08 +02:00
sina
d669d93d81 add packet and messaging files 2026-05-29 00:10:44 +02:00
sina
cb5a83096d load trace module 2026-05-28 20:26:33 +02:00
sina
468927a30f export LBR type as an argument on HyperTrace
Some checks failed
vs2022-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2022-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2022-ci / Deploy release (push) Has been cancelled
2026-05-28 14:41:37 +02:00
sina
0a279b5dba check IOCTL to load VMM module 2026-05-27 20:21:21 +02:00
sina
167931fc01 load the vmm module over IOCTL instead of CreateFile 2026-05-26 19:52:04 +02:00
sina
81f3d9f3d2 export HyperTrace LBR support and capacity function to the VMM and HyperEvade module
Some checks failed
vs2022-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2022-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2022-ci / Deploy release (push) Has been cancelled
2026-05-26 16:41:23 +02:00
sina
37cb28e910 add export to LBR support flag and LBR capacity on HyperTrace 2026-05-26 16:22:33 +02:00
Sina Karvandi
b56e34c3d2
Merge pull request #588 from HyperDbg/LBR3
Some checks are pending
vs2022-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2022-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2022-ci / Deploy release (push) Blocked by required conditions
Lbr3
2026-05-25 20:28:32 +02:00
sina
33c3513184 fix message layout of LBR printing and add notes to lbr help 2026-05-25 20:18:54 +02:00
sina
a8f259fbad fix #587 to add functions with no input and return a number 2026-05-25 16:26:26 +02:00
sina
686e445c9b fix LBR filter issue and dumping message format 2026-05-25 15:29:42 +02:00
sina
02ab868dc7 add lbr_restore and lbr_restore_by_filter functions
Some checks are pending
vs2022-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2022-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2022-ci / Deploy release (push) Blocked by required conditions
2026-05-24 23:51:12 +02:00
sina
1a63f6e737 enhance the LBR check function
Some checks are pending
vs2022-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2022-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2022-ci / Deploy release (push) Blocked by required conditions
2026-05-24 15:43:48 +02:00
Masoud Rahimi Jafari
e5652fbf7f Debug compile errors for intel pt 2026-05-20 01:57:32 +02:00
Masoud Rahimi Jafari
434aed98d0 Added pt pause, resume and size commands 2026-05-19 05:13:22 +02:00
Masoud Rahimi Jafari
59280239e9 Added pt mmap comand and function 2026-05-19 03:50:26 +02:00
Sina Karvandi
6871741ee0
Merge pull request #586 from HyperDbg/LBR2
Some checks failed
vs2022-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2022-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2022-ci / Deploy release (push) Has been cancelled
Lbr2
2026-05-18 16:57:06 +02:00
sina
5fb797c201 fix output buffer IOCTL checks for WRMSR 2026-05-17 20:18:36 +02:00
sina
1369aa777b refactor IOCTL codes 2026-05-17 17:07:59 +02:00
Sina Karvandi
13ccf7c9b0
Merge pull request #585 from orbisai0security/fix-v-004-memcpy-zero-size-validation
Some checks failed
vs2022-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2022-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2022-ci / Deploy release (push) Has been cancelled
fix: scriptenginefunctionmemcpy exposes a kernel-mod... in...
2026-05-17 12:40:13 +02:00
orbisai0security
1c5f4f3853 fix: V-004 security vulnerability
Automated security fix generated by Orbis Security AI
2026-05-17 04:43:55 +00:00
sina
ef1ce11154 check LBR support within nested virtualization environments 2026-05-17 04:57:09 +02:00
sina
61c30822fb perform adjustments for call_stack filter option of LBR 2026-05-17 04:27:56 +02:00
Masoud Rahimi Jafari
64328723c8 Added Intel-PT to hypertrace 2026-05-17 03:18:05 +02:00
sina
517872e072 create new fields to show branch type in ARCH LBR 2026-05-17 02:39:58 +02:00
sina
4ea5b142f4 fix LBR filter on ARCH LBR CTL
Some checks failed
vs2022-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2022-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2022-ci / Deploy release (push) Has been cancelled
2026-05-15 20:23:52 +02:00
sina
f6fd116274 add new arch-based TO and FROM MSRs 2026-05-15 17:25:56 +02:00
Sina Karvandi
dfec8d0cb2
Merge pull request #584 from HyperDbg/linux-refactoring
Some checks failed
vs2022-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2022-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2022-ci / Deploy release (push) Has been cancelled
Linux refactoring
2026-05-12 14:58:05 +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
858434940a add CPU intrinsics for user mode 2026-05-05 23:46:12 +02:00
sina
1a4f02f6df Merge branch 'dev' of https://github.com/HyperDbg/HyperDbg into dev
Some checks failed
vs2022-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2022-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2022-ci / Deploy release (push) Has been cancelled
2026-05-05 22:10:02 +02:00
sina
10dfa43696 add articles to README and CHANGELOG 2026-05-05 22:09:51 +02:00
Sina Karvandi
90295d7c13
Merge pull request #582 from HyperDbg/LBR
Lbr
2026-05-05 21:49:32 +02:00
sina
de0c56b466 create platform independent intrinsics functions 2026-05-05 21:25:20 +02:00
sina
e816b93c46 add missing LBR VMCALL 2026-05-04 14:23:53 +02:00
Sina Karvandi
77a6a0fb87
Merge pull request #581 from HyperDbg/LBR
Some checks failed
vs2022-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2022-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2022-ci / Deploy release (push) Has been cancelled
add lbrdump command and sdk function
2026-05-04 00:33:53 +02:00
sina
09416e7fe1 add lbrdump command and sdk function 2026-05-04 00:29:54 +02:00
sina
ea74b06286 apply automatic save for printing lbr records
Some checks are pending
vs2022-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2022-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2022-ci / Deploy release (push) Blocked by required conditions
2026-05-03 01:45:02 +02:00
Sina Karvandi
c767f40875
Merge pull request #580 from HyperDbg/LBR
Lbr
2026-05-03 01:27:01 +02:00
sina
19b9ebe3fd add lbrdump command 2026-05-03 01:25:39 +02:00
sina
8b593489e7 change functions of LBR 2026-05-03 01:03:19 +02:00
sina
ee72dd5f3f convert all VMX instructions to platform independent functions 2026-05-02 19:04:09 +02:00
sina
4e26d65626 add gitignore for files copied to the Linux mock 2026-05-02 17:49:15 +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
aa80cd9d6b Apply all ARCH Based LBR controls on API level 2026-05-01 20:39:13 +02:00
sina
6f004f1ffd Add ARCH LBR functions from hypervisor 2026-05-01 18:40:39 +02:00
sina
1ad7bac9ce check for ARCH and legacy LBR support 2026-04-30 20:29:22 +02:00
sina
469f12c645 compile HyperDbg SDK for Linux (user-mode)
Some checks failed
vs2022-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2022-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2022-ci / Deploy release (push) Has been cancelled
2026-04-28 17:17:45 +02:00
sina
d3f4e65686 Replace general types with basic types
Some checks are pending
vs2022-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2022-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2022-ci / Deploy release (push) Blocked by required conditions
2026-04-28 15:03:08 +02:00
sina
c5ba5ccd89 compile HyperDbg SDK for Linux 2026-04-28 14:39:54 +02:00
sina
b35e0dd43c clearing the headers for Windows and Linux 2026-04-28 01:24:43 +02:00
sina
dc085fbe2a remove PlatformTypes and merge it to GeneralTypes 2026-04-27 23:55:04 +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
Sina Karvandi
2f8e7f9029
Merge pull request #579 from HyperDbg/LBR
Lbr
2026-04-27 03:18:11 +02:00
sina
af50093b9b apply LBR filters from VMX-root mode 2026-04-27 03:16:41 +02:00
sina
f5c45c7ebb add filtering options to LBR 2026-04-27 00:50:41 +02:00
sina
93ac084d4b show branch misprediction and cycle count 2026-04-26 21:02:38 +02:00
Sina Karvandi
8a934e93c8
Merge pull request #578 from HyperDbg/LBR
Lbr
2026-04-26 12:38:05 +02:00
sina
84f0fa0ed4 check for the VMX state independently from function arguments 2026-04-26 12:37:08 +02:00
sina
76d91901cd add lbr_flush function to the script engine 2026-04-26 02:23:04 +02:00
sina
c6b6a8a3a0 add processor trace command 2026-04-25 22:46:55 +02:00
sina
e359911d60 add base structure for Intel PT 2026-04-25 21:42:17 +02:00
sina
3cbf328fee Restructure of the hypertrace project 2026-04-25 18:02:48 +02:00
Sina Karvandi
512e7fe290
Merge pull request #577 from HyperDbg/LBR
Lbr
2026-04-24 20:05:28 +02:00
sina
70f6613953 add lbr_save and lbr_dump script engine functions for accessing LBR commands 2026-04-24 20:04:30 +02:00
sina
566d38c39a create dmp function to enable, disable, save, and dump LBR branches 2026-04-24 18:35:15 +02:00
sina
03162c06ee remove unused LBR functions 2026-04-24 17:24:18 +02:00
sina
81869ec715 dump LBR based on TOS MSR 2026-04-24 17:16:11 +02:00
sina
7130daf65d remove unnecessary codes for LBR 2026-04-23 19:58:51 +02:00
sina
8f76929643 comment non-used codes for LBR 2026-04-23 19:33:10 +02:00
sina
d930b3341d change LBR control VMWRITE length 2026-04-23 18:52:41 +02:00
Sina Karvandi
54c2a9923b
Merge pull request #576 from HyperDbg/LBR
Lbr
2026-04-23 16:44:08 +02:00
sina
24875bda88 apply VM-exit and VM-entry load and save controls from VMCALLs 2026-04-23 16:42:34 +02:00
Sina Karvandi
54fd52a924
Merge pull request #575 from HyperDbg/copilot/find-typos-and-fix-copy-paste
Fix typos and copy-paste wording issues
2026-04-23 14:51:51 +02:00
copilot-swe-agent[bot]
774d61782f
fix: correct typos and one copy-paste error in comments and messages
Agent-Logs-Url: https://github.com/HyperDbg/HyperDbg/sessions/0817c887-8808-4080-a701-6a0211b10595

Co-authored-by: SinaKarvandi <13383992+SinaKarvandi@users.noreply.github.com>
2026-04-23 12:38:48 +00:00
sina
f2ef1c3f3b Fix the problem of not applying the EAX index in the CPUID event extension command 2026-04-22 18:24:09 +02:00
sina
f192c194df initialize the LBR based on hypervisor environment checks 2026-04-22 17:43:23 +02:00
sina
efded3790b protect load and save vm-entry and vm-exit controls from setting and unsetting in different routines 2026-04-22 16:27:20 +02:00
Sina Karvandi
4d4045674a
Merge pull request #574 from HyperDbg/LBR
Lbr
2026-04-19 20:10:12 +02:00
sina
111bead68d check for hypervisor support of load and save VMCS exit and entry controls 2026-04-19 20:08:47 +02:00
sina
6e511c8368 create different function separations for DPCs and Broadcasting routines 2026-04-19 19:34:13 +02:00
sina
43cdab9821 broadcast LBR example to all cores 2026-04-19 19:20:18 +02:00
sina
a1984fed70 change instances for VMWRITE into a single function 2026-04-19 16:57:48 +02:00
sina
01ae55f854 change VMREAD to a specific function 2026-04-19 15:57:52 +02:00
sina
2ad4fa56ee create separate example for LBR 2026-04-19 15:49:12 +02:00
sina
f36273aba7 add VMCALL option to LBR tracing 2026-04-14 19:44:41 +02:00
sina
1b08f14add add cross VMCALLs for setting core-specific LBR state 2026-04-14 19:23:51 +02:00
sina
a1d30abdf2 remove VMX instructions from hypertrace in favor of linking to hyperhv callbacks 2026-04-14 17:53:54 +02:00
sina
65c1a6aef9 v0.18.1 (release) 2026-04-09 17:32:30 +02:00
Sina Karvandi
00f889778c
v0.18.1
Merge pull request #573 from HyperDbg/dev
2026-04-09 17:19:10 +02:00
sina
13a2bc6368 Update CHANGLELOG.md 2026-04-09 17:17:49 +02:00
sina
15f8b3cca1 apply vmx-root LBR to VMCS 2026-04-06 20:17:40 +02:00
sina
6abfc0ec46 pass VMX root state over LBR 2026-04-06 19:55:08 +02:00
sina
c266a880c3 add lbr start and lbr stop functions to the script engine 2026-04-06 18:33:01 +02:00
sina
201820376d enable and disable LBR separately from the HyperTrace module 2026-04-06 16:45:35 +02:00
sina
1dd73675e9 apply the LBR and HyperTrace initialization and operations 2026-04-06 01:05:59 +02:00
sina
2329fd3c19 add user mode side of initializing LBR 2026-04-05 22:56:59 +02:00
sina
e040a1c711 fix .clang-format error 2026-03-15 21:53:58 +01:00
sina
fba6f66e1a minor refactor and modify changelog 2026-02-24 15:48:23 +01:00
Sina Karvandi
1337980ec3
Merge pull request #569 from ShirokoLEET/dev
Fix #567
2026-02-24 15:24:35 +01:00
ShirokoLEET
bff7f7b7c3 fix by change to tracking VA when split pages 2026-02-20 23:14:37 +08:00
Sina Karvandi
9b15c762c8
Merge pull request #568 from harimishal1/dev
hypertrace
2026-02-20 15:08:02 +01:00
Hari Mishal
3691c5e343 more comments changed 2026-02-19 21:07:59 +01:00
Hari Mishal
815e1b0ef9 changed some comments 2026-02-19 20:51:03 +01:00
Hari Mishal
95c37166e7 Merge branch 'dev' of https://github.com/harimishal1/Hyperdbg into dev 2026-02-19 20:47:17 +01:00
Hari Mishal
b0a839222b hypertrace now works when you load the vmm. call has been commented out 2026-02-19 20:33:24 +01:00
sina
aa0a9ff7ee change version and fix CHANGELOG 2026-02-16 13:37:08 +01:00
Sina Karvandi
a6f841c380
v0.18
Merge pull request #566 from HyperDbg/dev
2026-02-15 22:28:42 +01:00
Sina Karvandi
0638660e31
Merge pull request #565 from HyperDbg/update-zydis
Update zydis
2026-02-13 16:07:48 +01:00
sina
bc2779f1c1
add updated version of zydis to fix new WDK error 2026-02-13 16:05:35 +01:00
sina
aafc61457f
removed zydis submodule to update 2026-02-13 15:29:51 +01:00
sina
6e0aee6c01
add information for current state of supporting linux 2026-02-13 15:25:45 +01:00
Sina Karvandi
4dc64331f6
Merge pull request #563 from Alish14/linux-driver
Linux driver
2026-02-13 14:57:38 +01:00
Alireza moradi
ae8ce290c1 change dummy file header location and some changes in makefile 2026-02-13 12:25:26 +03:30
Alireza moradi
0f60d24921 change include path in mock.c 2026-02-13 12:25:26 +03:30
Alireza moradi
f5c54341ac change linux mock 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
3a21e72f32 add README 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
5f00c98583 updates cmakes 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
e229d85baa change make file for include path be dynamic not hardcoded 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
Alireza moradi
1eb72d1621 linux kernel module mock added 2026-02-13 12:12:44 +03:30
sina
91c558e43b
disable hypertrace callback by default 2026-02-11 18:17:09 +01:00
sina
207772f0e7
edit changelog 2026-02-11 18:16:04 +01:00
Sina Karvandi
9b9bdb3af6
Merge pull request #564 from harimishal1/dev
Uncommented call to hypertrace in Loader.c and added dependencies (lbr.h, lbr.c) and code (tracing.c) to print lbr buffer.
2026-02-11 17:58:30 +01:00
Hari Mishal
1924385156 Uncommented call to hypertrace in Loader.c and added dependencies (lbr.h, lbr.c) and code (tracing.c) to print lbr buffer. 2026-02-11 02:54:02 +01:00
sina
20984b36b5
update version and changelog 2026-02-08 19:49:22 +01:00
sina
5a42d00a1f
Link hypertrace to hyperkd 2026-02-08 04:09:47 +01:00
sina
37569a3ae6
separate LBR from general tracing routine in hypertrace 2026-02-08 03:50:25 +01:00
sina
a0bd050330
Fix hyperlog linking issues and redirect DbgPrints to LogInfo in hypertrace project 2026-02-08 03:35:04 +01:00
sina
5e3e0d4081
import hyperlog into hypertrace and import and export hypertrace routines 2026-02-08 03:02:43 +01:00
sina
569881c1c1
refactoring and add function information 2026-02-07 23:33:36 +01:00
sina
e25209453a
renaming and refactoring hypertrace project 2026-02-07 22:29:25 +01:00
Sina Karvandi
88b134c50f
Merge pull request #562 from harimishal1/dev
added tracing.h and tracing.c
2026-02-06 14:59:27 +01:00
Hari Mishal
cd5aae1b16 added all supported cpus to tracing.c 2026-02-03 17:52:53 +01:00
Hari Mishal
ef705fccc7 added tracing.h and tracing.c 2026-02-03 17:29:37 +01:00
Sina Karvandi
72145109ab
Merge pull request #561 from xmaple555/dev
add include file in script engine
2026-01-08 00:09:18 +01:00
xmaple21215
a7ceabdc33 update post-build event in script-engine 2026-01-06 17:03:17 +08:00
xmaple21215
8bd8950514 add include file in script engine 2026-01-06 16:38:22 +08:00
Sina Karvandi
c2e2fe5c4b
Merge pull request #560 from harimishal1/dev
add base code for the hypertrace project
2025-12-02 19:10:26 +01:00
Hari Mishal
19437cd694 add base code for the hypertrace project 2025-12-02 19:08:27 +01:00
Sina Karvandi
338677a0fb
Update CONTRIBUTING.md 2025-12-02 15:20:08 +01:00
Sina Karvandi
5462d69dd1
v0.17
Merge pull request #559 from HyperDbg/dev
2025-11-10 14:55:06 +01:00
sina
2158fc18da
Change version and update changelog 2025-11-09 19:52:48 +01:00
Sina Karvandi
898ae8cbce
Merge pull request #556 from xmaple555/dev
update array index for boolean expression in script engine
2025-10-26 14:31:49 +01:00
xmaple555
82540bab5e update array index for boolean expression in script engine 2025-10-26 12:15:41 +08:00
Sina Karvandi
ba2cec3c12
Merge pull request #555 from HyperDbg/fix-script-variable-type
fix script variable type
2025-10-21 14:16:09 +02:00
sina
43b0245fa1
fix script variable type 2025-10-21 12:56:21 +02:00
Sina Karvandi
ed2759402a
Merge pull request #554 from xmaple555/dev
add array and pointer in script engine
2025-10-21 11:53:17 +02:00
xmaple555
8b4178d416 add array and pointer in script engine 2025-10-21 16:46:49 +08:00
xmaple555
4233ade781 update pointer variable type in script engine 2025-10-15 08:01:17 +08:00
Sina Karvandi
35f3f3eec8
Merge pull request #553 from xmaple555/dev
fix dd_pa in scrpt-engine
2025-10-13 18:22:54 +02:00
xmaple555
3577876cac fix dd_pa in scrpt-engine 2025-10-14 00:09:58 +08:00
Sina Karvandi
22096da60e
v0.16
Merge pull request #551 from HyperDbg/dev
2025-09-08 00:11:00 +02:00
sina
2ec5747539
remove the requirement for the r in the user debugger 2025-09-07 00:17:37 +02:00
unknown
e837a4526b perform upausing threads before changing MBEC bits 2025-09-06 23:11:08 +02:00
Sina Karvandi
6fb000ce89
Merge pull request #550 from HyperDbg/user-debugger2
User debugger2
2025-09-06 20:30:31 +02:00
sina
228ecd91f1
added support for the print and the printf functions in the user debugger 2025-09-06 19:25:26 +02:00
unknown
0338f9b301 remove IRP sleep for debuggee manadatory bit operation codes 2025-09-06 16:44:25 +02:00
unknown
f3b952805b export SDK API for evaluating expressions based on the user or the kernel debugger context 2025-09-02 01:11:03 +02:00
unknown
8316085e17 fix command parameter parsing errors on the user debugger 2025-09-02 00:52:27 +02:00
sina
0d940ee543
sending results of format to the user debugger 2025-09-01 18:27:01 +02:00
sina
fe4f2be270
run script for the .formats command in the user debugger 2025-09-01 15:00:21 +02:00
sina
cda5029081
run script for the print command in the user debugger 2025-09-01 14:38:59 +02:00
sina
31fc581135
add support to the eval command in the user debugger 2025-08-31 18:31:35 +02:00
sina
3f6d837a62
run script for modifying registers in the user debugger 2025-08-31 16:53:09 +02:00
unknown
a869065718 add support to the registers command to the user debugger 2025-08-31 01:53:29 +02:00
unknown
85debe2636 add synchronization functions 2025-08-30 03:55:15 +02:00
unknown
87f32fb5d0 add user debugger command synchronization event 2025-08-30 03:37:10 +02:00
unknown
99b807dd6e add codes to support the p command in the user debugger 2025-08-30 00:14:48 +02:00
Sina Karvandi
82340d2c7e
Merge pull request #548 from HyperDbg/user-debugger
User debugger (progress)
2025-08-27 23:16:58 +02:00
sina
05b27083b2
fix running step-in command in user debugger 2025-08-27 23:14:57 +02:00
sina
739d143393
show number of blocked context switches 2025-08-23 15:36:53 +02:00
sina
c37ec6f3c0
apply command to the target thread from MBEC 2025-08-23 01:30:12 +02:00
Sina Karvandi
b2056dfe34
Refine README content and formatting
Updated README.md to enhance clarity and fix formatting issues.
2025-08-22 00:54:12 +02:00
Sina Karvandi
1429f2e289
Merge pull request #547 from HyperDbg/xsetbv
Xsetbv
2025-08-21 20:16:19 +02:00
sina
13f2b63053
fix checks for parameters of the XSETBV extension command 2025-08-21 19:48:37 +02:00
sina
8e111d93c6
remove extra code from XSETBV command 2025-08-21 00:39:35 +02:00
sina
77029f330d
add XSETBV event extension command 2025-08-21 00:17:26 +02:00
sina
cb9c61af29
update changelog with PR modifications 2025-08-20 18:18:39 +02:00
Sina Karvandi
91831c0d95
Merge pull request #545 from unlockable/monitor_bug_fix
Fix: An infinite vm-exit bug for !monitor x command
2025-08-20 17:02:11 +02:00
Sina Karvandi
66a1b6c6c4
Merge pull request #546 from HyperDbg/copilot/fix-33769209-15df-4e76-ba70-38c59b37adba
Fix grammar and spelling errors throughout HyperDbg codebase
2025-08-20 17:01:19 +02:00
copilot-swe-agent[bot]
972786821f Fix additional grammar/spelling: contractions, duplicate words, hyphenation
Co-authored-by: SinaKarvandi <13383992+SinaKarvandi@users.noreply.github.com>
2025-08-20 12:54:26 +00:00
copilot-swe-agent[bot]
8a5f696544 Fix grammar and spelling errors: perfrom->perform, occured->occurred, recieved->received
Co-authored-by: SinaKarvandi <13383992+SinaKarvandi@users.noreply.github.com>
2025-08-20 12:49:07 +00:00
copilot-swe-agent[bot]
e13e6a8f42 Initial plan 2025-08-20 12:38:55 +00:00
Seonjin Hwang
bc6010d061 Fix: after patch 0.14, there is an infinite vm-exit bug for \!monitor x which freeze hyperdbg. It simply fixs the bug 2025-08-20 14:53:38 +09:00
sina
c655a7705e
avoid saving and restoring nonvolatile XMM registers 2025-08-18 21:54:21 +02:00
Sina Karvandi
9bd5ffc7b9
v0.15 (release 2)
Merge pull request #544 from HyperDbg/dev
2025-08-18 00:34:38 +02:00
sina
a949bf66cd
temporarily hyperevade project 2025-08-18 00:30:13 +02:00
Sina Karvandi
77422be3dd
v0.15
Merge pull request #543 from HyperDbg/dev
2025-08-17 23:34:28 +02:00
sina
3ce7e7d92b
update preactivating mode command messages 2025-08-17 22:57:46 +02:00
sina
613dff02eb
re-enable the .start command and update changelog 2025-08-17 22:08:20 +02:00
Sina Karvandi
d2893ab5cc
Merge pull request #542 from HyperDbg/syscall-cet-support
Syscall cet support
2025-08-17 17:41:30 +02:00
sina
16f64afd4f
check for the compatibility of Intel CET to for emulating SYSCALL and SYSRET 2025-08-17 17:33:13 +02:00
sina
61d45c518d
move pool allocations to a single function 2025-08-17 16:25:02 +02:00
sina
ece94e748f
update ia32-doc submodule to update the correct value for VMCS PL3 SSP 2025-08-17 16:17:16 +02:00
sina
fae3290ec1
remove the ia32-doc dependencies 2025-08-17 16:14:11 +02:00
sina
39920ccfa5
change VMX headers to IA32doc headers 2025-08-17 14:26:38 +02:00
sina
360b0e5863
support CET SYSCALL emulation on VMCS 2025-08-17 13:51:32 +02:00
sina
cdadcfaded
add CET emulation for syscall extension command 2025-08-14 12:21:53 +02:00
Sina Karvandi
57b4b6f4e2
Merge pull request #541 from HyperDbg/save-restore-xmm-regs
Save and restore XMM registers on VM-exits
2025-08-10 01:10:12 +02:00
Sina Karvandi
4a4b1fab25
Merge branch 'dev' into save-restore-xmm-regs 2025-08-10 01:09:48 +02:00
sina
00c0add449
Restore XMM registers before VMXOFF 2025-08-09 23:45:40 +02:00
sina
faadc9272d
refactor PE parser codes 2025-08-09 14:59:00 +02:00
Sina Karvandi
82fa6ec316
Merge pull request #540 from Alish14/pe-rich-fix
Pe rich fix
2025-08-09 14:54:06 +02:00
alish14
6cb90d80d7 fix initializing format 2025-08-09 08:02:04 +03:30
alish14
38c917e1ec fixed incorrectly using pointer 2025-08-09 07:55:22 +03:30
alish14
da717d0deb change global variable to pointer 2025-08-09 06:07:22 +03:30
sina
6ea7989d51
refactoring rich header codes 2025-08-06 20:28:40 +02:00
Sina Karvandi
4d79ee1f80
Merge pull request #539 from Alish14/enhance-pe-rich
Enhance pe rich
2025-08-06 19:46:57 +02:00
alish14
76adc4ff75 add comment and change rich header displaying format 2025-08-05 04:49:48 +03:30
alish14
7baec5ebed header alias moved 2025-08-05 04:49:10 +03:30
alish14
af3c228bed add rich parser code 2025-08-04 05:21:49 +03:30
alish14
7b03230a42 add Rich header entries struct 2025-08-04 05:21:16 +03:30
sina
464e7c6736
Fix unloading (VMXOFF) crash when restoring XMM registers 2025-08-03 23:31:49 +02:00
sina
3f877c36f5
create XMM register structures for VM-entries 2025-08-03 01:18:58 +02:00
sina
853e5c9511
save and restore XMM registers and enable hyperevade optimization 2025-08-03 00:41:28 +02:00
Sina Karvandi
cbead678ea
Merge pull request #538 from HyperDbg/smi-command
SMI command
2025-08-03 00:15:58 +02:00
sina
11f8c2ebed
update changelog and change the help message of SMI command 2025-08-03 00:13:37 +02:00
sina
3961196112
add support for SMI related functionalities 2025-08-02 23:18:18 +02:00
sina
2e4269b5d3
change versioning and README.md 2025-07-27 20:08:10 +02:00
Sina Karvandi
5d8d3ca524
v0.14.1
Merge pull request #537 from HyperDbg/dev
2025-07-27 19:33:05 +02:00
sina
373158da82
fix the building issues with the bp and the .start commands 2025-07-27 19:31:08 +02:00
sina
2fdf0f59de
Restore release build optimizations and fix CPUID register restoration 2025-07-26 01:53:43 +02:00
Sina Karvandi
633ea9cb4a
Update CREDITS.md 2025-07-24 01:09:16 +02:00
Björn Ruytenberg
798f90b311
v0.14: temporarily work around Visual Studio 17.14.8 compiler optimization bug 2025-07-23 18:27:08 +02:00
Björn Ruytenberg
30201f6435 Temporarily work around Visual Studio 17.14.8 compiler optimization bug 2025-07-23 18:14:36 +02:00
Sina Karvandi
9dbfebd5b0
v0.14
Merge pull request #534 from HyperDbg/dev
2025-07-23 12:14:36 +02:00
sina
0648d875ca
add beta release instructions for the hyperevade project 2025-07-23 10:12:10 +02:00
sina
019162b4ff
temporarily disable bp, .start, .attach for the user debugger 2025-07-22 02:20:27 +02:00
Sina Karvandi
df8b94034f
Merge pull request #533 from HyperDbg/support-reserved-mmio
Added support to MMIO ranges above 512 GB
2025-07-22 01:28:12 +02:00
sina
945ae55563
check for EPT hooks above 512 GB 2025-07-22 01:21:11 +02:00
sina
fdd5dfc55e
fix shifting correct number of bytes on the PML3 PFN 2025-07-21 02:30:11 +02:00
sina
24d9a93531
set out of range MMIO ranges as uncacheable 2025-07-21 01:43:24 +02:00
sina
369908f64c
add support for extra reserved addresses for out of 512 GB range MMIO addresses 2025-07-21 01:14:39 +02:00
sina
3c92e09a51
fix crash on using TPAUSE instruction on Windows 11 24h2 2025-07-19 17:53:06 +02:00
Sina Karvandi
0ff9d51301
Merge pull request #532 from HyperDbg/user-debugger-breakpoint
User debugger breakpoint
2025-07-15 00:17:04 +02:00
sina
3d73a95b8f
check for uninitializing memory pools for the debugger 2025-07-15 00:02:11 +02:00
sina
891382fa50
check the accessibility of address based on process id 2025-07-09 23:49:12 +02:00
sina
7ae6ad8e37
added kernel side support for putting breakpoint in the user debugger 2025-07-09 22:38:36 +02:00
sina
33fbbb4e06
add user mode side of the user debugger 2025-07-09 13:37:01 +02:00
sina
d8b5d842d6
adjust pause and continue commands for the user debugger 2025-07-09 01:55:36 +02:00
sina
15061014c7
Fixed retrieving valid watching process IDs for the execution trap and user-mode execution prevention 2025-07-08 19:41:08 +02:00
sina
0e5ff45c30
set user mode execute bit for different core EPTPs 2025-07-08 00:10:43 +02:00
sina
beed7ccc34
fix renaming script engine TOKENs on the auto generated codes 2025-07-07 14:32:43 +02:00
Sina Karvandi
c709e0f04f
Merge pull request #530 from enzo-berry/dev
Refactor token structures and related functions in the script engine
2025-07-07 13:58:16 +02:00
Enzo Berry
6a89a94496 Refactor token structures and related functions in the script engine 2025-07-07 11:46:10 -07:00
Sina Karvandi
b72c5aec03
Merge pull request #527 from HyperDbg/mbec-reimplementation
Mbec reimplementation
2025-07-06 01:27:47 +02:00
sina
0c77512609
apply the breakpoint to the entrypoint 2025-07-06 01:26:16 +02:00
sina
e8e0489a6b
fix removing process from pausing list 2025-06-29 20:22:51 +02:00
sina
f01f0d85f8
add instant breakpoint breaks in the user debugger 2025-06-29 01:01:17 +02:00
sina
d6f0e22928
intercept the execution when the module loaded on the user debugger 2025-06-28 18:53:35 +02:00
sina
e5326f895d
move breakpoint initialization to debugger from kd 2025-06-28 10:06:30 +02:00
sina
b2b8cf5e63
fix attaching errors on the target process 2025-06-28 05:07:00 +02:00
sina
8aa8289236
adjust mbec and user debugger initialization 2025-06-28 04:28:39 +02:00
sina
a93b78dfad
use the same EPTP for MBEC 2025-06-28 03:54:07 +02:00
Sina Karvandi
d5f051ad58
Merge pull request #526 from HyperDbg/user-debugger
User debugger
2025-06-26 19:15:23 +02:00
sina
2637965512
apply user mode debugger to the kernel debugger 2025-06-26 19:14:29 +02:00
sina
fe4dd107cb
add hyperdbg test mode for the user debugger 2025-06-25 18:48:11 +02:00
sina
cc8167c089
only apply thread interception to user mode 2025-06-24 18:12:02 +02:00
sina
a05cdcdd1c
release and continue the user debugger execution based on mbec method 2025-06-23 20:35:32 +02:00
sina
4afe2daef2
intercept threads only once 2025-06-23 17:18:41 +02:00
sina
6893c1b19f
change user debugger from supervisor bit of regular page table to mbec 2025-06-21 02:59:44 +02:00
sina
e7a7668325
get process name and process id for the transparent mode 2025-06-11 01:43:19 +02:00
Sina Karvandi
df71d93b2f
Merge pull request #525 from HyperDbg/hyper-evade
Hyper evade
2025-06-11 00:01:13 +02:00
sina
0e649c6107
check for race condition while configuring the transparent mode 2025-06-10 23:59:21 +02:00
sina
7df82a1b5a
make separate msr read, msr write and trap flag handling 2025-06-08 10:07:19 +02:00
sina
17914a34c7
separate vmx and syscall footprints 2025-06-08 09:28:56 +02:00
sina
bba0bd2a4c
fix changes from transparent-mode to syscall callback 2025-06-08 08:58:40 +02:00
sina
bdfd1f30eb
change the syscall callback initialization scope 2025-06-08 00:06:52 +02:00
sina
664e84a14f
fixing compilation errors and add hyperevade callbacks 2025-06-07 23:57:04 +02:00
sina
872947677e
link hyperevade to hyperhv 2025-06-07 21:57:57 +02:00
sina
d74283bf99
fix compiling issue of hyperevade project 2025-06-07 21:11:51 +02:00
sina
afd5879bd2
move transparency functions to hyperevade 2025-06-07 20:17:05 +02:00
sina
29d9dc684e
fill the system-calls from user-mode 2025-06-07 00:09:27 +02:00
sina
1eb9606073
add dynamic system call numbers for transparent mode 2025-06-06 23:01:29 +02:00
Sina Karvandi
d0610661ba
Merge pull request #521 from CokeTree3/SysCall-transparency
Windows system call transparency
2025-06-06 22:01:04 +02:00
Sina Karvandi
5011062c95
Merge pull request #524 from HyperDbg/dev
Dev
2025-06-06 22:00:32 +02:00
sina
5d33cb7395
add function to get syscall number from current system 2025-06-06 21:54:55 +02:00
sina
04e3e1e6f5
update versioning and changelog 2025-06-04 20:10:20 +02:00
Sina Karvandi
646e535a2f
Merge pull request #522 from zuypt/sleep
Sleep
2025-06-04 18:16:59 +02:00
unknown
feea1057e2 add microsleep, rdtsc, rdtscp 2025-06-03 10:00:08 +02:00
unknown
0d5ee6ab60 implement microsleep function 2025-06-02 11:26:48 +02:00
CokeTree3
0f0bddea48
Merge branch 'HyperDbg:master' into SysCall-transparency 2025-05-30 12:57:06 +02:00
CokeTree3
c70152f916 Comment fix 2025-05-30 12:56:21 +02:00
CokeTree3
d44e2ff219 Small fix 2025-05-30 12:28:50 +02:00
CokeTree3
b86a2e2d64 Bugfixes and readability improvements 2025-05-30 12:26:30 +02:00
Sina Karvandi
80a434d49d
v0.13.2
Merge pull request #520 from HyperDbg/dev
2025-05-26 00:10:55 +02:00
sina
3887a2f2bd
edit CHANGELOG.md 2025-05-26 00:09:05 +02:00
sina
b77a42d761
Fixed VMCS layout corruption due to NMI injection on Meteor Lake 2025-05-24 06:26:28 +02:00
CokeTree3
b6e52d6d77 Added a per transparency mode execution, genuine vendor string randomization 2025-05-17 15:04:04 +02:00
CokeTree3
269c503863 Memory managment and variable name improvements 2025-05-16 18:02:26 +02:00
CokeTree3
84ad024f9b NtQueryValueKey and NtEnumerateKey syscall transparent mitigations 2025-05-16 17:42:52 +02:00
CokeTree3
d11f3934cb Registry access related systemcall transparency 2025-05-10 22:14:26 +02:00
CokeTree3
cc8d49cf94 File access related systemcall transparent mitigations 2025-05-09 20:47:11 +02:00
CokeTree3
0dc676b3d5 NtQueryAttributesFile and NtOpenDirectoryObject system call handling 2025-05-07 12:06:04 +02:00
CokeTree3
80820e21d3 Syscall NtQuerySystemInformation transparency 2025-05-06 17:16:45 +02:00
CokeTree3
a443283a71 SystemCall handler hooking 2025-05-04 20:50:34 +02:00
Sina Karvandi
2cc3da3dae
Merge pull request #518 from CokeTree3/MSR-transparency
MSR transparency features
2025-05-04 18:12:22 +02:00
sina
0512b40ed1
add optional parameters for the transparent mode syscalls 2025-05-04 13:41:07 +02:00
sina
8102503c7d
add hyperevade project 2025-05-04 13:00:53 +02:00
Sina Karvandi
88b561c05f
Merge pull request #517 from HyperDbg/sysret-interception-transparent-mode
Sysret interception for the transparent mode
2025-04-30 20:54:39 +02:00
sina
a8e3cf55e1
add context to the syscall interceptor 2025-04-30 20:52:04 +02:00
sina
b9433b3b33
set trap flags for the syscall in the transparent mode 2025-04-30 19:47:58 +02:00
CokeTree3
45da065bf6 MSR read and write handling in transparency mode 2025-04-28 11:56:48 +02:00
sina
021af26ded
restore constant memory callstack 2025-04-21 19:59:01 +02:00
sina
be6b055b83
Set variable length (stack frames) for showing the callstack 2025-04-21 19:54:24 +02:00
Sina Karvandi
6a1da349ef
v0.13.1
Merge pull request #516 from HyperDbg/dev
2025-04-14 01:10:49 +02:00
sina
8b4103a1ef
add updated details of CHANGELOG and README 2025-04-14 01:08:51 +02:00
Sina Karvandi
56c2d400fd
Merge pull request #515 from CokeTree3/CPUID-transparency
CPUID transparency features
2025-04-12 01:24:22 +02:00
CokeTree3
1037583fd4 added CPUID instruction handling in transparency mode 2025-04-11 19:40:32 +02:00
Sina Karvandi
5cac106321
Merge pull request #510 from Tumpes/master
fix .thread crash
2025-03-28 14:54:59 +01:00
Tumpes
1b64969ba9 fix .thread crash 2025-03-25 21:09:38 +02:00
Sina Karvandi
61dc1a115c
Update .clang-format format file 2025-03-19 21:19:02 +01:00
sina
cca2b3e96b update contributions list 2025-02-25 13:57:04 +01:00
Sina Karvandi
1a5c316ba6
v0.13
## [0.13.0.0] - 2025-02-25
New release of the HyperDbg Debugger.

### Added
- Added mitigation for the anti-hypervisor method in handling the trap flag for emulated instructions ([link](https://github.com/HyperDbg/HyperDbg/pull/497))
- Export the SDK functions for enabling and disabling transparent mode ([link](https://docs.hyperdbg.org/commands/extension-commands/hide#sdk))([link](https://docs.hyperdbg.org/commands/extension-commands/unhide#sdk))
- New description of changing script engine constants ([link](https://docs.hyperdbg.org/tips-and-tricks/misc/customize-build/change-script-engine-limitations))
- Added the command for interpreting PCI CAM (PCI configuration space) fields ([link](https://docs.hyperdbg.org/commands/extension-commands/pcicam))
- Added the command for dumping PCI CAM (PCI configuration space) memory ([link](https://docs.hyperdbg.org/commands/extension-commands/pcicam))
- Checking for and unloading the older version of the driver (if it exists) ([link](https://github.com/HyperDbg/HyperDbg/pull/503))
- **memcpy_pa()** function in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/functions/memory/memcpy_pa))
- **poi_pa**, **hi_pa**, **low_pa**, **db_pa**, **dd_pa**, **dw_pa**, and **dq_pa** keywords in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/assumptions-and-evaluations#keywords))
- **eb_pa**, **ed_pa**, and **eq_pa** functions in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/functions/memory/eb_pa-ed_pa-eq_pa))

### Changed
- Fix the 'lm' command issue of not showing kernel module addresses (KASLR leak mitigation) introduced in Windows 11 24h2 ([link](https://docs.hyperdbg.org/commands/debugging-commands/lm))
- Deprecated TSC mitigation for the transparent mode ([link](https://docs.hyperdbg.org/commands/extension-commands/measure))
- Changed the parameters of the '!hide' command ([link](https://docs.hyperdbg.org/commands/extension-commands/hide))
- Changed the parameters of the '!unhide' command ([link](https://docs.hyperdbg.org/commands/extension-commands/unhide))
- Fix containing backslash escape character in script strings ([link](https://github.com/HyperDbg/HyperDbg/pull/499))
- Fix reading/writing into devices' physical memory (MMIO region) in VMI Mode ([link](https://github.com/HyperDbg/HyperDbg/pull/500))
- All test cases for command parsing are now passed ([link](https://github.com/HyperDbg/HyperDbg/pull/504))
- The '.sympath' command now requires the symbol server path to be within quotes, although it is not mandatory ([link](https://docs.hyperdbg.org/commands/meta-commands/.sympath))
2025-02-25 09:16:58 +01:00
sina
289cd60f23 add base files for the MMIO shadowing implementation 2025-02-25 01:41:14 +01:00
sina
460b982790 modify changelog for v0.13 2025-02-24 15:05:18 +01:00
Björn Ruytenberg
0f7a167315
Merge pull request #508 from HyperDbg/add-pcie-support
Add pcicam command
2025-02-23 21:03:33 +01:00
Björn Ruytenberg
29cf8e8839 pcicam: Disable querying for BAR sizes
The current method for determining BAR sizes appears to generate unreliable results. For now, do not query devices for BAR sizes.
2025-02-23 20:55:07 +01:00
sina
551cc452d9 add new keywords to the script engine 2025-02-20 17:45:21 +01:00
Sina Karvandi
480abb916b
Merge pull request #506 from HyperDbg/physical-mem-script-funcs
Physical mem script funcs
2025-02-20 17:33:09 +01:00
sina
78812c66d3 add eq_pa, ed_pa, and eb_pa functions 2025-02-20 16:16:23 +01:00
sina
89fc0b996e add memcpy_pa for physical addresses 2025-02-20 15:48:22 +01:00
sina
6741855d24 add poi_pa hi_pa low_pa db_pa dd_pa dw_pa dq_pa keywords 2025-02-20 15:31:03 +01:00
sina
603cc6806f update PCI CAM extension command 2025-02-16 22:46:42 +01:00
sina
d4466552b0 support the .sympath command symbols server within quotes 2025-02-15 21:45:55 +01:00
sina
aca0f7242c add link test for the symbol parser 2025-02-15 20:44:27 +01:00
Sina Karvandi
5247ea3ce1
Merge pull request #505 from HyperDbg/parserAllTstFix
fix code format
2025-02-15 20:31:47 +01:00
Abbas-MG
b5702a60bf fix code format 2025-02-15 22:54:42 +03:30
Sina Karvandi
5da7ba0222
Merge pull request #504 from HyperDbg/parserAllTstFix
Parser all tst fix
2025-02-15 20:05:26 +01:00
Abbas-MG
cbb0832ad6 fixes - +1 tst 2025-02-15 22:23:11 +03:30
Abbas-MG
07486f4a96 fix parser fatal bugs 2025-02-15 22:22:01 +03:30
Sina Karvandi
48f8767fe0
Merge pull request #503 from HyperDbg/fix-24h2-issues
Fix 24h2 issues
2025-02-15 18:28:07 +01:00
sina
62e9606db1 removing the old instance of driver upon loading 2025-02-15 18:27:02 +01:00
sina
1a1e620b68 fix the logging issue for the MSR reads and writes and interrupt logging 2025-02-14 19:13:12 +01:00
sina
5c92dca212 add logging mechanism for RDMSR and WRMSR 2025-02-14 16:48:32 +01:00
sina
4ed399e2d6 fix the merging issues (compile error) and updating CHANGELOG.md 2025-02-13 17:28:09 +01:00
Sina Karvandi
64d3e8fb3d
Merge pull request #502 from HyperDbg/add-pcie-support
Add pcie support
2025-02-13 17:14:13 +01:00
Sina Karvandi
ee17e49bfc
Merge branch 'dev' into add-pcie-support 2025-02-13 17:13:19 +01:00
Sina Karvandi
e0497fc621
Merge pull request #501 from HyperDbg/read-device-physical-mem
Fix: Read/write devices' physical memory
2025-02-13 16:58:21 +01:00
sina
61a0ae4553 fix the issue of reading and writing device memory 2025-02-13 16:13:00 +01:00
Sina Karvandi
8682b3c218
Merge pull request #500 from HyperDbg/mmio-mem-read
Mmio mem read
2025-02-13 13:31:53 +01:00
Björn Ruytenberg
d1fe27763d pcicam: Do not skip subsequent BARs when encountering zero-sized BARs 2025-02-10 16:20:32 +01:00
Björn Ruytenberg
7ba93f08da pcicam: Rename parameter for hexadecimal dump 2025-02-10 14:51:32 +01:00
Björn Ruytenberg
ccc8b4dfd7 pcicam: Fix examples in help message 2025-02-10 14:47:54 +01:00
Björn Ruytenberg
835f4aedb7 pcicam: Disable command decoding when querying for BAR sizes 2025-02-10 14:06:22 +01:00
Björn Ruytenberg
53af89f2e8 pcicam: Fix passing wrong data structure in VMI mode 2025-02-10 14:02:42 +01:00
Björn Ruytenberg
dfe38377f6 Partially revert "add alias for the pci cam command"
This reverts commit d8c09d38bb.
2025-02-10 13:54:44 +01:00
SinaKarvandi
d8c09d38bb add alias for the pci cam command 2025-02-09 01:55:03 +01:00
SinaKarvandi
d24dea8643 Merge branch 'dev' of https://github.com/HyperDbg/HyperDbg into dev 2025-02-04 10:23:16 +01:00
SinaKarvandi
fe468e27bb update changelog.md 2025-02-04 10:22:42 +01:00
Sina Karvandi
29d1143258
Merge pull request #499 from HyperDbg/bkSlashFix
update parser
2025-02-03 23:43:32 +01:00
Abbas-MG
0e823a9b3c update parser 2025-02-04 01:55:21 +03:30
Björn Ruytenberg
bdb2583383 pcicam: Add support for Bridge header type; add initial support for determining BARs and their sizes 2025-01-27 16:14:43 +01:00
SinaKarvandi
b7b2b303d8 add new description for changing script engine constants 2025-01-25 18:37:54 +01:00
Sina Karvandi
b2b106e456
Merge pull request #498 from HyperDbg/modify-transparent-mode
Modify transparent mode
2025-01-25 16:40:10 +01:00
SinaKarvandi
43540dc35d export SDK APIs for the transparent mode 2025-01-25 16:38:46 +01:00
SinaKarvandi
36c0302c12 fix removing the trace of the hide 2025-01-25 16:03:03 +01:00
SinaKarvandi
bea9ae7a93 modify the hide and unhide command 2025-01-25 02:15:21 +01:00
Sina Karvandi
5a0ad03a0f
Merge pull request #497 from Shtan7/master
Add handling of the trap flag for emulated instructions.
2025-01-25 00:23:47 +01:00
Shtan7
61567d1ab5 Add handling of the trap flag for emulated instructions. 2025-01-23 23:56:59 +03:00
Sina Karvandi
a32859070f
Merge pull request #496 from halbGefressen/dev
Update C++ standard to C++20
2025-01-19 21:11:36 +01:00
Christian Zimmerer
bb8db803b6 Update C++ standard to C++20 2025-01-17 21:28:13 +01:00
Sina Karvandi
f01fe000f1
Merge pull request #495 from halbGefressen/dev
Fix argument parsing for attach command
2025-01-17 20:25:23 +01:00
Christian Zimmerer
d81876b91c Fix argument parsing for attach command 2025-01-17 20:06:09 +01:00
Björn Ruytenberg
0931ecb47d pcicam: Add initial support for dumping PCI config space (CAM) 2025-01-14 14:55:01 +01:00
Sina Karvandi
e56ed0ea8b
Merge pull request #493 from HyperDbg/fix-symbol-24h2
Fix symbol 24h2
2025-01-09 16:27:35 +01:00
SinaKarvandi
0afc582010 not setting debug privilege if it is already available 2025-01-09 16:25:45 +01:00
SinaKarvandi
4ec60c3bed fix passing module to the lm command 2025-01-09 01:13:42 +01:00
SinaKarvandi
74af42897f use debug privilege to fix symbol issue on 24h2 2025-01-08 23:39:49 +01:00
Sina Karvandi
136ba94c29
v0.12
Merge pull request #492 from HyperDbg/dev
2025-01-02 18:23:29 +01:00
SinaKarvandi
4e226423f1 edit CHANGELOG and README 2025-01-02 18:21:12 +01:00
SinaKarvandi
5de9c90a4e update Microsoft DIA SDK and symsrv 2024-12-30 05:23:15 +01:00
SinaKarvandi
0bb3398b30 move the idt query functions from debugger to hypervisor 2024-12-30 05:04:07 +01:00
SinaKarvandi
46876dd0b9 reloacte interrupt descriptor structure 2024-12-30 04:43:43 +01:00
SinaKarvandi
23702ca4f1 add query IDT command 2024-12-30 04:37:15 +01:00
SinaKarvandi
dc9496749a update CHANGELOG.md 2024-12-30 01:16:24 +01:00
Sina Karvandi
fd79e785ae
Merge pull request #491 from Shtan7/pull_request_branch
add proper handling for the xsetbv vmexit
2024-12-29 21:41:26 +01:00
Shtan7
c5ff96beea add proper handling for the xsetbv vmexit 2024-12-29 19:31:29 +03:00
SinaKarvandi
5ed68999e7 update changelog and refactor codes 2024-12-25 23:43:21 +01:00
Sina Karvandi
24969182f7
Merge pull request #490 from binophism/master
Fix: OOB(linear buffer overflow) write fixed
2024-12-25 23:24:13 +01:00
binophism
f77e99001b Fix: OOB(linear buffer overflow) write fixed 2024-12-25 21:47:29 +03:30
Sina Karvandi
a8adba6ea9
Merge pull request #489 from Reodus/master
Fix: replaced sprintf with sprintf_s to improve safety
2024-12-23 12:24:32 +01:00
reo
6497cc7dce Fix: replaced sprintf with sprintf_s to improve safety 2024-12-23 01:18:48 +03:30
SinaKarvandi
a93d639a78 fix PCI CAM reading offset 2024-12-11 18:18:29 +01:00
SinaKarvandi
a86d36b781 fix pci tree command error in VMI mode 2024-12-11 15:43:41 +01:00
Björn Ruytenberg
454a753173
Merge pull request #487 from HyperDbg/add-pcie-support
pcitree: Enforce bounds in parsing PCI EP names
2024-12-11 12:14:32 +01:00
Björn Ruytenberg
76c8cfe2d5 pcitree: Enforce bounds in parsing PCI EP names 2024-12-11 12:13:13 +01:00
SinaKarvandi
f8a3b0d547 add command to copy pci ids 2024-12-11 11:58:10 +01:00
Sina Karvandi
6360ec407e
Merge pull request #486 from HyperDbg/add-pcie-support
Add pcitree command
2024-12-10 16:15:00 +01:00
Björn Ruytenberg
02329af88e pcitree: Remove redundant log calls 2024-12-10 16:07:21 +01:00
Björn Ruytenberg
3a56de4a14 pcitree: Look up PCI IDs using pciutils PCI ID database 2024-12-10 16:04:06 +01:00
Sina Karvandi
0ef4883630
v0.11
Merge pull request #485 from HyperDbg/dev
2024-12-03 15:53:56 +01:00
SinaKarvandi
104960b69a update changelog for v0.11 2024-12-03 15:44:57 +01:00
Björn Ruytenberg
453dff9ac4 Merge branch 'dev' into add-pcie-support 2024-12-02 15:49:27 +01:00
SinaKarvandi
1ebe1ada38 change and add links for increasing communication buffer size and EPT hooks in a single page 2024-11-27 14:16:41 +01:00
SinaKarvandi
b7043b48ae Add IDT Entries interpreter 2024-11-26 11:44:06 +01:00
SinaKarvandi
62535c94da fix overflow error in showing interrupt entries 2024-11-20 15:39:21 +01:00
SinaKarvandi
13befcfa00 fix interrupt redirection issues 2024-11-20 14:44:03 +01:00
SinaKarvandi
bb9c4e30d7 add support for IO APIC 2024-11-19 13:56:22 +01:00
Björn Ruytenberg
29071cad41 pcitree: Send PCI device tree in one flattened buffer. Add EP Class Code and remove BDF probing limits. 2024-11-17 21:01:03 +01:00
Björn Ruytenberg
e714e3e6ad Fix typo 2024-11-17 18:50:22 +01:00
Björn Ruytenberg
9fb0360384 pcitree: Add initial version. Enumerates all PCIe EP's VID-DIDs. 2024-11-17 15:33:10 +01:00
Björn Ruytenberg
e9d6b9bf69 Merge branch 'dev' into add-pcie-support 2024-11-17 15:20:49 +01:00
SinaKarvandi
98d498ced1 fix typo in merge conflicts 2024-11-12 19:23:47 +01:00
Björn Ruytenberg
2b67727bc5
Merge pull request #484 from HyperDbg/add-pcie-support
Add pcitree command(WIP)
2024-11-12 19:19:11 +01:00
Björn Ruytenberg
14a679a8dc
Merge branch 'dev' into add-pcie-support 2024-11-12 19:18:52 +01:00
Björn Ruytenberg
f0123c8790 pcitree: Initial work to add pcitree command 2024-11-12 19:14:48 +01:00
Sina Karvandi
f0c917e4d3
Merge pull request #483 from HyperDbg/io-apic-support
read and dump IO APIC entries
2024-11-12 14:39:41 +01:00
SinaKarvandi
13d3efa3a4 read and dump IO APIC entries 2024-11-10 19:16:32 +01:00
Sina Karvandi
20f3ebd931
Merge pull request #482 from HyperDbg/apic-support
Apic support
2024-11-09 17:04:56 +01:00
SinaKarvandi
a6c6c88d05 show different APIC modes (x2apic or xapic) 2024-11-09 15:08:32 +01:00
SinaKarvandi
e3d8b6d980 add SDK api for reading local apic 2024-11-09 00:12:34 +01:00
SinaKarvandi
851375ec15 add local apic command 2024-11-08 21:00:21 +01:00
SinaKarvandi
f09fc83643 store APIC fields in user-mode constructed structures 2024-11-08 18:46:52 +01:00
SinaKarvandi
a73b6d66f2 refactor APIC support codes 2024-11-08 15:54:02 +01:00
SinaKarvandi
ac87707a0b add support to read Local APIC in xAPIC and x2APIC modes 2024-11-08 15:14:12 +01:00
Björn Ruytenberg
7d1cd99828 Fix formatting 2024-11-08 14:49:03 +01:00
Sina Karvandi
63f620e00a
v0.10.2
Merge pull request #480 from HyperDbg/dev
2024-10-11 13:10:59 +02:00
SinaKarvandi
3b88940f4f release v0.10.2 2024-10-11 13:07:19 +02:00
SinaKarvandi
fe03871381 update CHANGELOG 2024-10-06 15:27:26 +02:00
Sina Karvandi
8fc23d0936
Merge pull request #479 from ZhouZiY/dev
fix compatibility mode program crash when terminate vm
2024-10-06 12:29:29 +02:00
Y
536fd900f7 fix compatibility mode program crash when terminate vm 2024-10-06 18:07:22 +08:00
SinaKarvandi
fe97da65b7 interpret local hwdbg scripts 2024-10-02 18:00:34 +02:00
SinaKarvandi
595a78f776 add automated script compilation 2024-10-02 15:04:02 +02:00
SinaKarvandi
49c18bb118 export hwdbg testing functions 2024-10-01 13:47:46 +02:00
Sina Karvandi
af01f42788
Merge pull request #478 from HyperDbg/parser-Comment-fix_2
Parser fix
2024-09-30 21:08:27 +02:00
Abbas-MG
3adbd7b57b
Merge branch 'dev' into parser-Comment-fix_2 2024-09-30 22:37:16 +03:30
Abbas-MG
96ba6544fa few parser fixes rmv 3 cmd cases 2024-09-30 21:32:40 +03:30
SinaKarvandi
b5097b1893 add hw extension command 2024-09-30 17:25:12 +02:00
Abbas-MG
5069b69b0c some parser fixes 2024-09-30 16:46:58 +03:30
Abbas-MG
0487556985 some parser fixes 2024-09-30 16:46:58 +03:30
Abbas-MG
490b2b4657 modified to cope with Trim() 2024-09-30 16:46:58 +03:30
SinaKarvandi
f848fc0b08 create separate functions for hwdbg interpreter and script manager 2024-09-30 15:15:18 +02:00
SinaKarvandi
0ef0c5e451 refactor chip instance info interpretation codes 2024-09-30 14:28:42 +02:00
SinaKarvandi
f051c778dc refactor hwdbg buffer interpretation and writing codes 2024-09-27 16:31:29 +02:00
SinaKarvandi
35ca575bfd fix runtime error for deallocating memory from separate DLLs 2024-09-27 14:32:03 +02:00
Sina Karvandi
a336ad80e0
Merge pull request #477 from xmaple555/dev
update symbol and token structure in script-engine
2024-09-26 22:59:32 +02:00
xmaple555
1df3163ba7 update symbol and token strcture in script-engine 2024-09-27 04:48:43 +08:00
xmaple555
8799c84345 update token strcture in script-engine 2024-09-27 04:38:23 +08:00
SinaKarvandi
f49f92f872 change the showing message function of hardware scripts 2024-09-26 12:53:52 +02:00
SinaKarvandi
1de311647c export ShowMessages to the script engine 2024-09-26 12:44:24 +02:00
SinaKarvandi
dcb3f50bae change import exports from the symbol parser 2024-09-25 17:13:47 +02:00
SinaKarvandi
f3321dc62d unified script engine imported and exported functions 2024-09-25 16:27:42 +02:00
SinaKarvandi
34561c8d36 rename parsing functions 2024-09-25 14:26:17 +02:00
SinaKarvandi
2ed0918c97 Merge branch 'dev' of https://github.com/HyperDbg/HyperDbg into dev 2024-09-25 14:13:25 +02:00
SinaKarvandi
e5f9e31f8c computer number of flip-flops in a new functions 2024-09-25 14:13:08 +02:00
Sina Karvandi
c6e5d638c0 implementation of JSON config reader 2024-09-19 17:43:47 +02:00
Sina Karvandi
5466d182e1 create json representation of hwdbg configs 2024-09-19 16:09:39 +02:00
SinaKarvandi
1dfe98603d add plain SV test for DUT 2024-09-18 18:57:31 +02:00
Sina Karvandi
27a108873b apply the implementation of stack assignments 2024-09-18 17:32:08 +02:00
SinaKarvandi
eb3ba5de6b update script buffer for stack assignments 2024-09-18 17:04:08 +02:00
SinaKarvandi
1ae683af48 add script generation support for stack assignment 2024-09-18 16:53:40 +02:00
SinaKarvandi
814bb78ff6 Merge branch 'dev' of https://github.com/HyperDbg/HyperDbg into dev 2024-09-18 16:52:27 +02:00
Sina Karvandi
8f546c4374 add support for stack assignment 2024-09-18 16:49:16 +02:00
Sina Karvandi
308cf3967d avoid passing signals once stage is not configured 2024-09-18 13:50:32 +02:00
Sina Karvandi
38f7e747d6
Merge pull request #475 from HyperDbg/change-artifact-uploader-version
Update vs2022.yml
2024-09-08 15:26:44 +02:00
Sina Karvandi
636ef473ee
Update vs2022.yml 2024-09-08 15:26:24 +02:00
Sina Karvandi
a9c25ad7a2
v0.10.1
Merge pull request #474 from HyperDbg/dev
2024-09-08 15:05:42 +02:00
SinaKarvandi
6949a85e3b finalize changelog for v0.10.1 2024-09-08 15:01:52 +02:00
sina
e926e3edb1 add SKD APIs for tracing, tracking, and instrumenting instructions 2024-09-06 12:42:55 +02:00
sina
153fd64ef9 fix the problem with interpreting url as comment in the parser 2024-09-05 17:53:48 +02:00
sina
418f375ba0 Fix miscomputation of physical address width for physical address validity checks (#469) 2024-09-05 15:44:40 +02:00
Sina Karvandi
37c463b23e
Merge pull request #473 from HyperDbg/dependabot/github_actions/dot-github/workflows/actions/download-artifact-4.1.7
Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows
2024-09-05 13:22:03 +02:00
dependabot[bot]
e61b9abbde
Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.1.7.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4.1.7)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-03 22:29:50 +00:00
Sina Karvandi
886537ef87
Merge pull request #466 from HyperDbg/parser-Comment-fix_2
Parser and its test case fix
2024-08-24 09:04:55 -07:00
Abbas-MG
9cd1330e14 fix additional test cases and their pertaining code 2024-08-24 19:16:33 +03:30
Abbas-MG
cce5dd33bb new way of handling newLine and block comments 2024-08-24 16:45:32 +03:30
Abbas-MG
6ec8754db4 fix bugged testCases 2024-08-24 16:45:32 +03:30
Abbas-MG
6af7adfd21 testCase txt file fix 2024-08-24 16:45:32 +03:30
Abbas-MG
0915c09419 escaped newline bug fix 2024-08-24 16:45:32 +03:30
Abbas-MG
cb575a6624 escaped newline is now handled correctly 2024-08-24 16:45:32 +03:30
Abbas-MG
b5d6551165 fix newLine (\n) parse 2024-08-24 16:45:31 +03:30
Abbas-MG
7f248d3067 improved PrintToken(); now it prints in aligned columns 2024-08-24 16:45:31 +03:30
xmaple555
211295bf81 update symbol structure and stack buffer in script engine 2024-08-23 22:33:36 +08:00
Sina Karvandi
d517b1bb48
Merge pull request #465 from xmaple555/dev
update multiple assignment in script engine
2024-08-22 18:21:52 -07:00
xmaple555
8edd118a40 update multiple assignment in script engine 2024-08-23 04:10:11 +08:00
SinaKarvandi
0b404c61ae add real-world command parser test cases 2024-08-22 20:19:16 +09:00
Sina Karvandi
e686276cdc
Merge pull request #464 from xmaple555/dev
Update script engine
2024-08-21 09:58:52 -07:00
xmaple555
ba0f017dc2 remove global variable idtable 2024-08-22 00:45:09 +08:00
xmaple555
16c60bbe7e add assignment operator in script-engine 2024-08-22 00:30:23 +08:00
SinaKarvandi
b5383aa0d7 read physical memory through VMCALL 2024-08-21 20:31:29 +09:00
SinaKarvandi
4b41b42d6c use MmMapIoSpaceEx for reading MMIO physical memory 2024-08-21 19:28:38 +09:00
Sina Karvandi
c35df1f06c
Merge pull request #463 from HyperDbg/parser-Comment-fix
Parser comment fix
2024-08-21 01:01:10 -07:00
SinaKarvandi
c0bc6a93bb add a combination of strings and comment test cases 2024-08-21 16:10:03 +09:00
Sina Karvandi
498df5c38b
Merge pull request #462 from xmaple555/dev
update script-engine
2024-08-20 21:09:39 -07:00
Abbas-MG
9a7db27357 testcase txt file fix wrong command order expectation 2024-08-21 01:04:32 +03:30
Abbas-MG
49877c680a fix adjacent { 2024-08-21 00:56:08 +03:30
Abbas-MG
deb49b86fb testcase txt file typo? 2024-08-21 00:16:33 +03:30
Abbas-MG
bba0914d77 single line comment at end of string fixed 2024-08-21 00:14:19 +03:30
xmaple555
8435ca4e7f Merge branch 'mydev' into dev 2024-08-21 03:54:04 +08:00
xmaple555
b05414a171 update user-defined function for boolean parser 2024-08-21 03:42:03 +08:00
sina
a1ef3e8808 add main command parser testcases with comments 2024-08-21 03:35:22 +09:00
SinaKarvandi
6d91391d68 update changelog 2024-08-20 15:01:31 +09:00
Sina Karvandi
2ec1af86ac
Merge pull request #461 from xmaple555/dev
Dev
2024-08-20 03:10:50 +09:00
xmaple555
03401a7fbd update script-engine 2024-08-20 01:59:17 +08:00
Behrooz Abbassi
27359df8fa
Fix script-engine-test submodule bug
Remove the script-engine-test from incorrect path
2024-08-19 09:07:14 -07:00
SinaKarvandi
c07377e1ee fix .gitmodule missing submodule 2024-08-19 18:40:41 +09:00
SinaKarvandi
ac10080690 fix broken submodule 2024-08-19 18:29:15 +09:00
SinaKarvandi
98ce42da79 fix building issue for different submodule URL 2024-08-19 18:25:44 +09:00
SinaKarvandi
56fa031cdd show the position of failed testcases 2024-08-19 18:24:08 +09:00
Sina Karvandi
b9a8f755e3
Merge pull request #460 from HyperDbg/integrate-new-parser
Integrate new parser
2024-08-19 15:46:40 +09:00
Sina Karvandi
1422c5f8dc
Merge branch 'dev' into integrate-new-parser 2024-08-19 14:54:56 +09:00
SinaKarvandi
e7627aca9c add updated test script submodule 2024-08-19 14:53:23 +09:00
SinaKarvandi
83583bf56c remove script test submoudle 2024-08-19 14:51:30 +09:00
Sina Karvandi
555ced3cd3
Merge pull request #459 from HyperDbg/integrate-new-parser-newTestsFix
all test cases (73) passed
2024-08-19 13:03:22 +09:00
Abbas-MG
ad28eca220 first 73 tests passed 2024-08-19 07:27:42 +03:30
Abbas-MG
7671884c62 applied some parser fixes 2024-08-19 05:10:26 +03:30
Sina Karvandi
56bff45026
Merge pull request #456 from Sal3h/dev
added initial sensor sources
2024-08-18 01:21:00 +09:00
Monfared
249e2468fd added initial sensor sources 2024-08-17 12:15:27 -04:00
SinaKarvandi
e23178b6d9 move failed test cases to the main testing test cases 2024-08-18 00:24:58 +09:00
Sina Karvandi
f9997fcb70
Merge pull request #455 from HyperDbg/integrate-new-parser-newlineFix
Integrate new parser fix
2024-08-17 21:22:10 +09:00
Abbas-MG
fc323db3d9 Merge branch 'integrate-new-parser' of https://github.com/HyperDbg/HyperDbg into integrate-new-parser-newlineFix 2024-08-16 14:51:14 +03:30
Abbas-MG
7ce9991a4a cleanupInterpreter 2024-08-16 14:50:35 +03:30
SinaKarvandi
31ff2bb714 add support to pause debugger at startup 2024-08-16 18:59:56 +09:00
SinaKarvandi
7b91f3ca3e make general automated test cases for the semantic scripts 2024-08-16 17:13:13 +09:00
SinaKarvandi
16203a41a0 adjust automatic script semantic tests 2024-08-16 16:57:43 +09:00
SinaKarvandi
0e25c5b617 add automatic connection to remote system for semantic script test cases 2024-08-16 16:14:52 +09:00
Abbas-MG
04bb555318 nestedStringFix 2024-08-16 03:58:31 +03:30
SinaKarvandi
1860612659 add more failed test cases 2024-08-15 19:46:49 +09:00
SinaKarvandi
0841b63862 add remove passed test cases from the failed list 2024-08-15 14:33:41 +09:00
Sina Karvandi
a998f0ab91
Merge pull request #454 from HyperDbg/integrate-new-parser-nestedFix
parser nested blocks fix
2024-08-15 14:25:55 +09:00
Abbas-MG
95ffeef9bf IdxBracket var fix 2024-08-15 08:50:18 +03:30
SinaKarvandi
c30b8a42aa export SDK API closing connection to the remote debuggee 2024-08-15 14:14:28 +09:00
Abbas-MG
85b0bdb221 nested {} fix 2024-08-15 08:35:23 +03:30
SinaKarvandi
6dcfcad875 fix memcpy issue on the script engine 2024-08-14 18:36:55 +09:00
Sina Karvandi
9deeecfeea
Update CONTRIBUTING.md 2024-08-14 14:12:53 +09:00
SinaKarvandi
f3cc9dbdfe add more command parser testcases 2024-08-14 14:02:52 +09:00
Sina Karvandi
ce9f83ad5c
Merge pull request #452 from HyperDbg/integrate-new-parser-fix
fix adjacent { bug
2024-08-14 12:35:26 +09:00
Abbas-MG
e35635f0e0 fix adjacent { bug 2024-08-13 21:46:26 +03:30
SinaKarvandi
00fd5391fe add more test cases for the command parser 2024-08-13 19:46:37 +09:00
SinaKarvandi
8caea1fb77 run command test case tester from the test command 2024-08-13 19:31:02 +09:00
SinaKarvandi
22e8d82452 add automated test case tester for command parser 2024-08-13 18:50:14 +09:00
SinaKarvandi
a747d56751 make parsing infrastructure for automated testing 2024-08-11 19:42:58 +09:00
SinaKarvandi
cf20290ab3 trim strings and beautify showing tokens in new command parser 2024-08-11 17:34:44 +09:00
SinaKarvandi
02c9b97505 add fixed issues to the changelog 2024-08-10 23:25:18 +09:00
SinaKarvandi
8c45148271 fix integration tokens for the new parser 2024-08-10 23:11:59 +09:00
SinaKarvandi
0fe90f5a7b integrate new parser with the .script command 2024-08-10 22:30:05 +09:00
SinaKarvandi
c84408924c integrate new parser with the .start command 2024-08-10 22:22:03 +09:00
SinaKarvandi
acae1d3a41 add support to path for the struct command 2024-08-10 21:21:23 +09:00
SinaKarvandi
b7725a769e add new parser to debug, output and assembly commands 2024-08-10 20:06:26 +09:00
SinaKarvandi
ceb12f842f change parser of hide and settings commands 2024-08-10 18:23:40 +09:00
SinaKarvandi
c3e4596d01 integrate dump command with new parser 2024-08-10 17:04:46 +09:00
SinaKarvandi
417eaeaf3c add new CMAKE for pdbex 2024-08-07 17:06:48 +09:00
SinaKarvandi
91a480c12b update (remove) pdbex 2024-08-07 17:04:44 +09:00
Sina Karvandi
2b32b4d771
Merge pull request #449 from ddkwork/dev
fix cmake
2024-08-07 17:01:13 +09:00
Admin
2a2283de1d fix cmake 2024-08-07 14:58:16 +08:00
Sina Karvandi
d5a0e1238b
Merge pull request #446 from ddkwork/dev
hyperhv.dll build successfully.
2024-08-05 15:40:19 +09:00
Admin
a6fb5625cc hyperhv.dll build successfully. 2024-08-05 08:52:27 +08:00
Sina Karvandi
37e3221980
Merge pull request #445 from ddkwork/dev
fix cmake build work
2024-08-02 14:06:05 +09:00
Admin
c07fa0acb0 fix cmake build work 2024-08-02 05:19:45 +08:00
SinaKarvandi
787e79d713 add more commands to the new token parser 2024-07-31 19:49:52 +09:00
SinaKarvandi
2843332a1c change error message for initial commands 2024-07-31 18:21:23 +09:00
SinaKarvandi
a6b26c7e93 add second command argument to the tokenizer 2024-07-31 14:08:14 +09:00
SinaKarvandi
dcb9f44584 change showing parsed tokens 2024-07-30 20:16:05 +09:00
SinaKarvandi
4fc7d9d441 change code, condition and script parser 2024-07-30 19:38:50 +09:00
SinaKarvandi
5d9959cdf6 change event commands to new parser 2024-07-30 18:44:15 +09:00
SinaKarvandi
e1e4a13cf0 applying new parser to commands 8 2024-07-30 16:55:06 +09:00
SinaKarvandi
c878957cbb applying new parser to commands 7 2024-07-30 15:47:35 +09:00
SinaKarvandi
33b1ad5be5 applying new parser to commands 6 2024-07-30 15:07:17 +09:00
SinaKarvandi
000a9241fb applying new parser to commands 5 2024-07-30 14:17:06 +09:00
SinaKarvandi
760908f5e3 applying new parser to commands 4 2024-07-30 13:17:50 +09:00
SinaKarvandi
4c54c0c20b applying new parser to commands 3 2024-07-29 19:40:24 +09:00
SinaKarvandi
865111dd6a applying new parser to commands 2 2024-07-29 18:46:12 +09:00
SinaKarvandi
13c4355a16 applying new parser to commands 1 2024-07-29 18:06:54 +09:00
SinaKarvandi
cef8b27816 add new function types based on new tokenizer 2024-07-29 17:16:52 +09:00
SinaKarvandi
8099424b89 change token parser key value pairs to tuples 2024-07-29 16:24:39 +09:00
SinaKarvandi
328b906e31 print command tokens 2024-07-29 14:17:03 +09:00
Sina Karvandi
302c812b45
Update CONTRIBUTING.md 2024-07-29 13:13:23 +09:00
SinaKarvandi
a9ba979abc change SDK folders to lowercase 2024-07-28 20:42:48 +09:00
SinaKarvandi
5e26626f91 rename SDK folders 2024-07-28 19:55:51 +09:00
SinaKarvandi
1e3f8f385c create global SDK example directory for APIs 2024-07-28 19:44:53 +09:00
SinaKarvandi
6005722cc9 Export SDK API for assembling instructions 2024-07-28 18:10:54 +09:00
SinaKarvandi
f587313425 Implemented feature to pause the debuggee immediately upon connection 2024-07-28 16:57:28 +09:00
SinaKarvandi
602dd5d049 add modifications for the module in the event forwarding mechanism 2024-07-26 16:44:14 +09:00
SinaKarvandi
1e4e8fd6f0 add auto-pause after connecting to debuggee 2024-07-25 17:45:55 +09:00
SinaKarvandi
4e5c44d679 do not count SDK lines twice 2024-07-25 14:01:07 +09:00
xmaple555
f9ca713601 update script-engine 2 2024-07-25 01:52:58 +08:00
xmaple555
0aba9b5a1b update script-engine 1 2024-07-24 21:25:55 +08:00
Sina Karvandi
ceca0ae762
v0.10 (Updated contribution list + Added group links)
v0.10 (Updated contribution list + Added group links)
2024-07-23 20:46:30 +09:00
SinaKarvandi
ed081861a2 fix versioning issues 2024-07-23 20:45:17 +09:00
Sina Karvandi
a19e4b521c
Update README.md 2024-07-23 20:20:15 +09:00
Sina Karvandi
fab806d62f
Update CONTRIBUTING.md 2024-07-22 16:38:49 +09:00
Sina Karvandi
4d6a242a59
v0.10
Merge pull request #442 from HyperDbg/dev
2024-07-22 12:42:21 +09:00
SinaKarvandi
ff4fe10ffd create example for app and driver using libhyperdbg 2024-07-21 19:35:02 +09:00
SinaKarvandi
90da764d7e change message of breaking debugger in the VMI Mode 2024-07-21 17:41:40 +09:00
Sina Karvandi
647a7297ba
Merge pull request #441 from HyperDbg/revert-438-dev
Revert "update CMakeLists.txt and try to fix log callBack"
2024-07-21 17:11:53 +09:00
Sina Karvandi
699e911a25
Revert "update CMakeLists.txt and try to fix log callBack" 2024-07-21 17:11:41 +09:00
Sina Karvandi
dfa8fa3dc6
Merge pull request #438 from ddkwork/dev
update CMakeLists.txt and try to fix log callBack
2024-07-21 16:47:33 +09:00
SinaKarvandi
0001a09190 merge fixes to the assembler parser 2024-07-21 16:42:50 +09:00
SinaKarvandi
5106e440d1 adjust script limitation and VMX-root buffer size constants 2024-07-21 16:35:43 +09:00
Admin
13b1d2f57a must run log callBack 2024-07-21 07:22:22 +08:00
Admin
6ef4c4b58a update CMakeLists.txt and try to fix log callBack 2024-07-21 06:11:56 +08:00
Sina Karvandi
847466a2a5
Merge pull request #437 from HyperDbg/Abbas-MG-bugFix
parser and assembler bug fix
2024-07-21 03:45:28 +09:00
Abbas-MG
11d3031c99 BytesCount fixes 2024-07-20 20:47:19 +03:30
Abbas-MG
0c34aab9a8 0n parse fix 2024-07-20 20:35:11 +03:30
SinaKarvandi
481f103035 update command help messages 2024-07-20 22:05:39 +09:00
SinaKarvandi
4b16deae60 fix the computation error in asm code and asm condition buffers 2024-07-20 20:17:51 +09:00
SinaKarvandi
9291420cf8 fix minor issues with messages and line counter 2024-07-20 19:02:13 +09:00
Sina Karvandi
87ddbe1ba1
Merge pull request #435 from xmaple555/dev
Update the parser and the code execution.
2024-07-20 15:27:31 +09:00
xmaple555
37d6fc208b Merge remote-tracking branch 'origin-HyperDbg/dev' into dev 2024-07-20 11:59:04 +08:00
xmaple555
36b648eac6 update the user-defined function of the script-engine 2024-07-20 11:58:17 +08:00
xmaple555
a0abb047a8 add _SCRIPT_ENGINE_CODEEXEC_DBG_EN and stack buffer overflow check in script-engine 2024-07-19 19:17:46 +08:00
SinaKarvandi
8cdb4036b1 update event commands syntax 2024-07-19 17:03:43 +09:00
SinaKarvandi
9a8a6fef4b add warning message for clearing instant events 2024-07-19 14:05:52 +09:00
Sina Karvandi
98ebfaeb1e
Merge pull request #434 from HyperDbg/Abbas-MG-parser
parser and "0n" prefix
2024-07-19 13:14:33 +09:00
Abbas-MG
8bb2b6ae0c a line of test for parser 2024-07-18 21:59:24 +03:30
Abbas-MG
5ebce54a2f 0n prefix now interprets the number as decimal 2024-07-18 21:49:40 +03:30
Abbas-MG
4f35e6e2c0 improved parser class and moved into interpreter.cpp 2024-07-18 18:51:31 +03:30
SinaKarvandi
5e595f3418 init zero of set callback message SDK API 2024-07-18 16:45:42 +09:00
Abbas-MG
bcaa6bd282 syntax asm code - assert fail fix 2024-07-18 10:34:09 +03:30
SinaKarvandi
8e2491751e return shared buffer on set message callback 2024-07-18 15:59:30 +09:00
Abbas-MG
e8fe1bce74 added parser class 2024-07-18 10:07:09 +03:30
SinaKarvandi
33f44f25d0 Add message callback using shared memory 2024-07-18 13:12:30 +09:00
SinaKarvandi
25a912fbdb add unsetting text message callback 2024-07-18 12:51:53 +09:00
Sina Karvandi
25aca15604
Merge pull request #432 from HyperDbg/Abbas-MG-condtion-asm
made assembler a class - add "asm" to epthook's "condition" and "code"
2024-07-18 12:38:38 +09:00
Abbas-MG
901e906f54 made assembler a class - add asm to condition and code 2024-07-17 14:12:24 +03:30
SinaKarvandi
3eb34a91ed add syntax modification for the assembler 2024-07-15 13:52:39 +09:00
SinaKarvandi
d4b3640fd9 change asm convention 2024-07-15 11:50:33 +09:00
SinaKarvandi
9c0d233d73 update asm details 2024-07-15 10:44:10 +09:00
Sina Karvandi
9a5a393b18
Merge pull request #431 from HyperDbg/modify-asm
improved: asm parse - symbol parse - byte gen only
2024-07-15 10:41:15 +09:00
Abbas-MG
68217e932a improved: asm parse - symbol parse - byte gen only 2024-07-15 05:04:08 +03:30
SinaKarvandi
fe2e86abcb reorder keystone and zydis headers 2024-07-15 09:45:42 +09:00
SinaKarvandi
3304751e9b add keystone binaries 2024-07-14 18:30:35 +09:00
SinaKarvandi
0bfb36f195 add keystone libraries 2024-07-14 18:22:42 +09:00
Sina Karvandi
c5a10922f3
Merge pull request #427 from HyperDbg/Abbas-MG-patch-1
Update CREDITS.md
2024-07-14 14:30:48 +09:00
Abbas-MG
cd6311b9e8
Update CREDITS.md 2024-07-13 21:42:32 +03:30
Abbas-MG
2143c0a2f3 Merge branch 'dev' of https://github.com/HyperDbg/HyperDbg into dev 2024-07-13 20:21:53 +03:30
Abbas-MG
0192fd0222 add assemble command "a"
intel 64bit syntax tested. symbols are supported.
2024-07-13 20:20:52 +03:30
SinaKarvandi
22ffc4fab5 Fix the problem of repeating commands once kHyperDbg is disconnected 2024-07-13 22:35:09 +09:00
SinaKarvandi
15c94d0b0e Fix crash on editing invalid physical addresses (#424) 2024-07-13 20:16:13 +09:00
Sina Karvandi
9030ed96a3
Merge pull request #426 from HyperDbg/sdk-debug-and-start-process
Sdk debug and start process
2024-07-13 18:17:13 +09:00
SinaKarvandi
0df5c1b78f export start process SDK APIs 2024-07-13 18:14:52 +09:00
SinaKarvandi
c55dd4a2c1 add SDK API to debug remote device or from debuggee in the debugger mode 2024-07-12 19:51:00 +09:00
SinaKarvandi
8f1f0f2e74 add SDK API for getting the kernel base address 2024-07-12 18:25:34 +09:00
SinaKarvandi
0d8f62a3fc update readme 2024-07-12 17:54:19 +09:00
SinaKarvandi
a549ba6ef1 change pull request and issues templates 2024-07-12 14:54:41 +09:00
Sina Karvandi
865a506570
Merge pull request #419 from HyperDbg/edit-memory-api
Edit memory api
2024-07-10 21:01:24 +09:00
SinaKarvandi
139be97b81 fix memory writing sdk error 2024-07-10 21:00:23 +09:00
SinaKarvandi
25290cf2d7 export memory writing API SDK 2024-07-10 20:21:31 +09:00
SinaKarvandi
e30a5d6ce0 add external memory function with byte granularity 2024-07-10 20:13:31 +09:00
SinaKarvandi
6197407eb6 add unified memory editing API 2024-07-10 18:36:11 +09:00
SinaKarvandi
386b3e9a10 fix step-over hangs, if process is terminated (#406) 2024-07-10 15:37:45 +09:00
SinaKarvandi
c8113aa796 Fix triggering multiple monitor hooks with different contexts (#415) 2024-07-08 17:50:40 +09:00
SinaKarvandi
547415a9be fix path to the script common definition 2024-07-07 22:53:51 +09:00
Sina Karvandi
8c34277247
Merge pull request #416 from HyperDbg/register-api
Register SDK APIs
2024-07-07 22:24:24 +09:00
SinaKarvandi
5af1f2b653 export register reading/writing SDK APIs 2024-07-07 22:23:24 +09:00
SinaKarvandi
df50e0d866 export script definition to SDK 2024-07-07 22:07:45 +09:00
SinaKarvandi
7c3b7a68f9 add register writing function 2024-07-07 21:44:07 +09:00
SinaKarvandi
2d6f657d87 add reading register SDK API 2024-07-07 19:50:01 +09:00
Sina Karvandi
7f4d400f3f
Merge pull request #414 from HyperDbg/unified-read-write-mem
Unified read write mem
2024-07-06 22:47:29 +09:00
SinaKarvandi
5e298a853a export memory reading functions 2024-07-06 22:46:57 +09:00
SinaKarvandi
fb50598525 fix errors of reading memory in debugger mode 2024-07-06 22:02:22 +09:00
SinaKarvandi
556efd2bd3 add a unified memory reading function 2024-07-06 21:16:45 +09:00
SinaKarvandi
bfd6843211 remove merge DLL files 2024-07-05 21:08:27 +09:00
Sina Karvandi
9332cefea6
Merge pull request #412 from HyperDbg/fix-monitor-remove
Fix monitor remove (#409)
2024-07-05 21:01:06 +09:00
SinaKarvandi
800f59bb29 remove CMake backup file 2024-07-05 19:10:53 +09:00
SinaKarvandi
9a68be32c9 change the core file name 2024-07-05 18:50:51 +09:00
SinaKarvandi
a1d110b64a remove unsuccessful monitor events by hooking tag 2024-07-05 18:20:41 +09:00
SinaKarvandi
14f463e6eb fix unhooking monitor hooks on a different process or if the process is closed (#409) 2024-07-05 17:29:39 +09:00
Sina Karvandi
29c88e6266
Merge pull request #410 from HyperDbg/change-sdk
fix load vmm SDK exported function
2024-07-04 12:21:21 +09:00
SinaKarvandi
63d09b12f8 fix load vmm SDK exported function 2024-07-03 19:16:14 +09:00
Sina Karvandi
39ee2740df
Merge pull request #408 from ddkwork/dev
Genera cmake files
2024-07-01 20:15:44 +09:00
Admin
86ef7491d4 rename dlls dir 2024-07-01 19:11:25 +08:00
Admin
fbb04c4754 bump lib 2024-07-01 19:05:01 +08:00
Admin
94f22f37e5 kdserial is ok 2024-07-01 19:01:04 +08:00
Admin
2e2f848377 kdserial is ok 2024-07-01 19:01:04 +08:00
Admin
6ee313aeb6 kdserial is ok 2024-07-01 19:01:04 +08:00
Admin
6d6b4388ed how to use 2024-07-01 19:01:04 +08:00
Admin
7516873f11 how to use 2024-07-01 19:01:04 +08:00
Admin
5d93a90cdf how to use 2024-07-01 19:01:04 +08:00
Admin
d3a2583719 how to use 2024-07-01 19:01:04 +08:00
Admin
af9ffa6363 todo remove this file 2024-07-01 19:01:04 +08:00
Admin
aaa712eb7d add scheme notes 2024-07-01 19:01:04 +08:00
Admin
2b63cfafc6 add scheme notes 2024-07-01 19:01:04 +08:00
Admin
d336d66a80 auto generated CMakeLists.txt files for all the projects 2024-07-01 19:01:04 +08:00
SinaKarvandi
7d3c21ff0b add updated version of pdbex submodule 2024-07-01 19:55:38 +09:00
SinaKarvandi
04424aa77c remove pdbex submodule 2024-07-01 19:53:33 +09:00
Sina Karvandi
d5eae3df63
Merge pull request #404 from ddkwork/dev
Dev cmake
2024-06-30 23:02:11 +09:00
Admin
4a83786eaf remove test 2024-06-30 20:57:30 +08:00
Sina Karvandi
a691c1df3b
v0.9.1
v0.9.1
2024-06-30 21:48:29 +09:00
SinaKarvandi
a61a2c44fc make changelog for v0.9.1 2024-06-30 21:46:28 +09:00
SinaKarvandi
b165f56a7b add date and time pseudo-registers (#397) 2024-06-30 20:59:41 +09:00
Admin
a8d907eef4 add need zydis kernel library for hv 2024-06-30 19:31:50 +08:00
Admin
9ec9608845 hyperhv need zydis kernel library ? 2024-06-30 19:27:27 +08:00
Admin
b1ee8f8c12 add libhyperdbg2 for merge all dll project to one dll 2024-06-30 19:17:15 +08:00
Admin
61daca066a add cmakeDemoTest 2024-06-30 19:06:17 +08:00
Admin
482cf5bfe1 cmake for hyperdbg 2024-06-30 19:02:54 +08:00
Admin
aed17a3acd cmake for hyperdbg 2024-06-30 19:01:10 +08:00
Admin
dd7835eeae cmake for libhyperdbg 2024-06-30 19:00:23 +08:00
Admin
6263d10b81 cmake for hyperhv 2024-06-30 18:59:53 +08:00
Admin
a398ca936b ignore clion config files 2024-06-30 18:55:35 +08:00
Admin
1e609c3b5e ignore clion config files 2024-06-30 18:55:18 +08:00
Admin
ee9583a839 add FindWDK 2024-06-30 18:53:18 +08:00
SinaKarvandi
0ca7362ceb add driver name to driver loading exports 2024-06-28 22:10:55 +09:00
SinaKarvandi
13b575efdf set custom driver path for kd driver 2024-06-28 20:56:17 +09:00
SinaKarvandi
79f5c3d1d1 format scala codes 2024-06-28 15:26:32 +09:00
SinaKarvandi
aab38e8123 add exported SDK for pause, continue and setting breakpoints 2024-06-27 19:41:32 +09:00
Sina Karvandi
fcf8698ef2
Merge pull request #402 from HyperDbg/hwdbg-script
Hwdbg script
2024-06-27 18:47:44 +09:00
SinaKarvandi
1ea90c119b add checks for validity of GET and SET operands 2024-06-27 18:46:19 +09:00
Sina Karvandi
bbf5e72000 update default hwdbg script capabilities state 2024-06-27 18:32:35 +09:00
Sina Karvandi
cd44c1467a support optional conditional statements and temp variables 2024-06-27 15:38:33 +09:00
Sina Karvandi
7fbb243e01 reading functions for script main testcases 2024-06-27 14:27:56 +09:00
SinaKarvandi
b29248e937 add multiple testcases for pin/port assignments 2024-06-27 14:24:34 +09:00
SinaKarvandi
9620ffb854 add multiple testcases for assignments 2024-06-27 14:07:11 +09:00
SinaKarvandi
4d430f3680 add initial reading memory api 2024-06-26 20:28:56 +09:00
Sina Karvandi
c5a2d74be6
Merge pull request #401 from HyperDbg/hwdbg-script
Hwdbg script
2024-06-26 19:49:46 +09:00
Sina Karvandi
4f6273990f fix miscomputing last execution stage in conditional statements 2024-06-26 19:48:41 +09:00
SinaKarvandi
b8d9960a48 fix total flip-flops computation 2024-06-26 19:48:04 +09:00
Sina Karvandi
3ef3d59f3d run first conditional statement script 2024-06-26 17:48:37 +09:00
SinaKarvandi
f849bdf862 change script from ports to pins 2024-06-26 16:21:04 +09:00
SinaKarvandi
52670172df change default script 2024-06-25 17:06:59 +09:00
SinaKarvandi
49ed125e72 fix computation of stage register flip-flops 2024-06-25 17:01:52 +09:00
Sina Karvandi
e8680081a1 add temporary, local and global variables to different stages 2024-06-25 16:41:37 +09:00
Sina Karvandi
4412f5b2d6 unify local and global variables 2024-06-25 13:47:10 +09:00
SinaKarvandi
d0045bb3b2 export connection headers 2024-06-24 21:47:23 +09:00
SinaKarvandi
e3372e8810 export connect command to SDK 2024-06-24 21:43:01 +09:00
SinaKarvandi
c4cd890f85 divide user/kernel exported headers 2024-06-24 21:06:23 +09:00
SinaKarvandi
0dad558ef0 fix GO binding issues 2024-06-24 20:41:43 +09:00
SinaKarvandi
9b4fbaeb61 change libhyperdbg SDK functions 2024-06-24 19:07:06 +09:00
Sina Karvandi
f73d847c7d
Merge pull request #399 from HyperDbg/redesign-sdk
Redesign sdk
2024-06-24 18:06:43 +09:00
SinaKarvandi
48c362255e build based on new libhyperdbg 2024-06-24 18:05:54 +09:00
SinaKarvandi
c0180f6f26 rename to libhyperdbg 2024-06-24 17:26:03 +09:00
SinaKarvandi
3057707d48 fix phnt build error with 24H2 SDK 2024-06-24 16:35:25 +09:00
SinaKarvandi
a6234e494a remove phnt submodule 2024-06-24 15:14:39 +09:00
Sina Karvandi
92e6e81bba
Merge pull request #398 from HyperDbg/hwdbg-script
Hwdbg script
2024-06-24 15:06:30 +09:00
SinaKarvandi
6df5d360a7 fix alignment of hwdbg instance info 2024-06-24 15:05:34 +09:00
Sina Karvandi
91c244b0ec update bram instance info 2024-06-24 14:42:24 +09:00
Sina Karvandi
aa094bd7ae add local, global, temporary variables values 2024-06-24 14:10:09 +09:00
Sina Karvandi
543b40cb64 change pseudo-registers implementation 2024-06-21 17:50:06 +09:00
SinaKarvandi
4e63f828e1 change test script buffer 2024-06-21 17:49:21 +09:00
Sina Karvandi
5ad3ee1320 change get/set registers (pins and ports according to script engine indexes) 2024-06-21 17:44:53 +09:00
SinaKarvandi
885a052f33 change the test script buffer 2024-06-21 17:19:04 +09:00
SinaKarvandi
7ed7972554 add support for hw_pinX and hw_portX in the script engine 2024-06-21 17:09:41 +09:00
SinaKarvandi
a4e7807d3c move assertions into a separate file 2024-06-21 13:51:37 +09:00
Sina Karvandi
8ddd2134fc
Merge pull request #396 from HyperDbg/hwdbg-script
Hwdbg script
2024-06-20 20:02:46 +09:00
Sina Karvandi
8c92c92118 add stage index computation 2024-06-20 20:01:23 +09:00
SinaKarvandi
9c229eec12 Merge branch 'hwdbg-script' of https://github.com/HyperDbg/HyperDbg into hwdbg-script 2024-06-20 16:24:28 +09:00
SinaKarvandi
5fb31083a4 add undefined symbol and function 2024-06-20 15:50:22 +09:00
Sina Karvandi
f1111c34a1 add additional check for stage number validity 2024-06-20 14:01:13 +09:00
SinaKarvandi
64cfb00df0 update test scripts 2024-06-20 13:26:21 +09:00
Sina Karvandi
096381941e
Merge pull request #395 from HyperDbg/hwdbg-script
Hwdbg script
2024-06-19 20:12:46 +09:00
Sina Karvandi
16cc1e14b6 run first script 2024-06-19 20:10:48 +09:00
SinaKarvandi
b6b7596637 update script for hwdbg 2024-06-19 18:18:46 +09:00
SinaKarvandi
2ac50ae90e change testing script 2024-06-19 17:54:37 +09:00
Sina Karvandi
f6c6a39061 fix inferring input signals 2024-06-19 14:54:42 +09:00
Sina Karvandi
2aeaa391ad
Merge pull request #394 from HyperDbg/hwdbg-script
Hwdbg script
2024-06-18 21:36:02 +09:00
Sina Karvandi
c7c9b34e6d change test stage represenations 2024-06-18 21:34:18 +09:00
SinaKarvandi
c4fbc1e4f6 change buffer compression based on BRAM width 2024-06-18 21:18:56 +09:00
Sina Karvandi
c8a32ed779 add bram data to the instance info 2024-06-18 20:37:49 +09:00
Sina Karvandi
303a7d4586 append zero to port values if the size of port is bigger than script size 2024-06-18 19:23:05 +09:00
Sina Karvandi
3ae7f01de6 add stage enable bit 2024-06-18 18:06:44 +09:00
SinaKarvandi
b27e51d6f7 fix miscomputation of hwdbg symbol buffer size 2024-06-18 17:29:50 +09:00
SinaKarvandi
cbbcdec157 fix overriding script buffer 2024-06-18 16:08:52 +09:00
Sina Karvandi
99cb883fa9 remove inc and dec operators 2024-06-18 14:31:11 +09:00
SinaKarvandi
a7fe90de78 fix size of the script buffer (number of symbols) 2024-06-17 22:38:01 +09:00
Sina Karvandi
38e2467985 show GET and SET operators types and values 2024-06-17 22:25:20 +09:00
SinaKarvandi
ea93c2f496 make free space for unused operands 2024-06-17 21:10:45 +09:00
SinaKarvandi
b169851ed9 add support to read number of operands 2024-06-17 17:35:23 +09:00
Sina Karvandi
45b88f652d
Merge pull request #391 from HyperDbg/hwdbg-script
Hwdbg script
2024-06-17 14:01:28 +09:00
Sina Karvandi
bc205b3df2 add eval functions to the hwdbg script engine 2024-06-16 22:36:27 +09:00
Sina Karvandi
1574a717a3 vectorize get and set operators 2024-06-16 22:07:18 +09:00
Sina Karvandi
061de3a180 add set and get operator designs 2024-06-16 21:46:53 +09:00
Sina Karvandi
519e0ed3a5
Merge pull request #389 from HyperDbg/hwdbg-script
Hwdbg script
2024-06-15 23:22:47 +09:00
Sina Karvandi
a71a8c9f63 configure stage buffer from BRAM 2024-06-15 22:23:53 +09:00
SinaKarvandi
13bf89b16d fix script length miscomputation 2024-06-15 21:47:14 +09:00
SinaKarvandi
11073f334a add symbol size header to the script buffer 2024-06-15 21:11:26 +09:00
Sina Karvandi
a3be51214f update instance info 2024-06-15 20:52:01 +09:00
Sina Karvandi
00aa73e1f2 show contents of stage register configurations 2024-06-15 19:45:21 +09:00
Sina Karvandi
0fa85827ce
Merge pull request #388 from xmaple555/dev
add stack buffer in vmx-root
2024-06-15 19:32:53 +09:00
xmaple555
5df4d2a526 add stack buffer in vmx-root 2024-06-15 02:10:03 +08:00
Sina Karvandi
a60f6fb22a
Merge pull request #387 from HyperDbg/hwdbg-script
Hwdbg script
2024-06-14 20:21:22 +09:00
SinaKarvandi
e13283a619 synchronize structures with hwdbg 2024-06-14 20:19:47 +09:00
Sina Karvandi
29e1a06926 apply stage configuration at the exec engine 2024-06-14 20:13:37 +09:00
Sina Karvandi
83db63dcb9 connect interpreter script config module to script exec engine 2024-06-14 20:01:09 +09:00
Sina Karvandi
0e8bccba96 add initial logic of BRAM config module 2024-06-14 19:00:22 +09:00
Sina Karvandi
e0fa562975 add base code for BRAM stage configs 2024-06-14 17:04:26 +09:00
Sina Karvandi
1968999a61 combine error and success messages 2024-06-14 16:09:09 +09:00
SinaKarvandi
06bda24517 update error message of editing memory 2024-06-14 15:01:30 +09:00
Sina Karvandi
d9260f51c7
Merge pull request #385 from HyperDbg/script
Script
2024-06-14 14:41:23 +09:00
SinaKarvandi
9f67917da1 add changelog for fixing wcsncmp 2024-06-14 14:40:24 +09:00
xmaple555
dd377551f6
Merge pull request #384 from xmaple555/script
fix wcsncmp in script-engine 2
2024-06-14 03:02:09 +08:00
xmaple555
254a8dfe38 fix wcsncmp in script-engine 2 2024-06-14 02:56:07 +08:00
Sina Karvandi
b930f57f80
Merge pull request #383 from HyperDbg/hwdbg-script
Hwdbg script
2024-06-13 22:24:36 +09:00
Sina Karvandi
4636be8061 implementation of 'add' operator 2024-06-13 22:23:45 +09:00
Sina Karvandi
4d2f458752 add script eval structures 2024-06-13 21:47:03 +09:00
SinaKarvandi
f2174968fa change stage computation policies 2024-06-13 21:10:32 +09:00
Sina Karvandi
92c6fb0dcc change stage eval structure 2024-06-13 20:57:16 +09:00
Sina Karvandi
a572616c02 add instance info modifications 2024-06-13 18:55:40 +09:00
SinaKarvandi
85921e4443 write instance info buffer requests 2024-06-13 18:54:22 +09:00
SinaKarvandi
b92ff764ed add extra zeroing bytes to the packet saver 2024-06-13 18:48:26 +09:00
Sina Karvandi
2ec94ea3da add new set/get fields to the instance info 2024-06-13 18:00:40 +09:00
Sina Karvandi
2d793e79b6
Merge pull request #381 from HyperDbg/hwdbg-script
Hwdbg script
2024-06-13 14:43:37 +09:00
unknown
f5d7332a19 add type of wcsncmp function 2024-06-13 14:42:43 +09:00
Sina Karvandi
b83f66f539
Merge pull request #379 from HyperDbg/dev
Dev
2024-06-13 13:33:55 +09:00
Sina Karvandi
d799e0b9a4
Merge pull request #377 from xmaple555/dev
fix wcsncmp in script-engine
2024-06-13 12:16:02 +09:00
xmaple555
9cbcef61f9 fix wcsncmp in script-engine 2024-06-12 22:34:15 +08:00
unknown
a7e6c124ab add automatic script buffer packet generator 2024-06-12 21:41:43 +09:00
Sina Karvandi
f13f6770b7
Merge pull request #376 from HyperDbg/hwdbg-script
Hwdbg script
2024-06-12 20:18:04 +09:00
unknown
e8ff6bd821 add hwdbg short symbol buffer 2024-06-12 19:49:25 +09:00
unknown
2ed63f73b4 check for script semantic rules 2024-06-12 16:18:19 +09:00
Sina Karvandi
e3cc9a27ad remove ref and deref script capabilities 2024-06-12 16:17:42 +09:00
Sina Karvandi
e212884cd0 change script capablities 2024-06-12 15:56:24 +09:00
unknown
d524edabed add check for script capabilities based on instance info 2024-06-12 15:52:26 +09:00
Sina Karvandi
189ff9cfa0 add ref deref script capabilities 2024-06-12 15:34:37 +09:00
Sina Karvandi
0357c5c4e9 correct the order of moving script capabilities 2024-06-12 14:06:43 +09:00
Sina Karvandi
338b511994
Merge pull request #375 from HyperDbg/hwdbg-script
Hwdbg script
2024-06-11 22:24:49 +09:00
unknown
792fe4e967 add symbol bit compression for resource efficiency 2024-06-11 22:24:05 +09:00
unknown
975fcf889f add content of buffers into file for hwdbg test interpretation 2024-06-11 19:13:37 +09:00
unknown
3367784030 add interprtation of instance info 2024-06-11 18:18:38 +09:00
Sina Karvandi
ca4fe55111 update bram content to bram info 2024-06-11 18:17:45 +09:00
unknown
0e54da1a87 modify debugger side structure of instance info 2024-06-11 16:45:18 +09:00
Sina Karvandi
08fcd5f887 add debugger and debuggee offset area to instance info 2024-06-11 16:44:36 +09:00
unknown
f448127670 Merge branch 'dev' of https://github.com/HyperDbg/HyperDbg into dev 2024-06-11 16:01:28 +09:00
unknown
3961bb604e parse hwdbg sample instance info buffers 2024-06-11 16:01:07 +09:00
Sina Karvandi
1e46f1df25 apply dynamic script length width 2024-06-10 20:11:28 +09:00
unknown
91db4eacd1 add script variable length to the hwdbg symbol structure 2024-06-10 20:09:56 +09:00
Sina Karvandi
41ad0c1b68 fix sending instance info 2024-06-10 19:38:03 +09:00
Sina Karvandi
6ad860d65e add instance info test 2024-06-10 18:36:45 +09:00
Sina Karvandi
70addf4036 add instance info sending module 2024-06-10 18:27:03 +09:00
unknown
af541f9662 update instance info response headers for hwdbg 2024-06-10 18:14:33 +09:00
Sina Karvandi
5897065f15
v0.9
v0.9
2024-06-09 19:50:31 +09:00
unknown
820d9ce2c9 add strncmp function grammar modifications 2024-06-09 18:54:06 +09:00
unknown
fcaafaae53 add strncmp and wcsncmp to script engine 2024-06-09 18:16:31 +09:00
unknown
d6c775a852 reform the automated testing functions 2024-06-08 22:10:20 +09:00
Sina Karvandi
5d1d3ad56b
Merge pull request #372 from HyperDbg/support-physical-monitor
Support physical monitor
2024-06-08 18:01:56 +09:00
unknown
77a4fc83e0 perform termination of monitor based event from physical address 2024-06-08 18:00:43 +09:00
unknown
a515f7b878 add applying physical address monitors 2024-06-06 21:34:13 +09:00
unknown
9948494c11 add user-mode command parsing support for physical monitor 2024-06-06 19:41:22 +09:00
Sina Karvandi
1b409a1123
Merge pull request #371 from HyperDbg/host-gdt
Host gdt
2024-06-05 22:17:22 +09:00
unknown
ff2b51ed13 checking for race-condition of not locked cores before applying instant-events and switching cores 2024-06-05 22:16:17 +09:00
unknown
c733e71950 use IST1..IST7 in the TSS stack 2024-06-05 21:07:18 +09:00
unknown
834b43ece9 adjust IST1..7 host stack pointers 2024-06-04 21:54:48 +09:00
unknown
fb2866e92b copy OS GDT into Host GDT 2024-06-04 19:49:56 +09:00
unknown
f9c1cbf19d allocate HOST GDT buffer 2024-06-03 19:03:51 +09:00
Sina Karvandi
b964e2cfa0
Merge pull request #369 from HyperDbg/host-idt3
Enable using a separate HOST IDT
2024-06-03 14:13:17 +09:00
unknown
62fbb739a5 enable using HOST IDT 2024-06-03 14:11:25 +09:00
unknown
a655cb7c71 pass referenced param 2024-06-02 23:19:58 +09:00
Sina Karvandi
4a671c70d1
Merge pull request #368 from HyperDbg/host-idt2
Host idt2
2024-06-02 23:03:54 +09:00
unknown
8bf6d592a9 disable certail interrupt handler entries 2024-06-02 23:02:27 +09:00
unknown
f610bd1f60 enabling NMI handler in Host IDT 2024-06-02 22:55:05 +09:00
Sina Karvandi
487ff41031
Merge pull request #367 from HyperDbg/host-idt
Host idt
2024-06-02 22:19:04 +09:00
unknown
d6fece1f2f enable using OS HOST IDT 2024-06-02 22:14:31 +09:00
unknown
135a3fb8df create host IDT based on OS IDTR 2024-06-02 22:02:16 +09:00
unknown
acc7116bc4 change script supported capabilities 2024-06-01 14:57:30 +09:00
Sina Karvandi
f650644922 change port configuration type and embed it to instance of debugger 2024-05-31 13:46:08 +09:00
unknown
af8de1f0db add headers for hwdbg information buffers 2024-05-30 20:25:43 +09:00
Sina Karvandi
18814a5adb create an instance of the debugger 2024-05-30 20:24:48 +09:00
Sina Karvandi
204d2dd908 remove default module arguments 2024-05-30 18:13:35 +09:00
Sina Karvandi
e24d1da7b5 create dynmaic instance from main module 2024-05-30 17:38:36 +09:00
Sina Karvandi
985a4bcf9c Create instance object of the debugger 2024-05-30 17:17:17 +09:00
Sina Karvandi
224fc66dd3 add connect to get value and set value 2024-05-29 19:00:49 +09:00
Sina Karvandi
783462d483 add logic of getting setting data types 2024-05-29 16:24:24 +09:00
unknown
40fc283501 update definition of constant for data types in scala 2024-05-29 16:16:06 +09:00
Sina Karvandi
f55f664923 add set value logic for scripts 2024-05-29 15:31:53 +09:00
Sina Karvandi
1f356bccbb add get value logic for scripts 2024-05-29 15:24:57 +09:00
unknown
75c1d6ae71 add scala constants for script engine 2024-05-29 13:25:34 +09:00
unknown
11b3c5cbf7 add automatic generation of hwdbg constants for script engine 2024-05-29 13:23:31 +09:00
Sina Karvandi
09dca8266d change the definition of SYMBOL in script engine 2024-05-28 20:33:28 +09:00
unknown
ba3e0a7b90 create dynamic SYMBOL for hwdbg 2024-05-28 20:31:38 +09:00
Sina Karvandi
833d26b740 synchronize eval engine with auto-generated script definition headers 2024-05-28 19:54:39 +09:00
unknown
e1abffab5e add scala headers for script engine 2024-05-28 19:52:31 +09:00
unknown
f73175714d add hwdbg to the counter 2024-05-28 19:33:50 +09:00
Sina Karvandi
2b666aed88
Merge pull request #366 from HyperDbg/master
update with master
2024-05-28 19:16:26 +09:00
Sina Karvandi
3890408b6c
merge hwdbg
merge hwdbg
2024-05-28 19:04:09 +09:00
unknown
4fa5fe3539 merge hwdbg 2024-05-28 18:57:49 +09:00
Sina Karvandi
f77b16b752
Merge pull request #364 from HyperDbg/dev
remove duplicate funcs and create scala version of script definitions
2024-05-28 17:39:40 +09:00
unknown
f447156456 remove duplicate funcs and create scala version of script definitions 2024-05-28 17:38:22 +09:00
unknown
bc34dcde89 add nmi injection 2024-05-28 13:19:47 +09:00
unknown
310df381c2 add breakpoint modifications 2024-05-27 19:38:34 +09:00
unknown
c52edfaad4 add support for separate host IDT 2024-05-15 23:07:50 +09:00
unknown
18fd4ed691 change invalid address error message 2024-05-14 21:35:47 +09:00
unknown
9fd5c39300 change EPT Hook 2024-05-14 20:38:44 +09:00
unknown
e1e1debb3c add extra info message for invalid address error 2024-05-14 20:36:58 +09:00
Sina Karvandi
296d2fe345
Update README.md 2024-05-13 11:56:06 +09:00
Sina Karvandi
0218975986
Update README.md 2024-05-13 11:33:23 +09:00
unknown
8db7cc7192 add other environment definitions 2024-05-12 16:07:41 +09:00
unknown
22ef15abda add user-mode platform environment 2024-05-12 15:53:22 +09:00
unknown
f1247d1b74 fix Windows environment headers for kernel drivers 2024-05-12 15:30:04 +09:00
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
Sina Karvandi
02faf1de5a
v0.8.4
v0.8.4
2024-05-10 14:43:54 +09:00
unknown
85da245a4d change CHANGELOG.md 2024-05-10 14:42:12 +09:00
unknown
48c8c6e6e6 fix the signedness of the command parser 2024-05-10 14:32:15 +09:00
unknown
8bbb5955e3 update hwdbg headers 2024-05-06 19:02:11 +09:00
unknown
a55263e171 add hwdbg headers for port information 2024-05-04 23:15:24 +09:00
unknown
6fbca3b7dc add hwdbg headers for port information 2024-05-04 23:14:34 +09:00
Sina Karvandi
c6f03de4e0
Update README.md 2024-05-04 21:44:16 +09:00
Sina Karvandi
78b01b3035
v0.8.3
v0.8.3
2024-05-03 15:13:08 +09:00
unknown
acb3d7393f update CHANGELOG.md 2024-05-03 15:11:15 +09:00
unknown
b161e9e9d4 add citation to TRM paper 2024-05-03 15:05:55 +09:00
unknown
46ddc75f4e change release version of hyperdbg-cli to compile with debug flags 2024-05-03 14:42:15 +09:00
unknown
22d39d2247 add hwdbg response enum 2024-05-01 13:52:48 +09:00
unknown
c98b81cdec add hwdbg action enum 2024-04-28 23:03:22 +09:00
unknown
654108359f add hwdbg headers 2024-04-28 22:05:54 +09:00
unknown
d51f2ac191 add hwdbg shared headers 2024-04-17 17:58:39 +09:00
unknown
597bedd590 update zydis submodule 2024-04-07 16:32:38 +09:00
unknown
91aaa33d3a change invalid path to script engine wrapper 2024-04-07 16:28:51 +09:00
Sina Karvandi
7710b92be4
Merge pull request #355 from HyperDbg/dev
Dev
2024-04-07 16:08:27 +09:00
unknown
6eac037234 fix naming conventions for core number 2024-04-07 16:05:43 +09:00
Sina Karvandi
12d605f420
Merge pull request #353 from GermanAizek/fix-numa-cores
Added support NUMA configuration with multiple count CPU sockets
2024-04-07 15:48:53 +09:00
Sina Karvandi
7ac6287665
Merge pull request #354 from GermanAizek/fix
Many minor fixes in debugger and vmm/vmx
2024-04-07 15:44:53 +09:00
Herman Semenov
7bcf1e5c71 fix bitwise extended type, fixed memleaks, remove excess else and cmp int with EOF 2024-04-05 16:13:13 +03:00
Herman Semenov
040f70024f Added support NUMA configuration with multiple count CPU sockets 2024-04-05 13:49:13 +03:00
Sinaei
594d51e692 add Zydis as submodule without /GL flag 2024-03-20 15:38:30 +09:00
Sinaei
b748d389aa remove zydis submodule 2024-03-20 15:30:07 +09:00
Sina Karvandi
103874d777
v0.8.2
v0.8.2
2024-03-19 15:16:43 +09:00
Sinaei
5400e4f963 fix script engine ACCEPT and INVALID terms 2024-03-19 15:14:59 +09:00
Sina Karvandi
beff2c7c0c
Merge pull request #351 from HyperDbg/fix-script-engine-warnings
Fix script engine warnings
2024-03-18 12:43:25 +09:00
Sinaei
e3162bdd5b change project build order 2024-03-18 12:41:49 +09:00
Sinaei
cc9aab9ef3 compile script-engine with treat warnings as error 2024-03-18 12:31:11 +09:00
Sinaei
7c4c087d0a fix script-engine warnings 2 2024-03-17 20:48:07 +09:00
Sinaei
ff4d3737c8 update pdbex with treat warnings as error flag 2024-03-17 20:38:50 +09:00
Sinaei
983d8ef71e remove pdbex to update submodule 2024-03-17 20:38:09 +09:00
Sinaei
1f7c5ca835 fix script-engine warnings 2024-03-17 20:33:02 +09:00
Sinaei
35092b0e1a fix hprdbgkd compile warnings 2024-03-17 19:28:10 +09:00
Sina Karvandi
d015f7eb3d
Merge pull request #350 from HyperDbg/fix-spelling
Fix spelling
2024-03-17 19:02:06 +09:00
Sinaei
e65db2fc36 fix spelling typos 5 2024-03-17 19:00:14 +09:00
Sinaei
1dbc3430af fix spelling typos 4 2024-03-17 18:49:51 +09:00
Sinaei
696fb551db fix spelling typos 3 2024-03-17 18:17:38 +09:00
Sinaei
c395232076 fix spelling typos 2 2024-03-17 01:23:40 +09:00
Sinaei
5d58d0a1aa fix spelling typos 2024-03-17 01:01:22 +09:00
Sina Karvandi
b658de23e1
fix readme line overlap 2024-03-17 00:01:56 +09:00
Sina Karvandi
a2dfc5e714
Merge pull request #349 from HyperDbg/fix-user-warnings
Fix user warnings
2024-03-16 23:57:37 +09:00
Sinaei
83adf8462d fix all warnings of hprdbgctrl 2024-03-16 23:49:00 +09:00
Sinaei
432021b00c fix user-mode warnings 4 2024-03-15 13:51:23 +09:00
Sinaei
45cf7c20d8 fix user-mode warnings 3 2024-03-14 14:02:18 +09:00
Sinaei
4d58be1bec change export style of hprdbgctrl 2024-03-14 13:43:48 +09:00
Sinaei
92a937d8a8 fix user-mode warnings 2 2024-03-12 18:21:39 +09:00
Sinaei
13166e0bf1 fix user-mode warnings 1 2024-03-12 12:11:18 +09:00
Sina Karvandi
0a87947f77
Merge pull request #348 from HyperDbg/fix-linker-warnings
Fix linker warnings
2024-03-11 12:49:03 +09:00
Sinaei
769eddf1bd fix linker warnings for kernel modules 2024-03-11 12:47:41 +09:00
Sinaei
9c7a3135df fix linker warnings of hprdbghv 2024-03-10 20:42:06 +09:00
Sina Karvandi
99c243a3f5
Merge pull request #347 from Maladiy/dev
fix PhysicalAddress passed to EptSetupPML2Entry
2024-03-06 20:26:15 +09:00
Maladiy
0a003dba44 fix PhysicalAddress passed to EptSetupPML2Entry 2024-03-06 19:17:52 +08:00
Sinaei
7e4f1bd23d fix allocating buffer for spliting EPT PML2 2024-03-06 13:54:37 +09:00
Sinaei
38ae76e602 fix kdserial and user warnings 2024-03-03 22:46:46 +09:00
Sinaei
af61569f87 fix hyperlog warnings 2024-03-03 22:12:23 +09:00
Sina Karvandi
8b758bf55d
Merge pull request #346 from HyperDbg/fix-warnings2
Fix warnings2
2024-03-03 21:16:16 +09:00
Sinaei
be0e43901d fix warnings of hprdbghv 2024-03-03 21:04:43 +09:00
Sinaei
a4579e024e fix warnings 14 2024-03-03 20:25:27 +09:00
Sinaei
6de63ac2eb fix warnings 13 2024-03-03 19:06:22 +09:00
Sinaei
957136ac44 unifying core count and current cores 2024-03-03 16:27:16 +09:00
Sinaei
b5de7e6a5c fix warnings 12 2024-03-03 15:15:38 +09:00
Sinaei
4c11fdd4a7 fix warnings 11 2024-03-03 00:51:25 +09:00
Sinaei
dbd40565bb fix warnings 10 2024-03-02 23:58:00 +09:00
Sinaei
b188b7ddec load symbols automatically after downloading 2024-03-02 22:36:34 +09:00
Sina Karvandi
6015e01643
Merge pull request #345 from HyperDbg/fix-warnings
Fix warnings
2024-03-02 21:58:47 +09:00
Sinaei
f03f177d07 resolve parse-table conflicts 2024-03-02 21:57:02 +09:00
Sinaei
d3de191386 perform warnings modifications 2024-03-02 21:50:06 +09:00
Sinaei
491a6b6fc1 Merge branch 'dev' into fix-warnings 2024-03-02 21:39:40 +09:00
Sina Karvandi
c66acd6adf
Merge pull request #342 from xmaple555/script-engine
add user-defined function and variable type in script engine
2024-03-02 20:53:47 +09:00
xmaple555
29d79991e4 add user-defined function and variable type in script engine 2024-03-02 01:59:33 +08:00
Sinaei
e9ff613a01 fix warnings 9 2024-03-01 23:56:19 +09:00
Sinaei
ff00b669c1 fix warnings 8 2024-03-01 23:51:41 +09:00
Sinaei
cc4b07fb01 fix warnings 7 2024-03-01 23:20:18 +09:00
Sinaei
9d3d38f137 fix warnings 6 2024-03-01 23:02:03 +09:00
Sinaei
da7605ac60 fix warnings 5 2024-03-01 22:27:09 +09:00
Sinaei
fb4b4f2c3d fix warnings 4 2024-03-01 21:02:52 +09:00
Sinaei
7e9483e9cc fix warnings 3 2024-03-01 18:11:24 +09:00
Sinaei
bde0cee86d fix warnings 2 2024-03-01 15:59:58 +09:00
Sinaei
a11e4c58c7 fix warnings 1 2024-02-29 19:26:14 +09:00
Sina Karvandi
4dd374e2e2
Merge pull request #341 from gmh5225/fix
Fix errors in clang
2024-02-26 10:20:35 +09:00
gmh5225
55c52e6df5
Fix errors in clang 2024-02-25 21:48:00 +08:00
Sinaei
a8d8edfe4d Fix debuggee crash after running the '.debug close' command on the debugger 2024-02-02 16:22:07 +09:00
Sina Karvandi
68e0d32f3e
v0.8.1
v0.8.1.0
2024-02-01 17:47:36 +09:00
Sinaei
4d23aad49e update CHANGELOG 2024-02-01 17:45:42 +09:00
Sinaei
54f886b524 update CHANGELOG 2024-02-01 17:44:18 +09:00
Sina Karvandi
c44dd84ffd
Merge pull request #339 from HyperDbg/monitor-fixes
Monitor fixes
2024-02-01 17:38:46 +09:00
Sinaei
1f06260b97 fix restoring monitor event in case of failed attempts 2024-02-01 17:38:00 +09:00
Sinaei
64f431e3aa fix non-contiguous memory read/write/exec interception 2024-02-01 16:09:56 +09:00
Sinaei
778639466b fix monitoring typos 2024-02-01 12:47:31 +09:00
Sinaei
4ad82deeb5 fix termination of ept monitor hooks 2024-01-31 21:05:14 +09:00
Sinaei
9b0a402375 check monitor hooks based on event tags 2024-01-31 20:33:29 +09:00
Sinaei
9bd3931cbd refactor epthook2 functions 2024-01-31 19:04:49 +09:00
Sinaei
30df118f44 make epthook2 and monitor hooks separate 2024-01-31 18:42:58 +09:00
Sinaei
73c56c3550 save start and end physical address of monitor hooks 2024-01-31 18:01:51 +09:00
Sinaei
938458099b add support to length in the monitor event command 2024-01-31 15:46:45 +09:00
Sina Karvandi
f9ea736fb2
v0.8
v0.8
2024-01-28 21:54:57 +09:00
Sina Karvandi
46ae93d5b4
Update CHANGELOG.md 2024-01-28 21:53:50 +09:00
Sina Karvandi
207895b344
Merge pull request #337 from HyperDbg/dev
v0.8
2024-01-28 21:52:39 +09:00
Sinaei
db163b0e19 update README 2024-01-28 21:35:13 +09:00
Sinaei
ba20895c45 update CHANGELOG 2024-01-28 21:33:31 +09:00
Sina Karvandi
ae284de1be
Merge pull request #336 from Mattiwatti/mtrr-fixes-v3
MTRR fixes
2024-01-28 21:32:55 +09:00
Matthijs Lavrijsen
e6a81edc18
EPT: do not treat SMRAM region described by SMRR as variable range MTRR
The SMRAM region is not valid for use outside of SMM. Since we have no need for it and no way to access it in any case, do not create a faux MTRR entry for it with almost certainly an incorrect memory caching type (probably WB, but really any value other other than UC).
2024-01-28 13:22:29 +01:00
Matthijs Lavrijsen
d9536e71c5
Fix MTRR range loop typo, redux
This commit is a fixed redo of ed5ab28 to correctly index into the fixed range MTRRs ranging from IA32_MTRR_FIX16K_80000 up to A0000.
2024-01-28 13:21:59 +01:00
Sina Karvandi
85f2354f4b
Merge pull request #335 from HyperDbg/revert-334-dev
Revert "Dev"
2024-01-28 20:56:18 +09:00
Sina Karvandi
76e1f9a8cb
Revert "Dev" 2024-01-28 20:55:50 +09:00
Sina Karvandi
e96a0f9ce5
v0.8.0
v0.8.0
2024-01-28 20:25:30 +09:00
Sina Karvandi
391b09a9e2
Update CHANGELOG.md 2024-01-28 20:23:32 +09:00
Sina Karvandi
86585c30f3
Update git-help.md 2024-01-28 20:21:40 +09:00
Sinaei
f4a338610f update CHANGELOG 2024-01-28 20:17:43 +09:00
Sina Karvandi
53acb300c0
Merge pull request #332 from Mattiwatti/mtrr-fixes-v2
Fix MTRR range loop typo
2024-01-28 19:20:26 +09:00
Matthijs Lavrijsen
910eb08a51
Fix MTRR range loop typo, redux
This commit is a fixed redo of ed5ab28 to correctly index into the fixed range MTRRs ranging from IA32_MTRR_FIX16K_80000 up to A0000.
2024-01-28 03:59:49 +01:00
Sinaei
ed5ab28aff fix MTRR range loop typo 2024-01-27 17:08:41 +09:00
Sinaei
47dae1da6d update mode transition commands 2024-01-25 20:37:49 +09:00
845 changed files with 113652 additions and 27485 deletions

View file

@ -7,6 +7,13 @@ assignees: ''
---
**Note**
We're fortunate to have a community of highly skilled system engineers and reverse engineers contributing to HyperDbg. However, as an open-source, community-driven debugger, our resources and developer time are limited.
Since most HyperDbg users are professional programmers, we encourage you to contribute by submitting pull requests (PRs) whenever possible. While we will address issues created by users, we greatly appreciate your efforts to resolve issues independently and submit PRs. If you're unable to create a PR, please feel free to create an issue, and we'll do our best to address it.
Thank you for reporting issues and for your contributions! ❤️
**Describe the bug**
A clear and concise description of what the bug is.

View file

@ -7,6 +7,13 @@ assignees: ''
---
**Note**
We're fortunate to have a community of highly skilled system engineers and reverse engineers contributing to HyperDbg. However, as an open-source, community-driven debugger, our resources and developer time are limited.
Since most HyperDbg users are professional programmers, we encourage you to contribute by submitting pull requests (PRs) whenever possible. While we will address requests for new features created by users, we greatly appreciate your efforts to add them independently and submit PRs. If you're unable to create a PR, please feel free to create your request, and we'll do our best to address it. You can also create issues or discussions to discuss the possible features that you want to add to HyperDbg.
Thank you for requesting new features and for your contributions! ❤️
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

View file

@ -1,3 +1,4 @@
## Removing submodules
To remove a submodule you need to:
- Delete the relevant section from the `.gitmodules` file.
@ -42,3 +43,42 @@ To remove the effects of `git add .` and `git commit -m "test"` or just `git add
```
git reset --soft HEAD~1
```
To remove **all uncommitted and untracked changes** in Git and reset your working tree to the last commit:
```bash
git reset --hard
git clean -fd
```
To modify the last pushed commit:
```bash
# Undo the last commit but keep the changes in your working tree
git reset --soft HEAD~1
# Make your additional modifications
# edit files...
# Stage everything
git add .
# Create a new commit
git commit -m "Updated commit message"
# Force-push to replace the remote commit
git push --force-with-lease
```
---------------
## Releasing instructions
```
git checkout master
git pull
git tag -a v0.1.0 -m "HyperDbg releases"
git push origin master v0.1.0
git checkout dev
git rebase master
git push
```

View file

@ -1,26 +1,31 @@
name: vs2022-ci
on:
push:
branches:
- master
- dev
tags:
- 'v*'
paths-ignore:
- '.gitignore'
- '.gitattributes'
- '**.cmd'
- '**.bat'
- '**.md'
pull_request:
paths-ignore:
- '.gitignore'
- '.gitattributes'
- '**.cmd'
- '**.bat'
- '**.md'
workflow_dispatch:
# Disabled, uncomment the below line and remove the above lines to activate
# on:
# push:
# branches:
# - master
# - dev
# tags:
# - 'v*'
# paths-ignore:
# - '.gitignore'
# - '.gitattributes'
# - '**.cmd'
# - '**.bat'
# - '**.md'
#
# pull_request:
# paths-ignore:
# - '.gitignore'
# - '.gitattributes'
# - '**.cmd'
# - '**.bat'
# - '**.md'
env:
# WDK for Windows 11, version 22H2
WDK_URL: https://go.microsoft.com/fwlink/?linkid=2196230
@ -73,12 +78,12 @@ jobs:
# working-directory: ${{env.GITHUB_WORKSPACE}}
# run: msbuild /m /p:Configuration="Release MT" /p:Platform=${{matrix.PLATFORM}} /target:zydis /target:zycore /p:OutDir=${{ github.workspace }}/hyperdbg/libraries/zydis/ ${{ github.workspace }}/hyperdbg/dependencies/zydis/msvc/Zydis.sln
- name: Build Hyperdbg solution
- name: Build HyperDbg solution
working-directory: ${{env.GITHUB_WORKSPACE}}
run: msbuild /m /p:Configuration=${{matrix.BUILD_CONFIGURATION}} /p:Platform=${{matrix.PLATFORM}} ${{env.SOLUTION_FILE_PATH}}
- name: Upload build directory
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4.4.0
with:
name: build_files_${{matrix.BUILD_CONFIGURATION}}
path: ${{ env.BUILD_BIN_DIR }}
@ -86,12 +91,12 @@ jobs:
deploy-release:
name: Deploy release
needs: win-amd64-build
runs-on: windows-2019
runs-on: windows-2022
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download build files from "build" job
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4.1.7
with:
name: build_files_release
path: ${{ env.BUILD_BIN_DIR }}

99
.github/workflows/vs2026.yml vendored Normal file
View file

@ -0,0 +1,99 @@
name: vs2026-ci
on:
push:
branches:
- '**' # matches all branch names, including ones with slashes
tags:
- 'v*'
paths-ignore:
- '.gitignore'
- '.gitattributes'
- '**.cmd'
- '**.bat'
- '**.md'
pull_request:
paths-ignore:
- '.gitignore'
- '.gitattributes'
- '**.cmd'
- '**.bat'
- '**.md'
env:
SOLUTION_FILE_PATH: ./hyperdbg/hyperdbg.sln
RELEASE_ZIP_FILE_NAME: hyperdbg
BUILD_BIN_DIR: ./hyperdbg/build/bin/
jobs:
win-amd64-build:
runs-on: windows-2025-vs2026
strategy:
matrix:
BUILD_CONFIGURATION: [release, debug]
PLATFORM: [x64]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Checkout submodules recursively
run: git submodule update --init --recursive --remote
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v3
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Restore NuGet packages
run: nuget restore ${{ env.SOLUTION_FILE_PATH }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Update vcxproj files
run: python utils/replace-sdk-wdk.py
- name: Build HyperDbg solution
working-directory: ${{env.GITHUB_WORKSPACE}}
run: msbuild /m /p:Configuration=${{matrix.BUILD_CONFIGURATION}} /p:Platform=${{matrix.PLATFORM}} ${{env.SOLUTION_FILE_PATH}}
- name: Upload build directory
uses: actions/upload-artifact@v4.4.0
with:
name: build_files_${{matrix.BUILD_CONFIGURATION}}
path: ${{ env.BUILD_BIN_DIR }}
deploy-release:
name: Deploy release
needs: win-amd64-build
runs-on: windows-2025-vs2026
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download build files from "build" job
uses: actions/download-artifact@v4.1.7
with:
name: build_files_release
path: ${{ env.BUILD_BIN_DIR }}
- name: Archive release
uses: thedoctor0/zip-release@master
with:
path: ${{ env.BUILD_BIN_DIR }}release/
type: 'zip'
filename: ${{env.RELEASE_ZIP_FILE_NAME}}-${{ github.ref_name }}.zip
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{env.RELEASE_ZIP_FILE_NAME}}-${{ github.ref_name }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

14
.gitignore vendored
View file

@ -377,16 +377,26 @@ MigrationBackup/
!/hyperdbg/libraries/DIA/x84/*
!/hyperdbg/libraries/DIA/x64/*
# KdSerial Libraries
# kdserial libraries
!/hyperdbg/libraries/kdserial/*
!/hyperdbg/libraries/kdserial/x86/*
!/hyperdbg/libraries/kdserial/x64/*
!/hyperdbg/libraries/kdserial/arm/*
!/hyperdbg/libraries/kdserial/arm64/*
# Ignore keystone libraries
!/hyperdbg/libraries/keystone/release/
!/hyperdbg/libraries/keystone/debug/
!/hyperdbg/libraries/keystone/release/*
!/hyperdbg/libraries/keystone/debug/*
# Code review tools
compile_commands.json
StructLayoutSettings.json
*.metaproj
*.metaproj
#ignore clion config files
.idea
cmake-build-debug
/hyperdbg/hyperhv/zydis/

14
.gitmodules vendored
View file

@ -1,15 +1,15 @@
[submodule "hyperdbg/tests/script-engine-test"]
path = hyperdbg/tests/script-engine-test
url = https://github.com/HyperDbg/script-engine-test.git
[submodule "hyperdbg/miscellaneous/constants/pciid"]
path = hyperdbg/miscellaneous/constants/pciid
url = https://github.com/HyperDbg/pciids
[submodule "hyperdbg/dependencies/ia32-doc"]
path = hyperdbg/dependencies/ia32-doc
url = https://github.com/HyperDbg/ia32-doc.git
[submodule "hyperdbg/dependencies/phnt"]
path = hyperdbg/dependencies/phnt
url = https://github.com/HyperDbg/phnt.git
[submodule "hyperdbg/dependencies/pdbex"]
path = hyperdbg/dependencies/pdbex
url = https://github.com/HyperDbg/pdbex.git
[submodule "hyperdbg/dependencies/zydis"]
path = hyperdbg/dependencies/zydis
url = https://github.com/HyperDbg/zydis
[submodule "hyperdbg/script-engine/modules/script-engine-test"]
path = hyperdbg/script-engine/modules/script-engine-test
url = https://github.com/HyperDbg/script-engine-test
url = https://github.com/HyperDbg/zydis.git

View file

@ -4,6 +4,458 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.21.0.0] - 2026-07-05
New release of the HyperDbg Debugger.
### Added
- Added structure for the hyperperf (Hardware Performance Counter) project ([link](https://github.com/HyperDbg/HyperDbg/commit/c17ebc09c4d199a642352e66feebb3159582196c))
- The 'unload' command checks whether any module is loaded or not ([link](https://docs.hyperdbg.org/commands/debugging-commands/unload))
- Exported SDK API for checking whether any module is loaded or not ([link](https://github.com/HyperDbg/HyperDbg/commit/19e47c804f50f5dbb698f314e66b7d685a87ac1f))
- Added user mode and kernel mode PT parameter parser ([link](https://github.com/HyperDbg/HyperDbg/pull/631))
- Added thread (TID) and process (PID) helper functions for Intel PT ([link](https://github.com/HyperDbg/HyperDbg/pull/633))
### Changed
- Separated SDK libraries for user mode and kernel mode modules ([link](https://github.com/HyperDbg/HyperDbg/commit/c17ebc09c4d199a642352e66feebb3159582196c))
- Added hypertrace, hyperevade, and hyperperf DLL files to SDK ([link](https://github.com/HyperDbg/HyperDbg/commit/c17ebc09c4d199a642352e66feebb3159582196c))
- Fix pool manager uninitialize list corruption ([link](https://github.com/HyperDbg/HyperDbg/pull/629))
- Fix 'access denied' error on loading all modules using 'load all' ([link](https://docs.hyperdbg.org/commands/debugging-commands/load))([link](https://github.com/HyperDbg/HyperDbg/commit/2b818a5116d80d466aab7b343d4aa9d1d640f082))
- Fix the concatenation error for the "hyperkd" string on the hypertrace project (https://github.com/HyperDbg/HyperDbg/commit/2b0cc18899ff532d9d590a71bf880fee5456c15f))
- Organized header files for the libhyperdbg project ([link](https://github.com/HyperDbg/HyperDbg/pull/632))
## [0.20.0.0-beta] - 2026-06-21
New release of the HyperDbg Debugger.
### Added
- Added the libipt library to the project and the SDK
- Added Intel Processor Trace (PT) example app
- Added Linux distinction and pragmas together with new platform functions ([link](https://github.com/HyperDbg/HyperDbg/commit/9c3e0ed23b5f4bb64bd305e546dd0e86ee1910d9))
- Added interfaces to Linux port for the serial devices ([link](https://github.com/HyperDbg/HyperDbg/commit/31b514f8df40d81d44ae07a2328c02360ce488c3))
- Added platform IOCTL interface ([link](https://github.com/HyperDbg/HyperDbg/pull/619))
- Added typecast for wchar, mismatch on Linux and Windows ([link](https://github.com/HyperDbg/HyperDbg/commit/10576b064a9824ab655e7bea0e35e9556ee68ca4))
- Added missing IOCTLs for Intel PT ([link](https://github.com/HyperDbg/HyperDbg/commit/df12e9fd79851c8f378ec82a45066da510da507a))
- Added NuGet packages for Windows SDK and WDK
- Added Signal handler platform API for Linux ([link](https://github.com/HyperDbg/HyperDbg/pull/627))
- Added contribution guidelines for Linux ([link](https://github.com/HyperDbg/HyperDbg/tree/master/hyperdbg/linux#readme))
### Changed
- Moved to Visual Studio 2026 ([link](https://github.com/HyperDbg/HyperDbg/pull/626))
- Zydis and pdbex submodules are updated to VS2026
- Fix the new form of loading and unloading in the example app and PT app ([link](https://github.com/HyperDbg/HyperDbg/commit/9ad48d30dcf6b409ae86b2d08262584cd06f606e))
- Check whether the top-level hypervisor is Hyper-V and disable/enable VPIDs based on that, thanks to [@Idov31](https://github.com/Idov31) ([link](https://github.com/HyperDbg/HyperDbg/pull/625))
- Fix PT operation IOCTL buffer size ([link](https://github.com/HyperDbg/HyperDbg/commit/dabf132d31503843f90949f35f8dce4601d43126))
- CI/CD updated with NuGet packages for Visual Studio 2026 ([link](https://github.com/HyperDbg/HyperDbg/commit/5a0fad490124268550f955f594d1211d5c74f03d))
## [0.19.0.0-beta] - 2026-06-10
New release of the HyperDbg Debugger.
### Added
- First release of the HyperTrace module ([link](https://url.hyperdbg.org/hypertrace))
- HyperTrace now enables/disables VM-entry/VM-exit controls for Load and Save IA32_DEBUGCTL MSR
- Added Legacy LBR support to the HyperTrace module
- Added Architectural LBR support to the HyperTrace module
- Added the '!lbr' command for performing different Last Branch Record (LBR) operations ([link](https://docs.hyperdbg.org/commands/extension-commands/lbr))
- Added the '!lbrdump' command for dumping saved Last Branch Record (LBR) entries ([link](https://docs.hyperdbg.org/commands/extension-commands/lbrdump))
- Added **lbr_save()** and **lbr_print()** functions in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/functions/tracing/lbr/lbr_save))([link](https://docs.hyperdbg.org/commands/scripting-language/functions/tracing/lbr/lbr_print))
- Added mock application for compiling SDK for Linux
- Added '!help' alias for the '.help' command
- Added 'vm' alias for the 'load' command ([link](https://docs.hyperdbg.org/commands/debugging-commands/load))
- Added **lbr_check()** and **lbr_restore()** functions in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/functions/tracing/lbr/lbr_check))([link](https://docs.hyperdbg.org/commands/scripting-language/functions/tracing/lbr/lbr_restore))
- Added **lbr_restore_by_filter(filter)** function in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/functions/tracing/lbr/lbr_restore_by_filter))
- Added the 'kd' module in the 'load' command ([link](https://docs.hyperdbg.org/commands/debugging-commands/load))
- Added the 'trace' module in the 'load' command ([link](https://docs.hyperdbg.org/commands/debugging-commands/load))
- Exported SDK API for detecting CPU vendors
- Initial codes for the HyperTrace project by using Intel Processor Trace (PT), thanks to [@masoudrahimi01](https://github.com/masoudrahimi01) ([link](https://github.com/HyperDbg/HyperDbg/pull/589))
- Exported SDK APIs for loading and unloading the 'kd' and the 'trace' modules
- Exported SDK APIs for starting (installing) the 'kd' driver
- Exported SDK APIs for loading/unloading all modules
- Added tests for checking PE parser in 'hyperdbg-test' project
- Added example for loading HyperDbg in VMI mode directly from libhyperdbg
- Fix action cleanup list removal in debugger events ([link](https://github.com/HyperDbg/HyperDbg/pull/601))
- Added transparent-mode evade mask selection thanks to [@jtaw5649](https://github.com/jtaw5649) ([link](https://github.com/HyperDbg/HyperDbg/pull/602))
- Added synthetic MSR handling thanks to [@Idov31](https://github.com/Idov31) ([link](https://github.com/HyperDbg/HyperDbg/pull/605))
- Added use of relative RSDS fixture paths when loading PDB symbols, thanks to [@jtaw5649](https://github.com/jtaw5649) ([link](https://github.com/HyperDbg/HyperDbg/pull/607))
### Changed
- Fix the problem of not applying the EAX index in the CPUID event extension command ([link](https://docs.hyperdbg.org/commands/extension-commands/cpuid#parameters))
- Refactoring the IOCTL parameter checks and status routines
- All basic types are now defined for Linux
- VMX instructions are ported to platform-independent files to support Linux
- All CPU-related intrinsic instructions are ported to platform-independent files to support Linux
- HyperDbg SDK now compiles on Linux (GCC) for both user-mode and kernel-mode
- Fix the 'wrmsr' command IOCTL checks by receiving output in the buffer ([link](https://docs.hyperdbg.org/commands/debugging-commands/wrmsr))
- Extensive refactoring of code base (doxygen, variables, function names)
- Building certain modules on Linux and fixing CMake files thanks to [@maxraulea](https://github.com/maxraulea) ([link](https://github.com/HyperDbg/HyperDbg/pull/592))
- Fix the '!hide' command's HyperEvade activation guard thanks to [@jtaw5649](https://github.com/jtaw5649) ([link](https://github.com/HyperDbg/HyperDbg/pull/593))
- Fix synchronous debugger device IOCTL handles thanks to [@jtaw5649](https://github.com/jtaw5649) ([link](https://github.com/HyperDbg/HyperDbg/pull/595))
- PE parser ('.pe' command) now supports richer DOS/NT/COFF/optional-header output, section bounds checking, data directory reporting, import/export parsing, TLS/debug/PDB/load-config metadata, overlay reporting, and malformed metadata warnings thanks to [@jtaw5649](https://github.com/jtaw5649) ([link](https://github.com/HyperDbg/HyperDbg/pull/598))([link](https://docs.hyperdbg.org/commands/meta-commands/.pe))
- Building the script engine module on Linux (GCC) thanks to [@maxraulea](https://github.com/maxraulea) ([link](https://github.com/HyperDbg/HyperDbg/pull/596))
- The pool manager moved from 'hyperhv' to 'hyperkd'
- The 'load' command could load all modules using a new alias 'load all' ([link](https://docs.hyperdbg.org/commands/debugging-commands/load))
- The 'unload' command could remove all modules using two new aliases 'unload all' and 'unload remove all' ([link](https://docs.hyperdbg.org/commands/debugging-commands/unload))
- Change device handle checks with module loading status checks for IOCTLs ([link](https://github.com/HyperDbg/HyperDbg/pull/610))
- Fix standard callbacks for the VMM module ([link](https://github.com/HyperDbg/HyperDbg/pull/610))
- Fix race condition bug within the pool manager
## [0.18.1.0] - 2026-04-09
New release of the HyperDbg Debugger.
### Added
- HyperTrace now works with HyperDbg VMM ([link](https://github.com/HyperDbg/HyperDbg/pull/568))
- Progress on implementing Last Branch Recode (LBR) ([link](https://github.com/HyperDbg/HyperDbg/commit/1dd73675e9cd78737e013ffb35bc712f385f387e))
- Applying LBR registers on the VMCS instead of the DEBUGCTL MSR ([link](https://github.com/HyperDbg/HyperDbg/commit/15f8b3cca15448acd18d7e198740464a19ce4fe2))
### Changed
- Fix the problem of the '!epthook' not finding the PML1 entry ([link](https://docs.hyperdbg.org/commands/extension-commands/epthook))
- Fix the problem of getting the PML1 entry of the target address on Intel Core Ultra processors (#567) ([link](https://github.com/HyperDbg/HyperDbg/issues/567))
- Fix the '.clang-format' formatting error
- Restructure of the HyperTrace project
- Add starting structure for supporting Intel Processor Trace (PT)
## [0.18.0.0] - 2026-02-16
New release of the HyperDbg Debugger.
### Added
- Script engine now supports writing libraries using the '#include' keyword thanks to [@xmaple555](https://github.com/xmaple555) ([link](https://docs.hyperdbg.org/commands/scripting-language/casting-and-inclusion))([link](https://github.com/HyperDbg/HyperDbg/issues/557))([link](https://github.com/HyperDbg/HyperDbg/pull/561))
- Initial codes for the HyperTrace project by using Intel Last Branch Record (LBR) and Branch Trace Store (BTS) thanks to [@harimishal1](https://github.com/harimishal1) ([link](https://github.com/HyperDbg/HyperDbg/tree/master/hyperdbg/hypertrace))
- The HyperTrace project is now linked to the hyperkd
- Initial efforts to port HyperDbg to Linux have started thanks to [@Alish14](https://github.com/Alish14) ([link](https://github.com/HyperDbg/HyperDbg/pull/563))
### Changed
- Fix compilation error in Zydis with the new Windows WDK ([link](https://github.com/HyperDbg/zydis/commit/e61f59332ce49f8853006573ca853e404fafdd08))
## [0.17.0.0] - 2025-11-10
New release of the HyperDbg Debugger. All credit for this release goes to [@xmaple555](https://github.com/xmaple555).
### Added
- Added 1D and 2D arrays (multidimensional arrays) in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/variables-and-assignments#multidimensional-array))([link](https://github.com/HyperDbg/HyperDbg/pull/554))
- Added compound assignments in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/variables-and-assignments#compound-assignment))([link](https://github.com/HyperDbg/HyperDbg/pull/554))
- Added multiple assignments in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/variables-and-assignments#multiple-assignment))([link](https://github.com/HyperDbg/HyperDbg/pull/554))
### Changed
- Fix bugs for interpreting 'db_pa, 'dd_pa', 'eb_pa', and 'ed_pa' keywords in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/assumptions-and-evaluations#keywords))([link](https://github.com/HyperDbg/HyperDbg/pull/507))
- Fix variable types in the script engine ([link](https://github.com/HyperDbg/HyperDbg/commit/43b0245fa11b5c73ce4cd21d8b8787b86a05f89d))
- Fix and update array index for boolean expressions in the script engine ([link](https://github.com/HyperDbg/HyperDbg/commit/ba2cec3c12c3ff45ddc0004051884983ff62a0b3))
## [0.16.0.0] - 2025-09-08
New release of the HyperDbg Debugger.
### Added
- The **!xsetbv** event command was added for handling the execution of the XSETBV instruction, thanks to HyperDbg group members ([link](https://docs.hyperdbg.org/commands/extension-commands/xsetbv))
- Display of the number of blocked context switches in the '.switch' command ([link](https://docs.hyperdbg.org/commands/meta-commands/.switch))
- Added support for step-in (the 't' command) in the user debugger ([link](https://docs.hyperdbg.org/commands/debugging-commands/t))
- Added support for step-over (the 'p' command) in the user debugger ([link](https://docs.hyperdbg.org/commands/debugging-commands/p))
- Added support to show all registers or a specific register in the user debugger ([link](https://docs.hyperdbg.org/commands/debugging-commands/r))
- Exported SDK API for running scripts in either the kernel debugger or the user debugger
- Added support to modify registers or a specific register in the user debugger ([link](https://docs.hyperdbg.org/commands/debugging-commands/r))
- Added support to evaluate (run) scripts on the target thread in the user debugger ([link](https://docs.hyperdbg.org/commands/debugging-commands/eval))
- Added an indication of a thread's running or paused state to the HyperDbg signature in the user debugger ([link](https://docs.hyperdbg.org/using-hyperdbg/prerequisites/signatures))
- Added support for the '.formats' command in the user debugger ([link](https://docs.hyperdbg.org/commands/meta-commands/.formats))
- Added support for interpreting parameters based on script engine expressions in the user debugger
- Exported SDK API for evaluating expressions based on the context of the kernel debugger or the user debugger
- Added a new mechanism for showing the 'printf' and the 'print' function messages in the user debugger ([link](https://docs.hyperdbg.org/commands/scripting-language/functions/exports/printf))([link](https://docs.hyperdbg.org/commands/scripting-language/functions/exports/print))
### Changed
- Non-volatile XMM registers are no longer saved/restored on VM-exit handler ([link](https://learn.microsoft.com/en-us/cpp/build/x64-software-conventions?view=msvc-170))
- Fix grammar and spelling errors throughout HyperDbg codebase ([link](https://github.com/HyperDbg/HyperDbg/pull/546))
- Relocate extension command files into their corresponding VS directory
- Fix infinite VM-exit bug for the '!monitor x' command thanks to [@unlockable](https://github.com/unlockable) ([link](https://github.com/HyperDbg/HyperDbg/pull/545))
## [0.15.0.0] - 2025-08-18
New release of the HyperDbg Debugger.
### Added
- Added the '!smi' command for performing operations related to System Management Interrupt (SMI) ([link](https://docs.hyperdbg.org/commands/extension-commands/smi))
- Export the SDK functions for SMI operations ([link](https://docs.hyperdbg.org/commands/extension-commands/smi#sdk))
- Check for Intel CET IBT (indirect branch tracking) support
- Check for Intel CET shadow stack support
- Added support to Intel CET for SYSCALL/SYSRET emulation ([link](https://docs.hyperdbg.org/commands/extension-commands/syscall))([link](https://docs.hyperdbg.org/commands/extension-commands/sysret))
### Changed
- The 'hyperhv' project now has build optimizations enabled
- Reformat VMXOFF restoring routines to restore general-purpose and XMM registers correctly before moving to the previous stack
- Fix unloading (VMXOFF) crash when restoring XMM registers
- Fix the problem with restoring XMM registers (#468) ([link](https://github.com/HyperDbg/HyperDbg/issues/468))
- Enhanced the '.pe' command to support PE Rich Headers thanks to [@Alish14](https://github.com/Alish14) ([link](https://github.com/HyperDbg/HyperDbg/pull/539))
- Updated ia32-doc to fix VMCS PL3 SSP fields ([link](https://github.com/HyperDbg/ia32-doc))
- Fix the terminating process issue of the '!syscall/!sysret' commands on 11 generation (Rocket Lake/Tiger Lake) and newer Intel processors ([link](https://github.com/HyperDbg/HyperDbg/issues/392))
- Re-enable the support for the '.start' command in the Debugger mode ([link](https://docs.hyperdbg.org/commands/meta-commands/.start))
- The '!mode' event command is now compatible with different EPT hook commands (e.g., !epthook, !epthook2, !monitor, .start, and .restart) ([link](https://docs.hyperdbg.org/commands/extension-commands/mode))
- The '!mode' command doesn't need allocating extra EPTPs ([link](https://docs.hyperdbg.org/commands/extension-commands/mode))
## [0.14.1.0] - 2025-07-27
New release of the HyperDbg Debugger.
### Changed
- Restored the previous optimization on the release builds
- Fixed the issue of not properly restoring registers after the 'CPUID' instruction
- Fixed the building issues of the user debugger with the 'bp' and the '.start' commands
## [0.14.0.0] - 2025-07-23
New release of the HyperDbg Debugger.
### Added
- **microsleep(microseconds)** function in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/functions/timings/microsleep))
- **rdtsc()** and **rdtscp()** functions in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/functions/timings/rdtsc))([link](https://docs.hyperdbg.org/commands/scripting-language/functions/timings/rdtscp))
- Added functions to get system-call number from the running system ([link](https://github.com/HyperDbg/HyperDbg/commit/5d33cb7395c57fd6af170bfed90376598347679c))
- Added the support for the '.start' command in the VMI mode ([link](https://docs.hyperdbg.org/commands/meta-commands/.start))
- Added a new mechanism for finding the system-call number based on the running system ([link](https://github.com/HyperDbg/HyperDbg/commit/5d33cb7395c57fd6af170bfed90376598347679c))
- Added hyperevade transparency project ([link](https://url.hyperdbg.org/hyperevade))
- Added support to the '.attach' and '.detach' in the debugger mode ([link](https://docs.hyperdbg.org/commands/meta-commands/.attach))([link](https://docs.hyperdbg.org/commands/meta-commands/.detach))
- Added support to the '.start' command in the VMI mode for the user debugger ([link](https://docs.hyperdbg.org/commands/meta-commands/.start))
- Added support to setting the breakpoint using the 'bp' command in the VMI mode ([link](https://docs.hyperdbg.org/commands/debugging-commands/bp))
- Added EPT page table support for MMIO addresses above 512 GB
### Changed
- Redesigned the '!mode' extension command without extra EPTP ([link](https://github.com/HyperDbg/HyperDbg/commit/a93b78dfadbf94d2d69f24413170c983ec379f48))
- The user mode debugger now uses MBEC for preventing user-mode code execution ([link](https://github.com/HyperDbg/HyperDbg/commit/6893c1b19f1edaf57d0074bd60abcd518bf77338))
- Apply transparent-mode based on dynamic system-calls ([link](https://github.com/HyperDbg/HyperDbg/commit/1eb960607331fc0c2622804d7aff65702c155649))
- Breakpoint initialization is changed from kernel debugger to the regular debugger ([link](https://github.com/HyperDbg/HyperDbg/commit/e5326f895dcddb1adbc873a9fecede7af7eb7651))
- Fixed the build issue on new Windows SDK for Token structures ([link](https://github.com/HyperDbg/HyperDbg/pull/530))
- Fixed retrieving valid watching process IDs for the execution trap and user-mode execution prevention
- Fixed crashing the driver if the hyperlog memory was not properly allocated
- The target runner image for deploying HyperDbg (CI/CD) changed from Windows Server 2019 to 2022
- Restored the pid and the process name parameters of the '!hide' command ([link](https://docs.hyperdbg.org/commands/extension-commands/hide))
- Fixed crashing Windows when using 'TPAUSE' instruction on bare metal Windows 11 24h2
- Check to avoid putting EPT hooks on physical addresses greater than 512 GB
## [0.13.2.0] - 2025-05-26
New release of the HyperDbg Debugger.
### Added
- Intercepting system-call return results using the TRAP flag for the transparent-mode
- Added optional parameters and context for the transparent-mode system-call return interceptions
### Changed
- Set variable length (stack frames) for showing the callstack ([link](https://docs.hyperdbg.org/commands/debugging-commands/k))
- Fixed VMCS layout corruption due to NMI injection (VMRESUME 0x7 error) in nested-virtualization on Meteor Lake processors
- Restore RDMSR handler for VM-exits
## [0.13.1.0] - 2025-04-14
New release of the HyperDbg Debugger.
### Added
- Added new transparency methods for hiding nested virtualization environments thanks to [@CokeTree3](https://github.com/CokeTree3) ([link](https://github.com/HyperDbg/HyperDbg/pull/515))
### Changed
- Fix '.thread' command crash ([link](https://github.com/HyperDbg/HyperDbg/pull/510))
- Update .clang-format format file based on the new version of LLVM
- Update the list of required contributions
## [0.13.0.0] - 2025-02-25
New release of the HyperDbg Debugger.
### Added
- Added mitigation for the anti-hypervisor method in handling the trap flag for emulated instructions ([link](https://github.com/HyperDbg/HyperDbg/pull/497))
- Export the SDK functions for enabling and disabling transparent mode ([link](https://docs.hyperdbg.org/commands/extension-commands/hide#sdk))([link](https://docs.hyperdbg.org/commands/extension-commands/unhide#sdk))
- New description of changing script engine constants ([link](https://docs.hyperdbg.org/tips-and-tricks/misc/customize-build/change-script-engine-limitations))
- Added the command for interpreting PCI CAM (PCI configuration space) fields ([link](https://docs.hyperdbg.org/commands/extension-commands/pcicam))
- Added the command for dumping PCI CAM (PCI configuration space) memory ([link](https://docs.hyperdbg.org/commands/extension-commands/pcicam))
- Checking for and unloading the older version of the driver (if it exists) ([link](https://github.com/HyperDbg/HyperDbg/pull/503))
- **memcpy_pa()** function in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/functions/memory/memcpy_pa))
- **poi_pa**, **hi_pa**, **low_pa**, **db_pa**, **dd_pa**, **dw_pa**, and **dq_pa** keywords in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/assumptions-and-evaluations#keywords))
- **eb_pa**, **ed_pa**, and **eq_pa** functions in the script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/functions/memory/eb_pa-ed_pa-eq_pa))
### Changed
- Fix the 'lm' command issue of not showing kernel module addresses (KASLR leak mitigation) introduced in Windows 11 24h2 ([link](https://docs.hyperdbg.org/commands/debugging-commands/lm))
- Deprecated TSC mitigation for the transparent mode ([link](https://docs.hyperdbg.org/commands/extension-commands/measure))
- Changed the parameters of the '!hide' command ([link](https://docs.hyperdbg.org/commands/extension-commands/hide))
- Changed the parameters of the '!unhide' command ([link](https://docs.hyperdbg.org/commands/extension-commands/unhide))
- Fix containing backslash escape character in script strings ([link](https://github.com/HyperDbg/HyperDbg/pull/499))
- Fix reading/writing into devices' physical memory (MMIO region) in VMI Mode ([link](https://github.com/HyperDbg/HyperDbg/pull/500))
- All test cases for command parsing are now passed ([link](https://github.com/HyperDbg/HyperDbg/pull/504))
- The '.sympath' command now requires the symbol server path to be within quotes, although it is not mandatory ([link](https://docs.hyperdbg.org/commands/meta-commands/.sympath))
## [0.12.0.0] - 2025-01-02
New release of the HyperDbg Debugger.
### Added
- Added the PCI tree command ([link](https://docs.hyperdbg.org/commands/extension-commands/pcitree))
- Added the proper handling for the xsetbv VM exits thanks to [@Shtan7](https://github.com/Shtan7) ([link](https://github.com/HyperDbg/HyperDbg/pull/491))
- Added the IDT command for interpreting Interrupt Descriptor Table (IDT) ([link](https://docs.hyperdbg.org/commands/extension-commands/idt))
- Export SDK APIs for getting Interrupt Descriptor Table (IDT) entries
### Changed
- Fix buffer overflow in the symbols path converter thanks to [@binophism](https://github.com/binophism) ([link](https://github.com/HyperDbg/HyperDbg/pull/490))
- Fix script engine's "printf" function to improve safety thanks to [@Reodus](https://github.com/Reodus) ([link](https://github.com/HyperDbg/HyperDbg/pull/489))
## [0.11.0.0] - 2024-12-03
New release of the HyperDbg Debugger.
### Added
- Added the local APIC command (xAPIC and x2APIC modes) ([link](https://docs.hyperdbg.org/commands/extension-commands/apic))
- Added the I/O APIC command ([link](https://docs.hyperdbg.org/commands/extension-commands/ioapic))
- The new link is added to help increase the number of EPT hook breakpoints in a single page ([link](https://docs.hyperdbg.org/tips-and-tricks/misc/customize-build/number-of-ept-hooks-in-one-page))
- Export SDK APIs for Local APIC and X2APIC
### Changed
- The link for changing the communication buffer size is updated ([link](https://docs.hyperdbg.org/tips-and-tricks/misc/customize-build/increase-communication-buffer-size))
- Update Microsoft's DIA SDK and symsrv
## [0.10.2.0] - 2024-10-11
New release of the HyperDbg Debugger.
### Added
- Automated test case parsing and test case compilation (generation) for the hwdbg debugger
- Export hwdbg testing functions
- Automated test case interpretation and emulation of hwdbg hardware scripts
- Create JSON representation of hwdbg configs
### Changed
- Fix main command parser bugs according to test cases
- Improvements in symbol structure, token structure, and stack buffer in the script engine
- Fix compatibility mode program crash when terminating 32-bit process (#479) ([link](https://github.com/HyperDbg/HyperDbg/pull/479))
- Extensive refactor of chip instance info interpretation codes of hwdbg debugger
- Separating functions of hwdbg interpreter and script manager
- Fix synthesize inconsistencies between Icarus iVerilog and Xilinx ISim
- Fix runtime error for deallocating memory from separate DLLs
- Exporting standard functions (import/export) for the script engine
- Exporting standard functions (import/export) for the symbol parser
- Avoid passing signals once the stage is not configured
## [0.10.1.0] - 2024-09-08
New release of the HyperDbg Debugger.
### Added
- Added feature to pause the debuggee immediately upon connection
- The '.debug' command now supports pausing the debuggee at startup ([link](https://docs.hyperdbg.org/commands/meta-commands/.debug))
- Export SDK API for assembling instructions
- The 'struct' command now supports a path as output ([link](https://docs.hyperdbg.org/commands/debugging-commands/struct))
- Export SDK API closing connection to the remote debuggee
- Automated tests for the main command parser
- Export SDK APIs for stepping and tracing instructions
- Export SDK APIs for tracking execution
### Changed
- HyperDbg command-line comment sign is changed from '#' to C-like comments ('//' and '/**/')
- Integrating a new command parser for the regular HyperDbg commands
- Fix showing a list of active outputs using the 'output' command ([link](https://docs.hyperdbg.org/commands/debugging-commands/output))
- Fix the issue of passing arguments to the '.start' command ([link](https://docs.hyperdbg.org/commands/meta-commands/.start))
- Fix the problem with parsing multiple spaces within the events (#420) ([link](https://github.com/HyperDbg/HyperDbg/issues/420))
- Fix the problem with escaping '{' in the command parser (#421) ([link](https://github.com/HyperDbg/HyperDbg/issues/421))
- Fix nested brackets issues in the main command parser
- Fix script engine bugs on order of passing arguments to functions (#453) ([link](https://github.com/HyperDbg/HyperDbg/issues/453))
- Fix the script test case for factorial computation ([link](https://github.com/HyperDbg/script-engine-test/blob/main/semantic-test-cases/manual-test-cases_60-69.ds))
- Fix the script test case for computation iterative Fibonacci ([link](https://github.com/HyperDbg/script-engine-test/blob/main/semantic-test-cases/manual-test-cases_60-69.ds))
- Fix miscomputation of physical address width for physical address validity checks (#469) ([link](https://github.com/HyperDbg/HyperDbg/issues/469))
## [0.10.0.0] - 2024-07-22
New release of the HyperDbg Debugger.
### Added
- Support using assembly conditions and codes in all events ([link](https://docs.hyperdbg.org/using-hyperdbg/prerequisites/how-to-create-a-condition))([link](https://docs.hyperdbg.org/using-hyperdbg/prerequisites/how-to-create-an-action))
- Added support for forwarding events to binary (DLL) modules ([link](https://docs.hyperdbg.org/tips-and-tricks/misc/event-forwarding))([link](https://docs.hyperdbg.org/commands/debugging-commands/output))([link](https://github.com/HyperDbg/event-forwarding-examples))
- Added the assembler command 'a' for virtual memory ([link](https://docs.hyperdbg.org/commands/debugging-commands/a))
- Added the assembler command '!a' for physical memory ([link](https://docs.hyperdbg.org/commands/extension-commands/a))
- Providing a unified SDK API for reading memory in the VMI Mode and the Debugger Mode
- Export SDK APIs for reading/writing into registers in the Debugger Mode
- Export SDK API for writing memory in the VMI Mode and the Debugger Mode
- Export SDK API for getting kernel base address
- Export SDK API for connecting to the debugger and from debuggee in the Debugger Mode
- Export SDK API for starting a new process
- Add and export SDK API for unsetting message callback
- Event commands are coming with more examples regarding scripts and assembly codes
- Add message callback using shared memory
- Add maximum execution limitation to the script IRs (#435) ([link](https://github.com/HyperDbg/HyperDbg/pull/435))
### Changed
- Fix clearing '!monitor' hooks on a different process or if the process is closed (#409) ([link](https://github.com/HyperDbg/HyperDbg/issues/409))
- Fix triggering multiple '!monitor' hooks with different contexts (#415) ([link](https://github.com/HyperDbg/HyperDbg/issues/415))
- Fix the problem of repeating commands once kHyperDbg is disconnected
- Fix step-over hangs if the process terminates/excepts within call instruction (#406) ([link](https://github.com/HyperDbg/HyperDbg/issues/406))
- Fix crash on editing invalid physical addresses (#424) ([link](https://github.com/HyperDbg/HyperDbg/issues/424))
- Fix exporting VMM module load and install it in the SDK
- Fix function interpretation issues and update the parser and the code execution (#435) ([link](https://github.com/HyperDbg/HyperDbg/pull/435))
## [0.9.1.0] - 2024-06-30
New release of the HyperDbg Debugger.
### Added
- Regular port/pin value read and modification in hwdbg
- Conditional statement evaluation in hwdbg
- Added automatic script buffer packet generator for hwdbg
- Added support for @hw_pinX and @hw_portX registers
- Added hwdbg instance information interpreter
- Added stack buffer in vmx-root ([link](https://github.com/HyperDbg/HyperDbg/commit/5df4d2a5268a6b190dc126bf6cfe0527703296eb))
- Exporting functions to support loading drivers with different names
- Exporting function to connect and load HyperDbg drivers
- Exporting function to connect and load HyperDbg drivers
- **$date** and **$time** pseudo-registers are added ([link](https://docs.hyperdbg.org/commands/scripting-language/assumptions-and-evaluations#pseudo-registers))([link](https://github.com/HyperDbg/HyperDbg/issues/397))
### Changed
- Fix using constant WSTRINGs in the **wcsncmp** function ([link](https://docs.hyperdbg.org/commands/scripting-language/functions/strings/wcsncmp))
- Fix `phnt` build error with 24H2 SDK
- `hprdbgctrl.dll` changed to `libhyperdbg.dll`
- `hprdbgkd.sys` changed to `hyperkd.sys`
- `hprdbghv.dll` changed to `hyperhv.dll`
- Dividing user/kernel exported headers in the SDK
## [0.9.0.0] - 2024-06-09
New release of the HyperDbg Debugger.
### Added
- The **!monitor** command now physical address hooking ([link](https://docs.hyperdbg.org/commands/extension-commands/monitor))
- **hwdbg** is merged to HyperDbg codebase ([link](https://hwdbg.hyperdbg.org))
- **strncmp(Str1, Str2, Num)**, and **wcsncmp(WStr1, WStr2, Num)** functions in script engine ([link](https://docs.hyperdbg.org/commands/scripting-language/functions/strings/strncmp))([link](https://docs.hyperdbg.org/commands/scripting-language/functions/strings/wcsncmp))
### Changed
- Using a separate HOST IDT in VMCS (not OS IDT) (fix to this [VM escape](https://www.unknowncheats.me/forum/c-and-c-/390593-vm-escape-via-nmi.html) issues)
- Using a dedicated HOST GDT and TSS Stack
- Checking for race-condition of not locked cores before applying instant-events and switching cores
- The error message for invalid address is changed ([more information](https://docs.hyperdbg.org/tips-and-tricks/considerations/accessing-invalid-address))
- Fix the problem of not locking all cores after running the '.pagein' command
## [0.8.4.0] - 2024-05-10
New release of the HyperDbg Debugger.
### Changed
- Fixed the signedness overflow of the command parser
## [0.8.3.0] - 2024-05-03
New release of the HyperDbg Debugger.
### Added
- Added hwdbg headers ([link](https://hwdbg.hyperdbg.org))
- Added support NUMA configuration with multiple count CPU sockets ([link](https://github.com/HyperDbg/HyperDbg/commit/040f70024fdad879ecf2ff2b31da066d4ed759fc))
- Added citation to TRM paper ([link](https://arxiv.org/abs/2405.00298))
### Changed
- Change release flag of hyperdbg-cli to Multi-threaded Debug (/MTd)
- Fix bitwise extended type, fixed memleaks, remove excess else and cmp int with EOF ([link](https://github.com/HyperDbg/HyperDbg/commit/7bcf1e5c71364aa3177eef0929c07463155ce5c6))
## [0.8.2.0] - 2024-03-19
New release of the HyperDbg Debugger.
### Added
- Add user-defined functions and variable types in script engine thanks to [@xmaple555](https://github.com/xmaple555) ([link](https://docs.hyperdbg.org/commands/scripting-language/constants-and-functions))([link](https://github.com/HyperDbg/HyperDbg/pull/342))
### Changed
- Fix debuggee crash after running the '.debug close' command on the debugger
- The problem with adding edge MTRR pages is fixed thanks to [@Maladiy](https://github.com/Maladiy) ([link](https://github.com/HyperDbg/HyperDbg/pull/347))
- All compiler/linker warnings of kernel-mode modules are fixed
- User/Kernel modules of HyperDbg now compiled with "treat warning as error"
- After downloading new symbols it is automatically loaded
- Fix error messages/comments spelling typos
## [0.8.1.0] - 2024-02-01
New release of the HyperDbg Debugger.
### Added
- The **!monitor** command now supports length in parameters ([link](https://docs.hyperdbg.org/commands/extension-commands/monitor#syntax))
### Changed
- Fix the issue of not intercepting memory monitoring on non-contiguous physical memory allocations
- The speed of memory read/write/execution interception is enhanced by avoiding triggering out-of-range events
## [0.8.0.0] - 2024-01-28
New release of the HyperDbg Debugger thanks to [@mattiwatti](https://github.com/Mattiwatti).
### Added
- The **!mode** event command is added to detect kernel-to-user and user-to-kernel transitions ([link](https://docs.hyperdbg.org/commands/extension-commands/mode))
- The 'preactivate' command is added to support initializing special functionalities in the Debugger Mode ([link](https://docs.hyperdbg.org/commands/debugging-commands/preactivate))
### Changed
- Fix miscalculating MTRRs in 13th gen processors
## [0.7.2.0] - 2024-01-23
New release of the HyperDbg Debugger thanks to [@mattiwatti](https://github.com/Mattiwatti) and [@cutecatsandvirtualmachines](https://github.com/cutecatsandvirtualmachines).

View file

@ -2,21 +2,19 @@
First off, thanks for taking the time to contribute! ❤️
HyperDbg is a large-scale project that requires a lot of time and effort from the community. Given the current number of developers and their limited time and resources, we cannot develop every part simultaneously. Therefore, new developers are warmly welcomed to join and add their contributions to the project. Here, we made a list of potential improvements that you can contribute on. Feel free to open up an issue if you think you have any ideas that would make a good addition to the list, or if you want to implement one of the below items, or if you'd like to discuss a question you might have.
HyperDbg is a large-scale project that requires a lot of time and effort from the community. Given the current number of developers and their limited time and resources, we cannot develop every part simultaneously. Therefore, new developers are warmly welcomed to join and add their contributions to the project. Here, we made a list of potential improvements that you can contribute on. Feel free to open up an issue if you think you have any ideas that would make a good addition to the list.
## Things to Work on
- Writing blog posts about use-cases of HyperDbg
- Troubleshooting problems with running on Hyper-V's nested virtualization
- Troubleshooting problems with running on VirtualBox's nested virtualization
- Supporting kdnet (sending data over the net)
- Adding an assembler to the project
- Enhancing HyperDbg's [Transparent Mode](https://docs.hyperdbg.org/using-hyperdbg/prerequisites/operation-modes#transparent-mode), especially anti-hypervisor methods
- Making a SoftICE-style GUI
- Enhancing and adding more features to the ['.pe'](https://docs.hyperdbg.org/commands/meta-commands/.pe) command
- Anything else you might find interesting ;)
Please make sure to create a [discussion](https://github.com/orgs/HyperDbg/discussions) or an [issue](https://github.com/HyperDbg/HyperDbg/issues), or even better, join the HyperDbg groups ([Telegram](https://t.me/HyperDbg), [Discord](https://discord.gg/anSPsGUtzN), [Matrix](https://matrix.to/#/#hyperdbg-discussion:matrix.org)) on social media. Discuss the way you want to implement your changes and inform developers, because we often see people simultaneously working on the same issue. To avoid this collision, make sure to inform us before you start developing.
This list will be updated frequently.
### Working on an Idea or a Task
- We have a [wide range of ideas and tasks](https://github.com/orgs/HyperDbg/projects/2) that you might be interested in working on. You can choose a task and start working on it, and if you have any questions or need clarification, feel free to ask. This list will be updated frequently.
### Other Things to Work on
- Writing blog posts and creating videos about use-cases of HyperDbg (make sure to add it to the [awesome](https://github.com/HyperDbg/awesome) repository).
- Fixing unresolved GitHub [issues](https://github.com/HyperDbg/HyperDbg/issues).
- Any other interesting ideas you might find! (Let's have a discussion before working on them.)
## Fixing Bugs

View file

@ -4,7 +4,7 @@ The list provided comprises individuals who have made significant contributions
## Credits:
The attributions listed on this credits page are acknowledged without any particular order.
Just so you know the attributions listed on this credits page are acknowledged without any particular order.
- All of the [contributors](https://github.com/HyperDbg/HyperDbg/graphs/contributors)
- Sina Karvandi ([@Intel80x86](https://twitter.com/Intel80x86))
@ -21,4 +21,10 @@ The attributions listed on this credits page are acknowledged without any partic
- Ddkwork ([@ddkwork](https://github.com/ddkwork)) for making GUI
- Mohammad K. Fallah ([@mkfallah11](https://github.com/mkfallah11)) for implementing the optimization algorithms
- Xandora Team ([xandora.io](https://www.xandora.io)) for [Keystone](https://github.com/keystone-engine/keystone) engine
- xmaple555 ([@xmaple555](https://github.com/xmaple555)) for contributions in HyperDbg core and the script engine
- xmaple555 ([@xmaple555](https://github.com/xmaple555)) for contributions in HyperDbg core and the script engine
- Abbas Masoumi Gorji ([@AbbasMasoumiG](https://twitter.com/AbbasMasoumiG))
- Björn Ruytenberg ([@0Xiphorus](https://twitter.com/0Xiphorus))
- Marcis Zarins ([@CokeTree3](https://github.com/CokeTree3)) for his works on enhancing HyperEvade project
- Artem Shishkin ([@honorary_bot](https://twitter.com/honorary_bot)) for always answering our hypervisor questions
- unrustled.jimmies for helping us debug and fix issues, and his contributions in HyperDbg
- Hari Mishal ([@harimishal1](https://github.com/harimishal1)) for his works on the hypertrace project for supporting Last Branch Record (LBR)

136
README.md
View file

@ -6,25 +6,40 @@
<a href="https://www.gnu.org/licenses/gpl-3.0"><img src="https://raw.githubusercontent.com/HyperDbg/graphics/master/Badges/License-GPLv3-blue.svg" alt="License"></a>
</p>
<a href="https://hyperdbg.org/"><img align="right" width="150" height="150" src="https://github.com/HyperDbg/graphics/raw/master/Art%20Board/HyperDbg-Cat.Circle.Compressed.png" alt="HyperDbg Debugger"></a></br>
# HyperDbg Debugger
HyperDbg Debugger is an open-source, community-driven, hypervisor-assisted, user-mode, and kernel-mode Windows debugger with a focus on using modern hardware technologies. It is a debugger designed for analyzing, fuzzing, and reversing.
<a href="https://hyperdbg.org/"><img align="right" width="150" height="150" src="https://github.com/HyperDbg/graphics/raw/master/Art%20Board/HyperDbg-Cat.Circle.Compressed.png" alt="HyperDbg Debugger"></a></br>
**HyperDbg Debugger** is a free (as in free beer), open-source, community-driven, hypervisor-assisted, user-mode, and kernel-mode Windows debugger with a focus on using modern hardware technologies. It is a debugger designed for analyzing, fuzzing, and reversing.
You can follow **HyperDbg** on **[Twitter](https://twitter.com/HyperDbg)** to get notified about new releases, or join the HyperDbg **[Telegram](https://t.me/HyperDbg)** group, where you can ask developers and open-source reversing enthusiasts for help with setting up and running HyperDbg.
You can follow **HyperDbg** on **[Twitter](https://twitter.com/HyperDbg)** or **[Mastodon](https://infosec.exchange/@hyperdbg)** to get notified about new releases, or join any of the HyperDbg groups, where you can ask developers and open-source reversing enthusiasts for help setting up and using HyperDbg.
- **[Telegram](https://t.me/HyperDbg)**
- **[Discord](https://discord.gg/anSPsGUtzN)**
- **[Matrix](https://matrix.to/#/#hyperdbg-discussion:matrix.org)**
## Description
**HyperDbg** is designed with a focus on using modern hardware technologies to provide new features to the debuggers' world. It operates on top of Windows by virtualizing an already running system using Intel VT-x and Intel PT. This debugger aims not to use any APIs and software debugging mechanisms, but instead, it uses Second Layer Page Table (a.k.a. Extended Page Table or EPT) extensively to monitor both kernel and user executions.
**HyperDbg** is designed with a focus on using modern hardware technologies to provide new features to the debuggers' world. It operates on top of Windows by virtualizing an already running system using Intel VT-x and EPT. This debugger aims not to use any APIs and software debugging mechanisms, but instead, it uses Second Layer Page Table (a.k.a. Extended Page Table or EPT) extensively to monitor both kernel and user executions.
<p align="center"><a href="https://hyperdbg.org/"><img align="center" width="600" height="500" src="https://raw.githubusercontent.com/HyperDbg/graphics/master/Art%20Board/Artboard%201.png" alt="HyperDbg Debugger"></a></br>
</p>
HyperDbg comes with features like hidden hooks, which are as fast as old inline hooks, but also stealth. It mimics hardware debug registers for (read & write) to a specific location, but this time entirely invisible for both Windows kernel and the programs, and of course, without any limitation in size or count!
HyperDbg comes with features like hidden hooks, which are as fast as old inline hooks, but also stealth. It mimics hardware debug registers for (read & write) to a specific location, but this time invisible for both the Windows kernel and the programs, and of course, without any limitation in size or count!
Using TLB-splitting, and having features such as measuring code coverage and monitoring all mov(s) to/from memory by a function, makes HyperDbg a unique debugger.
Using TLB-splitting and having features such as measuring code coverage and monitoring all mov(s) to/from memory by a function, makes HyperDbg a unique debugger.
Although it has novel features, HyperDbg tries to be as stealthy as possible. It doesnt use any debugging APIs to debug Windows or any application, so classic anti-debugging methods wont detect it. Also, it resists the exploitation of time delta methods (e.g., RDTSC/RDTSCP) to detect the presence of hypervisors, therefore making it much harder for applications, packers, protectors, malware, anti-cheat engines, etc. to discover the debugger.
## Why HyperDbg?
HyperDbg is harder to set up and use, and also requires deeper low-level system knowledge compared to traditional debuggers. However, it provides two major advantages:
1. **Full System & OS Control**
HyperDbg operates at the hypervisor level, giving you powerful capabilities that are simply not possible with classic debuggers. This allows you to leverage hardware-assisted [features](https://github.com/HyperDbg/HyperDbg?tab=readme-ov-file#unique-features) for advanced reverse engineering and debugging scenarios.
2. **Stealth & Detection Resistance**
Since HyperDbg doesn't rely on standard OS debugging APIs, it is generally much harder (though not impossible) to detect. This makes it a strong choice when working against anti-debugging protections.
These advantages open up entirely new debugging and reverse engineering techniques that go beyond what conventional debuggers can offer.
## Build & Installation
You can download the latest compiled binary files from **[releases](https://github.com/HyperDbg/HyperDbg/releases)**; otherwise, if you want to build HyperDbg, you should clone HyperDbg with the `--recursive` flag.
@ -35,13 +50,13 @@ Please visit **[Build & Install](https://docs.hyperdbg.org/getting-started/build
## Tutorials
The **[OpenSecurityTraining2's "Reversing with HyperDbg (Dbg3301)"](https://ost2.fyi/Dbg3301)** tutorial is the recommended way to get started with and learn HyperDbg, guiding you through the initial steps of using HyperDbg, covering essential concepts, principles, debugging functionalities, along with practical examples and numerous reverse engineering methods that are unique to HyperDbg.
The **OpenSecurityTraining2's "Reversing with HyperDbg (Dbg3301)**" tutorial series, available on [**OST2's website**](https://ost2.fyi/Dbg3301) (_preferred_) and [**YouTube**](https://www.youtube.com/playlist?list=PLUFkSN0XLZ-kF1f143wlw8ujlH2A45nZY) is the recommended way to get started with and learn HyperDbg. It guides you through the initial steps of using HyperDbg, covering essential concepts, principles, and debugging functionalities, along with practical examples and numerous reverse engineering methods that are unique to HyperDbg.
If you're interested in understanding the internal design and architecture of hypervisors and HyperDbg, you can read the [**Hypervisor From Scratch**](https://rayanfam.com/tutorials) tutorials.
## Publications
In case you use one of **HyperDbg**'s components in your work, please consider citing our paper.
In case you use one of **HyperDbg**'s components in your work, please consider citing our papers.
**1. [HyperDbg: Reinventing Hardware-Assisted Debugging (CCS'22)](https://dl.acm.org/doi/abs/10.1145/3548606.3560649)** [[arXiv](https://arxiv.org/abs/2207.05676)]
@ -54,15 +69,71 @@ In case you use one of **HyperDbg**'s components in your work, please consider c
year={2022}
}
```
<details>
You can also read [this article](https://research.hyperdbg.org/debugger/kernel-debugger-design.html) as it describes the overall architecture, technical difficulties, design decisions, and internals of HyperDbg Debugger, [this article](https://research.hyperdbg.org/debugger/transparency.html) about our efforts on vm-exit transparency, and [this article](https://research.hyperdbg.org/debugger/chasing-bugs.html) about chasing bugs within hypervisors. More articles, posts, and resources are available at the **[awesome](https://github.com/HyperDbg/awesome)** repo, and in addition, the **[slides](https://github.com/HyperDbg/slides)** repo provides presentation slides for further reference.
<summary><b>Other paper built upon HyperDbg...</b></summary>
**2. [hwdbg: Debugging Hardware Like Software (EuroSec'25)](https://dl.acm.org/doi/abs/10.1145/3722041.3723101)** [[PDF](https://dl.acm.org/doi/pdf/10.1145/3722041.3723101)]
```
@inproceedings{karvandi2025hwdbg,
title={hwdbg: Debugging Hardware Like Software},
author={Karvandi, Mohammad Sina and Meghdadizanjani, Soroush and Monfared, Saleh Khalaj and van der Kouwe, Erik and Slowinska, Asia},
booktitle={Proceedings of the 18th European Workshop on Systems Security},
pages={56--62},
year={2025}
}
```
**3. [HyperEvade: Countering Anti-Debugging Techniques and Enhancing Transparency in Nested Virtualization using HyperDbg (DEBT'25)](https://www.jot.fm/contents/issue_2026_01/a8.html)** [[PDF](https://www.jot.fm/issues/issue_2026_01/a8.pdf)]
```
@article{ruytenberg2026hyperevade,
title={HyperEvade: Countering Anti-Debugging Techniques and Enhancing Transparency in Nested Virtualization using HyperDbg},
author={Ruytenberg, Bj{\"o}rn and Karvandi, Mohammad Sina},
journal={Journal of Object Technology},
volume={25},
number={1},
pages={1--3},
year={2026},
publisher={Association Internationale pour les Technologies Objets}
}
```
**4. [Digital Hole: Bypassing Commercial Audio DRM Solutions with DReaMcatcher (EuroSys'26)](https://dl.acm.org/doi/abs/10.1145/3767295.3803583)** [[PDF](https://dl.acm.org/doi/pdf/10.1145/3767295.3803583)]
```
@inproceedings{ruytenberg2026digital,
title={Digital Hole: Bypassing Commercial Audio DRM Solutions with DReaMcatcher},
author={Ruytenberg, Bj{\"o}rn and Karvandi, Mohammad Sina and Bos, Herbert and van der Kouwe, Erik and Slowinska, Asia},
booktitle={Proceedings of the 21st European Conference on Computer Systems},
pages={484--496},
year={2026}
}
```
**5. [TRM: An Efficient Hypervisor-Based Framework For Malware Analysis and Memory Reconstruction (AsiaCCS'26)](https://dl.acm.org/doi/10.1145/3779208.3785293)** [[PDF](https://dl.acm.org/doi/pdf/10.1145/3779208.3785293)]
```
@inproceedings{karvandi2026trm,
title={TRM: An Efficient Hypervisor-Based Framework For Malware Analysis and Memory Reconstruction},
author={Karvandi, Mohammad Sina and Meghdadizanjani, Soroush and Arasteh, Sima and Monfared, Saleh Khalaj and Fallah, Mohammad K and Gorgin, Saeid and Lee, Jeong-A and Slowinska, Asia and van der Kouwe, Erik},
booktitle={Proceedings of the ACM Asia Conference on Computer and Communications Security},
pages={68--82},
year={2026}
}
```
</details>
You can also read [this article](https://research.hyperdbg.org/debugger/kernel-debugger-design/) as it describes the overall architecture, technical difficulties, design decisions, and internals of HyperDbg Debugger, [this article](https://research.hyperdbg.org/vmm/transparency/) about our efforts on vm-exit transparency, [this article](https://research.hyperdbg.org/debugger/chasing-bugs/) about chasing bugs within hypervisors, and [this article](https://research.hyperdbg.org/debugger/gaining-insights/) about new reverse engineering techniques introduced in HyperDbg. More articles, posts, and resources are available at the **[awesome](https://github.com/HyperDbg/awesome)** repo, and in addition, the **[slides](https://github.com/HyperDbg/slides)** repo provides presentation slides for further reference.
## Unique Features
### First Release (v0.1.0.0)
* Advanced Hypervisor-based Kernel Mode Debugger [<a href="https://docs.hyperdbg.org/using-hyperdbg/kernel-mode-debugging" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/getting-started/attach-to-hyperdbg/debug" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/getting-started/attach-to-hyperdbg/local-debugging" target="_blank">link</a>]
* Classic EPT Hook (Hidden Breakpoint) [<a href="https://docs.hyperdbg.org/commands/extension-commands/epthook" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/design/features/vmm-module/design-of-epthook" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/using-hyperdbg/kernel-mode-debugging/examples/events/hooking-any-function" target="_blank">link</a>]
* Inline EPT Hook (Inline Hook) [<a href="https://docs.hyperdbg.org/commands/extension-commands/epthook2" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/design/features/vmm-module/design-of-epthook2" target="_blank">link</a>]
* Monitor Memory For R/W (Emulating Hardware Debug Registers Without Limitation) [<a href="https://docs.hyperdbg.org/commands/extension-commands/monitor" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/design/features/vmm-module/design-of-monitor" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/using-hyperdbg/kernel-mode-debugging/examples/events/monitoring-accesses-to-structures" target="_blank">link</a>]
* Monitor Memory for R/W (Emulating Hardware Debug Registers Without Limitation) [<a href="https://docs.hyperdbg.org/commands/extension-commands/monitor" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/design/features/vmm-module/design-of-monitor" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/using-hyperdbg/kernel-mode-debugging/examples/events/monitoring-accesses-to-structures" target="_blank">link</a>]
* SYSCALL Hook (Disable EFER & Handle #UD) [<a href="https://docs.hyperdbg.org/commands/extension-commands/syscall" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/design/features/vmm-module/design-of-syscall-and-sysret" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/using-hyperdbg/kernel-mode-debugging/examples/events/intercepting-all-syscalls" target="_blank">link</a>]
* SYSRET Hook (Disable EFER & Handle #UD) [<a href="https://docs.hyperdbg.org/commands/extension-commands/sysret" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/design/features/vmm-module/design-of-syscall-and-sysret" target="_blank">link</a>]
* CPUID Hook & Monitor [<a href="https://docs.hyperdbg.org/commands/extension-commands/cpuid" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/using-hyperdbg/kernel-mode-debugging/examples/events/triggering-special-instructions" target="_blank">link</a>]
@ -72,15 +143,15 @@ You can also read [this article](https://research.hyperdbg.org/debugger/kernel-d
* RDPMC Hook & Monitor [<a href="https://docs.hyperdbg.org/commands/extension-commands/pmc" target="_blank">link</a>]
* VMCALL Hook & Monitor [<a href="https://docs.hyperdbg.org/commands/extension-commands/vmcall" target="_blank">link</a>]
* Debug Registers Hook & Monitor [<a href="https://docs.hyperdbg.org/commands/extension-commands/dr" target="_blank">link</a>]
* I/O Port (In Instruction) Hook & Monitor [<a href="https://docs.hyperdbg.org/commands/extension-commands/ioin" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/using-hyperdbg/kernel-mode-debugging/examples/events/triggering-special-instructions" target="_blank">link</a>]
* I/O Port (Out Instruction) Hook & Monitor [<a href="https://docs.hyperdbg.org/commands/extension-commands/ioout" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/using-hyperdbg/kernel-mode-debugging/examples/events/triggering-special-instructions" target="_blank">link</a>]
* I/O Port (IN Instruction) Hook & Monitor [<a href="https://docs.hyperdbg.org/commands/extension-commands/ioin" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/using-hyperdbg/kernel-mode-debugging/examples/events/triggering-special-instructions" target="_blank">link</a>]
* I/O Port (OUT Instruction) Hook & Monitor [<a href="https://docs.hyperdbg.org/commands/extension-commands/ioout" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/using-hyperdbg/kernel-mode-debugging/examples/events/triggering-special-instructions" target="_blank">link</a>]
* MMIO Monitor [<a href="https://docs.hyperdbg.org/commands/extension-commands/monitor" target="_blank">link</a>]
* Exception (IDT < 32) Monitor [<a href="https://docs.hyperdbg.org/commands/extension-commands/exception" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/design/features/vmm-module/design-of-exception-and-interrupt" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/using-hyperdbg/kernel-mode-debugging/examples/events/identifying-system-behavior" target="_blank">link</a>]
* External-Interrupt (IDT > 32) Monitor [<a href="https://docs.hyperdbg.org/commands/extension-commands/interrupt" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/design/features/vmm-module/design-of-exception-and-interrupt" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/using-hyperdbg/kernel-mode-debugging/examples/events/identifying-system-behavior" target="_blank">link</a>]
* Running Automated Scripts [<a href="https://docs.hyperdbg.org/commands/scripting-language/debugger-script" target="_blank">link</a>]
* Transparent-mode (Anti-debugging and Anti-hypervisor Resistance) [<a href="https://docs.hyperdbg.org/tips-and-tricks/considerations/transparent-mode" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/using-hyperdbg/kernel-mode-debugging/examples/misc/defeating-anti-debug-and-anti-hypervisor-methods" target="_blank">link</a>]
* Running Custom Assembly In Both VMX-root, VMX non-root (Kernel & User) [<a href="https://docs.hyperdbg.org/using-hyperdbg/prerequisites/how-to-create-an-action" target="_blank">link</a>]
* Checking For Custom Conditions [<a href="https://docs.hyperdbg.org/using-hyperdbg/prerequisites/how-to-create-a-condition" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/design/debugger-internals/conditions" target="_blank">link</a>]
* Transparent-mode and Hyperevade Project (Anti-debugging and Anti-hypervisor Resistance) [<a href="https://docs.hyperdbg.org/tips-and-tricks/considerations/transparent-mode" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/commands/extension-commands/hide" target="_blank">link</a>][<a href="https://www.vusec.net/projects/hyperevade/" target="_blank">link</a>]
* Running Custom Assembly in Both VMX-root, VMX non-root (Kernel & User) [<a href="https://docs.hyperdbg.org/using-hyperdbg/prerequisites/how-to-create-an-action" target="_blank">link</a>]
* Checking for Custom Conditions [<a href="https://docs.hyperdbg.org/using-hyperdbg/prerequisites/how-to-create-a-condition" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/design/debugger-internals/conditions" target="_blank">link</a>]
* Process-specific & Thread-specific Debugging [<a href="https://docs.hyperdbg.org/commands/meta-commands/.process" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/commands/meta-commands/.thread" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/using-hyperdbg/user-mode-debugging/examples/basics/switching-to-a-specific-process-or-thread" target="_blank">link</a>]
* VMX-root Compatible Message Tracing [<a href="https://docs.hyperdbg.org/design/features/vmm-module/vmx-root-mode-compatible-message-tracing" target="_blank">link</a>]
* Powerful Kernel Side Scripting Engine [<a href="https://docs.hyperdbg.org/commands/scripting-language" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/design/script-engine" target="_blank">link</a>]
@ -89,27 +160,26 @@ You can also read [this article](https://research.hyperdbg.org/debugger/kernel-d
* Event Forwarding (#DFIR) [<a href="https://docs.hyperdbg.org/tips-and-tricks/misc/event-forwarding" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/commands/debugging-commands/output" target="_blank">link</a>]
* Transparent Breakpoint Handler [<a href="https://docs.hyperdbg.org/commands/debugging-commands/bp" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/using-hyperdbg/kernel-mode-debugging/examples/basics/setting-breakpoints-and-stepping-instructions" target="_blank">link</a>]
* Various Custom Scripts [<a href="https://github.com/HyperDbg/scripts" target="_blank">link</a>]
### Second Release (v0.2.0.0)
* HyperDbg Software Development Kit (SDK) [<a href="https://docs.hyperdbg.org/using-hyperdbg/sdk" target="_blank">link</a>]
### Third Release (v0.3.0.0)
* Event Short-circuiting [<a href="https://docs.hyperdbg.org/tips-and-tricks/misc/event-short-circuiting" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/commands/scripting-language/functions/events/event_sc" target="_blank">link</a>]
* Tracking records of function calls and return addresses [<a href="https://docs.hyperdbg.org/commands/extension-commands/track" target="_blank">link</a>]
* Tracking Records of Function Calls and Return Addresses [<a href="https://docs.hyperdbg.org/commands/extension-commands/track" target="_blank">link</a>]
* Kernel-level Length Disassembler Engine (LDE) [<a href="https://docs.hyperdbg.org/commands/scripting-language/functions/diassembler/disassemble_len" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/commands/scripting-language/functions/diassembler/disassemble_len32" target="_blank">link</a>]
### Fourth Release (v0.4.0.0)
* Memory Execution Monitor & Execution Blocking [<a href="https://docs.hyperdbg.org/commands/extension-commands/monitor" target="_blank">link</a>]
* Custom Page-fault Injection [<a href="https://docs.hyperdbg.org/commands/meta-commands/.pagein" target="_blank">link</a>]
### Fifth Release (v0.5.0.0)
* Different Event Calling Stages [<a href="https://docs.hyperdbg.org/tips-and-tricks/misc/event-calling-stage" target="_blank">link</a>]
### Sixth Release (v0.6.0.0)
* Injecting Custom Interrupts/Exceptions/Faults [<a href="https://docs.hyperdbg.org/commands/scripting-language/functions/events/event_inject" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/commands/scripting-language/functions/events/event_inject_error_code" target="_blank">link</a>]
### Seventh Release (v0.7.0.0)
* Instant events in the Debugger Mode [<a href="https://docs.hyperdbg.org/tips-and-tricks/misc/instant-events" target="_blank">link</a>]
* Instant Events in the Debugger Mode [<a href="https://docs.hyperdbg.org/tips-and-tricks/misc/instant-events" target="_blank">link</a>]
* Detecting Kernel-to-user and User-to-kernel Transitions [<a href="https://docs.hyperdbg.org/commands/extension-commands/mode" target="_blank">link</a>]
* Physical Memory Monitoring Hooks [<a href="https://docs.hyperdbg.org/commands/extension-commands/monitor" target="_blank">link</a>]
* Enumerating PCI/PCI-e Devices [<a href="https://docs.hyperdbg.org/commands/extension-commands/pcitree" target="_blank">link</a>]
* Interpreting and Dumping PCI/PCI-e Configuration Space (CAM) [<a href="https://docs.hyperdbg.org/commands/extension-commands/pcicam" target="_blank">link</a>]
* Dumping IDT Entries, I/O APIC, and Local APIC in XAPIC and X2APIC Modes [<a href="https://docs.hyperdbg.org/commands/extension-commands/idt" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/commands/extension-commands/ioapic" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/commands/extension-commands/apic" target="_blank">link</a>]
* Triggering and Counting System Management Mode (SMM) Interrupts (SMIs) [<a href="https://docs.hyperdbg.org/commands/extension-commands/smi" target="_blank">link</a>]
* Attaching to the User-mode Process and Preventing Execution [<a href="https://docs.hyperdbg.org/commands/meta-commands/.attach" target="_blank">link</a>]
* Intercepting Execution of XSETBV Instructions [<a href="https://docs.hyperdbg.org/commands/extension-commands/xsetbv" target="_blank">link</a>]
* Writing Library Script Files [<a href="https://docs.hyperdbg.org/commands/scripting-language/casting-and-inclusion" target="_blank">link</a>]
* Enhanced Portable Executable (PE) Parser [<a href="https://docs.hyperdbg.org/commands/meta-commands/.pe" target="_blank">link</a>]
* Tracing Branches using Last Branch Record (LBR) [<a href="https://docs.hyperdbg.org/commands/extension-commands/lbr" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/commands/extension-commands/lbrdump" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/commands/scripting-language/functions/tracing/lbr/lbr_print" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/commands/scripting-language/functions/tracing/lbr/lbr_save" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/commands/scripting-language/functions/tracing/lbr/lbr_check" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/commands/scripting-language/functions/tracing/lbr/lbr_restore" target="_blank">link</a>][<a href="https://docs.hyperdbg.org/commands/scripting-language/functions/tracing/lbr/lbr_restore_by_filter" target="_blank">link</a>]
## How does it work?
@ -121,15 +191,17 @@ You can read about the internal design of HyperDbg and its features in the [docu
</br>
## Scripts
You can write your **[scripts](https://github.com/HyperDbg/scripts)** to automate your debugging journey. **HyperDbg** has a powerful, fast, and entirely kernel-side implemented [script engine](https://docs.hyperdbg.org/commands/scripting-language).
## Contributing
Contributing to HyperDbg is super appreciated. We have made a list of potential [tasks](https://github.com/HyperDbg/HyperDbg/blob/master/CONTRIBUTING.md#things-to-work-on) that you might be interested in contributing towards.
If you want to contribute to HyperDbg, please read the [Contribution Guide](https://github.com/HyperDbg/HyperDbg/blob/master/CONTRIBUTING.md).
## License
**HyperDbg**, and all its submodules and repos, unless a license is otherwise specified, are licensed under **GPLv3** LICENSE.
Dependencies are licensed by their own.

3
examples/README.md Normal file
View file

@ -0,0 +1,3 @@
# User-Mode and Kernel-Mode Examples
Examples for user-mode and kernel-mode are **NOT** yet completed and are currently **under construction**!

View file

@ -0,0 +1,3 @@
NOTE
============
Build it directly from the main HyperDbg solution file. Do not build it independently, as it requires dependency files from the main HyperDbg libraries to be built first.

View file

@ -0,0 +1,20 @@
# Code generated by Visual Studio kit, DO NOT EDIT.
set(SourceFiles
"header/core/Core.h"
"header/driver/Driver.h"
"header/driver/Loader.h"
"header/misc/Global.h"
"header/pch.h"
"code/core/Core.c"
"code/driver/Driver.c"
"code/driver/Ioctl.c"
"code/driver/Loader.c"
)
include_directories(
"../../../hyperdbg/include"
"header"
)
wdk_add_driver(hyperdbg_driver
KMDF 1.15
${SourceFiles}
)

View file

@ -73,13 +73,17 @@ DriverEntry(
//
// Establish user-buffer access method.
//
DeviceObject->Flags |= DO_BUFFERED_IO;
if (DeviceObject != NULL)
{
DeviceObject->Flags |= DO_BUFFERED_IO;
}
//
// We cannot use logging mechanism of HyperDbg as it's not initialized yet
//
DbgPrint("HyperDbg's device and major functions are loaded");
ASSERT(NT_SUCCESS(Ntstatus));
return Ntstatus;
}
@ -102,7 +106,7 @@ DrvUnload(PDRIVER_OBJECT DriverObject)
//
// Unloading VMM and Debugger
//
LoaderUninitializeLogTracer();
LoaderUninitLogTracer();
}
/**
@ -115,6 +119,8 @@ DrvUnload(PDRIVER_OBJECT DriverObject)
NTSTATUS
DrvCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
UNREFERENCED_PARAMETER(DeviceObject);
//
// Check for privilege
//
@ -185,6 +191,8 @@ DrvCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS
DrvRead(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
UNREFERENCED_PARAMETER(DeviceObject);
//
// Not used
//
@ -207,6 +215,8 @@ DrvRead(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS
DrvWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
UNREFERENCED_PARAMETER(DeviceObject);
//
// Not used
//
@ -229,6 +239,8 @@ DrvWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS
DrvClose(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
UNREFERENCED_PARAMETER(DeviceObject);
//
// If the close is called means that all of the IOCTLs
// are not in a pending state so we can safely allow
@ -253,6 +265,8 @@ DrvClose(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS
DrvUnsupported(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
UNREFERENCED_PARAMETER(DeviceObject);
//
// Not supported
//

View file

@ -26,15 +26,17 @@ DrvDispatchIoControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
PREGISTER_NOTIFY_BUFFER RegisterEventRequest;
NTSTATUS Status;
UNREFERENCED_PARAMETER(DeviceObject);
//
// Here's the best place to see if there is any allocation pending
// to be allcated as we're in PASSIVE_LEVEL
//
// DO NOT CHANGE CALLING OF THE FOLLOWING FUNCTION
//
PoolManagerCheckAndPerformAllocationAndDeallocation();
// PoolManagerCheckAndPerformAllocationAndDeallocation();
if (g_AllowIOCTLFromUsermode)
if (g_VmmInitialized)
{
IrpStack = IoGetCurrentIrpStackLocation(Irp);
@ -62,13 +64,24 @@ DrvDispatchIoControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
switch (RegisterEventRequest->Type)
{
case IRP_BASED:
Status = LogRegisterIrpBasedNotification(DeviceObject, Irp);
LogRegisterIrpBasedNotification((PVOID)Irp, &Status);
break;
case EVENT_BASED:
Status = LogRegisterEventBasedNotification(DeviceObject, Irp);
if (LogRegisterEventBasedNotification((PVOID)Irp))
{
Status = STATUS_SUCCESS;
}
else
{
Status = STATUS_UNSUCCESSFUL;
}
break;
default:
LogError("Err, unknow notification type from user-mode");
LogError("Err, unknown notification type from user-mode");
Status = STATUS_INVALID_PARAMETER;
break;
}

View file

@ -24,12 +24,12 @@ LoaderInitVmmAndReversingMachine()
//
// Allow to server IOCTL
//
g_AllowIOCTLFromUsermode = TRUE;
g_VmmInitialized = TRUE;
//
// Fill the callbacks for the message tracer
//
MsgTracingCallbacks.VmxOpeationCheck = VmFuncVmxGetCurrentExecutionMode;
MsgTracingCallbacks.VmxOperationCheck = VmFuncVmxGetCurrentExecutionMode;
// MsgTracingCallbacks.CheckImmediateMessageSending = KdCheckImmediateMessagingMechanism;
// MsgTracingCallbacks.SendImmediateMessage = KdLoggingResponsePacketToDebugger;
@ -90,7 +90,7 @@ LoaderInitVmmAndReversingMachine()
//
// Not loaded
//
g_AllowIOCTLFromUsermode = FALSE;
g_VmmInitialized = FALSE;
return FALSE;
}
@ -101,7 +101,7 @@ LoaderInitVmmAndReversingMachine()
* @return VOID
*/
VOID
LoaderUninitializeLogTracer()
LoaderUninitLogTracer()
{
LogDebugInfo("Unloading HyperDbg's debugger...\n");

View file

@ -17,7 +17,7 @@
//////////////////////////////////////////////////
VOID
LoaderUninitializeLogTracer();
LoaderUninitLogTracer();
BOOLEAN
LoaderInitVmmAndReversingMachine();

View file

@ -18,7 +18,7 @@
BOOLEAN g_HandleInUse;
/**
* @brief Determines whether the clients are allowed to send IOCTL to the drive or not
* @brief Shows whether the VMM is initialized or not
*
*/
BOOLEAN g_AllowIOCTLFromUsermode;
BOOLEAN g_VmmInitialized;

View file

@ -9,12 +9,6 @@
* @copyright This project is released under the GNU Public License v3.
*
*/
#include <ntifs.h>
#include <ntddk.h>
#include <wdf.h>
#include <wdm.h>
#include <ntstrsafe.h>
#include <Windef.h>
//
// Scope definitions
@ -23,14 +17,15 @@
#define HYPERDBG_RM
//
// Definition of Intel primitives (External header)
// General WDK headers
//
// #include "ia32-doc/out/ia32.h"
#include <ntifs.h>
#include <Windef.h>
//
// Import Configuration and Definitions
//
#include "Configuration.h"
#include "config/Configuration.h"
//
// Macros
@ -45,15 +40,15 @@
//
// Import HyperLog Module
//
#include "SDK/Modules/HyperLog.h"
#include "SDK/Imports/HyperDbgHyperLogImports.h"
#include "SDK/Imports/HyperDbgHyperLogIntrinsics.h"
#include "SDK/modules/HyperLog.h"
#include "SDK/imports/kernel/HyperDbgHyperLogImports.h"
#include "SDK/imports/kernel/HyperDbgHyperLogIntrinsics.h"
//
// Import VMM Module
//
#include "SDK/Modules/VMM.h"
#include "SDK/Imports/HyperDbgVmmImports.h"
#include "SDK/modules/VMM.h"
#include "SDK/imports/kernel/HyperDbgVmmImports.h"
//
// Local Driver headers

View file

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\hyperdbg\packages\Microsoft.Windows.SDK.CPP.x64.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.x64.props" Condition="Exists('..\..\..\hyperdbg\packages\Microsoft.Windows.SDK.CPP.x64.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.x64.props')" />
<Import Project="..\..\..\hyperdbg\packages\Microsoft.Windows.SDK.CPP.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.props" Condition="Exists('..\..\..\hyperdbg\packages\Microsoft.Windows.SDK.CPP.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.props')" />
<Import Project="..\..\..\hyperdbg\packages\Microsoft.Windows.WDK.x64.10.0.28000.1839\build\native\Microsoft.Windows.WDK.x64.props" Condition="Exists('..\..\..\hyperdbg\packages\Microsoft.Windows.WDK.x64.10.0.28000.1839\build\native\Microsoft.Windows.WDK.x64.props')" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="debug|x64">
<Configuration>debug</Configuration>
@ -9,14 +12,6 @@
<Configuration>release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="debug|ARM64">
<Configuration>debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="release|ARM64">
<Configuration>release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{79AB8BD3-03A4-4B65-ABF6-313C10A00CC5}</ProjectGuid>
@ -47,22 +42,6 @@
<DriverTargetPlatform>Universal</DriverTargetPlatform>
<Driver_SpectreMitigation>false</Driver_SpectreMitigation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|ARM64'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>KMDF</DriverType>
<DriverTargetPlatform>Universal</DriverTargetPlatform>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|ARM64'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>KMDF</DriverType>
<DriverTargetPlatform>Universal</DriverTargetPlatform>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -81,27 +60,21 @@
<OutDir>$(SolutionDir)build\bin\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|ARM64'">
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|ARM64'">
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
<DriverSign>
<FileDigestAlgorithm>sha256</FileDigestAlgorithm>
</DriverSign>
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)\include;$(ProjectDir)header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)include;$(ProjectDir)header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ClCompile>
<TreatWarningAsError>false</TreatWarningAsError>
<TreatWarningAsError>true</TreatWarningAsError>
<PrecompiledHeader>Create</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<TreatLinkerWarningAsErrors>false</TreatLinkerWarningAsErrors>
<AdditionalDependencies>$(SolutionDir)build\bin\$(Configuration)\hyperlog.lib;$(SolutionDir)build\bin\$(Configuration)\hprdbghv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
<AdditionalDependencies>$(SolutionDir)build\bin\$(Configuration)\hyperlog.lib;$(SolutionDir)build\bin\$(Configuration)\hyperhv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>DriverEntry</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
@ -110,29 +83,20 @@
<FileDigestAlgorithm>sha256</FileDigestAlgorithm>
</DriverSign>
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)\include;$(ProjectDir)header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)include;$(ProjectDir)header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ClCompile>
<TreatWarningAsError>false</TreatWarningAsError>
<TreatWarningAsError>true</TreatWarningAsError>
<PrecompiledHeader>Create</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<Optimization>Full</Optimization>
</ClCompile>
<Link>
<TreatLinkerWarningAsErrors>false</TreatLinkerWarningAsErrors>
<AdditionalDependencies>$(SolutionDir)build\bin\$(Configuration)\hyperlog.lib;$(SolutionDir)build\bin\$(Configuration)\hprdbghv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
<AdditionalDependencies>$(SolutionDir)build\bin\$(Configuration)\hyperlog.lib;$(SolutionDir)build\bin\$(Configuration)\hyperhv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>DriverEntry</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|ARM64'">
<DriverSign>
<FileDigestAlgorithm>sha256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|ARM64'">
<DriverSign>
<FileDigestAlgorithm>sha256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup>
<ItemGroup>
<FilesToPackage Include="$(TargetPath)" />
</ItemGroup>
@ -149,7 +113,20 @@
<ClCompile Include="code\driver\Ioctl.c" />
<ClCompile Include="code\driver\Loader.c" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\hyperdbg\packages\Microsoft.Windows.SDK.CPP.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.targets" Condition="Exists('..\..\..\hyperdbg\packages\Microsoft.Windows.SDK.CPP.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\hyperdbg\packages\Microsoft.Windows.WDK.x64.10.0.28000.1839\build\native\Microsoft.Windows.WDK.x64.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\hyperdbg\packages\Microsoft.Windows.WDK.x64.10.0.28000.1839\build\native\Microsoft.Windows.WDK.x64.props'))" />
<Error Condition="!Exists('..\..\..\hyperdbg\packages\Microsoft.Windows.SDK.CPP.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\hyperdbg\packages\Microsoft.Windows.SDK.CPP.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.props'))" />
<Error Condition="!Exists('..\..\..\hyperdbg\packages\Microsoft.Windows.SDK.CPP.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\hyperdbg\packages\Microsoft.Windows.SDK.CPP.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.targets'))" />
<Error Condition="!Exists('..\..\..\hyperdbg\packages\Microsoft.Windows.SDK.CPP.x64.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.x64.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\hyperdbg\packages\Microsoft.Windows.SDK.CPP.x64.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.x64.props'))" />
</Target>
</Project>

View file

@ -56,4 +56,7 @@
<Filter>code\driver</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.SDK.CPP" version="10.0.28000.1839" targetFramework="native" />
<package id="Microsoft.Windows.SDK.CPP.x64" version="10.0.28000.1839" targetFramework="native" />
<package id="Microsoft.Windows.WDK.x64" version="10.0.28000.1839" targetFramework="native" />
</packages>

3
examples/user/README.md Normal file
View file

@ -0,0 +1,3 @@
NOTE
============
Build it directly from the main HyperDbg solution file. Do not build it independently, as it requires dependency files from the main HyperDbg libraries to be built first.

View file

@ -0,0 +1,11 @@
# Code generated by Visual Studio kit, DO NOT EDIT.
set(SourceFiles
"../../../platform/user/header/Environment.h"
"header/pch.h"
"code/hyperdbg-app.cpp"
)
include_directories(
"../../../hyperdbg/include"
"header"
)
add_executable(hyperdbg_app ${SourceFiles})

View file

@ -0,0 +1,58 @@
#include "pch.h"
static int
ShowMessages(const char * Text)
{
printf("%s", Text);
return 0;
}
static int
LoadVmm()
{
hyperdbg_u_set_text_message_callback((PVOID)ShowMessages);
if (!hyperdbg_u_detect_vmx_support())
{
printf("[-] VT-x (VMX) is not supported / enabled on this processor\n");
return 1;
}
printf("[*] loading HyperDbg VMM...\n");
if (hyperdbg_u_install_kd_driver() == 1 || hyperdbg_u_load_vmm() == 1)
{
printf("[-] cannot load the HyperDbg VMM\n");
return 1;
}
printf("[+] HyperDbg VMM is running\n");
return 0;
}
int
main(int argc, char ** argv)
{
return main2(argc, argv);
if (LoadVmm() != 0)
{
return 1;
}
hyperdbg_u_run_command((CHAR*)"lm");
printf("[*] unloading HyperDbg VMM...\n");
//
// Unload the driver
//
hyperdbg_u_unload_vmm();
hyperdbg_u_unload_kd();
hyperdbg_u_stop_kd_driver();
hyperdbg_u_uninstall_kd_driver();
printf("[+] done\n");
return 0;
}

View file

@ -0,0 +1,583 @@
#include "pch.h"
#include <string.h>
#include <stdlib.h>
#include <dbghelp.h>
#include "../dependencies/libipt/intel-pt.h"
#include <Zydis/Zydis.h>
#pragma comment(lib, "dbghelp.lib")
static UINT64 g_ImageBase = 0;
static UINT64 g_CodeBase = 0;
static UINT64 g_CodeSize = 0;
static UINT8 * g_Code = NULL;
static int
ShowMessages(const char * Text)
{
printf("%s", Text);
return 0;
}
static int
ReadImage(uint8_t * Buffer, size_t Size, const struct pt_asid * Asid, uint64_t Ip, void * Context)
{
(void)Asid;
(void)Context;
if (g_Code == NULL || Ip < g_CodeBase || Ip >= g_CodeBase + g_CodeSize)
return -pte_nomap;
uint64_t Available = g_CodeBase + g_CodeSize - Ip;
size_t Count = (Size < Available) ? Size : (size_t)Available;
memcpy(Buffer, g_Code + (Ip - g_CodeBase), Count);
return (int)Count;
}
typedef struct _PROC_BASIC_INFO
{
LONG ExitStatus;
PVOID PebBaseAddress;
ULONG_PTR Reserved[4];
} PROC_BASIC_INFO;
typedef LONG(NTAPI * PFN_NT_QIP)(HANDLE, ULONG, PVOID, ULONG, PULONG);
static BOOLEAN
CaptureImage(HANDLE Process, UINT64 * TextStart, UINT64 * TextEnd)
{
HMODULE Ntdll = GetModuleHandleA("ntdll.dll");
PFN_NT_QIP NtQip = Ntdll ? (PFN_NT_QIP)GetProcAddress(Ntdll, "NtQueryInformationProcess") : NULL;
PROC_BASIC_INFO Pbi = {0};
ULONG Ret = 0;
SIZE_T Got = 0;
UINT64 Base = 0;
IMAGE_DOS_HEADER Dos;
IMAGE_NT_HEADERS64 Nt;
UINT64 SectionBase;
if (NtQip == NULL || NtQip(Process, 0, &Pbi, sizeof(Pbi), &Ret) < 0 || Pbi.PebBaseAddress == NULL)
return FALSE;
if (!ReadProcessMemory(Process, (PBYTE)Pbi.PebBaseAddress + 0x10, &Base, sizeof(Base), &Got) || Base == 0)
return FALSE;
if (!ReadProcessMemory(Process, (PVOID)Base, &Dos, sizeof(Dos), &Got) || Dos.e_magic != IMAGE_DOS_SIGNATURE)
return FALSE;
if (!ReadProcessMemory(Process, (PBYTE)Base + Dos.e_lfanew, &Nt, sizeof(Nt), &Got) || Nt.Signature != IMAGE_NT_SIGNATURE)
return FALSE;
g_ImageBase = Base;
SectionBase = Base + Dos.e_lfanew + FIELD_OFFSET(IMAGE_NT_HEADERS64, OptionalHeader) + Nt.FileHeader.SizeOfOptionalHeader;
for (WORD i = 0; i < Nt.FileHeader.NumberOfSections; i++)
{
IMAGE_SECTION_HEADER Section;
if (!ReadProcessMemory(Process, (PBYTE)SectionBase + (UINT64)i * sizeof(Section), &Section, sizeof(Section), &Got))
return FALSE;
if (memcmp(Section.Name, ".text", 6) != 0)
continue;
UINT64 Start = Base + Section.VirtualAddress;
UINT64 Size = Section.Misc.VirtualSize ? Section.Misc.VirtualSize : Section.SizeOfRawData;
if (Size == 0)
return FALSE;
g_Code = (UINT8 *)malloc((size_t)Size);
if (g_Code == NULL)
return FALSE;
if (!ReadProcessMemory(Process, (PVOID)Start, g_Code, (SIZE_T)Size, &Got) || Got != Size)
{
free(g_Code);
g_Code = NULL;
return FALSE;
}
g_CodeBase = Start;
g_CodeSize = Size;
*TextStart = Start;
*TextEnd = Start + Size - 1;
return TRUE;
}
return FALSE;
}
static BOOLEAN
ResolveFunction(HANDLE Process, const char * Path, const char * Name, UINT64 * Start, UINT64 * End)
{
union
{
SYMBOL_INFO Info;
BYTE Buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
} Symbol = {0};
BOOLEAN Ok = FALSE;
SymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS);
if (!SymInitialize(Process, NULL, FALSE))
return FALSE;
if (SymLoadModuleEx(Process, NULL, Path, NULL, (DWORD64)g_ImageBase, 0, NULL, 0) != 0)
{
Symbol.Info.SizeOfStruct = sizeof(SYMBOL_INFO);
Symbol.Info.MaxNameLen = MAX_SYM_NAME;
if (SymFromName(Process, Name, &Symbol.Info) && Symbol.Info.Address != 0)
{
*Start = Symbol.Info.Address;
*End = Symbol.Info.Address + (Symbol.Info.Size ? Symbol.Info.Size : 0x200) - 1;
Ok = TRUE;
}
}
SymCleanup(Process);
return Ok;
}
static BOOLEAN
PtOperation(HYPERTRACE_PT_OPERATION_REQUEST_TYPE Type)
{
HYPERTRACE_PT_OPERATION_PACKETS Op = {};
Op.PtOperationType = Type;
return hyperdbg_u_pt_operation(&Op);
}
static BOOLEAN
PtFilter(UINT32 ProcessId, UINT64 Start, UINT64 End)
{
HYPERTRACE_PT_OPERATION_PACKETS Op = {};
Op.PtOperationType = HYPERTRACE_PT_OPERATION_REQUEST_TYPE_FILTER;
Op.FilterOptions.TraceUser = 1;
Op.EnableOptions.Pid = ProcessId;
if (End > Start)
{
Op.FilterOptions.NumAddrRanges = 1;
Op.FilterOptions.AddrRanges[0].Start = Start;
Op.FilterOptions.AddrRanges[0].End = End;
}
if (!hyperdbg_u_pt_operation(&Op))
return FALSE;
printf("[+] PT filter: cr3=0x%llx traceuser=%u ranges=%u buffer=0x%llx\n",
(unsigned long long)Op.EnableOptions.Cr3,
Op.FilterOptions.TraceUser,
Op.FilterOptions.NumAddrRanges,
(unsigned long long)Op.BufferSize);
return TRUE;
}
static const char *
PacketName(enum pt_packet_type Type)
{
switch (Type)
{
case ppt_psb: return "PSB"; case ppt_psbend: return "PSBEND"; case ppt_pad: return "PAD";
case ppt_fup: return "FUP"; case ppt_tip: return "TIP"; case ppt_tip_pge: return "TIP.PGE";
case ppt_tip_pgd: return "TIP.PGD"; case ppt_tnt_8: return "TNT8"; case ppt_tnt_64: return "TNT64";
case ppt_mode: return "MODE"; case ppt_pip: return "PIP"; case ppt_vmcs: return "VMCS";
case ppt_cbr: return "CBR"; case ppt_tsc: return "TSC"; case ppt_tma: return "TMA";
case ppt_mtc: return "MTC"; case ppt_cyc: return "CYC"; case ppt_ovf: return "OVF";
case ppt_stop: return "STOP"; case ppt_exstop: return "EXSTOP"; case ppt_mnt: return "MNT";
case ppt_ptw: return "PTW"; default: return "?";
}
}
static uint64_t
ReconstructIp(const struct pt_packet_ip * Packet, uint64_t * LastIp)
{
uint64_t Value = *LastIp;
switch (Packet->ipc)
{
case pt_ipc_update_16: Value = (Value & ~0xffffull) | (Packet->ip & 0xffffull); break;
case pt_ipc_update_32: Value = (Value & ~0xffffffffull) | (Packet->ip & 0xffffffffull); break;
case pt_ipc_update_48: Value = (Value & ~0xffffffffffffull) | (Packet->ip & 0xffffffffffffull); break;
case pt_ipc_sext_48:
Value = Packet->ip & 0xffffffffffffull;
if (Value & 0x800000000000ull)
Value |= 0xffff000000000000ull;
break;
default: Value = Packet->ip; break;
}
*LastIp = Value;
return Value;
}
static UINT64
DecodeCorePackets(UINT32 Cpu, const UINT8 * Buffer, UINT64 Size)
{
struct pt_config Config;
struct pt_packet_decoder * Decoder;
UINT64 Count = 0;
uint64_t LastIp = 0;
int Status;
pt_config_init(&Config);
Config.begin = (uint8_t *)Buffer;
Config.end = (uint8_t *)Buffer + Size;
Decoder = pt_pkt_alloc_decoder(&Config);
if (Decoder == NULL)
{
printf("[-] core %u: cannot allocate packet decoder\n", Cpu);
return 0;
}
for (;;)
{
Status = pt_pkt_sync_forward(Decoder);
if (Status < 0)
break;
for (;;)
{
struct pt_packet Packet;
Status = pt_pkt_next(Decoder, &Packet, sizeof(Packet));
if (Status < 0)
break;
Count++;
switch (Packet.type)
{
case ppt_tnt_8:
case ppt_tnt_64:
printf(" %-8s %2u ", PacketName(Packet.type), Packet.payload.tnt.bit_size);
for (uint8_t Bit = 0; Bit < Packet.payload.tnt.bit_size && Bit < 64; Bit++)
putchar(((Packet.payload.tnt.payload >> (Packet.payload.tnt.bit_size - 1 - Bit)) & 1) ? 'T' : 'N');
putchar('\n');
break;
case ppt_tip:
case ppt_fup:
case ppt_tip_pge:
case ppt_tip_pgd:
if (Packet.payload.ip.ipc == pt_ipc_suppressed)
printf(" %-8s (ip suppressed)\n", PacketName(Packet.type));
else
{
uint64_t Ip = ReconstructIp(&Packet.payload.ip, &LastIp);
printf(" %-8s 0x%016llx exe+0x%llx\n",
PacketName(Packet.type), (unsigned long long)Ip, (unsigned long long)(Ip - g_ImageBase));
}
break;
case ppt_pip:
printf(" %-8s cr3=0x%llx\n", PacketName(Packet.type), (unsigned long long)Packet.payload.pip.cr3);
break;
case ppt_cbr:
//printf(" %-8s ratio=%u\n", PacketName(Packet.type), Packet.payload.cbr.ratio);
break;
case ppt_tsc:
printf(" %-8s tsc=0x%llx\n", PacketName(Packet.type), (unsigned long long)Packet.payload.tsc.tsc);
break;
default:
//printf(" %-8s\n", PacketName(Packet.type));
break;
}
}
}
pt_pkt_free_decoder(Decoder);
return Count;
}
static UINT64
DecodeCore(UINT32 Cpu, const UINT8 * Buffer, UINT64 Size)
{
struct pt_config Config;
struct pt_insn_decoder * Decoder;
struct pt_image * Image;
UINT64 Count = 0;
int Status;
pt_config_init(&Config);
Config.begin = (uint8_t *)Buffer;
Config.end = (uint8_t *)Buffer + Size;
Decoder = pt_insn_alloc_decoder(&Config);
if (Decoder == NULL)
{
printf("[-] core %u: cannot allocate instruction decoder\n", Cpu);
return 0;
}
Image = pt_insn_get_image(Decoder);
pt_image_set_callback(Image, ReadImage, NULL);
for (;;)
{
Status = pt_insn_sync_forward(Decoder);
if (Status < 0)
break;
for (;;)
{
struct pt_insn Insn;
while (Status & pts_event_pending)
{
struct pt_event Event;
Status = pt_insn_event(Decoder, &Event, sizeof(Event));
if (Status < 0)
break;
}
if (Status < 0 || (Status & pts_eos))
break;
Status = pt_insn_next(Decoder, &Insn, sizeof(Insn));
if (Status < 0)
break;
ZydisDisassembledInstruction Disasm;
ZydisMachineMode Mode = (Insn.mode == ptem_32bit) ? ZYDIS_MACHINE_MODE_LEGACY_32 : ZYDIS_MACHINE_MODE_LONG_64;
if (ZYAN_SUCCESS(ZydisDisassembleIntel(Mode, Insn.ip, Insn.raw, Insn.size, &Disasm)))
printf(" 0x%016llx exe+0x%-6llx %s\n",
(unsigned long long)Insn.ip,
(unsigned long long)(Insn.ip - g_ImageBase),
Disasm.text);
else
printf(" 0x%016llx (undecodable)\n", (unsigned long long)Insn.ip);
Count++;
}
if (Status >= 0 && (Status & pts_eos))
break;
}
pt_insn_free_decoder(Decoder);
return Count;
}
static void
RunAndTrace(const char * Path, const char * Function, BOOLEAN Packets, int PinCore)
{
STARTUPINFOA Startup = {0};
PROCESS_INFORMATION Process = {0};
HYPERTRACE_PT_MMAP_PACKETS Mmap = {0};
HYPERTRACE_PT_OPERATION_PACKETS Sizes = {0};
UINT64 TextStart = 0;
UINT64 TextEnd = 0;
UINT64 FilterStart = 0;
UINT64 FilterEnd = 0;
UINT64 Total = 0;
Startup.cb = sizeof(Startup);
if (!CreateProcessA(Path, NULL, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &Startup, &Process))
{
printf("[-] cannot launch '%s' (error 0x%x)\n", Path, GetLastError());
return;
}
printf("[+] launched '%s' (pid %u, suspended)\n", Path, Process.dwProcessId);
if (PinCore >= 0)
{
DWORD_PTR Mask = (DWORD_PTR)1 << PinCore;
if (SetProcessAffinityMask(Process.hProcess, Mask))
printf("[+] pinned target to core %d (all trace should land on this core)\n", PinCore);
else
printf("[!] could not pin to core %d (error 0x%x); running unpinned\n", PinCore, GetLastError());
}
else
{
printf("[*] target unpinned (scheduler may migrate it across cores)\n");
}
if (!CaptureImage(Process.hProcess, &TextStart, &TextEnd))
{
printf("[-] cannot read target image / .text section\n");
TerminateProcess(Process.hProcess, 1);
goto Cleanup;
}
printf("[+] image base 0x%llx, .text 0x%llx-0x%llx (%llu bytes)\n",
(unsigned long long)g_ImageBase,
(unsigned long long)TextStart,
(unsigned long long)TextEnd,
(unsigned long long)g_CodeSize);
FilterStart = TextStart;
FilterEnd = TextEnd;
if (Function != NULL && ResolveFunction(Process.hProcess, Path, Function, &FilterStart, &FilterEnd)) {
printf("[+] IP filter narrowed to '%s' 0x%llx-0x%llx (%llu bytes)\n",
Function,
(unsigned long long)FilterStart,
(unsigned long long)FilterEnd,
(unsigned long long)(FilterEnd - FilterStart + 1));
}
else
{
printf("[!] IP filter: whole .text (symbol '%s' not found - build the target with a PDB)\n",
Function ? Function : "(none)");
}
if (!PtFilter(Process.dwProcessId, FilterStart, FilterEnd) ||
!PtOperation(HYPERTRACE_PT_OPERATION_REQUEST_TYPE_ENABLE))
{
printf("[-] cannot enable Intel PT\n");
TerminateProcess(Process.hProcess, 1);
goto Cleanup;
}
if (!hyperdbg_u_pt_mmap(&Mmap))
{
printf("[-] pt_mmap failed\n");
PtOperation(HYPERTRACE_PT_OPERATION_REQUEST_TYPE_DISABLE);
TerminateProcess(Process.hProcess, 1);
goto Cleanup;
}
printf("[+] PT enabled, %u per-core buffers mapped\n", Mmap.NumCpus);
printf("[*] resuming target and waiting for it to exit...\n");
ResumeThread(Process.hThread);
WaitForSingleObject(Process.hProcess, INFINITE);
printf("[+] target exited, decoding trace\n");
PtOperation(HYPERTRACE_PT_OPERATION_REQUEST_TYPE_PAUSE);
Sizes.PtOperationType = HYPERTRACE_PT_OPERATION_REQUEST_TYPE_SIZE;
if (!hyperdbg_u_pt_operation(&Sizes))
{
printf("[-] cannot query PT sizes\n");
PtOperation(HYPERTRACE_PT_OPERATION_REQUEST_TYPE_DISABLE);
goto Cleanup;
}
for (UINT32 i = 0; i < Mmap.NumCpus; i++)
{
UINT32 Cpu = Mmap.Cpus[i].CpuId;
UINT64 Bytes = (Cpu < Sizes.NumCpus) ? Sizes.BytesPerCpu[Cpu] : 0;
if (Bytes == 0)
continue;
if (Bytes > Mmap.Cpus[i].Size)
Bytes = Mmap.Cpus[i].Size;
printf("\n[*] core %u: %llu bytes of trace\n", Cpu, (unsigned long long)Bytes);
Total += Packets
? DecodeCorePackets(Cpu, (const UINT8 *)(ULONG_PTR)Mmap.Cpus[i].UserVa, Bytes)
: DecodeCore(Cpu, (const UINT8 *)(ULONG_PTR)Mmap.Cpus[i].UserVa, Bytes);
}
printf("\n[+] decoded %llu %s total\n", (unsigned long long)Total, Packets ? "packet(s)" : "instruction(s)");
PtOperation(HYPERTRACE_PT_OPERATION_REQUEST_TYPE_DISABLE);
Cleanup:
if (g_Code != NULL)
{
free(g_Code);
g_Code = NULL;
}
if (Process.hThread != NULL)
CloseHandle(Process.hThread);
if (Process.hProcess != NULL)
CloseHandle(Process.hProcess);
}
static int
LoadVmmAndTrace()
{
hyperdbg_u_set_text_message_callback((PVOID)ShowMessages);
if (!hyperdbg_u_detect_vmx_support())
{
printf("[-] VT-x (VMX) is not supported / enabled on this processor\n");
return 1;
}
printf("[*] loading HyperDbg VMM...\n");
if (hyperdbg_u_install_kd_driver() == 1 || hyperdbg_u_load_vmm() == 1)
{
printf("[-] cannot load the HyperDbg VMM\n");
return 1;
}
printf("[+] HyperDbg VMM is running\n");
printf("[*] loading HyperTrace...\n");
if ( hyperdbg_u_load_hypertrace_module() == 1)
{
printf("[-] cannot load the HyperDbg HyperTrace\n");
return 1;
}
printf("[+] HyperDbg HyperTrace is running\n");
return 0;
}
int
main2(int argc, char ** argv)
{
const char * function = "main";
BOOLEAN packets = FALSE;
int pinCore = 0;
if (argc < 2)
{
printf("HyperDbg Intel PT tracer\n");
printf("usage: %s <path-to-exe-that-exits> [function] [-p] [-c core]\n", argv[0]);
printf(" [function] symbol to IP-filter (default 'main'; pass '*' for whole .text)\n");
printf(" -p dump raw PT packets (TNT/TIP/FUP/PSB/...) instead of instructions\n");
printf(" -c core pin the target to this logical core (default 0; -1 = unpinned)\n");
return 1;
}
for (int i = 2; i < argc; i++)
{
if (strcmp(argv[i], "-p") == 0 || strcmp(argv[i], "--packets") == 0)
packets = TRUE;
else if (strcmp(argv[i], "-c") == 0 && i + 1 < argc)
pinCore = atoi(argv[++i]);
else if (strcmp(argv[i], "*") == 0)
function = NULL;
else
function = argv[i];
}
if (LoadVmmAndTrace() != 0)
{
return 1;
}
RunAndTrace(argv[1], function, packets, pinCore);
printf("[*] unloading HyperDbg VMM...\n");
//
// Unload the driver
//
hyperdbg_u_unload_vmm();
hyperdbg_u_unload_kd();
hyperdbg_u_stop_kd_driver();
hyperdbg_u_uninstall_kd_driver();
printf("[+] done\n");
return 0;
}

View file

@ -0,0 +1,16 @@
/**
* @file example-ipt.h
* @author Sina Karvandi (sina@hyperdbg.org)
* @brief Headers for Intel PT example
* @details
*
* @version 0.20
* @date 2026-06-13
*
* @copyright This project is released under the GNU Public License v3.
*
*/
#pragma once
int
main2(int argc, char** argv);

View file

@ -12,14 +12,14 @@
*/
#pragma once
//
// add headers that you want to pre-compile here
//
//
// Environment headers
//
#include "platform/general/header/Environment.h"
//
// Windows SDK headers
//
#define WIN32_LEAN_AND_MEAN
//
@ -36,6 +36,10 @@
//
// HyperDbg SDK headers
//
#include "Definition.h"
#include "SDK/HyperDbgSdk.h"
#include "SDK/Imports/HyperDbgCtrlImports.h"
#include "SDK/imports/user/HyperDbgLibImports.h"
//
// Other internal headers
//
#include "example-ipt.h"

View file

@ -1,14 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="debug|Win32">
<Configuration>debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="release|Win32">
<Configuration>release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="debug|x64">
<Configuration>debug</Configuration>
<Platform>x64</Platform>
@ -19,9 +11,11 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="header\example-ipt.h" />
<ClInclude Include="header\pch.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="code\hyperdbg-ipt.cpp" />
<ClCompile Include="code\hyperdbg-app.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
@ -33,29 +27,16 @@
<ProjectName>hyperdbg_app</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<PlatformToolset>v145</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<PlatformToolset>v145</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@ -64,71 +45,55 @@
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Label="UserMacros">
<!--
libipt (Intel Processor Trace decoder) install root.
Set this to the folder that contains 'include\intel-pt.h' and
'lib\libipt.lib'. 'libipt.dll' must be reachable at run time.
-->
<LibIptDir>C:\Users\masra\Desktop\libipt</LibIptDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
<OutDir>$(SolutionDir)build\bin\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
<PostBuildEventUseInBuild>false</PostBuildEventUseInBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
<OutDir>$(SolutionDir)build\bin\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
<PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;ZYCORE_STATIC_BUILD;ZYDIS_STATIC_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>Create</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(SolutionDir)\include;$(ProjectDir)\header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(LibIptDir)\include;$(SolutionDir)include;$(SolutionDir)dependencies\zydis\include;$(SolutionDir)dependencies\zydis\dependencies\zycore\include;$(ProjectDir)header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>$(SolutionDir)build\bin\$(Configuration)\hprdbgctrl.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(LibIptDir)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>$(SolutionDir)build\bin\$(Configuration)\libhyperdbg.lib;$(SolutionDir)libraries\zydis\user\Zydis.lib;$(SolutionDir)libraries\zydis\user\Zycore.lib;$(SolutionDir)libraries\libipt\libipt.lib</AdditionalDependencies>
<TreatLinkerWarningAsErrors>false</TreatLinkerWarningAsErrors>
</Link>
<PostBuildEvent>
<Command>
</Command>
<Message>
</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
<ClCompile>
@ -136,20 +101,30 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;ZYCORE_STATIC_BUILD;ZYDIS_STATIC_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>Create</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(SolutionDir)\include;$(ProjectDir)\header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(LibIptDir)\include;$(SolutionDir)include;$(SolutionDir)dependencies\zydis\include;$(SolutionDir)dependencies\zydis\dependencies\zycore\include;$(ProjectDir)header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
<Optimization>MaxSpeed</Optimization>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>$(SolutionDir)build\bin\$(Configuration)\hprdbgctrl.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(LibIptDir)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>$(SolutionDir)build\bin\$(Configuration)\libhyperdbg.lib;$(SolutionDir)libraries\zydis\user\Zydis.lib;$(SolutionDir)libraries\zydis\user\Zycore.lib;$(SolutionDir)libraries\libipt\libipt.lib</AdditionalDependencies>
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
</Link>
<PostBuildEvent>
<Command>
</Command>
<Message>
</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View file

@ -7,13 +7,22 @@
<Filter Include="code">
<UniqueIdentifier>{c40916c8-414b-486b-bfd1-13bcbafd8fa1}</UniqueIdentifier>
</Filter>
<Filter Include="header\platform">
<UniqueIdentifier>{14cb7f22-aa90-410e-a333-f05e0ec7981f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="header\pch.h">
<Filter>header</Filter>
</ClInclude>
<ClInclude Include="header\example-ipt.h">
<Filter>header</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="code\hyperdbg-ipt.cpp">
<Filter>code</Filter>
</ClCompile>
<ClCompile Include="code\hyperdbg-app.cpp">
<Filter>code</Filter>
</ClCompile>

59
hwdbg/.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,59 @@
name: Continuous Integration
on:
push:
tags: ['*']
branches: ['main']
pull_request:
workflow_dispatch:
env:
verilator-version: v5.012
verilator-install-dir: verilator-install
jobs:
ci:
name: ci
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cleanup
run: sed -i "s/%NAME%/test/g" build.sc
- name: Cache Scala
uses: coursier/cache-action@v6
- name: Setup Scala
uses: coursier/setup-action@v1
with:
jvm: adopt:11
apps: sbt mill
- name: Setup Dependencies
run: |
sudo apt-get install ccache
- name: Get Cached Verilator
id: get-cached-verilator
uses: actions/cache@v4
with:
path: ${{ env.verilator-install-dir }}
key: verilator-${{ env.verilator-version }}
- name: Install Verilator
if: steps.get-cached-verilator.outputs.cache-hit != 'true'
run: |
sudo apt-get install git help2man perl python3 make autoconf g++ flex bison numactl perl-doc libfl-dev
git clone https://github.com/verilator/verilator
unset VERILATOR_ROOT
cd verilator
git checkout ${{ env.verilator-version }}
autoconf
./configure --prefix=$(pwd)/../${{ env.verilator-install-dir }}
make
make install
- name: Set PATH
run: |
echo "$(pwd)/${{ env.verilator-install-dir }}/bin" >> $GITHUB_PATH
echo VERILATOR_ROOT="$(pwd)/${{ env.verilator-install-dir }}/share/verilator" >> $GITHUB_ENV
ln -sf $(pwd)/${{ env.verilator-install-dir }}/bin/verilator_bin $(pwd)/${{ env.verilator-install-dir }}/share/verilator/verilator_bin
- name: SBT Test
run: sbt test
- name: mill Test
run: mill _.test

366
hwdbg/.gitignore vendored Normal file
View file

@ -0,0 +1,366 @@
### Project Specific stuff
test_run_dir/*
### XilinxISE template
# intermediate build files
*.bgn
*.bit
*.bld
*.cmd_log
*.drc
*.ll
*.lso
*.msd
*.msk
*.ncd
*.ngc
*.ngd
*.ngr
*.pad
*.par
*.pcf
*.prj
*.ptwx
*.rbb
*.rbd
*.stx
*.syr
*.twr
*.twx
*.unroutes
*.ut
*.xpi
*.xst
*_bitgen.xwbt
*_envsettings.html
*_map.map
*_map.mrp
*_map.ngm
*_map.xrpt
*_ngdbuild.xrpt
*_pad.csv
*_pad.txt
*_par.xrpt
*_summary.html
*_summary.xml
*_usage.xml
*_xst.xrpt
# project-wide generated files
*.gise
par_usage_statistics.html
usage_statistics_webtalk.html
webtalk.log
webtalk_pn.xml
# generated folders
iseconfig/
xlnx_auto_0_xdb/
xst/
_ngo/
_xmsgs/
### Eclipse template
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
# Eclipse Core
.project
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Java annotation processor (APT)
.factorypath
# PDT-specific
.buildpath
# sbteclipse plugin
.target
# TeXlipse plugin
.texlipse
### C template
# Object files
*.o
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
### SBT template
# Simple Build Tool
# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control
target/
lib_managed/
src_managed/
project/boot/
.history
.cache
### Emacs template
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history
/eshell/lastdir
# elpa packages
/elpa/
# reftex files
*.rel
# AUCTeX auto folder
/auto/
# cask packages
.cask/
### Vim template
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
*.iml
## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:
# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries
# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml
# Gradle:
# .idea/gradle.xml
# .idea/libraries
# Mongo Explorer plugin:
# .idea/mongoSettings.xml
## File-based project format:
*.ipr
*.iws
## Plugin-specific files:
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
### C++ template
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
### OSX template
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Xcode template
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
## Other
*.xccheckout
*.moved-aside
*.xcuserstate
### Scala template
*.class
*.log
/.bsp
# sbt specific
.cache
.history
.lib/
dist/*
target/
lib_managed/
src_managed/
project/boot/
project/plugins/project/
# Scala-IDE specific
.scala_dependencies
.worksheet
### Java template
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
# Scala metals
.metals/*
# Scala metals
.bloop/
# Temporary disable the generated verilog files
generated/
# BRAM emulation content
# bram_instance_info.txt

1
hwdbg/.mill-version Normal file
View file

@ -0,0 +1 @@
0.11.5

5
hwdbg/.scalafmt.conf Normal file
View file

@ -0,0 +1,5 @@
version = "3.8.1"
runner.dialect = scala213
maxColumn = 150
docstrings.style = Asterisk
docstrings.oneline = unfold

76
hwdbg/CODE_OF_CONDUCT.md Normal file
View file

@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at sina@rayanfam.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

674
hwdbg/LICENSE Normal file
View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

121
hwdbg/README.md Normal file
View file

@ -0,0 +1,121 @@
<p align="center">
<img alt="hwdbg" title="hwdbg" src="https://github.com/HyperDbg/graphics/blob/master/Logos/hwdbg/hwdbg-high-resolution-logo-transparent.png?raw=true" width="300">
</p>
<p align="left">
<a href="https://hwdbg.hyperdbg.org"><img src="https://raw.githubusercontent.com/HyperDbg/graphics/master/Badges/Link-Website-orange.svg" alt="Website"></a>
<a href="https://hwdbg.hyperdbg.org/docs"><img src="https://raw.githubusercontent.com/HyperDbg/graphics/master/Badges/Link-Docs-yellow.svg" alt="Docs"></a>
<a href="https://hwdbg.hyperdbg.org/api"><img src="https://raw.githubusercontent.com/HyperDbg/graphics/master/Badges/Link-API-green.svg" alt="API"></a>
<a href="https://research.hyperdbg.org"><img src="https://raw.githubusercontent.com/HyperDbg/graphics/master/Badges/Link-Research-pink.svg" alt="Published Researches"></a>
<a href="https://www.gnu.org/licenses/gpl-3.0"><img src="https://raw.githubusercontent.com/HyperDbg/graphics/master/Badges/License-GPLv3-blue.svg" alt="License"></a>
</p>
## Description
The **hwdbg** debugger chip generator is a gate-level debugging tool designed to make configurable and synthesizable hardware debuggers for white-box and black-box chip fuzzing, testing, and reverse engineering. The primary goal of **hwdbg** is to provide control over hardware, enabling monitoring and modification of signals down to the granular level of a single clock cycle. It is written in Chisel and Verilog.
- ⚠️ This project is a work in progress and is not yet ready for testing.
**hwdbg** is a highly customizable debugger designed to ease hardware debugging by bringing software debugging concepts into the hardware debugging domain. **hwdbg** aims to help with the complexities associated with debugging hardware, including chips and IP cores. Key features of **hwdbg** include the ability to step through the hardware design at the clock-cycle level, visualize waveforms, inspect values (e.g., like a logical analyzer), and modify signals. Moreover, it is synthesizable into [FPGAs](https://github.com/HyperDbg/hwdbg-fpga) and has the potential for fabrication into physical chips.
```
┏━━━━━━━━━━━━━━━━━━━━━━━┓
_ _ _ ┃
| |_ _ _ _ _| || |_ ___ ┃
| . || | | |/ . || . \/ . | ┃
|_|_||__/_/ \___||___/\_. | ┃
<___'
|、
HyperDbg's chip-level debugger ┃ (˚ˎ 。7
┃ |、 ˜〵
┗━━━━━━━━━━━━━━━━━━━━━━━┛ じしˍ,)
```
## Publications
In case you use **hwdbg** in your work, please consider citing our paper.
**[hwdbg: Debugging Hardware Like Software (EuroSec'25)](https://dl.acm.org/doi/abs/10.1145/3722041.3723101)** [[PDF](https://dl.acm.org/doi/pdf/10.1145/3722041.3723101)]
```
@inproceedings{karvandi2025hwdbg,
title={hwdbg: Debugging Hardware Like Software},
author={Karvandi, Mohammad Sina and Meghdadizanjani, Soroush and Monfared, Saleh Khalaj and van der Kouwe, Erik and Slowinska, Asia},
booktitle={Proceedings of the 18th European Workshop on Systems Security},
pages={56--62},
year={2025}
}
```
## Deployment Board
[This repository](https://github.com/HyperDbg/hwdbg-fpga) contains pre-built TCL files to facilitate project creation for running **hwdbg** on various FPGA development boards.
## Output
For generating SystemVerilog files, you need to install [Chisel](https://www.chisel-lang.org/docs/installation). Once installed, use the following commands:
```sh
$ sbt run
```
This command prompts you to select a component. The `hwdbg.Main` class contains the debugger for synthesis purposes, while the `hwdbg.MainWithInitializedBRAM` class includes a pre-initialized Block RAM (BRAM), primarily for simulation and testing.
After selecting the appropriate class for synthesis (option `1`) or simulation (option `2`), the output should look like this:
```sh
$ sbt run
[info] welcome to sbt 1.9.7 (Eclipse Adoptium Java 17.0.10)
[info] loading settings for project -build-build-build from metals.sbt ...
[info] loading project definition from /home/sina/HyperDbg//project/project/project
[info] loading settings for project -build-build from metals.sbt ...
[info] loading project definition from /home/sina/HyperDbg//project/project
[success] Generated .bloop/-build-build.json
[success] Total time: 1 s, completed Apr 16, 2024, 1:49:05 PM
[info] loading settings for project -build from metals.sbt,plugins.sbt ...
[info] loading project definition from /home/sina/HyperDbg//project
[success] Total time: 0 s, completed Apr 16, 2024, 1:49:05 PM
[info] loading settings for project root from build.sbt ...
[info] set current project to hwdbg (in build file:/home/sina/HyperDbg/hwdbg/)
Multiple main classes detected. Select one to run:
[1] hwdbg.Main
[2] hwdbg.MainWithInitializedBRAM
Enter number: 2
[info] running hwdbg.MainWithInitializedBRAM
```
The generated code for the debugger can be found in the `generated` directory.
## Testbenches
To test **hwdbg**, [cocotb](https://www.cocotb.org/) should be installed. After that, first, run the debugger (generated SystemVerilog files) and then run the following commands:
```sh
cd sim/hwdbg/DebuggerModuleTestingBRAM
./test.sh
```
The above command generates a waves file at `./sim/hwdbg/DebuggerModuleTestingBRAM/sim_build/DebuggerModuleTestingBRAM.fst` which can be read using [GTKWave](https://gtkwave.sourceforge.net/).
```sh
cd sim/hwdbg/DebuggerModuleTestingBRAM
gtkwave ./sim_build/DebuggerModuleTestingBRAM.fst
```
### ModelSim
If you prefer to use ModelSim instead of GTKWave, you can configure the `modelsim.config` file. Please visit <a href="https://github.com/HyperDbg/hwdbg/blob/main/sim/modelsim/README.md">here</a> for more information.
## API
If you want to create the latest version of API documentation, you can run the following command:
```sh
$ sbt doc
```
This will generate documentation at `./target/scala-{version}/api/index.html`.
## License
**hwdbg** and all its submodules and repos, unless a license is otherwise specified, are licensed under **GPLv3** LICENSE.

29
hwdbg/build.sbt Normal file
View file

@ -0,0 +1,29 @@
// See README.md for license details.
ThisBuild / scalaVersion := "2.13.12"
ThisBuild / version := "0.1.0"
ThisBuild / organization := "org.hyperdbg"
val chiselVersion = "6.2.0"
lazy val root = (project in file("."))
.settings(
name := "hwdbg",
libraryDependencies ++= Seq(
"org.chipsalliance" %% "chisel" % chiselVersion,
"org.scalatest" %% "scalatest" % "3.2.16" % "test",
"io.circe" %% "circe-core" % "0.14.3",
"io.circe" %% "circe-generic" % "0.14.3",
"io.circe" %% "circe-parser" % "0.14.3"
),
scalacOptions ++= Seq(
"-language:reflectiveCalls",
"-deprecation",
"-feature",
"-Xcheckinit",
"-Ymacro-annotations"
),
addCompilerPlugin(
"org.chipsalliance" % "chisel-plugin" % chiselVersion cross CrossVersion.full
)
)

30
hwdbg/build.sc Normal file
View file

@ -0,0 +1,30 @@
// import Mill dependency
import mill._
import mill.define.Sources
import mill.modules.Util
import mill.scalalib.TestModule.ScalaTest
import scalalib._
// support BSP
import mill.bsp._
object hwdbg extends SbtModule { m =>
override def millSourcePath = os.pwd
override def scalaVersion = "2.13.12"
override def scalacOptions = Seq(
"-language:reflectiveCalls",
"-deprecation",
"-feature",
"-Xcheckinit",
)
override def ivyDeps = Agg(
ivy"org.chipsalliance::chisel:6.0.0",
)
override def scalacPluginIvyDeps = Agg(
ivy"org.chipsalliance:::chisel-plugin:6.0.0",
)
object test extends SbtModuleTests with TestModule.ScalaTest {
override def ivyDeps = m.ivyDeps() ++ Agg(
ivy"org.scalatest::scalatest::3.2.16"
)
}
}

View file

@ -0,0 +1 @@
sbt.version = 1.9.7

8
hwdbg/project/metals.sbt Normal file
View file

@ -0,0 +1,8 @@
// format: off
// DO NOT EDIT! This file is auto-generated.
// This file enables sbt-bloop to create bloop config files.
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.18")
// format: on

View file

@ -0,0 +1 @@
logLevel := Level.Warn

View file

@ -0,0 +1,8 @@
// format: off
// DO NOT EDIT! This file is auto-generated.
// This file enables sbt-bloop to create bloop config files.
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.18")
// format: on

View file

@ -0,0 +1,8 @@
// format: off
// DO NOT EDIT! This file is auto-generated.
// This file enables sbt-bloop to create bloop config files.
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.18")
// format: on

164
hwdbg/sim/.gitignore vendored Normal file
View file

@ -0,0 +1,164 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# cocotb folders and files
sim_build/
results.xml

View file

@ -0,0 +1,23 @@
# Makefile
TOPLEVEL_LANG = verilog
VERILOG_SOURCES += $(shell pwd)/../../../generated/DebuggerModuleTestingBRAM.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/InitRegMemFromFile.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/DebuggerMain.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/SendReceiveSynchronizer.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/DebuggerPacketReceiver.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/DebuggerPacketSender.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/DebuggerPacketInterpreter.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/InterpreterInstanceInfo.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/InterpreterSendSuccessOrError.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/ScriptExecutionEngine.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/InterpreterScriptBufferHandler.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/ScriptEngineGetValue.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/ScriptEngineSetValue.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/ScriptEngineEval.sv
TOPLEVEL = DebuggerModuleTestingBRAM
MODULE = test_DebuggerModuleTestingBRAM
include $(shell cocotb-config --makefiles)/Makefile.sim

View file

@ -0,0 +1,261 @@
Content of BRAM after emulation:
PS to PL area:
mem_0: 0000005a | Checksum
mem_1: 00000000 | Checksum
mem_2: 52444247 | Indicator
mem_3: 48595045 | Indicator
mem_4: 00000004 | TypeOfThePacket
mem_5: 00000001 | RequestedActionOfThePacket
mem_6: 00000000 | Start of Optional Data
mem_7: 00000000
mem_8: 00000000
mem_9: 00000000
mem_10: 00000000
mem_11: 00000000
mem_12: 00000000
mem_13: 00000000
mem_14: 00000000
mem_15: 00000000
mem_16: 00000000
mem_17: 00000000
mem_18: 00000000
mem_19: 00000000
mem_20: 00000000
mem_21: 00000000
mem_22: 00000000
mem_23: 00000000
mem_24: 00000000
mem_25: 00000000
mem_26: 00000000
mem_27: 00000000
mem_28: 00000000
mem_29: 00000000
mem_30: 00000000
mem_31: 00000000
mem_32: 00000000
mem_33: 00000000
mem_34: 00000000
mem_35: 00000000
mem_36: 00000000
mem_37: 00000000
mem_38: 00000000
mem_39: 00000000
mem_40: 00000000
mem_41: 00000000
mem_42: 00000000
mem_43: 00000000
mem_44: 00000000
mem_45: 00000000
mem_46: 00000000
mem_47: 00000000
mem_48: 00000000
mem_49: 00000000
mem_50: 00000000
mem_51: 00000000
mem_52: 00000000
mem_53: 00000000
mem_54: 00000000
mem_55: 00000000
mem_56: 00000000
mem_57: 00000000
mem_58: 00000000
mem_59: 00000000
mem_60: 00000000
mem_61: 00000000
mem_62: 00000000
mem_63: 00000000
mem_64: 00000000
mem_65: 00000000
mem_66: 00000000
mem_67: 00000000
mem_68: 00000000
mem_69: 00000000
mem_70: 00000000
mem_71: 00000000
mem_72: 00000000
mem_73: 00000000
mem_74: 00000000
mem_75: 00000000
mem_76: 00000000
mem_77: 00000000
mem_78: 00000000
mem_79: 00000000
mem_80: 00000000
mem_81: 00000000
mem_82: 00000000
mem_83: 00000000
mem_84: 00000000
mem_85: 00000000
mem_86: 00000000
mem_87: 00000000
mem_88: 00000000
mem_89: 00000000
mem_90: 00000000
mem_91: 00000000
mem_92: 00000000
mem_93: 00000000
mem_94: 00000000
mem_95: 00000000
mem_96: 00000000
mem_97: 00000000
mem_98: 00000000
mem_99: 00000000
mem_100: 00000000
mem_101: 00000000
mem_102: 00000000
mem_103: 00000000
mem_104: 00000000
mem_105: 00000000
mem_106: 00000000
mem_107: 00000000
mem_108: 00000000
mem_109: 00000000
mem_110: 00000000
mem_111: 00000000
mem_112: 00000000
mem_113: 00000000
mem_114: 00000000
mem_115: 00000000
mem_116: 00000000
mem_117: 00000000
mem_118: 00000000
mem_119: 00000000
mem_120: 00000000
mem_121: 00000000
mem_122: 00000000
mem_123: 00000000
mem_124: 00000000
mem_125: 00000000
mem_126: 00000000
mem_127: 00000000
PL to PS area:
mem_128: 00000000 | Checksum
mem_129: 00000000 | Checksum
mem_130: 52444247 | Indicator
mem_131: 48595045 | Indicator
mem_132: 00000005 | TypeOfThePacket
mem_133: 00000002 | RequestedActionOfThePacket
mem_134: 00000100 | Start of Optional Data
mem_135: 00000020
mem_136: 00000008
mem_137: 00000002
mem_138: 00000002
mem_139: 00000002
mem_140: 00000001
mem_141: 00000400
mem_142: 00000000
mem_143: 00000200
mem_144: 00000020
mem_145: 00000002
mem_146: 01ff9efb
mem_147: 00000000
mem_148: 0000000d
mem_149: 00000020
mem_150: 0000000c
mem_151: 00000014
mem_152: 00000000
mem_153: 00000000
mem_154: 00000000
mem_155: 00000000
mem_156: 00000000
mem_157: 00000000
mem_158: 00000000
mem_159: 00000000
mem_160: 00000000
mem_161: 00000000
mem_162: 00000000
mem_163: 00000000
mem_164: 00000000
mem_165: 00000000
mem_166: 00000000
mem_167: 00000000
mem_168: 00000000
mem_169: 00000000
mem_170: 00000000
mem_171: 00000000
mem_172: 00000000
mem_173: 00000000
mem_174: 00000000
mem_175: 00000000
mem_176: 00000000
mem_177: 00000000
mem_178: 00000000
mem_179: 00000000
mem_180: 00000000
mem_181: 00000000
mem_182: 00000000
mem_183: 00000000
mem_184: 00000000
mem_185: 00000000
mem_186: 00000000
mem_187: 00000000
mem_188: 00000000
mem_189: 00000000
mem_190: 00000000
mem_191: 00000000
mem_192: 00000000
mem_193: 00000000
mem_194: 00000000
mem_195: 00000000
mem_196: 00000000
mem_197: 00000000
mem_198: 00000000
mem_199: 00000000
mem_200: 00000000
mem_201: 00000000
mem_202: 00000000
mem_203: 00000000
mem_204: 00000000
mem_205: 00000000
mem_206: 00000000
mem_207: 00000000
mem_208: 00000000
mem_209: 00000000
mem_210: 00000000
mem_211: 00000000
mem_212: 00000000
mem_213: 00000000
mem_214: 00000000
mem_215: 00000000
mem_216: 00000000
mem_217: 00000000
mem_218: 00000000
mem_219: 00000000
mem_220: 00000000
mem_221: 00000000
mem_222: 00000000
mem_223: 00000000
mem_224: 00000000
mem_225: 00000000
mem_226: 00000000
mem_227: 00000000
mem_228: 00000000
mem_229: 00000000
mem_230: 00000000
mem_231: 00000000
mem_232: 00000000
mem_233: 00000000
mem_234: 00000000
mem_235: 00000000
mem_236: 00000000
mem_237: 00000000
mem_238: 00000000
mem_239: 00000000
mem_240: 00000000
mem_241: 00000000
mem_242: 00000000
mem_243: 00000000
mem_244: 00000000
mem_245: 00000000
mem_246: 00000000
mem_247: 00000000
mem_248: 00000000
mem_249: 00000000
mem_250: 00000000
mem_251: 00000000
mem_252: 00000000
mem_253: 00000000
mem_254: 00000000
mem_255: 00000000

View file

@ -0,0 +1,261 @@
Content of BRAM after emulation:
PS to PL area:
mem_0: 00000017 | Checksum
mem_1: 00000000 | Checksum
mem_2: 52444247 | Indicator
mem_3: 48595045 | Indicator
mem_4: 00000004 | TypeOfThePacket
mem_5: 00000002 | RequestedActionOfThePacket
mem_6: 00000033 | Start of Optional Data
mem_7: 00000006
mem_8: 0000000a
mem_9: 00000003
mem_10: 00000001
mem_11: 0000000f
mem_12: 00000000
mem_13: 0000000f
mem_14: 00000000
mem_15: 00000006
mem_16: 00000013
mem_17: 00000003
mem_18: 00000001
mem_19: 00000004
mem_20: 00000000
mem_21: 00000007
mem_22: 00000000
mem_23: 00000006
mem_24: 00000016
mem_25: 00000003
mem_26: 00000013
mem_27: 00000007
mem_28: 00000000
mem_29: 00000000
mem_30: 00000000
mem_31: 00000006
mem_32: 00000018
mem_33: 00000003
mem_34: 00000000
mem_35: 00000000
mem_36: 00000000
mem_37: 00000004
mem_38: 00000002
mem_39: 00000006
mem_40: 00000018
mem_41: 00000003
mem_42: 00000000
mem_43: 00000000
mem_44: 00000000
mem_45: 00000004
mem_46: 00000003
mem_47: 00000006
mem_48: 00000015
mem_49: 00000003
mem_50: 00000028
mem_51: 00000000
mem_52: 00000000
mem_53: 00000000
mem_54: 00000000
mem_55: 00000006
mem_56: 00000013
mem_57: 00000003
mem_58: 00000001
mem_59: 00000004
mem_60: 00000001
mem_61: 00000007
mem_62: 00000000
mem_63: 00000006
mem_64: 00000016
mem_65: 00000003
mem_66: 00000022
mem_67: 00000007
mem_68: 00000000
mem_69: 00000000
mem_70: 00000000
mem_71: 00000006
mem_72: 00000018
mem_73: 00000003
mem_74: 00000000
mem_75: 00000000
mem_76: 00000000
mem_77: 00000004
mem_78: 00000004
mem_79: 00000006
mem_80: 00000018
mem_81: 00000003
mem_82: 00000000
mem_83: 00000000
mem_84: 00000000
mem_85: 00000004
mem_86: 00000005
mem_87: 00000006
mem_88: 00000015
mem_89: 00000003
mem_90: 00000028
mem_91: 00000000
mem_92: 00000000
mem_93: 00000000
mem_94: 00000000
mem_95: 00000006
mem_96: 00000018
mem_97: 00000003
mem_98: 00000000
mem_99: 00000000
mem_100: 00000000
mem_101: 00000004
mem_102: 00000006
mem_103: 00000006
mem_104: 00000018
mem_105: 00000003
mem_106: 00000000
mem_107: 00000000
mem_108: 00000000
mem_109: 00000004
mem_110: 00000007
mem_111: 00000000
mem_112: 00000000
mem_113: 00000000
mem_114: 00000000
mem_115: 00000000
mem_116: 00000000
mem_117: 00000000
mem_118: 00000000
mem_119: 00000000
mem_120: 00000000
mem_121: 00000000
mem_122: 00000000
mem_123: 00000000
mem_124: 00000000
mem_125: 00000000
mem_126: 00000000
mem_127: 00000000
PL to PS area:
mem_128: 00000000 | Checksum
mem_129: 00000000 | Checksum
mem_130: 52444247 | Indicator
mem_131: 48595045 | Indicator
mem_132: 00000005 | TypeOfThePacket
mem_133: 00000001 | RequestedActionOfThePacket
mem_134: 7fffffff | Start of Optional Data
mem_135: 00000000
mem_136: 00000000
mem_137: 00000000
mem_138: 00000000
mem_139: 00000000
mem_140: 00000000
mem_141: 00000000
mem_142: 00000000
mem_143: 00000000
mem_144: 00000000
mem_145: 00000000
mem_146: 00000000
mem_147: 00000000
mem_148: 00000000
mem_149: 00000000
mem_150: 00000000
mem_151: 00000000
mem_152: 00000000
mem_153: 00000000
mem_154: 00000000
mem_155: 00000000
mem_156: 00000000
mem_157: 00000000
mem_158: 00000000
mem_159: 00000000
mem_160: 00000000
mem_161: 00000000
mem_162: 00000000
mem_163: 00000000
mem_164: 00000000
mem_165: 00000000
mem_166: 00000000
mem_167: 00000000
mem_168: 00000000
mem_169: 00000000
mem_170: 00000000
mem_171: 00000000
mem_172: 00000000
mem_173: 00000000
mem_174: 00000000
mem_175: 00000000
mem_176: 00000000
mem_177: 00000000
mem_178: 00000000
mem_179: 00000000
mem_180: 00000000
mem_181: 00000000
mem_182: 00000000
mem_183: 00000000
mem_184: 00000000
mem_185: 00000000
mem_186: 00000000
mem_187: 00000000
mem_188: 00000000
mem_189: 00000000
mem_190: 00000000
mem_191: 00000000
mem_192: 00000000
mem_193: 00000000
mem_194: 00000000
mem_195: 00000000
mem_196: 00000000
mem_197: 00000000
mem_198: 00000000
mem_199: 00000000
mem_200: 00000000
mem_201: 00000000
mem_202: 00000000
mem_203: 00000000
mem_204: 00000000
mem_205: 00000000
mem_206: 00000000
mem_207: 00000000
mem_208: 00000000
mem_209: 00000000
mem_210: 00000000
mem_211: 00000000
mem_212: 00000000
mem_213: 00000000
mem_214: 00000000
mem_215: 00000000
mem_216: 00000000
mem_217: 00000000
mem_218: 00000000
mem_219: 00000000
mem_220: 00000000
mem_221: 00000000
mem_222: 00000000
mem_223: 00000000
mem_224: 00000000
mem_225: 00000000
mem_226: 00000000
mem_227: 00000000
mem_228: 00000000
mem_229: 00000000
mem_230: 00000000
mem_231: 00000000
mem_232: 00000000
mem_233: 00000000
mem_234: 00000000
mem_235: 00000000
mem_236: 00000000
mem_237: 00000000
mem_238: 00000000
mem_239: 00000000
mem_240: 00000000
mem_241: 00000000
mem_242: 00000000
mem_243: 00000000
mem_244: 00000000
mem_245: 00000000
mem_246: 00000000
mem_247: 00000000
mem_248: 00000000
mem_249: 00000000
mem_250: 00000000
mem_251: 00000000
mem_252: 00000000
mem_253: 00000000
mem_254: 00000000
mem_255: 00000000

View file

@ -0,0 +1 @@
make SIM=icarus WAVES=1

View file

@ -0,0 +1,570 @@
##
# @file test_DebuggerModuleTestingBRAM.py
#
# @author Sina Karvandi (sina@hyperdbg.org)
#
# @brief Testing module for DebuggerModuleTestingBRAM
#
# @details
#
# @version 0.1
#
# @date 2024-04-21
#
# @copyright This project is released under the GNU Public License v3.
#
import random
import re
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import Timer
from cocotb.types import LogicArray
maximum_number_of_clock_cycles = 1000
'''
input clock,
reset,
io_en,
io_inputPin_0,
io_inputPin_1,
io_inputPin_2,
io_inputPin_3,
io_inputPin_4,
io_inputPin_5,
io_inputPin_6,
io_inputPin_7,
io_inputPin_8,
io_inputPin_9,
io_inputPin_10,
io_inputPin_11,
io_inputPin_12,
io_inputPin_13,
io_inputPin_14,
io_inputPin_15,
io_inputPin_16,
io_inputPin_17,
io_inputPin_18,
io_inputPin_19,
io_inputPin_20,
io_inputPin_21,
io_inputPin_22,
io_inputPin_23,
io_inputPin_24,
io_inputPin_25,
io_inputPin_26,
io_inputPin_27,
io_inputPin_28,
io_inputPin_29,
io_inputPin_30,
io_inputPin_31,
output io_outputPin_0,
io_outputPin_1,
io_outputPin_2,
io_outputPin_3,
io_outputPin_4,
io_outputPin_5,
io_outputPin_6,
io_outputPin_7,
io_outputPin_8,
io_outputPin_9,
io_outputPin_10,
io_outputPin_11,
io_outputPin_12,
io_outputPin_13,
io_outputPin_14,
io_outputPin_15,
io_outputPin_16,
io_outputPin_17,
io_outputPin_18,
io_outputPin_19,
io_outputPin_20,
io_outputPin_21,
io_outputPin_22,
io_outputPin_23,
io_outputPin_24,
io_outputPin_25,
io_outputPin_26,
io_outputPin_27,
io_outputPin_28,
io_outputPin_29,
io_outputPin_30,
io_outputPin_31,
input io_plInSignal,
output io_psOutInterrupt
'''
#
# Define a function to extract the numeric part of the string
#
def extract_number(s):
return int(s.split('_')[1])
def print_bram_content(dut):
"""Printing contents of Block RAM and saving them to a file"""
#
# Print the instances and signals (which includes the ports) of the design's toplevel
#
print("===================================================================")
# print("Onstances and signals (which includes the ports) of the design's toplevel:")
# print(dir(dut))
# print("===================================================================")
#
# Print the instances and signals of "inst_sub_block" under the toplevel
# which is the instance name of a Verilog module or VHDL entity/component
#
# print("Onstances and signals of 'dataOut_initRegMemFromFileModule' under the toplevel:")
# print(dir(dut.dataOut_initRegMemFromFileModule))
items_inside_bram_emulator = dir(dut.dataOut_initRegMemFromFileModule)
mem_items = []
for item in items_inside_bram_emulator:
if item.startswith("mem_"):
mem_items.append(item)
#
# Sort the list using the custom key function
#
sorted_list = sorted(mem_items, key=extract_number)
with open("script_buffer_response.txt", "w") as file:
# with open("bram_instance_info.txt", "w") as file:
file.write("Content of BRAM after emulation:\n")
print("Content of BRAM after emulation:")
#
# The second half of the BRAM is used for PL to PS communication
#
address_of_ps_to_pl_communication = "mem_0"
address_of_ps_to_pl_communication_checksum1 = "mem_0"
address_of_ps_to_pl_communication_checksum2 = "mem_1"
address_of_ps_to_pl_communication_indicator1 = "mem_2"
address_of_ps_to_pl_communication_indicator2 = "mem_3"
address_of_ps_to_pl_communication_type_of_packet = "mem_4"
address_of_ps_to_pl_communication_requested_action_of_the_packet = "mem_5"
address_of_ps_to_pl_communication_start_of_data = "mem_6"
len_of_sorted_list_div_by_2 = int(len(sorted_list) / 2)
address_of_pl_to_ps_communication = "mem_" + str(len_of_sorted_list_div_by_2)
address_of_pl_to_ps_communication_checksum1 = "mem_" + str(len_of_sorted_list_div_by_2 + 0)
address_of_pl_to_ps_communication_checksum2 = "mem_" + str(len_of_sorted_list_div_by_2 + 1)
address_of_pl_to_ps_communication_indicator1 = "mem_" + str(len_of_sorted_list_div_by_2 + 2)
address_of_pl_to_ps_communication_indicator2 = "mem_" + str(len_of_sorted_list_div_by_2 + 3)
address_of_pl_to_ps_communication_type_of_packet = "mem_" + str(len_of_sorted_list_div_by_2 + 4)
address_of_pl_to_ps_communication_requested_action_of_the_packet = "mem_" + str(len_of_sorted_list_div_by_2 + 5)
address_of_pl_to_ps_communication_start_of_data = "mem_" + str(len_of_sorted_list_div_by_2 + 6)
print("Address of PL to PS communication: " + address_of_pl_to_ps_communication)
for item in sorted_list:
element = getattr(dut.dataOut_initRegMemFromFileModule, item)
#
# Print the target register in binary format
#
# print(str(element))
#
# Convert binary to int
#
int_content = int(str(element.value), 2)
#
# Convert integer to hexadecimal string with at least 8 characters
#
hex_string = f'{int_content:08x}'
final_string = ""
if len(item) == 5:
final_string = item + ": " + hex_string
elif len(item) == 6:
final_string = item + ": " + hex_string
else:
final_string = item + ": " + hex_string
#
# Make a separation between PS and PL area
#
if item == address_of_ps_to_pl_communication:
file.write("\nPS to PL area:\n")
print("\nPS to PL area:")
elif item == address_of_pl_to_ps_communication:
file.write("\nPL to PS area:\n")
print("\nPL to PS area:")
if item == address_of_ps_to_pl_communication_checksum1 or \
item == address_of_ps_to_pl_communication_checksum2 or \
item == address_of_pl_to_ps_communication_checksum1 or \
item == address_of_pl_to_ps_communication_checksum2:
final_string = final_string + " | Checksum"
elif item == address_of_ps_to_pl_communication_indicator1 or \
item == address_of_ps_to_pl_communication_indicator2 or \
item == address_of_pl_to_ps_communication_indicator1 or \
item == address_of_pl_to_ps_communication_indicator2:
final_string = final_string + " | Indicator"
elif item == address_of_ps_to_pl_communication_type_of_packet or \
item == address_of_pl_to_ps_communication_type_of_packet:
final_string = final_string + " | TypeOfThePacket"
elif item == address_of_ps_to_pl_communication_requested_action_of_the_packet or \
item == address_of_pl_to_ps_communication_requested_action_of_the_packet:
final_string = final_string + " | RequestedActionOfThePacket"
elif item == address_of_ps_to_pl_communication_start_of_data or \
item == address_of_pl_to_ps_communication_start_of_data:
final_string = final_string + " | Start of Optional Data"
#
# Print contents of BRAM
#
file.write(final_string + "\n")
print(final_string)
print("\n===================================================================\n")
#
# Define a function to extract value of symbol
#
def get_symbol_value(dut, value):
element_value = getattr(dut.debuggerMainModule.outputPin_scriptExecutionEngineModule, value)
hex_string_value = ""
try:
int_content_value = int(str(element_value.value), 2)
hex_string_value = f'{int_content_value:x}'
except:
hex_string_value = str(element_value.value)
final_string_value = f'{value}: 0x{hex_string_value}' + " (bin: " + str(element_value.value) + ")"
return final_string_value
#
# Define a function to extract type of symbol
#
def get_symbol_type(dut, type):
element_type = getattr(dut.debuggerMainModule.outputPin_scriptExecutionEngineModule, type)
hex_string_type = ""
try:
int_content_type = int(str(element_type.value), 2)
hex_string_type = f'{int_content_type:x}'
except:
hex_string_type = str(element_type.value)
final_string_type = f'{type} : 0x{hex_string_type}' + " (bin: " + str(element_type.value) + ")"
return final_string_type
#
# Define a function to extract stage index
#
def get_stage_index(dut, stage_index):
stage_index_str = "stageRegs_" + str(stage_index) + "_stageIndex"
element_stage_index = getattr(dut.debuggerMainModule.outputPin_scriptExecutionEngineModule, stage_index_str)
hex_string_stage_index = ""
try:
int_content_stage_index = int(str(element_stage_index.value), 2)
hex_string_stage_index = f'{int_content_stage_index:x}'
except:
hex_string_stage_index = str(element_stage_index.value)
final_string_stage_index = f'{stage_index}: 0x{hex_string_stage_index}' + " (bin: " + str(element_stage_index.value) + ")"
return final_string_stage_index
#
# Define a function to extract content of stages
#
def extract_stage_details(dut):
print("Script Stage Registers Configuration:\n")
all_elements = dir(dut.debuggerMainModule.outputPin_scriptExecutionEngineModule)
#
# Define the pattern to match
#
pattern_value = re.compile(r'stageRegs_\d+_stageSymbol_Value')
pattern_type = re.compile(r'stageRegs_\d+_stageSymbol_Type')
pattern_stage_index = re.compile(r'stageRegs_\d+_stageIndex')
#
# Filter the list using the patterns
#
filtered_strings_values = [s for s in all_elements if pattern_value.match(s)]
filtered_strings_types = [s for s in all_elements if pattern_type.match(s)]
filtered_strings_stage_index = [s for s in all_elements if pattern_stage_index.match(s)]
#
# Sort the lists
#
sorted_values = sorted(filtered_strings_values, key=extract_number)
sorted_types = sorted(filtered_strings_types, key=extract_number)
sorted_stage_index = sorted(filtered_strings_stage_index, key=extract_number)
#
# Print the filtered strings
#
# print(sorted_values)
# print(sorted_types)
# print(sorted_stage_index)
for index, element in enumerate(sorted_values):
try:
final_string_type = get_symbol_type(dut, sorted_types[index])
#
# Print the type
#
print(final_string_type)
except:
print("This stage does not contain a 'type'")
try:
final_string_value = get_symbol_value(dut, sorted_values[index])
#
# Print the value
#
print(final_string_value)
except:
print("Unable to get stage 'value' configuration details")
try:
final_string_stage_index = get_stage_index(dut, index)
#
# Print the stage index
#
print("index: " + final_string_stage_index)
except:
print("index: " + str(index) +": This stage does not contain a 'stage index'")
print("\n")
#
# Check stage enable bit
#
try:
stage_enabled = "stageRegs_" + str(index) + "_stageEnable"
is_stage_enabled = getattr(dut.debuggerMainModule.outputPin_scriptExecutionEngineModule, stage_enabled)
print("\t Stage enabled bit: " + str(is_stage_enabled))
except:
print("\t Stage enabled bit: (unavailable)")
try:
final_string_value = get_symbol_value(dut, "stageRegs_" + str(index) + "_getOperatorSymbol_0_Value")
final_string_type = get_symbol_type(dut, "stageRegs_" + str(index) + "_getOperatorSymbol_0_Type")
print("\t Get (0) | " + final_string_type)
print("\t Get (0) | " + final_string_value)
except:
print("\t stage at:" + str(index) + " does not contain a Get (0) buffer")
print("\n")
try:
final_string_value = get_symbol_value(dut, "stageRegs_" + str(index) + "_getOperatorSymbol_1_Value")
final_string_type = get_symbol_type(dut, "stageRegs_" + str(index) + "_getOperatorSymbol_1_Type")
print("\t Get (1) | " + final_string_type)
print("\t Get (1) | " + final_string_value)
except:
print("\t stage at:" + str(index) + " does not contain a Get (1) buffer")
print("\n")
try:
final_string_value = get_symbol_value(dut, "stageRegs_" + str(index) + "_setOperatorSymbol_0_Value")
final_string_type = get_symbol_type(dut, "stageRegs_" + str(index) + "_setOperatorSymbol_0_Type")
print("\t Set (0) | " + final_string_type)
print("\t Set (0) | " + final_string_value)
except:
print("\t stage at:" + str(index) + " does not contain a Set (0) buffer")
print("\n\n")
def set_input_pins(dut):
dut.io_inputPin_0.value = 1
dut.io_inputPin_1.value = 1
dut.io_inputPin_2.value = 1
dut.io_inputPin_3.value = 1
dut.io_inputPin_4.value = 1
dut.io_inputPin_5.value = 1
dut.io_inputPin_6.value = 1
dut.io_inputPin_7.value = 1
dut.io_inputPin_8.value = 1
dut.io_inputPin_9.value = 1
dut.io_inputPin_10.value = 1
dut.io_inputPin_11.value = 1
dut.io_inputPin_12.value = 1
dut.io_inputPin_13.value = 1
dut.io_inputPin_14.value = 1
dut.io_inputPin_15.value = 1
dut.io_inputPin_16.value = 1
dut.io_inputPin_17.value = 1
dut.io_inputPin_18.value = 1
dut.io_inputPin_19.value = 1
dut.io_inputPin_20.value = 1
dut.io_inputPin_21.value = 1
dut.io_inputPin_22.value = 1
dut.io_inputPin_23.value = 1
dut.io_inputPin_24.value = 1
dut.io_inputPin_25.value = 1
dut.io_inputPin_26.value = 1
dut.io_inputPin_27.value = 1
dut.io_inputPin_28.value = 1
dut.io_inputPin_29.value = 1
dut.io_inputPin_30.value = 1
dut.io_inputPin_31.value = 1
@cocotb.test()
async def DebuggerModuleTestingBRAM_test(dut):
"""Test hwdbg module (with pre-defined BRAM)"""
#
# Assert initial output is unknown
#
assert LogicArray(dut.io_outputPin_0.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_1.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_2.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_3.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_4.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_5.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_6.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_7.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_8.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_9.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_10.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_11.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_12.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_13.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_14.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_15.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_16.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_17.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_18.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_19.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_20.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_21.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_22.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_23.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_24.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_25.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_26.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_27.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_28.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_29.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_30.value) == LogicArray("X")
assert LogicArray(dut.io_outputPin_31.value) == LogicArray("X")
#
# Create a 10ns period clock on port clock
#
clock = Clock(dut.clock, 10, units="ns")
#
# Start the clock. Start it low to avoid issues on the first RisingEdge
#
cocotb.start_soon(clock.start(start_high=False))
dut._log.info("Initialize and reset module")
#
# Initial values
#
dut.io_en.value = 0
dut.io_plInSignal.value = 0
#
# Reset DUT
#
dut.reset.value = 1
for _ in range(10):
await Timer(10, units="ns")
dut.reset.value = 0
dut._log.info("Enabling an interrupting chip to receive commands from BRAM")
#
# Enable chip
#
dut.io_en.value = 1
#
# Set initial input value to prevent it from floating
#
dut._log.info("Initializing input pins")
# set_input_pins(dut)
#
# Tell the hwdbg to receive BRAM results
#
dut.io_plInSignal.value = 1
await Timer(10, units="ns")
dut.io_plInSignal.value = 0
#
# Synchronize with the clock. This will regisiter the initial `inputPinX` value
#
await Timer(10, units="ns")
#
# Wait until the debuggee sends an interrupt to debugger
#
clock_counter = 0
interrupt_not_delivered = False
while str(dut.io_psOutInterrupt) != "1":
# print("State of interrupt: '" + str(dut.io_psOutInterrupt) + "'")
if clock_counter % 10 == 0:
print("Number of clock cycles spent in debuggee (PL): " + str(clock_counter))
clock_counter = clock_counter + 1
await Timer(10, units="ns")
#
# Apply a limitation to the number of clock cycles that
# can be executed to avoid infinite time
#
if (clock_counter >= maximum_number_of_clock_cycles):
interrupt_not_delivered = True
break
#
# Being here means either the debuggee sent an interrupt to the PS
# or the maximum clock cycles reached
#
if interrupt_not_delivered:
print("Maximum clock cycles reached")
else:
print("Debuggee (PL) interrupted Debugger (PS)")
#
# Run one more clock cycle to apply the latest BRAM modifications
#
await Timer(10, units="ns")
#
# Print contents of BRAM
#
print_bram_content(dut)
#
# Print the script stage configuration
#
extract_stage_details(dut)
#
# Check the final input on the next clock and run the circuit for a couple
# of more clock cycles
#
for _ in range(100):
set_input_pins(dut)
await Timer(10, units="ns")

View file

@ -0,0 +1,8 @@
# Makefile
TOPLEVEL_LANG = verilog
VERILOG_SOURCES = $(shell pwd)/../../../../generated/DebuggerPacketReceiver.sv
TOPLEVEL = DebuggerPacketReceiver
MODULE = test_DebuggerPacketReceiver
include $(shell cocotb-config --makefiles)/Makefile.sim

View file

@ -0,0 +1 @@
make SIM=icarus WAVES=1

View file

@ -0,0 +1,187 @@
##
# @file test_DebuggerPacketReceiver.py
#
# @author Sina Karvandi (sina@hyperdbg.org)
#
# @brief Testing module for DebuggerPacketReceiver
#
# @details
#
# @version 0.1
#
# @date 2024-04-22
#
# @copyright This project is released under the GNU Public License v3.
#
import random
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import Timer
from cocotb.types import LogicArray
'''
input clock,
reset,
io_en,
io_plInSignal,
output [12:0] io_rdWrAddr,
input [31:0] io_rdData,
output [31:0] io_requestedActionOfThePacketOutput,
output io_requestedActionOfThePacketOutputValid,
input io_noNewDataReceiver,
io_readNextData,
output io_dataValidOutput,
output [31:0] io_receivingData,
output io_finishedReceivingBuffer
'''
@cocotb.test()
async def DebuggerPacketReceiver_test(dut):
"""Test DebuggerPacketReceiver module"""
#
# Assert initial output is unknown
#
assert LogicArray(dut.io_rdWrAddr.value) == LogicArray("XXXXXXXXXXXXX")
assert LogicArray(dut.io_requestedActionOfThePacketOutput.value) == LogicArray("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
assert LogicArray(dut.io_requestedActionOfThePacketOutputValid.value) == LogicArray("X")
assert LogicArray(dut.io_dataValidOutput.value) == LogicArray("X")
assert LogicArray(dut.io_receivingData.value) == LogicArray("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
assert LogicArray(dut.io_finishedReceivingBuffer.value) == LogicArray("X")
clock = Clock(dut.clock, 10, units="ns") # Create a 10ns period clock on port clock
#
# Start the clock. Start it low to avoid issues on the first RisingEdge
#
cocotb.start_soon(clock.start(start_high=False))
dut._log.info("Initialize and reset module")
#
# Initial values
#
dut.io_en.value = 0
dut.io_readNextData.value = 0
dut.io_noNewDataReceiver.value = 0
dut.io_plInSignal.value = 0
#
# Reset DUT
#
dut.reset.value = 1
for _ in range(10):
await Timer(10, units="ns")
dut.reset.value = 0
dut._log.info("Enabling chip")
#
# Enable chip
#
dut.io_en.value = 1
for test_number in range(10):
dut._log.info("Enable receiving data on the chip (" + str(test_number) + ")")
#
# Tell the receiver to start receiving data (This mainly operates based on
# a rising-edge detector, so we'll need to make it low)
#
dut.io_plInSignal.value = 1
await Timer(10, units="ns")
dut.io_plInSignal.value = 0
#
# Wait until the receive operation is done (finished)
#
for i in range(30):
if (dut.io_finishedReceivingBuffer.value == 1):
break
else:
match dut.io_rdWrAddr.value:
case 0x0: # checksum
dut.io_rdData.value = 0x00001234
case 0x8: # indicator
dut.io_rdData.value = 0x48595045 # first 32 bits of the indicator
case 0x10: # type
dut.io_rdData.value = 0x4 # debugger to hardware packet (DEBUGGER_TO_DEBUGGEE_HARDWARE_LEVEL)
case 0x14: # requested action
dut.io_rdData.value = 0x14141414
case 0x18: # General output
dut.io_rdData.value = 0x18181818
case 0x1c: # General output
dut.io_rdData.value = 0x1c1c1c1c
case 0x20: # General output
dut.io_rdData.value = 0x20202020
case 0x24: # General output
dut.io_rdData.value = 0x24242424
case 0x28: # General output
dut.io_rdData.value = 0x28282828
case 0x2c: # General output
dut.io_rdData.value = 0x2c2c2c2c
case 0x30: # General output
dut.io_rdData.value = 0x30303030
case 0x34: # General output
dut.io_rdData.value = 0x34343434
case 0x38: # General output
dut.io_rdData.value = 0x38383838
case 0x3c: # General output
dut.io_rdData.value = 0x3c3c3c3c
case 0x40: # General output
dut.io_rdData.value = 0x40404040
case 0x44: # General output
dut.io_rdData.value = 0x44444444
case 0x48: # General output
dut.io_rdData.value = 0x48484848
case 0x4c: # General output
dut.io_rdData.value = 0x4c4c4c4c
case 0x50: # General output
dut.io_rdData.value = 0x50505050
case _:
assert "invalid address in the address line"
if dut.io_requestedActionOfThePacketOutputValid.value == 1:
#
# No new data needed to be received
#
if test_number % 3 == 0:
dut.io_noNewDataReceiver.value = 1
await Timer(10, units="ns")
dut.io_noNewDataReceiver.value = 0
else:
#
# Make change to the io_readNextData signal as it operates mainly
# based on a rising-edge detector
#
if dut.io_readNextData.value == 0:
dut.io_readNextData.value = 1
else:
dut.io_readNextData.value = 0
#
# Go to the next clock cycle
#
await Timer(10, units="ns")
if test_number % 3 != 0:
dut.io_noNewDataReceiver.value = 1
await Timer(10, units="ns")
dut.io_noNewDataReceiver.value = 0
#
# Run extra waiting clocks
#
for _ in range(10):
await Timer(10, units="ns")
#
# Check the final input on the next clock
#
await Timer(10, units="ns")

View file

@ -0,0 +1,8 @@
# Makefile
TOPLEVEL_LANG = verilog
VERILOG_SOURCES = $(shell pwd)/../../../../generated/DebuggerPacketSender.sv
TOPLEVEL = DebuggerPacketSender
MODULE = test_DebuggerPacketSender
include $(shell cocotb-config --makefiles)/Makefile.sim

View file

@ -0,0 +1 @@
make SIM=icarus WAVES=1

View file

@ -0,0 +1,165 @@
##
# @file test_DebuggerPacketSender.py
#
# @author Sina Karvandi (sina@hyperdbg.org)
#
# @brief Testing module for DebuggerPacketSender
#
# @details
#
# @version 0.1
#
# @date 2024-04-21
#
# @copyright This project is released under the GNU Public License v3.
#
import random
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import Timer
from cocotb.types import LogicArray
'''
input clock,
reset,
io_en,
output io_psOutInterrupt,
output [12:0] io_rdWrAddr,
output io_wrEna,
output [31:0] io_wrData,
input io_beginSendingBuffer,
io_noNewDataSender,
io_dataValidInput,
output io_sendWaitForBuffer,
io_finishedSendingBuffer,
input [31:0] io_requestedActionOfThePacketInput,
io_sendingData
'''
@cocotb.test()
async def DebuggerPacketSender_test(dut):
"""Test DebuggerPacketSender module"""
#
# Assert initial output is unknown
#
assert LogicArray(dut.io_psOutInterrupt.value) == LogicArray("X")
assert LogicArray(dut.io_rdWrAddr.value) == LogicArray("XXXXXXXXXXXXX")
assert LogicArray(dut.io_wrEna.value) == LogicArray("X")
assert LogicArray(dut.io_wrData.value) == LogicArray("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
assert LogicArray(dut.io_sendWaitForBuffer.value) == LogicArray("X")
assert LogicArray(dut.io_finishedSendingBuffer.value) == LogicArray("X")
clock = Clock(dut.clock, 10, units="ns") # Create a 10ns period clock on port clock
#
# Start the clock. Start it low to avoid issues on the first RisingEdge
#
cocotb.start_soon(clock.start(start_high=False))
dut._log.info("Initialize and reset module")
#
# Initial values
#
dut.io_en.value = 0
dut.io_beginSendingBuffer.value = 0
#
# Reset DUT
#
dut.reset.value = 1
for _ in range(10):
await Timer(10, units="ns")
dut.reset.value = 0
dut._log.info("Enabling chip")
#
# Enable chip
#
dut.io_en.value = 1
for test_number in range(10):
dut._log.info("Enable sending data on the chip (" + str(test_number) + ")")
#
# Still there is data to send
#
dut.io_noNewDataSender.value = 0
#
# Tell the sender to start sending data (This mainly operates based on
# a rising-edge detector, so we'll need to make it low)
#
dut.io_beginSendingBuffer.value = 1
await Timer(10, units="ns")
dut.io_beginSendingBuffer.value = 0
#
# No new data at this stage
#
dut.io_dataValidInput.value = 0
dut.io_sendingData.value = 0
#
# Adjust the requested action of the packet
#
dut.io_requestedActionOfThePacketInput.value = 0x55859555
#
# Synchronize with the clock. This will apply the initial values
#
await Timer(10, units="ns")
#
# This will change the behavior of the data producer to only
# generate extra data for 2 of the test case rounds, the third
# test case doesn't have any extra data
#
if test_number % 3 != 0 :
#
# Run until the module asks for further buffers
#
for i in range(100):
if dut.io_sendWaitForBuffer.value == 1:
val = random.randint(0, 0xffffffff)
#
# Indicate that the data is valid
#
dut.io_dataValidInput.value = 1
#
# Assign the random value to send as the data
#
dut.io_sendingData.value = val
await Timer(10, units="ns")
#
# Now, tell the sender module that there is no longer needed to send data
#
for i in range(100):
if dut.io_sendWaitForBuffer.value == 1:
dut.io_noNewDataSender.value = 1
await Timer(10, units="ns")
dut.io_noNewDataSender.value = 0
break
await Timer(10, units="ns")
#
# Run extra waiting clocks
#
for _ in range(10):
await Timer(10, units="ns")
#
# Check the final input on the next clock
#
await Timer(10, units="ns")

View file

@ -0,0 +1,10 @@
# Makefile
TOPLEVEL_LANG = verilog
VERILOG_SOURCES += $(shell pwd)/../../../../generated/SendReceiveSynchronizer.sv
VERILOG_SOURCES += $(shell pwd)/../../../../generated/DebuggerPacketReceiver.sv
VERILOG_SOURCES += $(shell pwd)/../../../../generated/DebuggerPacketSender.sv
TOPLEVEL = SendReceiveSynchronizer
MODULE = test_SendReceiveSynchronizer
include $(shell cocotb-config --makefiles)/Makefile.sim

View file

@ -0,0 +1 @@
make SIM=icarus WAVES=1

View file

@ -0,0 +1,352 @@
##
# @file test_SendReceiveSynchronizer.py
#
# @author Sina Karvandi (sina@hyperdbg.org)
#
# @brief Testing module for SendReceiveSynchronizer
#
# @details
#
# @version 0.1
#
# @date 2024-04-23
#
# @copyright This project is released under the GNU Public License v3.
#
import random
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import Timer
from cocotb.types import LogicArray
'''
input clock,
reset,
io_en,
io_plInSignal,
output io_psOutInterrupt,
output [12:0] io_rdWrAddr,
input [31:0] io_rdData,
output io_wrEna,
output [31:0] io_wrData,
io_requestedActionOfThePacketOutput,
output io_requestedActionOfThePacketOutputValid,
input io_noNewDataReceiver,
io_readNextData,
output io_dataValidOutput,
output [31:0] io_receivingData,
input io_beginSendingBuffer,
io_noNewDataSender,
io_dataValidInput,
output io_sendWaitForBuffer,
input [31:0] io_requestedActionOfThePacketInput,
io_sendingData
'''
@cocotb.test()
async def SendReceiveSynchronizer_test(dut):
"""Test SendReceiveSynchronizer module"""
global DEFAULT_CONFIGURATION_INITIALIZED_MEMORY_SIZE
#
# Assert initial output is unknown
#
assert LogicArray(dut.io_psOutInterrupt.value) == LogicArray("X")
assert LogicArray(dut.io_rdWrAddr.value) == LogicArray("XXXXXXXXXXXXX")
assert LogicArray(dut.io_wrEna.value) == LogicArray("X")
assert LogicArray(dut.io_wrData.value) == LogicArray("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
assert LogicArray(dut.io_requestedActionOfThePacketOutput.value) == LogicArray("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
assert LogicArray(dut.io_requestedActionOfThePacketOutputValid.value) == LogicArray("X")
assert LogicArray(dut.io_dataValidOutput.value) == LogicArray("X")
assert LogicArray(dut.io_receivingData.value) == LogicArray("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
assert LogicArray(dut.io_sendWaitForBuffer.value) == LogicArray("X")
clock = Clock(dut.clock, 10, units="ns") # Create a 10ns period clock on port clock
#
# Start the clock. Start it low to avoid issues on the first RisingEdge
#
cocotb.start_soon(clock.start(start_high=False))
dut._log.info("Initialize and reset module")
#
# Initial values
#
dut.io_en.value = 0
dut.io_beginSendingBuffer.value = 0
dut.io_noNewDataSender.value = 0
dut.io_dataValidInput.value = 0
dut.io_readNextData.value = 0
dut.io_noNewDataReceiver.value = 0
dut.io_plInSignal.value = 0
dut.io_requestedActionOfThePacketInput.value = 0
dut.io_requestedActionOfThePacketInput.value = 0
#
# Reset DUT
#
dut.reset.value = 1
for _ in range(10):
await Timer(10, units="ns")
dut.reset.value = 0
dut._log.info("Enabling chip")
#
# Enable chip
#
dut.io_en.value = 1
for test_number in range(10):
###############################################################
# #
# Receiving Logic #
# #
###############################################################
dut._log.info("Enable receiving data on the chip (" + str(test_number) + ")")
#
# Tell the receiver to start receiving data (This mainly operates based on
# a rising-edge detector, so we'll need to make it low)
#
dut.io_plInSignal.value = 1
await Timer(10, units="ns")
dut.io_plInSignal.value = 0
#
# Activate sending logic to test whether the chip fails synchronizing signals or not
#
dut.io_beginSendingBuffer.value = 1
await Timer(10, units="ns")
dut.io_beginSendingBuffer.value = 0
#
# Wait until the receive operation is done (finished)
#
for i in range(30):
match dut.io_rdWrAddr.value:
#
# For the PS data range
#
case 0x0: # checksum
dut.io_rdData.value = 0x00001234
case 0x8: # indicator
dut.io_rdData.value = 0x48595045 # first 32 bits of the indicator
case 0x10: # type
dut.io_rdData.value = 0x4 # debugger to hardware packet (DEBUGGER_TO_DEBUGGEE_HARDWARE_LEVEL)
case 0x14: # requested action
dut.io_rdData.value = 0x14141414
case 0x18: # General output
dut.io_rdData.value = 0x18181818
case 0x1c: # General output
dut.io_rdData.value = 0x1c1c1c1c
case 0x20: # General output
dut.io_rdData.value = 0x20202020
case 0x24: # General output
dut.io_rdData.value = 0x24242424
case 0x28: # General output
dut.io_rdData.value = 0x28282828
case 0x2c: # General output
dut.io_rdData.value = 0x2c2c2c2c
case 0x30: # General output
dut.io_rdData.value = 0x30303030
case 0x34: # General output
dut.io_rdData.value = 0x34343434
case 0x38: # General output
dut.io_rdData.value = 0x38383838
case 0x3c: # General output
dut.io_rdData.value = 0x3c3c3c3c
case 0x40: # General output
dut.io_rdData.value = 0x40404040
case 0x44: # General output
dut.io_rdData.value = 0x44444444
case 0x48: # General output
dut.io_rdData.value = 0x48484848
case 0x4c: # General output
dut.io_rdData.value = 0x4c4c4c4c
case 0x50: # General output
dut.io_rdData.value = 0x50505050
#
# For the PL data range
#
case 0x1000: # checksum
dut.io_rdData.value = 0x10001000
case 0x1008: # indicator 1
dut.io_rdData.value = 0x48595045 # The first 32 bits of the indicator
case 0x100c: # indicator 2
dut.io_rdData.value = 0x100c100c # The second 32 bits of the indicator
case 0x1010: # type
dut.io_rdData.value = 0x4 # debugger to hardware packet (DEBUGGER_TO_DEBUGGEE_HARDWARE_LEVEL)
case 0x1014: # requested action
dut.io_rdData.value = 0x10141014
case 0x1018: # General output
dut.io_rdData.value = 0x10181018
case 0x101c: # General output
dut.io_rdData.value = 0x101c101c
case 0x1020: # General output
dut.io_rdData.value = 0x10201020
case 0x1024: # General output
dut.io_rdData.value = 0x10241024
case 0x1028: # General output
dut.io_rdData.value = 0x10281028
case 0x102c: # General output
dut.io_rdData.value = 0x102c102c
case 0x1030: # General output
dut.io_rdData.value = 0x10301030
case 0x1034: # General output
dut.io_rdData.value = 0x10341034
case 0x1038: # General output
dut.io_rdData.value = 0x10381038
case 0x103c: # General output
dut.io_rdData.value = 0x103c103c
case 0x1040: # General output
dut.io_rdData.value = 0x10401040
case 0x1044: # General output
dut.io_rdData.value = 0x10441044
case 0x1048: # General output
dut.io_rdData.value = 0x10481048
case 0x104c: # General output
dut.io_rdData.value = 0x104c104c
case 0x1050: # General output
dut.io_rdData.value = 0x10501050
case _:
assert 1 == 2, "invalid address in the address line"
if dut.io_requestedActionOfThePacketOutputValid.value == 1:
#
# No new data needed to be received
#
if test_number % 3 == 0:
dut.io_noNewDataReceiver.value = 1
await Timer(10, units="ns")
dut.io_noNewDataReceiver.value = 0
else:
#
# Make change to the io_readNextData signal as it operates mainly
# based on a rising-edge detector
#
if dut.io_readNextData.value == 0:
dut.io_readNextData.value = 1
else:
dut.io_readNextData.value = 0
#
# Go to the next clock cycle
#
await Timer(10, units="ns")
if test_number % 3 != 0:
dut.io_noNewDataReceiver.value = 1
await Timer(10, units="ns")
dut.io_noNewDataReceiver.value = 0
#
# Run extra waiting clocks
#
for _ in range(10):
await Timer(10, units="ns")
###############################################################
# #
# Sending Logic #
# #
###############################################################
dut._log.info("Enable sending data on the chip (" + str(test_number) + ")")
#
# There is data to send
#
dut.io_noNewDataSender.value = 0
dut.io_beginSendingBuffer.value = 0
#
# Tell the sender to start sending data (This mainly operates based on
# a rising-edge detector, so we'll need to make it low)
#
dut.io_beginSendingBuffer.value = 1
await Timer(10, units="ns")
dut.io_beginSendingBuffer.value = 0
#
# Activate receiving logic to test whether the chip fails synchronizing signals or not
#
dut.io_plInSignal.value = 1
await Timer(10, units="ns")
dut.io_plInSignal.value = 0
#
# No new data at this stage
#
dut.io_dataValidInput.value = 0
dut.io_sendingData.value = 0
#
# Adjust the requested action of the packet
#
dut.io_requestedActionOfThePacketInput.value = 0x55859555
#
# Synchronize with the clock. This will apply the initial values
#
await Timer(10, units="ns")
#
# This will change the behavior of the data producer to only
# generate extra data for 2 of the test case rounds, the third
# test case doesn't have any extra data
#
if test_number % 3 != 0 :
#
# Run until the module asks for further buffers
#
for i in range(100):
if dut.io_sendWaitForBuffer.value == 1:
val = random.randint(0, 0xffffffff)
#
# Indicate that the data is valid
#
dut.io_dataValidInput.value = 1
#
# Assign the random value to send as the data
#
dut.io_sendingData.value = val
await Timer(10, units="ns")
#
# Now, tell the sender module that there is no longer needed to send data
#
for i in range(100):
if dut.io_sendWaitForBuffer.value == 1:
dut.io_noNewDataSender.value = 1
await Timer(10, units="ns")
dut.io_noNewDataSender.value = 0
break
await Timer(10, units="ns")
#
# Run extra waiting clocks
#
for _ in range(10):
await Timer(10, units="ns")
#
# Check the final input on the next clock
#
await Timer(10, units="ns")

View file

@ -0,0 +1,32 @@
# Automated ModelSim Viewer
First of all, make sure to edit the address of the "ModelSim" directory in **modelsim.py**.
After that, only modify the "modelsim.config" file.
In the "modelsim.config" file, the first line that starts with "module:" is the name of the target module's **Tester** class. The rest of the lines are signals to be shown.
For example:
```
module:DebuggerModuleTest
clock
inputPin
```
If you don't specify the signals to be filtered, then **ALL** signals will be shown.
For example:
```
module:DebuggerModuleTest
```
At last, run it with the following command:
```
python3 modelsim.py
```
or,
```
python3 sim/modelsim.py
```

View file

@ -0,0 +1,3 @@
module:DebuggerModuleTest
io_inputPin
io_outputPin

View file

@ -0,0 +1,157 @@
import os
import subprocess
import glob
MODELSIM = "/home/sina/intelFPGA/20.1/modelsim_ase/bin"
#
# Check modelsim directory
#
if not os.path.exists(MODELSIM):
print("[x] Error: The path does not exist")
exit()
else:
print("[*] Oh, the modelsim path found :)")
MODELSIM_VCD2WLF = MODELSIM + "/vcd2wlf"
MODELSIM_VSIM = MODELSIM + "/vsim"
#
# Config file variables
#
CONFIG_TEST_MODULE_CLASS = ""
CONFIG_SHOW_ALL_WAVES = True
CONFIG_WAVES_LIST = []
#
# Check if user is root or not
#
if os.geteuid() != 0:
print("[x] you should run this script with root (sudo) user permission")
exit()
else:
print("[*] user is root")
#
# Get the current script's directory
#
current_script_path = os.path.dirname(os.path.abspath(__file__))
WAVE_OUTPUT_FILES_PATH = current_script_path + \
"/../test_run_dir/DUT_should_pass/"
CONFIG_FILE_PATH = current_script_path + "/modelsim.config"
print("[*] current script path:", WAVE_OUTPUT_FILES_PATH)
#
# Check config file
#
if os.path.exists(CONFIG_FILE_PATH) == False:
print("[x] config file not found")
exit()
#
# Interpreting config file
#
with open(CONFIG_FILE_PATH, 'r') as file:
for line in file:
if line.lower().startswith("module:") or line.lower().startswith("module :"):
# it's the test module name
CONFIG_TEST_MODULE_CLASS = line.split(":")[1]
print("[*] found module name:", CONFIG_TEST_MODULE_CLASS)
else:
# it's a wave, so no longer need to show all waves
if line.isspace() == False:
CONFIG_SHOW_ALL_WAVES = False
CONFIG_WAVES_LIST.append(line)
print("[*] signal filter for:", line)
#
# Show message if all signals need to be shown
#
if CONFIG_SHOW_ALL_WAVES == True:
print("[*] no signal filter found, assuming all signals to be shown!")
#
# Check if test module is empty or not
#
if CONFIG_TEST_MODULE_CLASS.isspace() == True:
print("[x] main test module not found, please add 'module:' to the config file")
exit()
#
# Set the current working directory
#
os.chdir(current_script_path + "/..")
print("[*] current working directory: " + format(os.getcwd()))
#
# Create TCL config file
#
print("[*] writing to TCL config file: " +
current_script_path + '/modelsim.tcl')
if CONFIG_SHOW_ALL_WAVES:
with open(current_script_path + '/modelsim.tcl', 'w') as f:
# add the clock at top of the signals by default
f.write("add wave -position insertpoint clock\n")
f.write("add wave -position insertpoint *\n")
else:
with open(current_script_path + '/modelsim.tcl', 'w') as f:
for item in CONFIG_WAVES_LIST:
f.write("add wave -position insertpoint {*" + item.replace('\n','').replace('\r', '') + '*}\n')
#
# Remove all the previous *.wlf, *.vcd, *.fir files
#
print("[*] removing previously generated files")
for file_name in os.listdir(WAVE_OUTPUT_FILES_PATH):
if file_name.endswith('.wlf') or file_name.endswith('.vcd') or file_name.endswith('.fir'):
os.remove(os.path.join(WAVE_OUTPUT_FILES_PATH, file_name))
#
# Run the VCD wave generator
#
print("[*] running chisel VCD file generator for module: " +
CONFIG_TEST_MODULE_CLASS)
print("running command: '" + "sbt testOnly " + CONFIG_TEST_MODULE_CLASS + " -- -DwriteVcd=1" + "'")
result = subprocess.run(
["sbt", "testOnly " + CONFIG_TEST_MODULE_CLASS + " -- -DwriteVcd=1"], stdout=subprocess.PIPE)
print(result.stdout.decode())
#
# Get all files in directory
#
files = glob.glob(WAVE_OUTPUT_FILES_PATH + "/*")
#
# Sort files by last modified time
#
files.sort(key=lambda x: os.path.getmtime(x))
#
# Check if the list is empty or not
#
if not files or not files[-1].endswith('.vcd') :
print("[x] there was an error in generating VCD files")
exit()
#
# Get the latest modified file
#
latest_vcd_file = files[-1]
print("[*] latest generated VCD file: " + latest_vcd_file)
#
# Converting VCD to WLF
#
print("[*] converting VCD file to WLF file")
result = subprocess.run(
[MODELSIM_VCD2WLF, latest_vcd_file, latest_vcd_file + ".wlf"], stdout=subprocess.PIPE)
print(result.stdout.decode())
#
# Run the generated WLF file
#
print("[*] opening file in vsim: " + latest_vcd_file + ".wlf")
subprocess.run([MODELSIM_VSIM, latest_vcd_file + ".wlf",
"-do", current_script_path + '/modelsim.tcl'])

View file

@ -0,0 +1,2 @@
add wave -position insertpoint {*io_inputPin*}
add wave -position insertpoint {*io_outputPin*}

View file

@ -0,0 +1,162 @@
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Sina Karvandi (sina@hyperdbg.org)
//
// Create Date: 09/18/2024
// Design Name:
// Module Name: PlainSystemVerilogDUT
// Project Name: PlainSystemVerilogDUT
// Target Devices:
// Tool Versions:
// Description: This code is used for plain simulation of the top-level
// design of hwdbg debugger
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module PlainSystemVerilogDUT;
//
// Parameters
//
parameter CLK_PERIOD = 10; // Clock period
//
// Signal Declarations
//
logic clock;
logic reset;
logic io_en;
logic [31:0] io_inputPin; // Array for input pins
logic [31:0] io_outputPin; // Array for output pins
logic io_plInSignal;
logic io_psOutInterrupt;
//
// Instantiate the DUT (Device Under Test)
//
DebuggerModuleTestingBRAM uut (
.clock(clock),
.reset(reset),
.io_en(io_en),
.io_inputPin_0(io_inputPin[0]),
.io_inputPin_1(io_inputPin[1]),
.io_inputPin_2(io_inputPin[2]),
.io_inputPin_3(io_inputPin[3]),
.io_inputPin_4(io_inputPin[4]),
.io_inputPin_5(io_inputPin[5]),
.io_inputPin_6(io_inputPin[6]),
.io_inputPin_7(io_inputPin[7]),
.io_inputPin_8(io_inputPin[8]),
.io_inputPin_9(io_inputPin[9]),
.io_inputPin_10(io_inputPin[10]),
.io_inputPin_11(io_inputPin[11]),
.io_inputPin_12(io_inputPin[12]),
.io_inputPin_13(io_inputPin[13]),
.io_inputPin_14(io_inputPin[14]),
.io_inputPin_15(io_inputPin[15]),
.io_inputPin_16(io_inputPin[16]),
.io_inputPin_17(io_inputPin[17]),
.io_inputPin_18(io_inputPin[18]),
.io_inputPin_19(io_inputPin[19]),
.io_inputPin_20(io_inputPin[20]),
.io_inputPin_21(io_inputPin[21]),
.io_inputPin_22(io_inputPin[22]),
.io_inputPin_23(io_inputPin[23]),
.io_inputPin_24(io_inputPin[24]),
.io_inputPin_25(io_inputPin[25]),
.io_inputPin_26(io_inputPin[26]),
.io_inputPin_27(io_inputPin[27]),
.io_inputPin_28(io_inputPin[28]),
.io_inputPin_29(io_inputPin[29]),
.io_inputPin_30(io_inputPin[30]),
.io_inputPin_31(io_inputPin[31]),
.io_outputPin_0(io_outputPin[0]),
.io_outputPin_1(io_outputPin[1]),
.io_outputPin_2(io_outputPin[2]),
.io_outputPin_3(io_outputPin[3]),
.io_outputPin_4(io_outputPin[4]),
.io_outputPin_5(io_outputPin[5]),
.io_outputPin_6(io_outputPin[6]),
.io_outputPin_7(io_outputPin[7]),
.io_outputPin_8(io_outputPin[8]),
.io_outputPin_9(io_outputPin[9]),
.io_outputPin_10(io_outputPin[10]),
.io_outputPin_11(io_outputPin[11]),
.io_outputPin_12(io_outputPin[12]),
.io_outputPin_13(io_outputPin[13]),
.io_outputPin_14(io_outputPin[14]),
.io_outputPin_15(io_outputPin[15]),
.io_outputPin_16(io_outputPin[16]),
.io_outputPin_17(io_outputPin[17]),
.io_outputPin_18(io_outputPin[18]),
.io_outputPin_19(io_outputPin[19]),
.io_outputPin_20(io_outputPin[20]),
.io_outputPin_21(io_outputPin[21]),
.io_outputPin_22(io_outputPin[22]),
.io_outputPin_23(io_outputPin[23]),
.io_outputPin_24(io_outputPin[24]),
.io_outputPin_25(io_outputPin[25]),
.io_outputPin_26(io_outputPin[26]),
.io_outputPin_27(io_outputPin[27]),
.io_outputPin_28(io_outputPin[28]),
.io_outputPin_29(io_outputPin[29]),
.io_outputPin_30(io_outputPin[30]),
.io_outputPin_31(io_outputPin[31]),
.io_plInSignal(io_plInSignal),
.io_psOutInterrupt(io_psOutInterrupt)
);
//
// Clock generation
//
initial begin
clock = 0;
forever #(CLK_PERIOD / 2) clock = ~clock;
end
//
// Test procedure
//
initial begin
// Initialize signals
reset = 1;
io_en = 1;
io_plInSignal = 0;
io_inputPin = 32'h0; // Initialize all input pins to 0
#100; // Hold reset for 100 ns
// Apply reset
@(posedge clock);
reset = 0; // Release reset
@(posedge clock);
//
// Example input stimulus
//
io_inputPin = 32'hFFFF_FFFF; // Apply some input pattern
//
// Enable PL input signal
//
io_plInSignal = 1;
//
// Wait for a few clock cycles
//
repeat (10000) @(posedge clock);
//
// Finish the simulation after some time
//
repeat (20) @(posedge clock);
$finish;
end
endmodule

View file

@ -0,0 +1,515 @@
/**
* @file
* interpreter.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Remote debugger packet interpreter module
* @details
* @version 0.1
* @date
* 2024-04-19
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.communication.interpreter
import chisel3._
import chisel3.util.{switch, is}
import circt.stage.ChiselStage
import hwdbg.configs._
import hwdbg.types._
import hwdbg.script._
object DebuggerPacketInterpreterEnums {
object State extends ChiselEnum {
val sIdle, sNewActionReceived, sSendResponse, sDone = Value
}
}
class DebuggerPacketInterpreter(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
) extends Module {
//
// Import state enum
//
import DebuggerPacketInterpreterEnums.State
import DebuggerPacketInterpreterEnums.State._
val io = IO(new Bundle {
//
// Chip signals
//
val en = Input(Bool()) // chip enable signal
//
// Receiving signals
//
val requestedActionOfThePacketInput = Input(UInt(new DebuggerRemotePacket().RequestedActionOfThePacket.getWidth.W)) // the requested action
val requestedActionOfThePacketInputValid = Input(Bool()) // whether data on the requested action is valid or not
val noNewDataReceiver = Output(Bool()) // are interpreter expects more data?
val readNextData = Output(Bool()) // whether the next data should be read or not?
val dataValidInput = Input(Bool()) // whether data on the receiving data line is valid or not?
val receivingData = Input(UInt(instanceInfo.bramDataWidth.W)) // data to be received in interpreter
//
// Sending signals
//
val beginSendingBuffer = Output(Bool()) // should sender start sending buffers or not?
val noNewDataSender = Output(Bool()) // should sender finish sending buffers or not?
val dataValidOutput = Output(Bool()) // should sender send next buffer or not?
val sendWaitForBuffer = Input(Bool()) // should the interpreter send next buffer or not?
val requestedActionOfThePacketOutput = Output(UInt(new DebuggerRemotePacket().RequestedActionOfThePacket.getWidth.W)) // the requested action
val sendingData = Output(UInt(instanceInfo.bramDataWidth.W)) // data to be sent to the debugger
//
// Script stage configuration signals
//
val finishedScriptConfiguration = Output(Bool()) // whether script configuration finished or not?
val configureStage = Output(Bool()) // whether the configuration of stage should start or not?
val targetOperator = Output(new HwdbgShortSymbol(instanceInfo.scriptVariableLength)) // Current operator to be configured
})
//
// State registers
//
val state = RegInit(sIdle)
//
// Last error register
//
val lastSuccesOrErrorMessage = RegInit(0.U(instanceInfo.bramDataWidth.W))
//
// Last error register
//
val enablePinOfScriptBufferHandler = RegInit(false.B)
//
// Output pins
//
val noNewDataReceiver = WireInit(false.B)
val readNextData = WireInit(false.B)
val regBeginSendingBuffer = RegInit(false.B)
val noNewDataSender = WireInit(false.B)
val dataValidOutput = WireInit(false.B)
val sendingData = WireInit(0.U(instanceInfo.bramDataWidth.W))
val regRequestedActionOfThePacketOutput = RegInit(0.U(new DebuggerRemotePacket().RequestedActionOfThePacket.getWidth.W))
val finishedScriptConfiguration = WireInit(false.B)
val configureStage = WireInit(false.B)
val initialSymbol = Wire(new HwdbgShortSymbol(instanceInfo.scriptVariableLength))
initialSymbol.Type := 0.U
initialSymbol.Value := 0.U
val targetOperator = WireInit(initialSymbol)
//
// Apply the chip enable signal
//
when(io.en === true.B) {
switch(state) {
is(sIdle) {
//
// Check if the debugger need a new action (a new command is received)
//
when(io.requestedActionOfThePacketInputValid) {
//
// An action is received
//
state := sNewActionReceived
}.otherwise {
//
// Remain at the same state (no action)
//
state := sIdle
}
}
is(sNewActionReceived) {
// -------------------------------------------------------------------------
// Now, the action needs to be dispatched
//
val inputAction = io.requestedActionOfThePacketInput
when(inputAction === HwdbgActionEnums.hwdbgActionSendInstanceInfo.id.U) {
//
// *** Configure sending instance info ***
//
//
// Set the response packet type
//
regRequestedActionOfThePacketOutput := HwdbgResponseEnums.hwdbgResponseInstanceInfo.id.U
//
// This action needs a response
//
state := sSendResponse
}.elsewhen(inputAction === HwdbgActionEnums.hwdbgActionConfigureScriptBuffer.id.U) {
//
// *** Configure the internal buffer with script ***
//
//
// Enable the buffer config module
//
enablePinOfScriptBufferHandler := true.B
val (
moduleReadNextData,
moduleFinishedScriptConfiguration,
moduleConfigureStage,
moduleTargetOperator
) =
InterpreterScriptBufferHandler(
debug,
instanceInfo
)(
enablePinOfScriptBufferHandler,
io.dataValidInput,
io.receivingData
)
//
// Connect the script stage configuration signals
//
readNextData := moduleReadNextData
configureStage := moduleConfigureStage
finishedScriptConfiguration := moduleFinishedScriptConfiguration
targetOperator := moduleTargetOperator
when(moduleFinishedScriptConfiguration === true.B) {
//
// *** Script stage buffer configuration finished! ***
//
//
// Disable the buffer config module
//
enablePinOfScriptBufferHandler := false.B
//
// Set the response packet type
//
regRequestedActionOfThePacketOutput := HwdbgResponseEnums.hwdbgResponseSuccessOrErrorMessage.id.U
//
// Set the success message
//
lastSuccesOrErrorMessage := HwdbgSuccessOrErrorEnums.hwdbgOperationWasSuccessful.id.U
//
// This action needs a response
//
state := sSendResponse
}.otherwise {
//
// *** Script stage buffer configuration NOT finished, read the buffer ***
//
//
// Stay at the same state
//
state := sNewActionReceived
}
}.otherwise {
//
// *** Invalid action ***
//
//
// Set the response packet type
//
regRequestedActionOfThePacketOutput := HwdbgResponseEnums.hwdbgResponseSuccessOrErrorMessage.id.U
//
// Set the latest error
//
lastSuccesOrErrorMessage := HwdbgSuccessOrErrorEnums.hwdbgErrorInvalidPacket.id.U
//
// This action needs a response
//
state := sSendResponse
}
//
// -------------------------------------------------------------------------
//
}
is(sSendResponse) {
//
// Finish the receiving
//
noNewDataReceiver := true.B
//
// Begin sending response
//
regBeginSendingBuffer := true.B
//
// Wait until the sender module is reading to send data
//
when(io.sendWaitForBuffer === true.B) {
// -------------------------------------------------------------------------
// Now, the response needs to be sent
//
when(regRequestedActionOfThePacketOutput === HwdbgResponseEnums.hwdbgResponseInstanceInfo.id.U) {
//
// *** Send instance information ***
//
//
// Instantiate the instance info module
//
val (
noNewDataSenderModule,
dataValidOutputModule,
sendingDataModule
) =
InterpreterInstanceInfo(
debug,
instanceInfo
)(
io.sendWaitForBuffer // send waiting for buffer as an activation signal to the module
)
//
// Set data validity
//
dataValidOutput := dataValidOutputModule
//
// Set data
//
sendingData := sendingDataModule
//
// Once sending data is done, we'll go to the Done state
//
when(noNewDataSenderModule === true.B) {
state := sDone
}
}.elsewhen(regRequestedActionOfThePacketOutput === HwdbgResponseEnums.hwdbgResponseSuccessOrErrorMessage.id.U) {
//
// *** Send result of applying command (and errors) ***
//
//
// Instantiate the invalid packet module
//
val (
noNewDataSenderModule,
dataValidOutputModule,
sendingDataModule
) =
InterpreterSendSuccessOrError(
debug,
instanceInfo
)(
io.sendWaitForBuffer, // send waiting for buffer as an activation signal to the module
lastSuccesOrErrorMessage
)
//
// Set data validity
//
dataValidOutput := dataValidOutputModule
//
// Set data
//
sendingData := sendingDataModule
//
// Once sending data is done, we'll go to the Done state
//
when(noNewDataSenderModule === true.B) {
state := sDone
}
}
//
// -------------------------------------------------------------------------
//
}.otherwise {
//
// The sender module is not ready for sending buffer
// so, we need to stay at this state
//
state := sSendResponse
}
}
is(sDone) {
//
// Finish the receiving, sending communication
//
noNewDataReceiver := true.B
noNewDataSender := true.B
//
// No longer need to begin sending data
//
regBeginSendingBuffer := false.B
//
// Go to the idle state
//
state := sIdle
}
}
}
// ---------------------------------------------------------------------
//
// Connect output pins
//
io.noNewDataReceiver := noNewDataReceiver
io.readNextData := readNextData
io.beginSendingBuffer := regBeginSendingBuffer
io.noNewDataSender := noNewDataSender
io.dataValidOutput := dataValidOutput
io.requestedActionOfThePacketOutput := regRequestedActionOfThePacketOutput
io.sendingData := sendingData
io.configureStage := configureStage
io.finishedScriptConfiguration := finishedScriptConfiguration
io.targetOperator := targetOperator
}
object DebuggerPacketInterpreter {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
)(
en: Bool,
requestedActionOfThePacketInput: UInt,
requestedActionOfThePacketInputValid: Bool,
dataValidInput: Bool,
receivingData: UInt,
sendWaitForBuffer: Bool
): (Bool, Bool, Bool, Bool, Bool, UInt, UInt, Bool, Bool, HwdbgShortSymbol) = {
val debuggerPacketInterpreter = Module(
new DebuggerPacketInterpreter(
debug,
instanceInfo
)
)
val noNewDataReceiver = Wire(Bool())
val readNextData = Wire(Bool())
val beginSendingBuffer = Wire(Bool())
val noNewDataSender = Wire(Bool())
val dataValidOutput = Wire(Bool())
val requestedActionOfThePacketOutput = Wire(UInt(new DebuggerRemotePacket().RequestedActionOfThePacket.getWidth.W))
val sendingData = Wire(UInt(instanceInfo.bramDataWidth.W))
val finishedScriptConfiguration = Wire(Bool())
val configureStage = Wire(Bool())
val targetOperator = Wire(new HwdbgShortSymbol(instanceInfo.scriptVariableLength))
//
// Configure the input signals
//
debuggerPacketInterpreter.io.en := en
//
// Configure the input signals related to the receiving signals
//
debuggerPacketInterpreter.io.requestedActionOfThePacketInput := requestedActionOfThePacketInput
debuggerPacketInterpreter.io.requestedActionOfThePacketInputValid := requestedActionOfThePacketInputValid
debuggerPacketInterpreter.io.dataValidInput := dataValidInput
debuggerPacketInterpreter.io.receivingData := receivingData
//
// Configure the input signals related to the sending signals
//
debuggerPacketInterpreter.io.sendWaitForBuffer := sendWaitForBuffer
//
// Configure the output signals
//
noNewDataReceiver := debuggerPacketInterpreter.io.noNewDataReceiver
readNextData := debuggerPacketInterpreter.io.readNextData
//
// Configure the output signals related to sending packets
//
beginSendingBuffer := debuggerPacketInterpreter.io.beginSendingBuffer
noNewDataSender := debuggerPacketInterpreter.io.noNewDataSender
dataValidOutput := debuggerPacketInterpreter.io.dataValidOutput
//
// Configure the output signals related to received packets
//
requestedActionOfThePacketOutput := debuggerPacketInterpreter.io.requestedActionOfThePacketOutput
sendingData := debuggerPacketInterpreter.io.sendingData
//
// Configure the output signals related to stage configuration
//
finishedScriptConfiguration := debuggerPacketInterpreter.io.finishedScriptConfiguration
configureStage := debuggerPacketInterpreter.io.configureStage
targetOperator := debuggerPacketInterpreter.io.targetOperator
//
// Return the output result
//
(
noNewDataReceiver,
readNextData,
beginSendingBuffer,
noNewDataSender,
dataValidOutput,
requestedActionOfThePacketOutput,
sendingData,
finishedScriptConfiguration,
configureStage,
targetOperator
)
}
}

View file

@ -0,0 +1,462 @@
/**
* @file
* port_information.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Send port information (in interpreter)
* @details
* @version 0.1
* @date
* 2024-05-04
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.communication.interpreter
import chisel3._
import chisel3.util.{switch, is, log2Ceil}
import circt.stage.ChiselStage
import hwdbg.configs._
import hwdbg.utils._
object InterpreterInstanceInfoEnums {
object State extends ChiselEnum {
val sIdle, sSendVersion, sSendMaximumNumberOfStages, sSendScriptVariableLength, sSendNumberOfSupportedLocalAndGlobalVariables,
sSendNumberOfSupportedTemporaryVariables, sSendMaximumNumberOfSupportedGetScriptOperators, sSendMaximumNumberOfSupportedSetScriptOperators,
sSendSharedMemorySize, sSendDebuggerAreaOffset, sSendDebuggeeAreaOffset, sSendNumberOfPins, sSendNumberOfPorts, sSendScriptCapabilities1,
sSendScriptCapabilities2, sSendBramAddrWidth, sSendBramDataWidth, sSendPortsConfiguration, sDone = Value
}
}
class InterpreterInstanceInfo(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
) extends Module {
//
// Import state enum
//
import InterpreterInstanceInfoEnums.State
import InterpreterInstanceInfoEnums.State._
val io = IO(new Bundle {
//
// Chip signals
//
val en = Input(Bool()) // chip enable signal
//
// Sending signals
//
val noNewDataSender = Output(Bool()) // should sender finish sending buffers or not?
val dataValidOutput = Output(Bool()) // should sender send next buffer or not?
val sendingData = Output(UInt(instanceInfo.bramDataWidth.W)) // data to be sent to the debugger
})
//
// State registers
//
val state = RegInit(sIdle)
//
// Get number of input/output ports
//
val numberOfPorts = instanceInfo.portsConfiguration.size
//
// Convert input port pins into vector
//
// val pinsVec = RegInit(VecInit(Seq.fill(numberOfPorts)(0.U(instanceInfo.bramDataWidth.W))))
val pinsVec = VecInit(instanceInfo.portsConfiguration.map(_.U))
//
// Determine the width for numberOfSentPins
//
val numberOfSentPinsWidth = log2Ceil(numberOfPorts)
//
// Registers for keeping track of sent pin details
//
val numberOfSentPins = RegInit(0.U(numberOfSentPinsWidth.W))
//
// Output pins
//
val noNewDataSender = WireInit(false.B)
val dataValidOutput = WireInit(false.B)
val sendingData = WireInit(0.U(instanceInfo.bramDataWidth.W))
//
// Apply the chip enable signal
//
when(io.en === true.B) {
switch(state) {
is(sIdle) {
//
// Going to the next state (sending the version of the debugger)
//
state := sSendVersion
}
is(sSendVersion) {
//
// Set the version
//
sendingData := instanceInfo.version.U
//
// The output is valid
//
dataValidOutput := true.B
state := sSendMaximumNumberOfStages
}
is(sSendMaximumNumberOfStages) {
//
// Set the maximum number of stages supported by this instance of the debugger
//
sendingData := instanceInfo.maximumNumberOfStages.U
//
// The output is valid
//
dataValidOutput := true.B
state := sSendScriptVariableLength
}
is(sSendScriptVariableLength) {
//
// Set the script variable length of this instance of the debugger
//
sendingData := instanceInfo.scriptVariableLength.U
//
// The output is valid
//
dataValidOutput := true.B
state := sSendNumberOfSupportedLocalAndGlobalVariables
}
is(sSendNumberOfSupportedLocalAndGlobalVariables) {
//
// Set the number of supported local variables for this instance of the debugger
//
sendingData := instanceInfo.numberOfSupportedLocalAndGlobalVariables.U
//
// The output is valid
//
dataValidOutput := true.B
state := sSendNumberOfSupportedTemporaryVariables
}
is(sSendNumberOfSupportedTemporaryVariables) {
//
// Set the number of supported temporary variables for this instance of the debugger
//
sendingData := instanceInfo.numberOfSupportedTemporaryVariables.U
//
// The output is valid
//
dataValidOutput := true.B
state := sSendMaximumNumberOfSupportedGetScriptOperators
}
is(sSendMaximumNumberOfSupportedGetScriptOperators) {
//
// Set the maximum number of supported GET operators by this instance of the
// debugger in the script engine
//
sendingData := instanceInfo.maximumNumberOfSupportedGetScriptOperators.U
//
// The output is valid
//
dataValidOutput := true.B
state := sSendMaximumNumberOfSupportedSetScriptOperators
}
is(sSendMaximumNumberOfSupportedSetScriptOperators) {
//
// Set the maximum number of supported SET operators by this instance of the
// debugger in the script engine
//
sendingData := instanceInfo.maximumNumberOfSupportedSetScriptOperators.U
//
// The output is valid
//
dataValidOutput := true.B
state := sSendSharedMemorySize
}
is(sSendSharedMemorySize) {
//
// Set the shared memory size used by this instance of the debugger
//
sendingData := instanceInfo.sharedMemorySize.U
//
// The output is valid
//
dataValidOutput := true.B
state := sSendDebuggerAreaOffset
}
is(sSendDebuggerAreaOffset) {
//
// Set the start offset of the debugger to the debuggee memory for this
// instance of the debugger
//
sendingData := instanceInfo.debuggerAreaOffset.U
//
// The output is valid
//
dataValidOutput := true.B
state := sSendDebuggeeAreaOffset
}
is(sSendDebuggeeAreaOffset) {
//
// Set the start offset of the debuggee to the debugger memory for this
// instance of the debugger
//
sendingData := instanceInfo.debuggeeAreaOffset.U
//
// The output is valid
//
dataValidOutput := true.B
state := sSendNumberOfPins
}
is(sSendNumberOfPins) {
//
// Set the number of pins in this instance of the debugger
//
sendingData := instanceInfo.numberOfPins.U
//
// The output is valid
//
dataValidOutput := true.B
state := sSendNumberOfPorts
}
is(sSendNumberOfPorts) {
//
// Set the number of ports in this instance of the debugger
//
sendingData := instanceInfo.numberOfPorts.U
//
// The output is valid
//
dataValidOutput := true.B
state := sSendScriptCapabilities1
}
is(sSendScriptCapabilities1) {
//
// Set the first bits (most significant) of the supported operators capabilities of this instance
// of the debugger
//
sendingData := BitwiseFunction
.getBitsInRange(instanceInfo.scriptCapabilities, instanceInfo.bramDataWidth, instanceInfo.bramDataWidth + instanceInfo.bramDataWidth - 1)
.U
//
// The output is valid
//
dataValidOutput := true.B
state := sSendScriptCapabilities2
}
is(sSendScriptCapabilities2) {
//
// Set the second bits (least significant) of the supported operators capabilities of this instance
// of the debugger
//
sendingData := BitwiseFunction.getBitsInRange(instanceInfo.scriptCapabilities, 0, instanceInfo.bramDataWidth - 1).U
//
// The output is valid
//
dataValidOutput := true.B
state := sSendBramAddrWidth
}
is(sSendBramAddrWidth) {
//
// Set the BRAM address width in this instance of the debugger
//
sendingData := instanceInfo.bramAddrWidth.U
//
// The output is valid
//
dataValidOutput := true.B
state := sSendBramDataWidth
}
is(sSendBramDataWidth) {
//
// Set the BRAM data width in this instance of the debugger
//
sendingData := instanceInfo.bramDataWidth.U
//
// The output is valid
//
dataValidOutput := true.B
state := sSendPortsConfiguration
}
is(sSendPortsConfiguration) {
//
// Send input port items
//
//
// Adjust data
//
sendingData := pinsVec(numberOfSentPins)
//
// Data is valid
//
dataValidOutput := true.B
when(numberOfSentPins === (numberOfPorts - 1).U) {
//
// Reset the pins sent for sending details
//
numberOfSentPins := 0.U
state := sDone
}.otherwise {
//
// Send next index
//
numberOfSentPins := numberOfSentPins + 1.U
//
// Stay at the same state
//
state := sSendPortsConfiguration
}
}
is(sDone) {
//
// Indicate that sending data is done
//
noNewDataSender := true.B
//
// Goto the idle state
//
state := sIdle
}
}
}
// ---------------------------------------------------------------------
//
// Connect output pins
//
io.noNewDataSender := noNewDataSender
io.dataValidOutput := dataValidOutput
io.sendingData := sendingData
}
object InterpreterInstanceInfo {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
)(
en: Bool
): (Bool, Bool, UInt) = {
val interpreterInstanceInfo = Module(
new InterpreterInstanceInfo(
debug,
instanceInfo
)
)
val noNewDataSender = Wire(Bool())
val dataValidOutput = Wire(Bool())
val sendingData = Wire(UInt(instanceInfo.bramDataWidth.W))
//
// Configure the input signals
//
interpreterInstanceInfo.io.en := en
//
// Configure the output signals
//
noNewDataSender := interpreterInstanceInfo.io.noNewDataSender
dataValidOutput := interpreterInstanceInfo.io.dataValidOutput
sendingData := interpreterInstanceInfo.io.sendingData
//
// Return the output result
//
(
noNewDataSender,
dataValidOutput,
sendingData
)
}
}

View file

@ -0,0 +1,301 @@
/**
* @file
* script_buffer_handler.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Configures the script stages from shared memory
* @details
* @version 0.1
* @date
* 2024-06-14
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.communication.interpreter
import chisel3._
import chisel3.util.{switch, is}
import circt.stage.ChiselStage
import hwdbg.configs._
import hwdbg.types._
import hwdbg.script._
object InterpreterScriptBufferHandlerEnums {
object State extends ChiselEnum {
val sIdle, sReadSizeOfBuffer, sReadTypeOfOperator, sReadValueOfOperator, sDone = Value
}
}
class InterpreterScriptBufferHandler(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
) extends Module {
//
// Import state enum
//
import InterpreterScriptBufferHandlerEnums.State
import InterpreterScriptBufferHandlerEnums.State._
val io = IO(new Bundle {
//
// Chip signals
//
val en = Input(Bool()) // chip enable signal
//
// Receiving signals
//
val readNextData = Output(Bool()) // whether the next data should be read or not?
val dataValidInput = Input(Bool()) // whether data on the receiving data line is valid or not?
val receivingData = Input(UInt(instanceInfo.bramDataWidth.W)) // data to be received in interpreter
//
// Script stage configuration signals
//
val finishedScriptConfiguration = Output(Bool()) // whether configuration finished or not?
val configureStage = Output(Bool()) // whether the configuration of stage should start or not?
val targetOperator = Output(new HwdbgShortSymbol(instanceInfo.scriptVariableLength)) // Current operator to be configured
})
//
// State registers
//
val state = RegInit(sIdle)
//
// Internal registers
//
val regScriptNumberOfSymbols = Reg(UInt(instanceInfo.bramDataWidth.W))
//
// Output pins
//
val readNextData = WireInit(false.B)
val finishedScriptConfiguration = WireInit(false.B)
val configureStage = RegInit(false.B)
val regTargetOperator = Reg(new HwdbgShortSymbol(instanceInfo.scriptVariableLength))
//
// Apply the chip enable signal
//
when(io.en === true.B) {
switch(state) {
is(sIdle) {
//
// Read next data for the size of the buffer
//
readNextData := true.B
//
// Move to the next state
//
state := sReadSizeOfBuffer
}
is(sReadSizeOfBuffer) {
when(io.dataValidInput) {
//
// Data is valid and number of symbols is now available
//
regScriptNumberOfSymbols := io.receivingData
//
// Request next data
//
readNextData := true.B
//
// Move to the configuration state
//
state := sReadTypeOfOperator
}.otherwise {
//
// Stay at the same state since the data is not yet received
//
state := sReadSizeOfBuffer
}
}
is(sReadTypeOfOperator) {
//
// Not valid for configuring yet
//
configureStage := false.B
when(io.dataValidInput) {
//
// Request next data
//
readNextData := true.B
//
// Read the operator's "Type" data
//
regTargetOperator.Type := io.receivingData
//
// Next, we need to read "Value"
//
state := sReadValueOfOperator
}.otherwise {
//
// Stay at the same state since the data is not received yet
//
state := sReadTypeOfOperator
}
}
is(sReadValueOfOperator) {
when(io.dataValidInput) {
//
// Configure the stages
//
configureStage := true.B
//
// Read the operator's "Value" data
//
regTargetOperator.Value := io.receivingData
//
// Decrement the remaining symbols
//
regScriptNumberOfSymbols := regScriptNumberOfSymbols - 1.U
//
// Check if reading is scripts are finished or not
//
when(regScriptNumberOfSymbols === 0.U) {
//
// Configurartion was done
//
state := sDone
}.otherwise {
//
// Request next data
//
readNextData := true.B
//
// Again, read the next type
//
state := sReadTypeOfOperator
}
}.otherwise {
//
// Stay at the same state since the data is not received yet
//
state := sReadValueOfOperator
}
}
is(sDone) {
//
// Not valid for configuring anymore
//
configureStage := false.B
//
// Finished configuration
//
finishedScriptConfiguration := true.B
//
// Move to the idle state
//
state := sIdle
}
}
}
//
// Connect output pins
//
io.readNextData := readNextData
io.finishedScriptConfiguration := finishedScriptConfiguration
io.configureStage := configureStage
io.targetOperator := regTargetOperator
}
object InterpreterScriptBufferHandler {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
)(
en: Bool,
dataValidInput: Bool,
receivingData: UInt
): (Bool, Bool, Bool, HwdbgShortSymbol) = {
val interpreterScriptBufferHandler = Module(
new InterpreterScriptBufferHandler(
debug,
instanceInfo
)
)
val readNextData = Wire(Bool())
val finishedScriptConfiguration = Wire(Bool())
val configureStage = Wire(Bool())
val targetOperator = Wire(new HwdbgShortSymbol(instanceInfo.scriptVariableLength))
//
// Configure the input signals
//
interpreterScriptBufferHandler.io.en := en
//
// Configure the input signals related to the receiving signals
//
interpreterScriptBufferHandler.io.dataValidInput := dataValidInput
interpreterScriptBufferHandler.io.receivingData := receivingData
//
// Configure the output signals
//
readNextData := interpreterScriptBufferHandler.io.readNextData
//
// Configure the output signals related to configuring stage operators
//
finishedScriptConfiguration := interpreterScriptBufferHandler.io.finishedScriptConfiguration
configureStage := interpreterScriptBufferHandler.io.configureStage
targetOperator := interpreterScriptBufferHandler.io.targetOperator
//
// Return the output result
//
(
readNextData,
finishedScriptConfiguration,
configureStage,
targetOperator
)
}
}

View file

@ -0,0 +1,125 @@
/**
* @file
* send_success_or_error.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Send an indication of invalid packet error or success message (in the interpreter)
* @details
* @version 0.1
* @date
* 2024-05-04
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.communication.interpreter
import chisel3._
import chisel3.util.{switch, is}
import circt.stage.ChiselStage
import hwdbg.configs._
class InterpreterSendSuccessOrError(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
) extends Module {
val io = IO(new Bundle {
//
// Chip signals
//
val en = Input(Bool()) // chip enable signal
val lastSuccessOrError = Input(UInt(instanceInfo.bramDataWidth.W)) // input last error
//
// Sending signals
//
val noNewDataSender = Output(Bool()) // should sender finish sending buffers or not?
val dataValidOutput = Output(Bool()) // should sender send next buffer or not?
val sendingData = Output(UInt(instanceInfo.bramDataWidth.W)) // data to be sent to the debugger
})
//
// Output pins
//
val noNewDataSender = WireInit(false.B)
val dataValidOutput = WireInit(false.B)
val sendingData = WireInit(0.U(instanceInfo.bramDataWidth.W))
//
// Apply the chip enable signal
//
when(io.en === true.B) {
//
// Set the version
//
sendingData := io.lastSuccessOrError
//
// Sending the version in one clock cycle
//
noNewDataSender := true.B
dataValidOutput := true.B
}
// ---------------------------------------------------------------------
//
// Connect output pins
//
io.noNewDataSender := noNewDataSender
io.dataValidOutput := dataValidOutput
io.sendingData := sendingData
}
object InterpreterSendSuccessOrError {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
)(
en: Bool,
lastSuccessOrError: UInt
): (Bool, Bool, UInt) = {
val interpreterSendSuccessOrError = Module(
new InterpreterSendSuccessOrError(
debug,
instanceInfo
)
)
val noNewDataSender = Wire(Bool())
val dataValidOutput = Wire(Bool())
val sendingData = Wire(UInt(instanceInfo.bramDataWidth.W))
//
// Configure the input signals
//
interpreterSendSuccessOrError.io.en := en
interpreterSendSuccessOrError.io.lastSuccessOrError := lastSuccessOrError
//
// Configure the output signals
//
noNewDataSender := interpreterSendSuccessOrError.io.noNewDataSender
dataValidOutput := interpreterSendSuccessOrError.io.dataValidOutput
sendingData := interpreterSendSuccessOrError.io.sendingData
//
// Return the output result
//
(
noNewDataSender,
dataValidOutput,
sendingData
)
}
}

View file

@ -0,0 +1,444 @@
/**
* @file
* receiver.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Remote debugger packet receiver module
* @details
* @version 0.1
* @date
* 2024-04-08
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.communication
import chisel3._
import chisel3.util.{switch, is}
import circt.stage.ChiselStage
import hwdbg.configs._
import hwdbg.types._
import hwdbg.utils._
import hwdbg.constants._
object DebuggerPacketReceiverEnums {
object State extends ChiselEnum {
val sIdle, sReadChecksum, sReadIndicator, sReadTypeOfThePacket, sReadRequestedActionOfThePacket, sRequestedActionIsValid, sWaitToReadActionBuffer,
sReadActionBuffer, sDone = Value
}
}
class DebuggerPacketReceiver(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
) extends Module {
//
// Import state enum
//
import DebuggerPacketReceiverEnums.State
import DebuggerPacketReceiverEnums.State._
val io = IO(new Bundle {
//
// Chip signals
//
val en = Input(Bool()) // chip enable signal
//
// Interrupt signals (lines)
// Note: Only PL input signal is received here,
// a separate module will control the PS signal
//
val plInSignal = Input(Bool()) // PS to PL signal
//
// BRAM (Block RAM) ports
//
val rdWrAddr = Output(UInt(instanceInfo.bramAddrWidth.W)) // read/write address
val rdData = Input(UInt(instanceInfo.bramDataWidth.W)) // read data
//
// Receiving signals
//
val requestedActionOfThePacketOutput = Output(UInt(new DebuggerRemotePacket().RequestedActionOfThePacket.getWidth.W)) // the requested action
val requestedActionOfThePacketOutputValid = Output(Bool()) // whether data on the requested action is valid or not
val noNewDataReceiver = Input(Bool()) // receive done or not?
// this contains and edge-detection mechanism, which means reader should make it low after reading the data
val readNextData = Input(Bool()) // whether the next data should be read or not?
val dataValidOutput = Output(Bool()) // whether data on the receiving data line is valid or not?
val receivingData = Output(UInt(instanceInfo.bramDataWidth.W)) // data to be sent to the reader
val finishedReceivingBuffer = Output(Bool()) // Receiving is done or not?
})
//
// State registers
//
val state = RegInit(sIdle)
//
// Output pins
//
val rdWrAddr = WireInit(0.U(instanceInfo.bramAddrWidth.W))
val regRdWrAddr = RegInit(0.U(instanceInfo.bramAddrWidth.W))
val finishedReceivingBuffer = WireInit(false.B)
val regRequestedActionOfThePacketOutput = RegInit(0.U(new DebuggerRemotePacket().RequestedActionOfThePacket.getWidth.W))
val regRequestedActionOfThePacketOutputValid = RegInit(false.B)
val regDataValidOutput = RegInit(false.B)
val regReceivingData = RegInit(0.U(instanceInfo.bramDataWidth.W))
//
// Rising-edge detector for start receiving signal
//
val risingEdgePlInSignal = io.plInSignal & !RegNext(io.plInSignal)
//
// Rising-edge detector for reading next data signal
//
val risingEdgeReadNextData = io.readNextData & !RegNext(io.readNextData)
//
// Structure (as wire) of the received packet buffer
//
val receivedPacketBuffer = WireInit(0.U.asTypeOf(new DebuggerRemotePacket())) // here the wire is not used
//
// Apply the chip enable signal
//
when(io.en === true.B) {
switch(state) {
is(sIdle) {
//
// Create logs from communication structure offsets
//
LogInfo(debug)(f"The offset of Checksum is 0x${receivedPacketBuffer.Offset.checksum}%x")
LogInfo(debug)(f"The offset of Indicator is 0x${receivedPacketBuffer.Offset.indicator}%x")
LogInfo(debug)(f"The offset of TypeOfThePacket is 0x${receivedPacketBuffer.Offset.typeOfThePacket}%x")
LogInfo(debug)(f"The offset of requestedActionOfThePacketOutput is 0x${receivedPacketBuffer.Offset.requestedActionOfThePacket}%x")
//
// Check whether the interrupt from the PS is received or not
//
when(risingEdgePlInSignal === true.B) {
state := sReadChecksum
}
//
// Configure the output pins in case of sIdle
//
rdWrAddr := 0.U
regRequestedActionOfThePacketOutput := 0.U
regRequestedActionOfThePacketOutputValid := false.B
regDataValidOutput := false.B
regReceivingData := 0.U
finishedReceivingBuffer := false.B
}
is(sReadChecksum) {
//
// Adjust address to read Checksum from BRAM (Not Used)
//
rdWrAddr := (instanceInfo.debuggerAreaOffset + receivedPacketBuffer.Offset.checksum).U
//
// Goes to the next section
//
state := sReadIndicator
}
is(sReadIndicator) {
//
// Adjust address to read Indicator from BRAM
//
rdWrAddr := (instanceInfo.debuggerAreaOffset + receivedPacketBuffer.Offset.indicator).U
//
// Goes to the next section
//
state := sReadTypeOfThePacket
}
is(sReadTypeOfThePacket) {
//
// Adjust address to read TypeOfThePacket from BRAM
//
rdWrAddr := (instanceInfo.debuggerAreaOffset + receivedPacketBuffer.Offset.typeOfThePacket).U
//
// Check whether the indicator is valid or not
//
LogInfo(debug)(
f"Comparing first 0x${BitwiseFunction.getBitsInRange(HyperDbgSharedConstants.INDICATOR_OF_HYPERDBG_PACKET, 32, (32 + instanceInfo.bramDataWidth - 1))}%x number of the indicator (little-endian)"
)
when(
io.rdData === BitwiseFunction
.getBitsInRange(HyperDbgSharedConstants.INDICATOR_OF_HYPERDBG_PACKET, 32, (32 + instanceInfo.bramDataWidth - 1))
.U
) {
//
// Indicator of packet is valid
// (Goes to the next section)
//
state := sReadRequestedActionOfThePacket
}.otherwise {
//
// Indicator of packet is not valid
// (Receiving was done but not found a valid packet,
// so, go to the idle state)
//
state := sDone
}
}
is(sReadRequestedActionOfThePacket) {
//
// Adjust address to read RequestedActionOfThePacket from BRAM
//
rdWrAddr := (instanceInfo.debuggerAreaOffset + receivedPacketBuffer.Offset.requestedActionOfThePacket).U
//
// Save the address into a register
//
regRdWrAddr := (instanceInfo.debuggerAreaOffset + receivedPacketBuffer.Offset.requestedActionOfThePacket + (instanceInfo.bramDataWidth >> 3)).U
//
// Check whether the type of the packet is valid or not
//
val packetType: DebuggerRemotePacketType.Value = DebuggerRemotePacketType.DEBUGGER_TO_DEBUGGEE_HARDWARE_LEVEL
LogInfo(debug)(
f"Check packet type with DEBUGGER_TO_DEBUGGEE_HARDWARE_LEVEL (0x${packetType.id}%x)"
)
when(io.rdData === packetType.id.U) {
//
// Type of packet is valid
// (Goes to the next section)
//
state := sRequestedActionIsValid
}.otherwise {
//
// Type of packet is not valid
// (Receiving was done but not found a valid packet,
// so, go to the idle state)
//
state := sDone
}
}
is(sRequestedActionIsValid) {
//
// Read the RequestedActionOfThePacket
//
regRequestedActionOfThePacketOutput := io.rdData
//
// The RequestedActionOfThePacketOutput is valid from now
//
regRequestedActionOfThePacketOutputValid := true.B
//
// Goes to the next section
//
state := sWaitToReadActionBuffer
}
is(sWaitToReadActionBuffer) {
//
// The value of the received buffer is valid here, however,
// in order to make difference when a new value is read, the
// following signals goes to the off state
//
regDataValidOutput := false.B
//
// Check if the caller needs to read the next part of
// the block RAM or the receiving data should be finished
//
when(io.noNewDataReceiver === true.B) {
//
// No new data, the receiving is done
//
state := sDone
}.elsewhen(risingEdgeReadNextData === true.B) {
//
// Adjust address to read next data to BRAM
//
rdWrAddr := regRdWrAddr
regRdWrAddr := regRdWrAddr + (instanceInfo.bramDataWidth >> 3).U
//
// Read the next offset of the buffer
//
state := sReadActionBuffer
}.otherwise {
//
// Stay at the same state
//
state := sWaitToReadActionBuffer
}
}
is(sReadActionBuffer) {
//
// Data outputs are now valid
//
regDataValidOutput := true.B
//
// Adjust the read buffer data
//
regReceivingData := io.rdData
when(io.noNewDataReceiver === true.B) {
//
// No new data, the receiving is done
//
state := sDone
}.otherwise {
//
// Return to the previous state of action
//
state := sWaitToReadActionBuffer
}
}
is(sDone) {
//
// Reset the temporary address holder
//
regRdWrAddr := 0.U
//
// Requested action buffer and the receiving buffer is no longer valid
//
regRequestedActionOfThePacketOutput := 0.U
regRequestedActionOfThePacketOutputValid := false.B
regReceivingData := 0.U
regDataValidOutput := false.B
//
// The receiving is done at this stage, either
// was successful or unsuccessful, we'll release the
// sharing bram resource by indicating that the receiving
// module is no longer using the bram line
//
finishedReceivingBuffer := true.B
//
// Go to the idle state
//
state := sIdle
}
}
}
// ---------------------------------------------------------------------
//
// Connect output pins
//
io.rdWrAddr := rdWrAddr
io.requestedActionOfThePacketOutput := regRequestedActionOfThePacketOutput
io.requestedActionOfThePacketOutputValid := regRequestedActionOfThePacketOutputValid
io.dataValidOutput := regDataValidOutput
io.receivingData := regReceivingData
io.finishedReceivingBuffer := finishedReceivingBuffer
}
object DebuggerPacketReceiver {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
)(
en: Bool,
plInSignal: Bool,
rdData: UInt,
noNewDataReceiver: Bool,
readNextData: Bool
): (UInt, UInt, Bool, Bool, UInt, Bool) = {
val debuggerPacketReceiver = Module(
new DebuggerPacketReceiver(
debug,
instanceInfo
)
)
val rdWrAddr = Wire(UInt(instanceInfo.bramAddrWidth.W))
val requestedActionOfThePacketOutput = Wire(UInt(new DebuggerRemotePacket().RequestedActionOfThePacket.getWidth.W))
val requestedActionOfThePacketOutputValid = Wire(Bool())
val dataValidOutput = Wire(Bool())
val receivingData = Wire(UInt(instanceInfo.bramDataWidth.W))
val finishedReceivingBuffer = Wire(Bool())
//
// Configure the input signals
//
debuggerPacketReceiver.io.en := en
debuggerPacketReceiver.io.plInSignal := plInSignal
debuggerPacketReceiver.io.rdData := rdData
debuggerPacketReceiver.io.noNewDataReceiver := noNewDataReceiver
debuggerPacketReceiver.io.readNextData := readNextData
//
// Configure the output signals
//
rdWrAddr := debuggerPacketReceiver.io.rdWrAddr
//
// Configure the output signals related to received packets
//
requestedActionOfThePacketOutput := debuggerPacketReceiver.io.requestedActionOfThePacketOutput
requestedActionOfThePacketOutputValid := debuggerPacketReceiver.io.requestedActionOfThePacketOutputValid
dataValidOutput := debuggerPacketReceiver.io.dataValidOutput
receivingData := debuggerPacketReceiver.io.receivingData
finishedReceivingBuffer := debuggerPacketReceiver.io.finishedReceivingBuffer
//
// Return the output result
//
(
rdWrAddr,
requestedActionOfThePacketOutput,
requestedActionOfThePacketOutputValid,
dataValidOutput,
receivingData,
finishedReceivingBuffer
)
}
}

View file

@ -0,0 +1,383 @@
/**
* @file
* send_receive_synchronizer.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Send and receive synchronizer module
* @details
* @version 0.1
* @date
* 2024-04-17
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.communication
import chisel3._
import chisel3.util.{switch, is}
import circt.stage.ChiselStage
import hwdbg.configs._
import hwdbg.types._
object SendReceiveSynchronizerEnums {
object State extends ChiselEnum {
val sIdle, sReceiver, sSender = Value
}
}
class SendReceiveSynchronizer(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
) extends Module {
//
// Import state enum
//
import SendReceiveSynchronizerEnums.State
import SendReceiveSynchronizerEnums.State._
val io = IO(new Bundle {
//
// Chip signals
//
val en = Input(Bool()) // chip enable signal
//
// Interrupt signals (lines)
//
val plInSignal = Input(Bool()) // PS to PL signal
val psOutInterrupt = Output(Bool()) // PL to PS interrupt
//
// BRAM (Block RAM) ports
//
val rdWrAddr = Output(UInt(instanceInfo.bramAddrWidth.W)) // read/write address
val rdData = Input(UInt(instanceInfo.bramDataWidth.W)) // read data
val wrEna = Output(Bool()) // enable writing
val wrData = Output(UInt(instanceInfo.bramDataWidth.W)) // write data
//
// Receiver ports
//
val requestedActionOfThePacketOutput = Output(UInt(new DebuggerRemotePacket().RequestedActionOfThePacket.getWidth.W)) // the requested action
val requestedActionOfThePacketOutputValid = Output(Bool()) // whether data on the requested action is valid or not
val noNewDataReceiver = Input(Bool()) // receive done or not?
val readNextData = Input(Bool()) // whether the next data should be read or not?
val dataValidOutput = Output(Bool()) // whether data on the receiving data line is valid or not?
val receivingData = Output(UInt(instanceInfo.bramDataWidth.W)) // data to be sent to the reader
//
// Sender ports
//
val beginSendingBuffer = Input(Bool()) // should sender start sending buffers or not?
val noNewDataSender = Input(Bool()) // should sender finish sending buffers or not?
val dataValidInput = Input(Bool()) // should sender send next buffer or not?
val sendWaitForBuffer = Output(Bool()) // should the external module send next buffer or not?
val requestedActionOfThePacketInput = Input(UInt(new DebuggerRemotePacket().RequestedActionOfThePacket.getWidth.W)) // the requested action
val sendingData = Input(UInt(instanceInfo.bramDataWidth.W)) // data to be sent to the debugger
})
//
// State registers
//
val state = RegInit(sIdle)
//
// Saving state of the controlling pins
//
val regPlInSignal = RegInit(false.B)
val regBeginSendingBuffer = RegInit(false.B)
//
// Shared BRAM pins
//
val sharedRdWrAddr = WireInit(0.U(instanceInfo.bramAddrWidth.W)) // read/write address
val sharedRdData = WireInit(0.U(instanceInfo.bramDataWidth.W)) // read data
val sharedWrEna = WireInit(false.B) // enable writing
val sharedWrData = WireInit(0.U(instanceInfo.bramDataWidth.W)) // write data
//
// Instantiate the packet receiver module
//
val (
receiverRdWrAddr,
requestedActionOfThePacketOutput,
requestedActionOfThePacketOutputValid,
dataValidOutput,
receivingData,
finishedReceivingBuffer
) =
DebuggerPacketReceiver(
debug,
instanceInfo
)(
io.en,
regPlInSignal,
io.rdData,
io.noNewDataReceiver,
io.readNextData
)
//
// Instantiate the packet sender module
//
val (
psOutInterrupt,
senderRdWrAddr,
wrEna,
wrData,
sendWaitForBuffer,
finishedSendingBuffer
) =
DebuggerPacketSender(
debug,
instanceInfo
)(
io.en,
regBeginSendingBuffer,
io.noNewDataSender,
io.dataValidInput,
io.requestedActionOfThePacketInput,
io.sendingData
)
//
// Apply the chip enable signal
//
when(io.en === true.B) {
switch(state) {
is(sIdle) {
//
// Perform the resource separation of shared BRAM
// and apply priority to receive over send
//
when(io.plInSignal === true.B) {
//
// Activate the receiver module
//
regPlInSignal := true.B
//
// Go to the receiver state
//
state := sReceiver
}.elsewhen(io.beginSendingBuffer === true.B && io.plInSignal === false.B) {
//
// Activate the sender module
//
regBeginSendingBuffer := true.B
//
// Go to the sender state
//
state := sSender
}.otherwise {
//
// Stay at the same state as there is no communication
//
state := sIdle
}
}
is(sReceiver) {
//
// Check whether the receiving is finished
//
when(finishedReceivingBuffer === true.B) {
//
// No longer in the receiver state
//
regPlInSignal := false.B
//
// Go to the idle state
//
state := sIdle
}.otherwise {
//
// Connect the address of BRAM reader to the receiver address
//
sharedRdWrAddr := receiverRdWrAddr
//
// On the receiver, writing is not allowed
//
sharedWrEna := false.B
//
// Stay at the same state
//
state := sReceiver
}
}
is(sSender) {
//
// Check whether sending data is finished
//
when(finishedSendingBuffer === true.B) {
//
// No longer in the sender state
//
regBeginSendingBuffer := false.B
//
// Go to the idle state
//
state := sIdle
}.otherwise {
//
// Connect shared BRAM signals to the sender
//
sharedRdWrAddr := senderRdWrAddr
sharedWrEna := wrEna
sharedWrData := wrData
//
// Stay at the same state
//
state := sSender
}
}
}
}
// ---------------------------------------------------------------------
//
// Connect output pins (Interrupt)
//
io.psOutInterrupt := psOutInterrupt
//
// Connect output pins (BRAM)
//
io.rdWrAddr := sharedRdWrAddr
io.wrEna := wrEna
io.wrData := wrData
//
// Connect output pins (Receiver)
//
io.requestedActionOfThePacketOutput := requestedActionOfThePacketOutput
io.requestedActionOfThePacketOutputValid := requestedActionOfThePacketOutputValid
io.dataValidOutput := dataValidOutput
io.receivingData := receivingData
//
// Connect output pins (Sender)
//
io.sendWaitForBuffer := sendWaitForBuffer
}
object SendReceiveSynchronizer {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
)(
en: Bool,
plInSignal: Bool,
rdData: UInt,
noNewDataReceiver: Bool,
readNextData: Bool,
beginSendingBuffer: Bool,
noNewDataSender: Bool,
dataValidInput: Bool,
requestedActionOfThePacketInput: UInt,
sendingData: UInt
): (Bool, UInt, Bool, UInt, UInt, Bool, Bool, UInt, Bool) = {
val sendReceiveSynchronizerModule = Module(
new SendReceiveSynchronizer(
debug,
instanceInfo
)
)
val psOutInterrupt = Wire(Bool())
val rdWrAddr = Wire(UInt(instanceInfo.bramAddrWidth.W))
val wrEna = Wire(Bool())
val wrData = Wire(UInt(instanceInfo.bramDataWidth.W))
val requestedActionOfThePacketOutput = Wire(UInt(new DebuggerRemotePacket().RequestedActionOfThePacket.getWidth.W))
val requestedActionOfThePacketOutputValid = Wire(Bool())
val dataValidOutput = Wire(Bool())
val receivingData = Wire(UInt(instanceInfo.bramDataWidth.W))
val sendWaitForBuffer = Wire(Bool())
//
// Configure the input signals
//
sendReceiveSynchronizerModule.io.en := en
sendReceiveSynchronizerModule.io.plInSignal := plInSignal
sendReceiveSynchronizerModule.io.rdData := rdData
sendReceiveSynchronizerModule.io.noNewDataReceiver := noNewDataReceiver
sendReceiveSynchronizerModule.io.readNextData := readNextData
sendReceiveSynchronizerModule.io.beginSendingBuffer := beginSendingBuffer
sendReceiveSynchronizerModule.io.noNewDataSender := noNewDataSender
sendReceiveSynchronizerModule.io.dataValidInput := dataValidInput
sendReceiveSynchronizerModule.io.requestedActionOfThePacketInput := requestedActionOfThePacketInput
sendReceiveSynchronizerModule.io.sendingData := sendingData
//
// Configure the output signals
//
psOutInterrupt := sendReceiveSynchronizerModule.io.psOutInterrupt
rdWrAddr := sendReceiveSynchronizerModule.io.rdWrAddr
wrEna := sendReceiveSynchronizerModule.io.wrEna
wrData := sendReceiveSynchronizerModule.io.wrData
requestedActionOfThePacketOutput := sendReceiveSynchronizerModule.io.requestedActionOfThePacketOutput
requestedActionOfThePacketOutputValid := sendReceiveSynchronizerModule.io.requestedActionOfThePacketOutputValid
dataValidOutput := sendReceiveSynchronizerModule.io.dataValidOutput
receivingData := sendReceiveSynchronizerModule.io.receivingData
sendWaitForBuffer := sendReceiveSynchronizerModule.io.sendWaitForBuffer
//
// Return the output result
//
(
psOutInterrupt,
rdWrAddr,
wrEna,
wrData,
requestedActionOfThePacketOutput,
requestedActionOfThePacketOutputValid,
dataValidOutput,
receivingData,
sendWaitForBuffer
)
}
}

View file

@ -0,0 +1,494 @@
/**
* @file
* sender.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Remote debugger packet sender module
* @details
* @version 0.1
* @date
* 2024-04-16
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.communication
import chisel3._
import chisel3.util.{switch, is, log2Ceil}
import circt.stage.ChiselStage
import hwdbg.configs._
import hwdbg.types._
import hwdbg.constants._
object DebuggerPacketSenderEnums {
object State extends ChiselEnum {
val sIdle, sWriteChecksum, sWriteIndicator, sWriteTypeOfThePacket, sWriteRequestedActionOfThePacket, sWaitToGetData, sSendData, sDone = Value
}
}
class DebuggerPacketSender(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
) extends Module {
//
// Import state enum
//
import DebuggerPacketSenderEnums.State
import DebuggerPacketSenderEnums.State._
val io = IO(new Bundle {
//
// Chip signals
//
val en = Input(Bool()) // chip enable signal
//
// Interrupt signals (lines)
// Note: Only PS output signal is exported here,
// a separate module will control the PL signal
//
val psOutInterrupt = Output(Bool()) // PL to PS interrupt
//
// BRAM (Block RAM) ports
//
val rdWrAddr = Output(UInt(instanceInfo.bramAddrWidth.W)) // read/write address
val wrEna = Output(Bool()) // enable writing
val wrData = Output(UInt(instanceInfo.bramDataWidth.W)) // write data
//
// Sending signals
//
val beginSendingBuffer = Input(Bool()) // should sender start sending buffers or not?
val noNewDataSender = Input(Bool()) // should sender finish sending buffers or not?
val dataValidInput = Input(Bool()) // should sender send next buffer or not?
val sendWaitForBuffer = Output(Bool()) // should the external module send next buffer or not?
val finishedSendingBuffer = Output(Bool()) // indicate that the sender finished sending buffers and ready to send next packet
val requestedActionOfThePacketInput = Input(UInt(new DebuggerRemotePacket().RequestedActionOfThePacket.getWidth.W)) // the requested action
val sendingData = Input(UInt(instanceInfo.bramDataWidth.W)) // data to be sent to the debugger
})
//
// State registers
//
val state = RegInit(sIdle)
//
// Output pins
//
val psOutInterrupt = WireInit(false.B)
val wrEna = WireInit(false.B)
val wrData = WireInit(0.U(instanceInfo.bramDataWidth.W))
val sendWaitForBuffer = WireInit(false.B)
val finishedSendingBuffer = WireInit(false.B)
val rdWrAddr = WireInit(0.U(instanceInfo.bramAddrWidth.W))
//
// Temporary address and data holder (register)
//
val regRdWrAddr = RegInit(0.U(instanceInfo.bramAddrWidth.W))
val regDataToSend = RegInit(0.U(instanceInfo.bramDataWidth.W))
//
// Rising-edge detector for start sending signal
//
val risingEdgeBeginSendingBuffer = io.beginSendingBuffer & !RegNext(io.beginSendingBuffer)
//
// Keeping the state of whether sending data has been started or not
// Means that if the sender is in the middle of sending the headers
// of the packet or the actual data
//
val regIsSendingDataStarted = RegInit(false.B)
//
// Used to hold the transferred length of the indicator
//
val lengthOfIndicator: Int = new DebuggerRemotePacket().Indicator.getWidth
val regTransferredIndicatorLength = RegInit(0.U((log2Ceil(lengthOfIndicator) + 1).W))
//
// Structure (as wire) of the received packet buffer
//
val sendingPacketBuffer = WireInit(0.U.asTypeOf(new DebuggerRemotePacket()))
//
// Apply the chip enable signal
//
when(io.en === true.B) {
switch(state) {
is(sIdle) {
//
// Check whether the interrupt from the PS is received or not
//
when(risingEdgeBeginSendingBuffer === true.B) {
state := sWriteChecksum
}
//
// Configure the outputs in case of sIdle
//
psOutInterrupt := false.B
rdWrAddr := 0.U
regRdWrAddr := 0.U
wrEna := false.B
wrData := 0.U
sendWaitForBuffer := false.B
finishedSendingBuffer := false.B
//
// Sending data has not been started
//
regIsSendingDataStarted := false.B
}
is(sWriteChecksum) {
//
// Enable writing to the BRAM
//
wrEna := true.B
//
// Adjust address to write Checksum to BRAM (Not Used)
//
rdWrAddr := (instanceInfo.debuggeeAreaOffset + sendingPacketBuffer.Offset.checksum).U
//
// Adjust data to write Checksum
//
wrData := 0.U // Checksum is ignored
//
// Reset the transferred bytes of the indicator
//
regTransferredIndicatorLength := 0.U
//
// Goes to the next section
//
state := sWriteIndicator
}
is(sWriteIndicator) {
if (instanceInfo.bramDataWidth >= lengthOfIndicator) {
//
// Enable writing to the BRAM
//
wrEna := true.B
//
// Adjust address to write Indicator to BRAM
//
rdWrAddr := (instanceInfo.debuggeeAreaOffset + sendingPacketBuffer.Offset.indicator).U
//
// Adjust data to write Indicator
//
wrData := HyperDbgSharedConstants.INDICATOR_OF_HYPERDBG_PACKET.U
//
// Goes to the next section
//
state := sWriteTypeOfThePacket
} else {
//
// Enable writing to the BRAM
//
wrEna := true.B
//
// Adjust address to write Indicator to BRAM (Address granularity is in the byte format so,
// it'll be divided by 8 or shift to right by 3)
//
rdWrAddr := (instanceInfo.debuggeeAreaOffset + sendingPacketBuffer.Offset.indicator).U + (regTransferredIndicatorLength >> 3)
//
// Adjust data to write Indicator
//
wrData := HyperDbgSharedConstants.INDICATOR_OF_HYPERDBG_PACKET.U >> regTransferredIndicatorLength
//
// Add to the transferred length
//
regTransferredIndicatorLength := regTransferredIndicatorLength + instanceInfo.bramDataWidth.U
when(regTransferredIndicatorLength >= lengthOfIndicator.U) {
//
// Disable writing to the BRAM
//
wrEna := false.B
//
// Goes to the next section
//
state := sWriteTypeOfThePacket
}.otherwise {
//
// Stay at the same state
//
state := sWriteIndicator
}
}
}
is(sWriteTypeOfThePacket) {
//
// Enable writing to the BRAM
//
wrEna := true.B
//
// Adjust address to write type of packet to BRAM
//
rdWrAddr := (instanceInfo.debuggeeAreaOffset + sendingPacketBuffer.Offset.typeOfThePacket).U
//
// Adjust data to write type of packet
//
val packetType: DebuggerRemotePacketType.Value = DebuggerRemotePacketType.DEBUGGEE_TO_DEBUGGER_HARDWARE_LEVEL
wrData := packetType.id.U
//
// Goes to the next section
//
state := sWriteRequestedActionOfThePacket
}
is(sWriteRequestedActionOfThePacket) {
//
// Enable writing to the BRAM
//
wrEna := true.B
//
// Adjust address to write requested action of packet to BRAM
//
rdWrAddr := (instanceInfo.debuggeeAreaOffset + sendingPacketBuffer.Offset.requestedActionOfThePacket).U
//
// Adjust data to write requested action of packet
//
wrData := io.requestedActionOfThePacketInput
//
// Goes to the next section
//
state := sWaitToGetData
}
is(sWaitToGetData) {
//
// Disable writing to the BRAM
//
wrEna := false.B
//
// Indicate that the module is waiting for data
//
sendWaitForBuffer := true.B
//
// Check whether sending actual data already started or not
//
when(regIsSendingDataStarted === false.B) {
//
// It's not yet started, so we adjust the address to the start
// of the buffer after the last field of the header
//
regRdWrAddr := (instanceInfo.debuggeeAreaOffset + sendingPacketBuffer.Offset.startOfDataBuffer).U
//
// Indicate that sending data already started
//
regIsSendingDataStarted := true.B
}
//
// Wait to receive the data or check whether sending was done at this state
// (Two states will go us to the 'done' state)
//
when(io.noNewDataSender === true.B) {
//
// Sending data was done
//
state := sDone
}.elsewhen(io.dataValidInput === true.B) {
//
// Store the data to send in a register
//
regDataToSend := io.sendingData
//
// The data is valid, so let's send it
//
state := sSendData
}.otherwise {
//
// Stay in the same state as the data is not ready (valid)
//
state := sWaitToGetData
}
}
is(sSendData) {
//
// Not waiting for the buffer at this state
//
sendWaitForBuffer := false.B
//
// Enable writing to the BRAM
//
wrEna := true.B
//
// Adjust address to write next data to BRAM (Address granularity is in the byte format so,
// it'll be divided by 8 or shift to right by 3)
//
rdWrAddr := regRdWrAddr
regRdWrAddr := regRdWrAddr + (instanceInfo.bramDataWidth >> 3).U
//
// Adjust data to write as the sending data
//
wrData := regDataToSend
//
// Check whether sending was done at this state (Two states will go us to the 'done' state)
//
when(io.noNewDataSender === true.B) {
//
// Sending data was done
//
state := sDone
}.otherwise {
//
// Again go to the state for waiting for new data
//
state := sWaitToGetData
}
}
is(sDone) {
//
// Adjust the output bits
//
finishedSendingBuffer := true.B
//
// Interrupt the PS
//
psOutInterrupt := true.B
//
// Go to the idle state
//
state := sIdle
}
}
}
// ---------------------------------------------------------------------
//
// Connect output pins to internal registers
//
io.psOutInterrupt := psOutInterrupt
io.rdWrAddr := rdWrAddr
io.wrEna := wrEna
io.wrData := wrData
io.sendWaitForBuffer := sendWaitForBuffer
io.finishedSendingBuffer := finishedSendingBuffer
}
object DebuggerPacketSender {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
)(
en: Bool,
beginSendingBuffer: Bool,
noNewDataSender: Bool,
dataValidInput: Bool,
requestedActionOfThePacketInput: UInt,
sendingData: UInt
): (Bool, UInt, Bool, UInt, Bool, Bool) = {
val debuggerPacketSender = Module(
new DebuggerPacketSender(
debug,
instanceInfo
)
)
val psOutInterrupt = Wire(Bool())
val rdWrAddr = Wire(UInt(instanceInfo.bramAddrWidth.W))
val wrEna = Wire(Bool())
val wrData = Wire(UInt(instanceInfo.bramDataWidth.W))
val sendWaitForBuffer = Wire(Bool())
val finishedSendingBuffer = Wire(Bool())
//
// Configure the input signals
//
debuggerPacketSender.io.en := en
debuggerPacketSender.io.beginSendingBuffer := beginSendingBuffer
debuggerPacketSender.io.noNewDataSender := noNewDataSender
debuggerPacketSender.io.dataValidInput := dataValidInput
debuggerPacketSender.io.requestedActionOfThePacketInput := requestedActionOfThePacketInput
debuggerPacketSender.io.sendingData := sendingData
//
// Configure the output signals
//
psOutInterrupt := debuggerPacketSender.io.psOutInterrupt
rdWrAddr := debuggerPacketSender.io.rdWrAddr
wrEna := debuggerPacketSender.io.wrEna
wrData := debuggerPacketSender.io.wrData
//
// Configure the output signals related to sending packets
//
sendWaitForBuffer := debuggerPacketSender.io.sendWaitForBuffer
finishedSendingBuffer := debuggerPacketSender.io.finishedSendingBuffer
//
// Return the output result
//
(psOutInterrupt, rdWrAddr, wrEna, wrData, sendWaitForBuffer, finishedSendingBuffer)
}
}

View file

@ -0,0 +1,52 @@
{
"Version": {
"VERSION_MAJOR": 0,
"VERSION_MINOR": 2,
"VERSION_PATCH": 0
},
"DebuggerConfigurations": {
"ENABLE_DEBUG": true,
"NUMBER_OF_PINS": 32,
"PORT_PINS_MAP": [12, 20]
},
"ScriptEngineConfigurations": {
"MAXIMUM_NUMBER_OF_STAGES": 32,
"MAXIMUM_NUMBER_OF_SUPPORTED_GET_SCRIPT_OPERATORS": 2,
"MAXIMUM_NUMBER_OF_SUPPORTED_SET_SCRIPT_OPERATORS": 1,
"SCRIPT_VARIABLE_LENGTH": 8,
"NUMBER_OF_SUPPORTED_LOCAL_AND_GLOBAL_VARIABLES": 2,
"NUMBER_OF_SUPPORTED_TEMPORARY_VARIABLES": 2,
"SCRIPT_ENGINE_EVAL_CAPABILITIES": [
"assign_local_global_var",
"assign_registers",
"conditional_statements_and_comparison_operators",
"stack_assignments",
"func_or",
"func_xor",
"func_and",
"func_asl",
"func_add",
"func_sub",
"func_mul",
"func_gt",
"func_lt",
"func_egt",
"func_elt",
"func_equal",
"func_neq",
"func_jmp",
"func_jz",
"func_jnz",
"func_mov"
]
},
"MemoryCommunicationConfigurations": {
"BLOCK_RAM_ADDR_WIDTH": 13,
"BLOCK_RAM_DATA_WIDTH": 32,
"ENABLE_BLOCK_RAM_DELAY": true,
"DEFAULT_CONFIGURATION_INITIALIZED_MEMORY_SIZE": 1024,
"BASE_ADDRESS_OF_PS_TO_PL_COMMUNICATION": 0,
"BASE_ADDRESS_OF_PL_TO_PS_COMMUNICATION": 512
}
}

View file

@ -0,0 +1,500 @@
/**
* @file
* configs.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Configuration files
* @details
* @version 0.1
* @date
* 2024-04-03
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.configs
import io.circe._
import io.circe.parser._
import io.circe.generic.auto._
import scala.io.Source
import chisel3._
import chisel3.util._
import hwdbg.utils._
/**
* @brief
* Version of hwdbg (Definition and Default Values)
* @warning
* will be checked with HyperDbg
*/
object Version {
//
// Constant version info
//
var VERSION_MAJOR: Int = 0
var VERSION_MINOR: Int = 1
var VERSION_PATCH: Int = 0
def getEncodedVersion: Int = {
(VERSION_MAJOR << 16) | (VERSION_MINOR << 8) | VERSION_PATCH
}
def extractMajor(encodedVersion: Int): Int = {
encodedVersion >> 16
}
def extractMinor(encodedVersion: Int): Int = {
(encodedVersion >> 8) & 0xff // Masking to get only the 8 bits
}
def extractPatch(encodedVersion: Int): Int = {
encodedVersion & 0xff // Masking to get only the 8 bits
}
}
/**
* @brief
* Design constants (Definition and Default Values)
*/
object DebuggerConfigurations {
//
// whether to enable debug or not
//
var ENABLE_DEBUG: Boolean = true
//
// Number of input/output pins
//
var NUMBER_OF_PINS: Int = 32
//
// The configuration of ports and pins
//
// The following constant shows the key value object of the mappings
// of pins to ports (used for inputs/outputs)
// For example,
// port 0 (in) -> contains 12 pins
// port 1 (in) -> contains 20 pins
//
// var PORT_PINS_MAP: Array[Int] = Array(12, 18, 2)
// var PORT_PINS_MAP: Array[Int] = Array(12, 10, 5, 3, 2)
var PORT_PINS_MAP: Array[Int] = Array(12, 20)
}
/**
* @brief
* Design constants for script engine (Definition and Default Values)
*/
object ScriptEngineConfigurations {
//
// Maximum number of stages
//
var MAXIMUM_NUMBER_OF_STAGES: Int = 32
//
// Maximum number of stages
//
var MAXIMUM_NUMBER_OF_SUPPORTED_GET_SCRIPT_OPERATORS: Int = 2 // for get values
//
// Maximum number of stages
//
var MAXIMUM_NUMBER_OF_SUPPORTED_SET_SCRIPT_OPERATORS: Int = 1 // for get value
//
// Script variable length
//
var SCRIPT_VARIABLE_LENGTH: Int = 8
//
// Number supported of local and global variables
//
var NUMBER_OF_SUPPORTED_LOCAL_AND_GLOBAL_VARIABLES: Int = 2
//
// Number supported of temporary variables
//
var NUMBER_OF_SUPPORTED_TEMPORARY_VARIABLES: Int = 2
//
// Define the capabilities you want to enable
//
var SCRIPT_ENGINE_EVAL_CAPABILITIES = Seq(
//
// Statements and expressions
//
HwdbgScriptCapabilities.assign_local_global_var,
HwdbgScriptCapabilities.assign_registers,
// HwdbgScriptCapabilities.assign_pseudo_registers,
HwdbgScriptCapabilities.conditional_statements_and_comparison_operators,
HwdbgScriptCapabilities.stack_assignments,
//
// Operators
//
HwdbgScriptCapabilities.func_or,
HwdbgScriptCapabilities.func_xor,
HwdbgScriptCapabilities.func_and,
HwdbgScriptCapabilities.func_asl,
HwdbgScriptCapabilities.func_add,
HwdbgScriptCapabilities.func_sub,
HwdbgScriptCapabilities.func_mul,
// HwdbgScriptCapabilities.func_div,
// HwdbgScriptCapabilities.func_mod,
HwdbgScriptCapabilities.func_gt,
HwdbgScriptCapabilities.func_lt,
HwdbgScriptCapabilities.func_egt,
HwdbgScriptCapabilities.func_elt,
HwdbgScriptCapabilities.func_equal,
HwdbgScriptCapabilities.func_neq,
HwdbgScriptCapabilities.func_jmp,
HwdbgScriptCapabilities.func_jz,
HwdbgScriptCapabilities.func_jnz,
HwdbgScriptCapabilities.func_mov
// HwdbgScriptCapabilities.func_printf,
)
}
/**
* @brief
* The constants for memory communication (Definition and Default Values)
*/
object MemoryCommunicationConfigurations {
//
// Address width of the Block RAM (BRAM)
//
var BLOCK_RAM_ADDR_WIDTH: Int = 13
//
// Data width of the Block RAM (BRAM)
//
var BLOCK_RAM_DATA_WIDTH: Int = 32
//
// Emulate block RAM by inferring a register to delay one clock cycle
//
var ENABLE_BLOCK_RAM_DELAY: Boolean = true
//
// Default number of bytes used in initialized SRAM memory
//
var DEFAULT_CONFIGURATION_INITIALIZED_MEMORY_SIZE: Int = 8192 / 8 // 8 Kilobits
//
// Base address of PS to PL SRAM communication memory
//
var BASE_ADDRESS_OF_PS_TO_PL_COMMUNICATION: Int = 0
//
// Base address of PL to PS SRAM communication memory
//
var BASE_ADDRESS_OF_PL_TO_PS_COMMUNICATION: Int = DEFAULT_CONFIGURATION_INITIALIZED_MEMORY_SIZE / 2
}
/**
* @brief
* The structure of script capabilities information in hwdbg
* @details
* Same as _HWDBG_INSTANCE_INFORMATION in HyperDbg
*/
case class HwdbgInstanceInformation(
version: Int, // Target version of HyperDbg (same as hwdbg)
maximumNumberOfStages: Int, // Number of stages that this instance of hwdbg supports (NumberOfSupportedStages == 0 means script engine is disabled)
scriptVariableLength: Int, // Maximum length of variables (and other script elements)
numberOfSupportedLocalAndGlobalVariables: Int, // Number of supported local (and global) variables
numberOfSupportedTemporaryVariables: Int, // Number of supported temporary variables
maximumNumberOfSupportedGetScriptOperators: Int, // Maximum supported GET operators in a single func
maximumNumberOfSupportedSetScriptOperators: Int, // Maximum supported SET operators in a single func
sharedMemorySize: Int, // Size of shared memory
debuggerAreaOffset: Int, // The memory offset of debugger
debuggeeAreaOffset: Int, // The memory offset of debuggee
numberOfPins: Int, // Number of pins
numberOfPorts: Int, // Number of ports
scriptCapabilities: Long, // Capabilities bitmask
bramAddrWidth: Int, // BRAM address width
bramDataWidth: Int, // BRAM data width
portsConfiguration: Array[Int] // Port arrangement
)
/**
* @brief
* The script engine capabilities (Definition and Default Values)
*/
object HwdbgScriptCapabilities {
//
// Statements and expressions
//
val assign_local_global_var: Long = 1L << 0
val assign_registers: Long = 1L << 1
val assign_pseudo_registers: Long = 1L << 2
val conditional_statements_and_comparison_operators: Long = 1L << 3
val stack_assignments: Long = 1L << 4
//
// Operators
//
val func_or: Long = 1L << 5
val func_xor: Long = 1L << 6
val func_and: Long = 1L << 7
val func_asr: Long = 1L << 8
val func_asl: Long = 1L << 9
val func_add: Long = 1L << 10
val func_sub: Long = 1L << 11
val func_mul: Long = 1L << 12
val func_div: Long = 1L << 13
val func_mod: Long = 1L << 14
val func_gt: Long = 1L << 15
val func_lt: Long = 1L << 16
val func_egt: Long = 1L << 17
val func_elt: Long = 1L << 18
val func_equal: Long = 1L << 19
val func_neq: Long = 1L << 20
val func_jmp: Long = 1L << 21
val func_jz: Long = 1L << 22
val func_jnz: Long = 1L << 23
val func_mov: Long = 1L << 24
val func_printf: Long = 1L << 25
def allCapabilities: Seq[Long] = Seq(
assign_local_global_var,
assign_registers,
assign_pseudo_registers,
conditional_statements_and_comparison_operators,
stack_assignments,
func_or,
func_xor,
func_and,
func_asr,
func_asl,
func_add,
func_sub,
func_mul,
func_div,
func_mod,
func_gt,
func_lt,
func_egt,
func_elt,
func_equal,
func_neq,
func_jmp,
func_jz,
func_jnz,
func_mov,
func_printf
)
//
// Utility method to create a bitmask from a sequence of capabilities
//
def createCapabilitiesMask(capabilities: Seq[Long]): Long = {
capabilities.foldLeft(0L)(_ | _)
}
//
// Function to check if a capability is supported
//
def isCapabilitySupported(supportedCapabilities: Long, capability: Long): Boolean = {
(supportedCapabilities & capability) != 0
}
}
object HwdbgInstanceInformation {
//
// Function to create an instance of HwdbgInstanceInformation
//
def createInstanceInformation(
version: Int,
maximumNumberOfStages: Int,
scriptVariableLength: Int,
numberOfSupportedLocalAndGlobalVariables: Int,
numberOfSupportedTemporaryVariables: Int,
maximumNumberOfSupportedGetScriptOperators: Int,
maximumNumberOfSupportedSetScriptOperators: Int,
sharedMemorySize: Int,
debuggerAreaOffset: Int,
debuggeeAreaOffset: Int,
numberOfPins: Int,
numberOfPorts: Int,
enabledCapabilities: Seq[Long],
bramAddrWidth: Int,
bramDataWidth: Int,
portsConfiguration: Array[Int]
): HwdbgInstanceInformation = {
val capabilitiesMask = HwdbgScriptCapabilities.createCapabilitiesMask(enabledCapabilities)
//
// Printing the versioning info
//
LogInfo(true)("=======================================================================")
LogInfo(true)(
s"Generating code for hwdbg v${Version.extractMajor(version)}.${Version.extractMinor(version)}.${Version.extractPatch(version)} ($version)"
)
LogInfo(true)("Please visit https://hwdbg.hyperdbg.org/docs for more information...")
LogInfo(true)("hwdbg is released under the GNU Public License v3 (GPLv3).")
LogInfo(true)("=======================================================================")
HwdbgInstanceInformation(
version = version,
maximumNumberOfStages = maximumNumberOfStages,
scriptVariableLength = scriptVariableLength,
numberOfSupportedLocalAndGlobalVariables = numberOfSupportedLocalAndGlobalVariables,
numberOfSupportedTemporaryVariables = numberOfSupportedTemporaryVariables,
maximumNumberOfSupportedGetScriptOperators = maximumNumberOfSupportedGetScriptOperators,
maximumNumberOfSupportedSetScriptOperators = maximumNumberOfSupportedSetScriptOperators,
sharedMemorySize = sharedMemorySize,
debuggerAreaOffset = debuggerAreaOffset,
debuggeeAreaOffset = debuggeeAreaOffset,
numberOfPins = numberOfPins,
numberOfPorts = numberOfPorts,
scriptCapabilities = capabilitiesMask,
bramAddrWidth = bramAddrWidth,
bramDataWidth = bramDataWidth,
portsConfiguration = portsConfiguration
)
}
}
object ConfigLoader {
//
// Case classes for each configuration section
//
case class VersionConfig(
VERSION_MAJOR: Int,
VERSION_MINOR: Int,
VERSION_PATCH: Int
)
case class DebuggerConfigurationsConfig(
ENABLE_DEBUG: Boolean,
NUMBER_OF_PINS: Int,
PORT_PINS_MAP: Array[Int]
)
case class ScriptEngineConfigurationsConfig(
MAXIMUM_NUMBER_OF_STAGES: Int,
MAXIMUM_NUMBER_OF_SUPPORTED_GET_SCRIPT_OPERATORS: Int,
MAXIMUM_NUMBER_OF_SUPPORTED_SET_SCRIPT_OPERATORS: Int,
SCRIPT_VARIABLE_LENGTH: Int,
NUMBER_OF_SUPPORTED_LOCAL_AND_GLOBAL_VARIABLES: Int,
NUMBER_OF_SUPPORTED_TEMPORARY_VARIABLES: Int,
SCRIPT_ENGINE_EVAL_CAPABILITIES: Seq[String]
)
case class MemoryCommunicationConfigurationsConfig(
BLOCK_RAM_ADDR_WIDTH: Int,
BLOCK_RAM_DATA_WIDTH: Int,
ENABLE_BLOCK_RAM_DELAY: Boolean,
DEFAULT_CONFIGURATION_INITIALIZED_MEMORY_SIZE: Int,
BASE_ADDRESS_OF_PS_TO_PL_COMMUNICATION: Int,
BASE_ADDRESS_OF_PL_TO_PS_COMMUNICATION: Int
)
case class FullConfig(
Version: VersionConfig,
DebuggerConfigurations: DebuggerConfigurationsConfig,
ScriptEngineConfigurations: ScriptEngineConfigurationsConfig,
MemoryCommunicationConfigurations: MemoryCommunicationConfigurationsConfig
)
//
// Function to load configuration from a JSON file
//
def loadConfig(filePath: String): Option[FullConfig] = {
val source = Source.fromFile(filePath)
val jsonString = try source.getLines().mkString("\n") finally source.close()
decode[FullConfig](jsonString) match {
case Right(config) => Some(config)
case Left(error) =>
println(s"Failed to parse JSON configuration: $error")
None
}
}
}
object LoadConfiguration {
def loadFromJson(configPath: String): Unit = {
val configOpt = ConfigLoader.loadConfig(configPath)
configOpt.foreach { config =>
//
// *** Set the values in the respective objects ***
//
//
// Read the version
//
Version.VERSION_MAJOR = config.Version.VERSION_MAJOR
Version.VERSION_MINOR = config.Version.VERSION_MINOR
Version.VERSION_PATCH = config.Version.VERSION_PATCH
//
// Read the debugger configurations
//
DebuggerConfigurations.ENABLE_DEBUG = config.DebuggerConfigurations.ENABLE_DEBUG
DebuggerConfigurations.NUMBER_OF_PINS = config.DebuggerConfigurations.NUMBER_OF_PINS
DebuggerConfigurations.PORT_PINS_MAP = config.DebuggerConfigurations.PORT_PINS_MAP
//
// Read the script engine configurations
//
ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_STAGES = config.ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_STAGES
ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_GET_SCRIPT_OPERATORS = config.ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_GET_SCRIPT_OPERATORS
ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_SET_SCRIPT_OPERATORS = config.ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_SET_SCRIPT_OPERATORS
ScriptEngineConfigurations.SCRIPT_VARIABLE_LENGTH = config.ScriptEngineConfigurations.SCRIPT_VARIABLE_LENGTH
ScriptEngineConfigurations.NUMBER_OF_SUPPORTED_LOCAL_AND_GLOBAL_VARIABLES = config.ScriptEngineConfigurations.NUMBER_OF_SUPPORTED_LOCAL_AND_GLOBAL_VARIABLES
ScriptEngineConfigurations.NUMBER_OF_SUPPORTED_TEMPORARY_VARIABLES = config.ScriptEngineConfigurations.NUMBER_OF_SUPPORTED_TEMPORARY_VARIABLES
//
// Convert string capability names to the corresponding values in HwdbgScriptCapabilities
//
ScriptEngineConfigurations.SCRIPT_ENGINE_EVAL_CAPABILITIES = config.ScriptEngineConfigurations.SCRIPT_ENGINE_EVAL_CAPABILITIES.flatMap {
case "assign_local_global_var" => Some(HwdbgScriptCapabilities.assign_local_global_var)
case "assign_registers" => Some(HwdbgScriptCapabilities.assign_registers)
case "conditional_statements_and_comparison_operators" => Some(HwdbgScriptCapabilities.conditional_statements_and_comparison_operators)
case "stack_assignments" => Some(HwdbgScriptCapabilities.stack_assignments)
case "func_or" => Some(HwdbgScriptCapabilities.func_or)
case "func_xor" => Some(HwdbgScriptCapabilities.func_xor)
case "func_and" => Some(HwdbgScriptCapabilities.func_and)
case "func_asl" => Some(HwdbgScriptCapabilities.func_asl)
case "func_add" => Some(HwdbgScriptCapabilities.func_add)
case "func_sub" => Some(HwdbgScriptCapabilities.func_sub)
case "func_mul" => Some(HwdbgScriptCapabilities.func_mul)
case "func_gt" => Some(HwdbgScriptCapabilities.func_gt)
case "func_lt" => Some(HwdbgScriptCapabilities.func_lt)
case "func_egt" => Some(HwdbgScriptCapabilities.func_egt)
case "func_elt" => Some(HwdbgScriptCapabilities.func_elt)
case "func_equal" => Some(HwdbgScriptCapabilities.func_equal)
case "func_neq" => Some(HwdbgScriptCapabilities.func_neq)
case "func_jmp" => Some(HwdbgScriptCapabilities.func_jmp)
case "func_jz" => Some(HwdbgScriptCapabilities.func_jz)
case "func_jnz" => Some(HwdbgScriptCapabilities.func_jnz)
case "func_mov" => Some(HwdbgScriptCapabilities.func_mov)
case _ => None
}
//
// Read memory communication configurations
//
MemoryCommunicationConfigurations.BLOCK_RAM_ADDR_WIDTH = config.MemoryCommunicationConfigurations.BLOCK_RAM_ADDR_WIDTH
MemoryCommunicationConfigurations.BLOCK_RAM_DATA_WIDTH = config.MemoryCommunicationConfigurations.BLOCK_RAM_DATA_WIDTH
MemoryCommunicationConfigurations.ENABLE_BLOCK_RAM_DELAY = config.MemoryCommunicationConfigurations.ENABLE_BLOCK_RAM_DELAY
MemoryCommunicationConfigurations.DEFAULT_CONFIGURATION_INITIALIZED_MEMORY_SIZE = config.MemoryCommunicationConfigurations.DEFAULT_CONFIGURATION_INITIALIZED_MEMORY_SIZE
MemoryCommunicationConfigurations.BASE_ADDRESS_OF_PS_TO_PL_COMMUNICATION = config.MemoryCommunicationConfigurations.BASE_ADDRESS_OF_PS_TO_PL_COMMUNICATION
MemoryCommunicationConfigurations.BASE_ADDRESS_OF_PL_TO_PS_COMMUNICATION = config.MemoryCommunicationConfigurations.BASE_ADDRESS_OF_PL_TO_PS_COMMUNICATION
}
}
}

View file

@ -0,0 +1,68 @@
/**
* @file
* constants.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Constant values
* @details
* @version 0.1
* @date
* 2024-04-16
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.constants
import chisel3._
import chisel3.util._
/**
* @brief
* Shared value with HyperDbg
* @warning
* used in HyperDbg
*/
object HyperDbgSharedConstants {
//
// Constant indicator of a HyperDbg packet
//
val INDICATOR_OF_HYPERDBG_PACKET: Long = 0x4859504552444247L // HYPERDBG = 0x4859504552444247
}
/**
* @brief
* Enumeration for different packet types in HyperDbg packets (DEBUGGER_REMOTE_PACKET_TYPE)
* @warning
* Used in HyperDbg
*/
object DebuggerRemotePacketType extends Enumeration {
//
// Debugger to debuggee (vmx-root)
//
val DEBUGGER_TO_DEBUGGEE_EXECUTE_ON_VMX_ROOT = Value(1)
//
// Debugger to debuggee (user-mode)
//
val DEBUGGER_TO_DEBUGGEE_EXECUTE_ON_USER_MODE = Value(2)
//
// Debuggee to debugger (user-mode and kernel-mode, vmx-root mode)
//
val DEBUGGEE_TO_DEBUGGER = Value(3)
//
// Debugger to debuggee (hardware), used in hwdbg
//
val DEBUGGER_TO_DEBUGGEE_HARDWARE_LEVEL = Value(4)
//
// Debuggee to debugger (hardware), used in hwdbg
//
val DEBUGGEE_TO_DEBUGGER_HARDWARE_LEVEL = Value(5)
}

View file

@ -0,0 +1,36 @@
/**
* @file
* configs.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Configuration files for testing hwdbg
* @details
* @version 0.1
* @date
* 2024-04-15
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.configs
import chisel3._
import chisel3.util._
/**
* @brief
* The configuration constants for testing
*/
object TestingConfigurations {
// val BRAM_INITIALIZATION_FILE_PATH: String = "./src/test/bram/instance_info.hex.txt"
val BRAM_INITIALIZATION_FILE_PATH: String = "./src/test/bram/script_buffer.hex.txt"
// val BRAM_INITIALIZATION_FILE_PATH: String = "./src/test/bram/script_conditional_statements_pins.hex.txt"
// val BRAM_INITIALIZATION_FILE_PATH: String = "./src/test/bram/script_simple_pin_assignments.hex.txt"
// val BRAM_INITIALIZATION_FILE_PATH: String = "./src/test/bram/script_simple_port_assignments.hex.txt"
// val BRAM_INITIALIZATION_FILE_PATH: String = "./src/test/bram/script_conditional_statements_ports.hex.txt"
// val BRAM_INITIALIZATION_FILE_PATH: String = "./src/test/bram/script_conditional_statements_ports_with_port_assignments.hex.txt"
// val BRAM_INITIALIZATION_FILE_PATH: String = "./src/test/bram/script_conditional_statement_global_var.txt"
}

View file

@ -0,0 +1,105 @@
/**
* @file
* init_mem.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Initialize SRAM memory from a file
* @details
* @version 0.1
* @date
* 2024-04-03
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.libs.mem
import chisel3._
import chisel3.util.experimental.loadMemoryFromFileInline
import hwdbg.configs._
class InitMemInline(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
memoryFile: String,
addrWidth: Int,
width: Int,
size: Int
) extends Module {
val io = IO(new Bundle {
val enable = Input(Bool())
val write = Input(Bool())
val addr = Input(UInt(addrWidth.W))
val dataIn = Input(UInt(width.W))
val dataOut = Output(UInt(width.W))
})
val mem = SyncReadMem(size / width, UInt(width.W))
//
// Initialize memory
//
if (memoryFile.trim().nonEmpty) {
loadMemoryFromFileInline(mem, memoryFile)
}
io.dataOut := DontCare
when(io.enable) {
val rdwrPort = mem(io.addr)
when(io.write) {
rdwrPort := io.dataIn
}.otherwise {
io.dataOut := rdwrPort
}
}
}
object InitMemInline {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
memoryFile: String,
addrWidth: Int,
width: Int,
size: Int
)(
enable: Bool,
write: Bool,
addr: UInt,
dataIn: UInt
): UInt = {
val initMemInlineModule = Module(
new InitMemInline(
debug,
memoryFile,
addrWidth,
width,
size
)
)
val dataOut = Wire(UInt(width.W))
//
// Configure the input signals
//
initMemInlineModule.io.enable := enable
initMemInlineModule.io.write := write
initMemInlineModule.io.addr := addr
initMemInlineModule.io.dataIn := dataIn
//
// Configure the output signals
//
dataOut := initMemInlineModule.io.dataOut
//
// Return the output result
//
dataOut
}
}

View file

@ -0,0 +1,159 @@
/**
* @file
* init_reg_mem_from_file.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Initialize registers from a file
* @details
* @version 0.1
* @date
* 2024-04-14
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.libs.mem
import scala.collection.mutable.ArrayBuffer
import scala.io.Source
import chisel3._
import hwdbg.utils._
import hwdbg.configs._
object InitRegMemFromFileTools {
def readmemh(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
path: String,
width: Int
): Seq[UInt] = {
var counter: Int = 0
val buffer = new ArrayBuffer[UInt]
for (line <- Source.fromFile(path).getLines()) {
val tokens: Array[String] = line.split("(//)").map(_.trim)
if (tokens.nonEmpty && tokens.head != "" && tokens.head.split(";")(0).trim != "") {
val i = Integer.parseInt(tokens.head.split(";")(0).trim, 16)
LogInfo(debug)(
f"Initialize memory [${counter}%x]: 0x${i}%x"
)
counter = counter + 4
buffer.append(i.U(width.W))
}
}
buffer.toSeq
}
}
class InitRegMemFromFile(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
emulateBlockRamDelay: Boolean,
memoryFile: String,
addrWidth: Int,
width: Int,
size: Int
) extends Module {
val io = IO(new Bundle {
val enable = Input(Bool())
val write = Input(Bool())
val addr = Input(UInt(addrWidth.W))
val dataIn = Input(UInt(width.W))
val dataOut = Output(UInt(width.W))
})
//
// Not needed to show the BRAM information
//
val mem = RegInit(VecInit(InitRegMemFromFileTools.readmemh(false, memoryFile, width)))
val actualAddr = Wire(UInt(addrWidth.W))
val actualData = Wire(UInt(width.W))
val actualWrite = Wire(Bool())
//
// This because the address of the saved registers are using 4 bytes granularities
// E.g., 4 Rsh 2 = 1 | 8 Rsh 2 = 2 | 12 Rsh 2 = 3
//
if (emulateBlockRamDelay) {
//
// In case, if it is an emulation of BRAM, a one clock delay is injected
//
actualAddr := RegNext(io.addr >> 2)
actualData := RegNext(io.dataIn)
actualWrite := RegNext(io.write)
} else {
actualAddr := io.addr >> 2
actualData := io.dataIn
actualWrite := io.write
}
when(io.enable) {
val rdwrPort = mem(actualAddr)
io.dataOut := rdwrPort
when(actualWrite) {
mem(actualAddr) := actualData
}
}.otherwise {
io.dataOut := 0.U
}
}
object InitRegMemFromFile {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
emulateBlockRamDelay: Boolean,
memoryFile: String,
addrWidth: Int,
width: Int,
size: Int
)(
enable: Bool,
write: Bool,
addr: UInt,
dataIn: UInt
): UInt = {
val initRegMemFromFileModule = Module(
new InitRegMemFromFile(
debug,
emulateBlockRamDelay,
memoryFile,
addrWidth,
width,
size
)
)
val dataOut = Wire(UInt(width.W))
//
// Configure the input signals
//
initRegMemFromFileModule.io.enable := enable
initRegMemFromFileModule.io.write := write
initRegMemFromFileModule.io.addr := addr
initRegMemFromFileModule.io.dataIn := dataIn
//
// Configure the output signals
//
dataOut := initRegMemFromFileModule.io.dataOut
//
// Return the output result
//
dataOut
}
}

View file

@ -0,0 +1,73 @@
/**
* @file
* mux_2_to_1_io.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Implementation of MUX 2 to 1 (I/O)
* @details
* @version 0.1
* @date
* 2024-05-05
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.libs.mux
import chisel3._
import hwdbg.configs._
class Mux2To1IO(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG
) extends Module {
val io = IO(new Bundle {
val a = Input(Bool())
val b = Input(Bool())
val select = Input(Bool())
val out = Output(Bool())
})
io.out := io.a & io.select | io.b & (~io.select)
}
object Mux2To1IO {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG
)(
a: Bool,
b: Bool,
select: Bool
): (Bool) = {
val mux2To1IO = Module(
new Mux2To1IO(
debug
)
)
val out = Wire(Bool())
//
// Configure the input signals
//
mux2To1IO.io.a := a
mux2To1IO.io.b := b
mux2To1IO.io.select := select
//
// Configure the output signals
//
out := mux2To1IO.io.out
//
// Return the output result
//
out
}
}

View file

@ -0,0 +1,80 @@
/**
* @file
* mux_2_to_1_lookup.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Implementation of MUX 2 to 1 (Mux-Lookup)
* @details
* @version 0.1
* @date
* 2024-05-05
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.libs.mux
import chisel3._
import chisel3.util._
import hwdbg.configs._
class Mux2To1Lookup(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG
) extends Module {
val io = IO(new Bundle {
val a = Input(Bool())
val b = Input(Bool())
val select = Input(Bool())
val out = Output(Bool())
})
val inputs = Array(
false.B -> io.a,
true.B -> io.b
)
io.out := MuxLookup(io.select, io.a)(inputs)
}
object Mux2To1Lookup {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG
)(
a: Bool,
b: Bool,
select: Bool
): (Bool) = {
val mux2To1Lookup = Module(
new Mux2To1Lookup(
debug
)
)
val out = Wire(Bool())
//
// Configure the input signals
//
mux2To1Lookup.io.a := a
mux2To1Lookup.io.b := b
mux2To1Lookup.io.select := select
//
// Configure the output signals
//
out := mux2To1Lookup.io.out
//
// Return the output result
//
out
}
}

View file

@ -0,0 +1,83 @@
/**
* @file
* mux_4_to_1_onehot.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Implementation of MUX 4 to 1 (One Hot)
* @details
* @version 0.1
* @date
* 2024-05-05
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.libs.mux
import chisel3._
import chisel3.util._
import hwdbg.configs._
class Mux4To1OneHot(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
width: Int = 32
) extends Module {
val io = IO(new Bundle {
val in0 = Input(UInt(width.W))
val in1 = Input(UInt(width.W))
val in2 = Input(UInt(width.W))
val in3 = Input(UInt(width.W))
val sel = Input(UInt(log2Ceil(width).W))
val out = Output(UInt(width.W))
})
io.out := Mux1H(io.sel, Seq(io.in0, io.in1, io.in2, io.in3))
}
object Mux4To1OneHot {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
width: Int = 32
)(
in0: UInt,
in1: UInt,
in2: UInt,
in3: UInt,
sel: UInt
): (UInt) = {
val mux4To1OneHot = Module(
new Mux4To1OneHot(
debug
)
)
val out = Wire(UInt(width.W))
//
// Configure the input signals
//
mux4To1OneHot.io.in0 := in0
mux4To1OneHot.io.in1 := in1
mux4To1OneHot.io.in2 := in2
mux4To1OneHot.io.in3 := in3
mux4To1OneHot.io.sel := sel
//
// Configure the output signals
//
out := mux4To1OneHot.io.out
//
// Return the output result
//
out
}
}

View file

@ -0,0 +1,320 @@
/**
* @file
* main.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* hwdbg's main debugger module
* @details
* @version 0.1
* @date
* 2024-04-04
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg
import chisel3._
import circt.stage.ChiselStage
import hwdbg.configs._
import hwdbg.types._
import hwdbg.utils._
import hwdbg.script._
import hwdbg.communication._
import hwdbg.communication.interpreter._
class DebuggerMain(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
numberOfPins: Int,
maximumNumberOfStages: Int,
maximumNumberOfSupportedGetScriptOperators: Int,
maximumNumberOfSupportedSetScriptOperators: Int,
sharedMemorySize: Int,
debuggerAreaOffset: Int,
debuggeeAreaOffset: Int,
scriptVariableLength: Int,
numberOfSupportedLocalAndGlobalVariables: Int,
numberOfSupportedTemporaryVariables: Int,
scriptCapabilities: Seq[Long],
bramAddrWidth: Int,
bramDataWidth: Int,
portsConfiguration: Array[Int]
) extends Module {
//
// Ensure sum of input port values equals numberOfPins (NUMBER_OF_PINS)
//
require(
portsConfiguration.sum == numberOfPins,
"err, the sum of the portsConfiguration (PORT_PINS_MAP) values must equal the numberOfPins (NUMBER_OF_PINS)."
)
//
// Ensure script variable length is not bigger than BRAM data width
//
require(
bramDataWidth >= scriptVariableLength,
"err, the script variable length should not be bigger than BRAM data width."
)
//
// Ensure the maximum number of stages is not bigger than the maximum number
// that can be stored within the script variable length. This is because
// if a JUMP for conditional statements wants to set the target location,
// it cannot store its destination in a script variable.
//
require(
maximumNumberOfStages < math.pow(2, scriptVariableLength),
"err, the maximum number of stages should be less than 2 to the power of the script variable length."
)
//
// Ensure the number of pin + ports is not bigger than the maximum number
// that can be stored within the script variable length. This is because
// for setting and getting pins/ports values, hwdbg uses an index which
// should fit within a variable size.
//
require(
numberOfPins + portsConfiguration.size < math.pow(2, scriptVariableLength),
"err, the maximum number of pins + ports should be less than 2 to the power of the script variable length."
)
//
// Ensure the number of set operators are equal to 1 since otherwise two variables (local, global and
// temp) might be written simultaneously.
//
require(
maximumNumberOfSupportedSetScriptOperators == 1,
"err, the supported number of SET operators can be only 1."
)
val io = IO(new Bundle {
//
// Chip signals
//
val en = Input(Bool()) // chip enable signal
//
// Input/Output signals
//
val inputPin = Input(Vec(numberOfPins, UInt(1.W))) // input pins
val outputPin = Output(Vec(numberOfPins, UInt(1.W))) // output pins
//
// Interrupt signals (lines)
//
val plInSignal = Input(Bool()) // PS to PL signal
val psOutInterrupt = Output(Bool()) // PL to PS interrupt
//
// BRAM (Block RAM) ports
//
val rdWrAddr = Output(UInt(bramAddrWidth.W)) // read/write address
val rdData = Input(UInt(bramDataWidth.W)) // read data
val wrEna = Output(Bool()) // enable writing
val wrData = Output(UInt(bramDataWidth.W)) // write data
})
//
// *** Create an instance of the debugger ***
//
val instanceInfo = HwdbgInstanceInformation.createInstanceInformation(
version = Version.getEncodedVersion,
maximumNumberOfStages = maximumNumberOfStages,
scriptVariableLength = scriptVariableLength,
numberOfSupportedLocalAndGlobalVariables = numberOfSupportedLocalAndGlobalVariables,
numberOfSupportedTemporaryVariables = numberOfSupportedTemporaryVariables,
maximumNumberOfSupportedGetScriptOperators = maximumNumberOfSupportedGetScriptOperators,
maximumNumberOfSupportedSetScriptOperators = maximumNumberOfSupportedSetScriptOperators,
sharedMemorySize = sharedMemorySize,
debuggerAreaOffset = debuggerAreaOffset,
debuggeeAreaOffset = debuggeeAreaOffset,
numberOfPins = numberOfPins,
numberOfPorts = portsConfiguration.size,
enabledCapabilities = scriptCapabilities,
bramAddrWidth = bramAddrWidth,
bramDataWidth = bramDataWidth,
portsConfiguration = portsConfiguration
)
//
// Wire signals for the synchronizer
//
val requestedActionOfThePacketOutput = Wire(UInt(new DebuggerRemotePacket().RequestedActionOfThePacket.getWidth.W))
val requestedActionOfThePacketOutputValid = Wire(Bool())
val dataValidOutput = Wire(Bool())
val receivingData = Wire(UInt(bramDataWidth.W))
val sendWaitForBuffer = Wire(Bool())
// -----------------------------------------------------------------------
// Create instance from interpreter
//
val (
noNewDataReceiver,
readNextData,
beginSendingBuffer,
noNewDataSender,
dataValidInterpreterOutput,
requestedActionOfThePacketInterpreterOutput,
sendingData,
finishedScriptConfiguration,
configureStage,
targetOperator
) =
DebuggerPacketInterpreter(
debug,
instanceInfo
)(
io.en,
requestedActionOfThePacketOutput,
requestedActionOfThePacketOutputValid,
dataValidOutput,
receivingData,
sendWaitForBuffer
)
// -----------------------------------------------------------------------
// Create instance from script execution engine
//
val (outputPin) =
ScriptExecutionEngine(
debug,
instanceInfo
)(
io.en,
finishedScriptConfiguration,
configureStage,
targetOperator,
io.inputPin
)
// -----------------------------------------------------------------------
// Create instance from synchronizer
//
val (
psOutInterrupt,
rdWrAddr,
wrEna,
wrData,
outRequestedActionOfThePacketOutput,
outRequestedActionOfThePacketOutputValid,
outDataValidOutput,
outReceivingData,
outSendWaitForBuffer
) =
SendReceiveSynchronizer(
debug,
instanceInfo
)(
io.en,
io.plInSignal,
io.rdData,
noNewDataReceiver,
readNextData,
beginSendingBuffer,
noNewDataSender,
dataValidInterpreterOutput,
requestedActionOfThePacketInterpreterOutput,
sendingData
)
// -----------------------------------------------------------------------
// Connect synchronizer signals to wires
//
requestedActionOfThePacketOutput := outRequestedActionOfThePacketOutput
requestedActionOfThePacketOutputValid := outRequestedActionOfThePacketOutputValid
dataValidOutput := outDataValidOutput
receivingData := outReceivingData
sendWaitForBuffer := outSendWaitForBuffer
// -----------------------------------------------------------------------
// Configure the output signals
//
io.wrEna := wrEna
io.wrData := wrData
io.rdWrAddr := rdWrAddr
io.outputPin := outputPin
io.psOutInterrupt := psOutInterrupt
}
object DebuggerMain {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
numberOfPins: Int,
maximumNumberOfStages: Int,
maximumNumberOfSupportedGetScriptOperators: Int,
maximumNumberOfSupportedSetScriptOperators: Int,
sharedMemorySize: Int,
debuggerAreaOffset: Int,
debuggeeAreaOffset: Int,
scriptVariableLength: Int,
numberOfSupportedLocalAndGlobalVariables: Int,
numberOfSupportedTemporaryVariables: Int,
scriptCapabilities: Seq[Long],
bramAddrWidth: Int,
bramDataWidth: Int,
portsConfiguration: Array[Int]
)(
en: Bool,
inputPin: Vec[UInt],
plInSignal: Bool,
rdData: UInt
): (Vec[UInt], Bool, UInt, Bool, UInt) = {
val debuggerMainModule = Module(
new DebuggerMain(
debug,
numberOfPins,
maximumNumberOfStages,
maximumNumberOfSupportedGetScriptOperators,
maximumNumberOfSupportedSetScriptOperators,
sharedMemorySize,
debuggerAreaOffset,
debuggeeAreaOffset,
scriptVariableLength,
numberOfSupportedLocalAndGlobalVariables,
numberOfSupportedTemporaryVariables,
scriptCapabilities,
bramAddrWidth,
bramDataWidth,
portsConfiguration
)
)
val outputPin = Wire(Vec(numberOfPins, UInt(1.W)))
val psOutInterrupt = Wire(Bool())
val rdWrAddr = Wire(UInt(bramAddrWidth.W))
val wrEna = Wire(Bool())
val wrData = Wire(UInt(bramDataWidth.W))
//
// Configure the input signals
//
debuggerMainModule.io.en := en
debuggerMainModule.io.inputPin := inputPin
debuggerMainModule.io.plInSignal := plInSignal
debuggerMainModule.io.rdData := rdData
//
// Configure the output signals
//
outputPin := debuggerMainModule.io.outputPin
psOutInterrupt := debuggerMainModule.io.psOutInterrupt
rdWrAddr := debuggerMainModule.io.rdWrAddr
wrEna := debuggerMainModule.io.wrEna
wrData := debuggerMainModule.io.wrData
//
// Return the output result
//
(outputPin, psOutInterrupt, rdWrAddr, wrEna, wrData)
}
}

View file

@ -0,0 +1,507 @@
/**
* @file
* eval.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Script execution engine
* @details
* @version 0.1
* @date
* 2024-05-17
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.script
import chisel3._
import chisel3.util._
import hwdbg.configs._
import hwdbg.utils._
import hwdbg.stage._
class ScriptEngineEval(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
) extends Module {
//
// Import operators enum
//
import hwdbg.script.ScriptEvalFunc.ScriptOperators
import hwdbg.script.ScriptEvalFunc.ScriptOperators._
val io = IO(new Bundle {
//
// Chip signals
//
val en = Input(Bool()) // chip enable signal
//
// Stage configuration signals
//
val stageConfig = Input(new Stage(debug, instanceInfo))
val nextStage = Output(
UInt(
log2Ceil(
instanceInfo.maximumNumberOfStages * (instanceInfo.maximumNumberOfSupportedGetScriptOperators + instanceInfo.maximumNumberOfSupportedSetScriptOperators + 1)
).W
)
)
//
// Output signals
//
val outputPin = Output(Vec(instanceInfo.numberOfPins, UInt(1.W))) // output pins
val resultingLocalGlobalVariables = Output(
Vec(instanceInfo.numberOfSupportedLocalAndGlobalVariables, UInt(instanceInfo.scriptVariableLength.W))
) // output of local (and global) variables
val resultingTempVariables =
Output(Vec(instanceInfo.numberOfSupportedTemporaryVariables, UInt(instanceInfo.scriptVariableLength.W))) // output of temporary variables
})
//
// Output pins
//
val nextStage = WireInit(
0.U(
log2Ceil(
instanceInfo.maximumNumberOfStages * (instanceInfo.maximumNumberOfSupportedGetScriptOperators + instanceInfo.maximumNumberOfSupportedSetScriptOperators + 1)
).W
)
)
//
// Assign operator value (split the signal into only usable part)
//
LogInfo(debug)("Usable size of Value in the SYMBOL: " + ScriptOperators().getWidth)
val mainOperatorValue = io.stageConfig.stageSymbol.Value(ScriptOperators().getWidth - 1, 0).asTypeOf(ScriptOperators())
// -------------------------------------------------------------------------
// Get value module
//
val getValueModuleOutput = Wire(Vec(instanceInfo.maximumNumberOfSupportedGetScriptOperators, UInt(instanceInfo.scriptVariableLength.W)))
for (i <- 0 until instanceInfo.maximumNumberOfSupportedGetScriptOperators) {
getValueModuleOutput(i) := ScriptEngineGetValue(
debug,
instanceInfo
)(
io.en,
io.stageConfig.getOperatorSymbol(i),
io.stageConfig.localGlobalVariables,
io.stageConfig.tempVariables,
io.stageConfig.pinValues
)
}
// -------------------------------------------------------------------------
// *** Implementing the evaluation engine ***
//
//
val srcVal = WireInit(VecInit(Seq.fill(instanceInfo.maximumNumberOfSupportedGetScriptOperators)(0.U(instanceInfo.scriptVariableLength.W))))
val desVal = WireInit(VecInit(Seq.fill(instanceInfo.maximumNumberOfSupportedSetScriptOperators)(0.U(instanceInfo.scriptVariableLength.W))))
//
// Apply the chip enable signal
//
when(io.en === true.B) {
switch(mainOperatorValue) {
is(sFuncOr) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_or) == true) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
desVal(0) := srcVal(0) | srcVal(1)
nextStage := io.stageConfig.stageIndex + 4.U // one main operator + two GET operators + one SET operator
}
}
is(sFuncXor) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_xor) == true) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
desVal(0) := srcVal(0) ^ srcVal(1)
nextStage := io.stageConfig.stageIndex + 4.U // one main operator + two GET operators + one SET operator
}
}
is(sFuncAnd) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_and) == true) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
desVal(0) := srcVal(0) & srcVal(1)
nextStage := io.stageConfig.stageIndex + 4.U // one main operator + two GET operators + one SET operator
}
}
is(sFuncAsr) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_asr) == true) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
desVal(0) := srcVal(0) >> srcVal(1)(log2Ceil(instanceInfo.scriptVariableLength), 0)
nextStage := io.stageConfig.stageIndex + 4.U // one main operator + two GET operators + one SET operator
}
}
is(sFuncAsl) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_asl) == true) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
desVal(0) := srcVal(0) << srcVal(1)(log2Ceil(instanceInfo.scriptVariableLength), 0)
nextStage := io.stageConfig.stageIndex + 4.U // one main operator + two GET operators + one SET operator
}
}
is(sFuncAdd) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_add) == true) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
desVal(0) := srcVal(0) + srcVal(1)
nextStage := io.stageConfig.stageIndex + 4.U // one main operator + two GET operators + one SET operator
}
}
is(sFuncSub) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_sub) == true) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
desVal(0) := srcVal(0) - srcVal(1)
nextStage := io.stageConfig.stageIndex + 4.U // one main operator + two GET operators + one SET operator
}
}
is(sFuncMul) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_mul) == true) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
desVal(0) := srcVal(0) * srcVal(1)
nextStage := io.stageConfig.stageIndex + 4.U // one main operator + two GET operators + one SET operator
}
}
is(sFuncDiv) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_div) == true) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
desVal(0) := srcVal(0) / srcVal(1)
nextStage := io.stageConfig.stageIndex + 4.U // one main operator + two GET operators + one SET operator
}
}
is(sFuncMod) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_mod) == true) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
desVal(0) := srcVal(0) % srcVal(1)
nextStage := io.stageConfig.stageIndex + 4.U // one main operator + two GET operators + one SET operator
}
}
is(sFuncGt) {
if (
HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_gt) == true &&
HwdbgScriptCapabilities.isCapabilitySupported(
instanceInfo.scriptCapabilities,
HwdbgScriptCapabilities.conditional_statements_and_comparison_operators
) == true
) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
desVal(0) := srcVal(0) > srcVal(1)
nextStage := io.stageConfig.stageIndex + 4.U // one main operator + two GET operators + one SET operator
}
}
is(sFuncLt) {
if (
HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_lt) == true &&
HwdbgScriptCapabilities.isCapabilitySupported(
instanceInfo.scriptCapabilities,
HwdbgScriptCapabilities.conditional_statements_and_comparison_operators
) == true
) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
desVal(0) := srcVal(0) < srcVal(1)
nextStage := io.stageConfig.stageIndex + 4.U // one main operator + two GET operators + one SET operator
}
}
is(sFuncEgt) {
if (
HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_egt) == true &&
HwdbgScriptCapabilities.isCapabilitySupported(
instanceInfo.scriptCapabilities,
HwdbgScriptCapabilities.conditional_statements_and_comparison_operators
) == true
) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
desVal(0) := srcVal(0) >= srcVal(1)
nextStage := io.stageConfig.stageIndex + 4.U // one main operator + two GET operators + one SET operator
}
}
is(sFuncElt) {
if (
HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_egt) == true &&
HwdbgScriptCapabilities.isCapabilitySupported(
instanceInfo.scriptCapabilities,
HwdbgScriptCapabilities.conditional_statements_and_comparison_operators
) == true
) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
desVal(0) := srcVal(0) <= srcVal(1)
nextStage := io.stageConfig.stageIndex + 4.U // one main operator + two GET operators + one SET operator
}
}
is(sFuncEqual) {
if (
HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_equal) == true &&
HwdbgScriptCapabilities.isCapabilitySupported(
instanceInfo.scriptCapabilities,
HwdbgScriptCapabilities.conditional_statements_and_comparison_operators
) == true
) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
desVal(0) := srcVal(0) === srcVal(1)
nextStage := io.stageConfig.stageIndex + 4.U // one main operator + two GET operators + one SET operator
}
}
is(sFuncNeq) {
if (
HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_neq) == true &&
HwdbgScriptCapabilities.isCapabilitySupported(
instanceInfo.scriptCapabilities,
HwdbgScriptCapabilities.conditional_statements_and_comparison_operators
) == true
) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
desVal(0) := srcVal(0) =/= srcVal(1)
nextStage := io.stageConfig.stageIndex + 4.U // one main operator + two GET operators + one SET operator
}
}
is(sFuncJmp) {
if (
HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_jmp) == true &&
HwdbgScriptCapabilities.isCapabilitySupported(
instanceInfo.scriptCapabilities,
HwdbgScriptCapabilities.conditional_statements_and_comparison_operators
) == true
) {
srcVal(0) := getValueModuleOutput(0)
nextStage := srcVal(0)
}
}
is(sFuncJz) {
if (
HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_jz) == true &&
HwdbgScriptCapabilities.isCapabilitySupported(
instanceInfo.scriptCapabilities,
HwdbgScriptCapabilities.conditional_statements_and_comparison_operators
) == true
) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
when(srcVal(1) === 0.U) {
nextStage := srcVal(0)
}.otherwise {
nextStage := io.stageConfig.stageIndex + 3.U // one main operator + two GET operators
}
}
}
is(sFuncJnz) {
if (
HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_jnz) == true &&
HwdbgScriptCapabilities.isCapabilitySupported(
instanceInfo.scriptCapabilities,
HwdbgScriptCapabilities.conditional_statements_and_comparison_operators
) == true
) {
srcVal(0) := getValueModuleOutput(0)
srcVal(1) := getValueModuleOutput(1)
when(srcVal(1) =/= 0.U) {
nextStage := srcVal(0)
}.otherwise {
nextStage := io.stageConfig.stageIndex + 3.U // one main operator + two GET operators
}
}
}
is(sFuncMov) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_mov) == true) {
srcVal(0) := getValueModuleOutput(0)
desVal(0) := srcVal(0)
nextStage := io.stageConfig.stageIndex + 3.U // one main operator + one GET operators + one SET operator
}
}
is(sFuncPrintf) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.func_printf) == true) {
//
// To be implemented
//
}
}
}
}
// -------------------------------------------------------------------------
// Set value module
//
val setValueModuleInput = Wire(Vec(instanceInfo.maximumNumberOfSupportedSetScriptOperators, Vec(instanceInfo.numberOfPins, UInt(1.W))))
val outputLocalGlobalVariables = Wire(
Vec(
instanceInfo.maximumNumberOfSupportedSetScriptOperators,
Vec(instanceInfo.numberOfSupportedLocalAndGlobalVariables, UInt(instanceInfo.scriptVariableLength.W))
)
)
val outputTempVariables = Wire(
Vec(
instanceInfo.maximumNumberOfSupportedSetScriptOperators,
Vec(instanceInfo.numberOfSupportedTemporaryVariables, UInt(instanceInfo.scriptVariableLength.W))
)
)
for (i <- 0 until instanceInfo.maximumNumberOfSupportedSetScriptOperators) {
val (
outputPin,
resultingLocalGlobalVariables,
resultingTempVariables
) = ScriptEngineSetValue(
debug,
instanceInfo
)(
io.en,
io.stageConfig.setOperatorSymbol(i),
io.stageConfig.localGlobalVariables,
io.stageConfig.tempVariables,
desVal(i),
io.stageConfig.pinValues
)
//
// Connect SET output pins
//
setValueModuleInput(i) := outputPin
outputLocalGlobalVariables(i) := resultingLocalGlobalVariables
outputTempVariables(i) := resultingTempVariables
}
// ---------------------------------------------------------------------
//
// Connect the output signals
//
io.outputPin := setValueModuleInput(0)
io.resultingLocalGlobalVariables := outputLocalGlobalVariables(0)
io.resultingTempVariables := outputTempVariables(0)
io.nextStage := nextStage
}
object ScriptEngineEval {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
)(
en: Bool,
stageConfig: Stage
): (UInt, Vec[UInt], Vec[UInt], Vec[UInt]) = {
val scriptEngineEvalModule = Module(
new ScriptEngineEval(
debug,
instanceInfo
)
)
val outputPin = Wire(Vec(instanceInfo.numberOfPins, UInt(1.W)))
val resultingLocalGlobalVariables = Wire(Vec(instanceInfo.numberOfSupportedLocalAndGlobalVariables, UInt(instanceInfo.scriptVariableLength.W)))
val resultingTempVariables = Wire(Vec(instanceInfo.numberOfSupportedTemporaryVariables, UInt(instanceInfo.scriptVariableLength.W)))
val nextStage = Wire(
UInt(
log2Ceil(
instanceInfo.maximumNumberOfStages * (instanceInfo.maximumNumberOfSupportedGetScriptOperators + instanceInfo.maximumNumberOfSupportedSetScriptOperators + 1)
).W
)
)
//
// Configure the input signals
//
scriptEngineEvalModule.io.en := en
scriptEngineEvalModule.io.stageConfig := stageConfig
//
// Configure the output signals
//
nextStage := scriptEngineEvalModule.io.nextStage
outputPin := scriptEngineEvalModule.io.outputPin
resultingLocalGlobalVariables := scriptEngineEvalModule.io.resultingLocalGlobalVariables
resultingTempVariables := scriptEngineEvalModule.io.resultingTempVariables
//
// Return the output result
//
(
nextStage,
outputPin,
resultingLocalGlobalVariables,
resultingTempVariables
)
}
}

View file

@ -0,0 +1,373 @@
/**
* @file
* exec.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Script execution engine
* @details
* @version 0.1
* @date
* 2024-05-07
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.script
import chisel3._
import chisel3.util._
import hwdbg.configs._
import hwdbg.stage._
object ScriptExecutionEngineConfigStage {
object State extends ChiselEnum {
val sConfigStageSymbol, sConfigGetSymbol, sConfigSetSymbol = Value
}
}
class ScriptExecutionEngine(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
) extends Module {
//
// Import state enum
//
import ScriptExecutionEngineConfigStage.State
import ScriptExecutionEngineConfigStage.State._
val io = IO(new Bundle {
//
// Chip signals
//
val en = Input(Bool()) // chip enable signal
//
// Script stage configuration signals
//
val finishedScriptConfiguration = Input(Bool()) // whether script configuration finished or not?
val configureStage = Input(Bool()) // whether the configuration of stage should start or not?
val targetOperator = Input(new HwdbgShortSymbol(instanceInfo.scriptVariableLength)) // Current operator to be configured
//
// Input/Output signals
//
val inputPin = Input(Vec(instanceInfo.numberOfPins, UInt(1.W))) // input pins
val outputPin = Output(Vec(instanceInfo.numberOfPins, UInt(1.W))) // output pins
})
//
// Output pins
//
val outputPin = Wire(Vec(instanceInfo.numberOfPins, UInt(1.W)))
//
// Stage registers
//
val stageRegs = Reg(Vec(instanceInfo.maximumNumberOfStages, new Stage(debug, instanceInfo)))
//
// Stage configuration done
// Whether the state are configured or not
//
val stageConfigurationValid = RegInit(false.B)
//
// Stage configuration registers
//
val configState = RegInit(sConfigStageSymbol)
val configStageNumber = RegInit(0.U(log2Ceil(instanceInfo.maximumNumberOfStages).W))
//
// Calculate the maximum of the two values since we only want to use one register for
// both GET and SET
//
val maxOperators = math.max(instanceInfo.maximumNumberOfSupportedGetScriptOperators, instanceInfo.maximumNumberOfSupportedSetScriptOperators)
//
// Create a register with the width based on the maximum value
//
val configGetSetOperatorNumber = RegInit(0.U(log2Ceil(maxOperators).W))
val stageIndex = RegInit(
0.U(
log2Ceil(
instanceInfo.maximumNumberOfStages * (instanceInfo.maximumNumberOfSupportedGetScriptOperators + instanceInfo.maximumNumberOfSupportedSetScriptOperators + 1)
).W
)
)
// -----------------------------------------------------------------------
//
// *** Configure stage buffers ***
//
when(io.configureStage === true.B) {
switch(configState) {
is(sConfigStageSymbol) {
//
// Since the chip is in the configuring status, just pass all the input
// to output since the stage data is not valid at this stage
//
stageConfigurationValid := false.B
//
// Configure the stage symbol (The first symbol is the stage operator)
//
stageRegs(configStageNumber).stageSymbol := io.targetOperator
//
// Set the stage index
//
stageRegs(configStageNumber).stageIndex := stageIndex // store the stage index
stageRegs(configStageNumber).targetStage := 0.U // reset the target stage
stageIndex := stageIndex + 1.U // increment stage index
//
// If it is the very first configuration symbol, then we disable all stages
//
when(configStageNumber === 0.U) {
for (i <- 0 until instanceInfo.maximumNumberOfStages) {
stageRegs(i).stageEnable := false.B
}
}
//
// Going to the next state
//
configState := sConfigGetSymbol
}
is(sConfigGetSymbol) {
//
// Config GET operator
//
stageRegs(configStageNumber).getOperatorSymbol(configGetSetOperatorNumber) := io.targetOperator
configGetSetOperatorNumber := configGetSetOperatorNumber + 1.U
//
// Check whether this stage number should be counted in stage indexes or its empty
//
when(io.targetOperator.Type =/= 0.U) {
stageIndex := stageIndex + 1.U
}
when(configGetSetOperatorNumber === (instanceInfo.maximumNumberOfSupportedGetScriptOperators - 1).U) {
configGetSetOperatorNumber := 0.U // reset the counter
configState := sConfigSetSymbol // go to the next state
}.otherwise {
configState := sConfigGetSymbol // stay at the same state
}
}
is(sConfigSetSymbol) {
//
// Config SET operator
//
stageRegs(configStageNumber).setOperatorSymbol(configGetSetOperatorNumber) := io.targetOperator
stageRegs(configStageNumber).stageEnable := true.B // this stage is enabled
configGetSetOperatorNumber := configGetSetOperatorNumber + 1.U
when(io.targetOperator.Type =/= 0.U) {
stageIndex := stageIndex + 1.U
}
when(configGetSetOperatorNumber === (instanceInfo.maximumNumberOfSupportedSetScriptOperators - 1).U) {
configGetSetOperatorNumber := 0.U // reset the counter
when(io.finishedScriptConfiguration === true.B) {
//
// Not configuring anymore, reset the stage number
//
configStageNumber := 0.U // reset the stage number
stageIndex := 0.U // reset the stage index
configState := sConfigStageSymbol
//
// Stage data is now valid and can be used (scripts can apply from now on)
//
stageConfigurationValid := true.B
}.otherwise {
configStageNumber := configStageNumber + 1.U // Increment the stage number holder of current configuration
configState := sConfigStageSymbol // the next state is again a stage symbol
}
}.otherwise {
configState := sConfigSetSymbol // stay at the same state
}
}
}
}
// -----------------------------------------------------------------------
//
// *** Move each register (input vector) to the next stage at each clock ***
//
for (i <- 0 until instanceInfo.maximumNumberOfStages) {
if (i == 0) {
//
// At the first stage, the input registers should be passed to the
// first registers set of the stage registers
//
stageRegs(0).pinValues := io.inputPin
//
// Each pin start initially start from 0th target stage
//
stageRegs(0).targetStage := 0.U
} else if (i == (instanceInfo.maximumNumberOfStages - 1)) {
//
// At the last stage, the state registers should be passed to the output
// Note: At this stage script symbol is useless
//
outputPin := stageRegs(i - 1).pinValues
} else {
//
// Check if this stage should be ignored (passed to the next stage) or be evaluated
// (i - 1) is because the 0th index registers are used for storing data but the
// script engine assumes that the symbols start from 0, so -1 is used here
//
// Also, if the stage data is valid (configuration applied at least once)
//
when(stageConfigurationValid === true.B && stageRegs(i - 1).stageIndex === stageRegs(i - 1).targetStage && stageRegs(i - 1).stageEnable === true.B) {
//
// *** Based on target stage, this stage needs evaluation ***
//
//
// Instantiate an eval engine for this stage
//
val (
nextStage,
outputPin,
resultingLocalGlobalVariables,
resultingTempVariables
) = ScriptEngineEval(
debug,
instanceInfo
)(
stageRegs(i - 1).stageEnable,
stageRegs(i - 1)
)
//
// At the normal (middle) stage, the result of state registers should be passed to
// the next level of stage registers
//
stageRegs(i).pinValues := outputPin
//
// Pass the target stage symbol number to the next stage
//
stageRegs(i).targetStage := nextStage
//
// Pass the local (and global) and temporary variables to the next stage
//
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.assign_local_global_var) == true) {
stageRegs(i).localGlobalVariables := resultingLocalGlobalVariables
}
if (
HwdbgScriptCapabilities.isCapabilitySupported(
instanceInfo.scriptCapabilities,
HwdbgScriptCapabilities.conditional_statements_and_comparison_operators
) == true
) {
stageRegs(i).tempVariables := resultingTempVariables
}
}.otherwise {
//
// *** Based on target stage, this stage should be ignore ***
//
//
// Just pass all the values to the next stage
//
stageRegs(i).pinValues := stageRegs(i - 1).pinValues
stageRegs(i).targetStage := stageRegs(i - 1).targetStage
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.assign_local_global_var) == true) {
stageRegs(i).localGlobalVariables := stageRegs(i - 1).localGlobalVariables
}
if (
HwdbgScriptCapabilities.isCapabilitySupported(
instanceInfo.scriptCapabilities,
HwdbgScriptCapabilities.conditional_statements_and_comparison_operators
) == true
) {
stageRegs(i).tempVariables := stageRegs(i - 1).tempVariables
}
}
}
}
// -----------------------------------------------------------------------
//
// Connect the output signals
//
io.outputPin := outputPin
}
object ScriptExecutionEngine {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
)(
en: Bool,
finishedScriptConfiguration: Bool,
configureStage: Bool,
targetOperator: HwdbgShortSymbol,
inputPin: Vec[UInt]
): (Vec[UInt]) = {
val scriptExecutionEngineModule = Module(
new ScriptExecutionEngine(
debug,
instanceInfo
)
)
val outputPin = Wire(Vec(instanceInfo.numberOfPins, UInt(1.W)))
//
// Configure the input signals
//
scriptExecutionEngineModule.io.en := en
scriptExecutionEngineModule.io.finishedScriptConfiguration := finishedScriptConfiguration
scriptExecutionEngineModule.io.configureStage := configureStage
scriptExecutionEngineModule.io.targetOperator := targetOperator
scriptExecutionEngineModule.io.inputPin := inputPin
//
// Configure the output signals
//
outputPin := scriptExecutionEngineModule.io.outputPin
//
// Return the output result
//
(outputPin)
}
}

View file

@ -0,0 +1,238 @@
/**
* @file
* get_value.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Script engine get value
* @details
* @version 0.1
* @date
* 2024-05-29
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.script
import chisel3._
import chisel3.util._
import hwdbg.configs._
import hwdbg.utils._
import hwdbg.stage._
class ScriptEngineGetValue(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
) extends Module {
//
// Import script data types enum
//
import hwdbg.script.ScriptConstantTypes.ScriptDataTypes
import hwdbg.script.ScriptConstantTypes.ScriptDataTypes._
val io = IO(new Bundle {
//
// Chip signals
//
val en = Input(Bool()) // chip enable signal
//
// Evaluation operator symbol
//
val operator = Input(new HwdbgShortSymbol(instanceInfo.scriptVariableLength))
//
// Input variables
//
val localGlobalVariables =
Input(Vec(instanceInfo.numberOfSupportedLocalAndGlobalVariables, UInt(instanceInfo.scriptVariableLength.W))) // Local (and Global) variables
val tempVariables = Input(Vec(instanceInfo.numberOfSupportedTemporaryVariables, UInt(instanceInfo.scriptVariableLength.W))) // Temporary variables
//
// Input signals
//
val inputPin = Input(Vec(instanceInfo.numberOfPins, UInt(1.W))) // input pins
//
// Output value
//
val outputValue = Output(UInt(instanceInfo.scriptVariableLength.W)) // output value
})
val outputValue = WireInit(0.U(instanceInfo.scriptVariableLength.W))
//
// Assign operator type (split the signal into only usable part)
//
LogInfo(debug)("Usable size of Type in the SYMBOL: " + ScriptDataTypes().getWidth)
val mainOperatorType = io.operator.Type(ScriptDataTypes().getWidth - 1, 0).asTypeOf(ScriptDataTypes())
//
// *** Implementing the getting data logic ***
//
//
// Apply the chip enable signal
//
when(io.en === true.B) {
switch(mainOperatorType) {
is(symbolGlobalIdType) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.assign_local_global_var) == true) {
//
// Set output to local (and global) variables
//
outputValue := io.localGlobalVariables(io.operator.Value)
}
}
is(symbolLocalIdType) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.assign_local_global_var) == true) {
//
// Set output to local (and global) variables
//
outputValue := io.localGlobalVariables(io.operator.Value)
}
}
is(symbolNumType) {
//
// Constant value
//
outputValue := io.operator.Value
}
is(symbolRegisterType) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.assign_registers) == true) {
//
// Registers are pins and ports
//
when(instanceInfo.numberOfPins.U > io.operator.Value) {
//
// *** Used for getting the pin value ***
//
outputValue := io.inputPin(io.operator.Value)
}.otherwise {
//
// *** Used for getting the port value ***
//
//
// Create a vector of wires
//
val ports = Wire(Vec(instanceInfo.numberOfPorts, UInt(instanceInfo.scriptVariableLength.W)))
var currentPortIndex: Int = 0
var currentPortNum: Int = 0
//
// Iterate based on port configuration
//
for (port <- instanceInfo.portsConfiguration) {
LogInfo(debug)(f"connect port(${currentPortIndex}) to inputPin(${currentPortNum} to ${currentPortNum + port}) for SET")
ports(currentPortIndex) := io.inputPin.asUInt(currentPortNum + port - 1, currentPortNum)
currentPortNum += port
currentPortIndex += 1
}
//
// Set the output
//
outputValue := ports(io.operator.Value - instanceInfo.numberOfPins.U)
}
}
}
is(symbolPseudoRegType) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.assign_pseudo_registers) == true) {
//
// To be implemented
//
outputValue := 0.U
}
}
is(symbolStackIndexType) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.stack_assignments) == true) {
//
// To be implemented
//
outputValue := 0.U // io.inputPin.asUInt
}
}
is(symbolTempType) {
if (
HwdbgScriptCapabilities.isCapabilitySupported(
instanceInfo.scriptCapabilities,
HwdbgScriptCapabilities.conditional_statements_and_comparison_operators
) == true
) {
//
// Set output to temporary variables
//
outputValue := io.tempVariables(io.operator.Value)
}
}
}
}
//
// Connect the output signals
//
io.outputValue := outputValue
}
object ScriptEngineGetValue {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
)(
en: Bool,
operator: HwdbgShortSymbol,
localGlobalVariables: Vec[UInt],
tempVariables: Vec[UInt],
inputPin: Vec[UInt]
): (UInt) = {
val scriptEngineGetValueModule = Module(
new ScriptEngineGetValue(
debug,
instanceInfo
)
)
val outputValue = Wire(UInt(instanceInfo.scriptVariableLength.W))
//
// Configure the input signals
//
scriptEngineGetValueModule.io.en := en
scriptEngineGetValueModule.io.operator := operator
scriptEngineGetValueModule.io.localGlobalVariables := localGlobalVariables
scriptEngineGetValueModule.io.tempVariables := tempVariables
scriptEngineGetValueModule.io.inputPin := inputPin
//
// Configure the output signal
//
outputValue := scriptEngineGetValueModule.io.outputValue
//
// Return the output result
//
(outputValue)
}
}

View file

@ -0,0 +1,50 @@
package hwdbg.script
import chisel3._
import chisel3.util._
/**
* @brief
* The structure of HWDBG_SHORT_SYMBOL used in script engine of HyperDbg
*/
class HwdbgShortSymbol(
scriptVariableLength: Int
) extends Bundle {
//
// Ensure that the script variable length is at least 8 bits or 1 byte
//
require(
scriptVariableLength >= 8,
f"err, the minimum script variable length is 8 bits (1 byte)."
)
val Type = UInt(scriptVariableLength.W) // long long unsigned is 64 bits but it can be dynamic
val Value = UInt(scriptVariableLength.W) // long long unsigned is 64 bits but it can be dynamic
}
/**
* @brief
* Constant values for the script engine
*/
object ScriptConstants {
val SYMBOL_MEM_VALID_CHECK_MASK = 1 << 31
val INVALID = 0x80000000
val LALR_ACCEPT = 0x7fffffff
}
/**
* @brief
* Constant type values for the script engine
*/
object ScriptConstantTypes {
object ScriptDataTypes extends ChiselEnum {
val symbolUndefined, symbolGlobalIdType, symbolLocalIdType, symbolNumType, symbolRegisterType, symbolPseudoRegType, symbolSemanticRuleType, symbolTempType, symbolStringType, symbolVariableCountType, symbolInvalid, symbolWstringType, symbolFunctionParameterIdType, symbolReturnAddressType, symbolFunctionParameterType, symbolStackIndexType, symbolStackBaseIndexType, symbolReturnValueType = Value
}
}
object ScriptEvalFunc {
object ScriptOperators extends ChiselEnum {
val sFuncUndefined, sFuncInc, sFuncDec, sFuncReference, sFuncOr, sFuncXor, sFuncAnd, sFuncAsr, sFuncAsl, sFuncAdd, sFuncSub, sFuncMul, sFuncDiv, sFuncMod, sFuncGt, sFuncLt, sFuncEgt, sFuncElt, sFuncEqual, sFuncNeq, sFuncJmp, sFuncJz, sFuncJnz, sFuncMov, sFuncStart_of_do_while, sFuncStart_of_do_while_commands, sFuncEnd_of_do_while, sFuncStart_of_for, sFuncFor_inc_dec, sFuncStart_of_for_ommands, sFuncEnd_of_if, sFuncIgnore_lvalue, sFuncPush, sFuncPop, sFuncCall, sFuncRet, sFuncPrint, sFuncFormats, sFuncEvent_enable, sFuncEvent_disable, sFuncEvent_clear, sFuncTest_statement, sFuncSpinlock_lock, sFuncSpinlock_unlock, sFuncEvent_sc, sFuncMicrosleep, sFuncPrintf, sFuncPause, sFuncFlush, sFuncEvent_trace_step, sFuncEvent_trace_step_in, sFuncEvent_trace_step_out, sFuncEvent_trace_instrumentation_step, sFuncEvent_trace_instrumentation_step_in, sFuncRdtsc, sFuncRdtscp, sFuncLbr_save, sFuncLbr_dump, sFuncLbr_print, sFuncLbr_restore, sFuncLbr_check, sFuncSpinlock_lock_custom_wait, sFuncEvent_inject, sFuncPoi, sFuncDb, sFuncDd, sFuncDw, sFuncDq, sFuncNeg, sFuncHi, sFuncLow, sFuncNot, sFuncCheck_address, sFuncDisassemble_len, sFuncDisassemble_len32, sFuncDisassemble_len64, sFuncInterlocked_increment, sFuncInterlocked_decrement, sFuncPhysical_to_virtual, sFuncVirtual_to_physical, sFuncPoi_pa, sFuncHi_pa, sFuncLow_pa, sFuncDb_pa, sFuncDd_pa, sFuncDw_pa, sFuncDq_pa, sFuncLbr_restore_by_filter, sFuncEd, sFuncEb, sFuncEq, sFuncInterlocked_exchange, sFuncInterlocked_exchange_add, sFuncEb_pa, sFuncEd_pa, sFuncEq_pa, sFuncInterlocked_compare_exchange, sFuncStrlen, sFuncStrcmp, sFuncMemcmp, sFuncStrncmp, sFuncWcslen, sFuncWcscmp, sFuncEvent_inject_error_code, sFuncMemcpy, sFuncMemcpy_pa, sFuncWcsncmp = Value
}
}

View file

@ -0,0 +1,389 @@
/**
* @file
* set_value.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Script engine set value
* @details
* @version 0.1
* @date
* 2024-05-29
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.script
import chisel3._
import chisel3.util._
import hwdbg.configs._
import hwdbg.utils._
import hwdbg.stage._
class ScriptEngineSetValue(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
) extends Module {
//
// Import script data types enum
//
import hwdbg.script.ScriptConstantTypes.ScriptDataTypes
import hwdbg.script.ScriptConstantTypes.ScriptDataTypes._
val io = IO(new Bundle {
//
// Chip signals
//
val en = Input(Bool()) // chip enable signal
//
// Evaluation operator symbol
//
val operator = Input(new HwdbgShortSymbol(instanceInfo.scriptVariableLength))
//
// Input variables
//
val inputLocalGlobalVariables =
Input(Vec(instanceInfo.numberOfSupportedLocalAndGlobalVariables, UInt(instanceInfo.scriptVariableLength.W))) // Local (and Global) variables
val inputTempVariables =
Input(Vec(instanceInfo.numberOfSupportedTemporaryVariables, UInt(instanceInfo.scriptVariableLength.W))) // Temporary variables
//
// Input value
//
val inputValue = Input(UInt(instanceInfo.scriptVariableLength.W)) // input value
//
// Output signals
//
val inputPin = Input(Vec(instanceInfo.numberOfPins, UInt(1.W))) // output pins
val outputPin = Output(Vec(instanceInfo.numberOfPins, UInt(1.W))) // output pins
//
// Output variables
//
val outputLocalGlobalVariables =
Output(Vec(instanceInfo.numberOfSupportedLocalAndGlobalVariables, UInt(instanceInfo.scriptVariableLength.W))) // Local (and Global) variables
val outputTempVariables =
Output(Vec(instanceInfo.numberOfSupportedTemporaryVariables, UInt(instanceInfo.scriptVariableLength.W))) // Temporary variables
})
//
// Temp input
//
val inputLocalGlobalVariables = io.inputLocalGlobalVariables
val inputTempVariables = io.inputTempVariables
val inputPin = io.inputPin.asUInt
//
// Output pins
//
val outputPin = WireInit(0.U(instanceInfo.numberOfPins.W))
val outputLocalGlobalVariables = WireInit(
VecInit(Seq.fill(instanceInfo.numberOfSupportedLocalAndGlobalVariables)(0.U(instanceInfo.scriptVariableLength.W)))
) // Local (and Global) variables
val outputTempVariables = WireInit(
VecInit(Seq.fill(instanceInfo.numberOfSupportedTemporaryVariables)(0.U(instanceInfo.scriptVariableLength.W)))
) // Temporary variables
//
// Assign operator type (split the signal into only usable part)
//
LogInfo(debug)("Usable size of Type in the SYMBOL: " + ScriptDataTypes().getWidth)
val mainOperatorType = io.operator.Type(ScriptDataTypes().getWidth - 1, 0).asTypeOf(ScriptDataTypes())
//
// *** Implementing the setting data logic ***
//
//
// Apply the chip enable signal
//
when(io.en === true.B) {
switch(mainOperatorType) {
is(symbolUndefined) {
//
// In case of undefined SET value, just pass every input to the next step
//
outputPin := inputPin
outputLocalGlobalVariables := inputLocalGlobalVariables
outputTempVariables := inputTempVariables
}
is(symbolGlobalIdType) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.assign_local_global_var) == true) {
//
// Set the local (and global) variables
//
outputPin := inputPin
outputLocalGlobalVariables := inputLocalGlobalVariables
outputTempVariables := inputTempVariables
//
// Set the target variable
//
outputLocalGlobalVariables(io.operator.Value) := io.inputValue
}
}
is(symbolLocalIdType) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.assign_local_global_var) == true) {
//
// Set the target local/global variable
//
outputPin := inputPin
outputLocalGlobalVariables := inputLocalGlobalVariables
outputTempVariables := inputTempVariables
//
// Set the target local/global variable
//
outputLocalGlobalVariables(io.operator.Value) := io.inputValue
}
}
is(symbolRegisterType) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.assign_registers) == true) {
when(instanceInfo.numberOfPins.U > io.operator.Value) {
//
// *** Used for setting the pin value ***
//
//
// Registers are pins (set the value based on less significant bit)
//
val tempShiftedBit = (1.U << io.operator.Value)
when(io.inputValue(0) === 1.U) {
outputPin := inputPin | tempShiftedBit; // Set the N-th bit to 1
}.otherwise {
outputPin := inputPin & ~tempShiftedBit; // Clear the N-th bit to 0
}
}.otherwise {
//
// *** Used for setting the port value ***
//
//
// Iterate based on port configuration
//
var currentPortNum: Int = 0
val numPorts = instanceInfo.portsConfiguration.length
for ((port, index) <- instanceInfo.portsConfiguration.zipWithIndex) {
LogInfo(debug)(f"========================= port assignment (${index} - port size: ${port}) =========================")
when(io.operator.Value === (index + instanceInfo.numberOfPins).U) {
//
// If the current port's bit width is bigger than the script variable length,
// we need to append zero
//
val targetInputValue = WireInit(0.U(port.W))
if (port > instanceInfo.scriptVariableLength) {
//
// Since the port size is bigger than the variable size,
// we need to append zeros to the target value
//
LogInfo(debug)(
f"Appending zeros (${port - instanceInfo.scriptVariableLength}) to input variable (targetInputValue) to support port num: ${index}"
)
targetInputValue := Cat(io.inputValue, 0.U((port - instanceInfo.scriptVariableLength).W))
} else {
//
// Since the variable size is bigger than the port size,
// we need only a portion of the input value
//
targetInputValue := io.inputValue(port - 1, 0)
}
//
// Determine the range of bits to be modified
//
val high = currentPortNum + port - 1
val low = currentPortNum
// Create the modified outputPin based on whether it's the first, last or a middle port
val modifiedOutputPin = if (index == 0) {
//
// First port: keep higher bits unchanged, set lower bits to input value
//
LogInfo(debug)(
f"Set connecting index=${index} - inputPin(${instanceInfo.numberOfPins - 1}, ${high + 1}) + targetInputValue(${port - 1}, 0)"
)
Cat(
inputPin(instanceInfo.numberOfPins - 1, high + 1), // Bits above the range to keep unchanged
targetInputValue // New value for the specified range
)
} else if (index == numPorts - 1) {
//
// Last port: keep lower bits unchanged, set higher bits to input value
//
LogInfo(debug)(f"Set connecting index=${index} - targetInputValue(${port - 1}, 0) + inputPin(${low - 1}, 0)")
Cat(
targetInputValue, // New value for the specified range
inputPin(low - 1, 0) // Bits below the range to keep unchanged
)
} else {
//
// Middle port: keep both higher and lower bits unchanged
//
LogInfo(debug)(
f"Set connecting index=${index} - inputPin(${instanceInfo.numberOfPins - 1}, ${high + 1}) + targetInputValue(${port - 1}, 0) + inputPin(${low - 1}, 0)"
)
Cat(
inputPin(instanceInfo.numberOfPins - 1, high + 1), // Bits above the range to keep unchanged
targetInputValue, // New value for the specified range
inputPin(low - 1, 0) // Bits below the range to keep unchanged
)
}
//
// Assign the modified outputPin back to outputPin
//
outputPin := modifiedOutputPin
}
currentPortNum += port
}
}
outputLocalGlobalVariables := inputLocalGlobalVariables
outputTempVariables := inputTempVariables
}
}
is(symbolPseudoRegType) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.assign_pseudo_registers) == true) {
//
// To be implemented
//
outputPin := 0.U
outputLocalGlobalVariables := inputLocalGlobalVariables
outputTempVariables := inputTempVariables
}
}
is(symbolStackIndexType) {
if (HwdbgScriptCapabilities.isCapabilitySupported(instanceInfo.scriptCapabilities, HwdbgScriptCapabilities.stack_assignments) == true) {
//
// To be implemented
//
outputPin := inputPin
outputLocalGlobalVariables := inputLocalGlobalVariables
outputTempVariables := inputTempVariables
}
}
is(symbolTempType) {
if (
HwdbgScriptCapabilities.isCapabilitySupported(
instanceInfo.scriptCapabilities,
HwdbgScriptCapabilities.conditional_statements_and_comparison_operators
) == true
) {
//
// Set the temporary variables
//
outputPin := inputPin
outputLocalGlobalVariables := inputLocalGlobalVariables
outputTempVariables := inputTempVariables
//
// Set the target temporary variable
//
outputTempVariables(io.operator.Value) := io.inputValue
}
}
}
}
//
// Connect the output signals
//
io.outputLocalGlobalVariables := outputLocalGlobalVariables
io.outputTempVariables := outputTempVariables
for (i <- 0 until instanceInfo.numberOfPins) {
io.outputPin(i) := outputPin(i)
}
}
object ScriptEngineSetValue {
def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
)(
en: Bool,
operator: HwdbgShortSymbol,
inputLocalGlobalVariables: Vec[UInt],
inputTempVariables: Vec[UInt],
inputValue: UInt,
inputPin: Vec[UInt]
): (Vec[UInt], Vec[UInt], Vec[UInt]) = {
val scriptEngineSetValueModule = Module(
new ScriptEngineSetValue(
debug,
instanceInfo
)
)
val outputPin = Wire(Vec(instanceInfo.numberOfPins, UInt(1.W)))
val outputLocalGlobalVariables = Wire(Vec(instanceInfo.numberOfSupportedLocalAndGlobalVariables, UInt(instanceInfo.scriptVariableLength.W)))
val outputTempVariables = Wire(Vec(instanceInfo.numberOfSupportedTemporaryVariables, UInt(instanceInfo.scriptVariableLength.W)))
//
// Configure the input signals
//
scriptEngineSetValueModule.io.en := en
scriptEngineSetValueModule.io.operator := operator
scriptEngineSetValueModule.io.inputLocalGlobalVariables := inputLocalGlobalVariables
scriptEngineSetValueModule.io.inputTempVariables := inputTempVariables
scriptEngineSetValueModule.io.inputValue := inputValue
scriptEngineSetValueModule.io.inputPin := inputPin
//
// Configure the output signal
//
outputPin := scriptEngineSetValueModule.io.outputPin
outputLocalGlobalVariables := scriptEngineSetValueModule.io.outputLocalGlobalVariables
outputTempVariables := scriptEngineSetValueModule.io.outputTempVariables
//
// Return the output result
//
(
outputPin,
outputLocalGlobalVariables,
outputTempVariables
)
}
}

View file

@ -0,0 +1,183 @@
/**
* @file
* communication.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Data types for the communication
* @details
* @version 0.1
* @date
* 2024-04-08
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.types
import chisel3._
// -----------------------------------------------------------------------
//
// Structure in C:
//
// typedef struct _DEBUGGER_REMOTE_PACKET
// {
// BYTE Checksum;
// UINT64 Indicator; /* Shows the type of the packet */
// DEBUGGER_REMOTE_PACKET_TYPE TypeOfThePacket;
// DEBUGGER_REMOTE_PACKET_REQUESTED_ACTION RequestedActionOfThePacket;
//
// } DEBUGGER_REMOTE_PACKET, *PDEBUGGER_REMOTE_PACKET;
//
/**
* @brief
* The packet used for communication with the remote debugger
*/
class DebuggerRemotePacket() extends Bundle {
//
// Structure fields
//
val Checksum = UInt(8.W) // 1 bytes
val Alignment0 = UInt((64 - 8).W) // 7 bytes
val Indicator = UInt(64.W) // 8 bytes
val TypeOfThePacket = UInt(32.W) // 4 bytes
val RequestedActionOfThePacket = UInt(32.W) // 4 bytes
//
// Offset of structure fields
//
object Offset {
val checksum = (0) / 8
val indicator = (Checksum.getWidth + Alignment0.getWidth) / 8
val typeOfThePacket = (Checksum.getWidth + Alignment0.getWidth + Indicator.getWidth) / 8
val requestedActionOfThePacket = (Checksum.getWidth + Alignment0.getWidth + Indicator.getWidth + TypeOfThePacket.getWidth) / 8
val startOfDataBuffer =
(Checksum.getWidth + Alignment0.getWidth + Indicator.getWidth + TypeOfThePacket.getWidth + RequestedActionOfThePacket.getWidth) / 8
}
}
// -----------------------------------------------------------------------
//
// Structure in C:
//
// typedef struct _HWDBG_PORT_INFORMATION
// {
// UINT32 CountOfPorts;
//
// /*
//
// Here the pin information details will be available.
//
// UINT32
// Port Size
//
// */
//
// } HWDBG_PORT_INFORMATION, *PHWDBG_PORT_INFORMATION;
/**
* @brief
* The structure of port information in hwdbg
*/
class HwdbgPortInformation() extends Bundle {
//
// Structure fields
//
val CountOfPorts = UInt(32.W) // 4 bytes
//
// Offset of structure fields
//
object Offset {
val countOfPorts = (0) / 8
}
}
// -----------------------------------------------------------------------
//
// Structure in C:
//
// typedef struct _HWDBG_PORT_INFORMATION_ITEMS
// {
// UINT32 PortIndex;
//
// } HWDBG_PORT_INFORMATION_ITEMS, *PHWDBG_PORT_INFORMATION_ITEMS;
/**
* @brief
* The structure of port information (each item) in hwdbg
*/
class HwdbgPortInformationItems() extends Bundle {
//
// Structure fields
//
val PortSize = UInt(32.W) // 4 bytes
//
// Offset of structure fields
//
object Offset {
val portSize = (0) / 8
}
}
// -----------------------------------------------------------------------
/**
* @brief
* Different action of hwdbg (SHARED WITH HYPERDBG) (HWDBG_ACTION_ENUMS)
* @warning
* Used in HyperDbg
*/
object HwdbgActionEnums extends Enumeration {
val hwdbgActionSendInstanceInfo = Value(1)
val hwdbgActionConfigureScriptBuffer = Value(2)
}
// -----------------------------------------------------------------------
/**
* @brief
* Different responses of hwdbg (SHARED WITH HYPERDBG) (HWDBG_RESPONSE_ENUMS)
* @warning
* Used in HyperDbg
*/
object HwdbgResponseEnums extends Enumeration {
val hwdbgResponseSuccessOrErrorMessage = Value(1)
val hwdbgResponseInstanceInfo = Value(2)
}
// -----------------------------------------------------------------------
/**
* @brief
* Different responses of hwdbg (SHARED WITH HYPERDBG) (HWDBG_ERROR_ENUMS)
* @warning
*/
object HwdbgSuccessOrErrorEnums extends Enumeration {
val hwdbgOperationWasSuccessful = Value(0x7fffffff)
val hwdbgErrorInvalidPacket = Value(1)
}
// -----------------------------------------------------------------------

View file

@ -0,0 +1,71 @@
/**
* @file
* stage.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Data types related to stage registers
* @details
* @version 0.1
* @date
* 2024-05-07
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.stage
import chisel3._
import chisel3.util.log2Ceil
import hwdbg.configs._
import hwdbg.script._
class Stage(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
instanceInfo: HwdbgInstanceInformation
) extends Bundle {
val pinValues = Vec(
instanceInfo.numberOfPins,
UInt(1.W)
) // The value of each pin in each stage (should be passed to the next stage)
val stageSymbol = new HwdbgShortSymbol(
instanceInfo.scriptVariableLength
) // Interpreted script symbol for the target stage (should NOT be passed to the next stage)
val getOperatorSymbol = Vec(
instanceInfo.maximumNumberOfSupportedGetScriptOperators,
new HwdbgShortSymbol(instanceInfo.scriptVariableLength)
) // GET symbol operand (should NOT be passed to the next stage)
val setOperatorSymbol = Vec(
instanceInfo.maximumNumberOfSupportedSetScriptOperators,
new HwdbgShortSymbol(instanceInfo.scriptVariableLength)
) // SET symbol operand (should NOT be passed to the next stage)
val targetStage = UInt(
log2Ceil(
instanceInfo.maximumNumberOfStages * (instanceInfo.maximumNumberOfSupportedGetScriptOperators + instanceInfo.maximumNumberOfSupportedSetScriptOperators + 1)
).W
) // Target stage that needs to be executed for the current pin values (should be passed to the next stage)
val tempVariables = Vec(
instanceInfo.numberOfSupportedTemporaryVariables,
UInt(instanceInfo.scriptVariableLength.W)
) // Temporary variables
val localGlobalVariables = Vec(
instanceInfo.numberOfSupportedLocalAndGlobalVariables,
UInt(instanceInfo.scriptVariableLength.W)
) // Local (and Global) variables
val stageIndex = UInt(
log2Ceil(
instanceInfo.maximumNumberOfStages * (instanceInfo.maximumNumberOfSupportedGetScriptOperators + instanceInfo.maximumNumberOfSupportedSetScriptOperators + 1)
).W
) // Target stage index of the current stage (configured with script configuration and remains constant during execution)
val stageEnable = Bool() // Target stage is enabled (configured) or not
}

View file

@ -0,0 +1,59 @@
/**
* @file
* utils.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* Different utilities and functionalities
* @details
* @version 0.1
* @date
* 2024-04-12
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.utils
import chisel3._
import chisel3.util._
/**
* @brief
* Create logs and debug messages
*/
object LogInfo {
def apply(debug: Boolean)(message: String): Unit = {
if (debug) {
println("[*] debug msg: " + message)
}
}
}
object BitwiseFunction {
def getFirstNBits(num: Long, n: Int): Long = {
val mask = (1L << n) - 1 // Create a bitmask with the first 'n' bits set to 1
val shifted = num >>> (java.lang.Long.SIZE - n) // Shift the bits to the right to keep the first 'n' bits
val firstNBits = shifted & mask // Extract the first 'n' bits by performing a bitwise AND operation
firstNBits
}
def getBitsInRange(num: Long, start: Int, end: Int): Long = {
require(start >= 0 && start <= 63, "Starting point must be between 0 and 63")
require(end >= 0 && end <= 63, "Ending point must be between 0 and 63")
require(start <= end, "Starting point must be less than or equal to ending point")
val numBits = end - start + 1 // Number of bits in the range
val mask = (1L << numBits) - 1 // Create a bitmask with 'numBits' bits set to 1
val shifted = num >>> (java.lang.Long.SIZE - end - 1) // Shift the bits to the right to align the range with the rightmost position
val bitsInRange = shifted & mask // Extract the bits within the specified range
bitsInRange
}
}

View file

@ -0,0 +1,143 @@
/**
* @file
* top.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* hwdbg's top module
* @details
* @version 0.1
* @date
* 2024-04-03
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg
import chisel3._
import circt.stage.ChiselStage
import hwdbg._
import hwdbg.configs._
class DebuggerModule(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
numberOfPins: Int,
maximumNumberOfStages: Int,
maximumNumberOfSupportedGetScriptOperators: Int,
maximumNumberOfSupportedSetScriptOperators: Int,
sharedMemorySize: Int,
debuggerAreaOffset: Int,
debuggeeAreaOffset: Int,
scriptVariableLength: Int,
numberOfSupportedLocalAndGlobalVariables: Int,
numberOfSupportedTemporaryVariables: Int,
scriptCapabilities: Seq[Long],
bramAddrWidth: Int,
bramDataWidth: Int,
portsConfiguration: Array[Int]
) extends Module {
val io = IO(new Bundle {
//
// Chip signals
//
val en = Input(Bool()) // chip enable signal
//
// Input/Output signals
//
val inputPin = Input(Vec(numberOfPins, UInt(1.W))) // input pins
val outputPin = Output(Vec(numberOfPins, UInt(1.W))) // output pins
//
// Interrupt signals (lines)
//
val plInSignal = Input(Bool()) // PS to PL signal
val psOutInterrupt = Output(Bool()) // PL to PS interrupt
//
// BRAM (Block RAM) ports
//
val rdWrAddr = Output(UInt(bramAddrWidth.W)) // read/write address
val rdData = Input(UInt(bramDataWidth.W)) // read data
val wrEna = Output(Bool()) // enable writing
val wrData = Output(UInt(bramDataWidth.W)) // write data
})
//
// Instantiate the debugger's main module
//
val (outputPin, psOutInterrupt, rdWrAddr, wrEna, wrData) =
DebuggerMain(
debug,
numberOfPins,
maximumNumberOfStages,
maximumNumberOfSupportedGetScriptOperators,
maximumNumberOfSupportedSetScriptOperators,
sharedMemorySize,
debuggerAreaOffset,
debuggeeAreaOffset,
scriptVariableLength,
numberOfSupportedLocalAndGlobalVariables,
numberOfSupportedTemporaryVariables,
scriptCapabilities,
bramAddrWidth,
bramDataWidth,
portsConfiguration
)(
io.en,
io.inputPin,
io.plInSignal,
io.rdData
)
io.outputPin := outputPin
io.psOutInterrupt := psOutInterrupt
io.rdWrAddr := rdWrAddr
io.wrEna := wrEna
io.wrData := wrData
}
object Main extends App {
//
// Load configuration from JSON file
//
LoadConfiguration.loadFromJson("src/main/scala/hwdbg/configs/config.json")
//
// Generate hwdbg verilog files
//
println(
ChiselStage.emitSystemVerilog(
new DebuggerModule(
DebuggerConfigurations.ENABLE_DEBUG,
DebuggerConfigurations.NUMBER_OF_PINS,
ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_STAGES,
ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_GET_SCRIPT_OPERATORS,
ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_SET_SCRIPT_OPERATORS,
MemoryCommunicationConfigurations.DEFAULT_CONFIGURATION_INITIALIZED_MEMORY_SIZE,
MemoryCommunicationConfigurations.BASE_ADDRESS_OF_PS_TO_PL_COMMUNICATION,
MemoryCommunicationConfigurations.BASE_ADDRESS_OF_PL_TO_PS_COMMUNICATION,
ScriptEngineConfigurations.SCRIPT_VARIABLE_LENGTH,
ScriptEngineConfigurations.NUMBER_OF_SUPPORTED_LOCAL_AND_GLOBAL_VARIABLES,
ScriptEngineConfigurations.NUMBER_OF_SUPPORTED_TEMPORARY_VARIABLES,
ScriptEngineConfigurations.SCRIPT_ENGINE_EVAL_CAPABILITIES,
MemoryCommunicationConfigurations.BLOCK_RAM_ADDR_WIDTH,
MemoryCommunicationConfigurations.BLOCK_RAM_DATA_WIDTH,
DebuggerConfigurations.PORT_PINS_MAP
),
firtoolOpts = Array(
"-disable-all-randomization",
// "-strip-debug-info",
"--split-verilog", // The intention for this argument (and next argument) is to separate generated files.
"-o",
"generated/"
)
)
)
}

View file

@ -0,0 +1,176 @@
/**
* @file
* top_test.scala
* @author
* Sina Karvandi (sina@hyperdbg.org)
* @brief
* hwdbg's top module (with BRAM) for testing
* @details
* @version 0.1
* @date
* 2024-04-04
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg
import chisel3._
import circt.stage.ChiselStage
import hwdbg._
import hwdbg.configs._
import hwdbg.libs.mem._
class DebuggerModuleTestingBRAM(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
numberOfPins: Int,
maximumNumberOfStages: Int,
maximumNumberOfSupportedGetScriptOperators: Int,
maximumNumberOfSupportedSetScriptOperators: Int,
sharedMemorySize: Int,
debuggerAreaOffset: Int,
debuggeeAreaOffset: Int,
scriptVariableLength: Int,
numberOfSupportedLocalAndGlobalVariables: Int,
numberOfSupportedTemporaryVariables: Int,
scriptCapabilities: Seq[Long],
bramAddrWidth: Int,
bramDataWidth: Int,
portsConfiguration: Array[Int]
) extends Module {
val io = IO(new Bundle {
//
// Chip signals
//
val en = Input(Bool()) // chip enable signal
//
// Input/Output signals
//
val inputPin = Input(Vec(numberOfPins, UInt(1.W))) // input pins
val outputPin = Output(Vec(numberOfPins, UInt(1.W))) // output pins
//
// Interrupt signals (lines)
//
val plInSignal = Input(Bool()) // PS to PL signal
val psOutInterrupt = Output(Bool()) // PL to PS interrupt
//
// *** BRAM (Block RAM) ports are initialized from an external file ***
//
})
val bramEn = WireInit(false.B)
val bramWrite = WireInit(false.B)
val bramAddr = WireInit(0.U(bramAddrWidth.W))
val bramDataIn = WireInit(0.U(bramDataWidth.W))
val bramDataOut = WireInit(0.U(bramDataWidth.W))
//
// Instantiate the BRAM memory initializer module
//
val dataOut =
InitRegMemFromFile(
debug,
MemoryCommunicationConfigurations.ENABLE_BLOCK_RAM_DELAY,
TestingConfigurations.BRAM_INITIALIZATION_FILE_PATH,
bramAddrWidth,
bramDataWidth,
MemoryCommunicationConfigurations.DEFAULT_CONFIGURATION_INITIALIZED_MEMORY_SIZE
)(
bramEn,
bramWrite,
bramAddr,
bramDataIn
)
bramDataOut := dataOut
//
// Instantiate the debugger's main module
//
val (outputPin, psOutInterrupt, rdWrAddr, wrEna, wrData) =
DebuggerMain(
debug,
numberOfPins,
maximumNumberOfStages,
maximumNumberOfSupportedGetScriptOperators,
maximumNumberOfSupportedSetScriptOperators,
sharedMemorySize,
debuggerAreaOffset,
debuggeeAreaOffset,
scriptVariableLength,
numberOfSupportedLocalAndGlobalVariables,
numberOfSupportedTemporaryVariables,
scriptCapabilities,
bramAddrWidth,
bramDataWidth,
portsConfiguration
)(
io.en,
io.inputPin,
io.plInSignal,
bramDataOut
)
//
// Connect BRAM Pins
//
bramEn := io.en // enable BRAM when the main chip enabled
bramAddr := rdWrAddr
bramWrite := wrEna
bramDataIn := wrData
//
// Connect I/O pins
//
io.outputPin := outputPin
io.psOutInterrupt := psOutInterrupt
}
object MainWithInitializedBRAM extends App {
//
// Load configuration from JSON file
//
LoadConfiguration.loadFromJson("src/main/scala/hwdbg/configs/config.json")
//
// Generate hwdbg verilog files
//
println(
ChiselStage.emitSystemVerilog(
new DebuggerModuleTestingBRAM(
DebuggerConfigurations.ENABLE_DEBUG,
DebuggerConfigurations.NUMBER_OF_PINS,
ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_STAGES,
ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_GET_SCRIPT_OPERATORS,
ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_SET_SCRIPT_OPERATORS,
MemoryCommunicationConfigurations.DEFAULT_CONFIGURATION_INITIALIZED_MEMORY_SIZE,
MemoryCommunicationConfigurations.BASE_ADDRESS_OF_PS_TO_PL_COMMUNICATION,
MemoryCommunicationConfigurations.BASE_ADDRESS_OF_PL_TO_PS_COMMUNICATION,
ScriptEngineConfigurations.SCRIPT_VARIABLE_LENGTH,
ScriptEngineConfigurations.NUMBER_OF_SUPPORTED_LOCAL_AND_GLOBAL_VARIABLES,
ScriptEngineConfigurations.NUMBER_OF_SUPPORTED_TEMPORARY_VARIABLES,
ScriptEngineConfigurations.SCRIPT_ENGINE_EVAL_CAPABILITIES,
MemoryCommunicationConfigurations.BLOCK_RAM_ADDR_WIDTH,
MemoryCommunicationConfigurations.BLOCK_RAM_DATA_WIDTH,
DebuggerConfigurations.PORT_PINS_MAP
),
firtoolOpts = Array(
"-disable-all-randomization",
// "-strip-debug-info",
"--lowering-options=disallowLocalVariables", // because icarus doesn't support 'automatic logic', this option prevents such logics
"--split-verilog", // The intention for this argument (and next argument) is to separate generated files.
"-o",
"generated/"
)
)
)
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,64 @@
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03/08/2024 04:39:27 PM
// Design Name:
// Module Name: PL_CORE
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module PL_CORE(
(* clock_buffer_type="none" *) input wire QDR4_CLK_100MHZ_P,
(* clock_buffer_type="none" *) input wire QDR4_CLK_100MHZ_N,
// input wire reg_clk,
input wire uart_rx_line,
// input wire reg_eop,
// input logic SPI_nCS,
// output wire clk_reg_out,
output wire uart_tx_line,
// output logic laser_module_trigger,
output wire [3:0] led_out_ff
);
wire clk_main;
clk_wiz_11 clock_main
(
// Clock out ports
.clk_main(clk_main), // output clk_main
// Status and control signals
.reset(reset), // input reset
.locked(locked), // output locked
// Clock in ports
.clk_in1_p(QDR4_CLK_100MHZ_P), // input clk_in1_p
.clk_in1_n(QDR4_CLK_100MHZ_N) // input clk_in1_n
);
UART_FF UART_FF_INS (
.clk (clk_main),
.rst ('b0),
.reg_clk (clk_main),
.reg_eop (clk_main),
.uart_rx_line (uart_rx_line),
.uart_tx_line (uart_tx_line),
.gpio (gpio),
.led_out_ff (led_out_ff)
);
endmodule

View file

@ -0,0 +1,89 @@
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11/16/2023 02:48:20 PM
// Design Name:
// Module Name: ff_fanout
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module ff_fanout(
input wire clk,
input wire CE,
input wire rst,
input wire inp,
output reg res
);
//reg rst_em; // input clock on FPGA
//reg[27:0] counter=28'd0;
//parameter DIVISOR = 28'd1;
//// The frequency of the output clk_out
//// = The frequency of the input clk_in divided by DIVISOR
//// For example: Fclk_in = 50Mhz, if you want to get 1Hz signal to blink LEDs
//// You will modify the DIVISOR parameter value to 28'd50.000.000
//// Then the frequency of the output clk_out = 50Mhz/50.000.000 = 1Hz
//always @(posedge rst)
//begin
// counter <= counter + 28'd1;
// if(counter>=(DIVISOR-1))
// counter <= 28'd0;
// rst_em <= (counter<DIVISOR/2)?1'b1:1'b0;
//end
localparam size_i = 256;
(* S = "TRUE" *) (* KEEP = "TRUE" *) wire [size_i-1:0] q_output;
(* S = "TRUE" *) (* KEEP = "TRUE" *) wire [size_i-1:0] d_input;
assign d_input = ({size_i{inp}});
wire CLR;
assign CLR= 1'b0;
always @(posedge clk)begin
res <= &q_output;
end
(* S = "TRUE" *) (* KEEP = "TRUE" *) FDRE #(.INIT(1'b0)) FDRE_inst[size_i-1:0](
.Q(q_output),
.C(clk),
.CE(1'b1),
.R(rst),
.D(d_input)
);
// (* S = "TRUE" *) (* KEEP = "TRUE" *) FDRE #(.INIT(1'b0)) FDRE_inst[size_i-1:0](
// .Q(q_output),
// .C(clk),
// .CE(CE),
// .R(1'b0),
// .D(d_input)
// );
endmodule

View file

@ -0,0 +1,78 @@
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 06/20/2024 10:21:57 AM
// Design Name:
// Module Name: freq_generator
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module freq_generator(
input logic clk_in, // Input clock
input logic reset, // Reset signal
input logic [31:0] div_int, // Integer part of the division factor
input logic [31:0] div_frac, // Fractional part of the division factor (in fixed-point format, e.g., 0.5 = 32'd50000000)
output logic clk_out // Output clock
);
logic [31:0] int_counter;
logic [31:0] frac_counter;
logic frac_tick;
logic clk_out_internal;
// Integer Clock Division Logic
always_ff @(posedge clk_in or posedge reset) begin
if (reset) begin
int_counter <= 32'd0;
clk_out_internal <= 1'b0;
end else begin
if (int_counter >= (div_int - 1)) begin
int_counter <= 32'd0;
clk_out_internal <= ~clk_out_internal;
end else begin
int_counter <= int_counter + 1;
end
end
end
// Fractional Clock Division Logic
always_ff @(posedge clk_in or posedge reset) begin
if (reset) begin
frac_counter <= 32'd0;
frac_tick <= 1'b0;
end else begin
frac_counter <= frac_counter + div_frac;
if (frac_counter >= 32'd100000000) begin // When the counter exceeds 1.0 in fixed-point format
frac_counter <= frac_counter - 32'd100000000;
frac_tick <= 1'b1;
end else begin
frac_tick <= 1'b0;
end
end
end
// Combine Integer and Fractional Divisions
always_ff @(posedge clk_in or posedge reset) begin
if (reset) begin
clk_out <= 1'b0;
end else if (int_counter == 0 && frac_tick) begin
clk_out <= ~clk_out_internal;
end else begin
clk_out <= clk_out_internal;
end
end
endmodule

View file

@ -0,0 +1,29 @@
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 08/29/2023 01:50:41 PM
// Design Name:
// Module Name: inverter
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module inverter(
in_data,out_data
);
input in_data;
output out_data;
(* dont_touch = "yes" *) assign out_data = !in_data;
endmodule

Some files were not shown because too many files have changed in this diff Show more