1effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman/* 2effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * Copyright (C) 2013 The Android Open Source Project 3effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * All rights reserved. 4effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * 5effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * Redistribution and use in source and binary forms, with or without 6effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * modification, are permitted provided that the following conditions 7effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * are met: 8effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * * Redistributions of source code must retain the above copyright 9effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * notice, this list of conditions and the following disclaimer. 10effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * * Redistributions in binary form must reproduce the above copyright 11effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * notice, this list of conditions and the following disclaimer in 12effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * the documentation and/or other materials provided with the 13effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * distribution. 14effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * 15effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 19effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 20effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 21effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 22effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman * SUCH DAMAGE. 27effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman */ 28effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman 29851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes#include <private/bionic_asm.h> 30effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman 31766c7efe28fb066252eeb9b8e47e22970307c09eChris Dearman/* 32766c7efe28fb066252eeb9b8e47e22970307c09eChris Dearman * The caller is only required to allocate 16 bytes of stack for a0-a3. 33766c7efe28fb066252eeb9b8e47e22970307c09eChris Dearman * syscall has up to 6 arguments, so we need space for the extra two arguments. 34766c7efe28fb066252eeb9b8e47e22970307c09eChris Dearman */ 35766c7efe28fb066252eeb9b8e47e22970307c09eChris Dearman#define STACKSIZE 2*4 36766c7efe28fb066252eeb9b8e47e22970307c09eChris Dearman 37851e68a2402fa414544e66650e09dfdaac813e51Elliott HughesENTRY(syscall) 38effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman .set noreorder 39851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes .cpload t9 40851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes move v0, a0 41851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes move a0, a1 42851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes move a1, a2 43851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes move a2, a3 44851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes lw a3, 16(sp) 45851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes lw t0, 20(sp) 46851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes lw t1, 24(sp) 47851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes subu sp, STACKSIZE 48851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes sw t0, 16(sp) 49851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes sw t1, 20(sp) 50effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman syscall 51851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes addu sp, STACKSIZE 52851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes bnez a3, 1f 53851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes move a0, v0 54851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes j ra 55effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman nop 56effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman1: 577efad83d430f4d824f2aaa75edea5106f6ff8aaeElliott Hughes la t9,__set_errno_internal 58851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes j t9 59effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman nop 60effaa7824da1af4db5cef50c78079d4c4e1717a7Chris Dearman .set reorder 61851e68a2402fa414544e66650e09dfdaac813e51Elliott HughesEND(syscall) 62