Octocontrabass wrote:TheGameMaker90 wrote:Imagine I tried to use a feature like hyper threading on a CPU that doesn't even have multithreading
It would still work, and you might not notice anything is wrong. Processor topology is only a performance hint. You can still use all available hardware threads regardless of where they physically exist.
You're right, though, detecting processor topology is manufacturer-specific, so you would need to know the manufacturer. However, a "hyperthreading" flag is not useful. You need to know the physical location of each hardware thread to perform any optimizations.
TheGameMaker90 wrote:Also, about that "halt loop." Do you mean "jmp $"? I already have that at the end.
I did not say "halt loop", I said "HLT loop", as in a loop that runs the HLT instruction. Like this one you were using earlier:
Also, it's a bad idea to enable interrupts with STI before you've configured the IDT. Move that somewhere after the IDT configuration.
Hmm I didn't know that. I thought the feature would cause issues. And hyperthreading was an example
And that's what I had originally and the pit timer wasn't running. "HLT"-ing of any kind seems to prevent the timer from running if not triple faulting when I throw it in there now. Perhaps I'm missing something?
And good point, for all intents and purposes it works right now, but in practice you're right. The IDT tells the system how to handle the interrupts so it makes sense that it should go after.
Edit:
Ohhh! I think I get it. You mentioned somewhere that "CLI" interferes with the pit timer or hlt instruction, I just realized that in my old bootloader I had "CLI" before my HLT loop. I'm about to test the old one without "CLI".
Edit2:
Bingo! How did I miss that? I tyend to overthink the problem way too much. With just that one instruction removed, the system works. Very nice! Off topic, but I'm now working on the keyboard driver (which I've pretty much written myself) and I need to handle multiple keys at once. Ex: <SHIFT> + <A> = "A". How would I go about that?
My current keyboard handler function (processed through IRQ1) looks something like this:
Code: Select all
if (!(key & 0x80) == 1)
terminal_printf("%s", keys_normal[keys]); // Where keys is from reading data (0x60)
I tried:
Code: Select all
if ((!(key & 0x80) == 1) && (key == <my shift key macro>))
terminal_printf("%s", keys_caps[keys]); // Where keys is from reading data (0x60)
else
terminal_printf("%s", keys_normal[keys]);
Edit3:
If you don't want to answer about the keyboard I get it (off topic), but I just realized something: When I press shift, it only fires once rather that treating it like I'm holding the key. That might be one place to start.
On the note of the CPU flags, how would I retrieve them? In cpuid.asm I have the following:
Code: Select all
cpuid_get_property:
mov eax, [esp + 4]
cpuid
I call it like this:
Code: Select all
extern uint32_t cpuid_get_property(uint32_t);
Then I used it like this:
Code: Select all
if (!cpu_get_property(CPUID_FEAT_ECX_SSE3))
terminal_printf("[WARNING]: CPUID_FEAT_ECX_SSE3 is not supported...\n");
Is this correct, or is there a better way to do it?