1

I would like to know how it is possible to access CS, Since I know this is impossible to do MOV CS, SOME_VALUE. my question is how the loader can load something to CS. Should I use the IP?

Amitay Tsinis
  • 320
  • 3
  • 12
  • 2
    Use a far jump. – Jester Jan 30 '19 at 14:47
  • For example. let's assume I have in the main some code. how is it possible to load it to the CS can you explain? – Amitay Tsinis Jan 30 '19 at 14:49
  • 1
    You want to load code into CS? That makes no sense. – m0skit0 Jan 30 '19 at 14:52
  • I want to understand what I should do instead of MOV CS, SOMEVALUE because this is illegal. – Amitay Tsinis Jan 30 '19 at 14:58
  • 5
    "use the far jump" was the first comment. https://www.felixcloutier.com/x86/jmp ... that said, make sure you have code in the target code segment ready to be executed, because obviously the jump will jump there. You can't load `cs` with some "value" like any value, as the CPU is using `cs:ip` for every next instruction fetch, so the `cs` must point all the time to the memory segment where your running code is. (or more precise is: "where-ever the `cs` points, there the CPU continues to execute instructions, even if there is garbage instead of regular code") – Ped7g Jan 30 '19 at 15:01
  • thanks a lot for the explanation. – Amitay Tsinis Jan 30 '19 at 15:04

0 Answers0