milo hobgoblin
New member
PM me.. need some help. Trying to write some code to determine if Chipset/CPU is APIC or PIC compliant. Thanks in advance.
milo hobgoblin said:PM me.. need some help. Trying to write some code to determine if Chipset/CPU is APIC or PIC compliant. Thanks in advance.
blut wump said:I suspect that this is going to involve simply checking for the presence of the CPUID instruction.
If the instruction exists, execute it and check EAX
0 => Processor string dumped into EBX, ECX, EDX
1 => feature capability flags dumped EBX, ECX, EDX
This code will check for the presence of CPUID
PUSHA
PUSHFD
POP EAX
MOV EBX,EAX
XOR EAX,00200000H ;toggle bit 21
PUSH EAX
POPFD
PUSHFD
POP EAX
CMP EAX,EBX
JZ SHORT @@exit ;CPUID not available
;continue here... with executing CPUID
XOR EAX,EAX ;get CPU string
CPUID
MOV [cpu_string],EBX
OR EAX,EAX ;condition flags for coming JZ
MOV [cpu_string + 4],EDX
MOV [cpu_string + 8],ECX
JZ SHORT @@exit ;no CPUID functions
MOV EAX,1 ; get CPU flags
CPUID
MOV [cpu_info1],EBX
MOV [cpu_info2],EDX
MOV [cpu_info3],ECX
@@exit: POPA
RET
I can't remember what the bits indicate assuming you reached that stage and you need to check for Pentium-class capability across the AMD and Intel chip which might be satisfied by checking the chip names and it might be uneccessary to run CPUID a second time. I've never had to perform the check for APIC but I used the above code to check for presence of MMX registers and instructions; MMX flag being a test with 0x800000 on EDX.
blut wump said:I suspect that this is going to involve simply checking for the presence of the CPUID instruction.
If the instruction exists, execute it and check EAX
0 => Processor string dumped into EBX, ECX, EDX
1 => feature capability flags dumped EBX, ECX, EDX
This code will check for the presence of CPUID
PUSHA
PUSHFD
POP EAX
MOV EBX,EAX
XOR EAX,00200000H ;toggle bit 21
PUSH EAX
POPFD
PUSHFD
POP EAX
CMP EAX,EBX
JZ SHORT @@exit ;CPUID not available
;continue here... with executing CPUID
XOR EAX,EAX ;get CPU string
CPUID
MOV [cpu_string],EBX
OR EAX,EAX ;condition flags for coming JZ
MOV [cpu_string + 4],EDX
MOV [cpu_string + 8],ECX
JZ SHORT @@exit ;no CPUID functions
MOV EAX,1 ; get CPU flags
CPUID
MOV [cpu_info1],EBX
MOV [cpu_info2],EDX
MOV [cpu_info3],ECX
@@exit: POPA
RET
I can't remember what the bits indicate assuming you reached that stage and you need to check for Pentium-class capability across the AMD and Intel chip which might be satisfied by checking the chip names and it might be uneccessary to run CPUID a second time. I've never had to perform the check for APIC but I used the above code to check for presence of MMX registers and instructions; MMX flag being a test with 0x800000 on EDX.
LOLSassy69 said:My head just exploded.
milo hobgoblin said:LOL Sassy.. I can follow most of it and it still makes my head explode.
Reading other peoples assembly is probably one of the hardest things to do in programming. Without good comments it almost impossible to read your own code after a while.
and punch cards sucked.
It's called job security because it's so damned hard for anyone else to support they can't let him go.Sassy69 said:I worked w/ a guy at Motorola where we wrote pager code (Motorola assembler) in the early 90s. He wrote like 100,000 lines w/ no comments at all. Nutty.


This page contains mature content. By continuing, you confirm you are over 18 and agree to our TOS and User Agreement.
Please Scroll Down to See Forums Below 










