RE: Is 4 byte -1 invalid code on most/all architectures?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I'm a student around here, but I think the way you're doing this is
> daft. Do it properly.

 
 
I don't believe there is a proper way.
As I said, it's not my invention, I was aghast at first to find it,
(having brought up one of the targets where alignment matters
and debugging the alignment fault) 
but upon much further thought, I believe there is no good solution.
I'd very much appreciate hearing otherwise.
Generating code at runtime on the stack I don't consider a good solution.
  Maybe for certain targets though, if we can guarantee
  that the stack is executable. That's probably fairly rare these days though.
 
 
> If the x86 processor is in 32-bit or 64-bit mode, -1 resolves to:

 
Is my x86 and amd64 debugger wrong?
 
 
772809bd ff              ???
772809be ff              ???
772809bf ff              ???
772809c0 ff              ???
772809c1 ff              ???
 
 
 
 >  ISA manuals for all the processors you are interested in are available to you.
 
 
It's bit much to wade through.
The IA64 manual at least is confusing. Various fields, color coding,
 I'm not sure which bits are being referred to...
I'll try to read others. I imagine they are all much easier.
 
 
 
 > No. On MIPS I think 0xffffffff -> SD $31,-1($31)
 
 
Ugh, that seems unfortunate for us.
There is an additional saving grace that these are pointers to the starts of functions,
and necessarily written in a high level language and compiled by gcc, but I understand
that that isn't necessarily particularly restrictive.
 
 
 
Thanks,
 - Jay


----------------------------------------
> To: jay.krell@xxxxxxxxxxx; gcc-help@xxxxxxxxxxx
> Subject: Re: Is 4 byte -1 invalid code on most/all architectures?
> Date: Wed, 8 Dec 2010 19:59:40 -0500
> From: richardcavell@xxxxxxxx
>
> If the x86 processor is in 16-bit mode, -1 resolves to:
>
> pop sp
> js 0x69
>
> If the x86 processor is in 32-bit or 64-bit mode, -1 resolves to:
>
> pop esp
> js 0x69
>
> I'm a student around here, but I think the way you're doing this is
> daft. Do it properly.
>
> Richard 		 	   		  



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux