有没有办法在运行时检测iOS上的VFP / NEON / Thumb / ...? [英] Is there a way to detect VFP/NEON/Thumb/... on iOS at runtime?

查看:306
本文介绍了有没有办法在运行时检测iOS上的VFP / NEON / Thumb / ...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,通过查询 sysctlbyname(hw.cpusubtype,...)来确定iOS设备运行的CPU是相当容易的,但似乎没有什么明显的方法来找出CPU的实际功能(想想VFP,NEON,Thumb,...)。可以有人想办法做到这一点?

基本上,我需要的东西类似于 getauxval(AT_HWCAP)在Linux / Android上,它返回CPU支持的功能的位掩码。



有几点需要注意:


  1. 必须在运行时从操作系统中检索信息。没有预处理器定义。

  2. Fat二进制文件不是解决方案。我真的很需要在ARM v6二进制文件中知道这个东西。


    在此先感谢! p>

    解决方案

    sysctlbyname 有hw.optional.neon。我没有看到VFP的名称,除了hw.optional.vfp_shortvector,这是一个弃用的功能。


    So it's fairly easy to figure out what kind of CPU an iOS device runs by querying sysctlbyname("hw.cpusubtype", ...), but there seems to be no obvious way to figure out what features the CPU actually has (think VFP, NEON, Thumb, ...). Can someone think of a way to do this?

    Basically, what I need is something similar to getauxval(AT_HWCAP) on Linux/Android, which returns a bit mask of features supported by the CPU.

    A few things to note:

    1. The information must be retrieved at runtime from the OS. No preprocessor defines.
    2. Fat binaries is not a solution. I really do need to know this stuff in an ARM v6 binary.

    Thanks in advance!

    解决方案

    sysctlbyname has "hw.optional.neon". I do not see a name for VFP, except "hw.optional.vfp_shortvector", which is a deprecated feature.

    这篇关于有没有办法在运行时检测iOS上的VFP / NEON / Thumb / ...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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