yasm

Minimal opcode size x86-64 strlen implementation

守給你的承諾、 提交于 2019-12-10 15:22:54
问题 I'm investigating a minimal opcode size x86-64 strlen implementation for my code golfing / binary executable that is not supposed to exceed some size (think of demoscene for simplicity). General idea comes from here, size optimization ideas from here and here. Input string address is in rdi , max length should be not bigger than Int32 xor eax,eax ; 2 bytes or ecx,-1 ; 3 bytes repne scasb ; 2 bytes not ecx ; 2 bytes dec ecx ; 2 bytes Final result is in ecx in 11 bytes total. The question is

Cannot find yasm even though I have installed it

隐身守侯 提交于 2019-12-08 16:25:48
问题 I got a strange problem. I tried to install x264. When run sudo ./configure --enable-shared, it gave: Found no assembler Minimum version is yasm-0.7.0 If you really want to compile without asm, configure with --disable-asm. But I already installed yasm-0.7.0 ,to prove that ,i run yasm --version,it gave: * yasm 0.7.0.2066 Compiled on May 8 2012. Copyright (c) 2001-2008 Peter Johnson and other Yasm developers. Run yasm --license for licensing overview and summary. * I install yasm to /usr/local

CentOS下编译安装FFmpeg

心不动则不痛 提交于 2019-12-06 18:43:49
FFmpeg介绍 FFmpeg是一个开源免费跨平台的视频和音频流方案,属于自由软件,采用LGPL或GPL许可证(依据你选择的组件)。它提供了录制、转换以及流化音视频的完整解决方案。它包含了非常先进的音频/视频编解码库libavcodec,为了保证高可移植性和编解码质量,libavcodec里很多codec都是从头开发的。 文档: https://www.ffmpeg.org/documentation.html 安装之前准备: 编译工具提前安好,使用yum yum -y install gcc cc cl 正式开始: 第一步:安装ffmpeg时需要提前安装yasm插件,下面开始安装。 wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz tar -xvf yasm-1.3.0.tar.gz cd yasm-1.3.0/ ./configure && make && make install 第二步:好了开始安装ffmpeg。 wget http://www.ffmpeg.org/releases/ffmpeg-3.4.tar.gz tar -xvf ffmpeg-3.4.tar.gz cd ffmpeg-3.4/ ./configure && make && make install

make: Circular dependency dropped

荒凉一梦 提交于 2019-12-06 06:08:50
问题 I've already searched a long time on stackoverflow and other make manuals, websites but cannot find any trailing whitespace or miss usage in make functions. Can you help me solve this warning message ? make: Circular main.asm.o <- main.asm dependency dropped. Makefile: AS:=yasm CC:=gcc OUTPUTDIR:=$(shell pwd)/bin ASFLAGS:=-g dwarf2 -f elf64 -a x86 CFLAGS:=-g SOURCES=$(wildcard *.asm) OBJECTS=$(patsubst %.asm,%.o,$(SOURCES)) %.o: $(SOURCES) $(AS) $(ASFLAGS) -o $(OUTPUTDIR)/$(OBJECTS) $< all: $

ceph jewel手动编译安装的一些优化

别说谁变了你拦得住时间么 提交于 2019-12-04 15:09:04
一、手动安装ceph。 根据http://my.oschina.net/linuxhunter/blog/682013,手动安装jewel版本ceph到硬件服务器。 二、测试ceph集群的方法。 使用ceph自带的rados bench命令简单测试手动搭建ceph集群的性能,查看系统性能的工具使用perf命令。由于默认安装的ubuntu环境没有安装perf工具及其依赖,所有要手动安装perf工具。#apt-get install perf linux-tools-4.4.0-21-generic。安装完成后启用两个终端分别运行#perf top命令和#rados banch -p test_rbd 60 write --no-cleanup命令。 三、发现的问题。 在运行#perf top命令的终端上发现ceph-osd在调用ceph_crc32_sctp这个函数上占用了35%的CPU时间,而此时集群的压力并不大,因此决定从源代码上找找ceph_crc32_sctp为什么占用那么多的CPU时间。 ceph_crc32_sctp这个函数位于src/common/sctp_crc32.c这个文件中,只有ceph_choose_crc32函数调用ceph_crc32_sctp函数。分析ceph_choose_crc32这个函数不难发现,该函数根据当前CPU的架构来选择计算crc32的方法

make: Circular dependency dropped

我的未来我决定 提交于 2019-12-04 11:21:33
I've already searched a long time on stackoverflow and other make manuals, websites but cannot find any trailing whitespace or miss usage in make functions. Can you help me solve this warning message ? make: Circular main.asm.o <- main.asm dependency dropped. Makefile: AS:=yasm CC:=gcc OUTPUTDIR:=$(shell pwd)/bin ASFLAGS:=-g dwarf2 -f elf64 -a x86 CFLAGS:=-g SOURCES=$(wildcard *.asm) OBJECTS=$(patsubst %.asm,%.o,$(SOURCES)) %.o: $(SOURCES) $(AS) $(ASFLAGS) -o $(OUTPUTDIR)/$(OBJECTS) $< all: $(OBJECTS) $(CC) $(CFLAGS) -o httpd $(OUTPUTDIR)/$(OBJECTS) clean: rm $(OUTPUTDIR)/* rm httpd main.asm:

FizzBuzz in assembly - segmentation fault

旧时模样 提交于 2019-12-02 13:33:49
I am trying to write FizzBuzz in Assembly and I am seeing segmentation fault all the time. So far I have determined that it is not my printing routines (because I have removed their contents and the problem persists) and the error hides somewhere in the main function. I was getting this output when I run the program: fizzSegmentation fault Leading me to believe that it's not the problem with using division and looking up the remainders. But I could be wrong, I haven't done Assembly in two years... SECTION .data global _start fizz: db "fizz", 4 buzz: db "buzz", 4 SECTION .bss counter: resb 1

The effect of code alignment in timing main loops in assembly

杀马特。学长 韩版系。学妹 提交于 2019-12-01 18:08:42
问题 Let's say I have the following main loop .L2: vmulps ymm1, ymm2, [rdi+rax] vaddps ymm1, ymm1, [rsi+rax] vmovaps [rdx+rax], ymm1 add rax, 32 jne .L2 The way I would time this is to put it in another long loop like this ;align 32 .L1: mov rax, rcx neg rax align 32 .L2: vmulps ymm1, ymm2, [rdi+rax] vaddps ymm1, ymm1, [rsi+rax] vmovaps [rdx+rax], ymm1 add rax, 32 jne .L2 sub r8d, 1 ; r8 contains a large integer jnz .L1 What I'm finding is that the alignment I choose can have a significant effect

How to avoid stdin input that does not fit in buffer be sent to the shell in Linux 64-bit Intel (x86-64) assembly

不问归期 提交于 2019-12-01 04:25:57
问题 Edit: Title changed, as @Gunner pointed out that this is not a buffer overflow. In reading user input from stdin with NR_read in Linux 64-bit Intel assembly, I wonder how can I avoid that the input that does not fit in the input buffer being sent to Linux shell eg. bash? For example in this example program I have defined an input buffer of 255 bytes (the size of the buffer can be whatever >= 1). The rest of an input longer than 255 bytes is sent to bash (if running from bash) and and this is

yasm movsx, movsxd invalid size for operand 2

有些话、适合烂在心里 提交于 2019-11-29 15:45:09
I am trying to assemble the code below using yasm. I have put 'here' comments where yasm reports the error "error: invalid size for operand 2". Why is this error happening ? segment .data a db 25 b dw 0xffff c dd 3456 d dq -14 segment .bss res resq 1 segment .text global _start _start: movsx rax, [a] ; here movsx rbx, [b] ; here movsxd rcx, [c] ; here mov rdx, [d] add rcx, rdx add rbx, rcx add rax, rbx mov [res], rax ret For most instructions, the width of the register operand implies the width of the memory operand, because both operands have to be the same size. e.g. mov rdx, [d] implies mov