Hi, Petr Vandrovec wrote: >> The reason is that the previous part of the macro >> can jump to that part. So how can I divide those? > Use real labels instead of numeric local labels. OK, I am really sorry for asking such a crap :( >> returning to the kernel if fails, should die() >> anyway. Is this correct? > If you'll first test result of lar, and then > you'll do two independent RESTORE_REGS (second > setup, instead of doing push + pop), you can reuse > RESOTRE_REGS+add $4,%esp+iret return path, including > its exception handling. Yes, but I was wondering whether we really do need an exception handler when returning to kernel. There should be no fault there, and if there is - it should be an Oops, I think. Nevertheless, I did what you said. Perhaps something like die_if_kernel() is somewhere down the road anyway. > Patch looks fine, though you could speedup it a bit as outlined above. New patch is attached. > Now you have to persuade others that this patch should include patch > into the kernel. Yes, if not for that anonymous guy, who kept posting to me until he finally convinced me that the Ring-0 approach is not that difficult at all. So I tried... It was much more difficult to code up, but at the end it looks a little better and localized to entry.S completely. OTOH it touches the exception handlers, but not too much - it adds only 5 insns on the fast path. And the code is very fragile, but after I made all the magic numbers a #define consts, it actually looks not so bad. I don't know which patch is really better, so I am attaching both. Any ideas on which one should I have to continue working on and what improvements can be done to either one?