
Assembly Language
文章平均质量分 68
fanbird2008
这个作者很懒,什么都没留下…
展开
-
Nasm Assembly Intro - Understanding Calling Conventions (64-bit)
http://cs.lmu.edu/~ray/notes/nasmtutorial/NASM TutorialYep, it's a tutorial.Scope of the TutorialThis tutorial will show you how to write assembly language programs for Linux on the x86-64转载 2015-09-06 17:08:30 · 1257 阅读 · 0 评论 -
Assembly x64 Intro - XMM ABS
%macro WELS_AbsW 2 pxor %2, %2 psubw %2, %1 pmaxsw %1, %2%endmacroWELS_AbsW xmm0, xmm3展开如下:pxor xmm3, xmm3 => xmm3 = 0psubw xmm3, xmm0 => x原创 2015-12-16 09:40:20 · 551 阅读 · 0 评论 -
Assembly x64 Intro - Dct.asm of OpenH264 Encode
;*!;* \copy;* Copyright (c) 2009-2013, Cisco Systems;* All rights reserved.;*;* Redistribution and use in source and binary forms, with or without;* modification, are原创 2015-12-10 15:06:44 · 3720 阅读 · 0 评论 -
Assembly x64 Intro - Dct.asm of OpenH264 Decode
;*!;* \copy;* Copyright (c) 2009-2013, Cisco Systems;* All rights reserved.;*;* Redistribution and use in source and binary forms, with or without;* modification, are perm原创 2015-12-10 15:08:23 · 474 阅读 · 0 评论 -
Assembly x64 Intro - Align 16 of Nasm
1. addr.S extern printf ; the C function to be called%macro pabc 1 ; a "simple" print macro section .data.str db %1,0 ; %1 is first actual in macro call section .text原创 2015-12-10 13:36:34 · 530 阅读 · 0 评论 -
Assembly x64 Intro - Understand stack frame from example
#include #include int64_t testregs(int a, int b, int c, int d, int e, int f, int g, int h);int64_t testregs(int a, int b, int c, int d, int e, int f, int g, int h){ int64_t result; r原创 2015-12-10 11:07:45 · 418 阅读 · 0 评论 -
Assembly x64 Intro - call extern printf
1. print1.S; Declare external function extern printf ; the C function, to be called SECTION .data ; Data section, initialized variables a: dq转载 2015-12-08 15:23:16 · 632 阅读 · 0 评论 -
Assembly x64 Intro - Register Usage
; testreg_64.asm test what register names can be used;; compile: nasm -f elf64 -l testreg_64.lst testasm_64.asm; link: gcc -o testreg_64 testreg_64.o; run: ./testreg # may get segfault or转载 2015-12-09 14:47:20 · 688 阅读 · 0 评论 -
Assembly x64 Intro - Loop Example
; loopint_64.asm code loopint.c for nasm ; /* loopint_64.c a very simple loop that will be coded for nasm */; #include ; int main(); {; long int dd1[100]; // 100 could be 3 gigabytes;转载 2015-12-09 14:43:00 · 339 阅读 · 0 评论 -
Assembly x64 Intro - Horner Polynomial Evaluation
; horner_64.asm Horners method of evaluating polynomials;; given a polynomial Y = a_n X^n + a_n-1 X^n-1 + ... a_1 X + a_0; a_n is the coefficient 'a' with subscript n. X^n is X to nth power;转载 2015-12-09 15:36:46 · 362 阅读 · 0 评论 -
Assembly x64 Intro - Register Macro Define from OpenH264
%ifdef WIN64 ; Windows x64 ;************************************DEFAULT RELBITS 64%define arg1 rcx%define arg2 rdx%define arg3 r8%define arg4 r9%define arg5 [rsp + push_num*8 + 40]%def转载 2015-12-10 09:05:19 · 406 阅读 · 0 评论 -
Assembly x64 Intro - Stack frame layout on x86-64
http://eli.thegreenplace.net/2011/09/06/stack-frame-layout-on-x86-64/Stack frame layout on x86-64 September 06, 2011 at 20:13Tags Articles , Assembly , LinuxA few months ag转载 2015-12-10 10:43:47 · 720 阅读 · 0 评论 -
Assembly x64 Intro - Nasm Example
1. file add.S.globl my_addmy_add: pushq %rbp movq %rsp, %rbp addq %rsi, %rdi movq %rdi, %rax leaveq retq2. file max.S.globl my_maxmy_max: pushq %rb原创 2015-12-08 15:10:42 · 380 阅读 · 0 评论 -
Assembly x64 Intro - SSE2 4x4D Transpose
; in: xmm1, xmm2, xmm3, xmm4 pOut: xmm1, xmm4, xmm5, mm3%macro SSE2_Trans4x4D 5 SSE2_XSawp dq, %1, %2, %5 SSE2_XSawp dq, %3, %4, %2 SSE2_XSawp qdq, %1, %3, %4 SSE2_XSawp qdq,原创 2015-12-16 10:21:27 · 348 阅读 · 0 评论 -
Assembly x64 Intro - SSE2 Copy8Times
;copy a dw into a xmm for 8 times%macro SSE2_Copy8Times 2 movd %1, %2 punpcklwd %1, %1 pshufd %1, %1, 0%endmacro SSE2_Copy8Times xmm1, r2d ; xmm1 = b,b,b,b,b,原创 2015-12-16 09:31:02 · 348 阅读 · 0 评论 -
Assembly x64 Intro - View Assemble Variable by GDB
extern printf%define arg1 rdi%define arg2 rsi%define arg3 rdx%define arg4 rcx%define arg5 r8%define arg6 r9%define arg7 [rsp + push_num*8 + 8]%define arg8 [rsp + push_num*8 + 16]%def原创 2015-12-15 16:17:00 · 515 阅读 · 0 评论 -
Assembly x64 Intro - SSE2 4x8 Store
%macro SSE2_Store4x8p 6 SSE2_XSawp qdq, %2, %3, %6 SSE2_XSawp qdq, %4, %5, %3 MOVDQ [%1+0x00], %2 MOVDQ [%1+0x10], %4 MOVDQ [%1+0x20], %6 MOVDQ [%1+0x30], %3原创 2015-12-16 16:05:11 · 405 阅读 · 0 评论 -
Assembly x64 Intro - SSE2 4x8 Load
%macro SSE2_Load4x8p 6 MOVDQ %2, [%1+0x00] MOVDQ %4, [%1+0x10] MOVDQ %6, [%1+0x20] MOVDQ %3, [%1+0x30] SSE2_XSawp qdq, %4, %3, %5 ; 为什么要做这两步??原创 2015-12-16 16:04:25 · 596 阅读 · 0 评论 -
Assembly x64 Intro - SSE2 IDCT I16X16 DC
;***********************************************************************; void WelsIDctRecI16x16Dc_sse2(uint8_t *rec, int32_t stride, uint8_t *pred, int32_t pred_stride, int16_t *dct_dc);*********原创 2015-12-18 09:19:16 · 371 阅读 · 0 评论 -
Assembly x64 Intro - SSE2 IDCT
;***********************************************************************; void WelsIDctFourT4Rec_sse2(uint8_t *rec, int32_t stride, uint8_t *pred, int32_t pred_stride, int16_t *rs);;**************原创 2015-12-18 09:17:53 · 412 阅读 · 0 评论 -
Assembly x64 Intro - SSE2 DCT
;***********************************************************************; void WelsDctFourT4_sse2(int16_t *pDct, uint8_t *pix1, int32_t i_pix1, uint8_t *pix2, int32_t i_pix2 );********************原创 2015-12-18 09:16:43 · 430 阅读 · 0 评论 -
Assembly x64 Intro - SSE2 Hadamard 4 DC
;***********************************************************************;void WelsHadamardT4Dc_sse2( int16_t *luma_dc, int16_t *pDct);**************************************************************原创 2015-12-18 09:20:31 · 522 阅读 · 0 评论 -
Assembly x64 Intro - SSE2 Diff 8 Load
;***********************************************************************; void WelsDctFourT4_sse2(int16_t *pDct, uint8_t *pix1, int32_t i_pix1, uint8_t *pix2, int32_t i_pix2 );********************原创 2015-12-16 21:32:52 · 460 阅读 · 0 评论 -
Assembly x64 Intro - SSE2 Diff 4x8 Store
%macro SSE2_StoreDiff8p 6 paddw %1, %3 psraw %1, $06 movq %2, %6 punpcklbw %2, %4 paddsw %2, %1 packuswb %2, %2 movq %5, %2%end原创 2015-12-16 16:05:52 · 388 阅读 · 0 评论 -
Assembly x64 Intro - MMX 4x4W Transpose
; pOut mm1, mm4, mm5, mm3%macro MMX_Trans4x4W 5 MMX_XSwap wd, %1, %2, %5 MMX_XSwap wd, %3, %4, %2 MMX_XSwap dq, %1, %3, %4 MMX_XSwap dq, %5, %2, %3%endmacro原创 2015-12-16 10:18:12 · 595 阅读 · 0 评论 -
Assembly x64 Intro - SSE2 2x4x4W Transpose
;in: xmm0, xmm1, xmm2, xmm3 pOut: xmm0, xmm1, xmm3, xmm4%macro SSE2_TransTwo4x4W 5 SSE2_XSawp wd, %1, %2, %5 SSE2_XSawp wd, %3, %4, %2 SSE2_XSawp dq, %1, %3, %4 SSE2_XSawp d原创 2015-12-16 11:06:58 · 571 阅读 · 0 评论 -
Assembly x64 Intro - SSE2 8DC Load
%macro SSE2_Load8DC 6 movdqa %1, %6 ; %1 = dc0 dc1 paddw %1, %5 psraw %1, $06 ; (dc + 32) >> 6 movdqa %2, %1 psrldq %2,原创 2015-12-16 16:06:21 · 375 阅读 · 0 评论 -
Assembly x64 Intro - SSE2 Copy16Times
;copy a db into a xmm for 16 times%macro SSE2_Copy16Times 2 movd %1, %2 pshuflw %1, %1, 0 punpcklqdq %1, %1 packuswb %1, %1%endmacro原创 2015-12-16 09:20:33 · 344 阅读 · 0 评论 -
Assembly x64 Intro - Shift Operate
extern printf%macro prt1 1 section .data.str db %1, 0 section .text mov rdi, fmt1 mov rsi, .str mov rdx, rax mov rax, 0 call printf%endmacro%macro prt2 1 section .data转载 2015-12-09 15:20:03 · 428 阅读 · 0 评论 -
Assembly x64 Intro - Condition Compare
; ifint_64.asm code ifint_64.c for nasm ; /* ifint_64.c an 'if' statement that will be coded for nasm */; #include ; int main(); {; long int a=1;; long int b=2;; long int c=3;;转载 2015-12-09 15:28:00 · 384 阅读 · 0 评论 -
Assembly x64 Intro - GAS Assembly Issue
movslq %eax,%rbx movsx rbx, eax40056e: 8b 45 d0 mov -0x30(%rbp),%eax400571: 48 63 d8 movslq %eax,%rbx400574: 48 8b 45 f0 mov -0原创 2015-12-10 10:35:47 · 399 阅读 · 0 评论 -
Nasm Intro - The Three Kinds of Operands & Conditional Instructions
http://cs.lmu.edu/~ray/notes/nasmtutorial/Register OperandsIn this tutorial we only care about the integer registers and the xmm registers. You should already know what the registers are,转载 2015-07-20 17:56:25 · 529 阅读 · 0 评论 -
Nasm Intro - Multi-Line Macros
http://www.tortall.net/projects/yasm/manual/html/nasm-multi-line-macros.htmlMulti-line macros are much more like the type of macro seen in MASM and TASM: a multi-line macro definition in NASM lo转载 2015-07-21 09:33:19 · 700 阅读 · 0 评论 -
Nasm Intro - Understand nasm by OpenH264 WelsCPUId
;****************************************************************************************************; void WelsCPUId( int32_t uiIndex, int32_t *pFeatureA, int32_t *pFeatureB, int32_t *pFeatureC,原创 2015-07-20 16:54:43 · 673 阅读 · 0 评论 -
Assembly Intro - Inline Assembly Versus Non-Inline Assembly
From a function viewpoint, function may be implmented by inline assembly way, or by non-inline assembly way.Example:inline assembly functionint inline_add(int x, int y){ asm volatile ("ad原创 2015-07-16 17:11:27 · 510 阅读 · 0 评论 -
Assembly Intro - Intel and AT&T Syntax
Intel and AT&T Syntax.Intel and AT&T syntax Assembly language are very different from each other in appearance, and this will lead to confusion when one first comes across AT&T转载 2015-07-16 15:21:44 · 648 阅读 · 0 评论 -
Inline Assembly Intro - Float Point Register Usage
/* areatest.c - An example of using floating point regs */#include int main(){ int radius = 10; float area; asm(“fild %1\n\t” “fimul %1\n\t” “fldpi\n\t” “fmul %%st(1), %%st(0)” : “转载 2015-07-16 14:42:01 · 546 阅读 · 0 评论 -
Linux Assembler - GAS and NASM
http://www.ibm.com/developerworks/cn/linux/l-gas-nasm.html本文解释两种最流行的 Linux® 汇编器 —— GNU Assembler(GAS)和 Netwide Assembler(NASM) —— 之间一些比较重要的语法差异和语义差异,包括基本语法、变量和内存访问、宏处理、函数和外部例程、堆栈处理以及重复执行代码块的技术方面转载 2015-07-16 16:48:51 · 1025 阅读 · 0 评论 -
Inline Assembly Intro - Register Mismatch
1. As far as following inline assembly#include int main(){ float arg1, arg2, add, sub, mul, div ; printf( "Enter two numbers : " ); scanf( "%f%f", &arg1, &arg2 ); /* Perform原创 2015-07-15 17:52:29 · 769 阅读 · 0 评论 -
Inline Assembly - GCD
int gcd(int a, int b){ int result ; asm volatile ( "movl %1, %%eax;" "movl %2, %%ebx;" "CONTD: cmpl $0, %%ebx;" "je DONE;" "xorl %%edx, %%edx;" "idivl %%ebx;"转载 2015-07-14 13:59:15 · 556 阅读 · 0 评论