Skip to contentSkip to conversation

Tiny pivot root for asmutils-collection ...

DISCUSSION Fabian Franz 2 participants 2 messages Dec 9, 2002

lore
Share & tools
lore
#0 lore 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

#1 lore raw

man x86<instruction>

Hi list,
Is there UNIX man pages available for x86/avr/mips/sparc instructions somwhere?
It would be nice to be able to write for example 'man x86lea' instead of scanning the instruction set reference file.

// Claes

------------------------------------------------------------------------------
Home: http://www.mdstud.chalmers.se/~md0claes/
------------------------------------------------------------------------------
Citation :
The number of UNIX installations has grown to 10, with more expected. _The UNIX Programmer's Manual_, Second Edition, June, 1972
------------------------------------------------------------------------------