syscall table

/usr/src/linux-2.6.20/arch/i386/kernel/syscall_table.S

There are many times I am stumped as to what an interupt is doing.  This is of course specified in the eax regisrter.  A good starting point is the above file.  More research will probably specify what the other registers are doing.

Bash Bomb

So my buddy Greg pointed me to what he called a ‘bash bomb’.  It looks like:

:(){ :|:& };:

Anyway, all it does is recursively fork.  http://www.cyberciti.biz/faq/understanding-bash-fork-bomb/ gives a good explanation.  I do like it, because of its simplicity and obscurity. I have to deal with recursively forking things all the time (thanks operating system class with students experimenting with fork for the first time).

A simple pam hard limit on the number of processes can mitigate against this.  Put it in /etc/security/limits.conf.

My applicable limits are (fairly liberal):

*               soft    nproc           225
*               hard    nproc          300

So far, nothing has crashed the system with these, but I keep having to tweak them, so I may restrict them further in the future.

vim tricks – different types of insert, repeat

To repeat your last operation type ‘.’ in command mode.

Here are some different ways to insert

A – append text to end of line
I – insert text at beginning of line
o – open blank line below cursor
O – open blank line above cursur
s – delete char at cursor and sub text
S – Delete line and sub text
R – overstrike existing chars with new chars

To think, I’ve survived with only i, a, r, and I think I’ve used R before to this day.

One thing that’s interesting.  I wonder how many people think they know how to use their text editor and don’t.  I know I thought I knew vim pretty good until I started to learn how to use it.

I should mention

These can be preceded with numbers. For example,

5i*- [esc] will insert
*-*-*-*-*-

vim trick – restoring something you delete

If you delete, like say, 3 lines fast.

dd
dd
dd

and want to restore the 1st thing deleted only (not the other 2) you can with the following command:

“3dd

pretty slick.  I’m not sure I’ll ever be enough of a power user to remember it.

mycontroller – Cache

Download the mmlogic schematic here, the memfile here, and the cache file here.

The clock is run at a very slow speed so you can see what is happening.  I didn’t bother to stop the memory/cache from outputting, so there is a constant read.

The input is a memory address, which is fetched from Cache (if the data is in Cache) or RAM (if the data is not in Cache).

The part of the system not being used (RAM or cache) is always doing stuff, but this system just throws it away if it is not relevant, and keeps it if it is.

The Cache is done using a direct addressing scheme.  The addresses are stored in the “higher” half of the addresses.  For example, the data at 0000xxxx in the cache has the address in RAM stored at (in the cache) 0001xxxx.

Sample Run

At first, the program begins.  Because there is a default read, the instruction is to read 00000000 out of RAM.

The Controller will check to see if this value is in cache (page 4).  It checks this using an ALU and zero flag.  It is not, so memwrite (the zero flag output) will be set to +1.  This indicates to output the value from RAM.  The value is output from RAM, and put in cache.

Because there is a constant read, the value at RAM 00000000 is read again, but this time, it is in cache.  The ALU will compare the value at Cache 00010000 with the address, and they are equal, so ZF flag is set.

Flip any switch, the process above repeats.

Flip the switch back so the address is once again 00000000, and notice that the value is only read from cache.

Notes:

The logic analyzer will be a mess, because of my use of oscillators.  I recommend debugging by sight and LEDs.

The oscillators function as a system clock. This is a synchronous system.

The cache writing flag is oscillated only if the memwrite flag indicates that there must be a cache write (if the system had to retrieve something from RAM)

The control address oscillator is constantly moving back and forth between where the data is stored and where the address is stored in cache. It oscillates at a slower speed than the write oscillator.

Follow

Get every new post delivered to your Inbox.