assembly

Decoding i386 opcodes to instructions

六月ゝ 毕业季﹏ 提交于 2021-01-03 10:45:18
问题 I'm trying to Is there any good resource available to learn 'decoding' of i386 opcodes? Most of the websites talk about how to encode instructions, but I don't find anywhere something telling as to how to decode opcodes to instructions. I've looked at the source code of some disassemblers, but I want some documentation as to how to decode opcodes to instructions. Thanks and Regards, Hrishikesh Murali 回答1: Read the processor manuals, they have it described, though maybe not in complete details

Decoding i386 opcodes to instructions

不问归期 提交于 2021-01-03 10:37:46
问题 I'm trying to Is there any good resource available to learn 'decoding' of i386 opcodes? Most of the websites talk about how to encode instructions, but I don't find anywhere something telling as to how to decode opcodes to instructions. I've looked at the source code of some disassemblers, but I want some documentation as to how to decode opcodes to instructions. Thanks and Regards, Hrishikesh Murali 回答1: Read the processor manuals, they have it described, though maybe not in complete details

Decoding i386 opcodes to instructions

試著忘記壹切 提交于 2021-01-03 10:33:01
问题 I'm trying to Is there any good resource available to learn 'decoding' of i386 opcodes? Most of the websites talk about how to encode instructions, but I don't find anywhere something telling as to how to decode opcodes to instructions. I've looked at the source code of some disassemblers, but I want some documentation as to how to decode opcodes to instructions. Thanks and Regards, Hrishikesh Murali 回答1: Read the processor manuals, they have it described, though maybe not in complete details

what is segment 00 in my Linux executable program (64 bits)

让人想犯罪 __ 提交于 2021-01-03 09:41:31
问题 Here is a very simple assembly program, just return 12 after executed. $ cat a.asm global _start section .text _start: mov rax, 60 ; system call for exit mov rdi, 12 ; exit code 12 syscall It can be built and executed correctly: $ nasm -f elf64 a.asm && ld a.o && ./a.out || echo $? 12 But the size of a.out is big, it is more than 4k: $ wc -c a.out 4664 a.out I try to understand it by reading elf content: $ readelf -l a.out Elf file type is EXEC (Executable file) Entry point 0x401000 There are

what is segment 00 in my Linux executable program (64 bits)

可紊 提交于 2021-01-03 09:29:38
问题 Here is a very simple assembly program, just return 12 after executed. $ cat a.asm global _start section .text _start: mov rax, 60 ; system call for exit mov rdi, 12 ; exit code 12 syscall It can be built and executed correctly: $ nasm -f elf64 a.asm && ld a.o && ./a.out || echo $? 12 But the size of a.out is big, it is more than 4k: $ wc -c a.out 4664 a.out I try to understand it by reading elf content: $ readelf -l a.out Elf file type is EXEC (Executable file) Entry point 0x401000 There are

EMU8086 dividing 32 bit number by a 16 bit number gives unexpected 0 remainder

天大地大妈咪最大 提交于 2021-01-03 07:07:52
问题 I was trying to divide (Unsigned) 8A32F4D5 by C9A5 using emu8086 tool. I expected the quotient to be AF73H and the remainder be 94B6H . After writing the following code, I was getting correct quotient but the remainder became 0000h . Am I missing something? .MODEL SMALL .STACK 100H .DATA .CODE MAIN PROC ; initialize DS MOV AX,@DATA MOV DS,AX ; enter your code here MOV DX, 8A32H MOV AX, 0F4D5H MOV BX, 0C9A5H DIV BX ;exit to DOS MOV AX,4C00H INT 21H MAIN ENDP END MAIN The output in EMU8086: 回答1

EMU8086 dividing 32 bit number by a 16 bit number gives unexpected 0 remainder

蓝咒 提交于 2021-01-03 07:04:46
问题 I was trying to divide (Unsigned) 8A32F4D5 by C9A5 using emu8086 tool. I expected the quotient to be AF73H and the remainder be 94B6H . After writing the following code, I was getting correct quotient but the remainder became 0000h . Am I missing something? .MODEL SMALL .STACK 100H .DATA .CODE MAIN PROC ; initialize DS MOV AX,@DATA MOV DS,AX ; enter your code here MOV DX, 8A32H MOV AX, 0F4D5H MOV BX, 0C9A5H DIV BX ;exit to DOS MOV AX,4C00H INT 21H MAIN ENDP END MAIN The output in EMU8086: 回答1

EMU8086 dividing 32 bit number by a 16 bit number gives unexpected 0 remainder

不羁岁月 提交于 2021-01-03 07:04:33
问题 I was trying to divide (Unsigned) 8A32F4D5 by C9A5 using emu8086 tool. I expected the quotient to be AF73H and the remainder be 94B6H . After writing the following code, I was getting correct quotient but the remainder became 0000h . Am I missing something? .MODEL SMALL .STACK 100H .DATA .CODE MAIN PROC ; initialize DS MOV AX,@DATA MOV DS,AX ; enter your code here MOV DX, 8A32H MOV AX, 0F4D5H MOV BX, 0C9A5H DIV BX ;exit to DOS MOV AX,4C00H INT 21H MAIN ENDP END MAIN The output in EMU8086: 回答1

Load Sectors to RAM in qemu

和自甴很熟 提交于 2021-01-02 12:50:21
问题 I code a simple program which loads the sector (sector num.2) to the RAM but prints nothing. first, I tried this code for bootsector: org 0x7c00 mov ax, 0x1000 ; ES:BX = 1000:0000 mov es, ax mov bx, 0x00 LoadSectortoMemory: mov al, 0x01 ; Load 1 sectors mov ah, 0x02 ; Load disk data to ES:BX mov cl, 0x02 ; Sector = 2 mov ch, 0x00 ; Cylinder = 0 mov dl, 0x00 ; Drive = 0 mov dh, 0x00 ; Head = 0 int 13h ; Read jc LoadSectortoMemory ; ERROR => Try again jmp 0x1000:0x0000 times 510-($-$$) db 0 dw

Calling C function from masm 64

余生长醉 提交于 2021-01-01 06:36:39
问题 I have a problem with my assembly code (64 bit masm in Visual 2013 on win8 64). When I'm calling C function (printf), it throwing exception from ntdll.dll. What I'm doing wrong? How I can read and write data from console in 64 bit masm? Where I can find good tutorial for masm 64 bit? extrn printf : proc .data format byte "Arg1: %d", 10, 0 .code printData proc mov rbx, 100 push rbx lea rax, format; format address push rax call printf; throw unhandled exception ntdll.dll - Access violation