What happens if the CS segment register is changed? (How would you do that?)

I read this article: http://static.patater.com/gbaguy/day3pc.htm

It includes an offer

DO NOT CHANGE CS !!

But what exactly happens if you change the case of segments CS? Why is it so dangerous?

+5
source share
2 answers

csis a code segment. cs:ip, which means csalong with ip(instruction pointer) indicates the location of the next command. Thus, any change to csor ipor both changes the address from which the following command will be extracted and executed.

cs jmp ( ), call ( ), retf, int3, int iret. 8088 8086 pop cs ( 0x0F). pop cs 186+, 0x0F . http://en.wikipedia.org/wiki/X86_instruction_listings

. , , . 16- (, DOS) , , . jmp 0xF000:0xFFF0 cs 0xF000 ip 0xFFF0, BIOS , , . , , , ( BIOS, , / , ' '). jmp call , , ( , ..) .

+7

(.. 16- ) , CS, 4 . + ( = 0 = 4 , .. ), .

(, 32- 64- ). 64- 64- far jmp 32- . , .

TODO: , - , . , , .

-1

All Articles