Jump to content

Nytro

Administrators
  • Posts

    18725
  • Joined

  • Last visited

  • Days Won

    706

Everything posted by Nytro

  1. Nytro

    [PERL] Ajutor

    Foarte probabil exploitul nu mai e functional. Oricum, iti trebuie o lista cu parole, si asta face bruteforce. Ai dat 5 argumente in linia de comanda? Si ce anume ai modificat?
  2. Nytro

    Raid-uri

    Mie mi se par o prostie, dar daca am timp fac un script care sa posteze automat sau ce faceti voi acolo
  3. Optimizing subroutines in assembly language An optimization guide for x86 platforms Contents 1 Introduction ....................................................................................................................... 4 1.1 Reasons for using assembly code .............................................................................. 5 1.2 Reasons for not using assembly code ........................................................................ 5 1.3 Microprocessors covered by this manual .................................................................... 6 1.4 Operating systems covered by this manual................................................................. 7 2 Before you start................................................................................................................. 7 2.1 Things to decide before you start programming .......................................................... 7 2.2 Make a test strategy.................................................................................................... 9 2.3 Common coding pitfalls............................................................................................... 9 3 The basics of assembly coding........................................................................................ 12 3.1 Assemblers available................................................................................................ 12 3.2 Register set and basic instructions............................................................................ 14 3.3 Addressing modes .................................................................................................... 18 3.4 Instruction code format ............................................................................................. 24 3.5 Instruction prefixes.................................................................................................... 25 4 ABI standards.................................................................................................................. 27 4.1 Register usage.......................................................................................................... 27 4.2 Data storage ............................................................................................................. 28 4.3 Function calling conventions ..................................................................................... 28 4.4 Name mangling and name decoration ...................................................................... 30 4.5 Function examples.................................................................................................... 30 5 Using intrinsic functions in C++ ....................................................................................... 33 5.1 Using intrinsic functions for system code .................................................................. 34 5.2 Using intrinsic functions for instructions not available in standard C++ ..................... 35 5.3 Using intrinsic functions for vector operations ........................................................... 35 5.4 Availability of intrinsic functions................................................................................. 35 6 Using inline assembly in C++ .......................................................................................... 35 6.1 MASM style inline assembly ..................................................................................... 36 6.2 Gnu style inline assembly ......................................................................................... 41 7 Using an assembler......................................................................................................... 44 7.1 Static link libraries..................................................................................................... 45 7.2 Dynamic link libraries................................................................................................ 46 7.3 Libraries in source code form.................................................................................... 47 7.4 Making classes in assembly...................................................................................... 48 7.5 Thread-safe functions ............................................................................................... 49 7.6 Makefiles ..................................................................................................................50 8 Making function libraries compatible with multiple compilers and platforms..................... 51 8.1 Supporting multiple name mangling schemes........................................................... 51 8.2 Supporting multiple calling conventions in 32 bit mode ............................................. 53 8.3 Supporting multiple calling conventions in 64 bit mode ............................................. 55 8.4 Supporting different object file formats...................................................................... 57 8.5 Supporting other high level languages ...................................................................... 58 9 Optimizing for speed ....................................................................................................... 59 9.1 Identify the most critical parts of your code ............................................................... 59 9.2 Out of order execution .............................................................................................. 59 2 9.3 Instruction fetch, decoding and retirement ................................................................ 62 9.4 Instruction latency and throughput ............................................................................ 63 9.5 Break dependency chains......................................................................................... 64 9.6 Jumps and calls ........................................................................................................ 65 10 Optimizing for size......................................................................................................... 72 10.1 Choosing shorter instructions.................................................................................. 72 10.2 Using shorter constants and addresses .................................................................. 73 10.3 Reusing constants .................................................................................................. 75 10.4 Constants in 64-bit mode ........................................................................................ 75 10.5 Addresses and pointers in 64-bit mode................................................................... 75 10.6 Making instructions longer for the sake of alignment............................................... 77 11 Optimizing memory access............................................................................................ 80 11.1 How caching works................................................................................................. 80 11.2 Trace cache............................................................................................................ 81 11.3 Alignment of data.................................................................................................... 82 11.4 Alignment of code ................................................................................................... 84 11.5 Organizing data for improved caching..................................................................... 86 11.6 Organizing code for improved caching.................................................................... 86 11.7 Cache control instructions....................................................................................... 87 12 Loops ............................................................................................................................ 87 12.1 Minimize loop overhead .......................................................................................... 87 12.2 Induction variables.................................................................................................. 90 12.3 Move loop-invariant code........................................................................................ 91 12.4 Find the bottlenecks................................................................................................ 91 12.5 Instruction fetch, decoding and retirement in a loop ................................................ 92 12.6 Distribute µops evenly between execution units...................................................... 92 12.7 An example of analysis for bottlenecks on PM........................................................ 93 12.8 Same example on Core2 ........................................................................................ 96 12.9 Loop unrolling ......................................................................................................... 98 12.10 Optimize caching ................................................................................................ 100 12.11 Parallelization ..................................................................................................... 101 12.12 Analyzing dependences...................................................................................... 102 12.13 Loops on processors without out-of-order execution........................................... 105 12.14 Macro loops ........................................................................................................ 107 13 Vector programming.................................................................................................... 109 13.1 Conditional moves in SIMD registers .................................................................... 110 13.2 Using vector instructions with other types of data than they are intended for ........ 113 13.3 Shuffling data........................................................................................................ 115 13.4 Generating constants............................................................................................ 118 13.5 Accessing unaligned data ..................................................................................... 121 13.6 Using AVX instruction set and YMM registers ....................................................... 125 13.7 Vector operations in general purpose registers ..................................................... 130 14 Multithreading.............................................................................................................. 131 14.1 Hyperthreading ..................................................................................................... 132 15 CPU dispatching.......................................................................................................... 132 15.1 Checking for operating system support for XMM and YMM registers .................... 134 16 Problematic Instructions .............................................................................................. 135 16.1 LEA instruction (all processors)............................................................................. 135 16.2 INC and DEC (all Intel processors) ....................................................................... 136 16.3 XCHG (all processors) .......................................................................................... 136 16.4 Shifts and rotates (P4) .......................................................................................... 136 16.5 Rotates through carry (all processors) .................................................................. 137 16.6 Bit test (all processors) ......................................................................................... 137 16.7 LAHF and SAHF (all processors) .......................................................................... 137 16.8 Integer multiplication (all processors).................................................................... 137 16.9 Division (all processors)........................................................................................ 137 16.10 String instructions (all processors) ...................................................................... 142 16.11 WAIT instruction (all processors) ........................................................................ 143 3 16.12 FCOM + FSTSW AX (all processors).................................................................. 144 16.13 FPREM (all processors) ...................................................................................... 145 16.14 FRNDINT (all processors)................................................................................... 145 16.15 FSCALE and exponential function (all processors) ............................................. 145 16.16 FPTAN (all processors)....................................................................................... 147 16.17 FSQRT (SSE processors)................................................................................... 147 16.18 FLDCW (Most Intel processors) .......................................................................... 147 17 Special topics .............................................................................................................. 148 17.1 XMM versus floating point registers (Processors with SSE).................................. 148 17.2 MMX versus XMM registers (Processors with SSE2)............................................ 149 17.3 XMM versus YMM registers (Processors with AVX).............................................. 149 17.4 Freeing floating point registers (all processors)..................................................... 150 17.5 Transitions between floating point and MMX instructions (Processors with MMX). 150 17.6 Converting from floating point to integer (All processors) ...................................... 150 17.7 Using integer instructions for floating point operations .......................................... 152 17.8 Using floating point instructions for integer operations .......................................... 154 17.9 Moving blocks of data (All processors).................................................................. 155 17.10 Self-modifying code (All processors) ................................................................... 156 18 Measuring performance............................................................................................... 156 18.1 Testing speed ....................................................................................................... 156 18.2 The pitfalls of unit-testing ...................................................................................... 158 19 Literature..................................................................................................................... 158 20 Copyright notice .......................................................................................................... 159 Download: http://www.speedyshare.com/files/24051425/optimizing_assembly.pdf
  4. Optimizing software in C++ An optimization guide for Windows, Linux and Mac platforms Contents 1 Introduction ....................................................................................................................... 3 1.1 The costs of optimizing ............................................................................................... 4 2 Choosing the optimal platform........................................................................................... 4 2.1 Choice of hardware platform....................................................................................... 4 2.2 Choice of microprocessor ........................................................................................... 6 2.3 Choice of operating system......................................................................................... 6 2.4 Choice of programming language ............................................................................... 7 2.5 Choice of compiler ...................................................................................................... 9 2.6 Choice of function libraries........................................................................................ 11 2.7 Choice of user interface framework........................................................................... 13 2.8 Overcoming the drawbacks of the C++ language...................................................... 14 3 Finding the biggest time consumers ................................................................................ 15 3.1 How much is a clock cycle? ...................................................................................... 15 3.2 Use a profiler to find hot spots .................................................................................. 16 3.3 Program installation .................................................................................................. 18 3.4 Automatic updates .................................................................................................... 18 3.5 Program loading ....................................................................................................... 19 3.6 Dynamic linking and position-independent code ....................................................... 19 3.7 File access................................................................................................................21 3.8 System database ...................................................................................................... 21 3.9 Other databases ....................................................................................................... 21 3.10 Graphics and other system resources..................................................................... 22 3.11 Network access ...................................................................................................... 22 3.12 Memory access....................................................................................................... 22 3.13 Context switches..................................................................................................... 22 3.14 Dependency chains ................................................................................................ 23 3.15 Execution unit throughput ....................................................................................... 23 4 Performance and usability ............................................................................................... 23 5 Choosing the optimal algorithm....................................................................................... 25 6 Development process...................................................................................................... 26 7 The efficiency of different C++ constructs........................................................................ 26 7.1 Different kinds of variable storage............................................................................. 26 7.2 Integers variables and operators............................................................................... 29 7.3 Floating point variables and operators ...................................................................... 31 7.4 Enums ......................................................................................................................33 7.5 Booleans................................................................................................................... 33 7.6 Pointers and references............................................................................................ 35 7.7 Function pointers ...................................................................................................... 37 7.8 Member pointers....................................................................................................... 37 7.9 Smart pointers .......................................................................................................... 38 7.10 Arrays ..................................................................................................................... 38 7.11 Type conversions.................................................................................................... 40 7.12 Branches and switch statements............................................................................. 43 7.13 Loops...................................................................................................................... 45 7.14 Functions ................................................................................................................ 47 2 7.15 Function parameters ............................................................................................... 49 7.16 Function return types .............................................................................................. 50 7.17 Structures and classes............................................................................................ 50 7.18 Class data members (properties) ............................................................................ 51 7.19 Class member functions (methods)......................................................................... 52 7.20 Virtual member functions ........................................................................................ 53 7.21 Runtime type identification (RTTI)........................................................................... 53 7.22 Inheritance.............................................................................................................. 53 7.23 Constructors and destructors .................................................................................. 54 7.24 Unions ....................................................................................................................54 7.25 Bitfields................................................................................................................... 55 7.26 Overloaded functions .............................................................................................. 55 7.27 Overloaded operators ............................................................................................. 55 7.28 Templates............................................................................................................... 56 7.29 Threads .................................................................................................................. 59 7.30 Exceptions and error handling ................................................................................ 60 7.31 Other cases of stack unwinding .............................................................................. 63 7.32 Preprocessing directives......................................................................................... 64 7.33 Namespaces........................................................................................................... 64 8 Optimizations in the compiler .......................................................................................... 64 8.1 How compilers optimize ............................................................................................ 64 8.2 Comparison of different compilers............................................................................. 72 8.3 Obstacles to optimization by compiler....................................................................... 76 8.4 Obstacles to optimization by CPU............................................................................. 79 8.5 Compiler optimization options ................................................................................... 79 8.6 Optimization directives.............................................................................................. 81 8.7 Checking what the compiler does ............................................................................. 82 9 Optimizing memory access ............................................................................................. 85 9.1 Caching of code and data ......................................................................................... 85 9.2 Cache organization................................................................................................... 85 9.3 Functions that are used together should be stored together...................................... 87 9.4 Variables that are used together should be stored together ...................................... 87 9.5 Alignment of data...................................................................................................... 88 9.6 Dynamic memory allocation...................................................................................... 89 9.7 Container classes ..................................................................................................... 91 9.8 Strings ...................................................................................................................... 94 9.9 Access data sequentially .......................................................................................... 94 9.10 Cache contentions in large data structures ............................................................. 95 9.11 Explicit cache control .............................................................................................. 97 10 Multithreading................................................................................................................ 99 10.1 Hyperthreading ..................................................................................................... 101 11 Out of order execution................................................................................................. 101 12 Using vector operations............................................................................................... 103 12.1 AVX instruction set and YMM registers................................................................. 104 12.2 Automatic vectorization......................................................................................... 105 12.3 Explicit vectorization ............................................................................................. 107 12.4 Mathematical functions for vectors........................................................................ 120 12.5 Aligning dynamically allocated memory................................................................. 122 12.6 Aligning RGB video or 3-dimensional vectors ....................................................... 122 12.7 Conclusion............................................................................................................ 123 13 Make critical code in multiple versions for different CPUs............................................ 123 13.1 CPU dispatch strategies........................................................................................ 124 13.2 Test and maintenance .......................................................................................... 126 13.3 Implementation ..................................................................................................... 126 13.4 CPU dispatching in Gnu compiler ......................................................................... 128 13.5 CPU dispatching in Intel compiler ......................................................................... 129 14 Specific optimization tips ............................................................................................. 135 14.1 Use lookup tables ................................................................................................. 135 3 14.2 Bounds checking .................................................................................................. 137 14.3 Use bitwise operators for checking multiple values at once................................... 138 14.4 Integer multiplication............................................................................................. 139 14.5 Integer division...................................................................................................... 140 14.6 Floating point division ........................................................................................... 142 14.7 Don’t mix float and double..................................................................................... 143 14.8 Conversions between floating point numbers and integers ................................... 144 14.9 Using integer operations for manipulating floating point variables......................... 145 14.10 Mathematical functions ....................................................................................... 148 15 Metaprogramming ....................................................................................................... 149 16 Testing speed.............................................................................................................. 152 16.1 The pitfalls of unit-testing ...................................................................................... 154 16.2 Worst-case testing ................................................................................................ 154 17 Overview of compiler options....................................................................................... 156 18 Literature..................................................................................................................... 159 19 Copyright notice .......................................................................................................... 160 Download: http://www.speedyshare.com/files/24051378/optimizing_cpp.pdf
  5. A very useful, compact list containing all instructions for the Intel x86 Assembly Language. http://www.jegerlehner.ch/intel/IntelCodeTable.pdf
  6. PC Assembly Language by Dr Paul A. Carter Download: http://www.speedyshare.com/files/24051281/pcasm-book-pdf.zip
      • 1
      • Upvote
  7. The Art of Assembly Language Programming by Randall Hyde Download: http://www.speedyshare.com/files/24051264/pdfaoa.zip
  8. IA-32 Intel® Architecture Software Developer's Manual (Volume 1 - Basic Architecture) Download: http://www.speedyshare.com/files/24051156/25366516.zip IA-32 Intel® Architecture Software Developer's Manual (Volume 2A: Instruction Set Reference, A-M) Download: http://www.speedyshare.com/files/24051185/25366616.zip IA-32 Intel® Architecture Software Developer's Manual (Volume 2B: Instruction Set Reference, N-Z) Download: http://www.speedyshare.com/files/24051204/25366716.zip IA-32 Intel® Architecture Software Developer's Manual (Volume 3: System Programming Guide) http://www.speedyshare.com/files/24051217/25366816.zip © Intel, Corp.
  9. In sfarsit un tutorial de calitate
  10. Aaaa, e unul din ratatii cu Elite-Spula care dadea DDOS la RST.
  11. Nu as putea sa dau in EvilKnight aka necunoscut1 asta, are fata de fetita
  12. http://www.netinfinity.org/screenshots/scrns/upe5.png http://www.netinfinity.org/screenshots/scrns/upe3.png Imi place grafica
  13. Deci necunoscut1 e EViL][NiGhT ala de 12 ani?
  14. Nytro

    Sugestie :)

    Uite de ce nu le sterg. In trecut, cand mai faceam cate un programel, si eu faceam la fel. Faceam un cont, si postam programul. De multe ori nu sunt postate programe infectate de cel care le posteaza, ci sunt copiate de pe alte site-uri.
  15. @necunoscut1 Cu Ne0h a inceput ca o gluma, nu am avut nici o tangenta cu el. Dar vad ca exista oameni mai periculosi ca el, cei ca tine. Pai spune si tu mai intai de unde esti, poate o sa ne cunostem Edit: Brasov...
  16. "2) toti idiotii incearca dupa ce citesc asta;" - E o curiozitate, normal ca incerci. "4) zambesti acum pentru ca esti un idiot;" - Nu am zambit "5) vei trimite mai departe unui alt idiot;" - Asta e de fapt: "Trebuie sa fi si mai idiot sa trimiti mai departe" "6) inca mai ai un zambet pe fata..." - Tot nu am zambit
  17. Se vede ca ai 12 ani.
  18. pyth0n3: Asta era ideea, descarca ce am postat eu, e compilat de mine, nu e sursa. Ca asta nu stiu, daca merge. yo9gjx: Thanks.
  19. Eu nu am nici o treaba cu nimeni de aici, desi cred ca jumatate de pe aici nu prea ma au la inima. Dar na, e plin de oameni rai aici...
  20. E Carbide C++: Carbide.c++ - Wikipedia, the free encyclopedia Probabil si CodeWarrior - Wikipedia, the free encyclopedia Chiar si Eclipse se poate folosi: Eclipse (software) - Wikipedia, the free encyclopedia Si cred ca e si un plugin pentru Visual Studio: Carbide.c++ - Wikipedia, the free encyclopedia
  21. Super, daca mai gasesc programe utile in noi versiuni, care se gasesc doar ca surse o sa le compilez si o sa le postez aici. Nu fac RPM pentru ca nu stiu, si pentru ca eu mereu am avut probleme cu RPM-urile. Daca vrea cineva sa instaleze, sa dea un "cd" sa intre in folderul rezultat dupa dezarhivare, apoi ca root sa dea "cp -R * /usr" si gata qbert: Am uitat.
  22. Hmm, nu sunt expert in Linux, dar am compilat Pidgin 2.7.3 din sursa (fara avahi si video suport) si sunt curios daca va merge. Aveti aici arhiva, as vrea sa imi spuneti daca merge, nu sunt sigur. Am pus doar --prefix la configure, si am instalat si librariile necesare inainte (nu pe toate). E posibil sa nu mearga pentru ca voi e posibil sa nu le aveti. Download (.tar.gz): http://www.speedyshare.com/files/24026311/Pidgin_2.7.3 Rulati "bin/pidgin" dupa dezarhivare. Ar trebui sa mearga... Nu trebuie sa fiti root.
  23. Sunt multe http://www.linuxtopia.org/online_books/index.html
  24. SenatoR_v: A? Vorbeste in romana. Oricum, nu va suparati daca apar poze cu voi pe aici (doar nu va e rusine de voi nu?), si cu mine e o poza (pusa de mine chiar) si nu imi e rusine
  25. Cum ziceam, din 1 octombrie vin in Bucuresti. Dark Knight ala nici nu stiu cine e, stiu doar ca l-a batut cineva de pe ISR deci nu cred ca e cine stie ce zmeu. Ne0h asta am auzit ca e bazat. Deja am inceput sa tremur. Gata nu mai ies din casa Oricum, sunt genul care are curajul sa se dea la interval cu oricine, chiar daca are 2m si stiu ca imi iau bataie. Insa nu cred ca e cazul
×
×
  • Create New...