The Old New Thing

ia64 – misdeclaring near and far data

As I mentioned yesterday, the ia64 is a very demanding architecture. Today I'll discuss another way that lying to the compiler will come back and bite you. The ia64 does not have an absolute addressing mode. Instead, you access your global variables through the r1 register, nicknamed "gp" (global pointer). This register always points to your ...

Uninitialized garbage on ia64 can be deadly

On Friday, we talked about some of the bad things that can happen if you call a function with the wrong signature. The ia64 introduces yet another possible bad consequence of a mismatched function signature which you may have thought was harmless. The CreateThread function accepts a LPTHREAD_START_ROUTINE, which has the function signature ...

How can a program survive a corrupted stack?

Continuing from yesterday: The x86 architecture traditionally uses the EBP register to establish a stack frame. A typical function prologue goes like this: This establishes a stack frame that looks like this, for, say, a __stdcall function that takes two parameters. Parameters can be accessed with positive offsets from EBP; for example...

Aw, poor guy, he's so depressed

I suspect Tanzi isn't going to get much sympathy from, well, anybody. Parmalat's Tanzi is "Depressed" Lawyers for Calisto Tanzi, the jailed head of now-bankrupt European food and dairy group Parmalat, claim that he is "depressed" in prison, constantly asking about his family. The lawyers have suggested that Tanzi be released from prison and...

Google just keeps adding stuff

ResearchBuzz pointed out still more google search keywords like area codes, UPC, and whois. I'm still waiting for PLU, those code numbers on the food in the produce aisle. Here's a brief history of PLU codes for those geeky enough to care (like me...

What can go wrong when you mismatch the calling convention?

Believe it or not, calling conventions is one of the things that programs frequently get wrong. The compiler yells at you when you mismatch a calling convention, but lazy programmers will just stick a cast in there to get the compiler to "shut up already". And then Windows is stuck having to support your buggy code forever. The window ...

The history of calling conventions, part 5: amd64

The last architecture I'm going to cover in this series is the AMD64 architecture (also known as x86-64). The AMD64 takes the traditional x86 and expands the registers to 64 bits, naming them rax, rbx, etc. It also adds eight more general purpose registers, named simply R8 through R15. Here's a sample: On entry to CallThatFunction, the ...

If you know Swedish, the world is funnier

As I was driving through Seattle the other day, I saw a sign for a personal storage company called "Stor-More". I then had to laugh because in Swedish, "Stor-Mor" means "Big Momma". It's not restricted to Swedish. On my trip to Germany last year, my travelling companions found several German signs amusing: When he told some German ...

"Friends" is so trendsetting

The characters on the television program "Friends" are apparently trendsetters in the use of the word "so". [People with way too much time on their hands] spent a year going through transcripts from each episode of the first eight seasons of Friends, taking note of every single adjective... [T]he show's popularity peaked at the ...