determining the processor

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

determining the processor

Post by Neo »

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
CodeSlasher

RE:determining the processor

Post by CodeSlasher »

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
Chase

RE:determining the processor

Post by Chase »

Intel did release a couple of 486's that have cpuid support, some 486 DX100's if I remember correctly.
Brill

RE:determining the processor

Post by Brill »

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.
Xenos

RE:determining the processor

Post by Xenos »

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!
Post Reply