472,353 Members | 1,251 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

Dealing with illegal instruction

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
8 4612
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
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
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
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
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
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ajay Bakhshi | last post by:
Hi, I am getting the following problem on AIX. I create a small shared library. And tried to load it in python. It core dumps with the...
0
by: Paul Mahon | last post by:
Hello, I recently managed to corrupt a table pretty badly. I read the sections in the documentation about recovering after a crash. None of the...
1
by: Chandra | last post by:
Hi, I developed a Visual C++ 6.0 MFC Application on Windows 2000 5.00.2195 Service Pack 4. THe Application runs fine on my machine. But when a...
9
by: Roshni | last post by:
Hi, I wanted to know how do function pointers sometime access illegal memory access ? Could any one give me an example ? Thanks, Roshni
4
by: Mathias Waack | last post by:
Hi, I've embedded python into a legacy application. It works - most of the time. In some special situations the app crashes executing the "import...
3
by: =?Utf-8?B?SG9seXNtb2tl?= | last post by:
Hi there, I am having a problem im my webservices method when trying to save a file with latin characters to disk passed through WSE. I have...
3
by: somebody | last post by:
Hi all, I have been working on a php script lately that merges results from a db and an xml source and then populates a PDF through FDF. I have...
2
by: murali026 | last post by:
Hi All, Here I have an Application which will be running on Power PC Processor. After some time i have receiving the following error. ...
1
by: justduick | last post by:
I have developed a visual c# application which executes properly on my computer and others that have visual studio installed. however when...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.