[Gllug] Plank Drivers

Nix nix at esperi.demon.co.uk
Thu Aug 8 19:28:33 UTC 2002


On Thu, 08 Aug 2002, Tethys yowled:
> 
>>Has anyone got any suggestions? Avoiding binary-only modules is critical
>>because my system doesn't use the usual IA32 calling conventions so I
>>must recompile everything; so that rules nvidia out, I guess.
> 
> Yep. The XFree86 nv driver is actually pretty good, but for 2D only.
> For 3D, it'll drop back to software rendering. Just curious, though...
> what have you done to alter the calling conventions? And perhaps just
> as importantly, why?

The IA32 calling conventions were designed, IIRC, back in the Xenix
days, and it shows. --- but actually I misspoke above, I've been
messing with the C ABI as a whole, and looking at the changes most
of them are not calling-related.

There are lots of problems with them:

- many structures are passed on the stack when they needn't be

- the alignment of many things in structures is, while fine for
  the 386, crazy for later processors; the cross-vendor C++ ABI
  implemented in GCC 3.0+ has fixed this for non-POD structures,
  but it can't be fixed for POD structures for fear of breaking
  C compatibility. (Fixing this alone caused a significant speedup:
  about 8% in some code. Better cache behaviour, I think.)

- Nothing is done with %fs; %gs is a thread pointer, but %fs is
  almost unused in userspace code (IIRC: I can't remember whether
  this was eventually used for anything or not)

- it is made unnecessarily hard for the compiler to determine when
  the PIC register isn't needed (although fixing this didn't need
  to change the calling conventions it was easiest to do it that
  way, and since I'd broken them already...)

- and much else I can't recall at this time of night.

I really did it for fun and hack value and to piss off crackers (I'd
like to see them trying a conventional buffer-overflow attack on *this*
box!)

-- 
`There's something satisfying about killing JWZ over and over again.'
                                        -- 1i, personal communication

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list