17、ARM编程中的函数调用与数据处理

ARM编程中的函数调用与数据处理

在ARM编程中,对可执行文件的研究以及函数的编写和使用是非常重要的环节。下面将详细介绍相关内容。

可执行文件的研究

在使用GDB编译代码时,可以通过特定的方式来深入了解程序。首先,使用 --g 选项重新编译代码以创建调试数据,示例命令如下:

gcc --g --o prog20a prog20a.s

然后进入反汇编器:

gdb prog20a

在GDB中,可以使用以下命令进行反汇编:

disassemble main 

或者

x/44i main

通过这些操作,可以看到文件的库组件在 _exit: 之后被标记。同时,在列表中还能发现指向主入口点之前地址的分支,这些区域包含了libc初始化代码,意味着程序几乎被包裹在libc中。

printf函数的使用

printf 函数非常通用,下面的代码展示了如何向 printf 传递参数并打印结果:

/* Printing a string using 

相关推荐

ARM64的函数调用标准和栈布局

欢迎订阅奔跑吧linux社区微信公众号 本文节选自《奔跑吧Linux内核》第二版卷1第1.6章 函数调用标准(Procedure Call Standard,PCS)用来描述父/子函数是如何编译、链接的,特别是父函数和子函数之间调用关系的约定,如栈的布局、参数的传递等。每个处理器架构都有不同的函数调用标准,本章重点介绍ARM64的函数调用标准。 ARM公司有一份描述ARM64架构函数调用的标准和规范文档,这份文档是《Procedure Call Standard for ARM 64-Bit Arch.

rlk8888的博客 1972

ARM学习(17)ARM函数调用规则

ARM 函数调用规则

张一西的博客 2688

【C++基础】函数调用约定(x86/ARM 差异对比):面试高频考点与真题解析

本文将带你从入门到精通,通过面试高频考点、历年真题解析,彻底掌握 x86 与 ARM 架构下函数调用约定的精髓。无论你是校招小白还是社招专家,都能在这里找到应对考试和实际项目的 “通关秘籍”。

byte轻骑兵的技术小窝 3777

ARM架构下的函数调用过程解析

总结起来,ARM架构下的函数调用过程涉及参数传递、寄存器保存与恢复、栈操作以及跳转指令的使用。在ARM架构下,函数调用的过程涉及到栈的使用、寄存器的保存和恢复以及指令的跳转。在ARM架构中,常用的需要保存的寄存器包括r4-r11、sp(栈指针)和lr(链接寄存器)。通过在函数调用前保存寄存器,并在函数调用结束后恢复寄存器的值,可以确保函数调用过程中不会破坏原有的寄存器状态。寄存器恢复:恢复在函数调用过程中保存的寄存器状态。将之前保存在栈中的寄存器值重新加载到相应的寄存器中,以恢复调用函数前的状态。

ByteCodN的博客 442

18、ARM编程中的函数调用、排序算法与C代码反汇编

本文探讨了ARM编程中的关键主题,包括函数调用时链接寄存器(LR)和状态标志的处理方式,以及如何编写健壮的打印例程和实现冒泡排序算法。此外,还介绍了如何将C代码反汇编为汇编语言,并对生成的代码进行优化,以提高执行效率。通过实际示例和流程图,帮助读者深入理解底层编程机制,并提供实践建议以提升代码质量与性能。

cc789的博客 71

OSMDroid(1)——OSM简介,基础例子搭建

1.OSMDroid简介 Osmdroid是一款完全开源的地图基本操作SDK,相比于现在普遍使用的百度地图,高德地图,谷歌地图等最大的好处就是开源。 最近在做一个军方项目,要求完全不能联网,从开发到应用整个阶段都是在局域网进行,相比之下采用了OSMDroid这个SDK作为解决方案。 先来看OSMDroid,便是(OpenStreetMapForAndroid),后面都简称OSM...

robotskly的博客 6182

国产大模型高考横评:数学推理与教育落地能力实测

大模型能力评估正从开放榜单转向封闭任务的确定性验证,高考作为强逻辑、低容错、高精度的标准化考试,成为检验模型真实推理能力的理想标尺。其核心在于考察知识覆盖、步骤完整性、单位敏感性与教学对齐度,而非单纯答案正确率。数学解答题尤其凸显模型在前提校验、条件枚举与过程可控性上的差异,反映出训练数据与教育语料深度耦合带来的工程化优势。该范式已延伸至语文语感建模、英语表达习惯适配及理综跨学科缝合等场景,为智能阅卷、精准答疑和教培系统集成提供可复现、可解释、可部署的技术依据。

weixin_30436581的博客 288

激光工程师必备:5个ABCDRez在谐振腔设计中的实战技巧(含热效应处理)

本文为激光工程师分享了5个利用ABCDRez矩阵光学工具进行谐振腔设计的实战技巧,重点涵盖热效应处理、模式匹配优化与稳定性分析。通过建立参数化模型、动态热透镜补偿、模式匹配仿真及灵敏度分析,帮助工程师实现从“黑箱”到“白盒”的腔体设计与调试,提升激光器设计的鲁棒性与效率。

k6l7m8n9的博客 707

Qt QChart实战:从零打造一个实时温度监控仪表盘(附完整源码)

本文详细介绍了如何使用Qt QChart模块从零构建一个工业级实时温度监控仪表盘。通过实战案例,展示了波形图的绘制、坐标轴配置、数据流模拟等关键技术,并提供了完整的源码实现,帮助开发者快速掌握Qt在数据可视化领域的应用。

weixin_42537919的博客 246

Containerd容器运行时的私有仓库镜像推送push和镜像拉取问题解决

向/etc/containerd/config.toml配置添加如下配置,然后重启containerd。向/etc/containerd/config.toml配置添加如下配置,然后重启containerd。通过crictl为k8s拉取镜像如下所示。可以通过ctr命令进行镜像推送。往私有仓库推送镜像如下。

Bulut0907 1万+

【Clickhouse】Cannot allocate block number in Zookeeper write prefix view location

我有一个问题,我CK集群跑批的时候,replicated表变成只读的了下面是CK的报错和当时ZK的日志。下面是zk报错开始 我认为是写入的时候,压力太大,ZK扛不住了,就按照博客里的建议优化了ZK的参数,现在偶尔还会只读,zk报错都是图里的那种clickhouse的集群是5分片的集群,数据量比较大。每小时批量一次,每次2-10W条数据,字段的话,不到200个字段,使用的 jdbc sink写入。

九师兄 836

7.29华为OD机试真题 新系统 - 能量对撞 (Java/Py/C/C++/Js/Go)

7.29华为OD机试真题 新系统 - 能量对撞 (Java/Py/C/C++/Js/Go)

算法大师! 1327

电子元件及其规格书的查找与理解

本内容收录:在电子开发或维修过程中,查找电子元件及其规格书心得体会,以及元件规格书的理解,系个人多年实战经验的系统梳理。内容着重介绍贴片元件代码反查型号的实用技巧,并以三款典型疑难元件为例,详述其完整查找过程与最终型号确认。

让你爱上电路设计 3996

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: 54、机器学习模型公平性、合规性及可解释性技术解析
下一篇: 55、机器学习模型的监管合规与风险管理
人间清醒863
博客等级 码龄3年 33粉丝 1544原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值