By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,376 Members | 1,566 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,376 IT Pros & Developers. It's quick & easy.

Dealing with illegal instruction

P: n/a
Hello friends,

I'm writing a program in C with some bits in inline asm for efficiency.
I'd like to be able to handle illegal instructions from within asm.

Here's an example of a standalone asm program,

..data

..text

..globl _start
_start:

..byte 0xff
..byte 0xff
..byte 0xff

movl $1,%eax
movl $0,%ebx
int $0x80

This generates an illegal instruction but I'd like to be able to ignore
that.

Thanks.
Apr 11 '08 #1
Share this Question
Share on Google+
8 Replies


P: n/a
On 11 Apr 2008 at 12:20, jacob navia wrote:
Just another C hacker wrote:
>Hello friends,

I'm writing a program in C with some bits in inline asm for efficiency.
I'd like to be able to handle illegal instructions from within asm.
[snip]
>This generates an illegal instruction but I'd like to be able to ignore
that.

You have 3 illegal instructions, not one.
And why you add them in the first place?

Wouldn't it be better to delete the 3
.byte ff
???????
Jacob is right that what you're asking doesn't seem to make much sense -
maybe if you explain what you're ultimately trying to achieve then that
would help.

If you just want to catch illegal instructions, then you can use the C
signal function to install a handler for SIGILL (which has numerical
value 4).

Apr 11 '08 #2

P: n/a
Look I don't think it's any of your business what I'm doing, either
answer the question or don't bother.

Yeah signal is ok, but it doesn't let me know which was the address of
the illegal operation that was attempted.
Antoninus Twink wrote:
On 11 Apr 2008 at 12:20, jacob navia wrote:
>>Just another C hacker wrote:
>>>Hello friends,

I'm writing a program in C with some bits in inline asm for efficiency.
I'd like to be able to handle illegal instructions from within asm.

[snip]
>>>This generates an illegal instruction but I'd like to be able to ignore
that.

You have 3 illegal instructions, not one.
And why you add them in the first place?

Wouldn't it be better to delete the 3
.byte ff
???????


Jacob is right that what you're asking doesn't seem to make much sense -
maybe if you explain what you're ultimately trying to achieve then that
would help.

If you just want to catch illegal instructions, then you can use the C
signal function to install a handler for SIGILL (which has numerical
value 4).
Apr 11 '08 #3

P: n/a
In article <ft**********@aioe.org>, Just another C hacker <no@spam.comwrote:
>Look I don't think it's any of your business what I'm doing, either
answer the question or don't bother.
What's in it for us?

-- Richard
--
:wq
Apr 11 '08 #4

P: n/a
Just another C hacker wrote:
Look I don't think it's any of your business what I'm doing, either
answer the question or don't bother.
Look Mr "hacker"
You add illegal instructions and then you want to ignore it...
Fine, you want to screw some program, build some virus,
crash some stuff.

OK.

But do not expect help from me in this forum.
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Apr 11 '08 #5

P: n/a
Richard Tobin wrote:
In article <ft**********@aioe.org>, Just another C hacker <no@spam.comwrote:
>Look I don't think it's any of your business what I'm doing, either
answer the question or don't bother.

What's in it for us?

-- Richard
Well, if the virus works you will get one!

:-)

The only thing we gain here is YASV!
YET ANOTHER STUPID VIRUS!
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Apr 11 '08 #6

P: n/a
In article <ft**********@aioe.org>, jacob navia <ja***@nospam.orgwrote:
>Richard Tobin wrote:
>>Look I don't think it's any of your business what I'm doing, either
answer the question or don't bother.
>What's in it for us?
>Well, if the virus works you will get one!
Ah yes, that does look quite possible. If he wants help writing
viruses, my rates are double, plus indemnity.

-- Richard
--
:wq
Apr 11 '08 #7

P: n/a
Just another C hacker wrote:
>
Look I don't think it's any of your business what I'm doing, either
answer the question or don't bother.

Yeah signal is ok, but it doesn't let me know which was the address
of the illegal operation that was attempted.
Please do not top-post. Your answer belongs after (or intermixed
with) the quoted material to which you reply, after snipping all
irrelevant material. See the following links:

--
<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://www.caliburn.nl/topposting.html>
<http://www.netmeister.org/news/learn2quote.html>
<http://cfaj.freeshell.org/google/ (taming google)
<http://members.fortunecity.com/nnqweb/ (newusers)

** Posted from http://www.teranews.com **
Jun 27 '08 #8

P: n/a
"CBFalconer" <cb********@yahoo.comwrote in message
news:48***************@yahoo.com...
Just another C hacker wrote:
>>
Look I don't think it's any of your business what I'm doing, either
answer the question or don't bother.
....
>
Please do not top-post. Your answer belongs after (or intermixed
with) the quoted material to which you reply, after snipping all
irrelevant material. See the following links:
You make it sound like Just's reply would have been been perfectly
acceptable otherwise.

Sometimes it's necessary to ask additional questions of posters and a rebuke
like the above would put some people off.

Or are your posts generated automatically so that the actual content you
reply to is irrelevant?

--
Bart

Jun 27 '08 #9

This discussion thread is closed

Replies have been disabled for this discussion.