Commit Graph

7 Commits

Author SHA1 Message Date
Frinzell, Aaron 2181416bd9 Update type hints
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2024-09-10 16:38:28 -07:00
Dan Scott f19760c63c Replace print() with logger.log()
Signed-off-by: Dan Scott <dan.scott@intel.com>
2024-08-05 16:35:54 -07:00
Nicolas Iooss 6d52c2c54f Add type hints to helper.linuxnative.cpuid
With these annotations, mypy no longer report any issues in strict mode:

    $ mypy --strict chipsec/helper/linuxnative/cpuid.py
    Success: no issues found in 1 source file

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-06-20 16:37:01 -07:00
Nicolas Iooss f0ebbe01cc Simplify CPUID code mapping in linuxnative helper
Make the machine code `bytes` instead of `list`. This makes it no longer
necessary to cast it to `c_ubyte * size` before using it.

While at it, add `mmap.MAP_PRIVATE` flag to the mapping, as it is not
needed to create a `MAP_SHARED` mapping for the code (which is the
default flag).

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-06-20 16:37:01 -07:00
Nicolas Iooss fb80548746 Remove print_function import
Now that chipsec is no longer compatible with Python2, this import is no
longer useful.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-06-20 16:37:01 -07:00
Nicolas Iooss 470820d464 Use c_void_p instead of c_voidp
`ctypes.c_voidp` was a bug which is kept in ctypes for backward
compatibility. This is documented in
https://github.com/python/cpython/blob/3.10/Lib/ctypes/__init__.py#L246
:

    c_voidp = c_void_p # backwards compatibility (to a bug)

Replace the use of `c_voidp` with `c_void_p`.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-06-20 16:37:01 -07:00
Nathaniel Mitchell 89be1b4ad8 Remove native and add linuxnative as seperate helper
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-05-17 16:36:30 -07:00