GNUAssemblyModule16.section <section_name> (,"<flags>")口flagsx:executable sectionw:writeablesectiona:allowablesectionPredefined sections.text:codesection.data:initialized data section.bss:block startedby symbol,uninitializeddata sectionARM062019-3-21
GNU Assembly Module ARM06 2019-3-21 16 .section <section_name> {, “<flags>”} flags ◼ x: executable section ◼ w: writeable section ◼ a: allowable section Predefined sections .text: code section .data: initialized data section .bss: block started by symbol, uninitialized data section
Example:GNUassemblymodule.text口main:口stp x4, x5,[SP],#-16口str x30,[SP],#-8口mov x4,#8口mov x5,#6口add x0,x4,x5口口retARM062019-3-21
Example: GNU assembly module ARM06 2019-3-21 17 .text main: stp x4, x5, [SP], #-16 str x30, [SP], #-8 mov x4,#8 mov x5,#6 add x0,x4,x5 ret
合2 Procedure Call Standard18 2.1 Subroutine Calls2.2Process ImageARM062019-3-21
2 Procedure Call Standard ARM06 2019-3-21 18 2.1 Subroutine Calls 2.2 Process Image
2.1SubroutineCalls19 BL instruction performs branch-with linkRETinstructionis used for subroutine return GPRs (xO-x7) and SIMD registers (vO-v7) are used to pass argumentvalues into a subroutine and to return result values from a function Stack is for more arguments and return valuesARMO62019-3-21
2.1 Subroutine Calls ARM06 2019-3-21 19 BL instruction performs branch-with link RET instruction is used for subroutine return GPRs (x0-x7) and SIMD registers (v0-v7) are used to pass argument values into a subroutine and to return result values from a function Stack is for more arguments and return values
Subroutine Calls (cont)20+4PCX30mainsubroutineargumentvaluesx0-x7,v0-v7BLstackRET-resultvaluesARM062019-3-21
Subroutine Calls (cont) ARM06 2019-3-21 20 . BL . . x0-x7, v0-v7 stack . . RET argument values result values main subroutine PC X30 +4