查看設(shè)備架構(gòu)
adb -s emulator-5554 shell getprop ro.product.cpu.abi
C:\Users\liyd>adb -s emulator-5554 shell getprop ro.product.cpu.abi
x86_64
C:\Users\liyd>adb -s 804c11f1 shell getprop ro.product.cpu.abi
arm64-v8a
mumu模擬器12
C:\Users\liyd>adb -s 127.0.0.1:7555 shell getprop ro.product.cpu.abi
x86_64
架構(gòu)和 CPU
使用原生代碼時,硬件很重要。NDK 提供各種 ABI 供您選擇,可讓您確保針對正確的架構(gòu)和 CPU 進行編譯。
本部分介紹了在構(gòu)建時如何面向特定的架構(gòu)和 CPU,如何使用 ARM Neon 擴展指令集,以及在運行時如何使用 CPU 功能庫查詢可選功能。
Android ABI - NDK
bookmark_border
不同的 Android 設(shè)備使用不同的 CPU,而不同的 CPU 支持不同的指令集。CPU 與指令集的每種組合都有專屬的應(yīng)用二進制接口 (ABI)。ABI 包含以下信息:
可使用的 CPU 指令集(和擴展指令集)。
運行時內(nèi)存存儲和加載的字節(jié)順序。Android 始終是 little-endian。
在應(yīng)用和系統(tǒng)之間傳遞數(shù)據(jù)的規(guī)范(包括對齊限制),以及系統(tǒng)調(diào)用函數(shù)時如何使用堆棧和寄存器。
可執(zhí)行二進制文件(例如程序和共享庫)的格式,以及它們支持的內(nèi)容類型。Android 始終使用 ELF。如需了解詳情,請參閱 ELF System V 應(yīng)用二進制接口。
如何重整 C++ 名稱。如需了解詳情,請參閱 Generic/Itanium C++ ABI。
本頁列舉了 NDK 支持的 ABI,并且介紹了每個 ABI 的運行原理。
ABI 還可以指平臺支持的原生 API。如需影響 32 位系統(tǒng)的此類 ABI 問題列表,請參閱 32 位 ABI 錯誤。文章來源:http://www.zghlxwxcb.cn/news/detail-695445.html
支持的 ABI
文章來源地址http://www.zghlxwxcb.cn/news/detail-695445.html
ZygoteInit.java
private static final String ABI_LIST_ARG = "--abi-list=";
private static final String SOCKET_NAME_ARG = "--socket-name=";
public static void main(String argv[]) {
566 try {
567 RuntimeInit.enableDdms();
568 // Start profiling the zygote initialization.
569 SamplingProfilerIntegration.start();
570
571 boolean startSystemServer = false;
572 String socketName = "zygote";
573 String abiList = null;
574 for (int i = 1; i < argv.length; i++) {
575 if ("start-system-server".equals(argv[i])) {
576 startSystemServer = true;
577 } else if (argv[i].startsWith(ABI_LIST_ARG)) {
578 abiList = argv[i].substring(ABI_LIST_ARG.length());
579 } else if (argv[i].startsWith(SOCKET_NAME_ARG)) {
580 socketName = argv[i].substring(SOCKET_NAME_ARG.length());
581 } else {
582 throw new RuntimeException("Unknown command line argument: " + argv[i]);
583 }
584 }
585
586 if (abiList == null) {
587 throw new RuntimeException("No ABI list supplied.");
588 }
589
590 registerZygoteSocket(socketName);
591 EventLog.writeEvent(LOG_BOOT_PROGRESS_PRELOAD_START,
592 SystemClock.uptimeMillis());
593 preload();
594 EventLog.writeEvent(LOG_BOOT_PROGRESS_PRELOAD_END,
595 SystemClock.uptimeMillis());
596
597 // Finish profiling the zygote initialization.
598 SamplingProfilerIntegration.writeZygoteSnapshot();
599
600 // Do an initial gc to clean up after startup
601 gcAndFinalize();
602
603 // Disable tracing so that forked processes do not inherit stale tracing tags from
604 // Zygote.
605 Trace.setTracingEnabled(false);
606
607 if (startSystemServer) {
608 startSystemServer(abiList, socketName);
609 }
610
611 Log.i(TAG, "Accepting command socket connections");
612 runSelectLoop(abiList);
613
614 closeServerSocket();
615 } catch (MethodAndArgsCaller caller) {
616 caller.run();
617 } catch (RuntimeException ex) {
618 Log.e(TAG, "Zygote died with exception", ex);
619 closeServerSocket();
620 throw ex;
621 }
622 }
到了這里,關(guān)于Android架構(gòu) 架構(gòu)和 CPU ABI - NDK的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!