在不同的处理器上运行code(x86汇编) [英] Running code on different processor (x86 assembly)

查看:175
本文介绍了在不同的处理器上运行code(x86汇编)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在x86上的实模式,将需要什么指令被用来运行在不同的处理器的code,在多处理器系统?

In real mode on x86, what instructions would need to be used to run the code on a different processor, in a multiprocessor system?

(我正在写汇编一些pre-启动code,需要设置一定的CPU寄存器,并为此在系统中的每个CPU上,实际的操作系统启动前)。

(I'm writing some pre-boot code in assembler that needs to set certain CPU registers, and do this on every CPU in the system, before the actual operating system boots.)

推荐答案

所以,你有一个独立的(你说,pre-启动)计划,就像一个引导程序,在实模式下运行?这是与通常的BIOS中PeeCee?

So you have a stand-alone (you said "pre-boot") program, like a bootloader, running in real mode? And this is on a PeeCee with the usual BIOS?

在这种情况下,你只有一个CPU的运行。为了加速旋转其它CPU单元的操作系统通常会执行所谓的通用启动算法的这是这样的:

In that case you have only one CPU running. In order to spin-up the other CPU units an operating system will typically execute what is called the universal startup algorithm which goes like this:

BSP sends AP an INIT IPI
BSP DELAYs (10mSec)
If (APIC_VERSION is not an 82489DX) {
  BSP sends AP a STARTUP IPI
  BSP DELAYs (200μSEC)
  BSP sends AP a STARTUP IPI
  BSP DELAYs (200μSEC)
}
BSP verifies synchronization with executing AP

该BSP是引导处理器。的AP是应用处理器。一个IPI是一个处理器间中断。为了做一个IPI,你需要启用APIC,中断控制器扩展PC架构未在启动时启用。这就是为什么code是担心它正在运行什么样的ICU版本。所有这一切都是相当深的内核魔术。你可以尝试寻找的Linux,NetBSD的,或其他* BSD源$ C ​​$ C的例子,但它不会是容易阅读。如果你真的赢了,你可能会发现一个小的内核或独立的SMP测试程序在某处。

The BSP is the Boot Processor. An AP is an Application Processor. An IPI is an inter-processor interrupt. In order to do an IPI, you need to enable the APIC, an interrupt controller extension to the PC architecture which is not enabled at bootup. That's why the code is worried about what kind of ICU version it is running. All of this is fairly deep kernel magic. You might try looking at Linux, NetBSD, or other *BSD source code for an example, but it won't be easy to read. If you really win, you might find a small kernel or standalone SMP test program out there somewhere.

有关更多信息,请参见英特尔多处理器规范

For more information, see the Intel Multiprocessor Specification.

这篇关于在不同的处理器上运行code(x86汇编)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆