Fast thread local areas for amd64
Sometimes it's required to have large thread local data array. Thread stacks may be limited in size, and they could not provide enough flexibility or speed. In this case one could use %GS register of...
View ArticleHandling of synchronous faults on Unix
Signals and threads on Unix are always areas where interesting behaviour could be seen. As an example consider the way how synchronous faults are handled. In this test program I model behaviour of...
View ArticleELF runnable on multiple OSes
Once I asked myself, if it's possible to create an ELF file, which will run on multiple OSes with same CPU. ELF only does checks of target hardware, not an operating systems, but OSes differs in...
View ArticleGenome decoding
According to this page genome isn't exactly a program, in traditional Turing machine sense, but "..contains very little unused sequences and, in fact, is a complex, interwoven network.". Another...
View ArticleReverse engineering in microbiology
Interesting phenomenon in microbiology is reverse transcription. If I understand correctly, it's kind of technology used by some virii, such as AIDS virus to do reverse engineering of the DNA of the...
View ArticleSelf printing program in assembly
Self printing programs, so called quines are funny, so I decided to write one in linux-x86 ASM just to make almost really self reproducing program (almost, as it relies upon syscall for output, but...
View ArticleSelf printing program in assembly (part 2)
Shortest self printing program in assembly I managed to write. 69 bytes long. If anyone knows shorter version, please let me know. .globl _start .type _start, @function _start: movl $_start, %esi xorl...
View ArticleInfluence of intention on reality
According to PEAR experiment human intentions can statistically significantly affect behavior of random processes, moreover:Human minds can affect random physical processes, to a minor but...
View ArticleFixing FPU control word on Unix
FPU handling on x86 machines is traditional area where black magic is used heavily. As an example, I'll share experience of fixing FPU control word from the signal handler.Some applications have...
View ArticleContext sensitive function behavior
Usually C, unlike dynamic languages, considered not so easy to write context sensitive code. To demonstrate that this is feasible, at least on some systems and compilers I wrote following hack....
View ArticleFixing FPU control word on Win32
On Win32 fixing of control word is also possible, but done differently, as Win32 uses SEH (structured exception handlers) to handle hardware faults, and some magic is required to let fault really...
View ArticleSimple JIT compiler for your application
Just in time code generation usually considered to be complicated task, and it really is. Although there are cases (for example in multimedia, games or cryptographic application) when it does makes...
View ArticleLiving in nirvana
Recently I've read rather interesting life story of math professor John Wren-Lewis, who unintentionally got (and keeps for several years) nirvana-like state of mind. He calls it "eternity...
View Articledd story
One rather interesting difference between Linux and Solaris is how command like thisdd if=/dev/zero of=/dev/null bs=900M count=1 behave, especially if box has smth like 256M of RAM. Solaris behaves...
View ArticleMore fun with SEH
Just to demonstrate what kind of fancy stuff SEH provides, I wrote this small demo code for win32/x86. Idea of this code is to show how to modify the way other frames handle their exceptions. I don't...
View Articlememory debugger for linux
Sometimes it's required for an application to catch all memory accesses to particular location, for example for debugging purposes. It could be done using mprotect call, but there's another, specific...
View ArticleMemory debugger for Windows
For the sake of completeness, here's version of memory debugger for Win32. It uses vectored exception, so works only for Win2K or later. #define_WIN32_WINNT 0x0500 #include<stdio.h>...
View ArticleOverriding symbols on Win32
Today I was asked it it's possible to implement something similar to Linux's LD_PRELOAD for Windows, to allow override of particular symbol. I answered yes, and here's how I did it (some dynamic code...
View ArticleVTBL games
Little game with changing vtbl entry for an instance. Probably more interesting part would be class-wide modification, but it's usually in read only area (text segment). For completeness of demo we'll...
View ArticleSPARC ASIs
One, not so frequently used, yet useful feature of SPARC CPUs is ASI, or address space identifier, essentially just a 8-bit tag attached to memory address, modifying the way how memory access happens....
View Article