【发布时间】:2011-02-13 23:29:35
【问题描述】:
一位朋友向我发送了该代码并声称它可能会损坏处理器。这是真的吗?
void damage_processor() {
while (true) {
// Assembly code that sets the five control registers bits to ones which causes a bunch of exceptions in the system and then damages the processor
Asm(
"mov cr0, 0xffffffff \n\t"
"mov cr1, 0xffffffff \n\t"
"mov cr2, 0xffffffff \n\t"
"mov cr3, 0xffffffff \n\t"
"mov cr4, 0xffffffff \n\t"
)
}
}
这是真的吗?
【问题讨论】:
-
有趣。如果可以编写代码来直接损坏处理器,我会感到震惊,但肯定有可能从应用程序中创建系统不稳定,从而导致系统在重新启动之前完全失败。
-
不,这不是真的,但它会让你的显示器爆炸。
-
嗯,你试过了吗?
-
每个人都知道 HCF 是破坏你机器的指令。 en.wikipedia.org/wiki/Halt_and_Catch_Fire
-
我听说运行此代码将为您带来 +1000 StackOverflow 声誉。
标签: c assembly cpu-registers