##########################################################################
##
## This file is part of the Coroutine library
##
## Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
##
## Contact: Nokia Corporation (qt-info@nokia.com)
##
## Commercial Usage
##
## Licensees holding valid Qt Commercial licenses may use this file in
## accordance with the Qt Commercial License Agreement provided with the
## Software or, alternatively, in accordance with the terms contained in
## a written agreement between you and Nokia.
##
## GNU Lesser General Public License Usage
##
## Alternatively, this file may be used under the terms of the GNU Lesser
## General Public License version 2.1 as published by the Free Software
## Foundation and appearing in the file LICENSE.LGPL included in the
## packaging of this file.  Please review the following information to
## ensure the GNU Lesser General Public License version 2.1 requirements
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
##
## If you are unsure which license is appropriate for your use, please
## contact the sales department at http://qt.nokia.com/contact.
##
##########################################################################

.text
.globl _switchStackInternal


        /* void _switchStackInternal(void* to, void** from) */
_switchStackInternal:
        sub sp, sp, 160

        stp x19,x20, [sp]
        stp x21,x22, [sp,#16]
        stp x23,x24, [sp,#32]
        stp x25,x26, [sp,#48]
        stp x27,x28, [sp,#64]
        stp d8,d9, [sp,#80]
        stp d10,d11, [sp,#96]
        stp d12,d13, [sp,#112]
        stp d14,d15, [sp,#128]
        stp x29,x30,  [sp,#144] 

        mov x3, sp 
        str x3, [x1]
        mov sp, x0   


        ldp x19,x20, [sp]
        ldp x21,x22, [sp,#16]
        ldp x23,x24, [sp,#32]
        ldp x25,x26, [sp,#48]
        ldp x27,x28,[sp,#64]
        ldp d8,d9, [sp,#80]
        ldp d10,d11, [sp,#96]
        ldp d12,d13, [sp,#112]    ;
        ldp d14,d15, [sp,#128]
        ldp x29,x30, [sp,#144]
	add sp,sp,160
        br x30
