ELFIO. Tutorial and User Manual. Abstract ELFIO is a header-only C++ library intended for reading and generating files in the ELF binary format
|
|
|
- April Owens
- 9 years ago
- Views:
Transcription
1 ELFIO Tutorial and User Manual Abstract ELFIO is a header-only C++ library intended for reading and generating files in the ELF binary format Serge Lamikhov-Center [email protected] 0
2 1 TABLE OF CONTENTS 2 INTRODUCTION 2 3 GETTING STARTED WITH ELFIO ELF FILE READER ELF SECTION DATA ACCESSORS ELFDUMP UTILITY ELF FILE WRITER 6 4 ELFIO LIBRARY CLASSES ELFIO SECTION SEGMENT STRING_SECTION_ACCESSOR SYMBOL_SECTION_ACCESSOR RELOCATION_SECTION_ACCESSOR DYNAMIC_SECTION_ACCESSOR NOTE_SECTION_ACCESSOR 19 1
3 2 INTRODUCTION ELFIO is a header-only C++ library intended for reading and generating files in the ELF binary format. It is used as a standalone library - it is not dependant on any other product or project. Adhering to ISO C++, it compiles on a wide variety of architectures and compilers. While the library is easy to use, some basic knowledge of the ELF binary format is required. Such Information can easily be found on the Web. The full text of this tutorial comes together with ELFIO library distribution 3 GETTING STARTED WITH ELFIO 3.1 ELF FILE READER The ELFIO library is just normal C++ header files. In order to use all its classes and types, simply include the main header file "elfio.hpp". All ELFIO library declarations reside in a namespace called "ELFIO". This can be seen in the following example: #include <iostream> #include <elfio/elfio.hpp> using namespace ELFIO int main( int argc, char** argv ) { if ( argc!= 2 ) { std::cout << "Usage: tutorial <elf_file>" << std::endl; return 1; } - Include elfio.hpp header file - The ELFIO namespace usage This section of the tutorial will explain how to work with the reader portion of the ELFIO library. The first step would be creating an elfio class instance. The elfio constructor has no parameters. The creation is normally followed by invoking the 'load' member method, passing it an ELF file name as a parameter: 2
4 // Create elfio reader elfio reader; // Load ELF data if (!reader.load( argv[1] ) ) { std::cout << "Can't find or process ELF file " << argv[1] << std::endl; return 2; } - Create elfio class instance - Initialize the instance by loading ELF file. The function load returns true if the ELF file was found and processed successfully. It returns false otherwise The load() method returns true if the corresponding file was found and processed successfully. All the ELF file header properties such as encoding, machine type and entry point are accessible now. To get the class and the encoding of the file use: // Print ELF file properties std::cout << "ELF file class : "; if ( reader.get_class() == ELFCLASS32 ) std::cout << "ELF32" << std::endl; else std::cout << "ELF64" << std::endl; std::cout << "ELF file encoding : "; if ( reader.get_encoding() == ELFDATA2LSB ) std::cout << "Little endian" << std::endl; else std::cout << "Big endian" << std::endl; - Member function get_class() returns ELF file class. Possible return values are: ELFCLASS32 or ELFCLASS64 - Member function get_encoding() returns ELF file format encoding. Possible values are: ELFDATA2LSB or ELFDATA2MSB standing for little- and big-endianess correspondingly Note: Standard ELF types, flags and constants are defined in the elf_types.hpp header file. This file is included automatically into the project. For example: ELFCLASS32, ELFCLASS64 constants define values for 32/64 bit architectures. Constants ELFDATA2LSB and ELFDATA2MSB define values for little- and big-endian encoding. ELF binary files consist of sections and segments. Each section has its own responsibility: some contains executable code, others program's data, some are symbol tables and so on. See ELF binary format documentation for purpose and content description of sections and segments. 3
5 The following code demonstrates how to find out the amount of sections the ELF file contains. The code also presents how to access particular section properties like names and sizes: // Print ELF file sections info sec_num = reader.sections.size(); std::cout << "Number of sections: " << sec_num << std::endl; for ( int i = 0; i < sec_num; ++i ) { const section* psec = reader.sections[i]; std::cout << " [" << i << "] " << psec->get_name() << "\t" << psec->get_size() << std::endl; // Access section's data const char* p = reader.sections[i]->get_data(); } - Retrieve the number of sections - Use operator[] to access a section by its number or symbolic name - get_name(), get_size() and get_data() are member functions of section class The sections data member of ELFIO's reader object permits obtaining the number of sections inside a given ELF file. It also serves for getting access to individual sections by using operator[], which returns a pointer to the corresponding section's interface. Similarly, for executables, the segments of the ELF file can be processed: // Print ELF file segments info seg_num = reader.segments.size(); std::cout << "Number of segments: " << seg_num << std::endl; for ( int i = 0; i < seg_num; ++i ) { const segment* pseg = reader.segments[i]; std::cout << " [" << i << "] 0x" << std::hex << pseg->get_flags() << "\t0x" << pseg->get_virtual_address() << "\t0x" << pseg->get_file_size() << "\t0x" << pseg->get_memory_size() << std::endl; // Access segments's data const char* p = reader.segments[i]->get_data(); } - Retrieve the number of segments - Use operator[] to access a segment by its number - get_flags(), get_virtual_address(), get_file_size(), get_memory_size() and get_data() are member methods of segment class 4
6 In this case, the segments' attributes and data are obtained by using the segments data member of ELFIO's reader class. 3.2 ELF SECTION DATA ACCESSORS To simplify creation and interpretation of specific ELF sections, the ELFIO library provides accessor classes. Currently, the following classes are available: String section accessor Symbol section accessor Relocation section accessor Note section accessor Dynamic section accessor More accessors may be implemented in future versions of the library. Let's see how the accessors can be used with the previous ELF file reader example. The following example prints out all symbols in a section that turns out to be a symbol section: if ( psec->get_type() == SHT_SYMTAB ) { const symbol_section_accessor symbols( reader, psec ); for ( unsigned int j = 0; j < symbols.get_symbols_num(); ++j ) { std::string name; Elf64_Addr value; Elf_Xword size; bind; type; section_index; other; } } symbols.get_symbol( j, name, value, size, bind, type, section_index, other ); std::cout << j << " " << name << std::endl; - Check section s type - Build symbol section accessor - Get the number of symbols by using the symbol section accessor - Get particular symbol properties its name, value, etc. First we create a symbol_section_accessor class instance. Usually, accessors's constructors receive references to both the elfio and a section objects as parameters. The get_symbol() method is used for retrieving particular entries in the symbol table. 5
7 3.3 ELFDUMP UTILITY The source code for the ELF Dump Utility can be found in the "examples" directory. It heavily relies on dump facilities provided by the auxiliary header file <elfio_dump.hpp>. This header file demonstrates more accessor s usage examples. 3.4 ELF FILE WRITER In this chapter we will create a simple ELF executable file that prints out the classical Hello, World! message. The executable will be created and run on i386 Linux OS platform. It is supposed to run well on both 32 and 64-bit Linux platforms. The file will be created without invoking the compiler or assembler tools in the usual way (i.e. translating high level source code that makes use of the standard library functions). Instead, using the ELFIO writer, all the necessary sections and segments of the file will be created and filled explicitly, each, with its appropriate data. The physical file would then be created by the ELFIO library. Before starting, two implementation choices of elfio that users should be aware of are: 1. The ELF standard does not require that executables will contain any ELF sections only presence of ELF segments is mandatory. The elfio library, however, requires that all data will belong to sections. It means that in order to put data in a segment, a section should be created first. Sections are associated with segments by invoking the segment s member function add_section_index(). 2. The elfio writer class, while constructing, creates a string table section automatically. Our usage of the library API will consist of several steps: Creating an empty elfio object Setting-up ELF file properties Creating code section and data content for it Creating data section and its content Addition of both sections to corresponding ELF file segments Setting-up the program's entry point Dumping the elfio object to an executable ELF file 6
8 #include <elfio/elfio.hpp> using namespace ELFIO; int main( ) { elfio writer; writer.create( ELFCLASS32, ELFDATA2LSB ); writer.set_os_abi( ELFOSABI_LINUX ); writer.set_type( ET_EXEC ); writer.set_machine( EM_386 ); section* text_sec = writer.sections.add( ".text" ); text_sec->set_type( SHT_PROGBITS ); text_sec->set_flags( SHF_ALLOC SHF_EXECINSTR ); text_sec->set_addr_align( 0x10 ); char text[] = { '\xb8', '\x04', '\x00', '\x00', '\x00', // mov eax, 4 '\xbb', '\x01', '\x00', '\x00', '\x00', // mov ebx, 1 '\xb9', '\x20', '\x80', '\x04', '\x08', // mov ecx, msg '\xba', '\x0e', '\x00', '\x00', '\x00', // mov edx, 14 '\xcd', '\x80', // int 0x80 '\xb8', '\x01', '\x00', '\x00', '\x00', // mov eax, 1 '\xcd', '\x80' }; // int 0x80 text_sec->set_data( text, sizeof( text ) ); segment* text_seg = writer.segments.add(); text_seg->set_type( PT_LOAD ); text_seg->set_virtual_address( 0x ); text_seg->set_physical_address( 0x ); text_seg->set_flags( PF_X PF_R ); text_seg->set_align( 0x1000 ); text_seg->add_section_index( text_sec->get_index(), text_sec->get_addr_align() ); section* data_sec = writer.sections.add( ".data" ); data_sec->set_type( SHT_PROGBITS ); data_sec->set_flags( SHF_ALLOC SHF_WRITE ); data_sec->set_addr_align( 0x4 ); char data[] = { '\x48', '\x65', '\x6c', '\x6c', '\x6f', '\x2c', '\x20', '\x57', '\x6f', '\x72', '\x6c', '\x64', '\x21', '\x0a' }; data_sec->set_data( data, sizeof( data ) ); // Hello, World!\n segment* data_seg = writer.segments.add(); data_seg->set_type( PT_LOAD ); data_seg->set_virtual_address( 0x ); data_seg->set_physical_address( 0x ); data_seg->set_flags( PF_W PF_R ); data_seg->set_align( 0x10 ); data_seg->add_section_index( data_sec->get_index(), data_sec->get_addr_align() ); writer.set_entry( 0x ); writer.save( "hello_i386_32" ); } return 0; 7
9 - Initialize empty elfio object. This should be done as the first step when creating a new elfio object as other API is relying on parameters provided ELF file 32-bits/64-bits and little/big endianness - Other attributes of the file. Linux OS loader does not require full set of the attributes, but they are provided when a regular linker used for creation of ELF files - Create a new section, set section s attributes. Section type, flags and alignment have a big significance and controls how this section is treated by a linker or OS loader - Add section s data - Create new segment - Set attributes and properties for the segment - Associate a section with segment containing it - Setup entry point for your program - Create ELF binary file on disk Let s compile the example above (put into a source file named 'writer.cpp') into an executable file (named 'writer'). Invoking 'writer' will create the executable file "hello_i386_32" that prints the "Hello, World!" message. We'll change the permission attributes of this file, and finally, run it: > ls writer.cpp > g++ writer.cpp -o writer > ls writer writer.cpp >./writer > ls hello_i386_32 writer writer.cpp > chmod +x./hello_i386_32 >./hello_i386_32 Hello, World! In case you already compiled the elfdump utility, you can inspect the properties of the produced executable file (the.note section was not discussed in this tutorial, but it is produced by the sample file writer.cpp located in the examples folder of the library distribution): 8
10 ./elfdump hello_i386_32 ELF Header Class: ELF32 Encoding: Little endian ELFVersion: Current Type: Executable file Machine: Intel Version: Current Entry: 0x Flags: 0x0 Section Headers: [ Nr ] Type Addr Size ES Flg Lk Inf Al Name [ 0] NULL [ 1] STRTAB d shstrtab [ 2] PROGBITS d 00 AX text [ 3] PROGBITS e 00 WA data [ 4] NOTE note Key to Flags: W (write), A (alloc), X (execute) Segment headers: [ Nr ] Type VirtAddr PhysAddr FileSize Mem.Size Flags Align [ 0] LOAD d d RX [ 1] LOAD e e RW Note section (.note) No Type Name [ 0] Created by ELFIO [ 1] Never easier! Note: The elfio library takes care of the resulting binary file layout calculation. It does this on base of the provided memory image addresses and sizes. It is the user's responsibility to provide correct values for these parameters. Please refer to your OS (other execution environment or loader) manual for specific requirements related to executable ELF file attributes and/or mapping. Similarly to the reader example, you may use provided accessor classes to interpret and modify content of section s data. 9
11 4 ELFIO LIBRARY CLASSES This section contains detailed description of classes provided by elfio library 4.1 ELFIO Data members The ELFIO library's main class is elfio. The class contains two public data members: sections segments Data member Description The container stores ELFIO library section instances. Implements operator[], add() and size(). operator[] permits access to individual ELF file section according to its index or section name. operator[] is capable to provide section pointer according to section index or section name. begin() and end() iterators are available too. The container stores ELFIO library segment instances. Implements operator[], add() and size(). operator[] permits access to individual ELF file segment according to its index. operator[] is capable to provide section pointer according to segment index. begin() and end() iterators are available too Member functions Here is the list of elfio public member functions. The functions permit to retrieve or set ELF file properties. Member Function Description elfio() The constructor. ~elfio() The destructor. create( file_class, encoding ) bool load( const std::string& file_name ) Cleans and/or initializes elfio object. file_class is either ELFCLASS32 or ELFCLASS64. file_class is either ELFDATA2LSB or ELFDATA2MSB. Initializes elfio object by loading data from ELF binary file. File name provided in file_name. Returns true if the file was processed successfully. 10
12 bool save( const std::string& file_name ) get_class() get_elf_version() get_encoding() get_version() get_header_size() get_section_entry_size() get_segment_entry_size() get_os_abi() set_os_abi( value ) get_abi_version(); set_abi_version( value ) get_type() set_type( value ) Creates a file in ELF binary format. File name provided in file_name. Returns true if the file was created successfully. Returns ELF file class. Possible values are ELFCLASS32 or ELFCLASS64. Returns ELF file format version. Returns ELF file format encoding. Possible values are ELFDATA2LSB and ELFDATA2MSB. Identifies the object file version. Returns the ELF header's size in bytes. Returns a section's entry size in ELF file header section table. Returns a segment's entry size in ELF file header program table. Returns operating system ABI identification. Sets operating system ABI identification. Returns ABI version. Sets ABI version. Returns the object file type. Sets the object file type. get_machine() set_machine( value ) Returns the object file's architecture. Sets the object file's architecture. get_flags () Returns processor-specific flags associated with the file. 11
13 set_flags( value ) Elf64_Addr get_entry() set_entry( Elf64_Addr value ) Elf64_Off get_sections_offset() set_sections_offset( Elf64_Off value ) Elf64_Off get_segments_offset() set_segments_offset( Elf64_Off value ) get_section_name_str_index() set_section_name_str_index( value ) endianess_convertor& get_convertor() Elf_Xword get_default_entry_size( section_type ) Sets processor-specific flags associated with the file. Returns the virtual address to which the system first transfers control. Sets the virtual address to which the system first transfers control. Returns the section header table's file offset in bytes. Sets the section header table's file offset. Attention! The value can be overridden by the library, when it creates new ELF file layout. Returns the program header table's file offset. Sets the program header table's file offset. Attention! The value can be overridden by the library, when it creates new ELF file layout. Returns the section header table index of the entry associated with the section name string table. Sets the section header table index of the entry associated with the section name string table. Returns endianess convertor reference for the specific elfio object instance. Returns default entry size for known section types having different values on 32 and 64 bit architectures. At the moment, only SHT_RELA, SHT_REL, SHT_SYMTAB and SHT_DYNAMIC are 'known' section types. The function returns 0 for other section types. 12
14 4.2 SECTION Class section has no public data members Member functions section public member functions listed in the table below. These functions permit to retrieve or set ELF file section properties section() ~section() Member Function Description The default constructor. No section class instances are created manually. Usually, add method is used for sections data member of elfio object The destructor. get_index() Set functions: Returns section index. Sometimes, this index is passed to another section for inter-referencing between the sections. Section s index is also passed to segment for segment/section association Sets attributes for the section set_name( std::string ) set_type( ) set_flags( Elf_Xword ) set_info( ) set_link( ) set_addr_align( Elf_Xword ) set_entry_size( Elf_Xword ) set_address( Elf64_Addr ) set_size( Elf_Xword ) set_name_string_offset( ) Get functions: Returns section attributes std::string get_name() get_type() Elf_Xword get_flags() get_info() get_link() Elf_Xword get_addr_align() Elf_Xword get_entry_size() Elf64_Addr get_address() Elf_Xword get_size() get_name_string_offset() 13
15 Data manipulation functions: Manages section data const char* get_data() set_data( const char* pdata, size ) set_data( const std::string& data ) append_data( const char* pdata, size ) append_data( const std::string& data ) 4.3 SEGMENT Class segment has no public data members Member functions segment public member functions listed in the table below. These functions permit to retrieve or set ELF file segment properties segment() ~segment() Member Function Description The default constructor. No segment class instances are created manually. Usually, add method is used for segments data member of elfio object The destructor. get_index() Set functions: Returns segment s index Sets attributes for the segment set_type( ) set_flags( ) set_align( Elf_Xword ) set_virtual_address( Elf64_Addr ) set_physical_address( Elf64_Addr ) set_file_size( Elf_Xword ) 14
16 set_memory_size( Elf_Xword ) Get functions: get_type() get_flags() Elf_Xword get_align() Elf64_Addr get_virtual_address() Elf64_Addr get_physical_address() Elf_Xword get_file_size() Elf_Xword get_memory_size() add_section_index( index, Elf_Xword addr_align ) Returns segment attributes Manages segment-section association get_sections_num() get_section_index_at( num ) const char* get_data() Provides content of segment s data 4.4 STRING_SECTION_ACCESSOR Member functions Member Function string_section_accessor( section* section_ ) const char* get_string( index ) add_string( const char* str ) The constructor Description Retrieves string by its offset (index) in the section Appends section data with new string. Returns position (index) of the new record add_string( const std::string& str ) 15
17 4.5 SYMBOL_SECTION_ACCESSOR Member functions Member Function symbol_section_accessor( const elfio& elf_file, section* symbols_section ) get_index() Elf_Xword get_symbols_num() Get functions: bool get_symbol( Elf_Xword index, std::string& name, Elf64_Addr& value, Elf_Xword& size, & bind, & type, & section_index, & other ) bool get_symbol( const std::string& name, Elf64_Addr& value, Elf_Xword& size, & bind, & type, & section_index, & other ) add_symbol( name, Elf64_Addr value, Elf_Xword size, info, other, shndx ) The constructor Description Returns segment s index Returns number of symbols in the section Retrieves symbol properties by symbol index or name Adds symbol to the symbol table updating corresponding string section if required add_symbol( 16
18 name, Elf64_Addr value, Elf_Xword size, bind, type, other, shndx ) add_symbol( string_section_accessor& pstrwriter, const char* str, Elf64_Addr value, Elf_Xword size, info, other, shndx ) add_symbol( string_section_accessor& pstrwriter, const char* str, Elf64_Addr value, Elf_Xword size, bind, type, other, shndx ) 4.6 RELOCATION_SECTION_ACCESSOR Member functions Member Function relocation_section_accessor( const elfio& elf_file_, section* section_ ) Elf_Xword get_entries_num() bool get_entry( Elf_Xword index, Elf64_Addr& offset, & symbol, The constructor Description Retrieves number of relocation entries in the section Retrieves properties for relocation entry by its index. Calculated value in the second flavor of this function may not work for all architectures 17
19 & type, Elf_Sxword& addend ) bool get_entry( Elf_Xword index, Elf64_Addr& offset, Elf64_Addr& symbolvalue, std::string& symbolname, & type, Elf_Sxword& addend, Elf_Sxword& calcvalue ) add_entry( Elf64_Addr offset, Elf_Xword info ) add_entry( Elf64_Addr offset, symbol, type ) Adds new relocation entry. The last function in this set is capable to add relocation entry for a symbol, automatically updating symbol and string tables for this symbol add_entry( Elf64_Addr offset, Elf_Xword info, Elf_Sxword addend ) add_entry( Elf64_Addr offset, symbol, type, Elf_Sxword addend ) add_entry( string_section_accessor str_writer, const char* str, symbol_section_accessor sym_writer, Elf64_Addr value, size, sym_info, other, shndx, Elf64_Addr offset, type ) 18
20 4.7 DYNAMIC_SECTION_ACCESSOR Member functions Member Function dynamic_section_accessor ( elfio& elf_file_, section* section_ ) Elf_Xword get_entries_num() bool get_entry( Elf_Xword index, Elf_Xword& tag, Elf_Xword& value, std::string& str ) add_entry( Elf_Xword& tag, Elf_Xword& value ) add_entry( Elf_Xword& tag, std::string& str ) The constructor Description Retrieves number of dynamic section entries in the section Retrieves properties for dynamic section entry by its index. For most entries only tag and value arguments are relevant. str argument is empty string in this case. If tag equal to DT_NEEDED, DT_SONAME, DT_RPATH or DT_RUNPATH, str argument is filled with value taken from dynamic string table section. Adds new dynamic section entry. The second variant of the function updates the dynamic string table updating the entry with string table index. 4.8 NOTE_SECTION_ACCESSOR Member functions Member Function note_section_accessor( const elfio& elf_file_, section* section_ ) get_notes_num() bool get_note( index, The constructor Description Retrieves number of note entries in the section Retrieves particular note by its index 19
21 & type, std::string& name, *& desc, & descsize ) add_note( type, const std::string& name, const * desc, descsize ) Appends the section with a new note 20
Motorola 8- and 16-bit Embedded Application Binary Interface (M8/16EABI)
Motorola 8- and 16-bit Embedded Application Binary Interface (M8/16EABI) SYSTEM V APPLICATION BINARY INTERFACE Motorola M68HC05, M68HC08, M68HC11, M68HC12, and M68HC16 Processors Supplement Version 2.0
How To Write A 32 Bit File System On A Microsoft Microsoft Powerbook 2.2.2 (I.O.2) (I2) And I2.1.2-2.3 (I3) (Ii
I Executable and Linkable Format (ELF) Contents Preface OBJECT FILES 1 Introduction 1-1 ELF Header 1-3 Sections 1-8 String Table 1-16 Symbol Table 1-17 Relocation 1-21 PROGRAM LOADING AND DYNAMIC LINKING
Caml Virtual Machine File & data formats Document version: 1.4 http://cadmium.x9c.fr
Caml Virtual Machine File & data formats Document version: 1.4 http://cadmium.x9c.fr Copyright c 2007-2010 Xavier Clerc [email protected] Released under the LGPL version 3 February 6, 2010 Abstract: This
CORBA Programming with TAOX11. The C++11 CORBA Implementation
CORBA Programming with TAOX11 The C++11 CORBA Implementation TAOX11: the CORBA Implementation by Remedy IT TAOX11 simplifies development of CORBA based applications IDL to C++11 language mapping is easy
Intel Itanium Processorspecific
Intel Itanium Processorspecific Application Binary Interface (ABI) May 2001 Document Number: 245370-003 Information in this document is provided in connection with Intel products. No license, express or
An Incomplete C++ Primer. University of Wyoming MA 5310
An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages
64-Bit NASM Notes. Invoking 64-Bit NASM
64-Bit NASM Notes The transition from 32- to 64-bit architectures is no joke, as anyone who has wrestled with 32/64 bit incompatibilities will attest We note here some key differences between 32- and 64-bit
Binary storage of graphs and related data
EÖTVÖS LORÁND UNIVERSITY Faculty of Informatics Department of Algorithms and their Applications Binary storage of graphs and related data BSc thesis Author: Frantisek Csajka full-time student Informatics
For a 64-bit system. I - Presentation Of The Shellcode
#How To Create Your Own Shellcode On Arch Linux? #Author : N3td3v!l #Contact-mail : [email protected] #Website : Nopotm.ir #Spcial tnx to : C0nn3ct0r And All Honest Hackerz and Security Managers I - Presentation
Off-by-One exploitation tutorial
Off-by-One exploitation tutorial By Saif El-Sherei www.elsherei.com Introduction: I decided to get a bit more into Linux exploitation, so I thought it would be nice if I document this as a good friend
Hacking Techniques & Intrusion Detection. Ali Al-Shemery arabnix [at] gmail
Hacking Techniques & Intrusion Detection Ali Al-Shemery arabnix [at] gmail All materials is licensed under a Creative Commons Share Alike license http://creativecommonsorg/licenses/by-sa/30/ # whoami Ali
C++ Programming Language
C++ Programming Language Lecturer: Yuri Nefedov 7th and 8th semesters Lectures: 34 hours (7th semester); 32 hours (8th semester). Seminars: 34 hours (7th semester); 32 hours (8th semester). Course abstract
Informatica e Sistemi in Tempo Reale
Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)
CS61: Systems Programing and Machine Organization
CS61: Systems Programing and Machine Organization Fall 2009 Section Notes for Week 2 (September 14 th - 18 th ) Topics to be covered: I. Binary Basics II. Signed Numbers III. Architecture Overview IV.
Keil C51 Cross Compiler
Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation
An API for Reading the MySQL Binary Log
An API for Reading the MySQL Binary Log Mats Kindahl Lead Software Engineer, MySQL Replication & Utilities Lars Thalmann Development Director, MySQL Replication, Backup & Connectors
The C Programming Language course syllabus associate level
TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming
The programming language C. sws1 1
The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan
An Introduction to Assembly Programming with the ARM 32-bit Processor Family
An Introduction to Assembly Programming with the ARM 32-bit Processor Family G. Agosta Politecnico di Milano December 3, 2011 Contents 1 Introduction 1 1.1 Prerequisites............................. 2
Illustration 1: Diagram of program function and data flow
The contract called for creation of a random access database of plumbing shops within the near perimeter of FIU Engineering school. The database features a rating number from 1-10 to offer a guideline
URI and UUID. Identifying things on the Web.
URI and UUID Identifying things on the Web. Overview > Uniform Resource Identifiers (URIs) > URIStreamOpener > Universally Unique Identifiers (UUIDs) Uniform Resource Identifiers > Uniform Resource Identifiers
Comp151. Definitions & Declarations
Comp151 Definitions & Declarations Example: Definition /* reverse_printcpp */ #include #include using namespace std; int global_var = 23; // global variable definition void reverse_print(const
Network Programming. Writing network and internet applications.
Network Programming Writing network and internet applications. Overview > Network programming basics > Sockets > The TCP Server Framework > The Reactor Framework > High Level Protocols: HTTP, FTP and E-Mail
Stack Overflows. Mitchell Adair
Stack Overflows Mitchell Adair Outline Why? What? There once was a VM Virtual Memory Registers Stack stack1, stack2, stack3 Resources Why? Real problem Real money Real recognition Still prevalent Very
Reading and Writing PCD Files The PCD File Format The Grabber Interface Writing a Custom Grabber PCL :: I/O. Suat Gedikli, Nico Blodow
PCL :: I/O Suat Gedikli, Nico Blodow July 1, 2011 Outline 1. Reading and Writing PCD Files 2. The PCD File Format 3. The Grabber Interface 4. Writing a Custom Grabber global functions in the namespace
Computer Programming C++ Classes and Objects 15 th Lecture
Computer Programming C++ Classes and Objects 15 th Lecture 엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University Copyrights 2013 Eom, Hyeonsang All Rights Reserved Outline
Application Note. Introduction AN2471/D 3/2003. PC Master Software Communication Protocol Specification
Application Note 3/2003 PC Master Software Communication Protocol Specification By Pavel Kania and Michal Hanak S 3 L Applications Engineerings MCSL Roznov pod Radhostem Introduction The purpose of this
Sources: On the Web: Slides will be available on:
C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,
13 Classes & Objects with Constructors/Destructors
13 Classes & Objects with Constructors/Destructors 13.1 Introduction In object oriented programming, the emphasis is on data rather than function. Class is a way that binds the data & function together.
Logging. Working with the POCO logging framework.
Logging Working with the POCO logging framework. Overview > Messages, Loggers and Channels > Formatting > Performance Considerations Logging Architecture Message Logger Channel Log File Logging Architecture
Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) [email protected] http://www.mzahran.com
CSCI-UA.0201-003 Computer Systems Organization Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) [email protected] http://www.mzahran.com Some slides adapted (and slightly modified)
Embedded Software Development
Linköpings Tekniska Högskola Institutionen för Datavetanskap (IDA), Software and Systems (SaS) TDDI11, Embedded Software 2010-04-22 Embedded Software Development Host and Target Machine Typical embedded
Chapter 7D The Java Virtual Machine
This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly
APPLICATION NOTE. Atmel AVR911: AVR Open Source Programmer. 8-bit Atmel Microcontrollers. Features. Introduction
APPLICATION NOTE Atmel AVR911: AVR Open Source Programmer 8-bit Atmel Microcontrollers Features Open source C++ code Modular design Reads device information from the Atmel AVR Studio XML files Supports
Memory Systems. Static Random Access Memory (SRAM) Cell
Memory Systems This chapter begins the discussion of memory systems from the implementation of a single bit. The architecture of memory chips is then constructed using arrays of bit implementations coupled
Systems Design & Programming Data Movement Instructions. Intel Assembly
Intel Assembly Data Movement Instruction: mov (covered already) push, pop lea (mov and offset) lds, les, lfs, lgs, lss movs, lods, stos ins, outs xchg, xlat lahf, sahf (not covered) in, out movsx, movzx
Buffer Overflows. Security 2011
Buffer Overflows Security 2011 Memory Organiza;on Topics Kernel organizes memory in pages Typically 4k bytes Processes operate in a Virtual Memory Space Mapped to real 4k pages Could live in RAM or be
Lazy OpenCV installation and use with Visual Studio
Lazy OpenCV installation and use with Visual Studio Overview This tutorial will walk you through: How to install OpenCV on Windows, both: The pre-built version (useful if you won t be modifying the OpenCV
Coding conventions and C++-style
Chapter 1 Coding conventions and C++-style This document provides an overview of the general coding conventions that are used throughout oomph-lib. Knowledge of these conventions will greatly facilitate
ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters
The char Type ASCII Encoding The C char type stores small integers. It is usually 8 bits. char variables guaranteed to be able to hold integers 0.. +127. char variables mostly used to store characters
MADRAS: Multi-Architecture Binary Rewriting Tool Technical report. Cédric Valensi University of Versailles Saint-Quentin en Yvelines
MADRAS: Multi-Architecture Binary Rewriting Tool Technical report Cédric Valensi University of Versailles Saint-Quentin en Yvelines September 2, 2013 Chapter 1 Introduction In the domain of High Performance
C++ INTERVIEW QUESTIONS
C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get
CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08
CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 20: Stack Frames 7 March 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Where We Are Source code if (b == 0) a = b; Low-level IR code
Cross-platform event logging in Object Pascal
Cross-platform event logging in Object Pascal Micha el Van Canneyt June 24, 2007 1 Introduction Often, a program which works in the background or sits in the windows system tray needs to write some diagnostic
ISIS Application Program Interface ISIS_DLL User s Manual. Preliminary Version
ISIS Application Program Interface ISIS_DLL User s Manual Preliminary Version BIREME, São Paulo, July 2001 Copyright (c) 2001 BIREME Permission is granted to copy, distribute and/or modify this document
SQLITE C/C++ TUTORIAL
http://www.tutorialspoint.com/sqlite/sqlite_c_cpp.htm SQLITE C/C++ TUTORIAL Copyright tutorialspoint.com Installation Before we start using SQLite in our C/C++ programs, we need to make sure that we have
How To Write Portable Programs In C
Writing Portable Programs COS 217 1 Goals of Today s Class Writing portable programs in C Sources of heterogeneity Data types, evaluation order, byte order, char set, Reading period and final exam Important
Format string exploitation on windows Using Immunity Debugger / Python. By Abysssec Inc WwW.Abysssec.Com
Format string exploitation on windows Using Immunity Debugger / Python By Abysssec Inc WwW.Abysssec.Com For real beneficiary this post you should have few assembly knowledge and you should know about classic
Binary compatibility for library developers. Thiago Macieira, Qt Core Maintainer LinuxCon North America, New Orleans, Sept. 2013
Binary compatibility for library developers Thiago Macieira, Qt Core Maintainer LinuxCon North America, New Orleans, Sept. 2013 Who am I? Open Source developer for 15 years C++ developer for 13 years Software
Variable Base Interface
Chapter 6 Variable Base Interface 6.1 Introduction Finite element codes has been changed a lot during the evolution of the Finite Element Method, In its early times, finite element applications were developed
CS 103 Lab Linux and Virtual Machines
1 Introduction In this lab you will login to your Linux VM and write your first C/C++ program, compile it, and then execute it. 2 What you will learn In this lab you will learn the basic commands and navigation
Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.
Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to
Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas
CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage
How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint)
TN203 Porting a Program to Dynamic C Introduction Dynamic C has a number of improvements and differences compared to many other C compiler systems. This application note gives instructions and suggestions
umps software development
Laboratorio di Sistemi Operativi Anno Accademico 2006-2007 Software Development with umps Part 2 Mauro Morsiani Software development with umps architecture: Assembly language development is cumbersome:
Software security. Buffer overflow attacks SQL injections. Lecture 11 EIT060 Computer Security
Software security Buffer overflow attacks SQL injections Lecture 11 EIT060 Computer Security Buffer overflow attacks Buffer overrun is another common term Definition A condition at an interface under which
風 水. Heap Feng Shui in JavaScript. Alexander Sotirov. [email protected]
風 水 Heap Feng Shui in JavaScript Alexander Sotirov [email protected] Black Hat Europe 2007 Introduction What is Heap Feng Shui? the ancient art of arranging heap blocks in order to redirect the program
Syscall 5. Erik Jonsson School of Engineering and Computer Science. The University of Texas at Dallas
Syscall 5 System call 5 allows input of numerical data from the keyboard while a program is running. Syscall 5 is a bit unusual, in that it requires the use of register $v0 twice. In syscall 5 (as for
Embedded Software development Process and Tools: Lesson-4 Linking and Locating Software
Embedded Software development Process and Tools: Lesson-4 Linking and Locating Software 1 1. Linker 2 Linker Links the compiled codes of application software, object codes from library and OS kernel functions.
Computer Organization and Architecture
Computer Organization and Architecture Chapter 11 Instruction Sets: Addressing Modes and Formats Instruction Set Design One goal of instruction set design is to minimize instruction length Another goal
Fast Arithmetic Coding (FastAC) Implementations
Fast Arithmetic Coding (FastAC) Implementations Amir Said 1 Introduction This document describes our fast implementations of arithmetic coding, which achieve optimal compression and higher throughput by
Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C
Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C 1 An essential part of any embedded system design Programming 2 Programming in Assembly or HLL Processor and memory-sensitive
Applying Clang Static Analyzer to Linux Kernel
Applying Clang Static Analyzer to Linux Kernel 2012/6/7 FUJITSU COMPUTER TECHNOLOGIES LIMITED Hiroo MATSUMOTO 管 理 番 号 1154ka1 Copyright 2012 FUJITSU COMPUTER TECHNOLOGIES LIMITED Abstract Now there are
Randy Hyde s Win32 Assembly Language Tutorials (Featuring HOWL) #4: Radio Buttons
Randy Hyde s Win32 Assembly Language Tutorials Featuring HOWL #4: Radio Buttons In this fourth tutorial of this series, we ll take a look at implementing radio buttons on HOWL forms. Specifically, we ll
Compiler Construction
Compiler Construction Lecture 1 - An Overview 2003 Robert M. Siegfried All rights reserved A few basic definitions Translate - v, a.to turn into one s own language or another. b. to transform or turn from
Basics of I/O Streams and File I/O
Basics of This is like a cheat sheet for file I/O in C++. It summarizes the steps you must take to do basic I/O to and from files, with only a tiny bit of explanation. It is not a replacement for reading
W4118 Operating Systems. Junfeng Yang
W4118 Operating Systems Junfeng Yang Outline Linux overview Interrupt in Linux System call in Linux What is Linux A modern, open-source OS, based on UNIX standards 1991, 0.1 MLOC, single developer Linus
MPLAB TM C30 Managed PSV Pointers. Beta support included with MPLAB C30 V3.00
MPLAB TM C30 Managed PSV Pointers Beta support included with MPLAB C30 V3.00 Contents 1 Overview 2 1.1 Why Beta?.............................. 2 1.2 Other Sources of Reference..................... 2 2
OPERATING SYSTEM - MEMORY MANAGEMENT
OPERATING SYSTEM - MEMORY MANAGEMENT http://www.tutorialspoint.com/operating_system/os_memory_management.htm Copyright tutorialspoint.com Memory management is the functionality of an operating system which
Data Structures Using C++ 2E. Chapter 5 Linked Lists
Data Structures Using C++ 2E Chapter 5 Linked Lists Test #1 Next Thursday During Class Cover through (near?) end of Chapter 5 Objectives Learn about linked lists Become aware of the basic properties of
C++ Overloading, Constructors, Assignment operator
C++ Overloading, Constructors, Assignment operator 1 Overloading Before looking at the initialization of objects in C++ with constructors, we need to understand what function overloading is In C, two functions
Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine
7 Objectives After completing this lab you will: know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine Introduction Branches and jumps provide ways to change
Efficient Low-Level Software Development for the i.mx Platform
Freescale Semiconductor Application Note Document Number: AN3884 Rev. 0, 07/2009 Efficient Low-Level Software Development for the i.mx Platform by Multimedia Applications Division Freescale Semiconductor,
Linux/UNIX System Programming. POSIX Shared Memory. Michael Kerrisk, man7.org c 2015. February 2015
Linux/UNIX System Programming POSIX Shared Memory Michael Kerrisk, man7.org c 2015 February 2015 Outline 22 POSIX Shared Memory 22-1 22.1 Overview 22-3 22.2 Creating and opening shared memory objects 22-10
Java Interview Questions and Answers
1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java
Xbox 360 File Specifications Reference
Xbox 360 File Specifications Reference Introduction This reference attempts to document the specifications of the custom data formats in use by the Xbox 360 console. This data has either been discovered
Object Oriented Software Design II
Object Oriented Software Design II Real Application Design Christian Nastasi http://retis.sssup.it/~lipari http://retis.sssup.it/~chris/cpp Scuola Superiore Sant Anna Pisa April 25, 2012 C. Nastasi (Scuola
Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies)
Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies) Duration of Course: 6 Months Fees: Rs. 25,000/- (including Service Tax) Eligibility: B.E./B.Tech., M.Sc.(IT/ computer
sys socketcall: Network systems calls on Linux
sys socketcall: Network systems calls on Linux Daniel Noé April 9, 2008 The method used by Linux for system calls is explored in detail in Understanding the Linux Kernel. However, the book does not adequately
Lab 4: Socket Programming: netcat part
Lab 4: Socket Programming: netcat part Overview The goal of this lab is to familiarize yourself with application level programming with sockets, specifically stream or TCP sockets, by implementing a client/server
Lecture 22: C Programming 4 Embedded Systems
Lecture 22: C Programming 4 Embedded Systems Today s Goals Basic C programming process Variables and constants in C Pointers to access addresses Using a High Level Language High-level languages More human
Appendix M: Introduction to Microsoft Visual C++ 2010 Express Edition
Appendix M: Introduction to Microsoft Visual C++ 2010 Express Edition This book may be ordered from Addison-Wesley in a value pack that includes Microsoft Visual C++ 2010 Express Edition. Visual C++ 2010
Intel TSX (Transactional Synchronization Extensions) Mike Dai Wang and Mihai Burcea
Intel TSX (Transactional Synchronization Extensions) Mike Dai Wang and Mihai Burcea 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Example: toy banking application with RTM Code written and tested in
LC-3 Assembly Language
LC-3 Assembly Language Programming and tips Textbook Chapter 7 CMPE12 Summer 2008 Assembly and Assembler Machine language - binary Assembly language - symbolic 0001110010000110 An assembler is a program
Introduction to MIPS Assembly Programming
1 / 26 Introduction to MIPS Assembly Programming January 23 25, 2013 2 / 26 Outline Overview of assembly programming MARS tutorial MIPS assembly syntax Role of pseudocode Some simple instructions Integer
C++ Language Tutorial
cplusplus.com C++ Language Tutorial Written by: Juan Soulié Last revision: June, 2007 Available online at: http://www.cplusplus.com/doc/tutorial/ The online version is constantly revised and may contain
Glossary of Object Oriented Terms
Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction
1 The Java Virtual Machine
1 The Java Virtual Machine About the Spec Format This document describes the Java virtual machine and the instruction set. In this introduction, each component of the machine is briefly described. This
1 Abstract Data Types Information Hiding
1 1 Abstract Data Types Information Hiding 1.1 Data Types Data types are an integral part of every programming language. ANSI-C has int, double and char to name just a few. Programmers are rarely content
Next, the driver runs the C compiler (cc1), which translates main.i into an ASCII assembly language file main.s.
Chapter 7 Linking Linking is the process of collecting and combining various pieces of code and data into a single file that can be loaded (copied) into memory and executed. Linking can be performed at
MPLAB Harmony System Service Libraries Help
MPLAB Harmony System Service Libraries Help MPLAB Harmony Integrated Software Framework v1.08 All rights reserved. This section provides descriptions of the System Service libraries that are available
Intel P6 Systemprogrammering 2007 Föreläsning 5 P6/Linux Memory System
Intel P6 Systemprogrammering 07 Föreläsning 5 P6/Linux ory System Topics P6 address translation Linux memory management Linux page fault handling memory mapping Internal Designation for Successor to Pentium
Generating a Recognizer from Declarative Machine Descriptions
Generating a Recognizer from Declarative Machine Descriptions João Dias and Norman Ramsey Division of Engineering and Applied Sciences Harvard University {dias,nr}@eecs.harvard.edu Abstract Writing an
8.5. <summary>...26 9. Cppcheck addons...27 9.1. Using Cppcheck addons...27 9.1.1. Where to find some Cppcheck addons...27 9.2.
Cppcheck 1.72 Cppcheck 1.72 Table of Contents 1. Introduction...1 2. Getting started...2 2.1. First test...2 2.2. Checking all files in a folder...2 2.3. Excluding a file or folder from checking...2 2.4.
Simple Image File Formats
Chapter 2 Simple Image File Formats 2.1 Introduction The purpose of this lecture is to acquaint you with the simplest ideas in image file format design, and to get you ready for this week s assignment
Project No. 2: Process Scheduling in Linux Submission due: April 28, 2014, 11:59pm
Project No. 2: Process Scheduling in Linux Submission due: April 28, 2014, 11:59pm PURPOSE Getting familiar with the Linux kernel source code. Understanding process scheduling and how different parameters
