Commit Graph
33 Commits
Author SHA1 Message Date
Lionel Debroux 2a04ce6a6b Improve the IMC reading code by including IMC support files into system/*/memctrl.c: the Makefile becomes simpler, the build becomes faster, the redundant includes can go away, the resulting binary is more optimized. 2026-07-20 09:30:42 +02:00
Lionel Debroux 7273d36c54 Inline several functions which are simple or have a single caller, to save a bit of space. 2026-07-20 09:30:42 +02:00
Lionel Debroux d2c7cdfec9 Silence GCC 15+ warning on the GPT signature in a portable way, by using an array of bytes, like for the Basic Data Partition GUID. 2026-07-12 18:53:07 +02:00
Lionel Debroux 778cf00e1d Minimal fixup for #405: the 32-bit x86 binary started freezing reliably and quickly after 6f4ec848c4e9291626236bca457baf7b95542325; in app/main.c::run_at(), change the way the jump to the new start_address is performed on 32-bit x86. 2025-10-26 09:50:17 +01:00
Lionel DebrouxandCalvin Owens 6f4ec848c4 Help the code build with contemporary Clang & LLD. (#405)
* rework the PTE definition macros to completely avoid recursivity, so as not to have to special-case Clang which has a low default recursivity limit;
* replace a non-portable goto construct in app/main.c;
* make tools overridable in i586 and x86_64 Makefiles;
* let go of --warn-constructors flag to ld: lld doesn't support it and ld's manual indicates that it does nothing on COFF and ELF;
* don't discard .shstrtab section: lld somehow requires it, and keeping it doesn't change the final binary on ld anyway;
* don't discard .rela.dyn: lld produces an improper binary otherwise, but it doesn't change the final binary with ld;
* use out of line versions of memcpy() and memset() on Clang: sadly, the built-in versions are not up to the task of generating efficient inline versions.

Co-authored-by: Calvin Owens <calvin@wbinvd.org>
2025-10-07 15:39:22 +02:00
Lionel Debrouxand01e3 a935afd50a Avoid unnecessary Frame Buffer updates (#543)
Frame Buffer updates are expensive, let's instead uses these CPU cycles
for testing RAM...

Co-authored-by: 01e3 <01e3@ans.pl>
2025-09-14 21:36:34 +02:00
Lionel DebrouxandSam Demeulemeester f19066d258 Update Intel i801 PCI device IDs list & Add support for MTL-P (#537)
* Update Intel i801 PCI device IDs list from the Linux driver.

* Add support for MTL-P (eg: NUC 14th Gen)

---------

Co-authored-by: Sam Demeulemeester <github@x86-secret.com>
2025-08-14 12:17:27 +02:00
Lionel Debroux a10664a251 Make paths more uniform across architectures; adjust the build system and Github workflows accordingly.
* move x86/x86-64-specific files to boot/x86, build/i586, build/x86_64, system/x86, system/imc/x86;
* move build64/la64 to build/loongarch64;
* rename system/imc/loongson to system/img/loongarch.
2025-02-24 20:25:29 +01:00
Lionel Debroux e5c4800e58 Github workflow: test build on Ubuntu 24.04 as well. (#488) 2025-02-06 14:09:52 +01:00
Lionel Debroux d2ecbac5fd Add PCI ID for the SMBus controller behind the VT8237S bridge. (#448)
00:11.0 ISA bridge [0601]: VIA Technologies, Inc. VT8237S PCI to ISA Bridge [1106:3372]
2024-11-11 23:57:36 +01:00
Lionel Debroux 8d966d98f4 Refactor the memrw functions to reduce the redundancy. (#415)
The impact is limited now, but will increase when adding support for more architectures and more bit widths.
2024-07-16 08:55:13 +01:00
Lionel Debroux 53ca89f8ae Add initial NUMA awareness support (#378)
* Add a file containing useful macro definitions, currently a single top-level macro for obtaining the size of an array; use it to replace a sizeof(x) / sizeof(x[0]) construct in system/smbus.c . This requires switching the GCC build mode from C11 to C11 with GCC extensions.

* Initial NUMA awareness (#12) support: parse the ACPI SRAT to build up new internal structures related to proximity domains and affinity; use these structures in setup_vm_map() and calculate_chunk() to skip the work on the processors which don't belong to the proximity domain currently being tested.

Tested on a number of 1S single-domain, 2S multi-domain and 4S multi-domain platforms.

SKIP_RANGE(iterations) trick by Martin Whitaker.
2024-03-13 01:43:26 +01:00
Lionel Debroux 9b9c65b968 Reduce padding and relocations (#355)
* Optimize the JEP106 list by using __attribute__((packed)) to remove padding. The x86 & x86_64 series support unaligned accesses just fine, after all, and this is not remotely a hot path.

* Optimize several string-related constructs by switching to fixed-length char arrays, which avoids pointers + relocations.

* app/interrupt.c: array of different-length strings, but most of those are lengthy enough for this to be a clear win, especially on x86_64;
* system/usbhcd.c: array of same-length strings;
* tests/tests.h: array of structs containing same-length strings.

* Reduce the size of the list of tests by using a narrower type for the cpu mode, which reduces padding.
2023-11-29 12:45:17 +01:00
Lionel Debroux 34eb8186fd Significantly optimize test_mov_inv_walk1() for size by moving the ternary operators related to inverse and pattern outside hot paths, which prevents generated code duplication and shortens one of the sides of duplicated loops. (#351)
Before:
   text    data     bss     dec     hex filename
   3019       0       0    3019     bcb build32/tests/mov_inv_walk1.o
   2640       0       0    2640     a50 build64/tests/mov_inv_walk1.o

After:
   text    data     bss     dec     hex filename
   1705       0       0    1705     6a9 build32/tests/mov_inv_walk1.o
   1464       0       0    1464     5b8 build64/tests/mov_inv_walk1.o
2023-11-19 17:14:08 +01:00
Lionel Debroux df803bf294 Fix memory error addresses displayed by badram reporting mode (#308). 2023-07-28 09:39:54 +02:00
Lionel Debroux 8f788b27e1 Add support for configuring the error reporting mode through the command line. Fixes #83. 2023-01-23 15:49:45 +01:00
Lionel Debroux f24e897883 Add support for configuring the CPU sequencing mode through the command line. Reorder tests in app/config.c::parse_option alphabetically. Fixes #82. 2023-01-23 15:49:45 +01:00
Lionel Debroux 3aeda70e24 Move more of the simple string functions to the header, to allow inlining and further optimization.
Before:
   text    data     bss     dec     hex filename
  10374      19    2712   13105    3331 app/config.o
 106854   26720   13344  146918   23de6 memtest_shared
   8734      19    2712   11465    2cc9 app/config.o
 111310   28392  294688  434390   6a0d6 memtest_shared

After:
   text    data     bss     dec     hex filename
  10105      19    2712   12836    3224 app/config.o
 106580   26720   13344  146644   23cd4 memtest_shared
   8653      19    2712   11384    2c78 app/config.o
 110969   28392  294688  434049   69f81 memtest_shared
2023-01-23 15:49:45 +01:00
Lionel Debroux b6992b9ec0 Fix parallel build after d3d52b: boot/setup.S now contains #include "build_version.h", so that file needs to be generated beforehand. (#235) 2023-01-23 15:17:47 +01:00
Lionel Debroux 1c4d7f4089 Document PCI vendor and device IDs for several SMBus controller models from SiS, EFAR and ALi; move the PCI vendor ID defines from system/smbus.h to system/pci.h and add several vendor IDs; use the defines from system/pci.h in system/hwquirks.c. (#154)
Inspired by #126.
2022-09-14 18:57:10 +02:00
Lionel Debroux 408fdb8db6 Switch to an array of heaps in the heap manager, and heap IDs in the allocation functions. 2022-07-25 12:53:21 +02:00
Lionel Debroux 63a07258fd Fix the operation of the SMBus functions which require the SMBus controller ID. 2022-06-08 18:00:50 +02:00
Lionel DebrouxandSam Demeulemeester e86b04a14a Perform major simplification in smbus.c to reduce code size while keeping the functions readable, removing several unused strings and unnecessary arguments passed to several functions.
Add a bunch of PCI device IDs and driver indications for other SMBus controllers, so as to avoid other persons having to do that work again.
Add support for two PIIX4 devices: the standard PIIX4 PCI device ID, and the ServerWorks CSB5, which has a slight twist.

Co-authored-by: Lionel Debroux <lionel_debroux@yahoo.fr>
Co-authored-by: Sam Demeulemeester <sam@x86.fr>
2022-06-06 22:24:09 +02:00
Lionel Debroux c6ff7b1486 Inline the ctype functions, so as to reduce size. 2022-05-21 10:11:45 +02:00
Lionel Debroux cd68333f86 Get rid of memcpy(), as __builtin_memcpy() is globally smaller - and faster anyway - in all current and foreseeable occurrences. 2022-05-21 10:11:37 +02:00
Lionel Debroux 438201195d Get rid of out of line memset(), as __builtin_memset() is not larger - even usually smaller - and faster anyway in all current and foreseeable occurrences. 2022-05-21 10:11:37 +02:00
Lionel Debroux caa07482a0 Reorganize struct spd_infos for better alignment (#2), fix left shifts of count > width of type, fix whitespace, improve comments. 2022-05-19 18:45:13 +02:00
debrouxl c1d0c17f23 Add SPD decoding for SDRAM. 2022-05-19 15:07:09 +02:00
Lionel Debroux ea6e32cb48 Add support for parsing DMI struct type 1 (System Information), whose presence is mandatory, and use it as fallback for DMI struct type 2 (Baseboard Information), which often gives more useful data, but is optional. Fixes part of issue #36. (#39) 2022-04-16 13:40:50 +02:00
Lionel Debroux 5cc72a6bed Fix up the SMBIOS parser so that it doesn't perform all kinds of OOB accesses when dealing with invalid input. (#26) 2022-04-02 15:43:46 +02:00
Lionel Debroux e0d42db07c Optimize the code by declaring several functions static in system/ehci.c.
`size memtest_shared` indicates that this saves 200- (x86) / 200+ (x86_64) bytes, but alignment hides the gain.
2022-03-30 11:54:56 +02:00
Lionel Debroux 3ed9276eb0 Optimize the interrupt handler a bit by using compile-time string concatenation. 2022-02-22 11:00:02 +01:00
Lionel Debroux 7b6855f608 Add CLI arguments for enabling trace. 2022-02-22 10:59:58 +01:00