;
;               Language Independent Runtime Library
;
;       Copyright 2013
;                   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.
;

#if defined(EMBEDDED)
	.text
#ifdef __ghs_asm
; Define an argcheck __callee symbol for the function __ghs_syscall.
; int __ghs_syscall(int, ...)
__callee.__ghs_syscall.i.ie::               \
	.size __callee.__ghs_syscall.i.ie,0
#endif
__ghs_syscall::
	adrp	ip0, __dotsyscall
	str 	lr, [sp, -16]!
	add	ip0, ip0, :lo12:__dotsyscall
	cmn	wzr, wzr
	blr	ip0
	b.cc	noerror
	bl	__gh_set_errno
	movn	w0, #0
noerror:
	ldr	lr, [sp], 16
	ret
	.endf 	__ghs_syscall
	.maxstack __ghs_syscall,16
	.frameinfo __ghs_syscall,16,-16,0x40000000
	.scall  __ghs_syscall, __gh_set_errno
	.scall  __ghs_syscall, __dotsyscall

#ifdef __ghs_asm
; Define an argcheck __callee symbol for the function __ghs_syscall64.
; int64_t __ghs_syscall64(int, ...)
__callee.__ghs_syscall64.l.ie::               \
	.size __callee.__ghs_syscall64.l.ie,0
#endif
__ghs_syscall64::
	adrp	ip0, __dotsyscall
	str 	lr, [sp, -16]!
	add	ip0, ip0, :lo12:__dotsyscall
	cmn	wzr, wzr
	blr	ip0
	b.cc	noerror64
	bl	__gh_set_errno
	movn	x0, #0
noerror64:
	ldr	lr, [sp], 16
	ret
	.endf 	__ghs_syscall64
	.maxstack __ghs_syscall64,16
	.frameinfo __ghs_syscall64,16,-16,0x40000000
	.scall  __ghs_syscall64, __gh_set_errno
	.scall  __ghs_syscall64, __dotsyscall
#endif
