minix/lib/libc/arch/i386/int64/sub64u.S
Lorenzo Cavallaro a16308efdb cdecl calling convention expects the callee to pop the hidden pointer on
struct return. For example, GCC and LLVM comply with this (tested on IA32).

ACK doesn't seem to follow this convention and expects the caller to clean up
the stack. Compiling hand-written ACK-compliant assembly code (returning a 
struct) with GCC or LLVM used to break things (4-bytes misaligned stack).

The patch fixes this problem.
2010-03-24 17:25:17 +00:00

22 lines
505 B
ArmAsm

/* sub64() - unsigned from 64 bit subtraction Author: Kees J. Bot */
/* 7 Dec 1995 */
#include <minix/compiler.h>
.text
.globl _sub64u, _sub64ul
_sub64u:
/* u64_t sub64u(u64_t i, unsigned j); */
_sub64ul:
/* u64_t sub64ul(u64_t i, unsigned long j); */
movl 4(%esp), %eax
movl 8(%esp), %edx
subl 16(%esp), %edx
movl %edx, (%eax)
movl 12(%esp), %edx
sbbl $0, %edx
movl %edx, 4(%eax)
ret BYTES_TO_POP_ON_STRUCT_RETURN
/* */
/* $PchId: sub64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */