linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabian Franz <FabianFranz@gmx.de>
To: linux-assembly@vger.kernel.org
Subject: Tiny pivot root for asmutils-collection ...
Date: Mon, 9 Dec 2002 01:23:19 +0100	[thread overview]
Message-ID: <200212090123.19389.FabianFranz@gmx.de> (raw)

I needed it for an initrd-project:

section .text           ; declaring our .text segment
        global  _start  ; telling where program execution should start

        _start:                 ; this is where code starts getting exec'ed
        pop     ebx             ; argc
        pop     ebx             ; argv[0]
        pop     ebx             ; the first real arg, new_root
        pop     ecx             ; the first real arg, put_old


        mov     eax,217         ; the syscall number for pivot_root
                                ; we already have the new_root in ebx and 
put_old in ecx

        int     80h             ; call the kernel

        mov     ebx,eax         ; save the errno in ebx
        mov     eax,1           ; put the exit syscall number in eax
        int     80h             ; bail out

It was pretty easy to program; thx to the great tutorials on 
linuxassembly.org. Perhaps you have a use for it ? Its GPL, so feel free to 
add it ...

cu

Fabian

             reply	other threads:[~2002-12-09  0:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-09  0:23 Fabian Franz [this message]
2002-12-09 15:11 ` man x86<instruction> Claes Nyberg

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=200212090123.19389.FabianFranz@gmx.de \
    --to=fabianfranz@gmx.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).