Skip to content

Commit 6b0f13e

Browse files
committed
Clean up; cpuid is always supported on x86_64 & RSP/SS always pushed (thanks Octocontrabass)
1 parent 7aa4c05 commit 6b0f13e

File tree

4 files changed

+0
-43
lines changed

4 files changed

+0
-43
lines changed

kernel/src/kernel/system/processor/processor.asm

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,8 @@
2121

2222
BITS 64
2323

24-
global _checkForCPUID
2524
global _enableSSE
2625

27-
;
28-
; bool checkForCPUID()
29-
;
30-
; Checks if the CPUID instruction is available. This is implemented in
31-
; pure assembly, because C/C++ could cause race conditions due to the
32-
; ability of the compiler to modify the RFLAGS when it needs to.
33-
;
34-
_checkForCPUID:
35-
pushfq
36-
pop rax
37-
mov rcx, rax
38-
xor rax, 0x200000
39-
push rax
40-
popfq
41-
pushfq
42-
pop rax
43-
xor rax, rcx
44-
shr rax, 21
45-
and rax, 1
46-
push rcx
47-
popfq
48-
ret
49-
5026
;
5127
; void enableSSE()
5228
;

kernel/src/kernel/system/processor/processor.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ g_processor* _processorGetCurrent()
4747

4848
void processorInitializeBsp()
4949
{
50-
if(!processorSupportsCpuid())
51-
panic("%! processor has no CPUID support", "cpu");
52-
5350
processorPrintInformation();
5451

5552
if(!processorHasFeature(g_cpuid_standard_edx_feature::APIC))
@@ -182,11 +179,6 @@ bool processorListAvailable()
182179
return processors != nullptr;
183180
}
184181

185-
bool processorSupportsCpuid()
186-
{
187-
return _checkForCPUID();
188-
}
189-
190182
void processorCpuid(uint32_t code, uint32_t* outA, uint32_t* outB, uint32_t* outC, uint32_t* outD)
191183
{
192184
asm volatile("cpuid"

kernel/src/kernel/system/processor/processor.hpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,6 @@ struct g_processor
120120
g_processor* next;
121121
};
122122

123-
/**
124-
* Checks whether the CPU supports the CPUID instruction.
125-
*/
126-
extern "C" bool _checkForCPUID();
127-
128-
/**
129-
* Checks if the processor supports CPUID.
130-
*/
131-
bool processorSupportsCpuid();
132-
133123
/**
134124
* Performs a CPUID call and returns values in the out parameters.
135125
*/

kernel/src/kernel/system/processor/processor_state.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ struct g_processor_state
5858
uint64_t cs;
5959
uint64_t rflags;
6060

61-
// Only pushed/popped on Ring 3 <-> Ring 0 switches
6261
uint64_t rsp;
6362
uint64_t ss;
6463
}__attribute__((packed));

0 commit comments

Comments
 (0)