Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6334

Where I should use "swapgs" instruction

$
0
0

Hi I'm a kernel learner and have some questions about swapgs.

According to AMD's documentation, it swaps the gs.base hidden register and KernelGSBase MSR.

Furthermore, the addressing with "gs:XXXX" are calculated as "gs.base + base + (scale*index) + displacement"


Now my first question is:

  1. gs.base is the hidden part of segment register
  2. displacement is the "XXXX" part of "gs:XXXX"
  3. index may be the selector index in gs

Then where I should store the "base" and "scale"?


Furthermore, where I should use it, my current project put upper half of the virtual memory space as kernel, and the compiler will not usually add "gs:XXXX" as addressing reference.

So where, in particular, I should use the swapgs instruction.


Viewing all articles
Browse latest Browse all 6334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>