Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Inline i386 assembly JAPH

by rpc (Monk)
on Jan 06, 2001 at 04:57 UTC ( #50182=obfuscated: print w/replies, xml ) Need Help??

I was playing with Brian Ingerson's excellent Inline.pm and decided to do something funky. This only works on i386/Linux (Well, it might work on BSD. I think the syscalls are the same. Haven't tested it.)
#!/usr/bin/perl -w use strict; use less 'on non-i386 architectures'; &japh("japh!"); use Inline C => <<'JAPH'; int japh(char *j) { asm (" jmp jap_h j_aph: popl %ecx xorl %eax, %eax incb %al movl %eax, %ebx shl $0x2, %al movl %ebx, %edx shl $0x4, %dl addb $0xa, %dl int $0x80 xorl %eax, %eax incb %al int $0x80 jap_h: call j_aph .asciz \"Just Another Perl Hacker.\\n\" "); } JAPH

Replies are listed 'Best First'.
Re: Inline i386 assembly JAPH
by strredwolf (Chaplain) on Jan 06, 2001 at 23:06 UTC
    I think you should of tested to make sure you're on a Linux/ix86 system.

    $_=`uname -a'; die "Not Linux/ix86!" unless (/Linux/ && /86/);

    --
    $Stalag99{"URL"}="http://stalag99.keenspace.com";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://50182]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2023-01-30 17:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?