News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

CPU temperature detection on AMD Athlon XP

Started by formalproof, January 01, 2010, 10:01:25 AM

Previous topic - Next topic

formalproof

I'd like to write a program in MASM to display the temperature of my AMD Athlon XP CPU.

According to page 110 of http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/31116.pdf , some kind of temperature value is accessible through "SB-TSI" and "F3xA4[CurTmp]".

Does anyone know what these are and how they can be accessed in MASM programs? The AMD manuals are difficult for me to understand, so I was unable to find this information. Can someone help me a bit?

Many thanks in advance.

ecube

Minus reading it via a driver, the only way I know of in ring3 is via WMI, here's an example vbscript(.vbs) that does it, and it doesn't work for most CPU's. You can find MASM WMI code on the board somewhere.


strServer = "."

Set objWMI = GetObject("winmgmts://" & strServer & "/root\WMI")
Set objInstances = objWMI.InstancesOf("MSAcpi_ThermalZoneTemperature",48)

On Error Resume Next
For Each objInstance in objInstances
    With objInstance
        WScript.Echo .Active
        WScript.Echo Join(.ActiveTripPoint, ", ")
        WScript.Echo .ActiveTripPointCount
        WScript.Echo .CriticalTripPoint
        WScript.Echo .CurrentTemperature
        WScript.Echo .InstanceName
        WScript.Echo .PassiveTripPoint
        WScript.Echo .Reserved
        WScript.Echo .SamplingPeriod
        WScript.Echo .ThermalConstant1
        WScript.Echo .ThermalConstant2
        WScript.Echo .ThermalStamp
    End With
On Error Goto 0
Next


formalproof

Would it be possible to write a program with ring 0 access? Would it be possible to write a driver in MASM? What exactly makes a program a driver in Windows XP? (My ASM textbook doesn't explain this.) I'd be grateful for any info you can give me.

ecube

a driver is typically defined as "software that drives hardware" in our case it'd be software that communicates with the mobo to recieve the CPU temperature, and while it's not easy, it is possible. the program "speedfan" does it, but I think he did a lot of reversing and such. If you want to create a driver in win2k+(.drv, on 9x it's called vxd) check out http://www.freewebs.com/four-f/. As far as detecting CPU temp in kernel mode, I have no idea.

formalproof

Turns out that reading the temperature through WMI doesn't work for me, since my system doesn't support MSAcpi_ThermalZoneTemperature or any of the other possible classes (such as CIM_TemperatureProbe).

So I guess the only way is to write a driver (and learn to write them), which seems like a massive undertaking.