This application will show some information about the CPU.
More...
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <UEFIStarter/core.h>
|
#define | CI(NAME, REGISTER, BIT) Print(L ## #NAME ": %d\n",(REGISTER&1<<BIT)>0) |
| helper macro to quickly output a CPUID flag More...
|
|
|
void | cpuid () |
| Prints the CPU's vendor ID and a few of the capability flags.
|
|
UINT64 | rdmsr (UINT64 rcx) |
| Reads a CPU's model-specific register. More...
|
|
void | read_msrs () |
| Prints a selection of model-specific CPU registers. More...
|
|
void | handler () |
| Interrupt handler, this will be registered by test_idt() and should get called when signalling the interrupt there. More...
|
|
void | write_idt_entry_address (void *entry_base, void *func) |
| Writes an interrupt handler address into the IDT. More...
|
|
void | test_idt () |
| Tests whether interrupt handlers can be registered. More...
|
|
INTN EFIAPI | ShellAppMain (UINTN argc, CHAR16 **argv) |
| Main function, gets invoked by UEFI shell. More...
|
|
This application will show some information about the CPU.
- Author
- Richard Nusser
- Copyright
- 2017-2018 Richard Nusser
- License
- GPLv3 (see http://www.gnu.org/licenses/)
- See also
- https://github.com/rinusser/UEFIStarter
◆ CI
#define CI |
( |
|
NAME, |
|
|
|
REGISTER, |
|
|
|
BIT |
|
) |
| Print(L ## #NAME ": %d\n",(REGISTER&1<<BIT)>0) |
helper macro to quickly output a CPUID flag
- Parameters
-
NAME | the flag's name |
REGISTER | the variable to read from |
BIT | the flag's bit offset |
◆ rdmsr()
UINT64 rdmsr |
( |
UINT64 |
rcx | ) |
|
Reads a CPU's model-specific register.
- Parameters
-
rcx | the register selector for the RDMSR instruction |
- Returns
- the register's value
◆ read_msrs()
Prints a selection of model-specific CPU registers.
Currently the selection is very narrow: the function just prints the APIC base address.
◆ handler()
Interrupt handler, this will be registered by test_idt() and should get called when signalling the interrupt there.
This will set rax (the return register) to the current instruction pointer.
◆ write_idt_entry_address()
void write_idt_entry_address |
( |
void * |
entry_base, |
|
|
void * |
func |
|
) |
| |
Writes an interrupt handler address into the IDT.
- Parameters
-
entry_base | the start of the IDT entry to write to |
func | the handler's address |
◆ test_idt()
Tests whether interrupt handlers can be registered.
This will register handler() as the handling function for INT 3, then signal INT 3. The handler should get called and should return its instruction pointer (which should be very close to handler()'s address). This function checks the returned instruction pointer.
◆ ShellAppMain()
INTN EFIAPI ShellAppMain |
( |
UINTN |
argc, |
|
|
CHAR16 ** |
argv |
|
) |
| |
Main function, gets invoked by UEFI shell.
- Parameters
-
argc | the number of command-line arguments passed |
argv | the command-line arguments passed |
- Returns
- an EFI status code for the shell