]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/gccint/the-gcc-low-level-runtime-library/miscellaneous-runtime-library-routines.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / doc / gccint / the-gcc-low-level-runtime-library / miscellaneous-runtime-library-routines.rst
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. _miscellaneous-routines:
7
8 Miscellaneous runtime library routines
9 **************************************
10
11 Cache control functions
12 ^^^^^^^^^^^^^^^^^^^^^^^
13
14 .. function:: void __clear_cache (char *beg, char *end)
15
16 This function clears the instruction cache between :samp:`{beg}` and :samp:`{end}`.
17
18 Split stack functions and variables
19 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20
21 .. function:: void * __splitstack_find (void *segment_arg, void *sp, size_t len, void **next_segment, void **next_sp, void **initial_sp)
22
23 When using :option:`-fsplit-stack`, this call may be used to iterate
24 over the stack segments. It may be called like this:
25
26 .. code-block:: c++
27
28 void *next_segment = NULL;
29 void *next_sp = NULL;
30 void *initial_sp = NULL;
31 void *stack;
32 size_t stack_size;
33 while ((stack = __splitstack_find (next_segment, next_sp,
34 &stack_size, &next_segment,
35 &next_sp, &initial_sp))
36 != NULL)
37 {
38 /* Stack segment starts at stack and is
39 stack_size bytes long. */
40 }
41
42 There is no way to iterate over the stack segments of a different
43 thread. However, what is permitted is for one thread to call this
44 with the :samp:`{segment_arg}` and :samp:`{sp}` arguments NULL, to pass
45 :samp:`{next_segment}`, :samp:`{next_sp}`, and :samp:`{initial_sp}` to a different
46 thread, and then to suspend one way or another. A different thread
47 may run the subsequent ``__splitstack_find`` iterations. Of
48 course, this will only work if the first thread is suspended while the
49 second thread is calling ``__splitstack_find``. If not, the second
50 thread could be looking at the stack while it is changing, and
51 anything could happen.
52
53 .. c:var:: struct stack_segment *__morestack_segments
54
55 .. c:var:: stack_segment * __morestack_current_segment
56
57 .. c:var:: struct initial_sp __morestack_initial_sp
58
59 Internal variables used by the :option:`-fsplit-stack` implementation.