gas

documentation of gnu assembler directives

冷暖自知 提交于 2020-04-13 04:09:17
问题 I'm trying to learn mips assembly at the moment. To that end, I wrote a very simple c program... int main(){} ...and compiled it on a mips machine with the -S option to gcc to generate assembly code. Here is what the beginning of the main function looks like: .ent main main: .frame $fp,8,$31 .mask 0x40000000,-8 .fmask 0x00000000,0 I then tried to figure out what this all means by looking at the documentation for gas, but I couldn't find any of these directives there. So what do they mean?

documentation of gnu assembler directives

走远了吗. 提交于 2020-04-13 04:09:07
问题 I'm trying to learn mips assembly at the moment. To that end, I wrote a very simple c program... int main(){} ...and compiled it on a mips machine with the -S option to gcc to generate assembly code. Here is what the beginning of the main function looks like: .ent main main: .frame $fp,8,$31 .mask 0x40000000,-8 .fmask 0x00000000,0 I then tried to figure out what this all means by looking at the documentation for gas, but I couldn't find any of these directives there. So what do they mean?

Segfault with x86 assembly on mov 0, %eax

一笑奈何 提交于 2020-03-16 06:00:13
问题 I'm trying to assemble a small piece of x86 code. I'm on a 32 bit machine and I have written the following code. It should just add values into eax and then return. I realize there will not be any output. When I compile this using gcc main.S -o main It compiles with no errors. But when I run it seg faults (gdb claims that it segfaults on the first movl instruction). main.S has the following code in it. What am I doing wrong? .text .globl main main: pushl %ebp movl %esp, %ebp movl 0, %eax addl

memset movq giving segfault

女生的网名这么多〃 提交于 2020-03-04 05:03:13
问题 I've been stuck with the gdb for a few hours now. I am getting a segfault at the movq (%rsi, %rcx) line. I know you can't do mem->mem mov, so I did it through a temporary register. (%rsi), %rcx, then in the loop %rcx, (%rdi). Here is my code: experimentMemset: #memset(void *ptr, int value, size_t num) #%rdi #%rsi #%rdx movq %rdi, %rax #sets rax to the first pointer, to return later .loop: cmp $0, (%rdx) #see if num has reached 0 je .end cmpb $0, (%rdi) #see if string has ended also je .end

How to add values from vector to each other

纵饮孤独 提交于 2020-02-07 03:39:25
问题 In my code I solve integral y=x^2-4x+6 I used SSE - it allows me to operate on 4 values in one time. I made program which solve this integral with values from 0 to 5 divided to five 4-element vectors n1, n2, n3, n4. .data n1: .float 0.3125,0.625,0.9375,1.25 n2: .float 1.5625,1.875,2.1875,2.5 n3: .float 2.8125,3.12500,3.4375,3.75 n4: .float 4.0625,4.37500,4.6875,5 szostka: .float 6,6,6,6 czworka: .float 4,4,4,4 .text .global main main: movups (n1),%xmm0 mulps %xmm0,%xmm0 movups (szostka),%xmm2

Is there a difference between equals sign assignment “x = 1” and “.equ x, 1” or “.set x, 1” in GNU Gas assembly?

让人想犯罪 __ 提交于 2020-01-30 06:08:28
问题 E.g.: a = 1 and: .equ a, 1 and: .set a, 1 all produce the same output byte-by-byte upon: as --32 main.S according to cmp . I know that .equ and .set do the same thing according to the documentation of .equ : https://sourceware.org/binutils/docs-2.25/as/Equ.html : It is synonymous with `.set'. and I know what .equ does from Difference between .equ and .word in ARM Assembly? So what about = ? Is it the same as the other two? 回答1: It is the same. After grepping the documentation source, I've

GAS assembler not using 2-byte relative JMP displacement encoding (only 1-byte or 4-byte)

混江龙づ霸主 提交于 2020-01-24 13:57:58
问题 I am trying to write shellcode for a CTF challenge that does not allow for 0x00 bytes (it will be interpreted as a terminator). Due to restrictions in the challenge, I must do something like this: [shellcode bulk] [(0x514 - sizeof(shellcode bulk)) filler bytes] [fixed constant data to overwrite global symbols] [shellcode data] It looks something like this .intel_syntax noprefix .code32 shellcode: jmp sc_data shellcode_main: #open xor eax, eax pop ebx //file string xor ecx, ecx //flags xor edx

Different output in 3 anonymous function in GAS

瘦欲@ 提交于 2020-01-24 09:25:06
问题 I have a question. In the formal web page of google.script run, they saids that you can call "any server-side function" from client side using google.script.run. In the below gs file, I defined function "hoge" using normal function expression.(the "this!" row) If I execute this situation, output is randomly 1-4 numbers displayed on browser By the way, I tried to change the define style of function "hoge". I created 3 pattern using anonymous function. (all are called from client side using

what is jmpl instruction in x86?

淺唱寂寞╮ 提交于 2020-01-23 10:55:07
问题 x86 assembly design has instruction suffix, such as l(long) , w(word) , b(byte) . So I thought that jmpl to be long jmp But it worked quite weird when I compile it. See below example. Test1 : assembly main: jmp main Test1 : compile result eb fe jmp 0x0804839b <main> Test2 : assembly main: jmpl main # added l suffix Test2 : Compile result ff 25 9b 83 04 08 jmp *0x0804839b Compared to Test1, Test2 result is unexpected. I think It should be compiled as same as Test1. Question: Is jmpl something

what is jmpl instruction in x86?

。_饼干妹妹 提交于 2020-01-23 10:54:24
问题 x86 assembly design has instruction suffix, such as l(long) , w(word) , b(byte) . So I thought that jmpl to be long jmp But it worked quite weird when I compile it. See below example. Test1 : assembly main: jmp main Test1 : compile result eb fe jmp 0x0804839b <main> Test2 : assembly main: jmpl main # added l suffix Test2 : Compile result ff 25 9b 83 04 08 jmp *0x0804839b Compared to Test1, Test2 result is unexpected. I think It should be compiled as same as Test1. Question: Is jmpl something