/* * * Language Independent Library * * Copyright 1983-2000 Green Hills Software,Inc. * * This program is the property of Green Hills Software, Inc, * its contents are proprietary information and no part of it * is to be disclosed to anyone except employees of Green Hills * Software, Inc., or as agreed in writing signed by the President * of Green Hills Software, Inc. * */ /* ind_call.ppc: C callable wrapper for Host I/O system calls (PPC family). */ .file "ind_call.ppc" #include "ppc_regs.ppc" #if defined(EMBEDDED) || defined(__OSE) #ifdef __vle .section ".vletext", "vax" .vle .globl __ghs_syscall __ghs_syscall: se_mflr r0 # prolog se_stw r0, 4(sp) # '' e_stwu sp, -8(sp) # '' crset 2 # set Z(EQ) flag #if defined(TRANSFER_VECTOR) e_bl %tv(__dotsyscall) # call into .syscall section se_beq __noerr # if no error, return e_bl %tv(__gh_set_errno) # else set errno with r3 error code #else e_bl __dotsyscall # call into .syscall section se_beq __noerr # if no error, return e_bl __gh_set_errno # else set errno with r3 error code #endif se_bmaski r3, 0 # and return -1 __noerr: se_lwz r0, 12(sp) # epilog se_mtlr r0 # '' se_addi sp, 8 # '' se_blr # done #else /* __vle */ .text # if defined(__PPC64_ABI__) && !defined(__PPC64_NO_FUNC_DESC) .section ".opd", "aw" .align 3 .global __ghs_syscall __ghs_syscall: .quad .__ghs_syscall, .TOC.@tocbase, 0 .size __ghs_syscall, 24 .text .globl .__ghs_syscall .__ghs_syscall: # else .globl __ghs_syscall __ghs_syscall: # endif mflr r0 # prolog #ifdef __PPC64__ # ifdef __PPC64_ABI__ std r0, 16(sp) stdu sp, -112(sp) # 6(header)+8(parm save area) double words # else std r0, 8(sp) stdu sp, -16(sp) # endif #else stw r0, 4(sp) # '' stwu sp, -8(sp) # '' #endif crset 2 # set Z(EQ) flag /* Note: the + on the beq below sidesteps the PPC860 erratum that may otherwise result (as we hit the beq after executing a blr in ind_dots.ppc) This erratum is numbered CPU3(CPU8) */ #if defined(TRANSFER_VECTOR) bl %tv(__dotsyscall) # call into .syscall section beq+ __noerr # if no error, return bl %tv(__gh_set_errno) # else set errno with r3 error code #else bl __dotsyscall # call into .syscall section beq+ __noerr # if no error, return bl __gh_set_errno # else set errno with r3 error code #endif li r3, -1 # and return -1 __noerr: #ifdef __PPC64__ # ifdef __PPC64_ABI__ ld r0, 128(sp) mtlr r0 addi sp, sp, 112 blr # else ld r0, 24(sp) mtlr r0 addi sp, sp, 16 blr # endif #else lwz r0, 12(sp) # epilog mtlr r0 # '' addi sp, sp, 8 # '' blr # done #endif #endif /* __vle */ #ifdef __ELF .fsize 8 .scall __dotsyscall .scall __gh_set_errno # if defined(__PPC64_ABI__) && !defined(__PPC64_NO_FUNC_DESC) .type .__ghs_syscall,@function .size .__ghs_syscall,$-.__ghs_syscall # else .type __ghs_syscall,@function .size __ghs_syscall,$-__ghs_syscall # endif #endif /* __ELF */ #endif