Impressive 'hacks'

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
Post Reply
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Impressive 'hacks'

Post by earlz »

Hi, I was stumbling across some of my code and saw a thing I had never seen done before, yet standard compliant. (and took at least 6 hours to figure out by trial and error)

Code: Select all

typedef void (x86Lib::x86CPU::*opcode)();
//x86Lib is a namespace. x86CPU is a class. opcode is a function pointer type
//x86CPU::Opcodes is an array of the opcode type.
void x86CPU::Cycle(){
....
		*(uint32_t*)&op_cache=ReadDword(cCS,eip);
		(this->*Opcodes[op_cache[0]])();
		//operate on the this class with the opcode functions in this class
		eip=(uint16_t)eip+1;
...

}

//you had to use a full function declaration...
InstallOp(0xF4,&x86CPU::op16_hlt);
This hack took a very long time, yet is one of the most useful I've yet to find. This made it so I could have multiple x86CPU classes and each of them have different opcodes loaded(and therefore I could have one CPU in realmode and the other in pmode or whatever)

Anyone else discovered hacks like these that somehow are just amazing and work?
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Impressive 'hacks'

Post by JamesM »

Hmm, in a few hours I'm going to attempt to hack into my router, install telnet and bnc and have an irc bouncer on it, although I don't think that's quite what you were suggesting!
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: Impressive 'hacks'

Post by earlz »

JamesM wrote:Hmm, in a few hours I'm going to attempt to hack into my router, install telnet and bnc and have an irc bouncer on it, although I don't think that's quite what you were suggesting!
It could be... depends on if you find a clever way to do that in say one step lol
User avatar
Firestryke31
Member
Member
Posts: 550
Joined: Sat Nov 29, 2008 1:07 pm
Location: Throw a dart at central Texas
Contact:

Re: Impressive 'hacks'

Post by Firestryke31 »

There's my Firebird hack for the 5G/5.5G iPod, which was the very first hack based on the v1.3 firmware (so I had to do everything from scratch, including resizing images). It was Firebird that made me write my popular utility iPNG to convert PNG files to the iPod's internal format, as well as another utility to resize images and move them around to minimize wasted space.

Though I don't think either of those were what you meant either.
Owner of Fawkes Software.
Wierd Al wrote: You think your Commodore 64 is really neato,
What kind of chip you got in there, a Dorito?
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Impressive 'hacks'

Post by Love4Boobies »

I sometimes enjoy make-up sex. But I don't think that's what you meant either.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Impressive 'hacks'

Post by Troy Martin »

Booblover: Well it is a 'hack' in a sense...
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: Impressive 'hacks'

Post by earlz »

Love4Boobies wrote:I sometimes enjoy make-up sex. But I don't think that's what you meant either.
rofl.. I suppose it's a hack... I've never really been able to do that too well though.. but I think too much...
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: Impressive 'hacks'

Post by Owen »

The cast through op_cache there looks like it may violate strict aliasing requirements, which are a part of the C and C++ standards
Post Reply