⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 callconv.t

📁 RTEMS (Real-Time Executive for Multiprocessor Systems) is a free open source real-time operating sys
💻 T
字号:
@c@c  COPYRIGHT (c) 1988-2002.@c  On-Line Applications Research Corporation (OAR).@c  All rights reserved.@c@c  $Id: callconv.t,v 1.1 2002/07/30 21:43:53 joel Exp $@c@chapter Calling Conventions@section IntroductionEach high-level language compiler generatessubroutine entry and exit code based upon a set of rules knownas the compiler's calling convention.   These rules address thefollowing issues:@itemize @bullet@item register preservation and usage@item parameter passing@item call and return mechanism@end itemizeA compiler's calling convention is of importance wheninterfacing to subroutines written in another language eitherassembly or high-level.  Even when the high-level language andtarget processor are the same, different compilers may usedifferent calling conventions.  As a result, calling conventionsare both processor and compiler dependent.@section Processor BackgroundThe ARM architecture supports a simple yeteffective call and return mechanism.  A subroutine is invokedvia the branch and link (@code{bl}) instruction.  This instructionsaves the return address in the @code{lr} register.  Returningfrom a subroutine only requires that the return address bemoved into the program counter (@code{pc}), possibly withan offset.  It is is important tonote that the @code{bl} instruction does notautomatically save or restore any registers.  It is theresponsibility of the high-level language compiler to define theregister preservation and usage convention.@section Calling MechanismAll RTEMS directives are invoked using the @code{bl}instruction and return to the user application via themechanism described above.@section Register UsageAs discussed above, the ARM's call and return mechanism dosnot automatically save any registers.  RTEMS uses the registers@code{r0}, @code{r1}, @code{r2}, and @code{r3} as scratch registers andper ARM calling convention, the @code{lr} register is alteredas well.  These registers are not preserved by RTEMS directivestherefore, the contents of these registers should not be assumedupon return from any RTEMS directive. @section Parameter PassingRTEMS assumes that ARM calling conventions are followed and thatthe first four arguments are placed in registers @code{r0} through@code{r3}.  If there are more arguments, than that, then theyare place on the stack.@section User-Provided RoutinesAll user-provided routines invoked by RTEMS, such asuser extensions, device drivers, and MPCI routines, must alsoadhere to these calling conventions.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -