Re: RESTORE_ALL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;    \
> 
> Now, I understand the exception table stuff (fault at 1 ends up at 4 etc.) but I am
> unable to fathom what it's actually for. Ideas ?

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.

-- 

Mark Zealey (aka JALH on irc.openprojects.net: #zealos and many more)
mark@zealos.org
mark@itsolve.co.uk

UL++++>$ G!>(GCM/GCS/GS/GM) dpu? s:-@ a16! C++++>$ P++++>+++++$ L+++>+++++$
!E---? W+++>$ N- !o? !w--- O? !M? !V? !PS !PE--@ PGP+? r++ !t---?@ !X---?
!R- b+ !tv b+ DI+ D+? G+++ e>+++++ !h++* r!-- y--

(www.geekcode.com)
--
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/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux