Monday, June 25, 2012

Find 8 bits CPU ID from IO APIC redirection table entry


Find the CPU ID from IO APIC redirection table
use read and write everything tool. Specify index register: FEC00000, and Data register: FEC00010
First of all, you need to find out where is the IO APIC memory address, which is FEC00000 in our case, Then the address + 0x10 is the data register,
The first IRQ has indexes 0x10 and 0x11, the second 0x12 and 0x13, the third 0x14 and 0x15
CPU ID is the 56 – 63 bits of the redirection table entry

Packet Generator Tool

PackETH: ethernet packet generator
It can generate any raw packet.

Download from:
http://packeth.sourceforge.net/
http://sourceforge.net/projects/packeth/
The default file is for Windows, and Linux version need to Click on Browser all link

Install:
cd to packet directory
./configure
make
sudo make install

Usage:
Run it as root
Define packet header, payload, and interface, and click send

Friday, June 8, 2012

How to Limit the Amount of Memory Available to OS

Linux:

set the mem=2000m as the boot arguments, then the Linux only use first 2000MB memory. If the total RAM is 2G, it reserves 48MB.
http://fengweizhang.blogspot.com/2012/06/boot-arguments-on-linux.html


Windows:

Add line
MaxPhyPage=0x7D000 
at [386enh] section of C:\WINDOWS\system.ini
0x7D000 * 4KB = 2000MB
http://support.microsoft.com/kb/181862



Boot Arguments on Linux

http://tldp.org/HOWTO/BootPrompt-HOWTO-3.html


The `mem=' Argument

This argument has several purposes: The original purpose was to specify the amount of installed memory (or a value less than that if you wanted to limit the amount of memory available to linux).
The next (and hardly used) purpose is to specify mem=nopentium which tells the Linux kernel to not use the 4MB page table performance feature. If you want to use it for both purposes, use a separate mem= for each one.
The original BIOS call defined in the PC specification that returns the amount of installed memory was only designed to be able to report up to 64MB. (Yes, another lack of foresight, just like the 1024 cylinder disks... sigh.) Linux uses this BIOS call at boot to determine how much memory is installed. A newer specification (e820) allows the BIOS to get this right on most machines nowadays. If you have more than 64MB of RAM installed on an older machine, you can use this boot argument to tell Linux how much memory you have. Here is a quote from Linus on the usage of the mem= parameter.
``The kernel will accept any `mem=xx' parameter you give it, and if it turns out that you lied to it, it will crash horribly sooner or later. The parameter indicates the highest addressable RAM address, so `mem=0x1000000' means you have 16MB of memory, for example. For a 96MB machine this would be `mem=0x6000000'. If you tell Linux that it has more memory than it actually does have, bad things will happen: maybe not at once, but surely eventually.''
Note that the argument does not have to be in hex, and the suffixes `k' and `M' (case insensitive) can be used to specify kilobytes and Megabytes, respectively. (A `k' will cause a 10 bit shift on your value, and a `M' will cause a 20 bit shift.) A typical example for a 128MB machine would be "mem=128m".
In some cases, the memory reported via e820 can also be wrong, and so the mem=exactmap was added. You use this in conjunction with specifying an exact memory map, such as:


        mem=exactmap mem=640K@0 mem=1023M@1M

for a 1GB machine with the usual 384k of ISA memory mapped I/O space excluded from use.