1 /* Windows i386 support code for fibers and multithreading.
2 Copyright (C) 2019-2020 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 Under Section 7 of GPL version 3, you are granted additional
17 permissions described in the GCC Runtime Library Exception, version
18 3.1, as published by the Free Software Foundation.
20 You should have received a copy of the GNU General Public License and
21 a copy of the GCC Runtime Library Exception along with this program;
22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 <http://www.gnu.org/licenses/>. */
25 #include "../common/threadasm.S"
27 #if defined(__x86_64__)
30 .globl CSYM(fiber_switchContext)
31 .type CSYM(fiber_switchContext), @function
33 CSYM(fiber_switchContext):
48 // load newp to begin context switch
51 // load saved state from new stack
62 // 'return' to complete switch
66 .size CSYM(fiber_switchContext),.-CSYM(fiber_switchContext)
71 .globl CSYM(fiber_switchContext)
72 .type CSYM(fiber_switchContext), @function
74 CSYM(fiber_switchContext):
76 // Save current stack state.save current stack state
77 // Standard CDECL prologue.
88 // store oldp again with more accurate address
91 // load newp to begin context switch
94 // load saved state from new stack
104 // 'return' to complete switch
107 .size CSYM(fiber_switchContext),.-CSYM(fiber_switchContext)