Example-2/211directiveCAREAA64ex,CODE.READONLY:Namethisblockof code A64exENTRY:Mark first instruction to executeinstructionstartMOVwo,#10;Setup parametersMOVw1, #3ADDwo, wo, w1wO=WO+WIstopMOV#0x26x1,MOVKx1,#2,LSL#16STRx1,[sp,#0]ADP_Stopped_ApplicationExitMOVx0,#0STRx0,[sp,#8]Exit statuscodeMOVx1,spxl contains the address of parameter blockMOVwo,#0x18ange1_SwIreason_ReportExceptionHLT0xf000AArch64semihostingEND;Mark endoffileARM062019-3-21
Example - 2/2 ARM06 2019-3-21 11 instruction directive
1.1.2Assemblymodule12The constituentparts areELFsections (definedby AREAdirective)Application entry (defined by ENTRY directive)Applicationexecution(definedbylabel)Application termination (defined by label) Program end (defined by END directive)ARMO62019-3-21
1.1.2 Assembly module ARM06 2019-3-21 12 The constituent parts are ELF sections (defined by AREA directive) Application entry (defined by ENTRY directive) Application execution (defined by label) Application termination (defined by label) Program end (defined by END directive)
AnexampleA64assemblymodule13AREAA64eX,CODE,READONLY;Namethisblockof codeA64exENTRY:Mark first instruction to executestartMOVwo,#10;SetupparametersMOVw1,#3ADDwo,wo,wl:wO=wo+w1stopMOVx1,#0x26MOVKx1,#2,LSL#16STRx1,[sp,#0]:ADP_Stopped_ApplicationExitMOVx0,#0STRx0,[sp,#8]Exit status codeMOVx1,sp:xl contains the address of parameter blockMOVwo,#0x18;angel_SwIreason_ReportExceptionHLT0xf000AArch64semihostingEND:Mark end of fileARM062019-3-21
An example A64 assembly module ARM06 2019-3-21 13
AnexampleA32assemblymodule14AREAA32eX,CODE,READONLY;Namethisblockof codeA32exENTRY;Mark first instruction to executestartMOVr0,#10;Set up parameters?MOVr1, #3ADDro,ro,rl:ro=ro+rlstopMOVr0,#0x18;angel_SwIreason_ReportExceptionLDRrl,=0x20026;ADP_Stopped_ApplicationExitSVC#0x123456;A32 semihosting(formerlySwI)END;Mark end of fileARM062019-3-21
An example A32 assembly module ARM06 2019-3-21 14
1.2 GNU Assembly Module15 GNU AssemblyModules are similar to thatof ARM,buthave anumberofdifferencesFor instance,GNUuses .sectiontoreplaceAREA For example,GNU syntax identifieslabelsbythe presenceof acolonwhile ARM syntax identifies labels bytheir position atthe start of alineARMO62019-3-21
1.2 GNU Assembly Module ARM06 2019-3-21 15 GNU Assembly Modules are similar to that of ARM, but have a number of differences For instance, GNU uses .section to replace AREA For example, GNU syntax identifies labels by the presence of a colon, while ARM syntax identifies labels by their position at the start of a line