> I have seen the following codes, but do not know
what's the meaning of them:
> mm_segment_t old_fs;
> old_fs = get_fs();
> set_fs (KERNEL_DS);
> ........
> set_fs(old_fs);
> What is the usage of these codes and in what condition they will be used?
> mm_segment_t old_fs;
> old_fs = get_fs();
> set_fs (KERNEL_DS);
> ........
> set_fs(old_fs);
> What is the usage of these codes and in what condition they will be used?
If you want to invoke a sys
call from the kernel space, then you need to save the kernel data segment before
the call and restore that after you are done.
The piece of code you mention does exactly that.
The piece of code you mention does exactly that.
Thanks,
Saumendra
Saumendra