/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/asm_linkage.h>
#define PIC_SETUP(r) \
#define FUNC(x) \
.section ".text"; \
.align 4; \
x:
!
!
!
1:
!
!
!
save %sp, -SA(MINFRAME + EB_MAX_SIZE32), %sp
ldn [%fp + WINDOWSIZE + STACK_BIAS], %o0 ! get argc
add %fp, + WINDOWSIZE + CPTRSIZE + STACK_BIAS, %o1 ! get argv
add %o0, 1, %l0 ! add 1 to argc for last element of 0
sll %l0, CPTRSHIFT, %l0 ! multiply argc by pointer size
add %o1, %l0, %o2 ! and add to argv to get envp
call sbcp_init ! Call our c initalization routine
nop
restore
PIC_SETUP(g2)
ld [%g2+trap0], %g1
ta 9
!
!
!
!
! with (which the 4.x system call stubs depend on) and to allow
! recursive traps (e.g., from a signal handler).
!
FUNC(trap0)
save %sp, -SA(MINFRAME), %sp
tst %g1
be 1f
nop
mov %i0, %o0
mov %i1, %o1
mov %i2, %o2
mov %i3, %o3
mov %i4, %o4
mov %i5, %o5
ba,a 2f
1:
! indir syscall
mov %i0, %g1
mov %i1, %o0
mov %i2, %o1
mov %i3, %o2
mov %i4, %o3
mov %i5, %o4
ld [%fp + MINFRAME], %o5
2:
sll %g1, 4, %l1
PIC_SETUP(l0)
ld [%l0+sysent], %l0
add %l1, %l0, %l1
jmp %l1 ! jump into branch table
nop
SET_SIZE(trap0)
FUNC(trap0rtn)
cmp %o0, -1
bne 1f
addcc %g0, %g0, %g0 ! psr &= ~C
PIC_SETUP(o1)
ld [%o1+errno], %o1
ld [%o1], %o0
subcc %g0, 1, %g0 ! psr |= C
1:
mov %o0, %i0
restore
jmp %g6
nop
SET_SIZE(trap0rtn)
!
! nullsys
!
FUNC(nullsys)
clr %o0
b,a trap0rtn
SET_SIZE(nullsys)
!
! nosys
!
FUNC(nosys)
set ENOSYS, %o1
PIC_SETUP(g2)
ld [%g2+errno], %g2
st %o1, [%g2]
set -1, %o0
b,a trap0rtn
SET_SIZE(nosys)
!
! Have to #include the sysent table and stubs so that all
! symbols referenced between here and there are "static"
! to this module so the assembler can resolve them without
! the linker needing to deal with them at run time.
!
#include "sysent.s"