Skip to contentSkip to conversation

should we use $(__USER_DS) or $(__KERNEL_DS) when entering interrupt handlers?

DISCUSSION Yang 1 participant 1 message Mar 18, 2010

lore
Share & tools
lore

Yang

author
#0 lore raw

in handling an interrupt, kernel first saves all the register contents , in the SAVE_ALL macro, in the last part of this macro,  it adjusts the data segment selectors for kernel mode.

in kernel 2.4, the __KERNEL_DS segment is loaded into %ds and %es, at line 98 of:

http://lxr.linux.no/#linux-old+v2.4.31/arch/i386/kernel/entry.S

but in kernel 2.6, __USER_DS segment is loaded into %ds and %es, at line 227 of :
http://lxr.linux.no/#linux+v2.6.33/arch/x86/kernel/entry_32.S

I understand that on x86, all the data segment selector contents are basically the same, but semantically it's better to use the KERNEL_DS because we are working in kernel mode?

Thanks!
Yang