Stack sizes – Creating Our Own FibersStack sizes – Creating Our Own Fibers
Note The actual addresses you get will be different every time you run the program. In other words, the values 240, 205, 252, 56, 67, 86, 0, 0 represent the
Note The actual addresses you get will be different every time you run the program. In other words, the values 240, 205, 252, 56, 67, 86, 0, 0 represent the
Tip As we end the program in an endless loop, you’ll have to exit by pressing Ctrl + C. OK, so what happened? We didn’t call the function hello at
Options The last thing we need to introduce to get a minimal understanding of Rust’s inline assembly for now is the options keyword. After the input and output parameters, you’ll
We’ll use the body of our gt_switch function as a starting point by going through everything step by step. If you haven’t used inline assembly before, this might look foreign,
Now, this is where it gets a little difficult. On the x86-64 instruction set, there is no way for us to manipulate rip directly, so we have to use a
There seems to be an issue in macOS using such a small stack. The minimum for this code to run is a stack size of 624 bytes. The code works
Note We will use the Intel dialect in our examples. Assembly has strong backward compatibility guarantees. That’s why you will see that the same registers are addressed in different ways.
As mentioned earlier, this architecture of the CPU features a set of 16 general-purpose 64-bit registers, 16 SSE registers with 128-bit width, and 8 floating point registers with 80-bit width:
The x86-64 ISA defines 16 general-purpose registers. These are registers the CPU provides for programmers to use for whatever they see fit. Note that programmers here include the ones that
To find the architecture on your current system, run one of the following commands in your terminal: On Linux and MacOS: arch or uname -m On Windows PowerShell: $env:PROCESSOR_ARCHITECTURE On