calling convention cheat sheet
Thursday, January 21st, 2010 by mopeycdecl, stdcall, fastcall, c++
cdecl, stdcall, fastcall, c++
The goal of this project was to integrate all parts covered throughout the lab. Similar to lab7, lab8 fetches microcode from a second memory device. Extending lab7, however, it also performs very basic operations, including add, eq, nop, ld, skipz, and halt. There are 4 physical registers, which will be referred to as 00, 01, 10, and 11.
This is an RTOS developed by myself, with some code taken from FreeRTOS. This is some of the most difficult code I have ever written, although it really doesn’t do anything useful. Man, context switching in C can be a bear! It’s like a programatic buffer overflow! (seriously, you do a function call and just pop off enough stuff to overwrite the instruction pointer).
In CS 504:Real Time Operating Systems, the class built a functional Real Time Operating system based on the UIK API. In my implementation, I heavily relied on the source code of FreeRTOS. The process focused primarily on demonstrating the atmel processor, multitasking, and and basic interprocess communication, which are fundamental parts of an RTOS. In this project, the same problems are achieved with a very different architecture. Namely, all the first programming projects – generating a sound wave, counting LEDs, timing how long buttons were pressed, and handling hardware events – were programmed similarly and multi-tasked on the propeller chip. This project included interfacing with the ntsc and peripheral drivers, writing a sound driver, learning spin and propeller assembly, and comprehending the propeller architecture.
A musical “note” is a waveform that has a certain fundamental frequency. A perfect sine wave consists only of the fundamental frequency, and sounds very “pure” or mellow, like a flute. For this project, you are to use interrupts to generate the notes of a musical scale, while at the same time using another interrupt to update a count. We will generate square waves by toggling a bit within a port on and off. Specifically, your program should play the notes from middle C to the next higher C, each of approximately one second in duration. These notes should be playing at the same time that an 8-bit binary count is being displayed in the LED’s, updating at approximately 1/4 second.
The purpose of this assignment is to give you experience with the AVR’s timers and the use of interrupts. You are to repeat assignment #1, this time performing the timing using an interrupt-driven timer. You are to write an interrupt service routine (ISR) for one of the hardware timers on the AVR. Each time the timer interrupts, you should update a counter variable. Then, when determining the amount of time that the switch is held down, use the counter value. Then, use the counter again to determine how long to turn on the LED. As before, in addition to writing the code, determine the size of the code in your program, including main and the ISR.
Does my title sound like buz-word central? You bet it does. That’s because it was a bit difficult to find any good introductory material on this. Maybe that’s because there’s so much information out there…
My laptop drive recently died on me. Of course, this is the one machine that I don’t have good backups on. After various passes of dd_rescue (forward and backward) I had a pretty good disk image. Now I wanted to mount a partition. Problem is, I had an image.
http://www.ntfs-3g.org/performance.html
Here are some flags that may help vulnerable code from being executed.
-D_FORTIFY_SOURCE=2
This should get rid of some buffer overflows that can be analyzed statically and some obvious ones (strcpying input, format string vulnerabilities).
More information can be found here: http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html
-fstack-protector-all
From the man page:
Emit extra code to check for buffer overflows, such as stack smashing attacks. This [...]
The bad news is that ksplice makes it easier than ever for an intruder with root to change your settings (eg tripwire stuff). Before, this would have at least normally required a reboot which is something most sysadmins will naturally look into. Rebootless kernel patching has been around for awhile, but never has it been so easy.
Well, I didn’t know this was possible. First published in phrack, and can be viewed at http://doc.bughunter.net/rootkit-backdoor/kernel-patching.html
I guess that pokes a hole in my careful ideas about ids systems (I guess another one, there are holes on top of holes). Not this particular rootkit of course, but the fact that you can potentially manipulate the kernel by modifying kernel memory. Very tricky.
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 [...]
This paper was for my architecture class (topic: compare current Intel and AMD processors). I learned a lot researching this, but it may contain a lot of holes due to my lack of knowledge. Feel free to correct any of my mistakes in the comments section. Here is the paper.
This is part of a project to build a complete, functional, extremely basic microcontroller. It is built using multimedia logic.
This section is a simulated very simplified DMA.
Example Run
—
The test of writing back and forth bytes seems to work.
Also, the example from the lab specification seems to work. Namely:
Download:
-Select head 1, track 2, sector [...]
The hash_long function is found a lot of places in the kernel. Amongst other places it is how PIDs are stored in a table.
This is part of a project to build a complete, functional, extremely basic microcontroller. It is built using multimedia logic.
This is a functional subsystem that manages a small RAM in our architecture speed across 2 128 byte memory addresses.
All the Input and output can be viewed from the first page.
The tristate devices on the [...]
This is part of a project to build a complete, functional, extremely basic microcontroller. It is built using multimedia logic.
This is a fully functional program counter (PC) that runs on a 1 second clock.
On page 1, there is a switch. If the switch is set to 1 then the PC increments by 1. If the [...]
RAMEL is a programming language written using Lex, Yacc, and C by yours truly with the guidence of Dan Tappan in the CS Department at ISU. It runs on a Java virtual program. RAMEL is more or less useless, but it did help clear up how a compiler can actually work.
Bleh. So since I’m applying for a job so I uploaded the only paper I’ve published so far. It’s basically benchmarking tests with a new type of architecture. It was a good Summer of work altogether.
No computers were harmed in the 0.533 seconds it took to produce this page.