Tuesday, November 27, 2012

How to manually find kernel modules on Windows

KPCR -> KDVersionblock -> PsLoadedModuleList


http://memogaki.wordpress.com/2011/10/01/kpcr/
http://stackoverflow.com/questions/10690330/how-do-i-get-the-address-to-kernel-modules-nt-and-win32k

Monday, November 26, 2012

How to manually find all of kernel modules on Linux

1. cat /boot/System.map | grep modules
Get the address of modules symbol from system.map file. modules symbol points to a list_head structure, which is the head of double- and circular- linked list of all the modules.

2. take a look at linux-src/include/linux/module.h
struct module {}
contains all the useful information about module structure

3. Here is code in kernel module to print out all the module names.

static int hello_init(void)
{

    printk("start list all the modules\n");

// Get this magic address from system.map
    struct list_head * module_h = (struct list_head*) 0xc06e1880;
    int count = 100;
    struct list_head *list_h = module_h->next;
    struct module *m;
    while(count--)
    {
if(list_h == module_h)
   break;
m = list_entry(list_h, struct module, list);
printk("name: %s\n", m->name);
list_h = list_h->next;
    }

    printk("count is %d\n", count);
    printk("\nhello, world\n");
    return 0;
}

Tuesday, November 20, 2012

Hardware virtualization

Intel Virtualization Technology (VT)
http://software.intel.com/sites/default/files/m/0/2/1/b/b/1024-Virtualization.pdf

Saturday, November 3, 2012

Remove file from subversion after svn add but before svn commit

svn revert filename

http://picobit.wordpress.com/2009/05/06/remove-file-from-subversion-after-svn-add-but-before-svn-commit/

Draw picture using Tikz package

Example: http://www.texample.net/tikz/examples/
Manual: http://paws.wcu.edu/tsfoguel/tikzpgfmanual.pdf

Latex Basics

http://en.wikibooks.org/wiki/LaTeX/Basics

E.g. documentclass available options:
Document Classes
articlefor articles in scientific journals, presentations, short reports, program documentation, invitations, ...
IEEEtranfor articles with the IEEE Transactions format.
proca class for proceedings based on the article class.
minimalis as small as it can get. It only sets a page size and a base font. It is mainly used for debugging purposes.
reportfor longer reports containing several chapters, small books, thesis, ...
bookfor real books
slidesfor slides. The class uses big sans serif letters.
memoirfor changing sensibly the output of the document. It is based on the book class, but you can create any kind of document with it [1]
letterfor writing letters.
beamerfor writing presentations (see LaTeX/Presentations).

Enable and Disable maskable Interrrupts

Disable Interrrupts:
eflags &= (0xffffffff-0x200);

Enable Interrupts:
eflags |= (0x200);

http://en.wikipedia.org/wiki/FLAGS_register

Flush the Instruction Cache


// flush the cache, eip is the current eip address

__asm__ __volatile__("wbinvd"); // write back cache and invalidate cache

__asm__ __volatile__(
"CLFLUSH (%0)"
:"=r"(eip));
wbinvd:

Writes back all modified cache lines in the processor’s internal cache to main memory and invalidates (flushes) the internal caches. The instruction then issues a special- function bus cycle that directs external caches to also write back modified data and another bus cycle to indicate that the external caches should be invalidated. 


clfush:

Invalidates the cache line that contains the linear address specified with the source operand from all levels of the processor cache hierarchy (data and instruction). The invalidation is broadcast throughout the cache coherence domain. If, at any level of the cache hierarchy, the line is inconsistent with memory (dirty) it is written to memory before invalidation


Please see intel manual instruction volume for more details