From owner-svn-src-projects@FreeBSD.ORG Sun Aug 12 04:50:27 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 38DD2106566B; Sun, 12 Aug 2012 04:50:27 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23E518FC0A; Sun, 12 Aug 2012 04:50:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7C4oQ6M037956; Sun, 12 Aug 2012 04:50:26 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7C4oQMf037954; Sun, 12 Aug 2012 04:50:26 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201208120450.q7C4oQMf037954@svn.freebsd.org> From: Andrew Turner Date: Sun, 12 Aug 2012 04:50:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239208 - projects/arm_eabi/sys/libkern/arm X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Aug 2012 04:50:27 -0000 Author: andrew Date: Sun Aug 12 04:50:26 2012 New Revision: 239208 URL: http://svn.freebsd.org/changeset/base/239208 Log: Document __aeabi_ldivmod and __aeabi_uldivmod. Add a comment of what these functions are doing. Modified: projects/arm_eabi/sys/libkern/arm/ldivmod.S Modified: projects/arm_eabi/sys/libkern/arm/ldivmod.S ============================================================================== --- projects/arm_eabi/sys/libkern/arm/ldivmod.S Sun Aug 12 02:51:28 2012 (r239207) +++ projects/arm_eabi/sys/libkern/arm/ldivmod.S Sun Aug 12 04:50:26 2012 (r239208) @@ -28,9 +28,24 @@ #include __FBSDID("$FreeBSD$"); +/* + * These calculate: + * q = n / m + * With a remainer r. + * + * They take n in {r0, r1} and m in {r2, r3} then pass them into the + * helper function. The hepler functions return q in {r0, r1} as + * required by the API spec however r is returned on the stack. The + * ABI required us to return r in {r2, r3}. + * + * We need to allocate 8 bytes on the stack to store r, the link + * register, and a pointer to the space where the helper function + * will write r to. After returning from the helper fuinction we load + * the old link register and r from the stack and return. + */ ENTRY_NP(__aeabi_ldivmod) sub sp, sp, #8 /* Space for the remainder */ - stmfd sp!, {sp, lr} /* Sace the rem pointer and lr */ + stmfd sp!, {sp, lr} /* Save a pointer to the above space and lr */ bl PIC_SYM(_C_LABEL(__kern_ldivmod), PLT) ldr lr, [sp, #4] /* Restore lr */ add sp, sp, #8 /* Move sp to the remainder value */ @@ -39,7 +54,7 @@ ENTRY_NP(__aeabi_ldivmod) ENTRY_NP(__aeabi_uldivmod) sub sp, sp, #8 /* Space for the remainder */ - stmfd sp!, {sp, lr} /* Sace the rem pointer and lr */ + stmfd sp!, {sp, lr} /* Save a pointer to the above space and lr */ bl PIC_SYM(_C_LABEL(__qdivrem), PLT) ldr lr, [sp, #4] /* Restore lr */ add sp, sp, #8 /* Move sp to the remainder value */