repo_id
stringlengths 5
115
| size
int64 590
5.01M
| file_path
stringlengths 4
212
| content
stringlengths 590
5.01M
|
|---|---|---|---|
acidanthera/audk
| 2,130
|
ArmPkg/Drivers/ArmGicDxe/GicV3/Arm/ArmGicV3.S
|
#
# Copyright (c) 2014, ARM Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
#
#include <AsmMacroLib.h>
#include <Library/ArmLib.h>
// For the moment we assume this will run in SVC mode on ARMv7
//UINT32
//EFIAPI
//ArmGicGetControlSystemRegisterEnable (
// VOID
// );
ASM_FUNC(ArmGicV3GetControlSystemRegisterEnable)
mrc p15, 0, r0, c12, c12, 5 // ICC_SRE
bx lr
//VOID
//EFIAPI
//ArmGicSetControlSystemRegisterEnable (
// IN UINT32 ControlSystemRegisterEnable
// );
ASM_FUNC(ArmGicV3SetControlSystemRegisterEnable)
mcr p15, 0, r0, c12, c12, 5 // ICC_SRE
isb
bx lr
//VOID
//ArmGicV3EnableInterruptInterface (
// VOID
// );
ASM_FUNC(ArmGicV3EnableInterruptInterface)
mov r0, #1
mcr p15, 0, r0, c12, c12, 7 // ICC_IGRPEN1
bx lr
//VOID
//ArmGicV3DisableInterruptInterface (
// VOID
// );
ASM_FUNC(ArmGicV3DisableInterruptInterface)
mov r0, #0
mcr p15, 0, r0, c12, c12, 7 // ICC_IGRPEN1
bx lr
//VOID
//ArmGicV3EndOfInterrupt (
// IN UINTN InterruptId
// );
ASM_FUNC(ArmGicV3EndOfInterrupt)
mcr p15, 0, r0, c12, c12, 1 //ICC_EOIR1
bx lr
//UINTN
//ArmGicV3AcknowledgeInterrupt (
// VOID
// );
ASM_FUNC(ArmGicV3AcknowledgeInterrupt)
mrc p15, 0, r0, c12, c12, 0 //ICC_IAR1
bx lr
//VOID
//ArmGicV3SetPriorityMask (
// IN UINTN Priority
// );
ASM_FUNC(ArmGicV3SetPriorityMask)
mcr p15, 0, r0, c4, c6, 0 //ICC_PMR
bx lr
//VOID
//ArmGicV3SetBinaryPointer (
// IN UINTN BinaryPoint
// );
ASM_FUNC(ArmGicV3SetBinaryPointer)
mcr p15, 0, r0, c12, c12, 3 //ICC_BPR1
bx lr
//UINTN
//ArmGicV3GetControlRegister(
// VOID
// );
ASM_FUNC(ArmGicV3GetControlRegister)
mrc p15, 0, r0, c12, c12, 4 //ICC_CTLR
bx lr
//VOID
//ArmGicV3SetControlRegister(
// IN UINTN Value
// );
ASM_FUNC(ArmGicV3SetControlRegister)
mcr p15, 0, r0, c12, c12, 4 //ICC_CTLR
bx lr
|
acidanthera/audk
| 3,747
|
UefiCpuPkg/Library/BaseRiscV64CpuExceptionHandlerLib/SupervisorTrapHandler.S
|
/** @file
RISC-V Processor supervisor mode trap handler
Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <Base.h>
#include "CpuExceptionHandlerLib.h"
.align 3
.section .entry, "ax", %progbits
.globl SupervisorModeTrap
SupervisorModeTrap:
addi sp, sp, -SMODE_TRAP_REGS_SIZE
/* Save all general regisers except SP */
sd t0, SMODE_TRAP_REGS_OFFSET(t0)(sp)
csrr t0, CSR_SSTATUS
sd t0, SMODE_TRAP_REGS_OFFSET(sstatus)(sp)
csrr t0, CSR_SEPC
sd t0, SMODE_TRAP_REGS_OFFSET(sepc)(sp)
csrr t0, CSR_STVAL
sd t0, SMODE_TRAP_REGS_OFFSET(stval)(sp)
ld t0, SMODE_TRAP_REGS_OFFSET(t0)(sp)
sd zero, SMODE_TRAP_REGS_OFFSET(zero)(sp)
sd ra, SMODE_TRAP_REGS_OFFSET(ra)(sp)
sd gp, SMODE_TRAP_REGS_OFFSET(gp)(sp)
sd tp, SMODE_TRAP_REGS_OFFSET(tp)(sp)
sd t1, SMODE_TRAP_REGS_OFFSET(t1)(sp)
sd t2, SMODE_TRAP_REGS_OFFSET(t2)(sp)
sd s0, SMODE_TRAP_REGS_OFFSET(s0)(sp)
sd s1, SMODE_TRAP_REGS_OFFSET(s1)(sp)
sd a0, SMODE_TRAP_REGS_OFFSET(a0)(sp)
sd a1, SMODE_TRAP_REGS_OFFSET(a1)(sp)
sd a2, SMODE_TRAP_REGS_OFFSET(a2)(sp)
sd a3, SMODE_TRAP_REGS_OFFSET(a3)(sp)
sd a4, SMODE_TRAP_REGS_OFFSET(a4)(sp)
sd a5, SMODE_TRAP_REGS_OFFSET(a5)(sp)
sd a6, SMODE_TRAP_REGS_OFFSET(a6)(sp)
sd a7, SMODE_TRAP_REGS_OFFSET(a7)(sp)
sd s2, SMODE_TRAP_REGS_OFFSET(s2)(sp)
sd s3, SMODE_TRAP_REGS_OFFSET(s3)(sp)
sd s4, SMODE_TRAP_REGS_OFFSET(s4)(sp)
sd s5, SMODE_TRAP_REGS_OFFSET(s5)(sp)
sd s6, SMODE_TRAP_REGS_OFFSET(s6)(sp)
sd s7, SMODE_TRAP_REGS_OFFSET(s7)(sp)
sd s8, SMODE_TRAP_REGS_OFFSET(s8)(sp)
sd s9, SMODE_TRAP_REGS_OFFSET(s9)(sp)
sd s10, SMODE_TRAP_REGS_OFFSET(s10)(sp)
sd s11, SMODE_TRAP_REGS_OFFSET(s11)(sp)
sd t3, SMODE_TRAP_REGS_OFFSET(t3)(sp)
sd t4, SMODE_TRAP_REGS_OFFSET(t4)(sp)
sd t5, SMODE_TRAP_REGS_OFFSET(t5)(sp)
sd t6, SMODE_TRAP_REGS_OFFSET(t6)(sp)
/* Call to Supervisor mode trap handler in CpuExceptionHandlerLib.c */
mv a0, sp
call RiscVSupervisorModeTrapHandler
/* Restore all general regisers except SP */
ld ra, SMODE_TRAP_REGS_OFFSET(ra)(sp)
ld gp, SMODE_TRAP_REGS_OFFSET(gp)(sp)
ld tp, SMODE_TRAP_REGS_OFFSET(tp)(sp)
ld t2, SMODE_TRAP_REGS_OFFSET(t2)(sp)
ld t1, SMODE_TRAP_REGS_OFFSET(t1)(sp)
ld s0, SMODE_TRAP_REGS_OFFSET(s0)(sp)
ld s1, SMODE_TRAP_REGS_OFFSET(s1)(sp)
ld a0, SMODE_TRAP_REGS_OFFSET(a0)(sp)
ld a1, SMODE_TRAP_REGS_OFFSET(a1)(sp)
ld a2, SMODE_TRAP_REGS_OFFSET(a2)(sp)
ld a3, SMODE_TRAP_REGS_OFFSET(a3)(sp)
ld a4, SMODE_TRAP_REGS_OFFSET(a4)(sp)
ld a5, SMODE_TRAP_REGS_OFFSET(a5)(sp)
ld a6, SMODE_TRAP_REGS_OFFSET(a6)(sp)
ld a7, SMODE_TRAP_REGS_OFFSET(a7)(sp)
ld s2, SMODE_TRAP_REGS_OFFSET(s2)(sp)
ld s3, SMODE_TRAP_REGS_OFFSET(s3)(sp)
ld s4, SMODE_TRAP_REGS_OFFSET(s4)(sp)
ld s5, SMODE_TRAP_REGS_OFFSET(s5)(sp)
ld s6, SMODE_TRAP_REGS_OFFSET(s6)(sp)
ld s7, SMODE_TRAP_REGS_OFFSET(s7)(sp)
ld s8, SMODE_TRAP_REGS_OFFSET(s8)(sp)
ld s9, SMODE_TRAP_REGS_OFFSET(s9)(sp)
ld s10, SMODE_TRAP_REGS_OFFSET(s10)(sp)
ld s11, SMODE_TRAP_REGS_OFFSET(s11)(sp)
ld t3, SMODE_TRAP_REGS_OFFSET(t3)(sp)
ld t4, SMODE_TRAP_REGS_OFFSET(t4)(sp)
ld t5, SMODE_TRAP_REGS_OFFSET(t5)(sp)
ld t6, SMODE_TRAP_REGS_OFFSET(t6)(sp)
ld t0, SMODE_TRAP_REGS_OFFSET(sepc)(sp)
csrw CSR_SEPC, t0
ld t0, SMODE_TRAP_REGS_OFFSET(sstatus)(sp)
csrw CSR_SSTATUS, t0
ld t0, SMODE_TRAP_REGS_OFFSET(stval)(sp)
csrw CSR_STVAL, t0
ld t0, SMODE_TRAP_REGS_OFFSET(t0)(sp)
addi sp, sp, SMODE_TRAP_REGS_SIZE
sret
|
acidanthera/audk
| 1,371
|
UefiCpuPkg/Library/CpuMmuLib/LoongArch64/TlbExceptionHandle.S
|
#------------------------------------------------------------------------------
#
# TLB refill exception handler
#
# Copyright (c) 2024 Loongson Technology Corporation Limited. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
#-----------------------------------------------------------------------------
#include <Register/LoongArch64/Csr.h>
ASM_GLOBAL ASM_PFX(HandleTlbRefillStart)
ASM_GLOBAL ASM_PFX(HandleTlbRefillEnd)
#
# Refill the page table.
# @param VOID
# @retval VOID
#
ASM_PFX(HandleTlbRefillStart):
csrwr $t0, LOONGARCH_CSR_TLBRSAVE
csrrd $t0, LOONGARCH_CSR_PWCTL1
srli.d $t0, $t0, 18
andi $t0, $t0, 0x3F
bnez $t0, Level5
csrrd $t0, LOONGARCH_CSR_PWCTL1
srli.d $t0, $t0, 6
andi $t0, $t0, 0x3F
bnez $t0, Level4
csrrd $t0, LOONGARCH_CSR_PGD
b Level3
Level5:
csrrd $t0, LOONGARCH_CSR_PGD
lddir $t0, $t0, 4 #Put pud BaseAddress into T0
lddir $t0, $t0, 3 #Put pud BaseAddress into T0
b Level3
Level4:
csrrd $t0, LOONGARCH_CSR_PGD
lddir $t0, $t0, 3 #Put pud BaseAddress into T0
Level3:
lddir $t0, $t0, 2 #Put pmd BaseAddress into T0
lddir $t0, $t0, 1 #Put pte BaseAddress into T0
ldpte $t0, 0
ldpte $t0, 1
tlbfill // refill hi, lo0, lo1
csrrd $t0, LOONGARCH_CSR_TLBRSAVE
ertn
ASM_PFX(HandleTlbRefillEnd):
.end
|
acidanthera/audk
| 10,736
|
UefiCpuPkg/Library/CpuExceptionHandlerLib/LoongArch/LoongArch64/ExceptionHandlerAsm.S
|
#------------------------------------------------------------------------------
#
# LoongArch64 ASM exception handler
#
# Copyright (c) 2024, Loongson Technology Corporation Limited. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
#------------------------------------------------------------------------------
#include <Library/BaseLib.h>
#include <Library/CpuLib.h>
#include <Register/LoongArch64/Csr.h>
#define RSIZE 8 // 64 bit mode register size
#define GP_REG_CONTEXT_SIZE 32 * RSIZE // General-purpose registers size
#define FP_REG_CONTEXT_SIZE 34 * RSIZE // Floating-point registers size
#define CSR_REG_CONTEXT_SIZE 9 * RSIZE // CSR registers size
ASM_GLOBAL ASM_PFX(ExceptionEntry)
ASM_GLOBAL ASM_PFX(ExceptionEntryStart)
ASM_GLOBAL ASM_PFX(ExceptionEntryEnd)
ASM_PFX(ExceptionEntry):
move $s0, $a0
bl GetExceptionType // Exception type stored in register a0
move $a1, $s0 // SystemContxt
bl CommonExceptionHandler
PopContext:
//
// Not sure if interrupts are turned on during the exception handler, anyway disable interrupts here.
// It will be turned on when the instruction 'ertn' is executed.
//
bl DisableInterrupts
move $a0, $s0 // Restore a0 parameter through s0(EFI_SYSTEM_CONTEXT)
bl GetExceptionType // Get current exception type, and stored in register a0
// Check whether the FPE is changed during interrupt handler, if ture restore it.
ld.d $t1, $sp, (LOONGARCH_CSR_EUEN * RSIZE + GP_REG_CONTEXT_SIZE)
csrrd $t0, LOONGARCH_CSR_EUEN // Current EUEN
andi $t0, $t0, CSR_EUEN_FPEN
andi $t1, $t1, CSR_EUEN_FPEN
li.d $t2, EXCEPT_LOONGARCH_INT
bne $a0, $t2, PopRegs
beq $t0, $t1, PopRegs
beqz $t1, CloseFP
bl EnableFloatingPointUnits
b PopRegs
CloseFP:
bl DisableFloatingPointUnits
PopRegs:
//
// Pop CSR reigsters
//
addi.d $sp, $sp, GP_REG_CONTEXT_SIZE
ld.d $t0, $sp, LOONGARCH_CSR_CRMD * RSIZE
csrwr $t0, LOONGARCH_CSR_CRMD
ld.d $t0, $sp, LOONGARCH_CSR_PRMD * RSIZE
csrwr $t0, LOONGARCH_CSR_PRMD
ld.d $t0, $sp, LOONGARCH_CSR_ECFG * RSIZE
csrwr $t0, LOONGARCH_CSR_ECFG
ld.d $t0, $sp, LOONGARCH_CSR_ERA * RSIZE
csrwr $t0, LOONGARCH_CSR_ERA
addi.d $sp, $sp, CSR_REG_CONTEXT_SIZE // Fource change the stack pointer befor pop the FP registers.
beqz $t1, PopGP // If the FPE not set, only pop the GP registers.
//
// Pop FP registers
//
fld.d $fa0, $sp, 0 * RSIZE
fld.d $fa1, $sp, 1 * RSIZE
fld.d $fa2, $sp, 2 * RSIZE
fld.d $fa3, $sp, 3 * RSIZE
fld.d $fa4, $sp, 4 * RSIZE
fld.d $fa5, $sp, 5 * RSIZE
fld.d $fa6, $sp, 6 * RSIZE
fld.d $fa7, $sp, 7 * RSIZE
fld.d $ft0, $sp, 8 * RSIZE
fld.d $ft1, $sp, 9 * RSIZE
fld.d $ft2, $sp, 10 * RSIZE
fld.d $ft3, $sp, 11 * RSIZE
fld.d $ft4, $sp, 12 * RSIZE
fld.d $ft5, $sp, 13 * RSIZE
fld.d $ft6, $sp, 14 * RSIZE
fld.d $ft7, $sp, 15 * RSIZE
fld.d $ft8, $sp, 16 * RSIZE
fld.d $ft9, $sp, 17 * RSIZE
fld.d $ft10, $sp, 18 * RSIZE
fld.d $ft11, $sp, 19 * RSIZE
fld.d $ft12, $sp, 20 * RSIZE
fld.d $ft13, $sp, 21 * RSIZE
fld.d $ft14, $sp, 22 * RSIZE
fld.d $ft15, $sp, 23 * RSIZE
fld.d $fs0, $sp, 24 * RSIZE
fld.d $fs1, $sp, 25 * RSIZE
fld.d $fs2, $sp, 26 * RSIZE
fld.d $fs3, $sp, 27 * RSIZE
fld.d $fs4, $sp, 28 * RSIZE
fld.d $fs5, $sp, 29 * RSIZE
fld.d $fs6, $sp, 30 * RSIZE
fld.d $fs7, $sp, 31 * RSIZE
ld.d $t0, $sp, 32 * RSIZE
movgr2fcsr $r0, $t0 // Pop the fcsr0 register.
//
// Pop the fcc0-fcc7 registers.
//
ld.d $t0, $sp, 33 * RSIZE
bstrpick.d $t1, $t0, 7, 0
movgr2cf $fcc0, $t1
bstrpick.d $t1, $t0, 15, 8
movgr2cf $fcc1, $t1
bstrpick.d $t1, $t0, 23, 16
movgr2cf $fcc2, $t1
bstrpick.d $t1, $t0, 31, 24
movgr2cf $fcc3, $t1
bstrpick.d $t1, $t0, 39, 32
movgr2cf $fcc4, $t1
bstrpick.d $t1, $t0, 47, 40
movgr2cf $fcc5, $t1
bstrpick.d $t1, $t0, 55, 48
movgr2cf $fcc6, $t1
bstrpick.d $t1, $t0, 63, 56
movgr2cf $fcc7, $t1
PopGP:
//
// Pop GP registers
//
addi.d $sp, $sp, -(GP_REG_CONTEXT_SIZE + CSR_REG_CONTEXT_SIZE)
ld.d $ra, $sp, 1 * RSIZE
ld.d $tp, $sp, 2 * RSIZE
ld.d $a0, $sp, 4 * RSIZE
ld.d $a1, $sp, 5 * RSIZE
ld.d $a2, $sp, 6 * RSIZE
ld.d $a3, $sp, 7 * RSIZE
ld.d $a4, $sp, 8 * RSIZE
ld.d $a5, $sp, 9 * RSIZE
ld.d $a6, $sp, 10 * RSIZE
ld.d $a7, $sp, 11 * RSIZE
ld.d $t0, $sp, 12 * RSIZE
ld.d $t1, $sp, 13 * RSIZE
ld.d $t2, $sp, 14 * RSIZE
ld.d $t3, $sp, 15 * RSIZE
ld.d $t4, $sp, 16 * RSIZE
ld.d $t5, $sp, 17 * RSIZE
ld.d $t6, $sp, 18 * RSIZE
ld.d $t7, $sp, 19 * RSIZE
ld.d $t8, $sp, 20 * RSIZE
ld.d $r21, $sp, 21 * RSIZE
ld.d $fp, $sp, 22 * RSIZE
ld.d $s0, $sp, 23 * RSIZE
ld.d $s1, $sp, 24 * RSIZE
ld.d $s2, $sp, 25 * RSIZE
ld.d $s3, $sp, 26 * RSIZE
ld.d $s4, $sp, 27 * RSIZE
ld.d $s5, $sp, 28 * RSIZE
ld.d $s6, $sp, 29 * RSIZE
ld.d $s7, $sp, 30 * RSIZE
ld.d $s8, $sp, 31 * RSIZE
ld.d $sp, $sp, 3 * RSIZE
ertn // Returen from exception.
//
// End of ExceptionEntry
//
ASM_PFX(ExceptionEntryStart):
//
// Store the old stack pointer in preparation for pushing the exception context onto the new stack.
//
csrwr $sp, LOONGARCH_CSR_KS0
csrrd $sp, LOONGARCH_CSR_KS0
//
// Push GP registers
//
addi.d $sp, $sp, -(GP_REG_CONTEXT_SIZE + FP_REG_CONTEXT_SIZE + CSR_REG_CONTEXT_SIZE)
st.d $zero, $sp, 0 * RSIZE
st.d $ra, $sp, 1 * RSIZE
st.d $tp, $sp, 2 * RSIZE
st.d $a0, $sp, 4 * RSIZE
st.d $a1, $sp, 5 * RSIZE
st.d $a2, $sp, 6 * RSIZE
st.d $a3, $sp, 7 * RSIZE
st.d $a4, $sp, 8 * RSIZE
st.d $a5, $sp, 9 * RSIZE
st.d $a6, $sp, 10 * RSIZE
st.d $a7, $sp, 11 * RSIZE
st.d $t0, $sp, 12 * RSIZE
st.d $t1, $sp, 13 * RSIZE
st.d $t2, $sp, 14 * RSIZE
st.d $t3, $sp, 15 * RSIZE
st.d $t4, $sp, 16 * RSIZE
st.d $t5, $sp, 17 * RSIZE
st.d $t6, $sp, 18 * RSIZE
st.d $t7, $sp, 19 * RSIZE
st.d $t8, $sp, 20 * RSIZE
st.d $r21, $sp, 21 * RSIZE
st.d $fp, $sp, 22 * RSIZE
st.d $s0, $sp, 23 * RSIZE
st.d $s1, $sp, 24 * RSIZE
st.d $s2, $sp, 25 * RSIZE
st.d $s3, $sp, 26 * RSIZE
st.d $s4, $sp, 27 * RSIZE
st.d $s5, $sp, 28 * RSIZE
st.d $s6, $sp, 29 * RSIZE
st.d $s7, $sp, 30 * RSIZE
st.d $s8, $sp, 31 * RSIZE
csrrd $t0, LOONGARCH_CSR_KS0 // Read the old stack pointer.
st.d $t0, $sp, 3 * RSIZE
//
// Push CSR registers
//
addi.d $sp, $sp, GP_REG_CONTEXT_SIZE
csrrd $t0, LOONGARCH_CSR_CRMD
st.d $t0, $sp, LOONGARCH_CSR_CRMD * RSIZE
csrrd $t0, LOONGARCH_CSR_PRMD
st.d $t0, $sp, LOONGARCH_CSR_PRMD * RSIZE
csrrd $t0, LOONGARCH_CSR_EUEN
st.d $t0, $sp, LOONGARCH_CSR_EUEN * RSIZE
csrrd $t0, LOONGARCH_CSR_MISC
st.d $t0, $sp, LOONGARCH_CSR_MISC * RSIZE
csrrd $t0, LOONGARCH_CSR_ECFG
st.d $t0, $sp, LOONGARCH_CSR_ECFG * RSIZE
csrrd $t0, LOONGARCH_CSR_ESTAT
st.d $t0, $sp, LOONGARCH_CSR_ESTAT * RSIZE
csrrd $t0, LOONGARCH_CSR_ERA
st.d $t0, $sp, LOONGARCH_CSR_ERA * RSIZE
csrrd $t0, LOONGARCH_CSR_BADV
st.d $t0, $sp, LOONGARCH_CSR_BADV * RSIZE
csrrd $t0, LOONGARCH_CSR_BADI
st.d $t0, $sp, LOONGARCH_CSR_BADI * RSIZE
//
// Push FP registers
//
addi.d $sp, $sp, CSR_REG_CONTEXT_SIZE
csrrd $t0, LOONGARCH_CSR_EUEN
andi $t0, $t0, CSR_EUEN_FPEN
beqz $t0, PushRegDone
fst.d $fa0, $sp, 0 * RSIZE
fst.d $fa1, $sp, 1 * RSIZE
fst.d $fa2, $sp, 2 * RSIZE
fst.d $fa3, $sp, 3 * RSIZE
fst.d $fa4, $sp, 4 * RSIZE
fst.d $fa5, $sp, 5 * RSIZE
fst.d $fa6, $sp, 6 * RSIZE
fst.d $fa7, $sp, 7 * RSIZE
fst.d $ft0, $sp, 8 * RSIZE
fst.d $ft1, $sp, 9 * RSIZE
fst.d $ft2, $sp, 10 * RSIZE
fst.d $ft3, $sp, 11 * RSIZE
fst.d $ft4, $sp, 12 * RSIZE
fst.d $ft5, $sp, 13 * RSIZE
fst.d $ft6, $sp, 14 * RSIZE
fst.d $ft7, $sp, 15 * RSIZE
fst.d $ft8, $sp, 16 * RSIZE
fst.d $ft9, $sp, 17 * RSIZE
fst.d $ft10, $sp, 18 * RSIZE
fst.d $ft11, $sp, 19 * RSIZE
fst.d $ft12, $sp, 20 * RSIZE
fst.d $ft13, $sp, 21 * RSIZE
fst.d $ft14, $sp, 22 * RSIZE
fst.d $ft15, $sp, 23 * RSIZE
fst.d $fs0, $sp, 24 * RSIZE
fst.d $fs1, $sp, 25 * RSIZE
fst.d $fs2, $sp, 26 * RSIZE
fst.d $fs3, $sp, 27 * RSIZE
fst.d $fs4, $sp, 28 * RSIZE
fst.d $fs5, $sp, 29 * RSIZE
fst.d $fs6, $sp, 30 * RSIZE
fst.d $fs7, $sp, 31 * RSIZE
movfcsr2gr $t3, $r0
st.d $t3, $sp, 32 * RSIZE // Push the FCSR0 register.
//
// Push the fcc0-fcc7 registers.
//
movcf2gr $t3, $fcc0
or $t2, $t3, $zero
movcf2gr $t3, $fcc1
bstrins.d $t2, $t3, 0xf, 0x8
movcf2gr $t3, $fcc2
bstrins.d $t2, $t3, 0x17, 0x10
movcf2gr $t3, $fcc3
bstrins.d $t2, $t3, 0x1f, 0x18
movcf2gr $t3, $fcc4
bstrins.d $t2, $t3, 0x27, 0x20
movcf2gr $t3, $fcc5
bstrins.d $t2, $t3, 0x2f, 0x28
movcf2gr $t3, $fcc6
bstrins.d $t2, $t3, 0x37, 0x30
movcf2gr $t3, $fcc7
bstrins.d $t2, $t3, 0x3f, 0x38
st.d $t2, $sp, 33 * RSIZE
//
// Push exception context down
//
PushRegDone:
//
// Process IPI only when mailbox3 is NULL and mailbox0 is no-NULL.
//
li.d $t0, LOONGARCH_IOCSR_MBUF0
iocsrrd.d $a0, $t0
beqz $a0, EntryConmmonHanlder
li.d $t0, LOONGARCH_IOCSR_MBUF3
iocsrrd.d $t1, $t0
bnez $t1, EntryConmmonHanlder
csrrd $t0, LOONGARCH_CSR_ESTAT
srli.d $t0, $t0, 12
andi $t0, $t0, 0x1
beqz $t0, EntryConmmonHanlder
//
// Clean up current processor mailbox 0 and mailbox 3.
//
li.d $t0, LOONGARCH_IOCSR_MBUF0
iocsrwr.d $zero, $t0
li.d $t0, LOONGARCH_IOCSR_MBUF3
iocsrwr.d $zero, $t0
//
// Clear IPI interrupt.
//
li.d $t0, LOONGARCH_IOCSR_IPI_STATUS
iocsrrd.w $t1, $t0
li.d $t0, LOONGARCH_IOCSR_IPI_CLEAR
iocsrwr.w $t1, $t0
//
// Only kernel stage BSP calls IPI without parameters. Clean up the PIE and make sure
// global interrupts are turned off for the current processor when jumping to the kernel.
//
csrwr $a0, LOONGARCH_CSR_ERA // Update ERA
li.w $t0, BIT2 // IE
csrxchg $zero, $t0, LOONGARCH_CSR_PRMD // Clean PIE
//
// Return this exception and jump to kernel using ERA.
//
ertn
EntryConmmonHanlder:
addi.d $sp, $sp, -(GP_REG_CONTEXT_SIZE + CSR_REG_CONTEXT_SIZE)
move $a0, $sp
la.abs $ra, ExceptionEntry
jirl $zero, $ra, 0
ASM_PFX(ExceptionEntryEnd):
.end
|
acidanthera/audk
| 1,486
|
BaseTools/Bin/GccLto/liblto-arm.s
|
//
// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
//
// GCC in LTO mode interoperates poorly with non-standard libraries that
// provide implementations of compiler intrinsics such as memcpy/memset
// or the stack protector entry points.
//
// By referencing these functions from a non-LTO object that can be passed
// to the linker via the -plugin-opt=-pass-through=-lxxx options, the
// intrinsics are included in the link in a way that allows them to be
// pruned again if no other references to them exist.
//
.long memcpy - .
.long memset - .
.long __stack_chk_fail - .
.long __stack_chk_guard - .
.long __ashrdi3 - .
.long __ashldi3 - .
.long __aeabi_idiv - .
.long __aeabi_idivmod - .
.long __aeabi_uidiv - .
.long __aeabi_uidivmod - .
.long __divdi3 - .
.long __divsi3 - .
.long __lshrdi3 - .
.long __aeabi_memcpy - .
.long __aeabi_memset - .
.long memmove - .
.long __modsi3 - .
.long __moddi3 - .
.long __muldi3 - .
.long __aeabi_lmul - .
.long __ARM_ll_mullu - .
.long __udivsi3 - .
.long __umodsi3 - .
.long __udivdi3 - .
.long __umoddi3 - .
.long __udivmoddi4 - .
.long __clzsi2 - .
.long __ctzsi2 - .
.long __ucmpdi2 - .
.long __switch8 - .
.long __switchu8 - .
.long __switch16 - .
.long __switch32 - .
.long __aeabi_ulcmp - .
.long __aeabi_uldivmod - .
.long __aeabi_ldivmod - .
.long __aeabi_llsr - .
.long __aeabi_llsl - .
|
aclements/go-misc
| 7,027
|
varint/asm_amd64.s
|
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "textflag.h"
GLOBL ·hasBMI2(SB),NOPTR,$1
TEXT ·queryBMI2(SB),NOSPLIT,$0-1
// TODO: Check validity of query.
MOVQ $0x07, AX
MOVQ $0, CX
CPUID
// Bit 8 of EBX indicates BMI2 support.
BTQ $8, BX
SETCS ret+0(FP)
RET
// Hand-coded byte decoding loop with some clever tricks.
TEXT ·decodeVarintAsmLoop(SB),NOSPLIT,$0-40
MOVQ buf_base+0(FP), BX // Pointer
MOVQ buf_len+8(FP), AX // Length
MOVL $10, CX
CMPQ AX, CX
CMOVLGT CX, AX // Length is at most 10
XORL SI, SI // Index
XORL CX, CX // Shift
XORL DX, DX // Value
loop:
CMPL SI, AX // (fused with JEQ)
JEQ bad // Reached end of buffer or >10 bytes
MOVBLZX (SI)(BX*1), DI // Load next byte
INCL SI
// This could be a BTRL $7, DI, but this is simpler and
// just as fast thanks to macro-op fusion.
TESTL $0x80, DI // Is bit 7 set? (fused with JZ)
JZ last
ANDL $0x7f, DI // Clear bit 7
SHLQ CL, DI // value |= value << shift
ORQ DI, DX
ADDL $7, CX // shift += 7
JMP loop
last:
SHLQ CL, DI // Final value |= value << shift
ORQ DI, DX
// Return decoded value and length.
MOVQ DX, x+24(FP)
MOVQ SI, n+32(FP)
RET
bad:
MOVQ $0, x+24(FP)
MOVQ $0, n+32(FP)
RET
// decodeVarintAsmBMI2 uses the BMI2 PEXT instruction to extract 7
// bits from each byte in one instruction.
TEXT ·decodeVarintAsmBMI2(SB),NOSPLIT,$0-40
MOVQ buf_base+0(FP), BX
MOVQ buf_len+8(FP), CX
// Take the slow path if there's no BMI2 or there are fewer
// than 8 bytes available.
MOVBLZX ·hasBMI2(SB), AX
TESTB AL, AL
JEQ slowpath
CMPQ CX, $8
JLT slowpath
// Load 8 bytes from buf.
MOVQ (BX), AX
// Extract the continuation bits into BX.
MOVQ AX, M0
PMOVMSKB M0, BX
// Compute byte length - 1 of varint into BX.
NOTL BX
BSFL BX, BX
// If it's more than 8 bytes, take the slow path.
CMPL BX, $8
JGE slowpath
// Extract the relevant bytes from the input.
INCL BX
MOVQ BX, CX
SHLQ $(3+8), CX // CX[15:8] = (byte len * 8); CX[7:0] = 0
BEXTRQ CX, AX, AX // Requires BMI1
// Extract the low 7 bits from each byte of the input.
MOVQ $0x7f7f7f7f7f7f7f7f, DI
PEXTQ DI, AX, DX // Requires BMI2
// Return decoded value and length.
MOVQ DX, x+24(FP)
MOVQ BX, n+32(FP)
RET
slowpath:
// Consume buffer one byte at a time.
// TODO: Could merge with some of the above registers better.
MOVQ buf_base+0(FP), BX // Pointer
MOVQ buf_len+8(FP), AX // Length
MOVQ $10, CX
CMPQ AX, CX
CMOVQGT CX, AX // Length is at most 10
XORQ SI, SI // Index
XORQ CX, CX // Shift
XORQ DX, DX // Value
loop:
CMPQ SI, AX
JEQ bad // Reached end of buffer or >10 bytes
MOVBLZX (SI)(BX*1), DI // Load next byte
INCQ SI
BTRL $7, DI // Is bit 7 set? Clear bit 7.
JNC last // If not set, this is the final byte
SHLQ CL, DI // value |= value << shift
ORQ DI, DX
ADDQ $7, CX // shift += 7
JMP loop
last:
SHLQ CL, DI // value |= value << shift
ORQ DI, DX
// Return decoded value and length.
MOVQ DX, x+24(FP)
MOVQ SI, n+32(FP)
RET
bad:
MOVQ $0, x+24(FP)
MOVQ $0, n+32(FP)
RET
// The other two also use PEXT, but use different tricks to extract
// the length and set up the mask. They turned out to be slower than
// the one above, but are historically interesting.
DATA extract<>+0x00(SB)/8,$0x000000000000007f
DATA extract<>+0x08(SB)/8,$0x0000000000007f7f
DATA extract<>+0x10(SB)/8,$0x00000000007f7f7f
DATA extract<>+0x18(SB)/8,$0x000000007f7f7f7f
DATA extract<>+0x20(SB)/8,$0x0000007f7f7f7f7f
DATA extract<>+0x28(SB)/8,$0x00007f7f7f7f7f7f
DATA extract<>+0x30(SB)/8,$0x007f7f7f7f7f7f7f
DATA extract<>+0x38(SB)/8,$0x7f7f7f7f7f7f7f7f
GLOBL extract<>(SB),(NOPTR+RODATA),$(8*8)
TEXT ·decodeVarintAsm1(SB),NOSPLIT,$0-40
// Take the slow path if there's no BMI2 or there are fewer
// than 8 bytes available.
MOVBLZX ·hasBMI2(SB), AX
TESTB AL, AL
JEQ slowpath
MOVQ buf_len+8(FP), AX
CMPQ AX, $8
JLT slowpath
// Load 8 bytes from buf.
MOVQ buf_base+0(FP), AX
MOVQ (AX), AX
// Extract the continuation bits into BX.
MOVQ AX, M0
PMOVMSKB M0, BX
// Compute byte length - 1 of varint into BX.
NOTL BX
BSFL BX, BX
// If it's more than 8 bytes, take the slow path.
CMPL BX, $8
JGE slowpath
// Extract the value into DX using a mask lookup table.
MOVQ $extract<>(SB), CX
MOVQ (CX)(BX*8), DX
PEXTQ DX, AX, DX // Requires BMI2
// Return decoded value and length.
MOVQ DX, x+24(FP)
INCL BX
MOVQ BX, n+32(FP)
RET
slowpath:
// Consume buffer one byte at a time.
// TODO: Could merge with some of the above registers better.
MOVQ buf_base+0(FP), BX // Pointer
MOVQ buf_len+8(FP), AX // Length
MOVQ $10, CX
CMPQ AX, CX
CMOVQGT CX, AX // Length is at most 10
XORQ SI, SI // Index
XORQ CX, CX // Shift
XORQ DX, DX // Value
loop:
CMPQ SI, AX
JEQ bad // Reached end of buffer or >10 bytes
MOVBLZX (SI)(BX*1), DI // Load next byte
INCQ SI
BTRL $7, DI // Is bit 7 set? Clear bit 7.
JNC last // If not set, this is the final byte
SHLQ CL, DI // value |= value << shift
ORQ DI, DX
ADDQ $7, CX // shift += 7
JMP loop
last:
SHLQ CL, DI // value |= value << shift
ORQ DI, DX
// Return decoded value and length.
MOVQ DX, x+24(FP)
MOVQ SI, n+32(FP)
RET
bad:
MOVQ $0, x+24(FP)
MOVQ $0, n+32(FP)
RET
TEXT ·decodeVarintAsm2(SB),NOSPLIT,$0-40
MOVQ buf_base+0(FP), BX
MOVQ buf_len+8(FP), CX
// Take the slow path if there's no BMI2 or there are fewer
// than 8 bytes available.
MOVBLZX ·hasBMI2(SB), AX
TESTB AL, AL
JEQ slowpath
CMPQ CX, $8
JLT slowpath
// Load 8 bytes from buf.
MOVQ (BX), AX
// Get continuation bit mask into DX.
MOVQ $0x7f7f7f7f7f7f7f7f, DI
MOVQ AX, DX
ORQ DI, DX
// Compute bit length of varint into CX.
NOTQ DX
BSFQ DX, CX
// If all continuation bits are set, take the slow path.
JZ slowpath
// Compute bit extraction mask into R14.
//BLSMSKQ DX, R14 // Requires BMI1
BYTE $0xc4; BYTE $0xe2; BYTE $0x88; BYTE $0xf3; BYTE $0xd2
// Mask the value.
ANDQ R14, AX
// Extract the bits.
PEXTQ DI, AX, DX // Requires BMI2
// Compute byte length. 7=>1, 15=>2, etc.
INCQ CX
SHRQ $3, CX
// Return decoded value and length.
MOVQ DX, x+24(FP)
MOVQ CX, n+32(FP)
RET
slowpath:
// Consume buffer one byte at a time.
// TODO: Could merge with some of the above registers better.
MOVQ buf_base+0(FP), BX // Pointer
MOVQ buf_len+8(FP), AX // Length
MOVQ $10, CX
CMPQ AX, CX
CMOVQGT CX, AX // Length is at most 10
XORQ SI, SI // Index
XORQ CX, CX // Shift
XORQ DX, DX // Value
loop:
CMPQ SI, AX
JEQ bad // Reached end of buffer or >10 bytes
MOVBLZX (SI)(BX*1), DI // Load next byte
INCQ SI
BTRL $7, DI // Is bit 7 set? Clear bit 7.
JNC last // If not set, this is the final byte
SHLQ CL, DI // value |= value << shift
ORQ DI, DX
ADDQ $7, CX // shift += 7
JMP loop
last:
SHLQ CL, DI // value |= value << shift
ORQ DI, DX
// Return decoded value and length.
MOVQ DX, x+24(FP)
MOVQ SI, n+32(FP)
RET
bad:
MOVQ $0, x+24(FP)
MOVQ $0, n+32(FP)
RET
|
aclements/sv6
| 7,588
|
kernel/trapasm.S
|
#include "mmu.h"
#include "asmdefines.h"
#define NOEC pushq $0
#define EC
#define _TRAP(x, code) \
.globl trap ## x; \
.align 8; \
trap ## x: \
code; \
pushq $x; \
jmp trapcommon; \
.data; \
.quad trap ## x; \
.previous
#define TRAP(x) _TRAP(x, NOEC)
#define TRAPCODE(x) _TRAP(x, EC)
/* Calling convention:
*
* Syscall #: %rax
* Arguments: %rdi, %rsi, %rdx, %r10 (*), %r8, %r9
* Return RIP: %rcx (from syscall instruction)
* RFLAGS: %r11 (from syscall instruction)
*
* None of the above registers are preserved across function calls in
* the AMD64 ABI. This means user space doesn't need to save any
* registers across a syscall and we're free to clobber them.
*
* (*) This argument register differs from the regular AMD64 ABI.
* Normally, the fourth argument is in %rcx, but this is clobbered by
* syscall. %r10 is cheap to use because it is caller-save.
*/
.code64
.globl sysentry
.align 8
sysentry:
swapgs
movq %rax, %gs:24 // save %rax so we can use it
movq %gs:8, %rax // myproc()
movq %ss:PROC_KSTACK_OFFSET(%rax), %rax
addq $(KSTACKSIZE-TRAPFRAME_SIZE), %rax
// save all registers we're not allowed to clobber
// skip padding3, ds
movq %r15, %ss:0x10(%rax)
movq %r14, %ss:0x18(%rax)
movq %r13, %ss:0x20(%rax)
movq %r12, %ss:0x28(%rax)
movq %rbp, %ss:0x30(%rax)
movq %rbx, %ss:0x38(%rax)
// skip r11 (0x40)
// skip r10 (0x48)
// skip r9 (0x50)
// skip r8 (0x58)
// skip rax (0x60)
// skip rcx (0x68)
// skip rdx (0x70)
// skip rsi (0x78)
// skip rdi (0x80)
// skip trapno (0x88)
// skip err, padding2 (0x90)
movq %rcx, %ss:0x98(%rax) // rip saved by syscall
// skip cs, padding (0xa0)
movq %r11, %ss:0xa8(%rax) // eflags saved by syscall
movq %rsp, %ss:0xb0(%rax)
movw $KDSEG, %cx
movw %cx, %ds
movw %cx, %es
movq %rax, %rsp
// Push a fake activation record so we can stack unwind
pushq 0x98(%rax) // Return RIP
pushq %rbp // User RBP
mov %rsp, %rbp
movq %r10, %rcx // saved by usys.S
pushq %gs:24 // syscall# saved from %rax
sti
call sysentry_c
cli
// return using SYSRET
add $(8*3), %rsp // Discard syscall#, fake activation record
movq %rsp, %r11
swapgs
movw $UDSEG, %cx
movw %cx, %ds
movw %cx, %es
movq %ss:0x10(%r11), %r15
movq %ss:0x18(%r11), %r14
movq %ss:0x20(%r11), %r13
movq %ss:0x28(%r11), %r12
movq %ss:0x30(%r11), %rbp
movq %ss:0x38(%r11), %rbx
movq %ss:0x98(%r11), %rcx // rip to be restored by sysret
movq %ss:0xb0(%r11), %rsp
movq %ss:0xa8(%r11), %r11 // eflags to be restored by sysret
sysretq
trapcommon:
pushq %rdi
pushq %rsi
pushq %rdx
pushq %rcx
pushq %rax
pushq %r8
pushq %r9
pushq %r10
pushq %r11
pushq %rbx
pushq %rbp
pushq %r12
pushq %r13
pushq %r14
pushq %r15
movw %ds, %ax
pushw %ax
subq $0xe, %rsp
# Set up data and per-cpu segments.
movw $KDSEG, %ax
movw %ax, %ds
movw %ax, %es
cmpw $KCSEG, TF_CS(%rsp)
jz 1f
swapgs
1: movq %rsp, %rdi // first argument to trap
call trap_c
// Fall through to trapret
.globl trapret
.align 8
trapret:
cli
cmpw $KCSEG, TF_CS(%rsp)
jz 1f
swapgs
1: addq $0xe, %rsp // padding
popw %ax
movw %ax, %ds
movw %ax, %es
popq %r15
popq %r14
popq %r13
popq %r12
popq %rbp
popq %rbx
popq %r11
popq %r10
popq %r9
popq %r8
popq %rax
popq %rcx
popq %rdx
popq %rsi
popq %rdi
addq $0x10, %rsp // trapno, err
iretq
.data
.align 8
.globl trapentry
trapentry:
.text
// See section 6.15 of Vol 3.
TRAP(0) // divide error
TRAP(1) // debug exception
TRAP(2) // NMI
TRAP(3) // breakpoint
TRAP(4) // overflow
TRAP(5) // bound
TRAP(6) // invalid opcode
TRAP(7) // device not available
TRAPCODE(8) // double fault - has error code
TRAP(9) // coprocessor overrun
TRAPCODE(10) // invalid TSS
TRAPCODE(11) // segment not present
TRAPCODE(12) // stack fault
TRAPCODE(13) // general protection fault
TRAPCODE(14) // page fault
TRAP(15) // not defined
TRAP(16) // fpu error
TRAPCODE(17) // alignment check
TRAP(18) // machine check
TRAP(19) // simd
# Edit .+1,|seq 20 255 | sed 's/.*/ TRAP(&)/'
TRAP(20)
TRAP(21)
TRAP(22)
TRAP(23)
TRAP(24)
TRAP(25)
TRAP(26)
TRAP(27)
TRAP(28)
TRAP(29)
TRAP(30)
TRAP(31)
TRAP(32)
TRAP(33)
TRAP(34)
TRAP(35)
TRAP(36)
TRAP(37)
TRAP(38)
TRAP(39)
TRAP(40)
TRAP(41)
TRAP(42)
TRAP(43)
TRAP(44)
TRAP(45)
TRAP(46)
TRAP(47)
TRAP(48)
TRAP(49)
TRAP(50)
TRAP(51)
TRAP(52)
TRAP(53)
TRAP(54)
TRAP(55)
TRAP(56)
TRAP(57)
TRAP(58)
TRAP(59)
TRAP(60)
TRAP(61)
TRAP(62)
TRAP(63)
TRAP(64)
TRAP(65)
TRAP(66)
TRAP(67)
TRAP(68)
TRAP(69)
TRAP(70)
TRAP(71)
TRAP(72)
TRAP(73)
TRAP(74)
TRAP(75)
TRAP(76)
TRAP(77)
TRAP(78)
TRAP(79)
TRAP(80)
TRAP(81)
TRAP(82)
TRAP(83)
TRAP(84)
TRAP(85)
TRAP(86)
TRAP(87)
TRAP(88)
TRAP(89)
TRAP(90)
TRAP(91)
TRAP(92)
TRAP(93)
TRAP(94)
TRAP(95)
TRAP(96)
TRAP(97)
TRAP(98)
TRAP(99)
TRAP(100)
TRAP(101)
TRAP(102)
TRAP(103)
TRAP(104)
TRAP(105)
TRAP(106)
TRAP(107)
TRAP(108)
TRAP(109)
TRAP(110)
TRAP(111)
TRAP(112)
TRAP(113)
TRAP(114)
TRAP(115)
TRAP(116)
TRAP(117)
TRAP(118)
TRAP(119)
TRAP(120)
TRAP(121)
TRAP(122)
TRAP(123)
TRAP(124)
TRAP(125)
TRAP(126)
TRAP(127)
TRAP(128)
TRAP(129)
TRAP(130)
TRAP(131)
TRAP(132)
TRAP(133)
TRAP(134)
TRAP(135)
TRAP(136)
TRAP(137)
TRAP(138)
TRAP(139)
TRAP(140)
TRAP(141)
TRAP(142)
TRAP(143)
TRAP(144)
TRAP(145)
TRAP(146)
TRAP(147)
TRAP(148)
TRAP(149)
TRAP(150)
TRAP(151)
TRAP(152)
TRAP(153)
TRAP(154)
TRAP(155)
TRAP(156)
TRAP(157)
TRAP(158)
TRAP(159)
TRAP(160)
TRAP(161)
TRAP(162)
TRAP(163)
TRAP(164)
TRAP(165)
TRAP(166)
TRAP(167)
TRAP(168)
TRAP(169)
TRAP(170)
TRAP(171)
TRAP(172)
TRAP(173)
TRAP(174)
TRAP(175)
TRAP(176)
TRAP(177)
TRAP(178)
TRAP(179)
TRAP(180)
TRAP(181)
TRAP(182)
TRAP(183)
TRAP(184)
TRAP(185)
TRAP(186)
TRAP(187)
TRAP(188)
TRAP(189)
TRAP(190)
TRAP(191)
TRAP(192)
TRAP(193)
TRAP(194)
TRAP(195)
TRAP(196)
TRAP(197)
TRAP(198)
TRAP(199)
TRAP(200)
TRAP(201)
TRAP(202)
TRAP(203)
TRAP(204)
TRAP(205)
TRAP(206)
TRAP(207)
TRAP(208)
TRAP(209)
TRAP(210)
TRAP(211)
TRAP(212)
TRAP(213)
TRAP(214)
TRAP(215)
TRAP(216)
TRAP(217)
TRAP(218)
TRAP(219)
TRAP(220)
TRAP(221)
TRAP(222)
TRAP(223)
TRAP(224)
TRAP(225)
TRAP(226)
TRAP(227)
TRAP(228)
TRAP(229)
TRAP(230)
TRAP(231)
TRAP(232)
TRAP(233)
TRAP(234)
TRAP(235)
TRAP(236)
TRAP(237)
TRAP(238)
TRAP(239)
TRAP(240)
TRAP(241)
TRAP(242)
TRAP(243)
TRAP(244)
TRAP(245)
TRAP(246)
TRAP(247)
TRAP(248)
TRAP(249)
TRAP(250)
TRAP(251)
TRAP(252)
TRAP(253)
TRAP(254)
TRAP(255)
|
aclements/sv6
| 2,016
|
kernel/bootother.S
|
# Each non-boot CPU ("AP") is started up in response to a STARTUP
# IPI from the boot CPU. Section B.4.2 of the Multi-Processor
# Specification says that the AP will start in real mode with CS:IP
# set to XY00:0000, where XY is an 8-bit value sent with the
# STARTUP. Thus this code must start at a 4096-byte boundary.
#
# Because this code sets DS to zero, it must sit
# at an address in the low 2^16 bytes.
#
# Bootothers (in main.c) sends the STARTUPs one at a time.
# It copies this code (start) at 0x7000.
# It puts the address of a newly allocated per-core stack in start-4,
# and the address of the place to jump to (mpmain) in start-8.
#
# This code is identical to bootasm.S except:
# - it does not need to enable A20
# - it uses the address at start-4 for the %esp
# - it jumps to the address at start-8 instead of calling bootmain
#define SEG_ASM(type,base,lim) \
.word (((lim) >> 12) & 0xffff), ((base) & 0xffff); \
.byte (((base) >> 16) & 0xff), (0x90 | (type)), \
(0xC0 | (((lim) >> 28) & 0xf)), (((base) >> 24) & 0xff)
#define PROT_MODE_CSEG 0x8
#define PROT_MODE_DSEG 0x10
#define CR0_PE_ON 0x1
.code16
.globl start
start:
cli
wbinvd
mov $0, %ax
mov %ax, %ds
cld
# Announce we made it this far.
# Useful for debugging in bootothers.
movl $0x0a55face, start - 64
lgdt gdtdesc
movl %cr0, %eax
orl $CR0_PE_ON, %eax
movl %eax, %cr0
# Jump to next instruction, but in 32-bit code segment.
# Switches processor into 32-bit mode.
ljmp $PROT_MODE_CSEG, $protcseg
.code32
protcseg:
movw $PROT_MODE_DSEG, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %fs
movw %ax, %gs
movw %ax, %ss
movl $start-12, %esp
movl start-4, %ecx
jmp *%ecx
.align 4
gdt:
.quad 0 # null seg
SEG_ASM(0xa, 0x0, 0xffffffff) # code seg
SEG_ASM(0x2, 0x0, 0xffffffff) # data seg
.align 16
gdtdesc:
.word 0x17 # sizeof(gdt) - 1
gdtaddr:
.long gdt # address gdt
|
aclements/sv6
| 3,046
|
kernel/uaccess.S
|
#include "mmu.h"
#include "asmdefines.h"
#define ENTRY(name) .globl name ; .align 8; name :
// We aren't allowed to touch rbx,rsp,rbp,r12-r15
.code64
// rdi user src
// rsi kernel dst
ENTRY(__uaccess_int64)
push %rbp // For stack traces
mov %rsp, %rbp
mov %gs:0x8, %r11
movl $1, PROC_UACCESS(%r11)
mov (%rdi), %r10
mov %r10, (%rsi)
mov $0, %rax
jmp __uaccess_end
// rdi dst
// rsi src
// rdx dst len
ENTRY(__uaccess_str)
push %rbp // For stack traces
mov %rsp, %rbp
mov %gs:0x8, %r11
movl $1, PROC_UACCESS(%r11)
// %rcx is loop instruction counter
mov %rdx, %rcx
xor %rax, %rax
1:
movb (%rsi), %r10b
movb %r10b, (%rdi)
// Check for NULL
cmp $0, %r10b
je 2f
inc %rdi
inc %rsi
loop 1b
// Error
movq $-1, %rax
2: // Done
jmp __uaccess_end
// rdi user src
// rsi max len
// Returns pointer to NUL or (char*)-1 on failure
ENTRY(__uaccess_strend)
push %rbp // For stack traces
mov %rsp, %rbp
mov %gs:0x8, %r11
movl $1, PROC_UACCESS(%r11)
// %rcx limits scas
mov %rsi, %rcx
// Search for NUL
xor %rax, %rax
// Scan string
repne scasb
jne 2f
// RDI points one past the NUL
mov %rdi, %rax
dec %rax
jmp __uaccess_end
2:
// No NUL found
movq $-1, %rax
jmp __uaccess_end
// rdi dst
// rsi src
// rdx len
ENTRY(__uaccess_mem)
push %rbp // For stack traces
mov %rsp, %rbp
mov %gs:0x8, %r11
movl $1, PROC_UACCESS(%r11)
// %rcx is rep counter
mov %rdx, %rcx
xor %rax, %rax
// Copy
rep movsb
// Done
jmp __uaccess_end
.globl __uaccess_end
.align 8
__uaccess_end:
movl $0, PROC_UACCESS(%r11)
pop %rbp
ret
.globl zpage
.align 8
zpage:
mov $4096/0x40, %rcx
mov $0, %rax
1:
mov %rax, (%rdi)
mov %rax, 0x8(%rdi)
mov %rax, 0x10(%rdi)
mov %rax, 0x18(%rdi)
mov %rax, 0x20(%rdi)
mov %rax, 0x28(%rdi)
mov %rax, 0x30(%rdi)
mov %rax, 0x38(%rdi)
lea 0x40(%rdi), %rdi
loop 1b
ret
.globl zpage_nc
.align 8
zpage_nc:
mov $4096/0x40, %rcx
mov $0, %rax
1:
movnti %rax, (%rdi)
movnti %rax, 0x8(%rdi)
movnti %rax, 0x10(%rdi)
movnti %rax, 0x18(%rdi)
movnti %rax, 0x20(%rdi)
movnti %rax, 0x28(%rdi)
movnti %rax, 0x30(%rdi)
movnti %rax, 0x38(%rdi)
lea 0x40(%rdi), %rdi
loop 1b
sfence
ret
|
aclements/sv6
| 7,608
|
kernel/boot.S
|
# x86-64 bootstrap, assuming load by MultiBoot-compliant loader.
# The MutliBoot specification is at:
# http://www.gnu.org/software/grub/manual/multiboot/multiboot.html
# GRUB is a MultiBoot loader, as is qemu's -kernel option.
#include "mmu.h"
# KCODE is the kernel virtual address of the first byte of physical memory.
# The linker loads the executable as if starting at KCODE+2MB, but we
# ask the loader to load the kernel at physical 2MB and then set up the
# necessary memory mapping to switch to the higher address.
# The value of KCODE must match the definitions in kernel.h and kernel.ld.
#define KCODE 0xFFFFFFFFC0000000
# PADDR(x) is the physical memory address corresponding to x.
# Until we set up the memory map, fairly late in this file, we have to
# refer to PADDR(symbol) instead of symbol, so that we use the
# physical address.
#define PADDR(x) ((x) - KCODE)
# STACK is the size of the bootstrap stack.
#define STACK KSTACKSIZE
# MultiBoot header.
# http://www.gnu.org/software/grub/manual/multiboot/multiboot.html#Header-layout
.align 4
.text
.globl multiboot_header
multiboot_header:
#define magic 0x1badb002
#define flags (1<<16 | 1<<0)
.long magic
.long flags
.long (- magic - flags) # checksum
.long PADDR(multiboot_header) # header address
.long PADDR(multiboot_header) # load address
.long PADDR(edata) # load end address
.long PADDR(end) # bss end address
.long PADDR(start) # entry address
# Entry point jumped to by boot loader. Running in 32-bit mode.
# http://www.gnu.org/software/grub/manual/multiboot/multiboot.html#Machine-state
#
# EAX = 0x2badb002
# EBX = address of multiboot information structure
# CS = 32-bit read/execute code segment with identity map
# DS, ES, FS, GS, SS = 32-bit read/write data segment with identity map
# A20 gate = enabled
# CR0 = PE set, PG clear
# EFLAGS = VM clear, IF clear
#
.code32
.globl start
start:
# Tell BIOS to do "warm reboot" when we shut down.
movw $0x1234, 0x472
# Set up multiboot arguments for cmain.
movl %eax, %edi
movl %ebx, %esi
# Save command line passed to the kernel. QEMU puts this
# in the bss, so we need to save it before we zero bss.
call savecmdline
# Initialize stack.
movl $PADDR(stack+STACK), %esp
# Zero bss. QEMU's MultiBoot seems not to.
# It's possible that the header above is not right, but it looks right.
# %edi is holding multiboot argument, so save in another register.
# (The stack is in the bss.)
movl %edi, %edx
movl $PADDR(edata), %edi
movl $PADDR(end), %ecx
subl $PADDR(edata), %ecx
movl $0, %eax
cld
rep stosb
movl %edx, %edi
call loadgdt
# Enter new 32-bit code segment (already in 32-bit mode).
ljmp $KCSEG32, $PADDR(start32) // code32 segment selector
start32:
# Initialize page table.
call initpagetables
call init32e
movl $PADDR(start64), %eax
# Enter 64-bit mode.
ljmp $KCSEG, $PADDR(tramp64) // code64 segment selector
.code64
start64:
# Load VA stack pointer
movabsq $(stack+STACK), %rsp
# Clear frame pointer for stack walks, and call into C code.
movq $0, %rbp
call cmain
1: jmp 1b
.code32
.globl apstart
apstart:
call loadgdt
ljmp $KCSEG32, $PADDR(apstart32) // code32 segment selector
apstart32:
call init32e
movl $PADDR(apstart64), %eax
ljmp $KCSEG, $PADDR(tramp64) // code64 segment selector
.code64
apstart64:
# Remember (from bootothers), that our kernel stack pointer is
# at the top of our temporary stack.
popq %rax
movq %rax, %rsp
movq $0, %rbp
call mpboot
1: jmp 1b
.code64
tramp64:
# The linker thinks we are running at tramp64, but we're actually
# running at PADDR(tramp64), so use an explicit calculation to
# load and jump to the correct address. %rax should hold the
# physical address of the jmp target.
movq $KCODE, %r11
addq %r11, %rax
jmp *%rax
# Initial stack
.comm stack, STACK
# Page tables. See section 4.5 of 253668.pdf.
# We map the first GB of physical memory at 0, KBASE, KCODE. At boot
# time we are using the mapping at 0 but during ordinary execution we
# use the high mappings.
# The intent is that after bootstrap the kernel can expand this mapping
# to cover all the available physical memory.
# This would be easier if we could use the PS bit to create GB-sized entries
# and skip the pdt table, but not all chips support it, and QEMU doesn't.
.align 4096
.global kpml4
kpml4:
.quad PADDR(pdpt0) + (1<<0) + (1<<1) // present, read/write
.space 4096 - 3*8
// We can't just use pdpt0 because we mark pdpt0 no-execute
// in initpg.
.quad PADDR(pdptbase) + (1<<0) + (1<<1) // present, read/write
.quad PADDR(pdptcode) + (1<<0) + (1<<1) // present, read/write
.align 4096
pdpt0:
.quad PADDR(pdtcode) + (1<<0) + (1<<1) // present, read/write
.space 4096 - 8
.align 4096
pdptbase:
.quad PADDR(pdtbase) + (1<<0) + (1<<1) // present, read/write
.space 4096 - 8
.align 4096
pdptcode:
.space 4096 - 8
.quad PADDR(pdtcode) + (1<<0) + (1<<1) // present, read/write
.align 4096
pdtbase:
// Filled in below.
.space 4096
.align 4096
pdtcode:
// Filled in below.
.space 4096
.global cmdline
cmdline:
.space 256
.code32
savecmdline:
pushl %eax
pushl %ebx
pushl %ecx
pushl %edx
// Check for for cmdline in flags
movl (%esi), %eax
and $(1<<2), %eax
jz 2f
// Save null-terminated cmdline
movl 0x10(%esi), %eax
movl $PADDR(cmdline), %ebx
movl $255, %ecx
1: movb (%eax), %dl
movb %dl, (%ebx)
cmp $0, %dl
je 2f
inc %eax
inc %ebx
loop 1b
2: popl %eax
popl %ebx
popl %ecx
popl %edx
ret
initpagetables:
pushl %edi
pushl %ecx
pushl %eax
// Set up 64-bit entry in %edx:%eax.
// Base address 0, present, read/write, large page, global.
movl $(0 | 1<<0 | 1<<1 | 1<<7 | 1<<8), %eax
movl $0, %edx
// Fill in 512 entries at pdtbase and pdtcode.
movl $PADDR(pdtbase), %edi
movl $512, %ecx
1:
// Write this 64-bit entry.
movl %eax, 0(%edi)
movl %edx, 4(%edi)
movl %eax, (0+pdtcode-pdtbase)(%edi)
movl %edx, (4+pdtcode-pdtbase)(%edi)
addl $8, %edi
// 64-bit add to prepare address for next entry.
// Because this is a large page entry, it covers 512 4k pages (2 MB).
add $(512*4096), %eax
adc $0, %edx
loop 1b
popl %eax
popl %ecx
popl %edi
ret
# Initialize IA-32e mode. See section 9.8.5 of 253668.pdf.
init32e:
# Set CR4.PAE = CR4.PSE = CR4.OSFXSR = CR4.OSXMMEXCPT = 1.
movl %cr4, %eax
orl $0x630, %eax
movl %eax, %cr4
# Load CR3 with physical base address of level 4 page table.
movl $PADDR(kpml4), %eax
movl %eax, %cr3
# Enable IA-32e mode by setting IA32_EFER.LME = 1.
# Also turn on IA32_EFER.SCE (syscall enable) and
# IA32_EFER.NXE (no-execute enable).
movl $0xc0000080, %ecx
rdmsr
orl $((1<<8)|(1<<0)|(1<<11)), %eax
wrmsr
# Enable paging by setting CR0.PG = 1.
movl %cr0, %eax
orl $0x80000000, %eax
movl %eax, %cr0
nop
nop
ret
loadgdt:
subl $8, %esp
movl $PADDR(bootgdt), 4(%esp)
movw $(8*NSEGS-1), 2(%esp)
lgdt 2(%esp)
addl $8, %esp
movl $KDSEG, %eax // data segment selector
movw %ax, %ds
movw %ax, %es
movw %ax, %ss
movl $0, %eax // null segment selector
movw %ax, %fs
movw %ax, %gs
ret
.section .eh_frame
.globl __EH_FRAME_BEGIN__
__EH_FRAME_BEGIN__:
.section .eh_frame_end
.globl __EH_FRAME_END__
__EH_FRAME_END__:
.long 0 // see gcc/crtstuff.c __FRAME_END__
|
aclements/mtrace
| 1,319
|
tests/test-i386-code16.S
|
.code16
.globl code16_start
.globl code16_end
CS_SEG = 0xf
code16_start:
.globl code16_func1
/* basic test */
code16_func1 = . - code16_start
mov $1, %eax
data32 lret
/* test push/pop in 16 bit mode */
.globl code16_func2
code16_func2 = . - code16_start
xor %eax, %eax
mov $0x12345678, %ebx
movl %esp, %ecx
push %bx
subl %esp, %ecx
pop %ax
data32 lret
/* test various jmp opcodes */
.globl code16_func3
code16_func3 = . - code16_start
jmp 1f
nop
1:
mov $4, %eax
mov $0x12345678, %ebx
xor %bx, %bx
jz 2f
add $2, %ax
2:
call myfunc
lcall $CS_SEG, $(myfunc2 - code16_start)
ljmp $CS_SEG, $(myjmp1 - code16_start)
myjmp1_next:
cs lcall *myfunc2_addr - code16_start
cs ljmp *myjmp2_addr - code16_start
myjmp2_next:
data32 lret
myfunc2_addr:
.short myfunc2 - code16_start
.short CS_SEG
myjmp2_addr:
.short myjmp2 - code16_start
.short CS_SEG
myjmp1:
add $8, %ax
jmp myjmp1_next
myjmp2:
add $16, %ax
jmp myjmp2_next
myfunc:
add $1, %ax
ret
myfunc2:
add $4, %ax
lret
code16_end:
|
aclements/mtrace
| 1,816
|
tests/test-i386-vm86.S
|
.code16
.globl vm86_code_start
.globl vm86_code_end
#define GET_OFFSET(x) ((x) - vm86_code_start + 0x100)
vm86_code_start:
movw $GET_OFFSET(hello_world), %dx
movb $0x09, %ah
int $0x21
/* prepare int 0x90 vector */
xorw %ax, %ax
movw %ax, %es
es movw $GET_OFFSET(int90_test), 0x90 * 4
es movw %cs, 0x90 * 4 + 2
/* launch int 0x90 */
int $0x90
/* test IF support */
movw $GET_OFFSET(IF_msg), %dx
movb $0x09, %ah
int $0x21
pushf
popw %dx
movb $0xff, %ah
int $0x21
cli
pushf
popw %dx
movb $0xff, %ah
int $0x21
sti
pushfl
popl %edx
movb $0xff, %ah
int $0x21
#if 0
movw $GET_OFFSET(IF_msg1), %dx
movb $0x09, %ah
int $0x21
pushf
movw %sp, %bx
andw $~0x200, (%bx)
popf
#else
cli
#endif
pushf
popw %dx
movb $0xff, %ah
int $0x21
pushfl
movw %sp, %bx
orw $0x200, (%bx)
popfl
pushfl
popl %edx
movb $0xff, %ah
int $0x21
movb $0x00, %ah
int $0x21
int90_test:
pushf
pop %dx
movb $0xff, %ah
int $0x21
movw %sp, %bx
movw 4(%bx), %dx
movb $0xff, %ah
int $0x21
movw $GET_OFFSET(int90_msg), %dx
movb $0x09, %ah
int $0x21
iret
int90_msg:
.string "INT90 started\n$"
hello_world:
.string "Hello VM86 world\n$"
IF_msg:
.string "VM86 IF test\n$"
IF_msg1:
.string "If you see a diff here, your Linux kernel is buggy, please update to 2.4.20 kernel\n$"
vm86_code_end:
|
aclements/mtrace
| 2,945
|
pc-bios/optionrom/linuxboot.S
|
/*
* Linux Boot Option ROM
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* Copyright Novell Inc, 2009
* Authors: Alexander Graf <agraf@suse.de>
*
* Based on code in hw/pc.c.
*/
#include "optionrom.h"
BOOT_ROM_START
run_linuxboot:
cli
cld
jmp copy_kernel
boot_kernel:
read_fw FW_CFG_SETUP_ADDR
mov %eax, %ebx
shr $4, %ebx
/* All segments contain real_addr */
mov %bx, %ds
mov %bx, %es
mov %bx, %fs
mov %bx, %gs
mov %bx, %ss
/* CX = CS we want to jump to */
add $0x20, %bx
mov %bx, %cx
/* SP = cmdline_addr-real_addr-16 */
read_fw FW_CFG_CMDLINE_ADDR
mov %eax, %ebx
read_fw FW_CFG_SETUP_ADDR
sub %eax, %ebx
sub $16, %ebx
mov %ebx, %esp
/* Build indirect lret descriptor */
pushw %cx /* CS */
xor %ax, %ax
pushw %ax /* IP = 0 */
/* Clear registers */
xor %eax, %eax
xor %ebx, %ebx
xor %ecx, %ecx
xor %edx, %edx
xor %edi, %edi
xor %ebp, %ebp
/* Jump to Linux */
lret
copy_kernel:
/* We need to load the kernel into memory we can't access in 16 bit
mode, so let's get into 32 bit mode, write the kernel and jump
back again. */
/* Reserve space on the stack for our GDT descriptor. */
mov %esp, %ebp
sub $16, %esp
/* Now create the GDT descriptor */
movw $((3 * 8) - 1), -16(%bp)
mov %cs, %eax
movzwl %ax, %eax
shl $4, %eax
addl $gdt, %eax
movl %eax, -14(%bp)
/* And load the GDT */
data32 lgdt -16(%bp)
mov %ebp, %esp
/* Get us to protected mode now */
mov $1, %eax
mov %eax, %cr0
/* So we can set ES to a 32-bit segment */
mov $0x10, %eax
mov %eax, %es
/* We're now running in 16-bit CS, but 32-bit ES! */
/* Load kernel and initrd */
read_fw_blob_addr32(FW_CFG_KERNEL)
read_fw_blob_addr32(FW_CFG_INITRD)
read_fw_blob_addr32(FW_CFG_CMDLINE)
read_fw_blob_addr32(FW_CFG_SETUP)
/* And now jump into Linux! */
mov $0, %eax
mov %eax, %cr0
/* ES = CS */
mov %cs, %ax
mov %ax, %es
jmp boot_kernel
/* Variables */
.align 4, 0
gdt:
/* 0x00 */
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
/* 0x08: code segment (base=0, limit=0xfffff, type=32bit code exec/read, DPL=0, 4k) */
.byte 0xff, 0xff, 0x00, 0x00, 0x00, 0x9a, 0xcf, 0x00
/* 0x10: data segment (base=0, limit=0xfffff, type=32bit data read/write, DPL=0, 4k) */
.byte 0xff, 0xff, 0x00, 0x00, 0x00, 0x92, 0xcf, 0x00
BOOT_ROM_END
|
aclements/mtrace
| 4,118
|
pc-bios/optionrom/multiboot.S
|
/*
* Multiboot Option ROM
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* Copyright Novell Inc, 2009
* Authors: Alexander Graf <agraf@suse.de>
*/
#include "optionrom.h"
#define MULTIBOOT_MAGIC 0x2badb002
#define GS_PROT_JUMP 0
#define GS_GDT_DESC 6
BOOT_ROM_START
run_multiboot:
cli
cld
mov %cs, %eax
shl $0x4, %eax
/* set up a long jump descriptor that is PC relative */
/* move stack memory to %gs */
mov %ss, %ecx
shl $0x4, %ecx
mov %esp, %ebx
add %ebx, %ecx
sub $0x20, %ecx
sub $0x30, %esp
shr $0x4, %ecx
mov %cx, %gs
/* now push the indirect jump decriptor there */
mov (prot_jump), %ebx
add %eax, %ebx
movl %ebx, %gs:GS_PROT_JUMP
mov $8, %bx
movw %bx, %gs:GS_PROT_JUMP + 4
/* fix the gdt descriptor to be PC relative */
movw (gdt_desc), %bx
movw %bx, %gs:GS_GDT_DESC
movl (gdt_desc+2), %ebx
add %eax, %ebx
movl %ebx, %gs:GS_GDT_DESC + 2
xor %eax, %eax
mov %eax, %es
/* Read the bootinfo struct into RAM */
read_fw_blob(FW_CFG_INITRD)
/* FS = bootinfo_struct */
read_fw FW_CFG_INITRD_ADDR
shr $4, %eax
mov %ax, %fs
/* ES = mmap_addr */
mov %fs:48, %eax
shr $4, %eax
mov %ax, %es
/* Initialize multiboot mmap structs using int 0x15(e820) */
xor %ebx, %ebx
/* mmap start after first size */
movl $4, %edi
mmap_loop:
/* entry size (mmap struct) & max buffer size (int15) */
movl $20, %ecx
/* store entry size */
/* old as(1) doesn't like this insn so emit the bytes instead:
movl %ecx, %es:-4(%edi)
*/
.dc.b 0x26,0x67,0x66,0x89,0x4f,0xfc
/* e820 */
movl $0x0000e820, %eax
/* 'SMAP' magic */
movl $0x534d4150, %edx
int $0x15
mmap_check_entry:
/* last entry? then we're done */
jb mmap_done
and %bx, %bx
jz mmap_done
/* valid entry, so let's loop on */
mmap_store_entry:
/* %ax = entry_number * 24 */
mov $24, %ax
mul %bx
mov %ax, %di
movw %di, %fs:0x2c
/* %di = 4 + (entry_number * 24) */
add $4, %di
jmp mmap_loop
mmap_done:
real_to_prot:
/* Load the GDT before going into protected mode */
lgdt:
data32 lgdt %gs:GS_GDT_DESC
/* get us to protected mode now */
movl $1, %eax
movl %eax, %cr0
/* the LJMP sets CS for us and gets us to 32-bit */
ljmp:
data32 ljmp *%gs:GS_PROT_JUMP
prot_mode:
.code32
/* initialize all other segments */
movl $0x10, %eax
movl %eax, %ss
movl %eax, %ds
movl %eax, %es
movl %eax, %fs
movl %eax, %gs
/* Read the kernel and modules into RAM */
read_fw_blob(FW_CFG_KERNEL)
/* Jump off to the kernel */
read_fw FW_CFG_KERNEL_ENTRY
mov %eax, %ecx
/* EBX contains a pointer to the bootinfo struct */
read_fw FW_CFG_INITRD_ADDR
movl %eax, %ebx
/* EAX has to contain the magic */
movl $MULTIBOOT_MAGIC, %eax
ljmp2:
jmp *%ecx
/* Variables */
.align 4, 0
prot_jump: .long prot_mode
.short 8
.align 4, 0
gdt:
/* 0x00 */
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
/* 0x08: code segment (base=0, limit=0xfffff, type=32bit code exec/read, DPL=0, 4k) */
.byte 0xff, 0xff, 0x00, 0x00, 0x00, 0x9a, 0xcf, 0x00
/* 0x10: data segment (base=0, limit=0xfffff, type=32bit data read/write, DPL=0, 4k) */
.byte 0xff, 0xff, 0x00, 0x00, 0x00, 0x92, 0xcf, 0x00
/* 0x18: code segment (base=0, limit=0x0ffff, type=16bit code exec/read/conf, DPL=0, 1b) */
.byte 0xff, 0xff, 0x00, 0x00, 0x00, 0x9e, 0x00, 0x00
/* 0x20: data segment (base=0, limit=0x0ffff, type=16bit data read/write, DPL=0, 1b) */
.byte 0xff, 0xff, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00
gdt_desc:
.short (5 * 8) - 1
.long gdt
BOOT_ROM_END
|
aclements/mtrace
| 1,874
|
tests/cris/check_boundr.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 2\n2\nffff\nffffffff\n5432f789\n2\n2\nffff\nffff\nffff\nf789\n2\n2\nff\nff\n89\nfeda4953\nfeda4962\n0\n0\n
.include "testutils.inc"
start
moveq -1,r3
moveq 2,r4
bound.d r4,r3
test_move_cc 0 0 0 0
checkr3 2
moveq 2,r3
moveq -1,r4
bound.d r4,r3
test_move_cc 0 0 0 0
checkr3 2
move.d 0xffff,r4
move.d r4,r3
bound.d r4,r3
test_move_cc 0 0 0 0
checkr3 ffff
moveq -1,r4
move.d r4,r3
bound.d r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
move.d 0x5432f789,r4
move.d 0x78134452,r3
bound.d r4,r3
test_move_cc 0 0 0 0
checkr3 5432f789
moveq -1,r3
moveq 2,r4
bound.w r4,r3
test_move_cc 0 0 0 0
checkr3 2
moveq 2,r3
moveq -1,r4
bound.w r4,r3
test_move_cc 0 0 0 0
checkr3 2
moveq -1,r3
bound.w r3,r3
test_move_cc 0 0 0 0
checkr3 ffff
move.d 0xffff,r4
move.d r4,r3
bound.w r4,r3
test_move_cc 0 0 0 0
checkr3 ffff
move.d 0xfedaffff,r4
move.d r4,r3
bound.w r4,r3
test_move_cc 0 0 0 0
checkr3 ffff
move.d 0x5432f789,r4
move.d 0x78134452,r3
bound.w r4,r3
test_move_cc 0 0 0 0
checkr3 f789
moveq -1,r3
moveq 2,r4
bound.b r4,r3
test_move_cc 0 0 0 0
checkr3 2
moveq 2,r3
moveq -1,r4
bound.b r4,r3
test_move_cc 0 0 0 0
checkr3 2
move.d 0xff,r4
move.d r4,r3
bound.b r4,r3
test_move_cc 0 0 0 0
checkr3 ff
move.d 0xfeda49ff,r4
move.d r4,r3
bound.b r4,r3
test_move_cc 0 0 0 0
checkr3 ff
move.d 0x5432f789,r4
move.d 0x78134452,r3
bound.b r4,r3
test_move_cc 0 0 0 0
checkr3 89
move.d 0xfeda4956,r3
move.d 0xfeda4953,r4
bound.d r4,r3
test_move_cc 1 0 0 0
checkr3 feda4953
move.d 0xfeda4962,r3
move.d 0xfeda4963,r4
bound.d r4,r3
test_move_cc 1 0 0 0
checkr3 feda4962
move.d 0xfeda4956,r3
move.d 0,r4
bound.d r4,r3
test_move_cc 0 1 0 0
checkr3 0
move.d 0xfeda4956,r4
move.d 0,r3
bound.d r4,r3
test_move_cc 0 1 0 0
checkr3 0
quit
|
aclements/mtrace
| 1,165
|
tests/cris/check_movemr.s
|
# mach: crisv3 crisv8 crisv10 crisv32
# output: 12345678\n10234567\n12345678\n12344567\n12344523\n76543210\nffffffaa\naa\n9911\nffff9911\n78\n56\n3456\n6712\n
.include "testutils.inc"
start
.data
mem1:
.dword 0x12345678
mem2:
.word 0x4567
mem3:
.byte 0x23
.dword 0x76543210
.byte 0xaa,0x11,0x99
.text
move.d mem1,r2
move.d [r2],r3
test_move_cc 0 0 0 0
checkr3 12345678
move.d mem2,r3
move.d [r3],r3
test_move_cc 0 0 0 0
checkr3 10234567
move.d mem1,r2
move.d [r2+],r3
test_move_cc 0 0 0 0
checkr3 12345678
move.w [r2+],r3
test_move_cc 0 0 0 0
checkr3 12344567
move.b [r2+],r3
test_move_cc 0 0 0 0
checkr3 12344523
move.d [r2+],r3
test_move_cc 0 0 0 0
checkr3 76543210
movs.b [r2],r3
test_move_cc 1 0 0 0
checkr3 ffffffaa
movu.b [r2+],r3
test_move_cc 0 0 0 0
checkr3 aa
movu.w [r2],r3
test_move_cc 0 0 0 0
checkr3 9911
movs.w [r2+],r3
test_move_cc 1 0 0 0
checkr3 ffff9911
move.d mem1,r13
movs.b [r13+],r3
test_move_cc 0 0 0 0
checkr3 78
movu.b [r13],r3
test_move_cc 0 0 0 0
checkr3 56
movs.w [r13+],r3
test_move_cc 0 0 0 0
checkr3 3456
movu.w [r13+],r3
test_move_cc 0 0 0 0
checkr3 6712
quit
|
aclements/mtrace
| 1,160
|
tests/cris/check_movemrv32.s
|
# mach: crisv32
# output: 15\n7\n2\nffff1234\nb\n16\nf\n2\nffffffef\nf\nffff1234\nf\nfffffff4\nd\nfffffff2\n10\nfffffff2\nd\n
.include "testutils.inc"
.data
x:
.dword 8,9,10,11
y:
.dword -12,13,-14,15,16
start
moveq 7,r0
moveq 2,r1
move.d 0xffff1234,r2
moveq 21,r3
move.d x,r4
setf zcvn
movem r2,[r4+]
test_cc 1 1 1 1
subq 12,r4
checkr3 15
move.d [r4+],r3
checkr3 7
move.d [r4+],r3
checkr3 2
move.d [r4+],r3
checkr3 ffff1234
move.d [r4+],r3
checkr3 b
subq 16,r4
moveq 22,r0
moveq 15,r1
clearf zcvn
movem r0,[r4]
test_cc 0 0 0 0
move.d [r4+],r3
checkr3 16
move.d r1,r3
checkr3 f
move.d [r4+],r3
checkr3 2
subq 8,r4
moveq 10,r2
moveq -17,r0
clearf zc
setf vn
movem r1,[r4]
test_cc 1 0 1 0
move.d [r4+],r3
checkr3 ffffffef
move.d [r4+],r3
checkr3 f
move.d [r4+],r3
checkr3 ffff1234
move.d y,r4
setf zc
clearf vn
movem [r4+],r3
test_cc 0 1 0 1
checkr3 f
move.d r0,r3
checkr3 fffffff4
move.d r1,r3
checkr3 d
move.d r2,r3
checkr3 fffffff2
move.d [r4],r3
checkr3 10
subq 8,r4
setf zcvn
movem [r4+],r0
test_cc 1 1 1 1
move.d r0,r3
checkr3 fffffff2
move.d r1,r3
checkr3 d
quit
|
aclements/mtrace
| 3,358
|
tests/cris/check_lsl.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: ffffffff\n4\n80000000\nffff8000\n7f19f000\n80000000\n0\n0\n699fc67c\nffffffff\n4\n80000000\nffff8000\n7f19f000\nda670000\nda670000\nda670000\nda67c67c\nffffffff\nfffafffe\n4\nffff0000\nffff8000\n5a67f000\nda67f100\nda67f100\nda67f100\nda67f17c\nfff3faff\nfff3fafe\n4\nffffff00\nffffff00\nffffff80\n5a67f100\n5a67f1f0\n
.include "testutils.inc"
start
moveq -1,r3
lslq 0,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq 2,r3
lslq 1,r3
test_move_cc 0 0 0 0
checkr3 4
moveq -1,r3
lslq 31,r3
test_move_cc 1 0 0 0
checkr3 80000000
moveq -1,r3
lslq 15,r3
test_move_cc 1 0 0 0
checkr3 ffff8000
move.d 0x5a67f19f,r3
lslq 12,r3
test_move_cc 0 0 0 0
checkr3 7f19f000
move.d 0xda67f19f,r3
move.d 31,r4
lsl.d r4,r3
test_move_cc 1 0 0 0
checkr3 80000000
move.d 0xda67f19f,r3
move.d 32,r4
lsl.d r4,r3
test_move_cc 0 1 0 0
checkr3 0
move.d 0xda67f19f,r3
move.d 33,r4
lsl.d r4,r3
test_move_cc 0 1 0 0
checkr3 0
move.d 0xda67f19f,r3
move.d 66,r4
lsl.d r4,r3
test_move_cc 0 0 0 0
checkr3 699fc67c
moveq -1,r3
moveq 0,r4
lsl.d r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq 2,r3
moveq 1,r4
lsl.d r4,r3
test_move_cc 0 0 0 0
checkr3 4
moveq -1,r3
moveq 31,r4
lsl.d r4,r3
test_move_cc 1 0 0 0
checkr3 80000000
moveq -1,r3
moveq 15,r4
lsl.d r4,r3
test_move_cc 1 0 0 0
checkr3 ffff8000
move.d 0x5a67f19f,r3
moveq 12,r4
lsl.d r4,r3
test_move_cc 0 0 0 0
checkr3 7f19f000
move.d 0xda67f19f,r3
move.d 31,r4
lsl.w r4,r3
test_move_cc 0 1 0 0
checkr3 da670000
move.d 0xda67f19f,r3
move.d 32,r4
lsl.w r4,r3
test_move_cc 0 1 0 0
checkr3 da670000
move.d 0xda67f19f,r3
move.d 33,r4
lsl.w r4,r3
test_move_cc 0 1 0 0
checkr3 da670000
move.d 0xda67f19f,r3
move.d 66,r4
lsl.w r4,r3
test_move_cc 1 0 0 0
checkr3 da67c67c
moveq -1,r3
moveq 0,r4
lsl.w r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
move.d 0xfffaffff,r3
moveq 1,r4
lsl.w r4,r3
test_move_cc 1 0 0 0
checkr3 fffafffe
moveq 2,r3
moveq 1,r4
lsl.w r4,r3
test_move_cc 0 0 0 0
checkr3 4
moveq -1,r3
moveq 31,r4
lsl.w r4,r3
test_move_cc 0 1 0 0
checkr3 ffff0000
moveq -1,r3
moveq 15,r4
lsl.w r4,r3
test_move_cc 1 0 0 0
checkr3 ffff8000
move.d 0x5a67f19f,r3
moveq 12,r4
lsl.w r4,r3
test_move_cc 1 0 0 0
checkr3 5a67f000
move.d 0xda67f19f,r3
move.d 31,r4
lsl.b r4,r3
test_move_cc 0 1 0 0
checkr3 da67f100
move.d 0xda67f19f,r3
move.d 32,r4
lsl.b r4,r3
test_move_cc 0 1 0 0
checkr3 da67f100
move.d 0xda67f19f,r3
move.d 33,r4
lsl.b r4,r3
test_move_cc 0 1 0 0
checkr3 da67f100
move.d 0xda67f19f,r3
move.d 66,r4
lsl.b r4,r3
test_move_cc 0 0 0 0
checkr3 da67f17c
move.d 0xfff3faff,r3
moveq 0,r4
lsl.b r4,r3
test_move_cc 1 0 0 0
checkr3 fff3faff
move.d 0xfff3faff,r3
moveq 1,r4
lsl.b r4,r3
test_move_cc 1 0 0 0
checkr3 fff3fafe
moveq 2,r3
moveq 1,r4
lsl.b r4,r3
test_move_cc 0 0 0 0
checkr3 4
moveq -1,r3
moveq 31,r4
lsl.b r4,r3
test_move_cc 0 1 0 0
checkr3 ffffff00
moveq -1,r3
moveq 15,r4
lsl.b r4,r3
test_move_cc 0 1 0 0
checkr3 ffffff00
moveq -1,r3
moveq 7,r4
lsl.b r4,r3
test_move_cc 1 0 0 0
checkr3 ffffff80
move.d 0x5a67f19f,r3
moveq 12,r4
lsl.b r4,r3
test_move_cc 0 1 0 0
checkr3 5a67f100
move.d 0x5a67f19f,r3
moveq 4,r4
lsl.b r4,r3
test_move_cc 1 0 0 0
checkr3 5a67f1f0
quit
|
aclements/mtrace
| 1,084
|
tests/cris/check_orm.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 3\n3\nffff\nffffffff\n7c33f7db\nffff0003\n3\nfedaffff\n7813f7db\n3\n3\nfeb\n781344db\n
.include "testutils.inc"
.data
x:
.dword 2,1,0xff0f,-1,0x5432f789
.word 2,1,0xff5f,0xf789
.byte 2,1,0x4a,0x89
start
moveq 1,r3
move.d x,r5
or.d [r5+],r3
checkr3 3
moveq 2,r3
or.d [r5],r3
addq 4,r5
checkr3 3
move.d 0xf0ff,r3
or.d [r5+],r3
checkr3 ffff
moveq -1,r3
or.d [r5+],r3
checkr3 ffffffff
move.d 0x78134452,r3
or.d [r5+],r3
checkr3 7c33f7db
move.d 0xffff0001,r3
or.w [r5+],r3
checkr3 ffff0003
moveq 2,r3
or.w [r5],r3
addq 2,r5
test_move_cc 0 0 0 0
checkr3 3
move.d 0xfedaffaf,r3
or.w [r5+],r3
test_move_cc 1 0 0 0
checkr3 fedaffff
move.d 0x78134452,r3
or.w [r5+],r3
test_move_cc 1 0 0 0
checkr3 7813f7db
moveq 1,r3
or.b [r5+],r3
test_move_cc 0 0 0 0
checkr3 3
moveq 2,r3
or.b [r5],r3
addq 1,r5
test_move_cc 0 0 0 0
checkr3 3
move.d 0xfa3,r3
or.b [r5+],r3
test_move_cc 1 0 0 0
checkr3 feb
move.d 0x78134453,r3
or.b [r5],r3
test_move_cc 1 0 0 0
checkr3 781344db
quit
|
aclements/mtrace
| 2,223
|
tests/cris/check_movmp.s
|
# mach: crisv3 crisv8 crisv10 crisv32
# output: ffffff00\nffff0000\n0\nffffff00\nffff0000\n0\nffffff00\nffff0000\n0\nbb113344\n664433aa\ncc557788\nabcde012\nabcde000\n77880000\n0\n
# Test generic "move Ps,[]" and "move [],Pd" insns; the ones with
# functionality common to all models.
.include "testutils.inc"
start
.data
filler:
.byte 0xaa
.word 0x4433
.dword 0x55778866
.byte 0xcc
.text
; Test that writing to zero-registers is a nop
.if 0
; We used to just ignore the writes, but now an error is emitted. We
; keep the test-code but disabled, in case we need to change this again.
move 0xaa,p0
move 0x4433,p4
move 0x55774433,p8
.endif
moveq -1,r3
setf zcvn
clear.b r3
test_cc 1 1 1 1
checkr3 ffffff00
moveq -1,r3
clearf zcvn
clear.w r3
test_cc 0 0 0 0
checkr3 ffff0000
moveq -1,r3
clear.d r3
checkr3 0
; "Write" using ordinary memory references too.
.if 0 ; See ".if 0" above.
move.d filler,r6
move [r6],p0
move [r6],p4
move [r6],p8
.endif
# ffffff00\nffff0000\n0\nffffff00\nffff0000\n0\nbb113344\n664433aa\ncc557788\nabcde012\nabcde000\n77880000\n0\n
moveq -1,r3
clear.b r3
checkr3 ffffff00
moveq -1,r3
clear.w r3
checkr3 ffff0000
moveq -1,r3
clear.d r3
checkr3 0
; And postincremented.
.if 0 ; See ".if 0" above.
move [r6+],p0
move [r6+],p4
move [r6+],p8
.endif
# ffffff00\nffff0000\n0\nbb113344\n664433aa\ncc557788\nabcde012\nabcde000\n77880000\n0\n
moveq -1,r3
clear.b r3
checkr3 ffffff00
moveq -1,r3
clear.w r3
checkr3 ffff0000
moveq -1,r3
clear.d r3
checkr3 0
; Now see that we can write to the registers too.
# bb113344\n664433aa\ncc557788\nabcde012\nabcde000\n77880000\n0\n
; [PC+]
move.d filler,r9
move 0xbb113344,srp
move srp,r3
checkr3 bb113344
; [R+]
move [r9+],srp
move srp,r3
checkr3 664433aa
; [R]
move [r9],srp
move srp,r3
checkr3 cc557788
; And check writing to memory, clear and srp.
move.d filler,r9
move 0xabcde012,srp
setf zcvn
move srp,[r9+]
test_cc 1 1 1 1
subq 4,r9
move.d [r9],r3
checkr3 abcde012
clearf zcvn
clear.b [r9]
test_cc 0 0 0 0
move.d [r9],r3
checkr3 abcde000
addq 2,r9
clear.w [r9+]
subq 2,r9
move.d [r9],r3
checkr3 77880000
clear.d [r9]
move.d [r9],r3
checkr3 0
quit
|
aclements/mtrace
| 1,230
|
tests/cris/check_andc.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 2\n2\nffff\nffffffff\n50124400\nffff0002\n2\nfffff\nfedaff0f\n78134400\nffffff02\n2\nf02\n78134401\n78134400\n
.include "testutils.inc"
start
moveq -1,r3
and.d 2,r3
test_move_cc 0 0 0 0
checkr3 2
moveq 2,r3
and.d -1,r3
test_move_cc 0 0 0 0
checkr3 2
move.d 0xffff,r3
and.d 0xffff,r3
test_move_cc 0 0 0 0
checkr3 ffff
moveq -1,r3
and.d -1,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
move.d 0x78134452,r3
and.d 0x5432f789,r3
test_move_cc 0 0 0 0
checkr3 50124400
moveq -1,r3
and.w 2,r3
test_move_cc 0 0 0 0
checkr3 ffff0002
moveq 2,r3
and.w -1,r3
test_move_cc 0 0 0 0
checkr3 2
move.d 0xfffff,r3
and.w 0xffff,r3
test_move_cc 1 0 0 0
checkr3 fffff
move.d 0xfedaffaf,r3
and.w 0xff5f,r3
test_move_cc 1 0 0 0
checkr3 fedaff0f
move.d 0x78134452,r3
and.w 0xf789,r3
test_move_cc 0 0 0 0
checkr3 78134400
moveq -1,r3
and.b 2,r3
test_move_cc 0 0 0 0
checkr3 ffffff02
moveq 2,r3
and.b -1,r3
test_move_cc 0 0 0 0
checkr3 2
move.d 0xfa7,r3
and.b 0x5a,r3
test_move_cc 0 0 0 0
checkr3 f02
move.d 0x78134453,r3
and.b 0x89,r3
test_move_cc 0 0 0 0
checkr3 78134401
and.b 0,r3
test_move_cc 0 1 0 0
checkr3 78134400
quit
|
aclements/mtrace
| 1,752
|
tests/cris/check_bcc.s
|
.global main
.type main, @function
main:
clearf nzvc
setf nzv
bcc 0f
addq 1, $r3
jump dofail
0:
clearf nzvc
setf nzv
bcs dofail
addq 1,$r3
clearf nzvc
setf ncv
bne 1f
addq 1, $r3
fail:
dofail:
jump _fail
1:
clearf nzvc
setf ncv
beq dofail
addq 1,$r3
clearf nzvc
setf ncz
bvc 2f
addq 1,$r3
jump dofail
2:
clearf nzvc
setf ncz
bvs dofail
addq 1,$r3
clearf nzvc
setf vcz
bpl 3f
addq 1,$r3
jump fail
3:
clearf nzvc
setf vcz
bmi dofail
addq 1,$r3
clearf nzvc
setf nv
bls dofail
addq 1,$r3
clearf nzvc
setf nv
bhi 4f
addq 1,$r3
jump dofail
4:
clearf nzvc
setf zc
bge 5f
addq 1,$r3
jump dofail
5:
clearf nzvc
setf zc
blt dofail
addq 1,$r3
clearf nzvc
setf c
bgt 6f
addq 1,$r3
jump fail
6:
clearf nzvc
setf c
ble dofail
addq 1,$r3
;;;;;;;;;;
setf nzvc
clearf nzv
bcc dofail
addq 1,$r3
setf nzvc
clearf nzv
bcs 0f
addq 1,$r3
jump fail
0:
setf nzvc
clearf ncv
bne dofail
addq 1,$r3
setf nzvc
clearf ncv
beq 1f
addq 1,$r3
jump fail
1:
setf nzvc
clearf ncz
bvc dofail
addq 1,$r3
setf nzvc
clearf ncz
bvs 2f
addq 1,$r3
jump fail
2:
setf nzvc
clearf vcz
bpl dofail
addq 1,$r3
setf nzvc
clearf vcz
bmi 3f
addq 1,$r3
jump fail
3:
setf nzvc
clearf nv
bls 4f
addq 1,$r3
jump fail
4:
setf nzvc
clearf nv
bhi dofail
addq 1,$r3
setf zvc
clearf nzc
bge dofail
addq 1,$r3
setf nzc
clearf vzc
blt 5f
addq 1,$r3
jump fail
5:
setf nzvc
clearf c
bgt dofail
addq 1,$r3
setf nzvc
clearf c
ble 6f
addq 1,$r3
jump fail
6:
; do a forward branch.
ba 2f
nop
.fill 100
1:
ba 3f
nop
.fill 800
2:
ba 1b
nop
.fill 1024
3:
moveq 31, $r0
1: bne 1b
subq 1, $r0
jsr pass
moveq 0, $r10
ret
nop
|
aclements/mtrace
| 1,521
|
tests/cris/check_cmpr.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: ffffffff\n2\nffff\nffffffff\n78134452\nffffffff\n2\nffff\nfedaffff\n78134452\nffffffff\n2\nff\nfeda49ff\n78134452\n85649222\n
.include "testutils.inc"
start
moveq -1,r3
moveq -2,r4
cmp.d r4,r3
test_cc 0 0 0 0
checkr3 ffffffff
moveq 2,r3
moveq 1,r4
cmp.d r4,r3
test_cc 0 0 0 0
checkr3 2
move.d 0xffff,r3
move.d -0xffff,r4
cmp.d r4,r3
test_cc 0 0 0 1
checkr3 ffff
moveq 1,r4
moveq -1,r3
cmp.d r4,r3
test_cc 1 0 0 0
checkr3 ffffffff
move.d -0x5432f789,r4
move.d 0x78134452,r3
cmp.d r4,r3
test_cc 1 0 1 1
checkr3 78134452
moveq -1,r3
moveq -2,r4
cmp.w r4,r3
test_cc 0 0 0 0
checkr3 ffffffff
moveq 2,r3
moveq 1,r4
cmp.w r4,r3
test_cc 0 0 0 0
checkr3 2
move.d 0xffff,r3
move.d -0xffff,r4
cmp.w r4,r3
test_cc 1 0 0 0
checkr3 ffff
move.d 0xfedaffff,r3
move.d -0xfedaffff,r4
cmp.w r4,r3
test_cc 1 0 0 0
checkr3 fedaffff
move.d -0x5432f789,r4
move.d 0x78134452,r3
cmp.w r4,r3
test_cc 0 0 0 0
checkr3 78134452
moveq -1,r3
moveq -2,r4
cmp.b r4,r3
test_cc 0 0 0 0
checkr3 ffffffff
moveq 2,r3
moveq 1,r4
cmp.b r4,r3
test_cc 0 0 0 0
checkr3 2
move.d -0xff,r4
move.d 0xff,r3
cmp.b r4,r3
test_cc 1 0 0 0
checkr3 ff
move.d -0xfeda49ff,r4
move.d 0xfeda49ff,r3
cmp.b r4,r3
test_cc 1 0 0 0
checkr3 feda49ff
move.d -0x5432f789,r4
move.d 0x78134452,r3
cmp.b r4,r3
test_cc 1 0 0 1
checkr3 78134452
move.d 0x85649222,r3
move.d 0x77445622,r4
cmp.b r4,r3
test_cc 0 1 0 0
checkr3 85649222
quit
|
aclements/mtrace
| 3,636
|
tests/cris/check_mulx.s
|
# mach: crisv10 crisv32
# output: fffffffe\nffffffff\nfffffffe\n1\nfffffffe\nffffffff\nfffffffe\n1\nfffe0001\n0\nfffe0001\n0\n1\n0\n1\nfffffffe\n193eade2\n277e3a49\n193eade2\n277e3a49\nfffffffe\nffffffff\n1fffe\n0\nfffffffe\nffffffff\n1fffe\n0\n1\n0\nfffe0001\n0\nfdbdade2\nffffffff\n420fade2\n0\nfffffffe\nffffffff\n1fe\n0\nfffffffe\nffffffff\n1fe\n0\n1\n0\nfe01\n0\n1\n0\nfe01\n0\nffffd9e2\nffffffff\n2be2\n0\n0\n0\n0\n0\n
.include "testutils.inc"
start
moveq -1,r3
moveq 2,r4
muls.d r4,r3
test_cc 1 0 0 0
checkr3 fffffffe
move mof,r3
checkr3 ffffffff
moveq -1,r3
moveq 2,r4
mulu.d r4,r3
test_cc 0 0 1 0
checkr3 fffffffe
move mof,r3
checkr3 1
moveq 2,r3
moveq -1,r4
muls.d r4,r3
test_cc 1 0 0 0
checkr3 fffffffe
move mof,r3
checkr3 ffffffff
moveq 2,r3
moveq -1,r4
mulu.d r4,r3
test_cc 0 0 1 0
checkr3 fffffffe
move mof,r3
checkr3 1
move.d 0xffff,r4
move.d r4,r3
muls.d r4,r3
test_cc 0 0 1 0
checkr3 fffe0001
move mof,r3
checkr3 0
move.d 0xffff,r4
move.d r4,r3
mulu.d r4,r3
test_cc 0 0 0 0
checkr3 fffe0001
move mof,r3
checkr3 0
moveq -1,r4
move.d r4,r3
muls.d r4,r3
test_cc 0 0 0 0
checkr3 1
move mof,r3
checkr3 0
moveq -1,r4
move.d r4,r3
mulu.d r4,r3
test_cc 1 0 1 0
checkr3 1
move mof,r3
checkr3 fffffffe
move.d 0x5432f789,r4
move.d 0x78134452,r3
muls.d r4,r3
test_cc 0 0 1 0
checkr3 193eade2
move mof,r3
checkr3 277e3a49
move.d 0x5432f789,r4
move.d 0x78134452,r3
mulu.d r4,r3
test_cc 0 0 1 0
checkr3 193eade2
move mof,r3
checkr3 277e3a49
move.d 0xffff,r3
moveq 2,r4
muls.w r4,r3
test_cc 1 0 0 0
checkr3 fffffffe
move mof,r3
checkr3 ffffffff
moveq -1,r3
moveq 2,r4
mulu.w r4,r3
test_cc 0 0 0 0
checkr3 1fffe
move mof,r3
checkr3 0
moveq 2,r3
move.d 0xffff,r4
muls.w r4,r3
test_cc 1 0 0 0
checkr3 fffffffe
move mof,r3
checkr3 ffffffff
moveq 2,r3
moveq -1,r4
mulu.w r4,r3
test_cc 0 0 0 0
checkr3 1fffe
move mof,r3
checkr3 0
move.d 0xffff,r4
move.d r4,r3
muls.w r4,r3
test_cc 0 0 0 0
checkr3 1
move mof,r3
checkr3 0
moveq -1,r4
move.d r4,r3
mulu.w r4,r3
test_cc 0 0 0 0
checkr3 fffe0001
move mof,r3
checkr3 0
move.d 0x5432f789,r4
move.d 0x78134452,r3
muls.w r4,r3
test_cc 1 0 0 0
checkr3 fdbdade2
move mof,r3
checkr3 ffffffff
move.d 0x5432f789,r4
move.d 0x78134452,r3
mulu.w r4,r3
test_cc 0 0 0 0
checkr3 420fade2
move mof,r3
checkr3 0
move.d 0xff,r3
moveq 2,r4
muls.b r4,r3
test_cc 1 0 0 0
checkr3 fffffffe
move mof,r3
checkr3 ffffffff
moveq -1,r3
moveq 2,r4
mulu.b r4,r3
test_cc 0 0 0 0
checkr3 1fe
move mof,r3
checkr3 0
moveq 2,r3
moveq -1,r4
muls.b r4,r3
test_cc 1 0 0 0
checkr3 fffffffe
move mof,r3
checkr3 ffffffff
moveq 2,r3
moveq -1,r4
mulu.b r4,r3
test_cc 0 0 0 0
checkr3 1fe
move mof,r3
checkr3 0
move.d 0xff,r4
move.d r4,r3
muls.b r4,r3
test_cc 0 0 0 0
checkr3 1
move mof,r3
checkr3 0
moveq -1,r4
move.d r4,r3
mulu.b r4,r3
test_cc 0 0 0 0
checkr3 fe01
move mof,r3
checkr3 0
move.d 0xfeda49ff,r4
move.d r4,r3
muls.b r4,r3
test_cc 0 0 0 0
checkr3 1
move mof,r3
checkr3 0
move.d 0xfeda49ff,r4
move.d r4,r3
mulu.b r4,r3
test_cc 0 0 0 0
checkr3 fe01
move mof,r3
checkr3 0
move.d 0x5432f789,r4
move.d 0x78134452,r3
muls.b r4,r3
test_cc 1 0 0 0
checkr3 ffffd9e2
move mof,r3
checkr3 ffffffff
move.d 0x5432f789,r4
move.d 0x78134452,r3
mulu.b r4,r3
test_cc 0 0 0 0
checkr3 2be2
move mof,r3
checkr3 0
moveq 0,r3
move.d 0xf87f4aeb,r4
muls.d r4,r3
test_cc 0 1 0 0
checkr3 0
move mof,r3
checkr3 0
move.d 0xf87f4aeb,r3
moveq 0,r4
mulu.d r4,r3
test_cc 0 1 0 0
checkr3 0
move mof,r3
checkr3 0
quit
|
aclements/mtrace
| 1,374
|
tests/cris/check_addxr.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 1\n1\n1fffe\nfffffffe\ncc463bdb\nffff0001\n1\nfffe\nfedafffe\n78133bdb\nffffff01\n1\nfe\nfeda49fe\n781344db\n
.include "testutils.inc"
start
moveq -1,r3
moveq 2,r4
add.d r4,r3
test_cc 0 0 0 1
checkr3 1
moveq 2,r3
moveq -1,r4
add.d r4,r3
test_cc 0 0 0 1
checkr3 1
move.d 0xffff,r4
move.d r4,r3
add.d r4,r3
test_cc 0 0 0 0
checkr3 1fffe
moveq -1,r4
move.d r4,r3
add.d r4,r3
test_cc 1 0 0 1
checkr3 fffffffe
move.d 0x5432f789,r4
move.d 0x78134452,r3
add.d r4,r3
test_cc 1 0 1 0
checkr3 cc463bdb
moveq -1,r3
moveq 2,r4
add.w r4,r3
test_cc 0 0 0 1
checkr3 ffff0001
moveq 2,r3
moveq -1,r4
add.w r4,r3
test_cc 0 0 0 1
checkr3 1
move.d 0xffff,r4
move.d r4,r3
add.w r4,r3
test_cc 1 0 0 1
checkr3 fffe
move.d 0xfedaffff,r4
move.d r4,r3
add.w r4,r3
test_cc 1 0 0 1
checkr3 fedafffe
move.d 0x5432f789,r4
move.d 0x78134452,r3
add.w r4,r3
test_cc 0 0 0 1
checkr3 78133bdb
moveq -1,r3
moveq 2,r4
add.b r4,r3
test_cc 0 0 0 1
checkr3 ffffff01
moveq 2,r3
moveq -1,r4
add.b r4,r3
test_cc 0 0 0 1
checkr3 1
move.d 0xff,r4
move.d r4,r3
add.b r4,r3
test_cc 1 0 0 1
checkr3 fe
move.d 0xfeda49ff,r4
move.d r4,r3
add.b r4,r3
test_cc 1 0 0 1
checkr3 feda49fe
move.d 0x5432f789,r4
move.d 0x78134452,r3
add.b r4,r3
test_cc 1 0 0 0
checkr3 781344db
quit
|
aclements/mtrace
| 1,507
|
tests/cris/check_addxm.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 1\n1\n101\n10001\n100fe\n1fffe\nfffe\nfffe\nfffffffe\nfe\nfffffffe\n781344db\n781343db\n78143bdb\n78133bdb\n800000ed\n0\n
.include "testutils.inc"
.data
x:
.byte 0xff
.word 0xffff
.word 0xff
.word 0xffff
.byte 0x89
.word 0xf789
.byte 0xff
.word 0xffff
start
moveq 2,r3
move.d x,r5
adds.b [r5+],r3
test_cc 0 0 0 1
checkr3 1
moveq 2,r3
adds.w [r5+],r3
test_cc 0 0 0 1
checkr3 1
moveq 2,r3
subq 3,r5
addu.b [r5+],r3
test_cc 0 0 0 0
checkr3 101
moveq 2,r3
addu.w [r5+],r3
subq 3,r5
test_cc 0 0 0 0
checkr3 10001
move.d 0xffff,r3
addu.b [r5],r3
test_cc 0 0 0 0
checkr3 100fe
move.d 0xffff,r3
addu.w [r5],r3
test_cc 0 0 0 0
checkr3 1fffe
move.d 0xffff,r3
adds.b [r5],r3
test_cc 0 0 0 1
checkr3 fffe
move.d 0xffff,r3
adds.w [r5],r3
test_cc 0 0 0 1
checkr3 fffe
moveq -1,r3
adds.b [r5],r3
test_cc 1 0 0 1
addq 3,r5
checkr3 fffffffe
moveq -1,r3
adds.w [r5+],r3
test_cc 0 0 0 1
checkr3 fe
moveq -1,r3
adds.w [r5+],r3
test_cc 1 0 0 1
checkr3 fffffffe
move.d 0x78134452,r3
addu.b [r5],r3
test_cc 0 0 0 0
checkr3 781344db
move.d 0x78134452,r3
adds.b [r5+],r3
test_cc 0 0 0 1
checkr3 781343db
move.d 0x78134452,r3
addu.w [r5],r3
test_cc 0 0 0 0
checkr3 78143bdb
move.d 0x78134452,r3
adds.w [r5+],r3
test_cc 0 0 0 1
checkr3 78133bdb
move.d 0x7fffffee,r3
addu.b [r5+],r3
test_cc 1 0 1 0
checkr3 800000ed
move.d 0x1,r3
adds.w [r5+],r3
test_cc 0 1 0 1
checkr3 0
quit
|
aclements/mtrace
| 1,551
|
tests/cris/check_neg.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: ffffffff\nffffffff\n0\n80000000\n1\nba987655\nffff\nffff\n0\n89ab8000\nffff0001\n45677655\nff\nff\n0\n89abae80\nffffff01\n45678955\n
.include "testutils.inc"
start
moveq 0,r3
moveq 1,r4
neg.d r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq 1,r3
moveq 0,r4
neg.d r3,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
;; FIXME: this was wrong.
moveq 0,r3
neg.d r3,r3
test_move_cc 0 1 0 0
checkr3 0
move.d 0x80000000,r3
neg.d r3,r3
test_move_cc 1 0 0 0
checkr3 80000000
moveq -1,r3
neg.d r3,r3
test_move_cc 0 0 0 0
checkr3 1
move.d 0x456789ab,r3
neg.d r3,r3
test_move_cc 1 0 0 0
checkr3 ba987655
moveq 0,r3
moveq 1,r4
neg.w r4,r3
test_move_cc 1 0 0 0
checkr3 ffff
moveq 1,r3
moveq 0,r4
neg.w r3,r3
test_move_cc 1 0 0 0
checkr3 ffff
moveq 0,r3
neg.w r3,r3
test_move_cc 0 1 0 0
checkr3 0
move.d 0x89ab8000,r3
neg.w r3,r3
test_move_cc 1 0 0 0
checkr3 89ab8000
moveq -1,r3
neg.w r3,r3
test_move_cc 0 0 0 0
checkr3 ffff0001
move.d 0x456789ab,r3
neg.w r3,r3
test_move_cc 0 0 0 0
checkr3 45677655
moveq 0,r3
moveq 1,r4
neg.b r4,r3
test_move_cc 1 0 0 0
checkr3 ff
moveq 1,r3
moveq 0,r4
neg.b r3,r3
test_move_cc 1 0 0 0
checkr3 ff
moveq 0,r3
neg.b r3,r3
test_move_cc 0 1 0 0
checkr3 0
;; FIXME: was wrong.
move.d 0x89abae80,r3
neg.b r3,r3
test_move_cc 1 0 0 1
checkr3 89abae80
moveq -1,r3
neg.b r3,r3
test_move_cc 0 0 0 0
checkr3 ffffff01
move.d 0x456789ab,r3
neg.b r3,r3
test_move_cc 0 0 0 0
checkr3 45678955
quit
|
aclements/mtrace
| 1,509
|
tests/cris/check_subr.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 1\n1\n1fffe\nfffffffe\ncc463bdb\nffff0001\n1\nfffe\nfedafffe\n78133bdb\nffffff01\n1\nfe\nfeda49fe\n781344db\n85649200\n
.include "testutils.inc"
start
moveq -1,r3
moveq -2,r4
sub.d r4,r3
test_cc 0 0 0 0
checkr3 1
moveq 2,r3
moveq 1,r4
sub.d r4,r3
test_cc 0 0 0 0
checkr3 1
move.d 0xffff,r3
move.d -0xffff,r4
sub.d r4,r3
test_cc 0 0 0 1
checkr3 1fffe
moveq 1,r4
moveq -1,r3
sub.d r4,r3
test_cc 1 0 0 0
checkr3 fffffffe
move.d -0x5432f789,r4
move.d 0x78134452,r3
sub.d r4,r3
test_cc 1 0 1 1
checkr3 cc463bdb
moveq -1,r3
moveq -2,r4
sub.w r4,r3
test_cc 0 0 0 0
checkr3 ffff0001
moveq 2,r3
moveq 1,r4
sub.w r4,r3
test_cc 0 0 0 0
checkr3 1
move.d 0xffff,r3
move.d -0xffff,r4
sub.w r4,r3
test_cc 1 0 0 0
checkr3 fffe
move.d 0xfedaffff,r3
move.d -0xfedaffff,r4
sub.w r4,r3
test_cc 1 0 0 0
checkr3 fedafffe
move.d -0x5432f789,r4
move.d 0x78134452,r3
sub.w r4,r3
test_cc 0 0 0 0
checkr3 78133bdb
moveq -1,r3
moveq -2,r4
sub.b r4,r3
test_cc 0 0 0 0
checkr3 ffffff01
moveq 2,r3
moveq 1,r4
sub.b r4,r3
test_cc 0 0 0 0
checkr3 1
move.d -0xff,r4
move.d 0xff,r3
sub.b r4,r3
test_cc 1 0 0 0
checkr3 fe
move.d -0xfeda49ff,r4
move.d 0xfeda49ff,r3
sub.b r4,r3
test_cc 1 0 0 0
checkr3 feda49fe
move.d -0x5432f789,r4
move.d 0x78134452,r3
sub.b r4,r3
test_cc 1 0 0 1
checkr3 781344db
move.d 0x85649222,r3
move.d 0x77445622,r4
sub.b r4,r3
test_cc 0 1 0 0
checkr3 85649200
quit
|
aclements/mtrace
| 1,513
|
tests/cris/check_cmpxm.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 2\n2\n2\n2\nffff\nffff\nffff\nffff\nffffffff\nffffffff\nffffffff\n78134452\n78134452\n78134452\n78134452\n4452\n80000032\n
.include "testutils.inc"
.data
x:
.byte 0xff
.word 0xffff
.word 0xff
.word 0xffff
.byte 0x89
.word 0xf789
.word 0x8002
.word 0x764
start
moveq 2,r3
move.d x,r5
cmps.b [r5+],r3
test_cc 0 0 0 1
checkr3 2
moveq 2,r3
cmps.w [r5+],r3
test_cc 0 0 0 1
checkr3 2
moveq 2,r3
subq 3,r5
cmpu.b [r5+],r3
test_cc 1 0 0 1
checkr3 2
moveq 2,r3
cmpu.w [r5+],r3
test_cc 1 0 0 1
subq 3,r5
checkr3 2
move.d 0xffff,r3
cmpu.b [r5],r3
test_cc 0 0 0 0
checkr3 ffff
move.d 0xffff,r3
cmpu.w [r5],r3
test_cc 0 1 0 0
checkr3 ffff
move.d 0xffff,r3
cmps.b [r5],r3
test_cc 0 0 0 1
checkr3 ffff
move.d 0xffff,r3
cmps.w [r5],r3
test_cc 0 0 0 1
checkr3 ffff
moveq -1,r3
cmps.b [r5],r3
test_cc 0 1 0 0
addq 3,r5
checkr3 ffffffff
moveq -1,r3
cmps.w [r5+],r3
test_cc 1 0 0 0
checkr3 ffffffff
moveq -1,r3
cmps.w [r5+],r3
test_cc 0 1 0 0
checkr3 ffffffff
move.d 0x78134452,r3
cmpu.b [r5],r3
test_cc 0 0 0 0
checkr3 78134452
move.d 0x78134452,r3
cmps.b [r5+],r3
test_cc 0 0 0 1
checkr3 78134452
move.d 0x78134452,r3
cmpu.w [r5],r3
test_cc 0 0 0 0
checkr3 78134452
move.d 0x78134452,r3
cmps.w [r5+],r3
test_cc 0 0 0 1
checkr3 78134452
move.d 0x4452,r3
cmps.w [r5+],r3
test_cc 0 0 0 1
checkr3 4452
move.d 0x80000032,r3
cmpu.w [r5+],r3
test_cc 0 0 1 0
checkr3 80000032
quit
|
aclements/mtrace
| 3,557
|
tests/cris/check_asr.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: ffffffff\n1\nffffffff\nffffffff\n5a67f\nffffffff\nffffffff\nffffffff\nf699fc67\nffffffff\n1\nffffffff\nffffffff\n5a67f\nda67ffff\nda67ffff\nda67ffff\nda67fc67\nffffffff\nffffffff\n1\nffffffff\nffffffff\n5a670007\nda67f1ff\nda67f1ff\nda67f1ff\nda67f1e7\nffffffff\nffffffff\n1\nffffffff\nffffffff\nffffffff\n5a67f1ff\n5a67f1f9\n0\n5a670000\n
.include "testutils.inc"
start
moveq -1,r3
asrq 0,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq 2,r3
asrq 1,r3
test_move_cc 0 0 0 0
checkr3 1
moveq -1,r3
asrq 31,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq -1,r3
asrq 15,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
move.d 0x5a67f19f,r3
asrq 12,r3
test_move_cc 0 0 0 0
checkr3 5a67f
move.d 0xda67f19f,r3
move.d 31,r4
asr.d r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
move.d 0xda67f19f,r3
move.d 32,r4
asr.d r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
move.d 0xda67f19f,r3
move.d 33,r4
asr.d r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
move.d 0xda67f19f,r3
move.d 66,r4
asr.d r4,r3
test_move_cc 1 0 0 0
checkr3 f699fc67
moveq -1,r3
moveq 0,r4
asr.d r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq 2,r3
moveq 1,r4
asr.d r4,r3
test_move_cc 0 0 0 0
checkr3 1
moveq -1,r3
moveq 31,r4
asr.d r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq -1,r3
moveq 15,r4
asr.d r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
move.d 0x5a67f19f,r3
moveq 12,r4
asr.d r4,r3
test_move_cc 0 0 0 0
checkr3 5a67f
move.d 0xda67f19f,r3
move.d 31,r4
asr.w r4,r3
test_move_cc 1 0 0 0
checkr3 da67ffff
move.d 0xda67f19f,r3
move.d 32,r4
asr.w r4,r3
test_move_cc 1 0 0 0
checkr3 da67ffff
move.d 0xda67f19f,r3
move.d 33,r4
asr.w r4,r3
test_move_cc 1 0 0 0
checkr3 da67ffff
move.d 0xda67f19f,r3
move.d 66,r4
asr.w r4,r3
test_move_cc 1 0 0 0
checkr3 da67fc67
moveq -1,r3
moveq 0,r4
asr.w r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq -1,r3
moveq 1,r4
asr.w r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq 2,r3
moveq 1,r4
asr.w r4,r3
test_move_cc 0 0 0 0
checkr3 1
moveq -1,r3
moveq 31,r4
asr.w r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq -1,r3
moveq 15,r4
asr.w r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
move.d 0x5a67719f,r3
moveq 12,r4
asr.w r4,r3
test_move_cc 0 0 0 0
checkr3 5a670007
move.d 0xda67f19f,r3
move.d 31,r4
asr.b r4,r3
test_move_cc 1 0 0 0
checkr3 da67f1ff
move.d 0xda67f19f,r3
move.d 32,r4
asr.b r4,r3
test_move_cc 1 0 0 0
checkr3 da67f1ff
move.d 0xda67f19f,r3
move.d 33,r4
asr.b r4,r3
test_move_cc 1 0 0 0
checkr3 da67f1ff
move.d 0xda67f19f,r3
move.d 66,r4
asr.b r4,r3
test_move_cc 1 0 0 0
checkr3 da67f1e7
moveq -1,r3
moveq 0,r4
asr.b r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq -1,r3
moveq 1,r4
asr.b r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq 2,r3
moveq 1,r4
asr.b r4,r3
test_move_cc 0 0 0 0
checkr3 1
moveq -1,r3
moveq 31,r4
asr.b r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq -1,r3
moveq 15,r4
asr.b r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq -1,r3
moveq 7,r4
asr.b r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
; FIXME: was wrong.
move.d 0x5a67f19f,r3
moveq 12,r4
asr.b r4,r3
test_move_cc 1 0 0 0
checkr3 5a67f1ff
; FIXME: was wrong.
move.d 0x5a67f19f,r3
moveq 4,r4
asr.b r4,r3
test_move_cc 1 0 0 0
checkr3 5a67f1f9
move.d 0x5a67f19f,r3
asrq 31,r3
test_move_cc 0 1 0 0
checkr3 0
move.d 0x5a67419f,r3
moveq 16,r4
asr.w r4,r3
test_move_cc 0 1 0 0
checkr3 5a670000
quit
|
aclements/mtrace
| 1,395
|
tests/cris/check_andm.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 2\n2\nffff\nffffffff\n50124400\nffff0002\n2\nfffff\nfedaff0f\n78134400\nffffff02\n2\nf02\n78134401\n78134400\n
.include "testutils.inc"
.data
x:
.dword 2,-1,0xffff,-1,0x5432f789
.word 2,-1,0xffff,0xff5f,0xf789
.byte 2,-1,0x5a,0x89,0
start
moveq -1,r3
move.d x,r5
and.d [r5+],r3
test_move_cc 0 0 0 0
checkr3 2
moveq 2,r3
and.d [r5],r3
test_move_cc 0 0 0 0
addq 4,r5
checkr3 2
move.d 0xffff,r3
and.d [r5+],r3
test_move_cc 0 0 0 0
checkr3 ffff
moveq -1,r3
and.d [r5+],r3
test_move_cc 1 0 0 0
checkr3 ffffffff
move.d 0x78134452,r3
and.d [r5+],r3
test_move_cc 0 0 0 0
checkr3 50124400
moveq -1,r3
and.w [r5+],r3
test_move_cc 0 0 0 0
checkr3 ffff0002
moveq 2,r3
and.w [r5+],r3
test_move_cc 0 0 0 0
checkr3 2
move.d 0xfffff,r3
and.w [r5],r3
test_move_cc 1 0 0 0
addq 2,r5
checkr3 fffff
move.d 0xfedaffaf,r3
and.w [r5+],r3
test_move_cc 1 0 0 0
checkr3 fedaff0f
move.d 0x78134452,r3
and.w [r5+],r3
test_move_cc 0 0 0 0
checkr3 78134400
moveq -1,r3
and.b [r5],r3
test_move_cc 0 0 0 0
addq 1,r5
checkr3 ffffff02
moveq 2,r3
and.b [r5+],r3
test_move_cc 0 0 0 0
checkr3 2
move.d 0xfa7,r3
and.b [r5+],r3
test_move_cc 0 0 0 0
checkr3 f02
move.d 0x78134453,r3
and.b [r5+],r3
test_move_cc 0 0 0 0
checkr3 78134401
and.b [r5],r3
test_move_cc 0 1 0 0
checkr3 78134400
quit
|
aclements/mtrace
| 1,091
|
tests/cris/check_scc.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 1\n0\n1\n0\n1\n0\n1\n0\n0\n1\n1\n0\n1\n0\n1\n0\n1\n0\n0\n1\n0\n1\n1\n0\n1\n0\n0\n1\n1\n0\n1\n1\n0\n
.include "testutils.inc"
.macro lcheckr3 v
move $ccs, $r9
checkr3 \v
move $r9, $ccs
.endm
start
clearf nzvc
scc r3
lcheckr3 1
scs r3
lcheckr3 0
sne r3
lcheckr3 1
seq r3
lcheckr3 0
svc r3
lcheckr3 1
svs r3
lcheckr3 0
spl r3
lcheckr3 1
smi r3
lcheckr3 0
sls r3
lcheckr3 0
shi r3
lcheckr3 1
sge r3
lcheckr3 1
slt r3
lcheckr3 0
sgt r3
lcheckr3 1
sle r3
lcheckr3 0
sa r3
lcheckr3 1
setf nzvc
scc r3
lcheckr3 0
scs r3
lcheckr3 1
sne r3
lcheckr3 0
svc r3
lcheckr3 0
svs r3
lcheckr3 1
spl r3
lcheckr3 0
smi r3
lcheckr3 1
sls r3
lcheckr3 1
shi r3
lcheckr3 0
sge r3
lcheckr3 1
slt r3
lcheckr3 0
sgt r3
lcheckr3 0
sle r3
lcheckr3 1
sa r3
lcheckr3 1
clearf n
sge r3
lcheckr3 0
slt r3
lcheckr3 1
.if 1 ;..asm.arch.cris.v32
setf p
ssb r3
.else
moveq 1,r3
.endif
lcheckr3 1
.if 1 ;..asm.arch.cris.v32
clearf p
ssb r3
.else
moveq 0,r3
.endif
lcheckr3 0
quit
|
aclements/mtrace
| 1,370
|
tests/cris/check_cmpxc.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 2\n2\n2\n2\nffff\nffff\nffff\nffff\nffffffff\nffffffff\nffffffff\n78134452\n78134452\n78134452\n78134452\n4452\n80000032\n
.include "testutils.inc"
start
moveq 2,r3
cmps.b 0xff,r3
test_cc 0 0 0 1
checkr3 2
moveq 2,r3
cmps.w 0xffff,r3
test_cc 0 0 0 1
checkr3 2
moveq 2,r3
cmpu.b 0xff,r3
test_cc 1 0 0 1
checkr3 2
moveq 2,r3
move.d 0xffffffff,r4
cmpu.w -1,r3
test_cc 1 0 0 1
checkr3 2
move.d 0xffff,r3
cmpu.b -1,r3
test_cc 0 0 0 0
checkr3 ffff
move.d 0xffff,r3
cmpu.w -1,r3
test_cc 0 1 0 0
checkr3 ffff
move.d 0xffff,r3
cmps.b 0xff,r3
test_cc 0 0 0 1
checkr3 ffff
move.d 0xffff,r3
cmps.w 0xffff,r3
test_cc 0 0 0 1
checkr3 ffff
moveq -1,r3
cmps.b 0xff,r3
test_cc 0 1 0 0
checkr3 ffffffff
moveq -1,r3
cmps.w 0xff,r3
test_cc 1 0 0 0
checkr3 ffffffff
moveq -1,r3
cmps.w 0xffff,r3
test_cc 0 1 0 0
checkr3 ffffffff
move.d 0x78134452,r3
cmpu.b 0x89,r3
test_cc 0 0 0 0
checkr3 78134452
move.d 0x78134452,r3
cmps.b 0x89,r3
test_cc 0 0 0 1
checkr3 78134452
move.d 0x78134452,r3
cmpu.w 0xf789,r3
test_cc 0 0 0 0
checkr3 78134452
move.d 0x78134452,r3
cmps.w 0xf789,r3
test_cc 0 0 0 1
checkr3 78134452
move.d 0x4452,r3
cmps.w 0x8002,r3
test_cc 0 0 0 1
checkr3 4452
move.d 0x80000032,r3
cmpu.w 0x764,r3
test_cc 0 0 1 0
checkr3 80000032
quit
|
aclements/mtrace
| 1,255
|
tests/cris/check_cmpc.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: ffffffff\n2\nffff\nffffffff\n78134452\nffffffff\n2\nffff\nfedaffff\n78134452\nffffffff\n2\nff\nfeda49ff\n78134452\n85649282\n
.include "testutils.inc"
start
moveq -1,r3
cmp.d -2,r3
test_cc 0 0 0 0
checkr3 ffffffff
moveq 2,r3
cmp.d 1,r3
test_cc 0 0 0 0
checkr3 2
move.d 0xffff,r3
cmp.d -0xffff,r3
test_cc 0 0 0 1
checkr3 ffff
moveq -1,r3
cmp.d 1,r3
test_cc 1 0 0 0
checkr3 ffffffff
move.d 0x78134452,r3
cmp.d -0x5432f789,r3
test_cc 1 0 1 1
checkr3 78134452
moveq -1,r3
cmp.w -2,r3
test_cc 0 0 0 0
checkr3 ffffffff
moveq 2,r3
cmp.w 1,r3
test_cc 0 0 0 0
checkr3 2
move.d 0xffff,r3
cmp.w 1,r3
test_cc 1 0 0 0
checkr3 ffff
move.d 0xfedaffff,r3
cmp.w 1,r3
test_cc 1 0 0 0
checkr3 fedaffff
move.d 0x78134452,r3
cmp.w 0x877,r3
test_cc 0 0 0 0
checkr3 78134452
moveq -1,r3
cmp.b -2,r3
test_cc 0 0 0 0
checkr3 ffffffff
moveq 2,r3
cmp.b 1,r3
test_cc 0 0 0 0
checkr3 2
move.d 0xff,r3
cmp.b 1,r3
test_cc 1 0 0 0
checkr3 ff
move.d 0xfeda49ff,r3
cmp.b 1,r3
test_cc 1 0 0 0
checkr3 feda49ff
move.d 0x78134452,r3
cmp.b 0x77,r3
test_cc 1 0 0 1
checkr3 78134452
move.d 0x85649282,r3
cmp.b 0x82,r3
test_cc 0 1 0 0
checkr3 85649282
quit
|
aclements/mtrace
| 1,402
|
tests/cris/check_subm.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 1\n1\n1fffe\nfffffffe\ncc463bdb\nffff0001\n1\nfffe\nfedafffe\n78133bdb\nffffff01\n1\nfe\nfeda49fe\n781344db\n85649200\n
.include "testutils.inc"
.data
x:
.dword -2,1,-0xffff,1,-0x5432f789
.word -2,1,1,0x877
.byte -2,1,0x77
.byte 0x22
start
moveq -1,r3
move.d x,r5
sub.d [r5+],r3
test_cc 0 0 0 0
checkr3 1
moveq 2,r3
sub.d [r5],r3
test_cc 0 0 0 0
addq 4,r5
checkr3 1
move.d 0xffff,r3
sub.d [r5+],r3
test_cc 0 0 0 1
checkr3 1fffe
moveq -1,r3
sub.d [r5+],r3
test_cc 1 0 0 0
checkr3 fffffffe
move.d 0x78134452,r3
sub.d [r5+],r3
test_cc 1 0 1 1
checkr3 cc463bdb
moveq -1,r3
sub.w [r5+],r3
test_cc 0 0 0 0
checkr3 ffff0001
moveq 2,r3
sub.w [r5+],r3
test_cc 0 0 0 0
checkr3 1
move.d 0xffff,r3
sub.w [r5],r3
test_cc 1 0 0 0
checkr3 fffe
move.d 0xfedaffff,r3
sub.w [r5+],r3
test_cc 1 0 0 0
checkr3 fedafffe
move.d 0x78134452,r3
sub.w [r5+],r3
test_cc 0 0 0 0
checkr3 78133bdb
moveq -1,r3
sub.b [r5],r3
test_cc 0 0 0 0
addq 1,r5
checkr3 ffffff01
moveq 2,r3
sub.b [r5],r3
test_cc 0 0 0 0
checkr3 1
move.d 0xff,r3
sub.b [r5],r3
test_cc 1 0 0 0
checkr3 fe
move.d 0xfeda49ff,r3
sub.b [r5+],r3
test_cc 1 0 0 0
checkr3 feda49fe
move.d 0x78134452,r3
sub.b [r5+],r3
test_cc 1 0 0 1
checkr3 781344db
move.d 0x85649222,r3
sub.b [r5],r3
test_cc 0 1 0 0
checkr3 85649200
quit
|
aclements/mtrace
| 1,409
|
tests/cris/check_addm.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 1\n1\n1fffe\nfffffffe\ncc463bdb\nffff0001\n1\nfffe\nfedafffe\n78133bdb\nffffff01\n1\nfe\nfeda49fe\n781344db\n781344d0\n
.include "testutils.inc"
.data
x:
.dword 2,-1,0xffff,-1,0x5432f789
.word 2,-1,0xffff,0xf789
.byte 2,0xff,0x89
.byte 0x7e
start
moveq -1,r3
move.d x,r5
add.d [r5+],r3
test_cc 0 0 0 1
checkr3 1
moveq 2,r3
add.d [r5],r3
test_cc 0 0 0 1
addq 4,r5
checkr3 1
move.d 0xffff,r3
add.d [r5+],r3
test_cc 0 0 0 0
checkr3 1fffe
moveq -1,r3
add.d [r5+],r3
test_cc 1 0 0 1
checkr3 fffffffe
move.d 0x78134452,r3
add.d [r5+],r3
test_cc 1 0 1 0
checkr3 cc463bdb
moveq -1,r3
add.w [r5+],r3
test_cc 0 0 0 1
checkr3 ffff0001
moveq 2,r3
add.w [r5+],r3
test_cc 0 0 0 1
checkr3 1
move.d 0xffff,r3
add.w [r5],r3
test_cc 1 0 0 1
checkr3 fffe
move.d 0xfedaffff,r3
add.w [r5+],r3
test_cc 1 0 0 1
checkr3 fedafffe
move.d 0x78134452,r3
add.w [r5+],r3
test_cc 0 0 0 1
checkr3 78133bdb
moveq -1,r3
add.b [r5],r3
test_cc 0 0 0 1
addq 1,r5
checkr3 ffffff01
moveq 2,r3
add.b [r5],r3
test_cc 0 0 0 1
checkr3 1
move.d 0xff,r3
add.b [r5],r3
test_cc 1 0 0 1
checkr3 fe
move.d 0xfeda49ff,r3
add.b [r5+],r3
test_cc 1 0 0 1
checkr3 feda49fe
move.d 0x78134452,r3
add.b [r5+],r3
test_cc 1 0 0 0
checkr3 781344db
move.d 0x78134452,r3
add.b [r5],r3
test_cc 1 0 1 0
checkr3 781344d0
quit
|
aclements/mtrace
| 1,250
|
tests/cris/check_btst.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 1111\n
.include "testutils.inc"
start
clearf nzvc
moveq -1,r3
.if 1 ;..asm.arch.cris.v32
.else
setf vc
.endif
btstq 0,r3
test_cc 1 0 0 0
moveq 2,r3
btstq 1,r3
test_cc 1 0 0 0
moveq 4,r3
btstq 1,r3
test_cc 0 1 0 0
moveq -1,r3
btstq 31,r3
test_cc 1 0 0 0
move.d 0x5a67f19f,r3
btstq 12,r3
test_cc 1 0 0 0
move.d 0xda67f19f,r3
move.d 29,r4
btst r4,r3
test_cc 0 0 0 0
move.d 0xda67f19f,r3
move.d 32,r4
btst r4,r3
test_cc 1 0 0 0
move.d 0xda67f191,r3
move.d 33,r4
btst r4,r3
test_cc 0 0 0 0
moveq -1,r3
moveq 0,r4
btst r4,r3
test_cc 1 0 0 0
moveq 2,r3
moveq 1,r4
btst r4,r3
test_cc 1 0 0 0
moveq -1,r3
moveq 31,r4
btst r4,r3
test_cc 1 0 0 0
moveq 4,r3
btstq 1,r3
test_cc 0 1 0 0
moveq -1,r3
moveq 15,r4
btst r4,r3
test_cc 1 0 0 0
move.d 0x5a67f19f,r3
moveq 12,r4
btst r4,r3
test_cc 1 0 0 0
move.d 0x5a678000,r3
moveq 11,r4
btst r4,r3
test_cc 0 1 0 0
move.d 0x5a67f19f,r3
btst r3,r3
test_cc 0 0 0 0
move.d 0x1111,r3
checkr3 1111
; check that X gets cleared and that only the NZ flags are touched.
move.d 0xff, $r0
move $r0, $ccs
btst r3,r3
move $ccs, $r0
and.d 0xff, $r0
cmp.d 0xe3, $r0
test_cc 0 1 0 0
quit
|
aclements/mtrace
| 1,244
|
tests/cris/check_subc.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 1\n1\n1fffe\nfffffffe\ncc463bdb\nffff0001\n1\nfffe\nfedafffe\n78133bdb\nffffff01\n1\nfe\nfeda49fe\n781344db\n85649200\n
.include "testutils.inc"
start
moveq -1,r3
sub.d -2,r3
test_cc 0 0 0 0
checkr3 1
moveq 2,r3
sub.d 1,r3
test_cc 0 0 0 0
checkr3 1
move.d 0xffff,r3
sub.d -0xffff,r3
test_cc 0 0 0 1
checkr3 1fffe
moveq -1,r3
sub.d 1,r3
test_cc 1 0 0 0
checkr3 fffffffe
move.d 0x78134452,r3
sub.d -0x5432f789,r3
test_cc 1 0 1 1
checkr3 cc463bdb
moveq -1,r3
sub.w -2,r3
test_cc 0 0 0 0
checkr3 ffff0001
moveq 2,r3
sub.w 1,r3
test_cc 0 0 0 0
checkr3 1
move.d 0xffff,r3
sub.w 1,r3
test_cc 1 0 0 0
checkr3 fffe
move.d 0xfedaffff,r3
sub.w 1,r3
test_cc 1 0 0 0
checkr3 fedafffe
move.d 0x78134452,r3
sub.w 0x877,r3
test_cc 0 0 0 0
checkr3 78133bdb
moveq -1,r3
sub.b -2,r3
test_cc 0 0 0 0
checkr3 ffffff01
moveq 2,r3
sub.b 1,r3
test_cc 0 0 0 0
checkr3 1
move.d 0xff,r3
sub.b 1,r3
test_cc 1 0 0 0
checkr3 fe
move.d 0xfeda49ff,r3
sub.b 1,r3
test_cc 1 0 0 0
checkr3 feda49fe
move.d 0x78134452,r3
sub.b 0x77,r3
test_cc 1 0 0 1
checkr3 781344db
move.d 0x85649282,r3
sub.b 0x82,r3
test_cc 0 1 0 0
checkr3 85649200
quit
|
aclements/mtrace
| 1,414
|
tests/cris/check_cmpm.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: ffffffff\n2\nffff\nffffffff\n78134452\nffffffff\n2\nffff\nfedaffff\n78134452\nffffffff\n2\nff\nfeda49ff\n78134452\n85649222\n
.include "testutils.inc"
.data
x:
.dword -2,1,-0xffff,1,-0x5432f789
.word -2,1,1,0x877
.byte -2,1,0x77
.byte 0x22
start
moveq -1,r3
move.d x,r5
cmp.d [r5+],r3
test_cc 0 0 0 0
checkr3 ffffffff
moveq 2,r3
cmp.d [r5],r3
test_cc 0 0 0 0
addq 4,r5
checkr3 2
move.d 0xffff,r3
cmp.d [r5+],r3
test_cc 0 0 0 1
checkr3 ffff
moveq -1,r3
cmp.d [r5+],r3
test_cc 1 0 0 0
checkr3 ffffffff
move.d 0x78134452,r3
cmp.d [r5+],r3
test_cc 1 0 1 1
checkr3 78134452
moveq -1,r3
cmp.w [r5+],r3
test_cc 0 0 0 0
checkr3 ffffffff
moveq 2,r3
cmp.w [r5+],r3
test_cc 0 0 0 0
checkr3 2
move.d 0xffff,r3
cmp.w [r5],r3
test_cc 1 0 0 0
checkr3 ffff
move.d 0xfedaffff,r3
cmp.w [r5+],r3
test_cc 1 0 0 0
checkr3 fedaffff
move.d 0x78134452,r3
cmp.w [r5+],r3
test_cc 0 0 0 0
checkr3 78134452
moveq -1,r3
cmp.b [r5],r3
test_cc 0 0 0 0
addq 1,r5
checkr3 ffffffff
moveq 2,r3
cmp.b [r5],r3
test_cc 0 0 0 0
checkr3 2
move.d 0xff,r3
cmp.b [r5],r3
test_cc 1 0 0 0
checkr3 ff
move.d 0xfeda49ff,r3
cmp.b [r5+],r3
test_cc 1 0 0 0
checkr3 feda49ff
move.d 0x78134452,r3
cmp.b [r5+],r3
test_cc 1 0 0 1
checkr3 78134452
move.d 0x85649222,r3
cmp.b [r5],r3
test_cc 0 1 0 0
checkr3 85649222
quit
|
aclements/mtrace
| 1,273
|
tests/cris/check_orr.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 3\n3\nffff\nffffffff\n7c33f7db\nffff0003\n3\nfedaffff\n7813f7db\n3\n3\nfeb\n781344db\n
.include "testutils.inc"
start
moveq 1,r3
moveq 2,r4
or.d r4,r3
test_move_cc 0 0 0 0
checkr3 3
moveq 2,r3
moveq 1,r4
or.d r4,r3
test_move_cc 0 0 0 0
checkr3 3
move.d 0xff0f,r4
move.d 0xf0ff,r3
or.d r4,r3
test_move_cc 0 0 0 0
checkr3 ffff
moveq -1,r4
move.d r4,r3
or.d r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
move.d 0x5432f789,r4
move.d 0x78134452,r3
or.d r4,r3
test_move_cc 0 0 0 0
checkr3 7c33f7db
move.d 0xffff0001,r3
moveq 2,r4
or.w r4,r3
test_move_cc 0 0 0 0
checkr3 ffff0003
moveq 2,r3
move.d 0xffff0001,r4
or.w r4,r3
test_move_cc 0 0 0 0
checkr3 3
move.d 0xfedaffaf,r3
move.d 0xffffff5f,r4
or.w r4,r3
test_move_cc 1 0 0 0
checkr3 fedaffff
move.d 0x5432f789,r4
move.d 0x78134452,r3
or.w r4,r3
test_move_cc 1 0 0 0
checkr3 7813f7db
moveq 1,r3
move.d 0xffffff02,r4
or.b r4,r3
test_move_cc 0 0 0 0
checkr3 3
moveq 2,r3
moveq 1,r4
or.b r4,r3
test_move_cc 0 0 0 0
checkr3 3
move.d 0x4a,r4
move.d 0xfa3,r3
or.b r4,r3
test_move_cc 1 0 0 0
checkr3 feb
move.d 0x5432f789,r4
move.d 0x78134453,r3
or.b r4,r3
test_move_cc 1 0 0 0
checkr3 781344db
quit
|
aclements/mtrace
| 1,374
|
tests/cris/check_addr.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 1\n1\n1fffe\nfffffffe\ncc463bdb\nffff0001\n1\nfffe\nfedafffe\n78133bdb\nffffff01\n1\nfe\nfeda49fe\n781344db\n
.include "testutils.inc"
start
moveq -1,r3
moveq 2,r4
add.d r4,r3
test_cc 0 0 0 1
checkr3 1
moveq 2,r3
moveq -1,r4
add.d r4,r3
test_cc 0 0 0 1
checkr3 1
move.d 0xffff,r4
move.d r4,r3
add.d r4,r3
test_cc 0 0 0 0
checkr3 1fffe
moveq -1,r4
move.d r4,r3
add.d r4,r3
test_cc 1 0 0 1
checkr3 fffffffe
move.d 0x5432f789,r4
move.d 0x78134452,r3
add.d r4,r3
test_cc 1 0 1 0
checkr3 cc463bdb
moveq -1,r3
moveq 2,r4
add.w r4,r3
test_cc 0 0 0 1
checkr3 ffff0001
moveq 2,r3
moveq -1,r4
add.w r4,r3
test_cc 0 0 0 1
checkr3 1
move.d 0xffff,r4
move.d r4,r3
add.w r4,r3
test_cc 1 0 0 1
checkr3 fffe
move.d 0xfedaffff,r4
move.d r4,r3
add.w r4,r3
test_cc 1 0 0 1
checkr3 fedafffe
move.d 0x5432f789,r4
move.d 0x78134452,r3
add.w r4,r3
test_cc 0 0 0 1
checkr3 78133bdb
moveq -1,r3
moveq 2,r4
add.b r4,r3
test_cc 0 0 0 1
checkr3 ffffff01
moveq 2,r3
moveq -1,r4
add.b r4,r3
test_cc 0 0 0 1
checkr3 1
move.d 0xff,r4
move.d r4,r3
add.b r4,r3
test_cc 1 0 0 1
checkr3 fe
move.d 0xfeda49ff,r4
move.d r4,r3
add.b r4,r3
test_cc 1 0 0 1
checkr3 feda49fe
move.d 0x5432f789,r4
move.d 0x78134452,r3
add.b r4,r3
test_cc 1 0 0 0
checkr3 781344db
quit
|
aclements/mtrace
| 1,347
|
tests/cris/check_addxc.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 1\n1\n101\n10001\n100fe\n1fffe\nfffe\nfffe\nfffffffe\nfe\nfffffffe\n781344db\n781343db\n78143bdb\n78133bdb\n800000ed\n0\n
.include "testutils.inc"
start
moveq 2,r3
adds.b 0xff,r3
test_cc 0 0 0 1
checkr3 1
moveq 2,r3
adds.w 0xffff,r3
test_cc 0 0 0 1
checkr3 1
moveq 2,r3
addu.b 0xff,r3
checkr3 101
moveq 2,r3
move.d 0xffffffff,r4
addu.w -1,r3
test_cc 0 0 0 0
checkr3 10001
move.d 0xffff,r3
addu.b -1,r3
test_cc 0 0 0 0
checkr3 100fe
move.d 0xffff,r3
addu.w -1,r3
test_cc 0 0 0 0
checkr3 1fffe
move.d 0xffff,r3
adds.b 0xff,r3
test_cc 0 0 0 1
checkr3 fffe
move.d 0xffff,r3
adds.w 0xffff,r3
test_cc 0 0 0 1
checkr3 fffe
moveq -1,r3
adds.b 0xff,r3
test_cc 1 0 0 1
checkr3 fffffffe
moveq -1,r3
adds.w 0xff,r3
test_cc 0 0 0 1
checkr3 fe
moveq -1,r3
adds.w 0xffff,r3
test_cc 1 0 0 1
checkr3 fffffffe
move.d 0x78134452,r3
addu.b 0x89,r3
test_cc 0 0 0 0
checkr3 781344db
move.d 0x78134452,r3
adds.b 0x89,r3
test_cc 0 0 0 1
checkr3 781343db
move.d 0x78134452,r3
addu.w 0xf789,r3
test_cc 0 0 0 0
checkr3 78143bdb
move.d 0x78134452,r3
adds.w 0xf789,r3
test_cc 0 0 0 1
checkr3 78133bdb
move.d 0x7fffffee,r3
addu.b 0xff,r3
test_cc 1 0 1 0
checkr3 800000ed
move.d 0x1,r3
adds.w 0xffff,r3
test_cc 0 1 0 1
checkr3 0
quit
|
aclements/mtrace
| 1,063
|
tests/cris/check_orc.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 3\n3\nffff\nffffffff\n7c33f7db\nffff0003\n3\nfedaffff\n7813f7db\n3\n3\nfeb\n781344db\n
.include "testutils.inc"
start
moveq 1,r3
or.d 2,r3
test_move_cc 0 0 0 0
checkr3 3
moveq 2,r3
or.d 1,r3
test_move_cc 0 0 0 0
checkr3 3
move.d 0xf0ff,r3
or.d 0xff0f,r3
test_move_cc 0 0 0 0
checkr3 ffff
moveq -1,r3
or.d -1,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
move.d 0x78134452,r3
or.d 0x5432f789,r3
test_move_cc 0 0 0 0
checkr3 7c33f7db
move.d 0xffff0001,r3
or.w 2,r3
test_move_cc 0 0 0 0
checkr3 ffff0003
moveq 2,r3
or.w 1,r3
test_move_cc 0 0 0 0
checkr3 3
move.d 0xfedaffaf,r3
or.w 0xff5f,r3
test_move_cc 1 0 0 0
checkr3 fedaffff
move.d 0x78134452,r3
or.w 0xf789,r3
test_move_cc 1 0 0 0
checkr3 7813f7db
moveq 1,r3
or.b 2,r3
test_move_cc 0 0 0 0
checkr3 3
moveq 2,r3
or.b 1,r3
test_move_cc 0 0 0 0
checkr3 3
move.d 0xfa3,r3
or.b 0x4a,r3
test_move_cc 1 0 0 0
checkr3 feb
move.d 0x78134453,r3
or.b 0x89,r3
test_move_cc 1 0 0 0
checkr3 781344db
quit
|
aclements/mtrace
| 1,512
|
tests/cris/check_boundc.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 2\n2\nffff\nffffffff\n5432f789\n2\nffff\n2\nffff\nffff\nf789\n2\n2\nff\nff\nff\n89\n0\nff\n
.include "testutils.inc"
start
moveq -1,r3
moveq 2,r4
bound.d 2,r3
test_move_cc 0 0 0 0
checkr3 2
moveq 2,r3
bound.d 0xffffffff,r3
test_move_cc 0 0 0 0
checkr3 2
move.d 0xffff,r3
bound.d 0xffff,r3
test_move_cc 0 0 0 0
checkr3 ffff
moveq -1,r3
bound.d 0xffffffff,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
move.d 0x78134452,r3
bound.d 0x5432f789,r3
test_move_cc 0 0 0 0
checkr3 5432f789
moveq -1,r3
bound.w 2,r3
test_move_cc 0 0 0 0
checkr3 2
moveq -1,r3
bound.w 0xffff,r3
test_move_cc 0 0 0 0
checkr3 ffff
moveq 2,r3
bound.w 0xffff,r3
test_move_cc 0 0 0 0
checkr3 2
move.d 0xffff,r3
bound.w 0xffff,r3
test_move_cc 0 0 0 0
checkr3 ffff
move.d 0xfedaffff,r3
bound.w 0xffff,r3
test_move_cc 0 0 0 0
checkr3 ffff
move.d 0x78134452,r3
bound.w 0xf789,r3
test_move_cc 0 0 0 0
checkr3 f789
moveq -1,r3
bound.b 2,r3
test_move_cc 0 0 0 0
checkr3 2
moveq 2,r3
bound.b 0xff,r3
test_move_cc 0 0 0 0
checkr3 2
moveq -1,r3
bound.b 0xff,r3
test_move_cc 0 0 0 0
checkr3 ff
move.d 0xff,r3
bound.b 0xff,r3
test_move_cc 0 0 0 0
checkr3 ff
move.d 0xfeda49ff,r3
bound.b 0xff,r3
test_move_cc 0 0 0 0
checkr3 ff
move.d 0x78134452,r3
bound.b 0x89,r3
test_move_cc 0 0 0 0
checkr3 89
bound.w 0,r3
test_move_cc 0 1 0 0
checkr3 0
move.d 0xffff,r3
bound.b -1,r3
test_move_cc 0 0 0 0
checkr3 ff
quit
|
aclements/mtrace
| 1,439
|
tests/cris/check_andr.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: 2\n2\nffff\nffffffff\n50124400\nffff0002\n2\nfffff\nfedaff0f\n78134400\nffffff02\n2\nf02\n78134401\n78134400\n
.include "testutils.inc"
start
moveq -1,r3
moveq 2,r4
and.d r4,r3
test_move_cc 0 0 0 0
checkr3 2
moveq 2,r3
moveq -1,r4
and.d r4,r3
test_move_cc 0 0 0 0
checkr3 2
move.d 0xffff,r4
move.d r4,r3
and.d r4,r3
test_move_cc 0 0 0 0
checkr3 ffff
moveq -1,r4
move.d r4,r3
and.d r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
move.d 0x5432f789,r4
move.d 0x78134452,r3
and.d r4,r3
test_move_cc 0 0 0 0
checkr3 50124400
moveq -1,r3
moveq 2,r4
and.w r4,r3
test_move_cc 0 0 0 0
checkr3 ffff0002
moveq 2,r3
moveq -1,r4
and.w r4,r3
test_move_cc 0 0 0 0
checkr3 2
move.d 0xfffff,r3
move.d 0xffff,r4
and.w r4,r3
test_move_cc 1 0 0 0
checkr3 fffff
move.d 0xfedaffaf,r3
move.d 0xff5f,r4
and.w r4,r3
test_move_cc 1 0 0 0
checkr3 fedaff0f
move.d 0x5432f789,r4
move.d 0x78134452,r3
and.w r4,r3
test_move_cc 0 0 0 0
checkr3 78134400
moveq -1,r3
moveq 2,r4
and.b r4,r3
test_move_cc 0 0 0 0
checkr3 ffffff02
moveq 2,r3
moveq -1,r4
and.b r4,r3
test_move_cc 0 0 0 0
checkr3 2
move.d 0x5a,r4
move.d 0xfa7,r3
and.b r4,r3
test_move_cc 0 0 0 0
checkr3 f02
move.d 0x5432f789,r4
move.d 0x78134453,r3
and.b r4,r3
test_move_cc 0 0 0 0
checkr3 78134401
moveq 0,r7
and.b r7,r3
test_move_cc 0 1 0 0
checkr3 78134400
quit
|
aclements/mtrace
| 3,308
|
tests/cris/check_lsr.s
|
# mach: crisv0 crisv3 crisv8 crisv10 crisv32
# output: ffffffff\n1\n1\n1ffff\n5a67f\n1\n0\n0\n3699fc67\nffffffff\n1\n1\n1ffff\n5a67f\nda670000\nda670000\nda670000\nda673c67\nffffffff\nffff7fff\n1\nffff0000\nffff0001\n5a67000f\nda67f100\nda67f100\nda67f100\nda67f127\nffffffff\nffffff7f\n1\nffffff00\nffffff00\nffffff01\n5a67f100\n5a67f109\n
.include "testutils.inc"
start
moveq -1,r3
lsrq 0,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq 2,r3
lsrq 1,r3
test_move_cc 0 0 0 0
checkr3 1
moveq -1,r3
lsrq 31,r3
test_move_cc 0 0 0 0
checkr3 1
moveq -1,r3
lsrq 15,r3
test_move_cc 0 0 0 0
checkr3 1ffff
move.d 0x5a67f19f,r3
lsrq 12,r3
test_move_cc 0 0 0 0
checkr3 5a67f
move.d 0xda67f19f,r3
move.d 31,r4
lsr.d r4,r3
test_move_cc 0 0 0 0
checkr3 1
move.d 0xda67f19f,r3
move.d 32,r4
lsr.d r4,r3
test_move_cc 0 1 0 0
checkr3 0
move.d 0xda67f19f,r3
move.d 33,r4
lsr.d r4,r3
test_move_cc 0 1 0 0
checkr3 0
move.d 0xda67f19f,r3
move.d 66,r4
lsr.d r4,r3
test_move_cc 0 0 0 0
checkr3 3699fc67
moveq -1,r3
moveq 0,r4
lsr.d r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq 2,r3
moveq 1,r4
lsr.d r4,r3
test_move_cc 0 0 0 0
checkr3 1
moveq -1,r3
moveq 31,r4
lsr.d r4,r3
test_move_cc 0 0 0 0
checkr3 1
moveq -1,r3
moveq 15,r4
lsr.d r4,r3
test_move_cc 0 0 0 0
checkr3 1ffff
move.d 0x5a67f19f,r3
moveq 12,r4
lsr.d r4,r3
test_move_cc 0 0 0 0
checkr3 5a67f
move.d 0xda67f19f,r3
move.d 31,r4
lsr.w r4,r3
test_move_cc 0 1 0 0
checkr3 da670000
move.d 0xda67f19f,r3
move.d 32,r4
lsr.w r4,r3
test_move_cc 0 1 0 0
checkr3 da670000
move.d 0xda67f19f,r3
move.d 33,r4
lsr.w r4,r3
test_move_cc 0 1 0 0
checkr3 da670000
move.d 0xda67f19f,r3
move.d 66,r4
lsr.w r4,r3
test_move_cc 0 0 0 0
checkr3 da673c67
moveq -1,r3
moveq 0,r4
lsr.w r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq -1,r3
moveq 1,r4
lsr.w r4,r3
test_move_cc 0 0 0 0
checkr3 ffff7fff
moveq 2,r3
moveq 1,r4
lsr.w r4,r3
test_move_cc 0 0 0 0
checkr3 1
;; FIXME: this was wrong. Z should be set.
moveq -1,r3
moveq 31,r4
lsr.w r4,r3
test_move_cc 0 1 0 0
checkr3 ffff0000
moveq -1,r3
moveq 15,r4
lsr.w r4,r3
test_move_cc 0 0 0 0
checkr3 ffff0001
move.d 0x5a67f19f,r3
moveq 12,r4
lsr.w r4,r3
test_move_cc 0 0 0 0
checkr3 5a67000f
move.d 0xda67f19f,r3
move.d 31,r4
lsr.b r4,r3
test_move_cc 0 1 0 0
checkr3 da67f100
move.d 0xda67f19f,r3
move.d 32,r4
lsr.b r4,r3
test_move_cc 0 1 0 0
checkr3 da67f100
move.d 0xda67f19f,r3
move.d 33,r4
lsr.b r4,r3
test_move_cc 0 1 0 0
checkr3 da67f100
move.d 0xda67f19f,r3
move.d 66,r4
lsr.b r4,r3
test_move_cc 0 0 0 0
checkr3 da67f127
moveq -1,r3
moveq 0,r4
lsr.b r4,r3
test_move_cc 1 0 0 0
checkr3 ffffffff
moveq -1,r3
moveq 1,r4
lsr.b r4,r3
test_move_cc 0 0 0 0
checkr3 ffffff7f
moveq 2,r3
moveq 1,r4
lsr.b r4,r3
test_move_cc 0 0 0 0
checkr3 1
moveq -1,r3
moveq 31,r4
lsr.b r4,r3
test_move_cc 0 1 0 0
checkr3 ffffff00
moveq -1,r3
moveq 15,r4
lsr.b r4,r3
test_move_cc 0 1 0 0
checkr3 ffffff00
moveq -1,r3
moveq 7,r4
lsr.b r4,r3
test_move_cc 0 0 0 0
checkr3 ffffff01
move.d 0x5a67f19f,r3
moveq 12,r4
lsr.b r4,r3
test_move_cc 0 1 0 0
checkr3 5a67f100
move.d 0x5a67f19f,r3
moveq 4,r4
lsr.b r4,r3
test_move_cc 0 0 0 0
checkr3 5a67f109
quit
|
acl-dev/acl
| 2,930
|
lib_fiber/c/src/fiber/exp/setjmp_rv64g.S
|
/*-
* Copyright (c) 2015-2016 Ruslan Bukin <br@bsdpad.com>
* All rights reserved.
*
* Portions of this software were developed by SRI International and the
* University of Cambridge Computer Laboratory under DARPA/AFRL contract
* FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
*
* Portions of this software were developed by the University of Cambridge
* Computer Laboratory as part of the CTSRD Project, with support from the
* UK Higher Education Innovation Fund (HEIF).
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* 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
* SUCH DAMAGE.
*/
#define ENTRY(sym) \
.text; .globl sym; .type sym,@function; sym:
#define END(sym) .size sym, . - sym
ENTRY(SETJMP)
/* Store the stack pointer */
sd sp, (0 * 8)(a0)
addi a0, a0, (1 * 8)
/* Store the general purpose registers and ra */
sd s0, (0 * 8)(a0)
sd s1, (1 * 8)(a0)
sd s2, (2 * 8)(a0)
sd s3, (3 * 8)(a0)
sd s4, (4 * 8)(a0)
sd s5, (5 * 8)(a0)
sd s6, (6 * 8)(a0)
sd s7, (7 * 8)(a0)
sd s8, (8 * 8)(a0)
sd s9, (9 * 8)(a0)
sd s10, (10 * 8)(a0)
sd s11, (11 * 8)(a0)
sd ra, (12 * 8)(a0)
addi a0, a0, (13 * 8)
/* Return value */
li a0, 0
ret
END(SETJMP)
ENTRY(LONGJMP)
/* Restore the stack pointer */
ld t0, 0(a0)
mv sp, t0
addi a0, a0, (1 * 8)
/* Restore the general purpose registers and ra */
ld s0, (0 * 8)(a0)
ld s1, (1 * 8)(a0)
ld s2, (2 * 8)(a0)
ld s3, (3 * 8)(a0)
ld s4, (4 * 8)(a0)
ld s5, (5 * 8)(a0)
ld s6, (6 * 8)(a0)
ld s7, (7 * 8)(a0)
ld s8, (8 * 8)(a0)
ld s9, (9 * 8)(a0)
ld s10, (10 * 8)(a0)
ld s11, (11 * 8)(a0)
ld ra, (12 * 8)(a0)
addi a0, a0, (13 * 8)
/* Load the return value */
mv a0, a1
ret
END(LONGJMP)
|
acl-dev/acl
| 1,813
|
lib_fiber/c/src/fiber/exp/setjmp_x86_64.S
|
/*
* 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
* or http://www.opensolaris.org/os/licensing.
* 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 (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
*/
#define ENTRY(x) \
.text; \
.align 8; \
.globl x; \
.type x, @function; \
x:
#define SET_SIZE(x) \
.size x, [.-x]
/*
* Setjmp and longjmp implement non-local gotos using state vectors
* type label_t.
*/
#ifdef __x86_64__
ENTRY(SETJMP)
movq %rsp, 0(%rdi)
movq %rbp, 8(%rdi)
movq %rbx, 16(%rdi)
movq %r12, 24(%rdi)
movq %r13, 32(%rdi)
movq %r14, 40(%rdi)
movq %r15, 48(%rdi)
movq 0(%rsp), %rdx /* return address */
movq %rdx, 56(%rdi) /* rip */
xorl %eax, %eax /* return 0 */
ret
SET_SIZE(SETJMP)
ENTRY(LONGJMP)
movq 0(%rdi), %rsp
movq 8(%rdi), %rbp
movq 16(%rdi), %rbx
movq 24(%rdi), %r12
movq 32(%rdi), %r13
movq 40(%rdi), %r14
movq 48(%rdi), %r15
movq 56(%rdi), %rdx /* return address */
movq %rdx, 0(%rsp)
xorl %eax, %eax
incl %eax /* return 1 */
ret
SET_SIZE(LONGJMP)
#ifdef __ELF__
.section .note.GNU-stack,"",%progbits
#endif
#endif /* __x86_64__ */
|
acl-dev/acl
| 1,981
|
lib_fiber/c/src/fiber/exp/setjmp_i386.S
|
/*
* 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
* or http://www.opensolaris.org/os/licensing.
* 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 (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
*/
#define ENTRY(x) \
.text; \
.align 8; \
.globl x; \
.type x, @function; \
x:
#define SET_SIZE(x) \
.size x, [.-x]
/*
* Setjmp and longjmp implement non-local gotos using state vectors
* type label_t.
*/
#ifdef __i386__
ENTRY(SETJMP) /* save area is passed in eax */
movl %ebp, 0(%eax) /* save ebp */
movl %ebx, 4(%eax) /* save ebx */
movl %esi, 8(%eax) /* save esi */
movl %edi, 12(%eax) /* save edi */
movl %esp, 16(%eax) /* save esp */
movl (%esp), %ecx /* %eip (return address) */
movl %ecx, 20(%eax) /* save eip */
subl %eax, %eax /* return 0 */
ret
SET_SIZE(SETJMP)
ENTRY(LONGJMP) /* save area is passed in eax */
movl 0(%eax), %ebp /* restore ebp */
movl 4(%eax), %ebx /* restore ebx */
movl 8(%eax), %esi /* restore esi */
movl 12(%eax), %edi /* restore edi */
movl 16(%eax), %esp /* restore esp */
movl 20(%eax), %ecx /* %eip (return address) */
addl $4, %esp /* pop ret adr */
jmp *%ecx /* indirect jump */
SET_SIZE(LONGJMP)
#ifdef __ELF__
.section .note.GNU-stack,"",%progbits
#endif
#endif /* __i386__ */
|
acl-dev/acl
| 1,763
|
lib_fiber/c/src/fiber/exp/setjmp_s390x.S
|
/*
* Copyright (c) 2005-2014 Rich Felker, et al.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
.global SETJMP
.type SETJMP,@function
SETJMP:
stmg %r6, %r15, 0(%r2)
std %f8, 10*8(%r2)
std %f9, 11*8(%r2)
std %f10, 12*8(%r2)
std %f11, 13*8(%r2)
std %f12, 14*8(%r2)
std %f13, 15*8(%r2)
std %f14, 16*8(%r2)
std %f15, 17*8(%r2)
lghi %r2, 0
br %r14
.global LONGJMP
.type LONGJMP,@function
LONGJMP:
1:
lmg %r6, %r15, 0(%r2)
ld %f8, 10*8(%r2)
ld %f9, 11*8(%r2)
ld %f10, 12*8(%r2)
ld %f11, 13*8(%r2)
ld %f12, 14*8(%r2)
ld %f13, 15*8(%r2)
ld %f14, 16*8(%r2)
ld %f15, 17*8(%r2)
ltgr %r2, %r3
bnzr %r14
lhi %r2, 1
br %r14
#ifdef __ELF__
.section .note.GNU-stack,"",%progbits
#endif
|
acl-dev/acl
| 3,378
|
lib_fiber/c/src/fiber/exp/setjmp_ppc.S
|
/* $FreeBSD$ */
/* from: NetBSD: setjmp.S,v 1.1 1998/01/27 15:13:12 sakamoto Exp $ */
/* from: OpenBSD: setjmp.S,v 1.2 1996/12/28 06:22:18 rahnds Exp */
/* kernel version of this file, does not have signal goop */
/* int setjmp(jmp_buf env) */
#define _ASM
#include <asm/types.h>
#ifdef __powerpc64__
#if !defined(PPC64_ELF_ABI_v2) && !defined(PPC64_ELF_ABI_v1)
#if defined(_CALL_ELF) && _CALL_ELF == 2
#define PPC64_ELF_ABI_v2
#endif /* _CALL_ELF */
#endif /* PPC64_ELF_ABI_ */
#endif /* __powerpc64__ */
#ifdef __powerpc64__
#define LD_REG ld
#define ST_REG std
#define REGWIDTH 8
#else
#define LD_REG lwz
#define ST_REG stw
#define REGWIDTH 4
#endif /* __powerpc64__ */
#define JMP_r1 1*REGWIDTH
#define JMP_r2 2*REGWIDTH
#define JMP_r14 3*REGWIDTH
#define JMP_r15 4*REGWIDTH
#define JMP_r16 5*REGWIDTH
#define JMP_r17 6*REGWIDTH
#define JMP_r18 7*REGWIDTH
#define JMP_r19 8*REGWIDTH
#define JMP_r20 9*REGWIDTH
#define JMP_r21 10*REGWIDTH
#define JMP_r22 11*REGWIDTH
#define JMP_r23 12*REGWIDTH
#define JMP_r24 13*REGWIDTH
#define JMP_r25 14*REGWIDTH
#define JMP_r26 15*REGWIDTH
#define JMP_r27 16*REGWIDTH
#define JMP_r28 17*REGWIDTH
#define JMP_r29 18*REGWIDTH
#define JMP_r30 19*REGWIDTH
#define JMP_r31 20*REGWIDTH
#define JMP_lr 21*REGWIDTH
#define JMP_cr 22*REGWIDTH
#define JMP_ctr 23*REGWIDTH
#define JMP_xer 24*REGWIDTH
#ifdef __powerpc64__
#ifdef PPC64_ELF_ABI_v2
#define ENTRY(name) \
.align 2 ; \
.type name,@function; \
.weak name; \
name:
#else /* PPC64_ELF_ABI_v1 */
#define XGLUE(a,b) a##b
#define GLUE(a,b) XGLUE(a,b)
#define ENTRY(name) \
.align 2 ; \
.weak name; \
.weak GLUE(.,name); \
.pushsection ".opd","aw"; \
name: \
.quad GLUE(.,name); \
.quad .TOC.@tocbase; \
.quad 0; \
.popsection; \
.type GLUE(.,name),@function; \
GLUE(.,name):
#endif /* PPC64_ELF_ABI_v2 */
#else /* 32-bit */
#define ENTRY(name) \
.text; \
.p2align 4; \
.weak name; \
.type name,@function; \
name:
#endif /* __powerpc64__ */
ENTRY(SETJMP)
ST_REG 31, JMP_r31(3)
/* r1, r2, r14-r30 */
ST_REG 1, JMP_r1 (3)
ST_REG 2, JMP_r2 (3)
ST_REG 14, JMP_r14(3)
ST_REG 15, JMP_r15(3)
ST_REG 16, JMP_r16(3)
ST_REG 17, JMP_r17(3)
ST_REG 18, JMP_r18(3)
ST_REG 19, JMP_r19(3)
ST_REG 20, JMP_r20(3)
ST_REG 21, JMP_r21(3)
ST_REG 22, JMP_r22(3)
ST_REG 23, JMP_r23(3)
ST_REG 24, JMP_r24(3)
ST_REG 25, JMP_r25(3)
ST_REG 26, JMP_r26(3)
ST_REG 27, JMP_r27(3)
ST_REG 28, JMP_r28(3)
ST_REG 29, JMP_r29(3)
ST_REG 30, JMP_r30(3)
/* cr, lr, ctr, xer */
mfcr 0
ST_REG 0, JMP_cr(3)
mflr 0
ST_REG 0, JMP_lr(3)
mfctr 0
ST_REG 0, JMP_ctr(3)
mfxer 0
ST_REG 0, JMP_xer(3)
/* f14-f31, fpscr */
li 3, 0
blr
ENTRY(LONGJMP)
LD_REG 31, JMP_r31(3)
/* r1, r2, r14-r30 */
LD_REG 1, JMP_r1 (3)
LD_REG 2, JMP_r2 (3)
LD_REG 14, JMP_r14(3)
LD_REG 15, JMP_r15(3)
LD_REG 16, JMP_r16(3)
LD_REG 17, JMP_r17(3)
LD_REG 18, JMP_r18(3)
LD_REG 19, JMP_r19(3)
LD_REG 20, JMP_r20(3)
LD_REG 21, JMP_r21(3)
LD_REG 22, JMP_r22(3)
LD_REG 23, JMP_r23(3)
LD_REG 24, JMP_r24(3)
LD_REG 25, JMP_r25(3)
LD_REG 26, JMP_r26(3)
LD_REG 27, JMP_r27(3)
LD_REG 28, JMP_r28(3)
LD_REG 29, JMP_r29(3)
LD_REG 30, JMP_r30(3)
/* cr, lr, ctr, xer */
LD_REG 0, JMP_cr(3)
mtcr 0
LD_REG 0, JMP_lr(3)
mtlr 0
LD_REG 0, JMP_ctr(3)
mtctr 0
LD_REG 0, JMP_xer(3)
mtxer 0
/* f14-f31, fpscr */
mr 3, 4
blr
#ifdef __ELF__
.section .note.GNU-stack,"",%progbits
#endif
|
acl-dev/acl
| 2,919
|
lib_fiber/c/src/fiber/exp/setjmp_sparc64.S
|
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* 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
* SUCH DAMAGE.
*
* $Header: _setjmp.s,v 1.1 91/07/06 16:45:53 torek Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
.asciz "@(#)_setjmp.s 8.1 (Berkeley) 6/4/93"
#else
RCSID("$NetBSD: _setjmp.S,v 1.4 1998/10/08 02:27:59 eeh Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
#define _JB_FP 0x0
#define _JB_PC 0x8
#define _JB_SP 0x10
.register %g2,#ignore
.register %g3,#ignore
#define ENTRY(x) \
.text ; \
.align 32 ; \
.globl x ; \
.type x,@function ; \
x:
#define END(x) \
.size x, . - x
/*
* C library -- setjmp, longjmp
*
* longjmp(a,v)
* will generate a "return(v?v:1)" from
* the last call to
* setjmp(a)
* by restoring the previous context.
*/
ENTRY(SETJMP)
stx %sp, [%o0 + _JB_SP]
stx %o7, [%o0 + _JB_PC]
stx %fp, [%o0 + _JB_FP]
retl
clr %o0
END(SETJMP)
ENTRY(LONGJMP)
mov 1, %g1
movrnz %o1, %o1, %g1
mov %o0, %g2
ldx [%g2 + _JB_FP], %g3
1: cmp %fp, %g3
bl,a 1b
restore
be,a 2f
ldx [%g2 + _JB_SP], %o0
.Lbotch:
illtrap
2: cmp %o0, %sp
bge,a 3f
mov %o0, %sp
b,a .Lbotch
nop
3: ldx [%g2 + _JB_PC], %o7
retl
mov %g1, %o0
END(LONGJMP)
#ifdef __ELF__
.section .note.GNU-stack,"",%progbits
#endif
|
acl-dev/acl
| 2,428
|
lib_fiber/c/src/fiber/exp/setjmp_aarch64.S
|
/*-
* Copyright (c) 2014 Andrew Turner
* Copyright (c) 2014-2015 The FreeBSD Foundation
* All rights reserved.
*
* Portions of this software were developed by Andrew Turner
* under sponsorship from the FreeBSD Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* 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
* SUCH DAMAGE.
*
*/
#ifdef __aarch64__
#define ENTRY(sym) \
.text; \
.globl sym; \
.align 2; \
.type sym,#function; \
sym:
#define END(sym) \
.size sym, . - sym
ENTRY(SETJMP)
/* Store the stack pointer */
mov x8, sp
str x8, [x0], #8
/* Store the general purpose registers and lr */
stp x19, x20, [x0], #16
stp x21, x22, [x0], #16
stp x23, x24, [x0], #16
stp x25, x26, [x0], #16
stp x27, x28, [x0], #16
stp x29, x30, [x0], #16
/* Return value */
mov x0, #0
ret
END(SETJMP)
ENTRY(LONGJMP)
/* Restore the stack pointer */
ldr x8, [x0], #8
mov sp, x8
/* Restore the general purpose registers and lr */
ldp x19, x20, [x0], #16
ldp x21, x22, [x0], #16
ldp x23, x24, [x0], #16
ldp x25, x26, [x0], #16
ldp x27, x28, [x0], #16
ldp x29, x30, [x0], #16
/* Load the return value */
mov x0, x1
ret
END(LONGJMP)
#ifdef __ELF__
.section .note.GNU-stack,"",%progbits
#endif
#endif /* __aarch64__ */
|
acl-dev/acl
| 3,538
|
lib_fiber/c/src/fiber/exp/setjmp_mips.S
|
/*
* Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
* The President and Fellows of Harvard College.
* Copyright (c) 2017 MIPS Technologies, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* 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
* SUCH DAMAGE.
*/
#include <asm/asm.h>
#include <asm/regdef.h>
/*
* setjmp and longjmp for MIPS.
*/
.text
.set noreorder
/*
* int setjmp(jmp_buf jb);
*
* Save the current state so we can return again from the call later
* if/when longjmp is called. (If the function that called setjmp
* returns before longjmp is called, the results are undefined. We
* only need to save registers, not the whole contents of the stack.)
*/
LEAF(SETJMP)
/*
* jmp_buf is in a0. We need to save s0-s8, sp, gp, and ra in it.
* Don't store more registers without adjusting machine/setjmp.h.
*/
REG_S sp, 0(a0) /* save registers */
REG_S ra, 1*SZREG(a0)
REG_S gp, 2*SZREG(a0)
REG_S s0, 3*SZREG(a0)
REG_S s1, 4*SZREG(a0)
REG_S s2, 5*SZREG(a0)
REG_S s3, 6*SZREG(a0)
REG_S s4, 7*SZREG(a0)
REG_S s5, 8*SZREG(a0)
REG_S s6, 9*SZREG(a0)
REG_S s7, 10*SZREG(a0)
REG_S s8, 11*SZREG(a0)
jr ra /* done */
move v0, zero /* return 0 (in delay slot) */
END(SETJMP)
/*
* void longjmp(jmp_buf jb, int code);
*/
LEAF(LONGJMP)
/*
* jmp_buf is in a0. Return code is in a1.
* We need to restore s0-s8, sp, gp, and ra from the jmp_buf.
* The return code is forced to 1 if 0 is passed in.
*/
sltiu t0, a1, 1 /* set t0 to 1 if return code is 0... otherwise 0 */
addu a1, a1, t0 /* update the return code */
REG_L sp, 0(a0) /* restore registers */
REG_L ra, 1*SZREG(a0)
REG_L gp, 2*SZREG(a0)
REG_L s0, 3*SZREG(a0)
REG_L s1, 4*SZREG(a0)
REG_L s2, 5*SZREG(a0)
REG_L s3, 6*SZREG(a0)
REG_L s4, 7*SZREG(a0)
REG_L s5, 8*SZREG(a0)
REG_L s6, 9*SZREG(a0)
REG_L s7, 10*SZREG(a0)
REG_L s8, 11*SZREG(a0)
jr ra /* return, to where setjmp was called from */
move v0, a1 /* set return value */
END(LONGJMP)
#ifdef __ELF__
.section .note.GNU-stack,"",%progbits
#endif
|
acl-dev/acl
| 2,313
|
lib_fiber/c/src/fiber/exp/setjmp_arm.S
|
/*-
* Copyright 2004-2014 Olivier Houchard <cognet@FreeBSD.org>
* Copyright 2012-2014 Ian Lepore <ian@FreeBSD.org>
* Copyright 2013-2014 Andrew Turner <andrew@FreeBSD.org>
* Copyright 2014 Svatopluk Kraus <onwahe@gmail.com>
* Copyright 2014 Michal Meloun <meloun@miracle.cz>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* 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
* SUCH DAMAGE.
*/
#if defined(__arm__) && !defined(__aarch64__)
#if defined(__thumb2__)
#define _FUNC_MODE .code 16; .thumb_func
#else
#define _FUNC_MODE .code 32
#endif
#define ENTRY(x) \
.text; \
.syntax unified; \
.align 2; \
.global x; \
.type x,#function; \
_FUNC_MODE; \
x:
#define END(x) \
.size x, . - x;
#define RET bx lr
/*
* setjump + longjmp
*/
ENTRY(SETJMP)
#if defined(__thumb2__)
mov ip, sp
stmia r0, {r4-r12,r14}
#else
stmia r0, {r4-r14}
#endif
mov r0, #0x00000000
RET
END(SETJMP)
ENTRY(LONGJMP)
#if defined(__thumb2__)
ldmia r0, {r4-r12,r14}
mov sp, ip
#else
ldmia r0, {r4-r14}
#endif
mov r0, #0x00000001
RET
END(LONGJMP)
#ifdef __ELF__
.section .note.GNU-stack,"",%progbits
#endif
#endif
|
acl-dev/acl
| 6,312
|
lib_fiber/c/src/fiber/boost/ontop_ppc32_sysv_elf_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
* ------------------------------------------------- *
* |bchai|hiddn| fpscr | PC | CR | R14 | R15 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
* ------------------------------------------------- *
* | R16 | R17 | R18 | R19 | R20 | R21 | R22 | R23 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
* ------------------------------------------------- *
* | R24 | R25 | R26 | R27 | R28 | R29 | R30 | R31 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | F14 | F15 | F16 | F17 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | F18 | F19 | F20 | F21 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
* ------------------------------------------------- *
* | F22 | F23 | F24 | F25 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
* ------------------------------------------------- *
* | F26 | F27 | F28 | F29 | *
* ------------------------------------------------- *
* ------------------------|------------ *
* | 224 | 228 | 232 | 236 | 240 | 244 | *
* ------------------------|------------ *
* | F30 | F31 |bchai| LR | *
* ------------------------|------------ *
* *
*******************************************************/
.file "ontop_ppc32_sysv_elf_gas.S"
.text
.globl ontop_fcontext
.align 2
.type ontop_fcontext,@function
ontop_fcontext:
# Linux: ontop_fcontext( hidden transfer_t * R3, R4, R5, R6)
# Other: transfer_t R3:R4 = jump_fcontext( R3, R4, R5)
mflr %r0 # return address from LR
mffs %f0 # FPSCR
mfcr %r8 # condition register
stwu %r1, -240(%r1) # allocate stack space, R1 % 16 == 0
stw %r0, 244(%r1) # save LR in caller's frame
#ifdef __linux__
stw %r3, 4(%r1) # hidden pointer
#endif
stfd %f0, 8(%r1) # FPSCR
stw %r0, 16(%r1) # LR as PC
stw %r8, 20(%r1) # CR
# Save registers R14 to R31.
# Don't change R2, the thread-local storage pointer.
# Don't change R13, the small data pointer.
stw %r14, 24(%r1)
stw %r15, 28(%r1)
stw %r16, 32(%r1)
stw %r17, 36(%r1)
stw %r18, 40(%r1)
stw %r19, 44(%r1)
stw %r20, 48(%r1)
stw %r21, 52(%r1)
stw %r22, 56(%r1)
stw %r23, 60(%r1)
stw %r24, 64(%r1)
stw %r25, 68(%r1)
stw %r26, 72(%r1)
stw %r27, 76(%r1)
stw %r28, 80(%r1)
stw %r29, 84(%r1)
stw %r30, 88(%r1)
stw %r31, 92(%r1)
# Save registers F14 to F31 in slots with 8-byte alignment.
# 4-byte alignment may stall the pipeline of some processors.
# Less than 4 may cause alignment traps.
stfd %f14, 96(%r1)
stfd %f15, 104(%r1)
stfd %f16, 112(%r1)
stfd %f17, 120(%r1)
stfd %f18, 128(%r1)
stfd %f19, 136(%r1)
stfd %f20, 144(%r1)
stfd %f21, 152(%r1)
stfd %f22, 160(%r1)
stfd %f23, 168(%r1)
stfd %f24, 176(%r1)
stfd %f25, 184(%r1)
stfd %f26, 192(%r1)
stfd %f27, 200(%r1)
stfd %f28, 208(%r1)
stfd %f29, 216(%r1)
stfd %f30, 224(%r1)
stfd %f31, 232(%r1)
# store RSP (pointing to context-data) in R7/R6
# restore RSP (pointing to context-data) from R4/R3
#ifdef __linux__
mr %r7, %r1
mr %r1, %r4
lwz %r3, 4(%r1) # hidden pointer
#else
mr %r6, %r1
mr %r1, %r3
#endif
# ignore PC at 16(%r1)
lfd %f0, 8(%r1) # FPSCR
lwz %r8, 20(%r1) # CR
mtfsf 0xff, %f0 # restore FPSCR
mtcr %r8 # restore CR
# restore R14 to R31
lwz %r14, 24(%r1)
lwz %r15, 28(%r1)
lwz %r16, 32(%r1)
lwz %r17, 36(%r1)
lwz %r18, 40(%r1)
lwz %r19, 44(%r1)
lwz %r20, 48(%r1)
lwz %r21, 52(%r1)
lwz %r22, 56(%r1)
lwz %r23, 60(%r1)
lwz %r24, 64(%r1)
lwz %r25, 68(%r1)
lwz %r26, 72(%r1)
lwz %r27, 76(%r1)
lwz %r28, 80(%r1)
lwz %r29, 84(%r1)
lwz %r30, 88(%r1)
lwz %r31, 92(%r1)
# restore F14 to F31
lfd %f14, 96(%r1)
lfd %f15, 104(%r1)
lfd %f16, 112(%r1)
lfd %f17, 120(%r1)
lfd %f18, 128(%r1)
lfd %f19, 136(%r1)
lfd %f20, 144(%r1)
lfd %f21, 152(%r1)
lfd %f22, 160(%r1)
lfd %f23, 168(%r1)
lfd %f24, 176(%r1)
lfd %f25, 184(%r1)
lfd %f26, 192(%r1)
lfd %f27, 200(%r1)
lfd %f28, 208(%r1)
lfd %f29, 216(%r1)
lfd %f30, 224(%r1)
lfd %f31, 232(%r1)
# restore LR from caller's frame
lwz %r0, 244(%r1)
mtlr %r0
# adjust stack
addi %r1, %r1, 240
# see tail_ppc32_sysv_elf_gas.cpp
# Linux: fcontext_ontop_tail( hidden transfer_t * R3, R4, R5, R6, R7)
# Other: transfer_t R3:R4 = fcontext_ontop_tail( R3, R4, R5, R6)
b ontop_fcontext_tail
.size ontop_fcontext, .-ontop_fcontext
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 3,177
|
lib_fiber/c/src/fiber/boost/ontop_arm_aapcs_elf_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | s24 | s25 | s26 | s27 | s28 | s29 | s30 | s31 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
* ------------------------------------------------- *
* |hiddn| v1 | v2 | v3 | v4 | v5 | v6 | v7 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
* ------------------------------------------------- *
* | v8 | lr | pc | FCTX| DATA| | *
* ------------------------------------------------- *
* *
*******************************************************/
.file "ontop_arm_aapcs_elf_gas.S"
.text
.globl ontop_fcontext
.align 2
.type ontop_fcontext,%function
.syntax unified
ontop_fcontext:
@ save LR as PC
push {lr}
@ save hidden,V1-V8,LR
push {a1,v1-v8,lr}
@ prepare stack for FPU
sub sp, sp, #64
#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
@ save S16-S31
vstmia sp, {d8-d15}
#endif
@ store RSP (pointing to context-data) in A1
mov a1, sp
@ restore RSP (pointing to context-data) from A2
mov sp, a2
@ store parent context in A2
mov a2, a1
#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
@ restore S16-S31
vldmia sp, {d8-d15}
#endif
@ prepare stack for FPU
add sp, sp, #64
@ restore hidden,V1-V8,LR
pop {a1,v1-v8,lr}
@ return transfer_t from jump
str a2, [a1, #0]
str a3, [a1, #4]
@ pass transfer_t as first arg in context function
@ A1 == hidden, A2 == FCTX, A3 == DATA
@ skip PC
add sp, sp, #4
@ jump to ontop-function
bx a4
.size ontop_fcontext,.-ontop_fcontext
@ Mark that we don't need executable stack.
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 2,783
|
lib_fiber/c/src/fiber/boost/make_arm_aapcs_macho_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | s24 | s25 | s26 | s27 | s28 | s29 | s30 | s31 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | sjlj|hiddn| v1 | v2 | v3 | v4 | v5 | v6 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | v7 | v8 | lr | pc | FCTX| DATA| | *
* ------------------------------------------------- *
* *
*******************************************************/
.text
.globl _make_fcontext
.align 2
_make_fcontext:
@ shift address in A1 to lower 16 byte boundary
bic a1, a1, #15
@ reserve space for context-data on context-stack
sub a1, a1, #124
@ third arg of make_fcontext() == address of context-function
str a3, [a1, #108]
@ compute address of returned transfer_t
add a2, a1, #112
mov a3, a2
str a3, [a1, #68]
@ compute abs address of label finish
adr a2, finish
@ save address of finish as return-address for context-function
@ will be entered after context-function returns
str a2, [a1, #104]
bx lr @ return pointer to context-data
finish:
@ exit code is zero
mov a1, #0
@ exit application
bl __exit
|
acl-dev/acl
| 1,930
|
lib_fiber/c/src/fiber/boost/ontop_ppc64_sysv_xcoff_gas.S
|
.align 2
.globl .ontop_fcontext
.ontop_fcontext:
# reserve space on stack
subi 1, 1, 184
std 13, 0(1) # save R13
std 14, 8(1) # save R14
std 15, 16(1) # save R15
std 16, 24(1) # save R16
std 17, 32(1) # save R17
std 18, 40(1) # save R18
std 19, 48(1) # save R19
std 20, 56(1) # save R20
std 21, 64(1) # save R21
std 22, 72(1) # save R22
std 23, 80(1) # save R23
std 24, 88(1) # save R24
std 25, 96(1) # save R25
std 26, 104(1) # save R26
std 27, 112(1) # save R27
std 29, 120(1) # save R28
std 29, 128(1) # save R29
std 30, 136(1) # save R30
std 31, 144(1) # save R31
std 3, 152(1) # save hidden
# save CR
mfcr 0
std 0, 160(1)
# save LR
mflr 0
std 0, 168(1)
# save LR as PC
std 0, 176(1)
# store RSP (pointing to context-data) in R7
mr 7, 1
# restore RSP (pointing to context-data) from R4
mr 1, 4
ld 13, 0(1) # restore R13
ld 14, 8(1) # restore R14
ld 15, 16(1) # restore R15
ld 16, 24(1) # restore R16
ld 17, 32(1) # restore R17
ld 18, 40(1) # restore R18
ld 19, 48(1) # restore R19
ld 20, 56(1) # restore R20
ld 21, 64(1) # restore R21
ld 22, 72(1) # restore R22
ld 23, 80(1) # restore R23
ld 24, 88(1) # restore R24
ld 25, 96(1) # restore R25
ld 26, 104(1) # restore R26
ld 27, 112(1) # restore R27
ld 28, 120(1) # restore R28
ld 29, 128(1) # restore R29
ld 30, 136(1) # restore R30
ld 31, 144(1) # restore R31
ld 4, 152(1) # restore hidden
# restore CR
ld 0, 160(1)
mtcr 0
# restore LR
ld 0, 168(1)
mtlr 0
# ignore PC
# adjust stack
addi 1, 1, 184
# return transfer_t
std 7, 0(4)
std 5, 8(4)
# restore CTR
mtctr 6
# jump to context
bctr
|
acl-dev/acl
| 3,283
|
lib_fiber/c/src/fiber/boost/ontop_arm_aapcs_macho_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | s24 | s25 | s26 | s27 | s28 | s29 | s30 | s31 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | sjlj|hiddn| v1 | v2 | v3 | v4 | v5 | v6 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | v7 | v8 | lr | pc | FCTX| DATA| | *
* ------------------------------------------------- *
* *
*******************************************************/
.text
.globl _ontop_fcontext
.align 2
_ontop_fcontext:
@ save LR as PC
push {lr}
@ save hidden,V1-V8,LR
push {a1,v1-v8,lr}
@ locate TLS to save/restore SjLj handler
mrc p15, 0, v2, c13, c0, #3
bic v2, v2, #3
@ load TLS[__PTK_LIBC_DYLD_Unwind_SjLj_Key]
ldr v1, [v2, #8]
@ save SjLj handler
push {v1}
@ prepare stack for FPU
sub sp, sp, #64
#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
@ save S16-S31
vstmia sp, {d8-d15}
#endif
@ store RSP (pointing to context-data) in A1
mov a1, sp
@ restore RSP (pointing to context-data) from A2
mov sp, a2
#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
@ restore S16-S31
vldmia sp, {d8-d15}
#endif
@ prepare stack for FPU
add sp, sp, #64
@ restore SjLj handler
pop {v1}
@ store SjLj handler in TLS
str v1, [v2, #8]
@ store parent context in A2
mov a2, a1
@ restore hidden,V1-V8,LR
pop {a1,v1-v8,lr}
@ return transfer_t from jump
str a2, [a1, #0]
str a3, [a1, #4]
@ pass transfer_t as first arg in context function
@ A1 == hidden, A2 == FCTX, A3 == DATA
@ skip PC
add sp, sp, #4
@ jump to ontop-function
bx a4
|
acl-dev/acl
| 3,421
|
lib_fiber/c/src/fiber/boost/make_x86_64_sysv_elf_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/****************************************************************************************
* *
* ---------------------------------------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ---------------------------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
* ---------------------------------------------------------------------------------- *
* | fc_mxcsr|fc_x87_cw| R12 | R13 | R14 | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ---------------------------------------------------------------------------------- *
* | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
* ---------------------------------------------------------------------------------- *
* | R15 | RBX | RBP | RIP | *
* ---------------------------------------------------------------------------------- *
* *
****************************************************************************************/
.file "make_x86_64_sysv_elf_gas.S"
.text
.globl make_fcontext
.type make_fcontext,@function
.align 16
make_fcontext:
/* first arg of make_fcontext() == top of context-stack */
movq %rdi, %rax
/* shift address in RAX to lower 16 byte boundary */
andq $-16, %rax
/* reserve space for context-data on context-stack */
/* on context-function entry: (RSP -0x8) % 16 == 0 */
leaq -0x40(%rax), %rax
/* third arg of make_fcontext() == address of context-function */
/* stored in RBX */
movq %rdx, 0x28(%rax)
/* save MMX control- and status-word */
stmxcsr (%rax)
/* save x87 control-word */
fnstcw 0x4(%rax)
/* compute abs address of label trampoline */
leaq trampoline(%rip), %rcx
/* save address of trampoline as return-address for context-function */
/* will be entered after calling jump_fcontext() first time */
movq %rcx, 0x38(%rax)
/* compute abs address of label finish */
leaq finish(%rip), %rcx
/* save address of finish as return-address for context-function */
/* will be entered after context-function returns */
movq %rcx, 0x30(%rax)
ret /* return pointer to context-data */
trampoline:
/* store return address on stack */
/* fix stack alignment */
push %rbp
/* jump to context-function */
jmp *%rbx
finish:
/* exit code is zero */
xorq %rdi, %rdi
/* exit application */
call _exit@PLT
hlt
.size make_fcontext,.-make_fcontext
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 7,783
|
lib_fiber/c/src/fiber/boost/ontop_ppc64_sysv_elf_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
* ------------------------------------------------- *
* | TOC | R14 | R15 | R16 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
* ------------------------------------------------- *
* | R17 | R18 | R19 | R20 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
* ------------------------------------------------- *
* | R21 | R22 | R23 | R24 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | R25 | R26 | R27 | R28 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | R29 | R30 | R31 | hidden | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
* ------------------------------------------------- *
* | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
* ------------------------------------------------- *
* | CR | LR | PC | back-chain| *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
* ------------------------------------------------- *
* | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
* ------------------------------------------------- *
* | cr saved | lr saved | compiler | linker | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
* ------------------------------------------------- *
* | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
* ------------------------------------------------- *
* | TOC saved | FCTX | DATA | | *
* ------------------------------------------------- *
* *
*******************************************************/
.file "ontop_ppc64_sysv_elf_gas.S"
.globl ontop_fcontext
#if _CALL_ELF == 2
.text
.align 2
ontop_fcontext:
addis %r2, %r12, .TOC.-ontop_fcontext@ha
addi %r2, %r2, .TOC.-ontop_fcontext@l
.localentry ontop_fcontext, . - ontop_fcontext
#else
.section ".opd","aw"
.align 3
ontop_fcontext:
# ifdef _CALL_LINUX
.quad .L.ontop_fcontext,.TOC.@tocbase,0
.type ontop_fcontext,@function
.text
.align 2
.L.ontop_fcontext:
# else
.hidden .ontop_fcontext
.globl .ontop_fcontext
.quad .ontop_fcontext,.TOC.@tocbase,0
.size ontop_fcontext,24
.type .ontop_fcontext,@function
.text
.align 2
.ontop_fcontext:
# endif
#endif
# reserve space on stack
subi %r1, %r1, 184
#if _CALL_ELF != 2
std %r2, 0(%r1) # save TOC
#endif
std %r14, 8(%r1) # save R14
std %r15, 16(%r1) # save R15
std %r16, 24(%r1) # save R16
std %r17, 32(%r1) # save R17
std %r18, 40(%r1) # save R18
std %r19, 48(%r1) # save R19
std %r20, 56(%r1) # save R20
std %r21, 64(%r1) # save R21
std %r22, 72(%r1) # save R22
std %r23, 80(%r1) # save R23
std %r24, 88(%r1) # save R24
std %r25, 96(%r1) # save R25
std %r26, 104(%r1) # save R26
std %r27, 112(%r1) # save R27
std %r28, 120(%r1) # save R28
std %r29, 128(%r1) # save R29
std %r30, 136(%r1) # save R30
std %r31, 144(%r1) # save R31
#if _CALL_ELF != 2
std %r3, 152(%r1) # save hidden
#endif
# save CR
mfcr %r0
std %r0, 160(%r1)
# save LR
mflr %r0
std %r0, 168(%r1)
# save LR as PC
std %r0, 176(%r1)
# store RSP (pointing to context-data) in R7
mr %r7, %r1
#if _CALL_ELF == 2
# restore RSP (pointing to context-data) from R3
mr %r1, %r3
#else
# restore RSP (pointing to context-data) from R4
mr %r1, %r4
#endif
ld %r14, 8(%r1) # restore R14
ld %r15, 16(%r1) # restore R15
ld %r16, 24(%r1) # restore R16
ld %r17, 32(%r1) # restore R17
ld %r18, 40(%r1) # restore R18
ld %r19, 48(%r1) # restore R19
ld %r20, 56(%r1) # restore R20
ld %r21, 64(%r1) # restore R21
ld %r22, 72(%r1) # restore R22
ld %r23, 80(%r1) # restore R23
ld %r24, 88(%r1) # restore R24
ld %r25, 96(%r1) # restore R25
ld %r26, 104(%r1) # restore R26
ld %r27, 112(%r1) # restore R27
ld %r28, 120(%r1) # restore R28
ld %r29, 128(%r1) # restore R29
ld %r30, 136(%r1) # restore R30
ld %r31, 144(%r1) # restore R31
#if _CALL_ELF != 2
ld %r3, 152(%r1) # restore hidden
#endif
# restore CR
ld %r0, 160(%r1)
mtcr %r0
#if _CALL_ELF == 2
# restore CTR
mtctr %r5
# store cb entrypoint in %r12, used for TOC calculation
mr %r12, %r5
# copy transfer_t into ontop_fn arg registers
mr %r3, %r7
# arg pointer already in %r4
#else
# copy transfer_t into ontop_fn arg registers
mr %r4, %r7
# arg pointer already in %r5
# hidden arg already in %r3
# restore CTR
ld %r7, 0(%r6)
mtctr %r7
# restore TOC
ld %r2, 8(%r6)
# zero in r3 indicates first jump to context-function
cmpdi %r3, 0
beq use_entry_arg
#endif
return_to_ctx:
# restore LR
ld %r0, 168(%r1)
mtlr %r0
# adjust stack
addi %r1, %r1, 184
# jump to context
bctr
#if _CALL_ELF == 2
.size ontop_fcontext, .-ontop_fcontext
#else
use_entry_arg:
# compute return-value struct address
# (passed has hidden arg to ontop_fn)
addi %r3, %r1, 8
# jump to context and update LR
bctrl
# restore CTR
ld %r7, 176(%r1)
mtctr %r7
#if _CALL_ELF != 2
# restore TOC
ld %r2, 0(%r1)
#endif
# copy returned transfer_t into entry_fn arg registers
ld %r3, 8(%r1)
ld %r4, 16(%r1)
b return_to_ctx
# ifdef _CALL_LINUX
.size .ontop_fcontext, .-.L.ontop_fcontext
# else
.size .ontop_fcontext, .-.ontop_fcontext
# endif
#endif
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 7,558
|
lib_fiber/c/src/fiber/boost/jump_ppc32_sysv_macho_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
* ------------------------------------------------- *
* | F14 | F15 | F16 | F17 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
* ------------------------------------------------- *
* | F18 | F19 | F20 | F21 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
* ------------------------------------------------- *
* | F22 | F23 | F24 | F25 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | F26 | F27 | F28 | F29 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | F30 | F31 | fpscr | R13 | R14 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
* ------------------------------------------------- *
* | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
* ------------------------------------------------- *
* | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
* ------------------------------------------------- *
* | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
* ------------------------------------------------- *
* | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
* ------------------------------------------------- *
* | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
* ------------------------------------------------- *
* | R31 |hiddn| CR | LR | PC |bchai|linkr| FCTX| *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 64 | | *
* ------------------------------------------------- *
* | 256 | | *
* ------------------------------------------------- *
* | DATA| | *
* ------------------------------------------------- *
* *
*******************************************************/
.text
.globl _jump_fcontext
.align 2
_jump_fcontext:
; reserve space on stack
subi r1, r1, 244
stfd f14, 0(r1) # save F14
stfd f15, 8(r1) # save F15
stfd f16, 16(r1) # save F16
stfd f17, 24(r1) # save F17
stfd f18, 32(r1) # save F18
stfd f19, 40(r1) # save F19
stfd f20, 48(r1) # save F20
stfd f21, 56(r1) # save F21
stfd f22, 64(r1) # save F22
stfd f23, 72(r1) # save F23
stfd f24, 80(r1) # save F24
stfd f25, 88(r1) # save F25
stfd f26, 96(r1) # save F26
stfd f27, 104(r1) # save F27
stfd f28, 112(r1) # save F28
stfd f29, 120(r1) # save F29
stfd f30, 128(r1) # save F30
stfd f31, 136(r1) # save F31
mffs f0 # load FPSCR
stfd f0, 144(r1) # save FPSCR
stw r13, 152(r1) # save R13
stw r14, 156(r1) # save R14
stw r15, 160(r1) # save R15
stw r16, 164(r1) # save R16
stw r17, 168(r1) # save R17
stw r18, 172(r1) # save R18
stw r19, 176(r1) # save R19
stw r20, 180(r1) # save R20
stw r21, 184(r1) # save R21
stw r22, 188(r1) # save R22
stw r23, 192(r1) # save R23
stw r24, 196(r1) # save R24
stw r25, 200(r1) # save R25
stw r26, 204(r1) # save R26
stw r27, 208(r1) # save R27
stw r28, 212(r1) # save R28
stw r29, 216(r1) # save R29
stw r30, 220(r1) # save R30
stw r31, 224(r1) # save R31
stw r3, 228(r1) # save hidden
# save CR
mfcr r0
stw r0, 232(r1)
# save LR
mflr r0
stw r0, 236(r1)
# save LR as PC
stw r0, 240(r1)
# store RSP (pointing to context-data) in R6
mr r6, r1
# restore RSP (pointing to context-data) from R4
mr r1, r4
lfd f14, 0(r1) # restore F14
lfd f15, 8(r1) # restore F15
lfd f16, 16(r1) # restore F16
lfd f17, 24(r1) # restore F17
lfd f18, 32(r1) # restore F18
lfd f19, 40(r1) # restore F19
lfd f20, 48(r1) # restore F20
lfd f21, 56(r1) # restore F21
lfd f22, 64(r1) # restore F22
lfd f23, 72(r1) # restore F23
lfd f24, 80(r1) # restore F24
lfd f25, 88(r1) # restore F25
lfd f26, 96(r1) # restore F26
lfd f27, 104(r1) # restore F27
lfd f28, 112(r1) # restore F28
lfd f29, 120(r1) # restore F29
lfd f30, 128(r1) # restore F30
lfd f31, 136(r1) # restore F31
lfd f0, 144(r1) # load FPSCR
mtfsf 0xff, f0 # restore FPSCR
lwz r13, 152(r1) # restore R13
lwz r14, 156(r1) # restore R14
lwz r15, 160(r1) # restore R15
lwz r16, 164(r1) # restore R16
lwz r17, 168(r1) # restore R17
lwz r18, 172(r1) # restore R18
lwz r19, 176(r1) # restore R19
lwz r20, 180(r1) # restore R20
lwz r21, 184(r1) # restore R21
lwz r22, 188(r1) # restore R22
lwz r23, 192(r1) # restore R23
lwz r24, 196(r1) # restore R24
lwz r25, 200(r1) # restore R25
lwz r26, 204(r1) # restore R26
lwz r27, 208(r1) # restore R27
lwz r28, 212(r1) # restore R28
lwz r29, 216(r1) # restore R29
lwz r30, 220(r1) # restore R30
lwz r31, 224(r1) # restore R31
lwz r3, 228(r1) # restore hidden
# restore CR
lwz r0, 232(r1)
mtcr r0
# restore LR
lwz r0, 236(r1)
mtlr r0
# load PC
lwz r0, 240(r1)
# restore CTR
mtctr r0
# adjust stack
addi r1, r1, 244
# return transfer_t
stw r6, 0(r3)
stw r5, 4(r3)
# jump to context
bctr
|
acl-dev/acl
| 1,065
|
lib_fiber/c/src/fiber/boost/make_gas.S
|
// Stub file for universal binary
#if defined(__APPLE__)
#include "make_combined_sysv_macho_gas.S"
#elif defined(_WIN32) || defined(__MINGW32__) || defined(__MINGW64__) || defined(__CYGWIN__) || defined(__MSYS__)
#if defined(__x86_64__)
#include "make_x86_64_ms_pe_gas.asm"
#elif defined(__i386__)
#include "make_i386_ms_pe_gas.asm"
#endif
#elif defined(__x86_64__)
#include "make_x86_64_sysv_elf_gas.S"
#elif defined(__i386__)
#include "make_i386_sysv_elf_gas.S"
#elif defined(__ppc64__)
#include "make_ppc64_sysv_elf_gas.S"
#elif defined(__ppc__)
#include "make_ppc32_sysv_elf_gas.S"
#elif defined(__aarch64__)
#include "make_arm64_aapcs_elf_gas.S"
#elif defined(__arm__)
#include "make_arm_aapcs_elf_gas.S"
#elif defined(__mips64)
#include "make_mips64_n64_elf_gas.S"
#elif defined(__mips__)
#include "make_mips32_o32_elf_gas.S"
#elif defined(__riscv)
#include "make_riscv64_sysv_elf_gas.S"
#elif defined(__s390x__)
#include "make_s390x_sysv_elf_gas.S"
#else
#error "No arch's"
#endif
|
acl-dev/acl
| 4,051
|
lib_fiber/c/src/fiber/boost/make_riscv64_sysv_elf_gas.S
|
/*
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | fs0 | fs1 | fs2 | fs3 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | fs4 | fs5 | fs6 | fs7 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
* ------------------------------------------------- *
* | fs8 | fs9 | fs10 | fs11 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
* ------------------------------------------------- *
* | s0 | s1 | s2 | s3 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
* ------------------------------------------------- *
* | s4 | s5 | s6 | s7 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
* ------------------------------------------------- *
* | 0xa0| 0xa4| 0xa8| 0xac| 0xb0| 0xb4| 0xb8| 0xbc| *
* ------------------------------------------------- *
* | s8 | s9 | s10 | s11 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 48 | 49 | 50 | 51 | | | | | *
* ------------------------------------------------- *
* | 0xc0| 0xc4| 0xc8| 0xcc| | | | | *
* ------------------------------------------------- *
* | ra | pc | | | *
* ------------------------------------------------- *
* *
*******************************************************/
.file "make_riscv64_sysv_elf_gas.S"
.text
.align 1
.global make_fcontext
.type make_fcontext, %function
make_fcontext:
# shift address in a0 (allocated stack) to lower 16 byte boundary
andi a0, a0, ~0xF
# reserve space for context-data on context-stack
addi a0, a0, -0xd0
# third arg of make_fcontext() == address of context-function
# store address as a PC to jump in
sd a2, 0xc8(a0)
# save address of finish as return-address for context-function
# will be entered after context-function returns (RA register)
lla a4, finish
sd a4, 0xc0(a0)
ret // return pointer to context-data (a0)
finish:
# exit code is zero
li a0, 0
# exit application
tail _exit@plt
.size make_fcontext,.-make_fcontext
# Mark that we don't need executable stack.
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 4,376
|
lib_fiber/c/src/fiber/boost/ontop_mips64_n64_elf_gas.S
|
/*
Copyright Jiaxun Yang 2018.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 8 | 16 | 24 | *
* ------------------------------------------------- *
* | F24 | F25 | F26 | F27 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 40 | 48 | 56 | *
* ------------------------------------------------- *
* | F28 | F29 | F30 | F31 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 72 | 80 | 88 | *
* ------------------------------------------------- *
* | S0 | S1 | S2 | S3 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | S4 | S5 | S6 | S7 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | FP | GP | RA | PC | *
* ------------------------------------------------- *
* *
* *****************************************************/
.file "ontop_mips64_n64_elf_gas.S"
.text
.globl ontop_fcontext
.align 3
.type ontop_fcontext,@function
.ent ontop_fcontext
ontop_fcontext:
# reserve space on stack
daddiu $sp, $sp, -160
sd $s0, 64($sp) # save S0
sd $s1, 72($sp) # save S1
sd $s2, 80($sp) # save S2
sd $s3, 88($sp) # save S3
sd $s4, 96($sp) # save S4
sd $s5, 104($sp) # save S5
sd $s6, 112($sp) # save S6
sd $s7, 120($sp) # save S7
sd $fp, 128($sp) # save FP
sd $ra, 144($sp) # save RA
sd $ra, 152($sp) # save RA as PC
s.d $f24, 0($sp) # save F24
s.d $f25, 8($sp) # save F25
s.d $f26, 16($sp) # save F26
s.d $f27, 24($sp) # save F27
s.d $f28, 32($sp) # save F28
s.d $f29, 40($sp) # save F29
s.d $f30, 48($sp) # save F30
s.d $f31, 56($sp) # save F31
# store SP (pointing to context-data) in t0
move $t0, $sp
# restore SP (pointing to context-data) from a0
move $sp, $a0
l.d $f24, 0($sp) # restore F24
l.d $f25, 8($sp) # restore F25
l.d $f26, 16($sp) # restore F26
l.d $f27, 24($sp) # restore F27
l.d $f28, 32($sp) # restore F28
l.d $f29, 40($sp) # restore F29
l.d $f30, 48($sp) # restore F30
l.d $f31, 56($sp) # restore F31
ld $s0, 64($sp) # restore S0
ld $s1, 72($sp) # restore S1
ld $s2, 80($sp) # restore S2
ld $s3, 88($sp) # restore S3
ld $s4, 96($sp) # restore S4
ld $s5, 104($sp) # restore S5
ld $s6, 112($sp) # restore S6
ld $s7, 120($sp) # restore S7
ld $fp, 128($sp) # restore FP
ld $ra, 144($sp) # restore RA
# load PC
move $t9, $a2
# adjust stack
daddiu $sp, $sp, 160
move $a0, $t0 # move param from t0 to a0 as param
# jump to context
jr $t9
.end ontop_fcontext
.size ontop_fcontext, .-ontop_fcontext
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 6,297
|
lib_fiber/c/src/fiber/boost/jump_ppc32_sysv_elf_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
* ------------------------------------------------- *
* |bchai|hiddn| fpscr | PC | CR | R14 | R15 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
* ------------------------------------------------- *
* | R16 | R17 | R18 | R19 | R20 | R21 | R22 | R23 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
* ------------------------------------------------- *
* | R24 | R25 | R26 | R27 | R28 | R29 | R30 | R31 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | F14 | F15 | F16 | F17 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | F18 | F19 | F20 | F21 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
* ------------------------------------------------- *
* | F22 | F23 | F24 | F25 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
* ------------------------------------------------- *
* | F26 | F27 | F28 | F29 | *
* ------------------------------------------------- *
* ------------------------|------------ *
* | 224 | 228 | 232 | 236 | 240 | 244 | *
* ------------------------|------------ *
* | F30 | F31 |bchai| LR | *
* ------------------------|------------ *
* *
*******************************************************/
.file "jump_ppc32_sysv_elf_gas.S"
.text
.globl jump_fcontext
.align 2
.type jump_fcontext,@function
jump_fcontext:
# Linux: jump_fcontext( hidden transfer_t * R3, R4, R5)
# Other: transfer_t R3:R4 = jump_fcontext( R3, R4)
mflr %r0 # return address from LR
mffs %f0 # FPSCR
mfcr %r8 # condition register
stwu %r1, -240(%r1) # allocate stack space, R1 % 16 == 0
stw %r0, 244(%r1) # save LR in caller's frame
#ifdef __linux__
stw %r3, 4(%r1) # hidden pointer
#endif
stfd %f0, 8(%r1) # FPSCR
stw %r0, 16(%r1) # LR as PC
stw %r8, 20(%r1) # CR
# Save registers R14 to R31.
# Don't change R2, the thread-local storage pointer.
# Don't change R13, the small data pointer.
stw %r14, 24(%r1)
stw %r15, 28(%r1)
stw %r16, 32(%r1)
stw %r17, 36(%r1)
stw %r18, 40(%r1)
stw %r19, 44(%r1)
stw %r20, 48(%r1)
stw %r21, 52(%r1)
stw %r22, 56(%r1)
stw %r23, 60(%r1)
stw %r24, 64(%r1)
stw %r25, 68(%r1)
stw %r26, 72(%r1)
stw %r27, 76(%r1)
stw %r28, 80(%r1)
stw %r29, 84(%r1)
stw %r30, 88(%r1)
stw %r31, 92(%r1)
# Save registers F14 to F31 in slots with 8-byte alignment.
# 4-byte alignment may stall the pipeline of some processors.
# Less than 4 may cause alignment traps.
stfd %f14, 96(%r1)
stfd %f15, 104(%r1)
stfd %f16, 112(%r1)
stfd %f17, 120(%r1)
stfd %f18, 128(%r1)
stfd %f19, 136(%r1)
stfd %f20, 144(%r1)
stfd %f21, 152(%r1)
stfd %f22, 160(%r1)
stfd %f23, 168(%r1)
stfd %f24, 176(%r1)
stfd %f25, 184(%r1)
stfd %f26, 192(%r1)
stfd %f27, 200(%r1)
stfd %f28, 208(%r1)
stfd %f29, 216(%r1)
stfd %f30, 224(%r1)
stfd %f31, 232(%r1)
# store RSP (pointing to context-data) in R7/R6
# restore RSP (pointing to context-data) from R4/R3
#ifdef __linux__
mr %r7, %r1
mr %r1, %r4
lwz %r3, 4(%r1) # hidden pointer
#else
mr %r6, %r1
mr %r1, %r3
#endif
lfd %f0, 8(%r1) # FPSCR
lwz %r0, 16(%r1) # PC
lwz %r8, 20(%r1) # CR
mtfsf 0xff, %f0 # restore FPSCR
mtctr %r0 # load CTR with PC
mtcr %r8 # restore CR
# restore R14 to R31
lwz %r14, 24(%r1)
lwz %r15, 28(%r1)
lwz %r16, 32(%r1)
lwz %r17, 36(%r1)
lwz %r18, 40(%r1)
lwz %r19, 44(%r1)
lwz %r20, 48(%r1)
lwz %r21, 52(%r1)
lwz %r22, 56(%r1)
lwz %r23, 60(%r1)
lwz %r24, 64(%r1)
lwz %r25, 68(%r1)
lwz %r26, 72(%r1)
lwz %r27, 76(%r1)
lwz %r28, 80(%r1)
lwz %r29, 84(%r1)
lwz %r30, 88(%r1)
lwz %r31, 92(%r1)
# restore F14 to F31
lfd %f14, 96(%r1)
lfd %f15, 104(%r1)
lfd %f16, 112(%r1)
lfd %f17, 120(%r1)
lfd %f18, 128(%r1)
lfd %f19, 136(%r1)
lfd %f20, 144(%r1)
lfd %f21, 152(%r1)
lfd %f22, 160(%r1)
lfd %f23, 168(%r1)
lfd %f24, 176(%r1)
lfd %f25, 184(%r1)
lfd %f26, 192(%r1)
lfd %f27, 200(%r1)
lfd %f28, 208(%r1)
lfd %f29, 216(%r1)
lfd %f30, 224(%r1)
lfd %f31, 232(%r1)
# restore LR from caller's frame
lwz %r0, 244(%r1)
mtlr %r0
# adjust stack
addi %r1, %r1, 240
# return transfer_t
#ifdef __linux__
stw %r7, 0(%r3)
stw %r5, 4(%r3)
#else
mr %r3, %r6
# %r4, %r4
#endif
# jump to context
bctr
.size jump_fcontext, .-jump_fcontext
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 3,714
|
lib_fiber/c/src/fiber/boost/make_mips64_n64_elf_gas.S
|
/*
Copyright Jiaxun Yang 2018.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 8 | 16 | 24 | *
* ------------------------------------------------- *
* | F24 | F25 | F26 | F27 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 40 | 48 | 56 | *
* ------------------------------------------------- *
* | F28 | F29 | F30 | F31 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 72 | 80 | 88 | *
* ------------------------------------------------- *
* | S0 | S1 | S2 | S3 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | S4 | S5 | S6 | S7 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | FP | GP | RA | PC | *
* ------------------------------------------------- *
* *
* *****************************************************/
.file "make_mips64_n64_elf_gas.S"
.text
.globl make_fcontext
.align 3
.type make_fcontext,@function
.ent make_fcontext
make_fcontext:
#ifdef __PIC__
.set noreorder
.cpload $t9
.set reorder
#endif
# shift address in A0 to lower 16 byte boundary
li $v1, 0xfffffffffffffff0
and $v0, $v1, $a0
# reserve space for context-data on context-stack
daddiu $v0, $v0, -160
# third arg of make_fcontext() == address of context-function
sd $a2, 152($v0)
# save global pointer in context-data
sd $gp, 136($v0)
# psudo instruction compute abs address of label finish based on GP
dla $t9, finish
# save address of finish as return-address for context-function
# will be entered after context-function returns
sd $t9, 144($v0)
jr $ra # return pointer to context-data
finish:
# reload our gp register (needed for la)
daddiu $t0, $sp, -160
ld $gp, 136($t0)
# call _exit(0)
# the previous function should have left the 16 bytes incoming argument
# area on the stack which we reuse for calling _exit
dla $t9, _exit
move $a0, $zero
jr $t9
.end make_fcontext
.size make_fcontext, .-make_fcontext
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 4,211
|
lib_fiber/c/src/fiber/boost/jump_mips32_o32_elf_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
* ------------------------------------------------- *
* | F20 | F22 | F24 | F26 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
* ------------------------------------------------- *
* | F28 | F30 | S0 | S1 | S2 | S3 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
* ------------------------------------------------- *
* | S4 | S5 | S6 | S7 | FP |hiddn| RA | PC | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | ABI ARGS | GP | FCTX| DATA| | *
* ------------------------------------------------- *
* *
* *****************************************************/
.file "jump_mips32_o32_elf_gas.S"
.text
.globl jump_fcontext
.align 2
.type jump_fcontext,@function
.ent jump_fcontext
jump_fcontext:
# reserve space on stack
addiu $sp, $sp, -96
sw $s0, 48($sp) # save S0
sw $s1, 52($sp) # save S1
sw $s2, 56($sp) # save S2
sw $s3, 60($sp) # save S3
sw $s4, 64($sp) # save S4
sw $s5, 68($sp) # save S5
sw $s6, 72($sp) # save S6
sw $s7, 76($sp) # save S7
sw $fp, 80($sp) # save FP
sw $a0, 84($sp) # save hidden, address of returned transfer_t
sw $ra, 88($sp) # save RA
sw $ra, 92($sp) # save RA as PC
#if defined(__mips_hard_float)
s.d $f20, ($sp) # save F20
s.d $f22, 8($sp) # save F22
s.d $f24, 16($sp) # save F24
s.d $f26, 24($sp) # save F26
s.d $f28, 32($sp) # save F28
s.d $f30, 40($sp) # save F30
#endif
# store SP (pointing to context-data) in A0
move $a0, $sp
# restore SP (pointing to context-data) from A1
move $sp, $a1
#if defined(__mips_hard_float)
l.d $f20, ($sp) # restore F20
l.d $f22, 8($sp) # restore F22
l.d $f24, 16($sp) # restore F24
l.d $f26, 24($sp) # restore F26
l.d $f28, 32($sp) # restore F28
l.d $f30, 40($sp) # restore F30
#endif
lw $s0, 48($sp) # restore S0
lw $s1, 52($sp) # restore S1
lw $s2, 56($sp) # restore S2
lw $s3, 60($sp) # restore S3
lw $s4, 64($sp) # restore S4
lw $s5, 68($sp) # restore S5
lw $s6, 72($sp) # restore S6
lw $s7, 76($sp) # restore S7
lw $fp, 80($sp) # restore FP
lw $v0, 84($sp) # restore hidden, address of returned transfer_t
lw $ra, 88($sp) # restore RA
# load PC
lw $t9, 92($sp)
# adjust stack
addiu $sp, $sp, 96
# return transfer_t from jump
sw $a0, ($v0) # fctx of transfer_t
sw $a2, 4($v0) # data of transfer_t
# pass transfer_t as first arg in context function
# A0 == fctx, A1 == data
move $a1, $a2
# jump to context
jr $t9
.end jump_fcontext
.size jump_fcontext, .-jump_fcontext
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 3,040
|
lib_fiber/c/src/fiber/boost/make_arm_aapcs_elf_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | s24 | s25 | s26 | s27 | s28 | s29 | s30 | s31 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
* ------------------------------------------------- *
* |hiddn| v1 | v2 | v3 | v4 | v5 | v6 | v7 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
* ------------------------------------------------- *
* | v8 | lr | pc | FCTX| DATA| | *
* ------------------------------------------------- *
* *
*******************************************************/
.file "make_arm_aapcs_elf_gas.S"
.text
.globl make_fcontext
.align 2
.type make_fcontext,%function
.syntax unified
make_fcontext:
@ shift address in A1 to lower 16 byte boundary
bic a1, a1, #15
@ reserve space for context-data on context-stack
sub a1, a1, #124
@ third arg of make_fcontext() == address of context-function
str a3, [a1, #104]
@ compute address of returned transfer_t
add a2, a1, #108
mov a3, a2
str a3, [a1, #64]
@ compute abs address of label finish
adr a2, finish
@ save address of finish as return-address for context-function
@ will be entered after context-function returns
str a2, [a1, #100]
#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
#endif
bx lr @ return pointer to context-data
finish:
@ exit code is zero
mov a1, #0
@ exit application
bl _exit@PLT
.size make_fcontext,.-make_fcontext
@ Mark that we don't need executable stack.
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 3,808
|
lib_fiber/c/src/fiber/boost/make_arm64_aapcs_macho_gas.S
|
/*
Copyright Edward Nevill + Oliver Kowalke 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | d8 | d9 | d10 | d11 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | d12 | d13 | d14 | d15 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
* ------------------------------------------------- *
* | x19 | x20 | x21 | x22 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
* ------------------------------------------------- *
* | x23 | x24 | x25 | x26 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
* ------------------------------------------------- *
* | x27 | x28 | FP | LR | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | | | *
* ------------------------------------------------- *
* | 0xa0| 0xa4| 0xa8| 0xac| | | *
* ------------------------------------------------- *
* | PC | align | | | *
* ------------------------------------------------- *
* *
*******************************************************/
.text
.globl _make_fcontext
.balign 16
_make_fcontext:
; shift address in x0 (allocated stack) to lower 16 byte boundary
and x0, x0, ~0xF
; reserve space for context-data on context-stack
sub x0, x0, #0xb0
; third arg of make_fcontext() == address of context-function
; store address as a PC to jump in
str x2, [x0, #0xa0]
; compute abs address of label finish
; 0x0c = 3 instructions * size (4) before label 'finish'
; TODO: Numeric offset since llvm still does not support labels in ADR. Fix:
; http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140407/212336.html
adr x1, 0x0c
; save address of finish as return-address for context-function
; will be entered after context-function returns (LR register)
str x1, [x0, #0x98]
ret lr ; return pointer to context-data (x0)
finish:
; exit code is zero
mov x0, #0
; exit application
bl __exit
|
acl-dev/acl
| 5,227
|
lib_fiber/c/src/fiber/boost/make_ppc32_sysv_elf_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
* ------------------------------------------------- *
* |bchai|hiddn| fpscr | PC | CR | R14 | R15 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
* ------------------------------------------------- *
* | R16 | R17 | R18 | R19 | R20 | R21 | R22 | R23 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
* ------------------------------------------------- *
* | R24 | R25 | R26 | R27 | R28 | R29 | R30 | R31 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | F14 | F15 | F16 | F17 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | F18 | F19 | F20 | F21 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
* ------------------------------------------------- *
* | F22 | F23 | F24 | F25 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
* ------------------------------------------------- *
* | F26 | F27 | F28 | F29 | *
* ------------------------------------------------- *
* ------------------------|------------ *
* | 224 | 228 | 232 | 236 | 240 | 244 | *
* ------------------------|------------ *
* | F30 | F31 |bchai| LR | *
* ------------------------|------------ *
* *
*******************************************************/
.file "make_ppc32_sysv_elf_gas.S"
.text
.globl make_fcontext
.align 2
.type make_fcontext,@function
make_fcontext:
# save return address into R6
mflr %r6
# first arg of make_fcontext() == top address of context-function
# shift address in R3 to lower 16 byte boundary
clrrwi %r3, %r3, 4
# reserve space on context-stack, including 16 bytes of linkage
# and parameter area + 240 bytes of context-data (R1 % 16 == 0)
subi %r3, %r3, 16 + 240
# third arg of make_fcontext() == address of context-function
#ifdef __linux__
# save context-function as PC
stw %r5, 16(%r3)
#else
# save context-function for trampoline
stw %r5, 248(%r3)
#endif
# set back-chain to zero
li %r0, 0
stw %r0, 240(%r3)
# copy FPSCR to new context
mffs %f0
stfd %f0, 8(%r3)
#ifdef __linux__
# set hidden pointer for returning transfer_t
la %r0, 248(%r3)
stw %r0, 4(%r3)
#endif
# load address of label 1 into R4
bl 1f
1: mflr %r4
#ifndef __linux__
# compute abs address of trampoline, use as PC
addi %r7, %r4, trampoline - 1b
stw %r7, 16(%r3)
#endif
# compute abs address of label finish
addi %r4, %r4, finish - 1b
# save address of finish as return-address for context-function
# will be entered after context-function returns
stw %r4, 244(%r3)
# restore return address from R6
mtlr %r6
blr # return pointer to context-data
#ifndef __linux__
trampoline:
# On systems other than Linux, jump_fcontext is returning the
# transfer_t in R3:R4, but we need to pass transfer_t * R3 to
# our context-function.
lwz %r0, 8(%r1) # address of context-function
mtctr %r0
stw %r3, 8(%r1)
stw %r4, 12(%r1)
la %r3, 8(%r1) # address of transfer_t
bctr
#endif
finish:
# Use the secure PLT for _exit(0). If we use the insecure BSS PLT
# here, then the linker may use the insecure BSS PLT even if the
# C++ compiler wanted the secure PLT.
# set R30 for secure PLT, large model
bl 2f
2: mflr %r30
addis %r30, %r30, .Ltoc - 2b@ha
addi %r30, %r30, .Ltoc - 2b@l
# call _exit(0) with special addend 0x8000 for large model
li %r3, 0
bl _exit + 0x8000@plt
.size make_fcontext, .-make_fcontext
/* Provide the GOT pointer for secure PLT, large model. */
.section .got2,"aw"
.Ltoc = . + 0x8000
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 3,716
|
lib_fiber/c/src/fiber/boost/make_arm64_aapcs_elf_gas.S
|
/*
Copyright Edward Nevill + Oliver Kowalke 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | d8 | d9 | d10 | d11 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | d12 | d13 | d14 | d15 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
* ------------------------------------------------- *
* | x19 | x20 | x21 | x22 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
* ------------------------------------------------- *
* | x23 | x24 | x25 | x26 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
* ------------------------------------------------- *
* | x27 | x28 | FP | LR | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | | | *
* ------------------------------------------------- *
* | 0xa0| 0xa4| 0xa8| 0xac| | | *
* ------------------------------------------------- *
* | PC | align | | | *
* ------------------------------------------------- *
* *
*******************************************************/
.file "make_arm64_aapcs_elf_gas.S"
.text
.align 2
.global make_fcontext
.type make_fcontext, %function
make_fcontext:
# shift address in x0 (allocated stack) to lower 16 byte boundary
and x0, x0, ~0xF
# reserve space for context-data on context-stack
sub x0, x0, #0xb0
# third arg of make_fcontext() == address of context-function
# store address as a PC to jump in
str x2, [x0, #0xa0]
# save address of finish as return-address for context-function
# will be entered after context-function returns (LR register)
adr x1, finish
str x1, [x0, #0x98]
ret x30 // return pointer to context-data (x0)
finish:
# exit code is zero
mov x0, #0
# exit application
bl _exit
.size make_fcontext,.-make_fcontext
# Mark that we don't need executable stack.
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 4,090
|
lib_fiber/c/src/fiber/boost/jump_arm64_aapcs_macho_gas.S
|
/*
Copyright Edward Nevill + Oliver Kowalke 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | d8 | d9 | d10 | d11 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | d12 | d13 | d14 | d15 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
* ------------------------------------------------- *
* | x19 | x20 | x21 | x22 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
* ------------------------------------------------- *
* | x23 | x24 | x25 | x26 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
* ------------------------------------------------- *
* | x27 | x28 | FP | LR | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | | | *
* ------------------------------------------------- *
* | 0xa0| 0xa4| 0xa8| 0xac| | | *
* ------------------------------------------------- *
* | PC | align | | | *
* ------------------------------------------------- *
* *
*******************************************************/
.text
.globl _jump_fcontext
.balign 16
_jump_fcontext:
; prepare stack for GP + FPU
sub sp, sp, #0xb0
; save d8 - d15
stp d8, d9, [sp, #0x00]
stp d10, d11, [sp, #0x10]
stp d12, d13, [sp, #0x20]
stp d14, d15, [sp, #0x30]
; save x19-x30
stp x19, x20, [sp, #0x40]
stp x21, x22, [sp, #0x50]
stp x23, x24, [sp, #0x60]
stp x25, x26, [sp, #0x70]
stp x27, x28, [sp, #0x80]
stp fp, lr, [sp, #0x90]
; save LR as PC
str lr, [sp, #0xa0]
; store RSP (pointing to context-data) in X0
mov x4, sp
; restore RSP (pointing to context-data) from X1
mov sp, x0
; load d8 - d15
ldp d8, d9, [sp, #0x00]
ldp d10, d11, [sp, #0x10]
ldp d12, d13, [sp, #0x20]
ldp d14, d15, [sp, #0x30]
; load x19-x30
ldp x19, x20, [sp, #0x40]
ldp x21, x22, [sp, #0x50]
ldp x23, x24, [sp, #0x60]
ldp x25, x26, [sp, #0x70]
ldp x27, x28, [sp, #0x80]
ldp fp, lr, [sp, #0x90]
; return transfer_t from jump
; pass transfer_t as first arg in context function
; X0 == FCTX, X1 == DATA
mov x0, x4
; load pc
ldr x4, [sp, #0xa0]
; restore stack from GP + FPU
add sp, sp, #0xb0
ret x4
|
acl-dev/acl
| 3,595
|
lib_fiber/c/src/fiber/boost/ontop_i386_sysv_elf_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/****************************************************************************************
* *
* ---------------------------------------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ---------------------------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
* ---------------------------------------------------------------------------------- *
* | fc_mxcsr|fc_x87_cw| EDI | ESI | EBX | EBP | EIP | hidden | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ---------------------------------------------------------------------------------- *
* | 0x20 | 0x24 | | *
* ---------------------------------------------------------------------------------- *
* | to | data | | *
* ---------------------------------------------------------------------------------- *
* *
****************************************************************************************/
.file "ontop_i386_sysv_elf_gas.S"
.text
.globl ontop_fcontext
.align 2
.type ontop_fcontext,@function
ontop_fcontext:
leal -0x18(%esp), %esp /* prepare stack */
#if !defined(BOOST_USE_TSX)
stmxcsr (%esp) /* save MMX control- and status-word */
fnstcw 0x4(%esp) /* save x87 control-word */
#endif
movl %edi, 0x8(%esp) /* save EDI */
movl %esi, 0xc(%esp) /* save ESI */
movl %ebx, 0x10(%esp) /* save EBX */
movl %ebp, 0x14(%esp) /* save EBP */
/* store ESP (pointing to context-data) in ECX */
movl %esp, %ecx
/* first arg of ontop_fcontext() == fcontext to jump to */
movl 0x20(%esp), %eax
/* pass parent fcontext_t */
movl %ecx, 0x20(%eax)
/* second arg of ontop_fcontext() == data to be transferred */
movl 0x24(%esp), %ecx
/* pass data */
movl %ecx, 0x24(%eax)
/* third arg of ontop_fcontext() == ontop-function */
movl 0x28(%esp), %ecx
/* restore ESP (pointing to context-data) from EAX */
movl %eax, %esp
/* address of returned transport_t */
movl 0x1c(%esp), %eax
/* return parent fcontext_t */
movl %ecx, (%eax)
/* return data */
movl %edx, 0x4(%eax)
#if !defined(BOOST_USE_TSX)
ldmxcsr (%esp) /* restore MMX control- and status-word */
fldcw 0x4(%esp) /* restore x87 control-word */
#endif
movl 0x8(%esp), %edi /* restore EDI */
movl 0xc(%esp), %esi /* restore ESI */
movl 0x10(%esp), %ebx /* restore EBX */
movl 0x14(%esp), %ebp /* restore EBP */
leal 0x18(%esp), %esp /* prepare stack */
/* jump to context */
jmp *%ecx
.size ontop_fcontext,.-ontop_fcontext
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 4,275
|
lib_fiber/c/src/fiber/boost/jump_arm64_aapcs_elf_gas.S
|
/*
Copyright Edward Nevill + Oliver Kowalke 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | d8 | d9 | d10 | d11 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | d12 | d13 | d14 | d15 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
* ------------------------------------------------- *
* | x19 | x20 | x21 | x22 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
* ------------------------------------------------- *
* | x23 | x24 | x25 | x26 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
* ------------------------------------------------- *
* | x27 | x28 | FP | LR | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | | | *
* ------------------------------------------------- *
* | 0xa0| 0xa4| 0xa8| 0xac| | | *
* ------------------------------------------------- *
* | PC | align | | | *
* ------------------------------------------------- *
* *
*******************************************************/
.file "jump_arm64_aapcs_elf_gas.S"
.text
.align 2
.global jump_fcontext
.type jump_fcontext, %function
jump_fcontext:
# prepare stack for GP + FPU
sub sp, sp, #0xb0
# save d8 - d15
stp d8, d9, [sp, #0x00]
stp d10, d11, [sp, #0x10]
stp d12, d13, [sp, #0x20]
stp d14, d15, [sp, #0x30]
# save x19-x30
stp x19, x20, [sp, #0x40]
stp x21, x22, [sp, #0x50]
stp x23, x24, [sp, #0x60]
stp x25, x26, [sp, #0x70]
stp x27, x28, [sp, #0x80]
stp x29, x30, [sp, #0x90]
# save LR as PC
str x30, [sp, #0xa0]
# store RSP (pointing to context-data) in X0
mov x4, sp
# restore RSP (pointing to context-data) from X1
mov sp, x0
# load d8 - d15
ldp d8, d9, [sp, #0x00]
ldp d10, d11, [sp, #0x10]
ldp d12, d13, [sp, #0x20]
ldp d14, d15, [sp, #0x30]
# load x19-x30
ldp x19, x20, [sp, #0x40]
ldp x21, x22, [sp, #0x50]
ldp x23, x24, [sp, #0x60]
ldp x25, x26, [sp, #0x70]
ldp x27, x28, [sp, #0x80]
ldp x29, x30, [sp, #0x90]
# return transfer_t from jump
# pass transfer_t as first arg in context function
# X0 == FCTX, X1 == DATA
mov x0, x4
# load pc
ldr x4, [sp, #0xa0]
# restore stack from GP + FPU
add sp, sp, #0xb0
ret x4
.size jump_fcontext,.-jump_fcontext
# Mark that we don't need executable stack.
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 7,548
|
lib_fiber/c/src/fiber/boost/ontop_ppc32_sysv_macho_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
* ------------------------------------------------- *
* | F14 | F15 | F16 | F17 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
* ------------------------------------------------- *
* | F18 | F19 | F20 | F21 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
* ------------------------------------------------- *
* | F22 | F23 | F24 | F25 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | F26 | F27 | F28 | F29 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | F30 | F31 | fpscr | R13 | R14 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
* ------------------------------------------------- *
* | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
* ------------------------------------------------- *
* | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
* ------------------------------------------------- *
* | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
* ------------------------------------------------- *
* | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
* ------------------------------------------------- *
* | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
* ------------------------------------------------- *
* | R31 |hiddn| CR | LR | PC |bchai|linkr| FCTX| *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 64 | | *
* ------------------------------------------------- *
* | 256 | | *
* ------------------------------------------------- *
* | DATA| | *
* ------------------------------------------------- *
* *
*******************************************************/
.text
.globl _ontop_fcontext
.align 2
_ontop_fcontext:
# reserve space on stack
subi r1, r1, 244
stfd f14, 0(r1) # save F14
stfd f15, 8(r1) # save F15
stfd f16, 16(r1) # save F16
stfd f17, 24(r1) # save F17
stfd f18, 32(r1) # save F18
stfd f19, 40(r1) # save F19
stfd f20, 48(r1) # save F20
stfd f21, 56(r1) # save F21
stfd f22, 64(r1) # save F22
stfd f23, 72(r1) # save F23
stfd f24, 80(r1) # save F24
stfd f25, 88(r1) # save F25
stfd f26, 96(r1) # save F26
stfd f27, 104(r1) # save F27
stfd f28, 112(r1) # save F28
stfd f29, 120(r1) # save F29
stfd f30, 128(r1) # save F30
stfd f31, 136(r1) # save F31
mffs f0 # load FPSCR
stfd f0, 144(r1) # save FPSCR
stw r13, 152(r1) # save R13
stw r14, 156(r1) # save R14
stw r15, 160(r1) # save R15
stw r16, 164(r1) # save R16
stw r17, 168(r1) # save R17
stw r18, 172(r1) # save R18
stw r19, 176(r1) # save R19
stw r20, 180(r1) # save R20
stw r21, 184(r1) # save R21
stw r22, 188(r1) # save R22
stw r23, 192(r1) # save R23
stw r24, 196(r1) # save R24
stw r25, 200(r1) # save R25
stw r26, 204(r1) # save R26
stw r27, 208(r1) # save R27
stw r28, 212(r1) # save R28
stw r29, 216(r1) # save R29
stw r30, 220(r1) # save R30
stw r31, 224(r1) # save R31
stw r3, 228(r1) # save hidden
# save CR
mfcr r0
stw r0, 232(r1)
# save LR
mflr r0
stw r0, 236(r1)
# save LR as PC
stw r0, 240(r1)
# store RSP (pointing to context-data) in R7
mr r7, r1
# restore RSP (pointing to context-data) from R4
mr r1, r4
lfd f14, 0(r1) # restore F14
lfd f15, 8(r1) # restore F15
lfd f16, 16(r1) # restore F16
lfd f17, 24(r1) # restore F17
lfd f18, 32(r1) # restore F18
lfd f19, 40(r1) # restore F19
lfd f20, 48(r1) # restore F20
lfd f21, 56(r1) # restore F21
lfd f22, 64(r1) # restore F22
lfd f23, 72(r1) # restore F23
lfd f24, 80(r1) # restore F24
lfd f25, 88(r1) # restore F25
lfd f26, 96(r1) # restore F26
lfd f27, 104(r1) # restore F27
lfd f28, 112(r1) # restore F28
lfd f29, 120(r1) # restore F29
lfd f30, 128(r1) # restore F30
lfd f31, 136(r1) # restore F31
lfd f0, 144(r1) # load FPSCR
mtfsf 0xff, f0 # restore FPSCR
lwz r13, 152(r1) # restore R13
lwz r14, 156(r1) # restore R14
lwz r15, 160(r1) # restore R15
lwz r16, 164(r1) # restore R16
lwz r17, 168(r1) # restore R17
lwz r18, 172(r1) # restore R18
lwz r19, 176(r1) # restore R19
lwz r20, 180(r1) # restore R20
lwz r21, 184(r1) # restore R21
lwz r22, 188(r1) # restore R22
lwz r23, 192(r1) # restore R23
lwz r24, 196(r1) # restore R24
lwz r25, 200(r1) # restore R25
lwz r26, 204(r1) # restore R26
lwz r27, 208(r1) # restore R27
lwz r28, 212(r1) # restore R28
lwz r29, 216(r1) # restore R29
lwz r30, 220(r1) # restore R30
lwz r31, 224(r1) # restore R31
lwz r4, 228(r1) # restore hidden
# restore CR
lwz r0, 232(r1)
mtcr r0
# restore LR
lwz r0, 236(r1)
mtlr r0
# ignore PC
# adjust stack
addi r1, r1, 244
# return transfer_t
stw r7, 0(r4)
stw r5, 4(r4)
# restore CTR
mtctr r6
# jump to ontop-function
bctr
|
acl-dev/acl
| 5,103
|
lib_fiber/c/src/fiber/boost/jump_riscv64_sysv_elf_gas.S
|
/*
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | fs0 | fs1 | fs2 | fs3 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | fs4 | fs5 | fs6 | fs7 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
* ------------------------------------------------- *
* | fs8 | fs9 | fs10 | fs11 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
* ------------------------------------------------- *
* | s0 | s1 | s2 | s3 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
* ------------------------------------------------- *
* | s4 | s5 | s6 | s7 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
* ------------------------------------------------- *
* | 0xa0| 0xa4| 0xa8| 0xac| 0xb0| 0xb4| 0xb8| 0xbc| *
* ------------------------------------------------- *
* | s8 | s9 | s10 | s11 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 48 | 49 | 50 | 51 | | | | | *
* ------------------------------------------------- *
* | 0xc0| 0xc4| 0xc8| 0xcc| | | | | *
* ------------------------------------------------- *
* | ra | pc | | | *
* ------------------------------------------------- *
* *
*******************************************************/
.file "jump_riscv64_sysv_elf_gas.S"
.text
.align 1
.global jump_fcontext
.type jump_fcontext, %function
jump_fcontext:
# prepare stack for GP + FPU
addi sp, sp, -0xd0
# save fs0 - fs11
fsd fs0, 0x00(sp)
fsd fs1, 0x08(sp)
fsd fs2, 0x10(sp)
fsd fs3, 0x18(sp)
fsd fs4, 0x20(sp)
fsd fs5, 0x28(sp)
fsd fs6, 0x30(sp)
fsd fs7, 0x38(sp)
fsd fs8, 0x40(sp)
fsd fs9, 0x48(sp)
fsd fs10, 0x50(sp)
fsd fs11, 0x58(sp)
# save s0-s11, ra
sd s0, 0x60(sp)
sd s1, 0x68(sp)
sd s2, 0x70(sp)
sd s3, 0x78(sp)
sd s4, 0x80(sp)
sd s5, 0x88(sp)
sd s6, 0x90(sp)
sd s7, 0x98(sp)
sd s8, 0xa0(sp)
sd s9, 0xa8(sp)
sd s10, 0xb0(sp)
sd s11, 0xb8(sp)
sd ra, 0xc0(sp)
# save RA as PC
sd ra, 0xc8(sp)
# store SP (pointing to context-data) in A2
mv a2, sp
# restore SP (pointing to context-data) from A0
mv sp, a0
# load fs0 - fs11
fld fs0, 0x00(sp)
fld fs1, 0x08(sp)
fld fs2, 0x10(sp)
fld fs3, 0x18(sp)
fld fs4, 0x20(sp)
fld fs5, 0x28(sp)
fld fs6, 0x30(sp)
fld fs7, 0x38(sp)
fld fs8, 0x40(sp)
fld fs9, 0x48(sp)
fld fs10, 0x50(sp)
fld fs11, 0x58(sp)
# load s0-s11,ra
ld s0, 0x60(sp)
ld s1, 0x68(sp)
ld s2, 0x70(sp)
ld s3, 0x78(sp)
ld s4, 0x80(sp)
ld s5, 0x88(sp)
ld s6, 0x90(sp)
ld s7, 0x98(sp)
ld s8, 0xa0(sp)
ld s9, 0xa8(sp)
ld s10, 0xb0(sp)
ld s11, 0xb8(sp)
ld ra, 0xc0(sp)
# return transfer_t from jump
# pass transfer_t as first arg in context function
# a0 == FCTX, a1 == DATA
mv a0, a2
# load pc
ld a2, 0xc8(sp)
# restore stack from GP + FPU
addi sp, sp, 0xd0
jr a2
.size jump_fcontext,.-jump_fcontext
# Mark that we don't need executable stack.
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 7,635
|
lib_fiber/c/src/fiber/boost/ontop_ppc32_sysv_xcoff_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
* ------------------------------------------------- *
* | F14 | F15 | F16 | F17 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
* ------------------------------------------------- *
* | F18 | F19 | F20 | F21 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
* ------------------------------------------------- *
* | F22 | F23 | F24 | F25 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | F26 | F27 | F28 | F29 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | F30 | F31 | fpscr | R13 | R14 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
* ------------------------------------------------- *
* | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
* ------------------------------------------------- *
* | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
* ------------------------------------------------- *
* | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
* ------------------------------------------------- *
* | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
* ------------------------------------------------- *
* | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
* ------------------------------------------------- *
* | R31 |hiddn| CR | LR | PC |bchai|linkr| FCTX| *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 64 | | *
* ------------------------------------------------- *
* | 256 | | *
* ------------------------------------------------- *
* | DATA| | *
* ------------------------------------------------- *
* *
*******************************************************/
.globl .ontop_fcontext
.globl ontop_fcontext[DS]
.align 2
.csect ontop_fcontext[DS]
ontop_fcontext:
.long .ontop_fcontext
.ontop_fcontext:
# reserve space on stack
subi r1, r1, 244
stfd f14, 0(r1) # save F14
stfd f15, 8(r1) # save F15
stfd f16, 16(r1) # save F16
stfd f17, 24(r1) # save F17
stfd f18, 32(r1) # save F18
stfd f19, 40(r1) # save F19
stfd f20, 48(r1) # save F20
stfd f21, 56(r1) # save F21
stfd f22, 64(r1) # save F22
stfd f23, 72(r1) # save F23
stfd f24, 80(r1) # save F24
stfd f25, 88(r1) # save F25
stfd f26, 96(r1) # save F26
stfd f27, 104(r1) # save F27
stfd f28, 112(r1) # save F28
stfd f29, 120(r1) # save F29
stfd f30, 128(r1) # save F30
stfd f31, 136(r1) # save F31
mffs f0 # load FPSCR
stfd f0, 144(r1) # save FPSCR
stw r13, 152(r1) # save R13
stw r14, 156(r1) # save R14
stw r15, 160(r1) # save R15
stw r16, 164(r1) # save R16
stw r17, 168(r1) # save R17
stw r18, 172(r1) # save R18
stw r19, 176(r1) # save R19
stw r20, 180(r1) # save R20
stw r21, 184(r1) # save R21
stw r22, 188(r1) # save R22
stw r23, 192(r1) # save R23
stw r24, 196(r1) # save R24
stw r25, 200(r1) # save R25
stw r26, 204(r1) # save R26
stw r27, 208(r1) # save R27
stw r28, 212(r1) # save R28
stw r29, 216(r1) # save R29
stw r30, 220(r1) # save R30
stw r31, 224(r1) # save R31
stw r3, 228(r1) # save hidden
# save CR
mfcr r0
stw r0, 232(r1)
# save LR
mflr r0
stw r0, 236(r1)
# save LR as PC
stw r0, 240(r1)
# store RSP (pointing to context-data) in R7
mr r7, r1
# restore RSP (pointing to context-data) from R4
mr r1, r4
lfd f14, 0(r1) # restore F14
lfd f15, 8(r1) # restore F15
lfd f16, 16(r1) # restore F16
lfd f17, 24(r1) # restore F17
lfd f18, 32(r1) # restore F18
lfd f19, 40(r1) # restore F19
lfd f20, 48(r1) # restore F20
lfd f21, 56(r1) # restore F21
lfd f22, 64(r1) # restore F22
lfd f23, 72(r1) # restore F23
lfd f24, 80(r1) # restore F24
lfd f25, 88(r1) # restore F25
lfd f26, 96(r1) # restore F26
lfd f27, 104(r1) # restore F27
lfd f28, 112(r1) # restore F28
lfd f29, 120(r1) # restore F29
lfd f30, 128(r1) # restore F30
lfd f31, 136(r1) # restore F31
lfd f0, 144(r1) # load FPSCR
mtfsf 0xff, f0 # restore FPSCR
lwz r13, 152(r1) # restore R13
lwz r14, 156(r1) # restore R14
lwz r15, 160(r1) # restore R15
lwz r16, 164(r1) # restore R16
lwz r17, 168(r1) # restore R17
lwz r18, 172(r1) # restore R18
lwz r19, 176(r1) # restore R19
lwz r20, 180(r1) # restore R20
lwz r21, 184(r1) # restore R21
lwz r22, 188(r1) # restore R22
lwz r23, 192(r1) # restore R23
lwz r24, 196(r1) # restore R24
lwz r25, 200(r1) # restore R25
lwz r26, 204(r1) # restore R26
lwz r27, 208(r1) # restore R27
lwz r28, 212(r1) # restore R28
lwz r29, 216(r1) # restore R29
lwz r30, 220(r1) # restore R30
lwz r31, 224(r1) # restore R31
lwz r4, 228(r1) # restore hidden
# restore CR
lwz r0, 232(r1)
mtcr r0
# restore LR
lwz r0, 236(r1)
mtlr r0
# ignore PC
# adjust stack
addi r1, r1, 244
# return transfer_t
stw r7, 0(r4)
stw r5, 4(r4)
# restore CTR
mtctr r6
# jump to ontop-function
bctr
|
acl-dev/acl
| 2,161
|
lib_fiber/c/src/fiber/boost/jump_ppc64_sysv_xcoff_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
.align 2
.globl .jump_fcontext
.jump_fcontext:
# reserve space on stack
subi 1, 1, 184
std 13, 0(1) # save R13
std 14, 8(1) # save R14
std 15, 16(1) # save R15
std 16, 24(1) # save R16
std 17, 32(1) # save R17
std 18, 40(1) # save R18
std 19, 48(1) # save R19
std 20, 56(1) # save R20
std 21, 64(1) # save R21
std 22, 72(1) # save R22
std 23, 80(1) # save R23
std 24, 88(1) # save R24
std 25, 96(1) # save R25
std 26, 104(1) # save R26
std 27, 112(1) # save R27
std 29, 120(1) # save R28
std 29, 128(1) # save R29
std 30, 136(1) # save R30
std 31, 144(1) # save R31
std 3, 152(1) # save hidden
# save CR
mfcr 0
std 0, 160(1)
# save LR
mflr 0
std 0, 168(1)
# save LR as PC
std 0, 176(1)
# store RSP (pointing to context-data) in R6
mr 6, 1
# restore RSP (pointing to context-data) from R4
mr 1, 4
ld 13, 0(1) # restore R13
ld 14, 8(1) # restore R14
ld 15, 16(1) # restore R15
ld 16, 24(1) # restore R16
ld 17, 32(1) # restore R17
ld 18, 40(1) # restore R18
ld 19, 48(1) # restore R19
ld 20, 56(1) # restore R20
ld 21, 64(1) # restore R21
ld 22, 72(1) # restore R22
ld 23, 80(1) # restore R23
ld 24, 88(1) # restore R24
ld 25, 96(1) # restore R25
ld 26, 104(1) # restore R26
ld 27, 112(1) # restore R27
ld 28, 120(1) # restore R28
ld 29, 128(1) # restore R29
ld 30, 136(1) # restore R30
ld 31, 144(1) # restore R31
ld 3, 152(1) # restore hidden
# restore CR
ld 0, 160(1)
mtcr 0
# restore LR
ld 0, 168(1)
mtlr 0
# load PC
ld 0, 176(1)
# restore CTR
mtctr 0
# adjust stack
addi 1, 1, 184
# return transfer_t
std 6, 0(3)
std 5, 8(3)
# jump to context
bctr
|
acl-dev/acl
| 3,231
|
lib_fiber/c/src/fiber/boost/make_x86_64_sysv_macho_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/****************************************************************************************
* *
* ---------------------------------------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ---------------------------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
* ---------------------------------------------------------------------------------- *
* | fc_mxcsr|fc_x87_cw| R12 | R13 | R14 | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ---------------------------------------------------------------------------------- *
* | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
* ---------------------------------------------------------------------------------- *
* | R15 | RBX | RBP | RIP | *
* ---------------------------------------------------------------------------------- *
* *
****************************************************************************************/
.text
.globl _make_fcontext
.align 8
_make_fcontext:
/* first arg of make_fcontext() == top of context-stack */
movq %rdi, %rax
/* shift address in RAX to lower 16 byte boundary */
andq $-16, %rax
/* reserve space for context-data on context-stack */
/* on context-function entry: (RSP -0x8) % 16 == 0 */
leaq -0x40(%rax), %rax
/* third arg of make_fcontext() == address of context-function */
/* stored in RBX */
movq %rdx, 0x28(%rax)
/* save MMX control- and status-word */
stmxcsr (%rax)
/* save x87 control-word */
fnstcw 0x4(%rax)
/* compute abs address of label trampoline */
leaq trampoline(%rip), %rcx
/* save address of trampoline as return-address for context-function */
/* will be entered after calling jump_fcontext() first time */
movq %rcx, 0x38(%rax)
/* compute abs address of label finish */
leaq finish(%rip), %rcx
/* save address of finish as return-address for context-function */
/* will be entered after context-function returns */
movq %rcx, 0x30(%rax)
ret /* return pointer to context-data */
trampoline:
/* store return address on stack */
/* fix stack alignment */
push %rbp
/* jump to context-function */
jmp *%rbx
finish:
/* exit code is zero */
xorq %rdi, %rdi
/* exit application */
call __exit
hlt
|
acl-dev/acl
| 5,000
|
lib_fiber/c/src/fiber/boost/ontop_s390x_sysv_elf_gas.S
|
/*******************************************************
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 8 | 16 | 24 | *
* ------------------------------------------------- *
* | t.fctx | t.data | r2 | r6 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 40 | 48 | 56 | *
* ------------------------------------------------- *
* | r7 | r8 | r9 | r10 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 72 | 80 | 88 | *
* ------------------------------------------------- *
* | r11 | r12 | r13 | r14 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 104 | 112 | 120 | *
* ------------------------------------------------- *
* | f8 | f9 | f10 | f11 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 128 | 136 | 144 | 152 | *
* ------------------------------------------------- *
* | f12 | f13 | f14 | f15 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
* ------------------------------------------------- *
* | 160 | 168 | 176 | | *
* ------------------------------------------------- *
* | fpc | pc | | | *
* ------------------------------------------------- *
*******************************************************/
.text
.align 8
.global ontop_fcontext
.type ontop_fcontext, @function
#define ARG_OFFSET 0
#define GR_OFFSET 16
#define R14_OFFSET 88
#define FP_OFFSET 96
#define FPC_OFFSET 160
#define PC_OFFSET 168
#define CONTEXT_SIZE 176
/*
typedef void* fcontext_t;
struct transfer_t {
fcontext_t fctx;
void * data;
};
transfer_t ontop_fcontext( fcontext_t const to,
void * vp,
transfer_t (* fn)( transfer_t) );
Incoming args
r2 - Hidden argument to the location where the return transfer_t needs to be returned
r3 - Target context
r4 - Data pointer
r5 - Function to be executed
This implementation assumes that ontop_fcontext will never be called with target contexts
created via make_fcontext.
*/
ontop_fcontext:
/* Reserve stack space to store the current context. */
aghi %r15,-CONTEXT_SIZE
/* Save the argument register holding the location of the return value. */
stg %r2,GR_OFFSET(%r15)
/* Save the call-saved general purpose registers. */
stmg %r6,%r14,GR_OFFSET+8(%r15)
/* Save call-saved floating point registers. */
std %f8,FP_OFFSET(%r15)
std %f9,FP_OFFSET+8(%r15)
std %f10,FP_OFFSET+16(%r15)
std %f11,FP_OFFSET+24(%r15)
std %f12,FP_OFFSET+32(%r15)
std %f13,FP_OFFSET+40(%r15)
std %f14,FP_OFFSET+48(%r15)
std %f15,FP_OFFSET+56(%r15)
/* Save the return address as current pc. */
stg %r14,PC_OFFSET(%r15)
/* Save the floating point control register. */
stfpc FPC_OFFSET(%r15)
/* Backup the stack pointer pointing to the old context-data into r1. */
lgr %r1,%r15
/* Load the new context pointer as stack pointer. */
lgr %r15,%r3
/* Restore the call-saved GPRs from the new context. */
lmg %r6,%r14,GR_OFFSET+8(%r15)
/* Restore call-saved floating point registers. */
ld %f8,FP_OFFSET(%r15)
ld %f9,FP_OFFSET+8(%r15)
ld %f10,FP_OFFSET+16(%r15)
ld %f11,FP_OFFSET+24(%r15)
ld %f12,FP_OFFSET+32(%r15)
ld %f13,FP_OFFSET+40(%r15)
ld %f14,FP_OFFSET+48(%r15)
ld %f15,FP_OFFSET+56(%r15)
/* Load the floating point control register. */
lfpc FPC_OFFSET(%r15)
/* Store the transfer_t values located in the saved context. */
stg %r1,0(%r1) /* transfer_t.fctx = old context */
stg %r4,8(%r1) /* transfer_t.data = data */
/* Set up the arguments for the target function. */
lg %r2,GR_OFFSET(%r15)
lgr %r3,%r1
/* Deallocate the context. */
aghi %r15,CONTEXT_SIZE
br %r5
.size ontop_fcontext,.-ontop_fcontext
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 5,522
|
lib_fiber/c/src/fiber/boost/make_ppc32_sysv_xcoff_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
* ------------------------------------------------- *
* | F14 | F15 | F16 | F17 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
* ------------------------------------------------- *
* | F18 | F19 | F20 | F21 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
* ------------------------------------------------- *
* | F22 | F23 | F24 | F25 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | F26 | F27 | F28 | F29 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | F30 | F31 | fpscr | R13 | R14 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
* ------------------------------------------------- *
* | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
* ------------------------------------------------- *
* | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
* ------------------------------------------------- *
* | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
* ------------------------------------------------- *
* | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
* ------------------------------------------------- *
* | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
* ------------------------------------------------- *
* | R31 |hiddn| CR | LR | PC |bchai|linkr| FCTX| *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 64 | | *
* ------------------------------------------------- *
* | 256 | | *
* ------------------------------------------------- *
* | DATA| | *
* ------------------------------------------------- *
* *
*******************************************************/
.globl make_fcontext[DS]
.globl .make_fcontext[PR]
.align 2
.csect make_fcontext[DS]
make_fcontext:
.long .make_fcontext[PR]
.csect .make_fcontext[PR], 3
#.make_fcontext:
# save return address into R6
mflr 6
# first arg of make_fcontext() == top address of context-function
# shift address in R3 to lower 16 byte boundary
clrrwi 3, 3, 4
# reserve space for context-data on context-stack
# including 64 byte of linkage + parameter area (R1 % 16 == 0)
subi 3, 3, 336
# third arg of make_fcontext() == address of context-function
stw 5, 240(3)
# set back-chain to zero
li 0, 0
stw 0, 244(3)
# compute address of returned transfer_t
addi 0, 3, 252
mr 4, 0
stw 4, 228(3)
# load LR
mflr 0
# jump to label 1
bl .Label
.Label:
# load LR into R4
mflr 4
# compute abs address of label .L_finish
addi 4, 4, .L_finish - .Label
# restore LR
mtlr 0
# save address of finish as return-address for context-function
# will be entered after context-function returns
stw 4, 236(3)
# restore return address from R6
mtlr 6
blr # return pointer to context-data
.L_finish:
# save return address into R0
mflr 0
# save return address on stack, set up stack frame
stw 0, 4(1)
# allocate stack space, R1 % 16 == 0
stwu 1, -16(1)
# exit code is zero
li 3, 0
# exit application
bl ._exit
nop
|
acl-dev/acl
| 1,065
|
lib_fiber/c/src/fiber/boost/jump_gas.S
|
// Stub file for universal binary
#if defined(__APPLE__)
#include "jump_combined_sysv_macho_gas.S"
#elif defined(_WIN32) || defined(__MINGW32__) || defined(__MINGW64__) || defined(__CYGWIN__) || defined(__MSYS__)
#if defined(__x86_64__)
#include "jump_x86_64_ms_pe_gas.asm"
#elif defined(__i386__)
#include "jump_i386_ms_pe_gas.asm"
#endif
#elif defined(__x86_64__)
#include "jump_x86_64_sysv_elf_gas.S"
#elif defined(__i386__)
#include "jump_i386_sysv_elf_gas.S"
#elif defined(__ppc64__)
#include "jump_ppc64_sysv_elf_gas.S"
#elif defined(__ppc__)
#include "jump_ppc32_sysv_elf_gas.S"
#elif defined(__aarch64__)
#include "jump_arm64_aapcs_elf_gas.S"
#elif defined(__arm__)
#include "jump_arm_aapcs_elf_gas.S"
#elif defined(__mips64)
#include "jump_mips64_n64_elf_gas.S"
#elif defined(__mips__)
#include "jump_mips32_o32_elf_gas.S"
#elif defined(__riscv)
#include "jump_riscv64_sysv_elf_gas.S"
#elif defined(__s390x__)
#include "jump_s390x_sysv_elf_gas.S"
#else
#error "No arch's"
#endif
|
acl-dev/acl
| 4,284
|
lib_fiber/c/src/fiber/boost/ontop_arm64_aapcs_elf_gas.S
|
/*
Copyright Edward Nevill + Oliver Kowalke 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | d8 | d9 | d10 | d11 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | d12 | d13 | d14 | d15 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
* ------------------------------------------------- *
* | x19 | x20 | x21 | x22 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
* ------------------------------------------------- *
* | x23 | x24 | x25 | x26 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
* ------------------------------------------------- *
* | x27 | x28 | FP | LR | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | | | *
* ------------------------------------------------- *
* | 0xa0| 0xa4| 0xa8| 0xac| | | *
* ------------------------------------------------- *
* | PC | align | | | *
* ------------------------------------------------- *
* *
*******************************************************/
.file "ontop_arm64_aapcs_elf_gas.S"
.text
.align 2
.global ontop_fcontext
.type ontop_fcontext, %function
ontop_fcontext:
# prepare stack for GP + FPU
sub sp, sp, #0xb0
# save d8 - d15
stp d8, d9, [sp, #0x00]
stp d10, d11, [sp, #0x10]
stp d12, d13, [sp, #0x20]
stp d14, d15, [sp, #0x30]
# save x19-x30
stp x19, x20, [sp, #0x40]
stp x21, x22, [sp, #0x50]
stp x23, x24, [sp, #0x60]
stp x25, x26, [sp, #0x70]
stp x27, x28, [sp, #0x80]
stp x29, x30, [sp, #0x90]
# save LR as PC
str x30, [sp, #0xa0]
# store RSP (pointing to context-data) in X5
mov x4, sp
# restore RSP (pointing to context-data) from X1
mov sp, x0
# load d8 - d15
ldp d8, d9, [sp, #0x00]
ldp d10, d11, [sp, #0x10]
ldp d12, d13, [sp, #0x20]
ldp d14, d15, [sp, #0x30]
# load x19-x30
ldp x19, x20, [sp, #0x40]
ldp x21, x22, [sp, #0x50]
ldp x23, x24, [sp, #0x60]
ldp x25, x26, [sp, #0x70]
ldp x27, x28, [sp, #0x80]
ldp x29, x30, [sp, #0x90]
# return transfer_t from jump
# pass transfer_t as first arg in context function
# X0 == FCTX, X1 == DATA
mov x0, x4
# skip pc
# restore stack from GP + FPU
add sp, sp, #0xb0
# jump to ontop-function
ret x2
.size ontop_fcontext,.-ontop_fcontext
# Mark that we don't need executable stack.
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 5,249
|
lib_fiber/c/src/fiber/boost/jump_s390x_sysv_elf_gas.S
|
/*******************************************************
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 8 | 16 | 24 | *
* ------------------------------------------------- *
* | t.fctx | t.data | r2 | r6 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 40 | 48 | 56 | *
* ------------------------------------------------- *
* | r7 | r8 | r9 | r10 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 72 | 80 | 88 | *
* ------------------------------------------------- *
* | r11 | r12 | r13 | r14 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 104 | 112 | 120 | *
* ------------------------------------------------- *
* | f8 | f9 | f10 | f11 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 128 | 136 | 144 | 152 | *
* ------------------------------------------------- *
* | f12 | f13 | f14 | f15 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
* ------------------------------------------------- *
* | 160 | 168 | 176 | | *
* ------------------------------------------------- *
* | fpc | pc | | | *
* ------------------------------------------------- *
*******************************************************/
.text
.align 8
.global jump_fcontext
.type jump_fcontext, @function
#define ARG_OFFSET 0
#define GR_OFFSET 16
#define FP_OFFSET 96
#define FPC_OFFSET 160
#define PC_OFFSET 168
#define CONTEXT_SIZE 176
#define REG_SAVE_AREA_SIZE 160
/*
typedef void* fcontext_t;
struct transfer_t {
fcontext_t fctx;
void * data;
};
transfer_t jump_fcontext( fcontext_t const to,
void * data);
Incoming args
r2 - Hidden argument to the location where the return transfer_t needs to be returned
r3 - Context we want to switch to
r4 - Data pointer
*/
jump_fcontext:
.machine "z10"
/* Reserve stack space to store the current context. */
aghi %r15,-CONTEXT_SIZE
/* Save the argument register holding the location of the return value. */
stg %r2,GR_OFFSET(%r15)
/* Save the call-saved general purpose registers. */
stmg %r6,%r14,GR_OFFSET+8(%r15)
/* Save call-saved floating point registers. */
std %f8,FP_OFFSET(%r15)
std %f9,FP_OFFSET+8(%r15)
std %f10,FP_OFFSET+16(%r15)
std %f11,FP_OFFSET+24(%r15)
std %f12,FP_OFFSET+32(%r15)
std %f13,FP_OFFSET+40(%r15)
std %f14,FP_OFFSET+48(%r15)
std %f15,FP_OFFSET+56(%r15)
/* Save the return address as current pc. */
stg %r14,PC_OFFSET(%r15)
/* Save the floating point control register. */
stfpc FPC_OFFSET(%r15)
/* Backup the stack pointer pointing to the old context-data into r1. */
lgr %r1,%r15
/* Load the new context pointer as stack pointer. */
lgr %r15,%r3
/* Restore the call-saved GPRs from the new context. */
lmg %r6,%r14,GR_OFFSET+8(%r15)
/* Restore call-saved floating point registers. */
ld %f8,FP_OFFSET(%r15)
ld %f9,FP_OFFSET+8(%r15)
ld %f10,FP_OFFSET+16(%r15)
ld %f11,FP_OFFSET+24(%r15)
ld %f12,FP_OFFSET+32(%r15)
ld %f13,FP_OFFSET+40(%r15)
ld %f14,FP_OFFSET+48(%r15)
ld %f15,FP_OFFSET+56(%r15)
/* Load the floating point control register. */
lfpc FPC_OFFSET(%r15)
/* Restore PC - the location where we will jump to at the end. */
lg %r5,PC_OFFSET(%r15)
ltg %r2,GR_OFFSET(%r15)
jnz use_return_slot
/* We restore a make_fcontext context. Use the function
argument slot in the context we just saved and allocate the
register save area for the target function. */
la %r2,ARG_OFFSET(%r1)
aghi %r15,-REG_SAVE_AREA_SIZE
use_return_slot:
/* Save the two fields in transfer_t. When calling a
make_fcontext function this becomes the function argument of
the target function, otherwise it will be the return value of
jump_fcontext. */
stg %r1,0(%r2)
stg %r4,8(%r2)
/* Free the restored context. */
aghi %r15,CONTEXT_SIZE
/* Jump to the PC loaded from the new context. */
br %r5
.size jump_fcontext,.-jump_fcontext
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 5,865
|
lib_fiber/c/src/fiber/boost/jump_ppc64_sysv_macho_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
* ------------------------------------------------- *
* | TOC | R14 | R15 | R16 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
* ------------------------------------------------- *
* | R17 | R18 | R19 | R20 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
* ------------------------------------------------- *
* | R21 | R22 | R23 | R24 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | R25 | R26 | R27 | R28 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | R29 | R30 | R31 | hidden | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
* ------------------------------------------------- *
* | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
* ------------------------------------------------- *
* | CR | LR | PC | back-chain| *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
* ------------------------------------------------- *
* | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
* ------------------------------------------------- *
* | cr saved | lr saved | compiler | linker | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
* ------------------------------------------------- *
* | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
* ------------------------------------------------- *
* | TOC saved | FCTX | DATA | | *
* ------------------------------------------------- *
* *
*******************************************************/
.text
.align 2
.globl _jump_fcontext
_jump_fcontext:
; reserve space on stack
subi r1, r1, 184
std r14, 8(r1) ; save R14
std r15, 16(r1) ; save R15
std r16, 24(r1) ; save R16
std r17, 32(r1) ; save R17
std r18, 40(r1) ; save R18
std r19, 48(r1) ; save R19
std r20, 56(r1) ; save R20
std r21, 64(r1) ; save R21
std r22, 72(r1) ; save R22
std r23, 80(r1) ; save R23
std r24, 88(r1) ; save R24
std r25, 96(r1) ; save R25
std r26, 104(r1) ; save R26
std r27, 112(r1) ; save R27
std r28, 120(r1) ; save R28
std r29, 128(r1) ; save R29
std r30, 136(r1) ; save R30
std r31, 144(r1) ; save R31
std r3, 152(r1) ; save hidden
; save CR
mfcr r0
std r0, 160(r1)
; save LR
mflr r0
std r0, 168(r1)
; save LR as PC
std r0, 176(r1)
; store RSP (pointing to context-data) in R6
mr r6, r1
; restore RSP (pointing to context-data) from R4
mr r1, r4
ld r14, 8(r1) ; restore R14
ld r15, 16(r1) ; restore R15
ld r16, 24(r1) ; restore R16
ld r17, 32(r1) ; restore R17
ld r18, 40(r1) ; restore R18
ld r19, 48(r1) ; restore R19
ld r20, 56(r1) ; restore R20
ld r21, 64(r1) ; restore R21
ld r22, 72(r1) ; restore R22
ld r23, 80(r1) ; restore R23
ld r24, 88(r1) ; restore R24
ld r25, 96(r1) ; restore R25
ld r26, 104(r1) ; restore R26
ld r27, 112(r1) ; restore R27
ld r28, 120(r1) ; restore R28
ld r29, 128(r1) ; restore R29
ld r30, 136(r1) ; restore R30
ld r31, 144(r1) ; restore R31
ld r3, 152(r1) ; restore hidden
; restore CR
ld r0, 160(r1)
mtcr r0
; restore LR
ld r0, 168(r1)
mtlr r0
; load PC
ld r12, 176(r1)
# restore CTR
mtctr r12
# adjust stack
addi r1, r1, 184
# zero in r3 indicates first jump to context-function
cmpdi r3, 0
beq use_entry_arg
# return transfer_t
std r6, 0(r3)
std r5, 8(r3)
# jump to context
bctr
use_entry_arg:
# copy transfer_t into transfer_fn arg registers
mr r3, r6
mr r4, r5
# jump to context
bctr
|
acl-dev/acl
| 4,055
|
lib_fiber/c/src/fiber/boost/make_i386_sysv_elf_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/****************************************************************************************
* *
* ---------------------------------------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ---------------------------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
* ---------------------------------------------------------------------------------- *
* | fc_mxcsr|fc_x87_cw| EDI | ESI | EBX | EBP | EIP | hidden | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ---------------------------------------------------------------------------------- *
* | 0x20 | 0x24 | | *
* ---------------------------------------------------------------------------------- *
* | to | data | | *
* ---------------------------------------------------------------------------------- *
* *
****************************************************************************************/
.file "make_i386_sysv_elf_gas.S"
.text
.globl make_fcontext
.align 2
.type make_fcontext,@function
make_fcontext:
/* first arg of make_fcontext() == top of context-stack */
movl 0x4(%esp), %eax
/* reserve space for first argument of context-function
eax might already point to a 16byte border */
leal -0x8(%eax), %eax
/* shift address in EAX to lower 16 byte boundary */
andl $-16, %eax
/* reserve space for context-data on context-stack */
leal -0x28(%eax), %eax
/* third arg of make_fcontext() == address of context-function */
/* stored in EBX */
movl 0xc(%esp), %ecx
movl %ecx, 0x10(%eax)
/* save MMX control- and status-word */
stmxcsr (%eax)
/* save x87 control-word */
fnstcw 0x4(%eax)
/* return transport_t */
/* FCTX == EDI, DATA == ESI */
leal 0x8(%eax), %ecx
movl %ecx, 0x1c(%eax)
/* compute abs address of label trampoline */
call 1f
/* address of trampoline 1 */
1: popl %ecx
/* compute abs address of label trampoline */
addl $trampoline-1b, %ecx
/* save address of trampoline as return address */
/* will be entered after calling jump_fcontext() first time */
movl %ecx, 0x18(%eax)
/* compute abs address of label finish */
call 2f
/* address of label 2 */
2: popl %ecx
/* compute abs address of label finish */
addl $finish-2b, %ecx
/* save address of finish as return-address for context-function */
/* will be entered after context-function returns */
movl %ecx, 0x14(%eax)
ret /* return pointer to context-data */
trampoline:
/* move transport_t for entering context-function */
movl %edi, (%esp)
movl %esi, 0x4(%esp)
pushl %ebp
/* jump to context-function */
jmp *%ebx
finish:
call 3f
/* address of label 3 */
3: popl %ebx
/* compute address of GOT and store it in EBX */
addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx
/* exit code is zero */
xorl %eax, %eax
movl %eax, (%esp)
/* exit application */
call _exit@PLT
hlt
.size make_fcontext,.-make_fcontext
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 4,459
|
lib_fiber/c/src/fiber/boost/jump_mips64_n64_elf_gas.S
|
/*
Copyright Jiaxun Yang 2018.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 8 | 16 | 24 | *
* ------------------------------------------------- *
* | F24 | F25 | F26 | F27 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 40 | 48 | 56 | *
* ------------------------------------------------- *
* | F28 | F29 | F30 | F31 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 72 | 80 | 88 | *
* ------------------------------------------------- *
* | S0 | S1 | S2 | S3 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | S4 | S5 | S6 | S7 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | FP | GP | RA | PC | *
* ------------------------------------------------- *
* *
* *****************************************************/
.file "jump_mips64_n64_elf_gas.S"
.text
.globl jump_fcontext
.align 3
.type jump_fcontext,@function
.ent jump_fcontext
jump_fcontext:
# reserve space on stack
daddiu $sp, $sp, -160
sd $s0, 64($sp) # save S0
sd $s1, 72($sp) # save S1
sd $s2, 80($sp) # save S2
sd $s3, 88($sp) # save S3
sd $s4, 96($sp) # save S4
sd $s5, 104($sp) # save S5
sd $s6, 112($sp) # save S6
sd $s7, 120($sp) # save S7
sd $fp, 128($sp) # save FP
sd $ra, 144($sp) # save RA
sd $ra, 152($sp) # save RA as PC
s.d $f24, 0($sp) # save F24
s.d $f25, 8($sp) # save F25
s.d $f26, 16($sp) # save F26
s.d $f27, 24($sp) # save F27
s.d $f28, 32($sp) # save F28
s.d $f29, 40($sp) # save F29
s.d $f30, 48($sp) # save F30
s.d $f31, 56($sp) # save F31
# store SP (pointing to old context-data) in v0 as return
move $v0, $sp
# get SP (pointing to new context-data) from a0 param
move $sp, $a0
l.d $f24, 0($sp) # restore F24
l.d $f25, 8($sp) # restore F25
l.d $f26, 16($sp) # restore F26
l.d $f27, 24($sp) # restore F27
l.d $f28, 32($sp) # restore F28
l.d $f29, 40($sp) # restore F29
l.d $f30, 48($sp) # restore F30
l.d $f31, 56($sp) # restore F31
ld $s0, 64($sp) # restore S0
ld $s1, 72($sp) # restore S1
ld $s2, 80($sp) # restore S2
ld $s3, 88($sp) # restore S3
ld $s4, 96($sp) # restore S4
ld $s5, 104($sp) # restore S5
ld $s6, 112($sp) # restore S6
ld $s7, 120($sp) # restore S7
ld $fp, 128($sp) # restore FP
ld $ra, 144($sp) # restore RAa
# load PC
ld $t9, 152($sp)
# adjust stack
daddiu $sp, $sp, 160
move $a0, $v0 # move old sp from v0 to a0 as param
move $v1, $a1 # move *data from a1 to v1 as return
# jump to context
jr $t9
.end jump_fcontext
.size jump_fcontext, .-jump_fcontext
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 3,181
|
lib_fiber/c/src/fiber/boost/jump_i386_sysv_macho_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/****************************************************************************************
* *
* ---------------------------------------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ---------------------------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
* ---------------------------------------------------------------------------------- *
* | fc_mxcsr|fc_x87_cw| EDI | ESI | EBX | EBP | EIP | to | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ---------------------------------------------------------------------------------- *
* | 0x20 | | *
* ---------------------------------------------------------------------------------- *
* | data | | *
* ---------------------------------------------------------------------------------- *
* *
****************************************************************************************/
.text
.globl _jump_fcontext
.align 2
_jump_fcontext:
leal -0x18(%esp), %esp /* prepare stack */
#if !defined(BOOST_USE_TSX)
stmxcsr (%esp) /* save MMX control- and status-word */
fnstcw 0x4(%esp) /* save x87 control-word */
#endif
movl %edi, 0x8(%esp) /* save EDI */
movl %esi, 0xc(%esp) /* save ESI */
movl %ebx, 0x10(%esp) /* save EBX */
movl %ebp, 0x14(%esp) /* save EBP */
/* store ESP (pointing to context-data) in ECX */
movl %esp, %ecx
/* first arg of jump_fcontext() == fcontext to jump to */
movl 0x1c(%esp), %eax
/* second arg of jump_fcontext() == data to be transferred */
movl 0x20(%esp), %edx
/* restore ESP (pointing to context-data) from EAX */
movl %eax, %esp
/* return parent fcontext_t */
movl %ecx, %eax
/* returned data is stored in EDX */
movl 0x18(%esp), %ecx /* restore EIP */
#if !defined(BOOST_USE_TSX)
ldmxcsr (%esp) /* restore MMX control- and status-word */
fldcw 0x4(%esp) /* restore x87 control-word */
#endif
movl 0x8(%esp), %edi /* restore EDI */
movl 0xc(%esp), %esi /* restore ESI */
movl 0x10(%esp), %ebx /* restore EBX */
movl 0x14(%esp), %ebp /* restore EBP */
leal 0x1c(%esp), %esp /* prepare stack */
/* jump to context */
jmp *%ecx
|
acl-dev/acl
| 3,078
|
lib_fiber/c/src/fiber/boost/jump_arm_aapcs_elf_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | s24 | s25 | s26 | s27 | s28 | s29 | s30 | s31 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
* ------------------------------------------------- *
* |hiddn| v1 | v2 | v3 | v4 | v5 | v6 | v7 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
* ------------------------------------------------- *
* | v8 | lr | pc | FCTX| DATA| | *
* ------------------------------------------------- *
* *
*******************************************************/
.file "jump_arm_aapcs_elf_gas.S"
.text
.globl jump_fcontext
.align 2
.type jump_fcontext,%function
.syntax unified
jump_fcontext:
@ save LR as PC
push {lr}
@ save hidden,V1-V8,LR
push {a1,v1-v8,lr}
@ prepare stack for FPU
sub sp, sp, #64
#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
@ save S16-S31
vstmia sp, {d8-d15}
#endif
@ store RSP (pointing to context-data) in A1
mov a1, sp
@ restore RSP (pointing to context-data) from A2
mov sp, a2
#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
@ restore S16-S31
vldmia sp, {d8-d15}
#endif
@ prepare stack for FPU
add sp, sp, #64
@ restore hidden,V1-V8,LR
pop {a4,v1-v8,lr}
@ return transfer_t from jump
str a1, [a4, #0]
str a3, [a4, #4]
@ pass transfer_t as first arg in context function
@ A1 == FCTX, A2 == DATA
mov a2, a3
@ restore PC
pop {pc}
.size jump_fcontext,.-jump_fcontext
@ Mark that we don't need executable stack.
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 3,189
|
lib_fiber/c/src/fiber/boost/jump_arm_aapcs_macho_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | s24 | s25 | s26 | s27 | s28 | s29 | s30 | s31 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | sjlj|hiddn| v1 | v2 | v3 | v4 | v5 | v6 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | v7 | v8 | lr | pc | FCTX| DATA| | *
* ------------------------------------------------- *
* *
*******************************************************/
.text
.globl _jump_fcontext
.align 2
_jump_fcontext:
@ save LR as PC
push {lr}
@ save hidden,V1-V8,LR
push {a1,v1-v8,lr}
@ locate TLS to save/restore SjLj handler
mrc p15, 0, v2, c13, c0, #3
bic v2, v2, #3
@ load TLS[__PTK_LIBC_DYLD_Unwind_SjLj_Key]
ldr v1, [v2, #8]
@ save SjLj handler
push {v1}
@ prepare stack for FPU
sub sp, sp, #64
#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
@ save S16-S31
vstmia sp, {d8-d15}
#endif
@ store RSP (pointing to context-data) in A1
mov a1, sp
@ restore RSP (pointing to context-data) from A2
mov sp, a2
#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
@ restore S16-S31
vldmia sp, {d8-d15}
#endif
@ prepare stack for FPU
add sp, sp, #64
@ r#estore SjLj handler
pop {v1}
@ store SjLj handler in TLS
str v1, [v2, #8]
@ restore hidden,V1-V8,LR
pop {a4,v1-v8,lr}
@ return transfer_t from jump
str a1, [a4, #0]
str a3, [a4, #4]
@ pass transfer_t as first arg in context function
@ A1 == FCTX, A2 == DATA
mov a2, a3
@ restore PC
pop {pc}
|
acl-dev/acl
| 5,116
|
lib_fiber/c/src/fiber/boost/ontop_riscv64_sysv_elf_gas.S
|
/*
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | fs0 | fs1 | fs2 | fs3 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | fs4 | fs5 | fs6 | fs7 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
* ------------------------------------------------- *
* | fs8 | fs9 | fs10 | fs11 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
* ------------------------------------------------- *
* | s0 | s1 | s2 | s3 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
* ------------------------------------------------- *
* | s4 | s5 | s6 | s7 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
* ------------------------------------------------- *
* | 0xa0| 0xa4| 0xa8| 0xac| 0xb0| 0xb4| 0xb8| 0xbc| *
* ------------------------------------------------- *
* | s8 | s9 | s10 | s11 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 48 | 49 | 50 | 51 | | | | | *
* ------------------------------------------------- *
* | 0xc0| 0xc4| 0xc8| 0xcc| | | | | *
* ------------------------------------------------- *
* | ra | pc | | | *
* ------------------------------------------------- *
* *
*******************************************************/
.file "ontop_riscv64_sysv_elf_gas.S"
.text
.align 1
.global ontop_fcontext
.type ontop_fcontext, %function
ontop_fcontext:
# prepare stack for GP + FPU
addi sp, sp, -0xd0
# save fs0 - fs11
fsd fs0, 0x00(sp)
fsd fs1, 0x08(sp)
fsd fs2, 0x10(sp)
fsd fs3, 0x18(sp)
fsd fs4, 0x20(sp)
fsd fs5, 0x28(sp)
fsd fs6, 0x30(sp)
fsd fs7, 0x38(sp)
fsd fs8, 0x40(sp)
fsd fs9, 0x48(sp)
fsd fs10, 0x50(sp)
fsd fs11, 0x58(sp)
# save s0-s11, ra
sd s0, 0x60(sp)
sd s1, 0x68(sp)
sd s2, 0x70(sp)
sd s3, 0x78(sp)
sd s4, 0x80(sp)
sd s5, 0x88(sp)
sd s6, 0x90(sp)
sd s7, 0x98(sp)
sd s8, 0xa0(sp)
sd s9, 0xa8(sp)
sd s10, 0xb0(sp)
sd s11, 0xb8(sp)
sd ra, 0xc0(sp)
# save RA as PC
sd ra, 0xc8(sp)
# store SP (pointing to context-data) in A3
mv a3, sp
# restore SP (pointing to context-data) from A0
mv sp, a0
# load fs0 - fs11
fld fs0, 0x00(sp)
fld fs1, 0x08(sp)
fld fs2, 0x10(sp)
fld fs3, 0x18(sp)
fld fs4, 0x20(sp)
fld fs5, 0x28(sp)
fld fs6, 0x30(sp)
fld fs7, 0x38(sp)
fld fs8, 0x40(sp)
fld fs9, 0x48(sp)
fld fs10, 0x50(sp)
fld fs11, 0x58(sp)
# load s0-s11,ra
ld s0, 0x60(sp)
ld s1, 0x68(sp)
ld s2, 0x70(sp)
ld s3, 0x78(sp)
ld s4, 0x80(sp)
ld s5, 0x88(sp)
ld s6, 0x90(sp)
ld s7, 0x98(sp)
ld s8, 0xa0(sp)
ld s9, 0xa8(sp)
ld s10, 0xb0(sp)
ld s11, 0xb8(sp)
ld ra, 0xc0(sp)
# return transfer_t from jump
# pass transfer_t as first arg in context function
# a0 == FCTX, a1 == DATA
mv a0, a3
# skip pc
# restore stack from GP + FPU
addi sp, sp, 0xd0
# jump to ontop-function
jr a2
.size ontop_fcontext,.-ontop_fcontext
# Mark that we don't need executable stack.
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 4,095
|
lib_fiber/c/src/fiber/boost/ontop_arm64_aapcs_macho_gas.S
|
/*
Copyright Edward Nevill + Oliver Kowalke 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
* ------------------------------------------------- *
* | d8 | d9 | d10 | d11 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
* ------------------------------------------------- *
* | d12 | d13 | d14 | d15 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
* ------------------------------------------------- *
* | x19 | x20 | x21 | x22 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
* ------------------------------------------------- *
* | x23 | x24 | x25 | x26 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
* ------------------------------------------------- *
* | x27 | x28 | FP | LR | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | | | *
* ------------------------------------------------- *
* | 0xa0| 0xa4| 0xa8| 0xac| | | *
* ------------------------------------------------- *
* | PC | align | | | *
* ------------------------------------------------- *
* *
*******************************************************/
.text
.global _ontop_fcontext
.balign 16
_ontop_fcontext:
; prepare stack for GP + FPU
sub sp, sp, #0xb0
; save d8 - d15
stp d8, d9, [sp, #0x00]
stp d10, d11, [sp, #0x10]
stp d12, d13, [sp, #0x20]
stp d14, d15, [sp, #0x30]
; save x19-x30
stp x19, x20, [sp, #0x40]
stp x21, x22, [sp, #0x50]
stp x23, x24, [sp, #0x60]
stp x25, x26, [sp, #0x70]
stp x27, x28, [sp, #0x80]
stp x29, x30, [sp, #0x90]
; save LR as PC
str x30, [sp, #0xa0]
; store RSP (pointing to context-data) in X5
mov x4, sp
; restore RSP (pointing to context-data) from X1
mov sp, x0
; load d8 - d15
ldp d8, d9, [sp, #0x00]
ldp d10, d11, [sp, #0x10]
ldp d12, d13, [sp, #0x20]
ldp d14, d15, [sp, #0x30]
; load x19-x30
ldp x19, x20, [sp, #0x40]
ldp x21, x22, [sp, #0x50]
ldp x23, x24, [sp, #0x60]
ldp x25, x26, [sp, #0x70]
ldp x27, x28, [sp, #0x80]
ldp x29, x30, [sp, #0x90]
; return transfer_t from jump
; pass transfer_t as first arg in context function
; X0 == FCTX, X1 == DATA
mov x0, x4
; skip pc
; restore stack from GP + FPU
add sp, sp, #0xb0
; jump to ontop-function
ret x2
|
acl-dev/acl
| 1,651
|
lib_fiber/c/src/fiber/boost/make_ppc64_sysv_xcoff_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
.globl make_fcontext[DS]
.globl .make_fcontext[PR]
.align 2
.csect .make_fcontext[PR], 3
.globl _make_fcontext
#._make_fcontext:
# save return address into R6
mflr 6
# first arg of make_fcontext() == top address of context-function
# shift address in R3 to lower 16 byte boundary
clrrwi 3, 3, 4
# reserve space for context-data on context-stack
# including 64 byte of linkage + parameter area (R1 % 16 == 0)
subi 3, 3, 248
# third arg of make_fcontext() == address of context-function
stw 5, 176(3)
# set back-chain to zero
li 0, 0
std 0, 184(3)
# compute address of returned transfer_t
addi 0, 3, 232
mr 4, 0
std 4, 152(3)
# load LR
mflr 0
# jump to label 1
bl .Label
.Label:
# load LR into R4
mflr 4
# compute abs address of label .L_finish
addi 4, 4, .L_finish - .Label
# restore LR
mtlr 0
# save address of finish as return-address for context-function
# will be entered after context-function returns
stw 4, 168(3)
# restore return address from R6
mtlr 6
blr # return pointer to context-data
.L_finish:
# save return address into R0
mflr 0
# save return address on stack, set up stack frame
stw 0, 8(1)
# allocate stack space, R1 % 16 == 0
stwu 1, -32(1)
# exit code is zero
li 3, 0
# exit application
bl ._exit
nop
|
acl-dev/acl
| 7,302
|
lib_fiber/c/src/fiber/boost/jump_ppc64_sysv_elf_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
* ------------------------------------------------- *
* | TOC | R14 | R15 | R16 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
* ------------------------------------------------- *
* | R17 | R18 | R19 | R20 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
* ------------------------------------------------- *
* | R21 | R22 | R23 | R24 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | R25 | R26 | R27 | R28 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | R29 | R30 | R31 | hidden | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
* ------------------------------------------------- *
* | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
* ------------------------------------------------- *
* | CR | LR | PC | back-chain| *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
* ------------------------------------------------- *
* | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
* ------------------------------------------------- *
* | cr saved | lr saved | compiler | linker | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
* ------------------------------------------------- *
* | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
* ------------------------------------------------- *
* | TOC saved | FCTX | DATA | | *
* ------------------------------------------------- *
* *
*******************************************************/
.file "jump_ppc64_sysv_elf_gas.S"
.globl jump_fcontext
#if _CALL_ELF == 2
.text
.align 2
jump_fcontext:
addis %r2, %r12, .TOC.-jump_fcontext@ha
addi %r2, %r2, .TOC.-jump_fcontext@l
.localentry jump_fcontext, . - jump_fcontext
#else
.section ".opd","aw"
.align 3
jump_fcontext:
# ifdef _CALL_LINUX
.quad .L.jump_fcontext,.TOC.@tocbase,0
.type jump_fcontext,@function
.text
.align 2
.L.jump_fcontext:
# else
.hidden .jump_fcontext
.globl .jump_fcontext
.quad .jump_fcontext,.TOC.@tocbase,0
.size jump_fcontext,24
.type .jump_fcontext,@function
.text
.align 2
.jump_fcontext:
# endif
#endif
# reserve space on stack
subi %r1, %r1, 184
#if _CALL_ELF != 2
std %r2, 0(%r1) # save TOC
#endif
std %r14, 8(%r1) # save R14
std %r15, 16(%r1) # save R15
std %r16, 24(%r1) # save R16
std %r17, 32(%r1) # save R17
std %r18, 40(%r1) # save R18
std %r19, 48(%r1) # save R19
std %r20, 56(%r1) # save R20
std %r21, 64(%r1) # save R21
std %r22, 72(%r1) # save R22
std %r23, 80(%r1) # save R23
std %r24, 88(%r1) # save R24
std %r25, 96(%r1) # save R25
std %r26, 104(%r1) # save R26
std %r27, 112(%r1) # save R27
std %r28, 120(%r1) # save R28
std %r29, 128(%r1) # save R29
std %r30, 136(%r1) # save R30
std %r31, 144(%r1) # save R31
#if _CALL_ELF != 2
std %r3, 152(%r1) # save hidden
#endif
# save CR
mfcr %r0
std %r0, 160(%r1)
# save LR
mflr %r0
std %r0, 168(%r1)
# save LR as PC
std %r0, 176(%r1)
# store RSP (pointing to context-data) in R6
mr %r6, %r1
#if _CALL_ELF == 2
# restore RSP (pointing to context-data) from R3
mr %r1, %r3
#else
# restore RSP (pointing to context-data) from R4
mr %r1, %r4
ld %r2, 0(%r1) # restore TOC
#endif
ld %r14, 8(%r1) # restore R14
ld %r15, 16(%r1) # restore R15
ld %r16, 24(%r1) # restore R16
ld %r17, 32(%r1) # restore R17
ld %r18, 40(%r1) # restore R18
ld %r19, 48(%r1) # restore R19
ld %r20, 56(%r1) # restore R20
ld %r21, 64(%r1) # restore R21
ld %r22, 72(%r1) # restore R22
ld %r23, 80(%r1) # restore R23
ld %r24, 88(%r1) # restore R24
ld %r25, 96(%r1) # restore R25
ld %r26, 104(%r1) # restore R26
ld %r27, 112(%r1) # restore R27
ld %r28, 120(%r1) # restore R28
ld %r29, 128(%r1) # restore R29
ld %r30, 136(%r1) # restore R30
ld %r31, 144(%r1) # restore R31
#if _CALL_ELF != 2
ld %r3, 152(%r1) # restore hidden
#endif
# restore CR
ld %r0, 160(%r1)
mtcr %r0
# restore LR
ld %r0, 168(%r1)
mtlr %r0
# load PC
ld %r12, 176(%r1)
# restore CTR
mtctr %r12
# adjust stack
addi %r1, %r1, 184
#if _CALL_ELF == 2
# copy transfer_t into transfer_fn arg registers
mr %r3, %r6
# arg pointer already in %r4
# jump to context
bctr
.size jump_fcontext, .-jump_fcontext
#else
# zero in r3 indicates first jump to context-function
cmpdi %r3, 0
beq use_entry_arg
# return transfer_t
std %r6, 0(%r3)
std %r5, 8(%r3)
# jump to context
bctr
use_entry_arg:
# copy transfer_t into transfer_fn arg registers
mr %r3, %r6
mr %r4, %r5
# jump to context
bctr
# ifdef _CALL_LINUX
.size .jump_fcontext, .-.L.jump_fcontext
# else
.size .jump_fcontext, .-.jump_fcontext
# endif
#endif
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 3,661
|
lib_fiber/c/src/fiber/boost/make_mips32_o32_elf_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
* ------------------------------------------------- *
* | F20 | F22 | F24 | F26 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
* ------------------------------------------------- *
* | F28 | F30 | S0 | S1 | S2 | S3 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
* ------------------------------------------------- *
* | S4 | S5 | S6 | S7 | FP |hiddn| RA | PC | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | ABI ARGS | GP | FCTX| DATA| | *
* ------------------------------------------------- *
* *
* *****************************************************/
.file "make_mips32_o32_elf_gas.S"
.text
.globl make_fcontext
.align 2
.type make_fcontext,@function
.ent make_fcontext
make_fcontext:
#ifdef __PIC__
.set noreorder
.cpload $t9
.set reorder
#endif
# shift address in A0 to lower 16 byte boundary
li $v1, -16 # 0xfffffffffffffff0
and $v0, $v1, $a0
# reserve space for context-data on context-stack
# includes an extra 32 bytes for:
# - 16-byte incoming argument area required by mips ABI used when
# jump_context calls the initial function
# - 4 bytes to save our GP register used in finish
# - 8 bytes to as space for transfer_t returned to finish
# - 4 bytes for alignment
addiu $v0, $v0, -128
# third arg of make_fcontext() == address of context-function
sw $a2, 92($v0)
# save global pointer in context-data
sw $gp, 112($v0)
# compute address of returned transfer_t
addiu $t0, $v0, 116
sw $t0, 84($v0)
# compute abs address of label finish
la $t9, finish
# save address of finish as return-address for context-function
# will be entered after context-function returns
sw $t9, 88($v0)
jr $ra # return pointer to context-data
finish:
# reload our gp register (needed for la)
lw $gp, 16($sp)
# call _exit(0)
# the previous function should have left the 16 bytes incoming argument
# area on the stack which we reuse for calling _exit
la $t9, _exit
move $a0, $zero
jr $t9
.end make_fcontext
.size make_fcontext, .-make_fcontext
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
|
acl-dev/acl
| 4,959
|
lib_fiber/c/src/fiber/boost/make_ppc64_sysv_macho_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
* ------------------------------------------------- *
* | TOC | R14 | R15 | R16 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
* ------------------------------------------------- *
* | R17 | R18 | R19 | R20 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
* ------------------------------------------------- *
* | R21 | R22 | R23 | R24 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | R25 | R26 | R27 | R28 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | R29 | R30 | R31 | hidden | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
* ------------------------------------------------- *
* | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
* ------------------------------------------------- *
* | CR | LR | PC | back-chain| *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
* ------------------------------------------------- *
* | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
* ------------------------------------------------- *
* | cr saved | lr saved | compiler | linker | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
* ------------------------------------------------- *
* | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
* ------------------------------------------------- *
* | TOC saved | FCTX | DATA | | *
* ------------------------------------------------- *
* *
.text
.globl _make_fcontext
_make_fcontext:
; save return address into R6
mflr r6
; first arg of make_fcontext() == top address of context-function
; shift address in R3 to lower 16 byte boundary
clrrwi r3, r3, 4
; reserve space for context-data on context-stack
; including 64 byte of linkage + parameter area (R1 16 == 0)
subi r3, r3, 248
; third arg of make_fcontext() == address of context-function
stw r5, 176(r3)
; set back-chain to zero
li %r0, 0
std %r0, 184(%r3)
; compute address of returned transfer_t
addi %r0, %r3, 232
mr %r4, %r0
std %r4, 152(%r3)
; load LR
mflr r0
; jump to label 1
bl l1
l1:
; load LR into R4
mflr r4
; compute abs address of label finish
addi r4, r4, lo16((finish - .) + 4)
; restore LR
mtlr r0
; save address of finish as return-address for context-function
; will be entered after context-function returns
std r4, 168(r3)
; restore return address from R6
mtlr r6
blr ; return pointer to context-data
finish:
; save return address into R0
mflr r0
; save return address on stack, set up stack frame
stw r0, 8(r1)
; allocate stack space, R1 16 == 0
stwu r1, -32(r1)
; set return value to zero
li r3, 0
; exit application
bl __exit
nop
|
acl-dev/acl
| 3,592
|
lib_fiber/c/src/fiber/boost/make_i386_sysv_macho_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/****************************************************************************************
* *
* ---------------------------------------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ---------------------------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
* ---------------------------------------------------------------------------------- *
* | fc_mxcsr|fc_x87_cw| EDI | ESI | EBX | EBP | EIP | to | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ---------------------------------------------------------------------------------- *
* | 0x20 | | *
* ---------------------------------------------------------------------------------- *
* | data | | *
* ---------------------------------------------------------------------------------- *
* *
****************************************************************************************/
.text
.globl _make_fcontext
.align 2
_make_fcontext:
/* first arg of make_fcontext() == top of context-stack */
movl 0x4(%esp), %eax
/* reserve space for first argument of context-function
eax might already point to a 16byte border */
leal -0x8(%eax), %eax
/* shift address in EAX to lower 16 byte boundary */
andl $-16, %eax
/* reserve space for context-data on context-stack */
leal -0x2c(%eax), %eax
/* third arg of make_fcontext() == address of context-function */
/* stored in EBX */
movl 0xc(%esp), %ecx
movl %ecx, 0x10(%eax)
/* save MMX control- and status-word */
stmxcsr (%eax)
/* save x87 control-word */
fnstcw 0x4(%eax)
/* compute abs address of label trampoline */
call 1f
/* address of trampoline 1 */
1: popl %ecx
/* compute abs address of label trampoline */
addl $trampoline-1b, %ecx
/* save address of trampoline as return address */
/* will be entered after calling jump_fcontext() first time */
movl %ecx, 0x18(%eax)
/* compute abs address of label finish */
call 2f
/* address of label 2 */
2: popl %ecx
/* compute abs address of label finish */
addl $finish-2b, %ecx
/* save address of finish as return-address for context-function */
/* will be entered after context-function returns */
movl %ecx, 0x14(%eax)
ret /* return pointer to context-data */
trampoline:
/* move transport_t for entering context-function */
movl %eax, (%esp)
movl %edx, 0x4(%esp)
pushl %ebp
/* jump to context-function */
jmp *%ebx
finish:
/* exit code is zero */
xorl %eax, %eax
movl %eax, (%esp)
/* exit application */
call __exit
hlt
|
acl-dev/acl
| 5,619
|
lib_fiber/c/src/fiber/boost/ontop_ppc64_sysv_macho_gas.S
|
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
* ------------------------------------------------- *
* | TOC | R14 | R15 | R16 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
* ------------------------------------------------- *
* | R17 | R18 | R19 | R20 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
* ------------------------------------------------- *
* | R21 | R22 | R23 | R24 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | R25 | R26 | R27 | R28 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | R29 | R30 | R31 | hidden | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
* ------------------------------------------------- *
* | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
* ------------------------------------------------- *
* | CR | LR | PC | back-chain| *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
* ------------------------------------------------- *
* | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
* ------------------------------------------------- *
* | cr saved | lr saved | compiler | linker | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
* ------------------------------------------------- *
* | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
* ------------------------------------------------- *
* | TOC saved | FCTX | DATA | | *
* ------------------------------------------------- *
* *
*******************************************************/
.text
.align 2
.globl _ontop_fcontext
_ontop_fcontext:
; reserve space on stack
subi r1, r1, 184
std r14, 8(r1) ; save R14
std r15, 16(r1) ; save R15
std r16, 24(r1) ; save R16
std r17, 32(r1) ; save R17
std r18, 40(r1) ; save R18
std r19, 48(r1) ; save R19
std r20, 56(r1) ; save R20
std r21, 64(r1) ; save R21
std r22, 72(r1) ; save R22
std r23, 80(r1) ; save R23
std r24, 88(r1) ; save R24
std r25, 96(r1) ; save R25
std r26, 104(r1) ; save R26
std r27, 112(r1) ; save R27
std r28, 120(r1) ; save R28
std r29, 128(r1) ; save R29
std r30, 136(r1) ; save R30
std r31, 144(r1) ; save R31
std r3, 152(r1) ; save hidden
; save CR
mfcr r0
std r0, 160(r1)
; save LR
mflr r0
std r0, 168(r1)
; save LR as PC
std r0, 176(r1)
; store RSP (pointing to context-data) in R7
mr r7, r1
; restore RSP (pointing to context-data) from R4
mr r1, r4
ld r14, 8(r1) ; restore R14
ld r15, 16(r1) ; restore R15
ld r16, 24(r1) ; restore R16
ld r17, 32(r1) ; restore R17
ld r18, 40(r1) ; restore R18
ld r19, 48(r1) ; restore R19
ld r20, 56(r1) ; restore R20
ld r21, 64(r1) ; restore R21
ld r22, 72(r1) ; restore R22
ld r23, 80(r1) ; restore R23
ld r24, 88(r1) ; restore R24
ld r25, 96(r1) ; restore R25
ld r26, 104(r1) ; restore R26
ld r27, 112(r1) ; restore R27
ld r28, 120(r1) ; restore R28
ld r29, 128(r1) ; restore R29
ld r30, 136(r1) ; restore R30
ld r31, 144(r1) ; restore R31
ld r4, 152(r1) ; restore hidden
; restore CR
ld r0, 160(r1)
mtcr r0
; restore LR
ld r0, 168(r1)
mtlr r0
; ignore PC
; adjust stack
addi r1, r1, 184
; return transfer_t
std r7, 0(r4)
std r5, 8(r4)
; restore CTR
mtctr r6
; jump to context
bctr
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.