web developer & system programmer

coder . cl

ramblings and thoughts on programming...

foreign system call emulations on freebsd

published: 19-07-2009 / updated: 19-07-2009
posted in: c, freebsd, programming
by Daniel Molina Wegener

Call simulations are common nowdays techniques to use foreign applications — build for other operating systems, such as M$ Windows — in the FreeBSD platform. The common technique is to create an interface to the real system calls replacing foreign system calls with wrappers on them. To build this task an assembler instruction is used. On call simulations we have the usage of win32 codecs, wine and valgrind — valgrind do not use foreign system calls, but replaces standard library routines. Most of them are using — behind all those system calls and standard library routines — a common assembler instruction: lldt. lldt stands for "Load Local Descriptor Table" and it’s related to Segment Descriptor Tables. This article is a lightweight introduction to the use of lldt assembler instruction.