assembly

ICEBP assembly instruction

坚强是说给别人听的谎言 提交于 2021-01-29 05:19:41
问题 As a workaround with x86 instructions, I used an opcode looks like .byte 0xf1, 0xc1 and tried to execute that inside gdb. the disassembly of that line shows f1 icebp So, when first byte which is F1 is fetched it is recognized as an instruction called icebp . This is known to be an undocumented instruction. The only thing I found in the SDM, is a footnote in INT sections saying The mnemonic ICEBP has also been used for the instruction with opcode F1 Continuing with gdb, it says Cannot access

Passing parameters to a function — push or registers [duplicate]

半腔热情 提交于 2021-01-29 05:14:00
问题 This question already has answers here : What are the calling conventions for UNIX & Linux system calls (and user-space functions) on i386 and x86-64 (4 answers) Where is the x86-64 System V ABI documented? (3 answers) Why does Windows64 use a different calling convention from all other OSes on x86-64? (4 answers) Closed 5 months ago . I want to write a function that does something like: def addme(x, y): return x + y I know there is already an instruction for this, but I'm practicing how to

How to set a breakpoint on an assembly file using Xcode?

戏子无情 提交于 2021-01-29 05:02:52
问题 I tried "breakpoint [line number]", "breakpoint filename.s:line_number" but they don't work. Currently I have to step through all lines, and it's a hassle 回答1: As an alternative you can: 1) show memory with assembly instructions with di with explicit arguments if you need reach out further di -c 1000 ; if you need to disassemble a specific address di -s <address> 2) set a memory break point with br s -a <memory address you found in previous step> Another alternative is slightly more

Linux Assembly x86_64 create a file using command line parameters

限于喜欢 提交于 2021-01-29 05:00:59
问题 I'm trying to teach myself assembly. I've found a good website; however, everything is written for x86 and I use a 64-bit machine. I know what the problem is, but I don't know how to fix it. If I run the program with strace, then here is the results: execve("./file", ["./file", "hello"], [/* 94 vars */]) = 0 creat(NULL, 0) = -1 EINVAL (Invalid argument) write(0, NULL, 0 <unfinished ...> +++ exited with 234 +++ So, I know that when I call creat , that the file name "hello" is not being passed

Looping and processing string byte-by-byte in MASM assembly

半腔热情 提交于 2021-01-29 04:54:55
问题 I am using MASM assembly and I am trying to write a loop that processes the string str1 byte-by-byte, changing each lowercase letter into the corresponding capital letter using bit operations. If the letter is already capital, leave it alone. Nothing seems to happen to my string str1 when I execute my code and I'm having difficulty figuring out why, maybe I shouldn't be processing my array as such, but nonetheless, here's the code: .386 .MODEL FLAT str1 dword "aBcD", cr, Lf, 0 .... .code

Looping and processing string byte-by-byte in MASM assembly

巧了我就是萌 提交于 2021-01-29 04:51:18
问题 I am using MASM assembly and I am trying to write a loop that processes the string str1 byte-by-byte, changing each lowercase letter into the corresponding capital letter using bit operations. If the letter is already capital, leave it alone. Nothing seems to happen to my string str1 when I execute my code and I'm having difficulty figuring out why, maybe I shouldn't be processing my array as such, but nonetheless, here's the code: .386 .MODEL FLAT str1 dword "aBcD", cr, Lf, 0 .... .code

Comparing Characters (ARM Assembly)

泄露秘密 提交于 2021-01-29 04:28:30
问题 I'm trying to compare a Character from a Char-Array with a char in my assembly code. This is the C-Code I use to start the assembly code: char a[] = "abc"; char b = 'a'; int size = 3; int d = _asm_main(a); printf("Char a: %s\n",a); printf("Erg:%d\n",d); and this is the assembly code: _asm_main: push {r6,r7,r8,lr} mov r8,r0 ldr r7,[r8,#2] mov r6,r7 b compare compare: cmp r6,#'c' beq true b false true: mov r0,#1 b end false: mov r0,#2 b end end: pop {r6,r7,r8,pc} BX lr It works for 'c' but if I

assembly concatenate two strings

感情迁移 提交于 2021-01-29 04:02:04
问题 I want to concatenate two strings but in my output instead of getting the final concatenated string, I get a line of weird characters and spaces, maybe someone could help me a bit. I want to save the result in s3. Here is the code DATA SEGMENT STR1 DB "ENTER FIRST STRING HERE ->$" STR2 DB "ENTER SECOND STRING HERE ->$" STR3 DB "CONCATEnatedD STRING :->$" STR11 DB "FIRST STRING : ->$" STR22 DB "SECOND STRING: ->$" s1 DB 20 DUP("$") s2 DB 20 DUP("$") s3 db 40 dup(?) NEWLINE DB 10,13,"$" DATA

getting 3 error messages, mips assembly language

六月ゝ 毕业季﹏ 提交于 2021-01-29 03:56:01
问题 This is an assignment. the idea is to prompt the user to: input the first positive integer input any one of the operations /,*,-,+ input the second positive integer Then, call do_math which calls one of: do_add if operator is +, add the 2 inputs without using add or sub mips instruction and the return the result in a register. return an error condition if there is an overflow. do_sub if operator is -, subtract the second integer from the first without using sub or add mips instruction (you

argument to operation or instruction has illegal size 8086 subroutine

房东的猫 提交于 2021-01-29 03:17:34
问题 I started programming in assembler for microprocessor 8086. I try to draw a tree on the screen, sending a subroutine, row, column, amount (collected from the stack), the error I present is argument to operation or instruction has Illegal size on line 21, ie when performing the push count,column,row. DATOS SEGMENT row DB 1 colum DB 39 carac DB 2AH count DB 1 ENDS PILA SEGMENT STACK DB 100 DUP(?) PILA ENDS CODIGO SEGMENT ASSUME CS:CODIGO , DS:DATOS,SS:PILA INICIO : MOV AX,DATOS MOV DS,AX MOV AH