Reword the comment about "millicode" nature of these functions and add
it to sdivsi3.S too. Remove !_KERNEL code left over from the days when we shared these files with userland. Use .L prefix for local label.
This commit is contained in:
parent
c74d0fafd6
commit
41f19aa9d6
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sdivsi3.S,v 1.11 2011/07/14 09:48:03 mrg Exp $ */
|
||||
/* $NetBSD: sdivsi3.S,v 1.12 2011/08/05 01:59:39 uwe Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
|
@ -36,9 +36,26 @@
|
|||
|
||||
#include <machine/asm.h>
|
||||
#if defined(LIBC_SCCS)
|
||||
RCSID("$NetBSD: sdivsi3.S,v 1.11 2011/07/14 09:48:03 mrg Exp $")
|
||||
RCSID("$NetBSD: sdivsi3.S,v 1.12 2011/08/05 01:59:39 uwe Exp $")
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IMPOTANT: This function is special.
|
||||
*
|
||||
* This function is an auxiliary "millicode" function that is
|
||||
* referenced by the code generated by gcc for signed integer
|
||||
* division. But gcc does NOT treat a call to this function as an
|
||||
* ordinary function call - it can clobber only R1, R2 and R3.
|
||||
*
|
||||
* See the definition of "divsi3_i1" in gcc/config/sh/sh.md
|
||||
*
|
||||
* As the consequence this function cannot be called via any
|
||||
* indirection that assumes normal calling convention:
|
||||
*
|
||||
* . cannot have _PROF_PROLOGUE
|
||||
* . cannot be called via PLT (not relevant for kernel)
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __ELF__
|
||||
.hidden __sdivsi3
|
||||
|
@ -51,7 +68,7 @@ NENTRY(__sdivsi3)
|
|||
mov r5, r1
|
||||
|
||||
tst r1, r1
|
||||
bt div_by_zero
|
||||
bt .L_div_by_zero
|
||||
|
||||
mov #0, r2
|
||||
div0s r2, r0
|
||||
|
@ -70,33 +87,6 @@ NENTRY(__sdivsi3)
|
|||
rts
|
||||
addc r2, r0
|
||||
|
||||
div_by_zero:
|
||||
#ifdef _KERNEL
|
||||
.L_div_by_zero:
|
||||
rts
|
||||
mov #0, r0
|
||||
#else
|
||||
mov.l r14, @-r15
|
||||
sts.l pr, @-r15
|
||||
mov r15, r14
|
||||
|
||||
mov.l L_raise, r1
|
||||
#ifdef PIC
|
||||
1: bsrf r1
|
||||
#else
|
||||
jsr @r1
|
||||
#endif
|
||||
mov #8, r4 /* delay slot. 8 <- SIGFPE. */
|
||||
mov #0, r0
|
||||
|
||||
lds.l @r15+, pr
|
||||
rts
|
||||
mov.l @r15+, r14
|
||||
|
||||
.align 2
|
||||
L_raise:
|
||||
#ifdef PIC
|
||||
.long _C_LABEL(raise)-(1b+4)
|
||||
#else
|
||||
.long _C_LABEL(raise)
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: udivsi3.S,v 1.10 2011/07/14 09:48:04 mrg Exp $ */
|
||||
/* $NetBSD: udivsi3.S,v 1.11 2011/08/05 01:59:39 uwe Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
|
@ -36,26 +36,24 @@
|
|||
|
||||
#include <machine/asm.h>
|
||||
#if defined(LIBC_SCCS)
|
||||
RCSID("$NetBSD: udivsi3.S,v 1.10 2011/07/14 09:48:04 mrg Exp $")
|
||||
RCSID("$NetBSD: udivsi3.S,v 1.11 2011/08/05 01:59:39 uwe Exp $")
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IMPOTANT: This function is special.
|
||||
*
|
||||
* This function is an auxiliary function that is referenced by the
|
||||
* code generated by gcc for integer division. But gcc does NOT treat
|
||||
* a call to this function as an ordinary function call w.r.t. the set
|
||||
* of register this call clobbers. See the definition of "udivsi3_i1"
|
||||
* in gcc/config/sh/sh.md.
|
||||
* This function is an auxiliary "millicode" function that is
|
||||
* referenced by the code generated by gcc for unsigned integer
|
||||
* division. But gcc does NOT treat a call to this function as an
|
||||
* ordinary function call - it can clobber only R4.
|
||||
*
|
||||
* Any call to this function MUST NOT clobber any registers besides r4
|
||||
* and r0, where the result is returned. At the time of the call the
|
||||
* r4 contains the first argument, so we are only left with r0, and we
|
||||
* cannot do anything meaningful using only one register. The
|
||||
* consequences are:
|
||||
* See the definition of "udivsi3_i1" in gcc/config/sh/sh.md
|
||||
*
|
||||
* . this function cannot have _PROF_PROLOGUE
|
||||
* . this function cannot be called via PLT
|
||||
* As the consequence this function cannot be called via any
|
||||
* indirection that assumes normal calling convention:
|
||||
*
|
||||
* . cannot have _PROF_PROLOGUE
|
||||
* . cannot be called via PLT (not relevant for kernel)
|
||||
*/
|
||||
|
||||
|
||||
|
@ -67,7 +65,7 @@
|
|||
/* r0 <= r4 / r5 */
|
||||
NENTRY(__udivsi3)
|
||||
tst r5, r5
|
||||
bt div_by_zero
|
||||
bt .L_div_by_zero
|
||||
|
||||
mov #0, r0
|
||||
div0u
|
||||
|
@ -83,33 +81,6 @@ NENTRY(__udivsi3)
|
|||
rts
|
||||
mov r4, r0
|
||||
|
||||
div_by_zero:
|
||||
#ifdef _KERNEL
|
||||
.L_div_by_zero:
|
||||
rts
|
||||
mov #0, r0
|
||||
#else
|
||||
mov.l r14, @-r15
|
||||
sts.l pr, @-r15
|
||||
mov r15, r14
|
||||
|
||||
mov.l L_raise, r1
|
||||
#ifdef PIC
|
||||
1: bsrf r1
|
||||
#else
|
||||
jsr @r1
|
||||
#endif
|
||||
mov #8, r4 /* delay slot. 8 <- SIGFPE. */
|
||||
mov #0, r0
|
||||
|
||||
lds.l @r15+, pr
|
||||
rts
|
||||
mov.l @r15+, r14
|
||||
|
||||
.align 2
|
||||
L_raise:
|
||||
#ifdef PIC
|
||||
.long _C_LABEL(raise)-(1b+4)
|
||||
#else
|
||||
.long _C_LABEL(raise)
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue