Re: remove the last set_fs() in common code, and remove it for x86 and powerpc v3

From: Linus Torvalds
Date: Fri Sep 04 2020 - 14:45:16 EST


On Fri, Sep 4, 2020 at 10:58 AM Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote:
>
> set_fs() is older than some kernel hackers!
>
> $ cd linux-0.11/
> $ find . -type f -name '*.h' | xargs grep -e set_fs -w -n -A3

Oh, it's older than that. It was there (as set_fs) in 0.10, and may
even predate that. But sadly, I don't have tar-balls for 0.02 and
0.03, so can't check.

The actual use of %fs as the user space segment is already there in
0.01, but there was no 'set_fs()'. That was a simpler and more direct
time, and "get_fs()" looked like this back then:

#define _fs() ({ \
register unsigned short __res; \
__asm__("mov %%fs,%%ax":"=a" (__res):); \
__res;})

and all the setting was basically part of the kernel entry asm and. Lovely.

Linus