OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc1/] [libgloss/] [lm32/] [scall.S] - Diff between revs 207 and 345

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 207 Rev 345
/*
/*
 * Lattice Mico32 system calls.
 * Lattice Mico32 system calls.
 * Contributed by Jon Beniston 
 * Contributed by Jon Beniston 
 *
 *
 * Redistribution and use in source and binary forms, with or without
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * modification, are permitted provided that the following conditions
 * are met:
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * documentation and/or other materials provided with the distribution.
 *
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * SUCH DAMAGE.
 */
 */
#include 
#include 
/*
/*
 * System call convention (as implemented in simulator:
 * System call convention (as implemented in simulator:
 *    - System call number in register r8
 *    - System call number in register r8
 *    - Return value in r1 and r2 (only if 64-bit value)
 *    - Return value in r1 and r2 (only if 64-bit value)
 *    - errno in r3
 *    - errno in r3
 */
 */
        .extern errno
        .extern errno
        .global _write
        .global _write
_write:
_write:
        mvi     r8, SYS_write
        mvi     r8, SYS_write
        scall
        scall
        mvhi    r4, hi(errno)
        mvhi    r4, hi(errno)
        ori     r4, r4, lo(errno)
        ori     r4, r4, lo(errno)
        sw      (r4+0), r3
        sw      (r4+0), r3
        ret
        ret
        .global _read
        .global _read
_read:
_read:
        mvi     r8, SYS_read
        mvi     r8, SYS_read
        scall
        scall
        mvhi    r4, hi(errno)
        mvhi    r4, hi(errno)
        ori     r4, r4, lo(errno)
        ori     r4, r4, lo(errno)
        sw      (r4+0), r3
        sw      (r4+0), r3
        ret
        ret
        .global _open
        .global _open
_open:
_open:
        mvi     r8, SYS_open
        mvi     r8, SYS_open
        scall
        scall
        mvhi    r4, hi(errno)
        mvhi    r4, hi(errno)
        ori     r4, r4, lo(errno)
        ori     r4, r4, lo(errno)
        sw      (r4+0), r3
        sw      (r4+0), r3
        ret
        ret
        .global _close
        .global _close
_close:
_close:
        mvi     r8, SYS_close
        mvi     r8, SYS_close
        scall
        scall
        mvhi    r4, hi(errno)
        mvhi    r4, hi(errno)
        ori     r4, r4, lo(errno)
        ori     r4, r4, lo(errno)
        sw      (r4+0), r3
        sw      (r4+0), r3
        ret
        ret
        .global _lseek
        .global _lseek
_lseek:
_lseek:
        mvi     r8, SYS_lseek
        mvi     r8, SYS_lseek
        scall
        scall
        mvhi    r4, hi(errno)
        mvhi    r4, hi(errno)
        ori     r4, r4, lo(errno)
        ori     r4, r4, lo(errno)
        sw      (r4+0), r3
        sw      (r4+0), r3
        ret
        ret
        .global _fstat
        .global _fstat
_fstat:
_fstat:
        mvi     r8, SYS_fstat
        mvi     r8, SYS_fstat
        scall
        scall
        mvhi    r4, hi(errno)
        mvhi    r4, hi(errno)
        ori     r4, r4, lo(errno)
        ori     r4, r4, lo(errno)
        sw      (r4+0), r3
        sw      (r4+0), r3
        ret
        ret
        .global _stat
        .global _stat
_stat:
_stat:
        mvi     r8, SYS_stat
        mvi     r8, SYS_stat
        scall
        scall
        mvhi    r4, hi(errno)
        mvhi    r4, hi(errno)
        ori     r4, r4, lo(errno)
        ori     r4, r4, lo(errno)
        sw      (r4+0), r3
        sw      (r4+0), r3
        ret
        ret
        .global _link
        .global _link
_link:
_link:
        mvi     r8, SYS_link
        mvi     r8, SYS_link
        scall
        scall
        mvhi    r4, hi(errno)
        mvhi    r4, hi(errno)
        ori     r4, r4, lo(errno)
        ori     r4, r4, lo(errno)
        sw      (r4+0), r3
        sw      (r4+0), r3
        ret
        ret
        .global _unlink
        .global _unlink
_unlink:
_unlink:
        mvi     r8, SYS_unlink
        mvi     r8, SYS_unlink
        scall
        scall
        mvhi    r4, hi(errno)
        mvhi    r4, hi(errno)
        ori     r4, r4, lo(errno)
        ori     r4, r4, lo(errno)
        sw      (r4+0), r3
        sw      (r4+0), r3
        ret
        ret
        .global _exit
        .global _exit
_exit:
_exit:
        /* This call doesn't return */
        /* This call doesn't return */
        mvi     r8, SYS_exit
        mvi     r8, SYS_exit
        scall
        scall
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.