我怎样才能检测x86汇编内核的数量? [英] How can I detect the number of cores in x86 assembly?

查看:113
本文介绍了我怎样才能检测x86汇编内核的数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个非常简单的操作系统作为自己学习的工具。我的当前任务正在检测有关硬件尽可能多

I am writing a very simple operating system as a learning tool for myself. My current task is detecting as much about the hardware as possible.

我迄今能找到很多关于使用CPUID指令的CPU信息。有一件事我似乎无法找到的是数字或物理和/或逻辑内核。有没有办法做到这一点使用x86汇编和C?

I have so far been able to find a lot of information about the CPU using the CPUID instruction. The one thing I can't seem to find is the number or physical and/or logical cores. Is there a way to do this using a combination of x86 assembly and C?

我写的操作系统,所以code可以在管理员模式下运行,并且没有系统库来查询这些信息。

I am writing the operating system, so the code can be run in supervisor mode, and there are no system libraries to query for this information.

推荐答案

为了找到所有系统中的处理器,你必须分析或者ACPI表或Intel的MP配置表。请参见带来SMP您UP操作系统有关使用MP配置表来查找并启动其他处理器的教程。寻找在 http://www.acpi.info/spec.htm 在ACPI的更多信息。您可能还需要检查检测CPU拓扑结构,它可以告诉你哪些处理器和内核的哪个物理芯片一个系统内。

In order to find all of the processors in a system, you must parse either the ACPI tables or Intel's MP configuration table. See Bringing SMP to your UP Operating System for a tutorial on using the MP configuration table to find and start other processors. Find more information on ACPI at http://www.acpi.info/spec.htm. You may also want to check out Detecting CPU Topology, which can tell you which processors and cores are on which physical chip within a system.

您的操作系统, http://wiki.osdev.org 将是你最好的朋友在工作时。它是全信息的所有操作系统开发的不同部分,包括通用硬件和工具。

When working on your OS, http://wiki.osdev.org will be your best friend. It is full of information on all of the different parts of operating system development, including common hardware and tools.

这篇关于我怎样才能检测x86汇编内核的数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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