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?
Asked
Active
Viewed 228 times
1
-
2Use 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
-
1You 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