2

new guy here. Working on Bi0S script, adding as many features as possible. It is possible to change fan speeds, advanced security, manipulate voltages, etc. How do you overclock the microprocessor using Assembly?. No not the Avengers Assembly or the UN. .. (the moderators said i have to make a clear distinction because my last post wasn't "specific enough" ). Preferably in Assembly (Language) or C/C++

1 Answer 1

2

How to change the clock-speed of a microprocessor using inline assembly language

General procedures for utilizing assembly language to overclock a microprocessor are :

  • Ascertain the CPU and motherboard's maximum safe clock speed. It is crucial to adhere to this limit in order to protect the processor and motherboard. This will typically be stated in the documentation for your hardware.

  • Create code to read the relevant hardware registers' current clock speed. The correct registers to read from must be determined by consulting the processor's documentation.

  • Based on the maximum safe clock speed and the desired level of overclocking, choose the new clock speed you wish to set.

  • Create code to update the hardware registers with the new clock speed. Again, to find out which registers to write to, refer to the manual for your CPU.

  • Test the stability of the system using a program like LinX or Prime95 to run at the new clock speed. You can keep using the new clock speed if the system is stable. If the system is unstable, you might need to modify the BIOS or hardware settings, change the clock speed, or other factors.

Please keep in mind that the code i mentioned is just an example, and the specific registers and values that must be changed will depend on the microprocessor and motherboard you're using. To determine the correct values, consult the documentation for your hardware. when overclocking a microprocessor, as increasing the clock speed can also increase the power consumption and heat generation of the processor. You may need to make additional changes to the BIOS settings or hardware registers, such as increasing the voltage to the processor or adjusting the cooling settings, in order to ensure that the processor remains stable at the higher clock speed

#include <stdio.h>
#include <stdint.h>

// ハードウェアレジスタを保存する構造体
struct HardwareRegisters {
    uint32_t clockControl;  // クロックコントロールレジスタ
    uint32_t voltageControl;  // 電圧コントロールレジスタ
    uint32_t temperatureControl;  // 温度コントロールレジスタ
};

// ハードウェアレジスタを読み込む関数
HardwareRegisters readHardwareRegisters() {
    HardwareRegisters regs;

// インラインアセンブリを使ってレジスタを読み込む
__asm__ __volatile__ (
    "movl $0x0, %%eax\n\t"  // EAXレジスタに0を代入
    "rdmsr\n\t"  // MSRレジスタを読み込む
    "movl %%edx, %0\n\t"  // 読み込んだEDXレジスタをclockControlに保存
    "movl %%eax, %1\n\t"  // 読み込んだEAXレジスタをvoltageControlに保存
    "movl $0x1, %%eax\n\t"  // EAXレジスタに1を代入
    "rdmsr\n\t"  // MSRレジスタを読み込む
    "movl %%edx, %2\n\t"  // 読み込んだEDXレジスタをtemperatureControlに保存
    : "=m"(regs.clockControl), "=m"(regs.voltageControl), "=m"(regs.temperatureControl)  // 出力
    :  // 入力
    : "%eax", "%edx"  // クリアするレジスタ
);

return regs;
}

// ハードウェアレジスタに書き込む関数
void writeHardwareRegisters(HardwareRegisters regs) {
    // インラインアセンブリを使ってレジスタに書き込む
    __asm__ __volatile__ (
        "movl $0x0, %%eax\n\t"  // EAXレジスタに0を代入
        "movl %0, %%edx\n\t"  // clockControlをEDXレジスタに保存
        "movl %1, %%eax\n\t"  // voltageControlをEAXレジスタに保存
                "wrmsr\n\t"  // MSRレジスタに書き込む
        "movl $0x1, %%eax\n\t"  // EAXレジスタに1を代入
        "movl %2, %%edx\n\t"  // temperatureControlをEDXレジスタに保存
        "wrmsr\n\t"  // MSRレジスタに書き込む
        :  // 出力
        : "m"(regs.clockControl), "m"(regs.voltageControl), "m"(regs.temperatureControl)  // 入力
        : "%eax", "%edx"  // クリアするレジスタ
    );
}

int main() {
    // 現在のハードウェアレジスタを読み込む
    HardwareRegisters currentRegs = readHardwareRegisters();

// 最大安全クロックスピードとオーバークロックのレベルに基づいて新しいクロックスピードを決定する
uint32_t newClockSpeed = currentRegs.clockControl + 1000;  // クロックスピードを1000 MHz増やす

// ハードウェアレジスタを新しいクロックスピードに更新する
currentRegs.clockControl = newClockSpeed;
writeHardwareRegisters(currentRegs);

// 新しいクロックスピードでシステムの安定性をテストする
// LinXやPrime95などのプログラムを使って新しいクロックスピードで実行する

return 0;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.