determining the processor
determining the processor
I want to know how to check what kind of processor is running on a system especially if it is earlier than a 486 i want my program to quit as i dont expect the earlier processors to be able to handle the code.Any info will be appreciated
Only Human
RE:determining the processor
You could try executing and instruction or group of instructions that don't not exist on a specific type of CPU. for example, if you try to execute an instruction that first appears in 386 CPUs on a 286 CPU, an invalid instruction exception will fire.So you could use the exception handler to kill the OS. Or you could use the system Flags. Certain flags do not change in the 286 CPUs but do change in 386 CPUs when you try to alter them. The same thing happens on with 386 CPUs and 486 Cpus. After 486 CPUs, just use the CPUID instruction
RE:determining the processor
Intel did release a couple of 486's that have cpuid support, some 486 DX100's if I remember correctly.
RE:determining the processor
You can find out if the cpu is a pentium (or late 486) by testing the id bit in eflags.
If this can not be set its either a 3/486. To detect which test the alignment check bit in eflags. If it can be set, its a 486 because alignment checking is not available on the 386. It if can not be set, 386 obviously.
Brill.
If this can not be set its either a 3/486. To detect which test the alignment check bit in eflags. If it can be set, its a 486 because alignment checking is not available on the 386. It if can not be set, 386 obviously.
Brill.
RE:determining the processor
If you're still in real mode, this should work:
push 0, popf, pushf, pop ax: If bits 12-15 are set, the processor is earlier than 286. If not:
push 7000h, popf, pushf, pop ax: If bits 12-14 are clear, the processor is a 286, otherwise later. If so:
Test if alignment check is possible, bit 18 in EFLAGS. Be caraful not to cause an alignment check exception, align SP to doubleword before setting this bit!
push 0, popf, pushf, pop ax: If bits 12-15 are set, the processor is earlier than 286. If not:
push 7000h, popf, pushf, pop ax: If bits 12-14 are clear, the processor is a 286, otherwise later. If so:
Test if alignment check is possible, bit 18 in EFLAGS. Be caraful not to cause an alignment check exception, align SP to doubleword before setting this bit!