New sources layout
Change-Id: Ic716f336b7071063997cf5b4dae6d50e0b4631e9
This commit is contained in:
@@ -27,7 +27,7 @@ SRCS+= _setjmp.S
|
||||
SRCS+= sigsetjmp.S
|
||||
|
||||
.if defined(__MINIX)
|
||||
# Already defined in sys-minix
|
||||
# Already defined in minix/lib/libc/arch/arm/sys
|
||||
.else
|
||||
SRCS+= makecontext.c resumecontext.c swapcontext.S
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
# rts sources
|
||||
HERE=${ARCHDIR}/sys-minix
|
||||
.PATH: ${HERE}
|
||||
|
||||
TMP=ucontextoffsets.h.tmp
|
||||
CF=${HERE}/ucontextoffsets.cf
|
||||
|
||||
INCS+=ucontextoffsets.h
|
||||
|
||||
ucontext.o: ucontextoffsets.h
|
||||
|
||||
SRCS+= \
|
||||
__sigreturn.S \
|
||||
_do_kernel_call_intr.S \
|
||||
_ipc.S \
|
||||
brksize.S \
|
||||
get_minix_kerninfo.S \
|
||||
ucontext.S
|
||||
|
||||
ucontextoffsets.h: ${CF}
|
||||
ucontextoffsets.h: ${NETBSDSRCDIR}/sys/sys/ucontext.h
|
||||
ucontextoffsets.h: ${NETBSDSRCDIR}/include/arch/${MACHINE_ARCH}/include/stackframe.h
|
||||
ucontextoffsets.h:
|
||||
${_MKTARGET_CREATE}
|
||||
cat ${CF} | \
|
||||
${TOOL_GENASSYM} -- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} >$TMP && \
|
||||
mv -f $TMP $@
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
/* This routine is the low-level code for returning from signals. */
|
||||
/* It calls _sigreturn, which is the normal "system call" routine. */
|
||||
/* Both __sigreturn and _sigreturn are needed. */
|
||||
#include <machine/asm.h>
|
||||
|
||||
IMPORT(sigreturn)
|
||||
ENTRY(__sigreturn)
|
||||
pop {r0} /* load sigframe.sf_scp into r0 as parameter */
|
||||
b _C_LABEL(sigreturn) /* _sigreturn(struct sigcontext *sf_scpcopy) */
|
||||
@@ -1,8 +0,0 @@
|
||||
#include <minix/ipcconst.h>
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(_do_kernel_call_intr)
|
||||
/* r0 already holds msg ptr */
|
||||
mov r3, #KERVEC_INTR /* r3 determines the SVC type */
|
||||
svc #0 /* trap to kernel */
|
||||
bx lr
|
||||
@@ -1,74 +0,0 @@
|
||||
#include <minix/ipcconst.h>
|
||||
#include <machine/asm.h>
|
||||
|
||||
/**========================================================================* */
|
||||
/* IPC assembly routines * */
|
||||
/**========================================================================* */
|
||||
ENTRY(_ipc_send_intr)
|
||||
push {fp}
|
||||
mov fp, sp
|
||||
mov r2, r1 /* r2 = msg ptr */
|
||||
mov r1, r0 /* r1 = src_dest */
|
||||
mov r0, #SEND /* _ipc_send(dest, ptr) */
|
||||
mov r3, #IPCVEC_INTR /* r3 determines the SVC type */
|
||||
svc #0 /* trap to kernel */
|
||||
pop {fp}
|
||||
bx lr
|
||||
|
||||
ENTRY(_ipc_receive_intr)
|
||||
push {fp}
|
||||
mov fp, sp
|
||||
push {r2} /* save status ptr */
|
||||
mov r2, r1 /* r2 = msg ptr */
|
||||
mov r1, r0 /* r1 = src_dest */
|
||||
mov r0, #RECEIVE /* _ipc_receive(src, ptr) */
|
||||
mov r3, #IPCVEC_INTR /* r3 determines the SVC type */
|
||||
svc #0 /* trap to kernel */
|
||||
pop {r2} /* restore status ptr */
|
||||
str r1, [r2]
|
||||
pop {fp}
|
||||
bx lr
|
||||
|
||||
ENTRY(_ipc_sendrec_intr)
|
||||
push {fp}
|
||||
mov fp, sp
|
||||
mov r2, r1 /* r2 = msg ptr */
|
||||
mov r1, r0 /* r1 = src_dest */
|
||||
mov r0, #SENDREC /* _ipc_sendrec(srcdest, ptr) */
|
||||
mov r3, #IPCVEC_INTR /* r3 determines the SVC type */
|
||||
svc #0 /* trap to kernel */
|
||||
pop {fp}
|
||||
bx lr
|
||||
|
||||
ENTRY(_ipc_notify_intr)
|
||||
push {fp}
|
||||
mov fp, sp
|
||||
mov r1, r0 /* r1 = src_dest */
|
||||
mov r0, #NOTIFY /* _ipc_notify(srcdst) */
|
||||
mov r3, #IPCVEC_INTR /* r3 determines the SVC type */
|
||||
svc #0 /* trap to kernel */
|
||||
pop {fp}
|
||||
bx lr
|
||||
|
||||
ENTRY(_ipc_sendnb_intr)
|
||||
push {fp}
|
||||
mov fp, sp
|
||||
mov r2, r1 /* r2 = msg ptr */
|
||||
mov r1, r0 /* r1 = src_dest */
|
||||
mov r0, #SENDNB /* _ipc_sendnb(dest, ptr) */
|
||||
mov r3, #IPCVEC_INTR /* r3 determines the SVC type */
|
||||
svc #0 /* trap to kernel */
|
||||
pop {fp}
|
||||
bx lr
|
||||
|
||||
ENTRY(_ipc_senda_intr)
|
||||
push {fp}
|
||||
mov fp, sp
|
||||
mov r2, r0 /* r2 = table */
|
||||
/* r1 already holds count */
|
||||
mov r0, #SENDA /* _ipc_senda(table, count) */
|
||||
mov r3, #IPCVEC_INTR /* r3 determines the SVC type */
|
||||
svc #0 /* trap to kernel */
|
||||
pop {fp}
|
||||
bx lr
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
.globl _end
|
||||
.globl _brksize
|
||||
|
||||
.data
|
||||
_brksize: .long _end
|
||||
@@ -1,17 +0,0 @@
|
||||
#include <minix/ipcconst.h>
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(get_minix_kerninfo)
|
||||
push {fp}
|
||||
mov fp, sp
|
||||
push {r0}
|
||||
mov r1, #0
|
||||
mov r2, #0
|
||||
mov r0, #MINIX_KERNINFO /* _get_minix_kerninfo() */
|
||||
mov r3, #IPCVEC_INTR /* r3 determines the SVC type */
|
||||
svc #0 /* trap to kernel */
|
||||
pop {r2} /* r2 = return struct ptr (was r0) */
|
||||
str r1, [r2]
|
||||
pop {fp}
|
||||
bx lr
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
#include <machine/asm.h>
|
||||
#include <ucontextoffsets.h>
|
||||
|
||||
|
||||
IMPORT(getuctx)
|
||||
IMPORT(setuctx)
|
||||
IMPORT(resumecontext)
|
||||
|
||||
|
||||
/* int getcontext(ucontext_t *ucp)
|
||||
* Initialise the structure pointed to by ucp to the current user context
|
||||
* of the calling thread. */
|
||||
ENTRY(getcontext)
|
||||
ENTRY(_getcontext)
|
||||
/* In case a process does not use the FPU and is neither interested in
|
||||
* saving its signal mask, then we can skip the context switch to
|
||||
* PM and kernel altogether and only save general-purpose registers. */
|
||||
|
||||
mov r3, lr /* Save return address:
|
||||
* When setcontext or swapcontext is called,
|
||||
* we jump to this address and continue
|
||||
* running. */
|
||||
|
||||
/* r0 = ucp */
|
||||
|
||||
/* Check null pointer */
|
||||
cmp r0, #0 /* ucp == NULL? */
|
||||
bne 3f /* Not null, continue */
|
||||
mov r1, #EFAULT
|
||||
ldr r2, =_C_LABEL(errno)
|
||||
str r1, [r2] /* errno = EFAULT */
|
||||
mov r0, #-1 /* return -1 */
|
||||
bx lr
|
||||
|
||||
3: /* Check flags */
|
||||
ldr r1, [r0, #UC_FLAGS] /* r1 = ucp->uc_flags */
|
||||
and r1, r1, #[_UC_IGNFPU|_UC_IGNSIGM]
|
||||
cmp r1, #[_UC_IGNFPU|_UC_IGNSIGM] /* Allowed to ignore both? */
|
||||
beq 1f /* If so, skip getuctx */
|
||||
|
||||
0:
|
||||
push {r0, r3}
|
||||
bl _C_LABEL(getuctx) /* getuctx(ucp) */
|
||||
pop {r0, r3}
|
||||
|
||||
1:
|
||||
/* Save the context */
|
||||
mov lr, r3 /* Restore lr */
|
||||
str lr, [r0, #LRREG] /* Save lr */
|
||||
str lr, [r0, #PCREG] /* Save real RTA in mcp struct */
|
||||
str sp, [r0, #SPREG] /* Save stack pointer */
|
||||
str fp, [r0, #FPREG] /* Save fp */
|
||||
str r4, [r0, #REG4] /* Save r4 */
|
||||
str r5, [r0, #REG5] /* Save r5 */
|
||||
str r6, [r0, #REG6] /* Save r6 */
|
||||
str r7, [r0, #REG7] /* Save r7 */
|
||||
str r8, [r0, #REG8] /* Save r8 */
|
||||
str r9, [r0, #REG9] /* Save r9 */
|
||||
str r10, [r0, #REG10] /* Save r10 */
|
||||
|
||||
ldr r1, =MCF_MAGIC
|
||||
str r1, [r0, #MAGIC] /* Set magic value */
|
||||
|
||||
mov r1, #0
|
||||
str r1, [r0, #REG0] /* Return 0 */
|
||||
mov r0, #0 /* Return 0 */
|
||||
|
||||
2:
|
||||
bx lr /* Restore return address */
|
||||
|
||||
|
||||
/* int setcontext(const ucontext_t *ucp)
|
||||
* Restore the user context pointed to by ucp. A successful call to
|
||||
* setcontext does not return; program execution resumes at the point
|
||||
* specified by the ucp argument. If ucp was created with getcontext(),
|
||||
* program execution continues as if the corresponding call of getcontext()
|
||||
* had just returned. If ucp was created with makecontext(), program
|
||||
* execution continues with the function passed to makecontext(). */
|
||||
ENTRY(setcontext)
|
||||
/* In case a process does not use the FPU and is neither interested in
|
||||
* restoring its signal mask, then we can skip the context switch to
|
||||
* PM and kernel altogether and restore state here. */
|
||||
|
||||
/* r0 = ucp */
|
||||
|
||||
/* Check null pointer */
|
||||
cmp r0, #0 /* ucp == NULL? */
|
||||
bne 3f /* Not null, continue */
|
||||
mov r1, #EFAULT
|
||||
ldr r2, =_C_LABEL(errno)
|
||||
str r1, [r2] /* errno = EFAULT */
|
||||
mov r0, #-1 /* return -1 */
|
||||
bx lr
|
||||
|
||||
3: /* Check flags */
|
||||
ldr r1, [r0, #MAGIC] /* r1 = ucp->mc_context.mc_magic */
|
||||
ldr r2, =MCF_MAGIC
|
||||
cmp r1, r2 /* is the magic value set (is context valid)?*/
|
||||
beq 4f /* is set, proceed */
|
||||
mov r1, #EINVAL /* not set, return error code */
|
||||
ldr r2, =_C_LABEL(errno)
|
||||
str r1, [r2] /* errno = EINVAL */
|
||||
mov r0, #-1 /* return -1 */
|
||||
bx lr
|
||||
|
||||
|
||||
4: ldr r1, [r0, #UC_FLAGS] /* r1 = ucp->uc_flags */
|
||||
and r1, r1, #[_UC_IGNFPU|_UC_IGNSIGM]
|
||||
cmp r1, #[_UC_IGNFPU|_UC_IGNSIGM] /* Allowed to ignore both? */
|
||||
beq 1f /* Neither are set, so don't bother restoring FPU
|
||||
* state and signal mask */
|
||||
|
||||
push {r0, r3}
|
||||
0: bl _C_LABEL(setuctx) /* setuctx(ucp) */
|
||||
pop {r0, r3}
|
||||
|
||||
1: /* Restore the registers */
|
||||
ldr r4, [r0, #REG4] /* Restore r4 */
|
||||
ldr r5, [r0, #REG5] /* Restore r5 */
|
||||
ldr r6, [r0, #REG6] /* Restore r6 */
|
||||
ldr r7, [r0, #REG7] /* Restore r7 */
|
||||
ldr r8, [r0, #REG8] /* Restore r8 */
|
||||
ldr r9, [r0, #REG9] /* Restore r9 */
|
||||
ldr r10, [r0, #REG10] /* Restore r10 */
|
||||
ldr r12, [r0, #REG12] /* Restore r12 */
|
||||
ldr fp, [r0, #FPREG] /* Restore fp */
|
||||
ldr sp, [r0, #SPREG] /* Restore sp */
|
||||
ldr lr, [r0, #LRREG] /* Restore lr */
|
||||
mov r3, r0
|
||||
ldr r0, [r3, #REG0] /* Restore r0 */
|
||||
2:
|
||||
ldr pc, [r3, #PCREG] /* Restore pc */
|
||||
|
||||
|
||||
/* void ctx_start()
|
||||
* A wrapper to call resumecontext. Makecontext puts the ucp in r4.
|
||||
* This function moves the ucp into r0 so that the ucp is the first
|
||||
* parameter for resumecontext. The call to resumecontext will start
|
||||
* the next context in the linked list (or exit the program if there
|
||||
* is no context). */
|
||||
ENTRY(ctx_start)
|
||||
mov r0, r4
|
||||
b _C_LABEL(resumecontext)
|
||||
@@ -1,31 +0,0 @@
|
||||
|
||||
include <minix/type.h>
|
||||
include <sys/ucontext.h>
|
||||
include <sys/errno.h>
|
||||
include <machine/mcontext.h>
|
||||
|
||||
struct __ucontext
|
||||
member UC_FLAGS uc_flags
|
||||
member UC_LINK uc_link
|
||||
member MAGIC uc_mcontext.mc_magic
|
||||
member REG0 uc_mcontext.__gregs[_REG_R0]
|
||||
member REG1 uc_mcontext.__gregs[_REG_R1]
|
||||
member REG2 uc_mcontext.__gregs[_REG_R2]
|
||||
member REG3 uc_mcontext.__gregs[_REG_R3]
|
||||
member REG4 uc_mcontext.__gregs[_REG_R4]
|
||||
member REG5 uc_mcontext.__gregs[_REG_R5]
|
||||
member REG6 uc_mcontext.__gregs[_REG_R6]
|
||||
member REG7 uc_mcontext.__gregs[_REG_R7]
|
||||
member REG8 uc_mcontext.__gregs[_REG_R8]
|
||||
member REG9 uc_mcontext.__gregs[_REG_R9]
|
||||
member REG10 uc_mcontext.__gregs[_REG_R10]
|
||||
member FPREG uc_mcontext.__gregs[_REG_FP]
|
||||
member REG12 uc_mcontext.__gregs[_REG_R12]
|
||||
member SPREG uc_mcontext.__gregs[_REG_SP]
|
||||
member LRREG uc_mcontext.__gregs[_REG_LR]
|
||||
member PCREG uc_mcontext.__gregs[_REG_PC]
|
||||
define EFAULT EFAULT
|
||||
define EINVAL EINVAL
|
||||
define MCF_MAGIC MCF_MAGIC
|
||||
define _UC_IGNFPU _UC_IGNFPU
|
||||
define _UC_IGNSIGM _UC_IGNSIGM
|
||||
Reference in New Issue
Block a user