1)So in the book that I'm reading it says for example changing IR register does not require switching from user mode to kernel mode, but i don't get it, how can i know if it requires switching or not?
2)also what about other registers, like DR, PSW, PC etc, how can i know whether it requires switching or not?
3)one last problem is that at some point the book says something like : changing the value of "memory management registers" requires kernel mode, but i don't even know what this register is?!
In most systems one can place registers into three groups:
1) General Registers: These are registers the process can change at will.
2) Process Definition Register: These are registers can only be changed in kernel mode. Such registers generally include the Processor Status and registers defining the process address space. Note that the value of the Processor Status can be altered in user mode through instructions but the the value of the register cannot be set in user mode.
3) System Register: These are registers shared by all processes. These change only be changed in kernel mode. For example,there is usually a register that defines the location of the interrupt vector.
1)So in the book that I'm reading it says for example changing IR register does not require switching from user mode to kernel mode, but i don't get it,
What is the "IR" register. Is that is usually known as the Program Counter (PC)? If so that can be changed in user mode.
how can i know if it requires switching or not? and 2)also what about other registers, like DR, PSW, PC etc, how can i know whether it requires switching or not?
You have to read the manual for your processor. But, if it isn't a general register, you need to be in kernel mode to change it.
If your register is R0, R1, R2, .... or has an alias like SP, BP,PC you can change in user mode. Otherwise, assume it needs kernel mode.
3)one last problem is that at some point the book says something like : changing the value of "memory management registers" requires kernel mode, but i don't even know what this register is?!
Those depend upon your processor.