On Wed, Jan 16, 2002 at 08:00:17AM +0000, Mark Zealey wrote: > On Wed, Jan 16, 2002 at 05:44:56AM +0000, John Levon wrote: > > > > > can someone explain the purpose of this code : > > > > #define RESTORE_ALL \ > > [snip] > > 1: popl %ds; \ > > 2: popl %es; \ > > addl $4,%esp; \ > > 3: iret; \ > > .section .fixup,"ax"; \ > > 4: movl $0,(%esp); \ > > jmp 1b; \ > > 5: movl $0,(%esp); \ > > jmp 2b; \ > > 6: pushl %ss; \ > > popl %ds; \ > > pushl %ss; \ > > popl %es; \ > > pushl $11; \ > > call do_exit; \ > > .previous; \ > > .section __ex_table,"a";\ > > .align 4; \ > > .long 1b,4b; \ > > .long 2b,5b; \ > > .long 3b,6b; \ > > > OK, I was gonna say 'I dunno' but, looking closer at it, it looks like it > handles the cases where we were called from an invalid ds or es, or if we can't > iret (bad cs/esp/ss/eip/whatever). In the first 2, it just writes 0 to them, in > the last case, it kills the process. > What is the point in writing 0 to ds and es. Won't this fault again later when referenced. Or is that, fault generation is postponed to user space ? (Assuming that it enters user space after RESTORE_ALL) Regards, Bharata. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ IRC Channel: irc.openprojects.net / #kernelnewbies Web Page: http://www.kernelnewbies.org/