aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--content/2023-01-14-xpost-matcha-threads/gen-svg.sh2
-rw-r--r--content/2023-01-14-xpost-matcha-threads/index.md33
-rw-r--r--content/2023-01-14-xpost-matcha-threads/init-stack.drawio25
-rw-r--r--content/2023-01-14-xpost-matcha-threads/init-stack.svg3
-rw-r--r--content/2023-01-14-xpost-matcha-threads/yield.drawio170
-rw-r--r--content/2023-01-14-xpost-matcha-threads/yield.svg3
6 files changed, 228 insertions, 8 deletions
diff --git a/content/2023-01-14-xpost-matcha-threads/gen-svg.sh b/content/2023-01-14-xpost-matcha-threads/gen-svg.sh
index 365e243..8991440 100644
--- a/content/2023-01-14-xpost-matcha-threads/gen-svg.sh
+++ b/content/2023-01-14-xpost-matcha-threads/gen-svg.sh
@@ -1,3 +1,5 @@
#!/bin/bash
drawio -x -f svg -t --svg-theme dark -o os-vs-user-threads.svg os-vs-user-threads.drawio
+drawio -x -f svg -t --svg-theme dark -o yield.svg yield.drawio
+drawio -x -f svg -t --svg-theme dark -o init-stack.svg init-stack.drawio
diff --git a/content/2023-01-14-xpost-matcha-threads/index.md b/content/2023-01-14-xpost-matcha-threads/index.md
index 3456b09..a916145 100644
--- a/content/2023-01-14-xpost-matcha-threads/index.md
+++ b/content/2023-01-14-xpost-matcha-threads/index.md
@@ -51,14 +51,11 @@ underlying cooperative-multitasking and implement such a `yield()` function as
shown in the example above.
Looking at the final implementation, the yield function does the following:
-```txt
-yield:
- 1. function prologue
- 2. push callee-saved regs to current stack
- 3. swap stack pointers (current - new)
- 4. pop callee-saved regs from new stack
- 5. function epilogue & return
-```
+1. push callee-saved regs to current stack
+2. swap stack pointers (current - new)
+3. pop callee-saved regs from new stack
+
+<img src="yield.svg">
Implementations for different ISAs are available here:
- [x86_64][yield-x86]
@@ -66,6 +63,24 @@ Implementations for different ISAs are available here:
- [armv7a][yield-arm]
- [riscv64][yield-rv64]
+<div style="overflow: auto;">
+<img src="init-stack.svg" style="float: right; width: 20%; padding-left: 2ch;">
+
+Since a thread returns into the last stack-frame of the new thread after
+switching the stack pointers in the yield function, special care must be taken
+when a new stack is created.
+
+The _initial stack_ is setup such that, when yield-ing into the new stack for
+the first time, the stack contains the initial values for the callee-saved
+registers, which yield will restore and the return frame contains an address
+which should be returned to when returning from yield.
+
+An example of setting up the initial stack can be seen in [init_stack
+(x86)][init-stack]. From this it can also be seen that the first time the
+thread will return to [thread_create][thread-create], which just calls into a
+function passed to [init_stack][init-stack].
+</div>
+
## Appendix: os-level vs user-level threading
The figure below depicts *os-level* threading (left) vs *user-level* threading
@@ -89,3 +104,5 @@ to the scheduler, the stack-pointer is switched back to **stack S**.
[yield-arm]: https://github.com/johannst/matcha-threads/blob/master/lib/arch/arm/yield.s
[yield-arm64]: https://github.com/johannst/matcha-threads/blob/master/lib/arch/arm64/yield.s
[yield-rv64]: https://github.com/johannst/matcha-threads/blob/master/lib/arch/riscv64/yield.s
+[init-stack]: https://github.com/johannst/matcha-threads/blob/master/lib/arch/x86_64/init_stack.cc
+[thread-create]: https://github.com/johannst/matcha-threads/blob/master/lib/arch/x86_64/thread_create.s
diff --git a/content/2023-01-14-xpost-matcha-threads/init-stack.drawio b/content/2023-01-14-xpost-matcha-threads/init-stack.drawio
new file mode 100644
index 0000000..eb0859f
--- /dev/null
+++ b/content/2023-01-14-xpost-matcha-threads/init-stack.drawio
@@ -0,0 +1,25 @@
+<mxfile host="Electron" modified="2024-12-17T22:25:02.025Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/23.1.5 Chrome/120.0.6099.109 Electron/28.1.0 Safari/537.36" etag="tKiDaYk_CW1yGI5HMTUf" version="23.1.5" type="device">
+ <diagram name="Page-1" id="eupsqoG42ICuPfNcTmHv">
+ <mxGraphModel dx="683" dy="410" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
+ <root>
+ <mxCell id="0" />
+ <mxCell id="1" parent="0" />
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-1" value="" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;fillColor=none;" parent="1" vertex="1">
+ <mxGeometry x="240" y="400" width="120" height="200" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-2" value="&lt;font&gt;initial&lt;br&gt;stack layout&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=monospace;" parent="1" vertex="1">
+ <mxGeometry x="240" y="360" width="120" height="30" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-4" value="initial values for callee-saved registers" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#ffffff;fillColor=none;" parent="1" vertex="1">
+ <mxGeometry x="240" y="480" width="120" height="50" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-26" value="&lt;font style=&quot;font-size: 11px;&quot;&gt;return frame&lt;br&gt;(thread_create)&lt;br&gt;&lt;/font&gt;" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=default;fillColor=none;fontColor=#FFFFFF;" parent="1" vertex="1">
+ <mxGeometry x="240" y="440" width="120" height="40" as="geometry" />
+ </mxCell>
+ <mxCell id="o6MmRjZrtVa51bDexMuh-1" value="&lt;span style=&quot;font-size: 11px;&quot;&gt;thread_create args&lt;/span&gt;" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=default;fillColor=none;fontColor=#FFFFFF;" vertex="1" parent="1">
+ <mxGeometry x="240" y="400" width="120" height="40" as="geometry" />
+ </mxCell>
+ </root>
+ </mxGraphModel>
+ </diagram>
+</mxfile>
diff --git a/content/2023-01-14-xpost-matcha-threads/init-stack.svg b/content/2023-01-14-xpost-matcha-threads/init-stack.svg
new file mode 100644
index 0000000..2abc191
--- /dev/null
+++ b/content/2023-01-14-xpost-matcha-threads/init-stack.svg
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="121px" height="241px" viewBox="-0.5 -0.5 121 241"><defs/><g><rect x="0" y="40" width="120" height="200" fill="none" stroke="rgb(240, 240, 240)" pointer-events="all"/><rect x="0" y="0" width="120" height="30" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 15px; margin-left: 1px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;"><font>initial<br />stack layout</font></div></div></div></foreignObject><text x="60" y="19" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px" text-anchor="middle">initial...</text></switch></g><rect x="0" y="120" width="120" height="50" fill="none" stroke="#ffffff" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 145px; margin-left: 1px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">initial values for callee-saved registers</div></div></div></foreignObject><text x="60" y="149" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px" text-anchor="middle">initial values for c...</text></switch></g><rect x="0" y="80" width="120" height="40" fill="none" stroke="rgb(240, 240, 240)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 100px; margin-left: 1px;"><div data-drawio-colors="color: #FFFFFF; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(255, 255, 255); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;"><font style="font-size: 11px;">return frame<br />(thread_create)<br /></font></div></div></div></foreignObject><text x="60" y="104" fill="#FFFFFF" font-family="monospace" font-size="12px" text-anchor="middle">return frame...</text></switch></g><rect x="0" y="40" width="120" height="40" fill="none" stroke="rgb(240, 240, 240)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 60px; margin-left: 1px;"><div data-drawio-colors="color: #FFFFFF; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(255, 255, 255); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;"><span style="font-size: 11px;">thread_create args</span></div></div></div></foreignObject><text x="60" y="64" fill="#FFFFFF" font-family="monospace" font-size="12px" text-anchor="middle">thread_create args</text></switch></g></g><switch><g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/><a transform="translate(0,-5)" xlink:href="https://www.drawio.com/doc/faq/svg-export-text-problems" target="_blank"><text text-anchor="middle" font-size="10px" x="50%" y="100%">Text is not SVG - cannot display</text></a></switch></svg> \ No newline at end of file
diff --git a/content/2023-01-14-xpost-matcha-threads/yield.drawio b/content/2023-01-14-xpost-matcha-threads/yield.drawio
new file mode 100644
index 0000000..164a1f1
--- /dev/null
+++ b/content/2023-01-14-xpost-matcha-threads/yield.drawio
@@ -0,0 +1,170 @@
+<mxfile host="Electron" modified="2024-12-17T21:47:19.951Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/23.1.5 Chrome/120.0.6099.109 Electron/28.1.0 Safari/537.36" etag="JAmpZuPaR45DXouftlhj" version="23.1.5" type="device">
+ <diagram name="Page-1" id="eupsqoG42ICuPfNcTmHv">
+ <mxGraphModel dx="1195" dy="718" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
+ <root>
+ <mxCell id="0" />
+ <mxCell id="1" parent="0" />
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-1" value="" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;fillColor=none;" vertex="1" parent="1">
+ <mxGeometry x="240" y="400" width="120" height="240" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-2" value="&lt;font&gt;process address space&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=monospace;" vertex="1" parent="1">
+ <mxGeometry x="240" y="360" width="120" height="30" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-3" value="" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#FFFFFF;fillColor=none;" vertex="1" parent="1">
+ <mxGeometry x="240" y="430" width="120" height="60" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-4" value="" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#ffffff;fillColor=none;" vertex="1" parent="1">
+ <mxGeometry x="240" y="580" width="120" height="40" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-10" value="" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#ffffff;fillColor=#FFFFFF;shadow=0;glass=0;fillStyle=hatch;" vertex="1" parent="1">
+ <mxGeometry x="240" y="430" width="120" height="20" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-12" value="&lt;font face=&quot;monospace&quot;&gt;stack A&lt;/font&gt;" style="text;whiteSpace=wrap;rotation=-90;html=1;" vertex="1" parent="1">
+ <mxGeometry x="350" y="445" width="55" height="30" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-14" value="&lt;font face=&quot;monospace&quot;&gt;stack B&lt;/font&gt;" style="text;whiteSpace=wrap;rotation=-90;html=1;" vertex="1" parent="1">
+ <mxGeometry x="350" y="570" width="55" height="30" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-15" value="" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#ffffff;fillColor=#FFFFFF;shadow=0;glass=0;fillStyle=hatch;" vertex="1" parent="1">
+ <mxGeometry x="240" y="540" width="120" height="40" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-17" value="core" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#FFFFFF;fillColor=none;align=center;verticalAlign=top;" vertex="1" parent="1">
+ <mxGeometry x="80" y="440" width="80" height="60" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-46" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="eODdzWfbsgeiVxMC9DDa-20" target="eODdzWfbsgeiVxMC9DDa-25">
+ <mxGeometry relative="1" as="geometry">
+ <Array as="points">
+ <mxPoint x="200" y="485" />
+ <mxPoint x="200" y="470" />
+ </Array>
+ </mxGeometry>
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-20" value="sp" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#ffffff;fillColor=none;" vertex="1" parent="1">
+ <mxGeometry x="135" y="475" width="20" height="20" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-22" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="eODdzWfbsgeiVxMC9DDa-20" target="eODdzWfbsgeiVxMC9DDa-20">
+ <mxGeometry relative="1" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-25" value="&lt;font style=&quot;font-size: 11px;&quot;&gt;callee-saved regs&lt;/font&gt;" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#50FA7B;fillColor=none;fontColor=#FFFFFF;" vertex="1" parent="1">
+ <mxGeometry x="240" y="450" width="120" height="20" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-26" value="&lt;font style=&quot;font-size: 11px;&quot;&gt;callee-saved regs&lt;/font&gt;" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#ff55ff;fillColor=none;fontColor=#FFFFFF;" vertex="1" parent="1">
+ <mxGeometry x="240" y="580" width="120" height="20" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-29" value="" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;fillColor=none;" vertex="1" parent="1">
+ <mxGeometry x="605" y="400" width="120" height="240" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-30" value="&lt;font&gt;process address space&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=monospace;" vertex="1" parent="1">
+ <mxGeometry x="605" y="360" width="120" height="30" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-31" value="" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#FFFFFF;fillColor=none;" vertex="1" parent="1">
+ <mxGeometry x="605" y="430" width="120" height="60" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-32" value="" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#ffffff;fillColor=none;" vertex="1" parent="1">
+ <mxGeometry x="605" y="580" width="120" height="40" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-33" value="" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#ffffff;fillColor=#FFFFFF;shadow=0;glass=0;fillStyle=hatch;" vertex="1" parent="1">
+ <mxGeometry x="605" y="430" width="120" height="20" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-34" value="stack A" style="text;whiteSpace=wrap;rotation=-90;fillColor=none;fontFamily=monospace;" vertex="1" parent="1">
+ <mxGeometry x="715" y="445" width="55" height="30" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-35" value="stack B" style="text;whiteSpace=wrap;rotation=-90;fontFamily=monospace;" vertex="1" parent="1">
+ <mxGeometry x="715" y="570" width="55" height="30" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-36" value="" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#ffffff;fillColor=#FFFFFF;shadow=0;glass=0;fillStyle=hatch;" vertex="1" parent="1">
+ <mxGeometry x="605" y="540" width="120" height="40" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-44" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="eODdzWfbsgeiVxMC9DDa-72" target="eODdzWfbsgeiVxMC9DDa-48">
+ <mxGeometry relative="1" as="geometry">
+ <mxPoint x="520" y="490.5099999999999" as="sourcePoint" />
+ <mxPoint x="605" y="580" as="targetPoint" />
+ <Array as="points">
+ <mxPoint x="565" y="485" />
+ <mxPoint x="565" y="600" />
+ </Array>
+ </mxGeometry>
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-42" value="&lt;font style=&quot;font-size: 11px;&quot;&gt;callee-saved regs&lt;/font&gt;" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#50FA7B;fillColor=none;fontColor=#FFFFFF;" vertex="1" parent="1">
+ <mxGeometry x="605" y="450" width="120" height="20" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-19" value="regs" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#50FA7B;fillColor=none;fontColor=#FFFFFF;" vertex="1" parent="1">
+ <mxGeometry x="85" y="475" width="45" height="20" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-48" value="&lt;font style=&quot;font-size: 11px;&quot;&gt;callee-saved regs&lt;/font&gt;" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#ff55ff;fillColor=none;fontColor=#FFFFFF;" vertex="1" parent="1">
+ <mxGeometry x="605" y="580" width="120" height="20" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-49" value="" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;fillColor=none;" vertex="1" parent="1">
+ <mxGeometry x="240" y="720" width="120" height="260" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-50" value="&lt;font&gt;process address space&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=monospace;" vertex="1" parent="1">
+ <mxGeometry x="240" y="680" width="120" height="30" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-51" value="" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#FFFFFF;fillColor=none;" vertex="1" parent="1">
+ <mxGeometry x="240" y="750" width="120" height="60" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-52" value="" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#ffffff;fillColor=none;" vertex="1" parent="1">
+ <mxGeometry x="240" y="900" width="120" height="40" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-53" value="" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#ffffff;fillColor=#FFFFFF;shadow=0;glass=0;fillStyle=hatch;" vertex="1" parent="1">
+ <mxGeometry x="240" y="750" width="120" height="20" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-54" value="stack A" style="text;whiteSpace=wrap;rotation=-90;fillColor=none;fontFamily=monospace;" vertex="1" parent="1">
+ <mxGeometry x="350" y="765" width="55" height="30" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-55" value="stack B" style="text;whiteSpace=wrap;rotation=-90;fontFamily=monospace;" vertex="1" parent="1">
+ <mxGeometry x="350" y="890" width="55" height="30" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-56" value="" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#ffffff;fillColor=#FFFFFF;shadow=0;glass=0;fillStyle=hatch;" vertex="1" parent="1">
+ <mxGeometry x="240" y="860" width="120" height="40" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-58" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="eODdzWfbsgeiVxMC9DDa-80">
+ <mxGeometry relative="1" as="geometry">
+ <mxPoint x="240" y="900" as="targetPoint" />
+ <Array as="points">
+ <mxPoint x="200" y="805" />
+ <mxPoint x="200" y="900" />
+ </Array>
+ <mxPoint x="160" y="809" as="sourcePoint" />
+ </mxGeometry>
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-61" value="&lt;font style=&quot;font-size: 11px;&quot;&gt;callee-saved regs&lt;/font&gt;" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#50FA7B;fillColor=none;fontColor=#FFFFFF;" vertex="1" parent="1">
+ <mxGeometry x="240" y="770" width="120" height="20" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-64" value="&lt;font&gt;&lt;i&gt;(1) save callee-saved registers of current thread&lt;/i&gt;&lt;/font&gt;" style="text;html=1;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;fontFamily=monospace;" vertex="1" parent="1">
+ <mxGeometry x="80" y="360" width="140" height="60" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-65" value="&lt;font&gt;&lt;i&gt;(2) move to new stack pointer&lt;/i&gt;&lt;/font&gt;" style="text;html=1;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;fontFamily=monospace;" vertex="1" parent="1">
+ <mxGeometry x="440" y="360" width="140" height="50" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-66" value="&lt;font&gt;&lt;i&gt;(3) restore callee-saved registers of new thread&lt;/i&gt;&lt;/font&gt;" style="text;html=1;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;fontFamily=monospace;" vertex="1" parent="1">
+ <mxGeometry x="80" y="680" width="140" height="60" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-71" value="core" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#FFFFFF;fillColor=none;align=center;verticalAlign=top;" vertex="1" parent="1">
+ <mxGeometry x="440" y="440" width="80" height="60" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-72" value="sp" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#ffffff;fillColor=none;" vertex="1" parent="1">
+ <mxGeometry x="495" y="475" width="20" height="20" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-73" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="eODdzWfbsgeiVxMC9DDa-72" target="eODdzWfbsgeiVxMC9DDa-72">
+ <mxGeometry relative="1" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-74" value="regs" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#50FA7B;fillColor=none;fontColor=#FFFFFF;" vertex="1" parent="1">
+ <mxGeometry x="445" y="475" width="45" height="20" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-79" value="core" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#FFFFFF;fillColor=none;align=center;verticalAlign=top;" vertex="1" parent="1">
+ <mxGeometry x="80" y="760" width="80" height="60" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-80" value="sp" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#ffffff;fillColor=none;" vertex="1" parent="1">
+ <mxGeometry x="135" y="795" width="20" height="20" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-81" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="eODdzWfbsgeiVxMC9DDa-80" target="eODdzWfbsgeiVxMC9DDa-80">
+ <mxGeometry relative="1" as="geometry" />
+ </mxCell>
+ <mxCell id="eODdzWfbsgeiVxMC9DDa-82" value="regs" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=monospace;strokeColor=#FF55FF;fillColor=none;fontColor=#FFFFFF;" vertex="1" parent="1">
+ <mxGeometry x="85" y="795" width="45" height="20" as="geometry" />
+ </mxCell>
+ </root>
+ </mxGraphModel>
+ </diagram>
+</mxfile>
diff --git a/content/2023-01-14-xpost-matcha-threads/yield.svg b/content/2023-01-14-xpost-matcha-threads/yield.svg
new file mode 100644
index 0000000..508a163
--- /dev/null
+++ b/content/2023-01-14-xpost-matcha-threads/yield.svg
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="678px" height="621px" viewBox="-0.5 -0.5 678 621"><defs><pattern patternUnits="userSpaceOnUse" width="11.5" height="11.5" x="0" y="0" patternTransform="rotate(45)" id="mx-pattern-hatch-1-ffffff-0"><line x1="0" y1="0" x2="0" y2="11.5" stroke="#ffffff" stroke-width="1.5"/></pattern></defs><g><rect x="160" y="40" width="120" height="240" fill="none" stroke="rgb(240, 240, 240)" pointer-events="all"/><rect x="160" y="0" width="120" height="30" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 15px; margin-left: 161px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;"><font>process address space</font></div></div></div></foreignObject><text x="220" y="19" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px" text-anchor="middle">process address space</text></switch></g><rect x="160" y="70" width="120" height="60" fill="none" stroke="#ffffff" pointer-events="all"/><rect x="160" y="220" width="120" height="40" fill="none" stroke="#ffffff" pointer-events="all"/><rect x="160" y="70" width="120" height="20" fill="url(#mx-pattern-hatch-1-ffffff-0)" stroke="#ffffff" pointer-events="all"/><rect x="270" y="85" width="55" height="30" fill="none" stroke="none" transform="rotate(-90,297.5,100)" pointer-events="all"/><g transform="translate(-0.5 -0.5)rotate(-90 289.5 125.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 53px; height: 1px; padding-top: 126px; margin-left: 290px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;"><font face="monospace">stack A</font></div></div></div></foreignObject><text x="290" y="138" fill="rgb(240, 240, 240)" font-family="Helvetica" font-size="12px">stack A</text></switch></g><rect x="270" y="210" width="55" height="30" fill="none" stroke="none" transform="rotate(-90,297.5,225)" pointer-events="all"/><g transform="translate(-0.5 -0.5)rotate(-90 289.5 250.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 53px; height: 1px; padding-top: 251px; margin-left: 290px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;"><font face="monospace">stack B</font></div></div></div></foreignObject><text x="290" y="263" fill="rgb(240, 240, 240)" font-family="Helvetica" font-size="12px">stack B</text></switch></g><rect x="160" y="180" width="120" height="40" fill="url(#mx-pattern-hatch-1-ffffff-0)" stroke="#ffffff" pointer-events="all"/><rect x="0" y="80" width="80" height="60" fill="none" stroke="#ffffff" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 78px; height: 1px; padding-top: 87px; margin-left: 1px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">core</div></div></div></foreignObject><text x="40" y="99" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px" text-anchor="middle">core</text></switch></g><path d="M 75 125 L 120 125 L 120 110 L 153.63 110" fill="none" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 158.88 110 L 151.88 113.5 L 153.63 110 L 151.88 106.5 Z" fill="rgb(240, 240, 240)" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="all"/><rect x="55" y="115" width="20" height="20" fill="none" stroke="#ffffff" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 18px; height: 1px; padding-top: 125px; margin-left: 56px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">sp</div></div></div></foreignObject><text x="65" y="129" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px" text-anchor="middle">sp</text></switch></g><rect x="160" y="90" width="120" height="20" fill="none" stroke="#50fa7b" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 100px; margin-left: 161px;"><div data-drawio-colors="color: #FFFFFF; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(255, 255, 255); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;"><font style="font-size: 11px;">callee-saved regs</font></div></div></div></foreignObject><text x="220" y="104" fill="#FFFFFF" font-family="monospace" font-size="12px" text-anchor="middle">callee-saved regs</text></switch></g><rect x="160" y="220" width="120" height="20" fill="none" stroke="#ff55ff" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 230px; margin-left: 161px;"><div data-drawio-colors="color: #FFFFFF; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(255, 255, 255); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;"><font style="font-size: 11px;">callee-saved regs</font></div></div></div></foreignObject><text x="220" y="234" fill="#FFFFFF" font-family="monospace" font-size="12px" text-anchor="middle">callee-saved regs</text></switch></g><rect x="525" y="40" width="120" height="240" fill="none" stroke="rgb(240, 240, 240)" pointer-events="all"/><rect x="525" y="0" width="120" height="30" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 15px; margin-left: 526px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;"><font>process address space</font></div></div></div></foreignObject><text x="585" y="19" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px" text-anchor="middle">process address space</text></switch></g><rect x="525" y="70" width="120" height="60" fill="none" stroke="#ffffff" pointer-events="all"/><rect x="525" y="220" width="120" height="40" fill="none" stroke="#ffffff" pointer-events="all"/><rect x="525" y="70" width="120" height="20" fill="url(#mx-pattern-hatch-1-ffffff-0)" stroke="#ffffff" pointer-events="all"/><rect x="635" y="85" width="55" height="30" fill="none" stroke="none" transform="rotate(-90,662.5,100)" pointer-events="all"/><g transform="translate(-0.5 -0.5)rotate(-90 654.5 125.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 53px; height: 1px; padding-top: 126px; margin-left: 655px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">stack A</div></div></div></foreignObject><text x="655" y="138" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px">stack A</text></switch></g><rect x="635" y="210" width="55" height="30" fill="none" stroke="none" transform="rotate(-90,662.5,225)" pointer-events="all"/><g transform="translate(-0.5 -0.5)rotate(-90 654.5 250.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 53px; height: 1px; padding-top: 251px; margin-left: 655px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">stack B</div></div></div></foreignObject><text x="655" y="263" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px">stack B</text></switch></g><rect x="525" y="180" width="120" height="40" fill="url(#mx-pattern-hatch-1-ffffff-0)" stroke="#ffffff" pointer-events="all"/><path d="M 435 125 L 485 125 L 485 240 L 518.63 240" fill="none" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 523.88 240 L 516.88 243.5 L 518.63 240 L 516.88 236.5 Z" fill="rgb(240, 240, 240)" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="all"/><rect x="525" y="90" width="120" height="20" fill="none" stroke="#50fa7b" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 100px; margin-left: 526px;"><div data-drawio-colors="color: #FFFFFF; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(255, 255, 255); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;"><font style="font-size: 11px;">callee-saved regs</font></div></div></div></foreignObject><text x="585" y="104" fill="#FFFFFF" font-family="monospace" font-size="12px" text-anchor="middle">callee-saved regs</text></switch></g><rect x="5" y="115" width="45" height="20" fill="none" stroke="#50fa7b" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 43px; height: 1px; padding-top: 125px; margin-left: 6px;"><div data-drawio-colors="color: #FFFFFF; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(255, 255, 255); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">regs</div></div></div></foreignObject><text x="28" y="129" fill="#FFFFFF" font-family="monospace" font-size="12px" text-anchor="middle">regs</text></switch></g><rect x="525" y="220" width="120" height="20" fill="none" stroke="#ff55ff" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 230px; margin-left: 526px;"><div data-drawio-colors="color: #FFFFFF; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(255, 255, 255); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;"><font style="font-size: 11px;">callee-saved regs</font></div></div></div></foreignObject><text x="585" y="234" fill="#FFFFFF" font-family="monospace" font-size="12px" text-anchor="middle">callee-saved regs</text></switch></g><rect x="160" y="360" width="120" height="260" fill="none" stroke="rgb(240, 240, 240)" pointer-events="all"/><rect x="160" y="320" width="120" height="30" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 335px; margin-left: 161px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;"><font>process address space</font></div></div></div></foreignObject><text x="220" y="339" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px" text-anchor="middle">process address space</text></switch></g><rect x="160" y="390" width="120" height="60" fill="none" stroke="#ffffff" pointer-events="all"/><rect x="160" y="540" width="120" height="40" fill="none" stroke="#ffffff" pointer-events="all"/><rect x="160" y="390" width="120" height="20" fill="url(#mx-pattern-hatch-1-ffffff-0)" stroke="#ffffff" pointer-events="all"/><rect x="270" y="405" width="55" height="30" fill="none" stroke="none" transform="rotate(-90,297.5,420)" pointer-events="all"/><g transform="translate(-0.5 -0.5)rotate(-90 289.5 445.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 53px; height: 1px; padding-top: 446px; margin-left: 290px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">stack A</div></div></div></foreignObject><text x="290" y="458" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px">stack A</text></switch></g><rect x="270" y="530" width="55" height="30" fill="none" stroke="none" transform="rotate(-90,297.5,545)" pointer-events="all"/><g transform="translate(-0.5 -0.5)rotate(-90 289.5 570.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 53px; height: 1px; padding-top: 571px; margin-left: 290px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">stack B</div></div></div></foreignObject><text x="290" y="583" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px">stack B</text></switch></g><rect x="160" y="500" width="120" height="40" fill="url(#mx-pattern-hatch-1-ffffff-0)" stroke="#ffffff" pointer-events="all"/><path d="M 75 445 L 120 445 L 120 540 L 153.63 540" fill="none" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 158.88 540 L 151.88 543.5 L 153.63 540 L 151.88 536.5 Z" fill="rgb(240, 240, 240)" stroke="rgb(240, 240, 240)" stroke-miterlimit="10" pointer-events="all"/><rect x="160" y="410" width="120" height="20" fill="none" stroke="#50fa7b" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 420px; margin-left: 161px;"><div data-drawio-colors="color: #FFFFFF; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(255, 255, 255); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;"><font style="font-size: 11px;">callee-saved regs</font></div></div></div></foreignObject><text x="220" y="424" fill="#FFFFFF" font-family="monospace" font-size="12px" text-anchor="middle">callee-saved regs</text></switch></g><rect x="0" y="0" width="140" height="60" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 138px; height: 1px; padding-top: 7px; margin-left: 2px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;"><font><i>(1) save callee-saved registers of current thread</i></font></div></div></div></foreignObject><text x="2" y="19" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px">(1) save callee-saved r...</text></switch></g><rect x="360" y="0" width="140" height="50" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 138px; height: 1px; padding-top: 7px; margin-left: 362px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;"><font><i>(2) move to new stack pointer</i></font></div></div></div></foreignObject><text x="362" y="19" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px">(2) move to new stack p...</text></switch></g><rect x="0" y="320" width="140" height="60" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 138px; height: 1px; padding-top: 327px; margin-left: 2px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;"><font><i>(3) restore callee-saved registers of new thread</i></font></div></div></div></foreignObject><text x="2" y="339" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px">(3) restore callee-save...</text></switch></g><rect x="360" y="80" width="80" height="60" fill="none" stroke="#ffffff" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 78px; height: 1px; padding-top: 87px; margin-left: 361px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">core</div></div></div></foreignObject><text x="400" y="99" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px" text-anchor="middle">core</text></switch></g><rect x="415" y="115" width="20" height="20" fill="none" stroke="#ffffff" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 18px; height: 1px; padding-top: 125px; margin-left: 416px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">sp</div></div></div></foreignObject><text x="425" y="129" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px" text-anchor="middle">sp</text></switch></g><rect x="365" y="115" width="45" height="20" fill="none" stroke="#50fa7b" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 43px; height: 1px; padding-top: 125px; margin-left: 366px;"><div data-drawio-colors="color: #FFFFFF; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(255, 255, 255); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">regs</div></div></div></foreignObject><text x="388" y="129" fill="#FFFFFF" font-family="monospace" font-size="12px" text-anchor="middle">regs</text></switch></g><rect x="0" y="400" width="80" height="60" fill="none" stroke="#ffffff" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 78px; height: 1px; padding-top: 407px; margin-left: 1px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">core</div></div></div></foreignObject><text x="40" y="419" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px" text-anchor="middle">core</text></switch></g><rect x="55" y="435" width="20" height="20" fill="none" stroke="#ffffff" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 18px; height: 1px; padding-top: 445px; margin-left: 56px;"><div data-drawio-colors="color: rgb(240, 240, 240); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(240, 240, 240); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">sp</div></div></div></foreignObject><text x="65" y="449" fill="rgb(240, 240, 240)" font-family="monospace" font-size="12px" text-anchor="middle">sp</text></switch></g><rect x="5" y="435" width="45" height="20" fill="none" stroke="#ff55ff" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 43px; height: 1px; padding-top: 445px; margin-left: 6px;"><div data-drawio-colors="color: #FFFFFF; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(255, 255, 255); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">regs</div></div></div></foreignObject><text x="28" y="449" fill="#FFFFFF" font-family="monospace" font-size="12px" text-anchor="middle">regs</text></switch></g></g><switch><g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/><a transform="translate(0,-5)" xlink:href="https://www.drawio.com/doc/faq/svg-export-text-problems" target="_blank"><text text-anchor="middle" font-size="10px" x="50%" y="100%">Text is not SVG - cannot display</text></a></switch></svg> \ No newline at end of file