Difference: CallingCFunction (1 vs. 2)

Revision 22020-07-13 - PeterSchmid

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Calling C Functions from Forth and Vice Versa

Added:
>
>

Register Usage

 Procedure Call Standard for the ARM Architecture AAPCS

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/on-the-aapcs-with-an-application-to-efficient-parameter-passing

Line: 11 to 12
 
r1 Argument, result, scratch register 2 Scratch
r2 Argument, scratch register 3 Scratch
r3 Argument, scratch register 4 Scratch
Changed:
<
<
r4 Variable register 1  
r5 Variable register 2  
>
>
r4 Variable register 1 DO Index
r5 Variable register 2 DO Limit
 
r6 Variable register 3 Top Of Stack TOS
Changed:
<
<
r7 Variable register 4 Data Stack
r8 Variable register 5  
r9 Platform register (usage defined by platform in use)  
r10 Variable register 7  
r11 Variable register 8  
r12 Intra-procedure-call scratch register  
>
>
r7 Variable register 4 Data stack pointer
r8 Variable register 5 unused
r9 Platform register (usage defined by platform in use) unused
r10 Variable register 7 unused
r11 Variable register 8 unused
r12 Intra-procedure-call scratch register unused
 
r13 Stack pointer (SP) Stack pointer (SP)
r14 Link register (LR) Link register (LR)
r15 Program counter (PC) Program counter (PC)
Changed:
<
<
>
>

VFP Register Usage

The VFP-v2 co-processor has 32 single-precision registers, s0-s31, which may also be accessed as 16 double-precision registers, d0-d15 (with d0 overlapping s0, s1; d1 overlapping s2, s3; etc).

Calling C Functions from Forth

Calling Forth Words from C Functions

Stack Pointer and Top Of Stack
  -- Peter Schmid - 2020-07-13

Revision 12020-07-13 - PeterSchmid

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="WebHome"

Calling C Functions from Forth and Vice Versa

Procedure Call Standard for the ARM Architecture AAPCS

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/on-the-aapcs-with-an-application-to-efficient-parameter-passing

Register AAPCS Purpose MECRISP Forth Purpose
r0 Argument, result, scratch register 1 Scratch
r1 Argument, result, scratch register 2 Scratch
r2 Argument, scratch register 3 Scratch
r3 Argument, scratch register 4 Scratch
r4 Variable register 1  
r5 Variable register 2  
r6 Variable register 3 Top Of Stack TOS
r7 Variable register 4 Data Stack
r8 Variable register 5  
r9 Platform register (usage defined by platform in use)  
r10 Variable register 7  
r11 Variable register 8  
r12 Intra-procedure-call scratch register  
r13 Stack pointer (SP) Stack pointer (SP)
r14 Link register (LR) Link register (LR)
r15 Program counter (PC) Program counter (PC)

-- Peter Schmid - 2020-07-13

Comments

<--/commentPlugin-->
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback