首页 > 系统相关 >20230818 CHAPTER 5 Thanks for the Memories arm64汇编内存使用

20230818 CHAPTER 5 Thanks for the Memories arm64汇编内存使用

时间:2023-08-18 21:44:18浏览次数:43  
标签:CHAPTER Memories mov write w3 Thanks x2 x0 内存

.data 段的内存引用实例

十进制数不要以0开头,否则会被认为是8进制数

一个数前面可以加-负号或者~取反符号;

 

申请一个内存块;

 

重复!

转义字符!

内存对齐

 

 

The offset from the PC has 19 bits in the instruction, which gives a range of +/-1MB. The offset address is in words

“ldr X1, #8” means 8 words from the current instruction. Any data that you want to modify should go in a .data section.

 

 

 

 

 

 

   updates X1 with the value calculated

 

 

 一个程序:把字符串转成大写

.global _start
_start:
	ldr x0,=instr
	ldr x1,=outstr

	mov x2,0
loop:
	ldrb w3,[x0,x2]
	cmp w3,0
	b.eq cout	//reach the end of instr
	cmp w3,'a'
	b.cc write
	cmp w3,'z'
	b.hi write
	sub w3,w3,'a'-'A'
write:
	strb w3,[x1,x2]
	add x2,x2,1	//next loop
	b loop
cout:
	mov x0,1	//stdout
	mov x8,64	//linux write system call
	svc 0

	mov x0,0
	mov x8,93
	svc 0
.data
instr:	.asciz	"a test string , convert To UPPER case.\n"
outstr:	.fill	255,1,0

   

 

ldp,stp,加载或保存128bits数据,使用2个64位寄存器;

 

 

 

 

 

 

 

 

 

标签:CHAPTER,Memories,mov,write,w3,Thanks,x2,x0,内存
From: https://www.cnblogs.com/yangdinshan/p/17641453.html

相关文章

  • 强化学习Chapter4——两个基本优化算法(1)
    强化学习Chapter4——两个基本优化算法(1)上一节导出了状态价值函数的贝尔曼方程以及最优状态价值函数:\[\begin{aligned}V^\pi(s)&=E_{a\sim\pi,s’\simP}[r(s,a)+\gammaV^\pi(s‘)]\\&=\sum_{a}\pi(a|s_t)(r(s_t,a)+\gamma\sum_{s'}p(s'|s_t,a)V^\pi(s'))\\V^*(s)&am......
  • 强化学习Chapter2——优化目标(2)
    强化学习Chapter2——优化目标(2)上文推导出强化学习的一般性目标,即不做确定性假设下的优化目标,得到了下面两个式子:\[P(\tau|\pi)=\rho_0(s_0)\prod^{T-1}_{t=0}P(s_{t+1}|s_t,a_t)\pi(a_t|s_t)\\J(\pi)=\int_\tauP(\tau|\pi)R(\tau)=E_{\tau\sim\pi}[R(\tau)]\]我们的目标就......
  • 强化学习Chapter2——优化目标(1)
    强化学习Chapter2——优化目标(1)上节涉及强化学习基本思路以及利用数学方式表征强化学习,但对强化学习的目标并没有进行详尽的定义。本节的目标旨在介绍algorithm-free的优化目标,即本文将不涉及算法地详述强化学习的目标。强化学习一般性目标上文提到,强化学习的目标可以解释为:......
  • VSCODE cannot find package "GOPROJECT/src/chapter1/model" in any of解决方法
    环境:win10go1.20问题描述:在go项目中想要导入自己的其他包的方法或变量,保存后提示cannotfindpackage"GOPROJECT/src/chapter1/model"inanyof: D:\VScode\language\Go\src\GOPROJECT\src\chapter1\model(from$GOROOT) C:\Users\艾坤\go\src\GOPROJECT\src\chapt......
  • SystemVerilog for Design Edition 2 Chapter 10
    SystemVerilogforDesignEdition2Chapter10SystemVerilogextendstheVeriloglanguagewithapowerfulinterfaceconstruct.Interfacesofferanewparadigmformodelingabstraction.Theuseofinterfacescansimplifythetaskofmodelingandverifying......
  • SystemVerilog for Design Edition 2 Chapter 9
    SystemVerilogforDesignEdition2Chapter9ThischapterpresentsthemanyenhancementstoVerilogthatSystemVerilogaddsforrepresentingandworkingwithdesignhierarchy.Thetopicsthatarediscussedinclude:•Moduleprototypes•Nestedmodules•S......
  • SystemVerilog for Design Edition 2 Chapter 8
    SystemVerilogforDesignEdition2Chapter8SystemVerilogenablesmodelingatahigherlevelofabstractionthroughtheuseof2-statetypes,enumeratedtypes,anduserdefinedtypes.Thesearecomplementedbynewspecializedalwaysproceduralblocks,alw......
  • SystemVerilog for Design Edition 2 Chapter 7
    SystemVerilogforDesignEdition2Chapter7SystemVerilogaddsseveralnewoperatorsandproceduralstatementstotheVeriloglanguagethatallowmodelingmoreconcisesynthesizableRTLcode.Additionalenhancementsconveythedesigner’sintent,helping......
  • SystemVerilog for Design Edition 2 Chapter 6
    SystemVerilogforDesignEdition2Chapter6TheVeriloglanguageprovidesageneralpurposeproceduralblock,calledalways,thatisusedtomodelavarietyofhardwaretypesaswellasverificationroutines.Becauseofthegeneralpurposeapplicationof......
  • SystemVerilog for Design Edition 2 Chapter 5
    SystemVerilogforDesignEdition2Chapter5SystemVerilogaddsseveralenhancementstoVerilogforrepresentinglargeamountsofdata.TheVerilogarrayconstructisextendedbothinhowdatacanberepresentedandforoperationsonarrays.Structureand......