Enable Hyperthreading or 2nd CPU in Windows XP

I came across this on a VM the other morning. It seemed that assigned the VM 2vCPU and then installing XP Professional didn’t install the correct HAL/Kernel. I’m not sure why, but here’s how I noticed the problem and how I fixed it.

I first noticed the issue when it was reported that in Task Manager the CPU graph only had one CPU showing. In the View -> CPU History menu, there was only one option to show the single CPU. I checked device manager next and noted that there were in fact 2 CPUs recognized by Windows under Processors category. I then checked My Computer -> Properties and it only reported 1 E7540 @ 2.00GHz CPU. Hmmmm. I next checked the HAL by looking at Device Manager -> Computer and seeing that ACPI was installed but not ACPI Multiprocessor!

To change to ACPI Multiprocessor, you can right-click on the ACPI and choose Update Driver and it would list whichever drivers are installed. Here are some of the options that would be available (if installed):

Standard PC, Non-ACPI PIC HAL (Hal.dll)

  • Standard PC

MPS Uniprocessor PC, Non-ACPI APIC UP HAL (Halapic.dll)

  • Standard PC
  • MPS Uniprocessor
  • MPS Multiprocessor

MPS Multiprocessor PC, Non-ACPI APIC MP HAL (Halmps.dll)

  • Standard PC
  • MPS Multiprocessor

Advanced Configuration and Power Interface (ACPI) PC, ACPI PIC HAL (Halacpi.dll)

  • Standard PC
  • Advanced Configuration and Power Interface (ACPI) PC

ACPI Uniprocessor PC, ACPI APIC UP HAL (Halaacpi.dll)

  • Standard PC
  • Advanced Configuration and Power Interface (ACPI) PC
  • ACPI Uniprocessor
  • ACPI Multiprocessor

ACPI Multiprocessor PC, ACPI APIC MP HAL (Halmacpi.dll)

  • Standard PC
  • Advanced Configuration and Power Interface (ACPI) PC
  • ACPI Multiprocessor
  • MPS Multiprocessor

Well, I didn’t have any of those. So I knew Windows wasn’t installed, seemingly, with the support for Multiprocessor, etc.

Here’s how I corrected the problem.

I attached an XP Professional ISO to the VM and then from within the VM, I launched a command prompt and changed to the CD-ROM directory (in my case, D:):

cd /d d:

I expanded ntkrnlmp.ex_ and halmacpi.dl_ to c:windowssystem32:

d:>expand i386ntkrnlmp.exe_ c:windowssystem32ntkrnlmp.exe
d:>expand i386halmacpi.dl_ c:windowssystem32halmacpi.dll

Next, I modified boot.ini to specify the kernel and hal to load:

d:>attrib -r c:boot.ini
d:>edit c:boot.ini

I appended the following to the boot line:

/kernel=ntkrnlmp.exe /hal=halmacpi.dll

So the entire line looks like this now:

multi(0)disk(0)rdisk(0)partition(1)WINDOWS=Microsoft Windows XP Professional /fastdetect /noexecute=optin /kernel=ntkrnlmp.exe /hal=halmacpi.dll

Make sure you don’t make any typos or you will not be booting and you’ll have to fix your boot.ini through other methods.

After saving boot.ini, I made it read-only again:

d:>attrib +r c:boot.ini

Then I rebooted.

Voila. Now I see both vCPUs in Task Manager and My Computer Properties and today is a good day.

This is the first VM I came across with this problem and I have to believe it was because it was installed when there was only 1vCPU configured for it.

Batch Script to Cleanup Temporary Files

This script is intended for use on Windows XP / Server 2003.

@echo off

@for /d %%d in ( C:\Documents and Settings\* ) do @(
  echo %%d
  if exist %%d\Local Settings\ (
    if exist %%d\Local Settings\Temp (
      for /d %%e in ( %%d\Local Settings\Temp\* ) do @(
        attrib -R -A -S -H %%e\*.*
        rmdir %%e /s /q

      if exist %%d\Local Settings\Temporary Internet Files (
        rmdir %%d\Local Settings\Temporary Internet Files /s /q

      if exist %%d\Local Settings\Temp\*.* (
        attrib -R -A -S -H %%d\Local Settings\Temp\*.*
        del %%d\Local Settings\Temp\*.* /q