All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ed Reed <ed.reed@aesec.com>
To: linux-assembly@vger.kernel.org
Subject: Question about entry.S RESTORE_REGS macro
Date: Mon, 25 Sep 2006 12:26:38 -0400	[thread overview]
Message-ID: <4518033E.7080903@aesec.com> (raw)

I'm looking at the entry / exit routines to the kernel in 
arch/i386/kernel/entry.S, and at the entry conditions for 
ret_from_fork() that is also defined there....

And looking at the assembler macro defined at the top of the file, 
RESTORE_REGS, I'm trying to figure out what the ELF section stuff is 
doing there - have you a clue, or a pointer you give me as to whom to 
ask?  I don't THINK it's relevant to my current efforts, but I'd like to 
understand what's going on.

code:

#define SAVE_ALL \
       cld; \
       pushl %es; \
       pushl %ds; \
       pushl %eax; \
       pushl %ebp; \
       pushl %edi; \
       pushl %esi; \
       pushl %edx; \
       pushl %ecx; \
       pushl %ebx; \
       movl $(__USER_DS), %edx; \
       movl %edx, %ds; \
       movl %edx, %es;

#define RESTORE_INT_REGS \
       popl %ebx;      \
       popl %ecx;      \
       popl %edx;      \
       popl %esi;      \
       popl %edi;      \
       popl %ebp;      \
       popl %eax

#define RESTORE_REGS    \
       RESTORE_INT_REGS; \
1:      popl %ds;       \
2:      popl %es;       \
.section .fixup,"ax";   \
3:      movl $0,(%esp); \
       jmp 1b;         \
4:      movl $0,(%esp); \
       jmp 2b;         \
.previous;              \
.section __ex_table,"a";\
       .align 4;       \
       .long 1b,3b;    \
       .long 2b,4b;    \
.previous


The SAVE_ALL and RESTORE_INT_REGS seem pretty straight forward, but in 
RESTORE_REGS, are the two section entries and labels creating relocation 
entries for the popl %ds and %es instructions?

Newbie question, I suppose, but that's the only think I can see that 
would make sense, and don't know who else to ask.



                 reply	other threads:[~2006-09-25 16:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4518033E.7080903@aesec.com \
    --to=ed.reed@aesec.com \
    --cc=linux-assembly@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.