Thread (16 messages) flat view 16 messages, 4 authors, 2019-02-20

Re: [PATCH 6/6] powerpc sstep: Add modsd, modud instruction emulation

From: Segher Boessenkool <hidden>
Date: 2018-09-04 21:22:24

On Mon, Sep 03, 2018 at 08:49:38PM +0530, Sandipan Das wrote:
+#ifdef __powerpc64__
+		case 265:	/* modud */
+			if (!cpu_has_feature(CPU_FTR_ARCH_300))
+				return -1;
+			op->val = regs->gpr[ra] % regs->gpr[rb];
+			goto compute_done;
+#endif
The mod instruction has special cases that aren't handled by this C code,
too (divide by 0, or signed division of the most negative number by -1).
For the mod intruction the behaviour is undefined in those cases, but you
probably should force some specific behaviour.  You don't want the kernel
to execute a trap instruction, etc. :-)


Segher
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help