assembly

What do ds:si and es:di mean in assembly?

こ雲淡風輕ζ 提交于 2020-07-18 04:19:19
问题 The movsb (move string, bytes) instruction fetches the byte at address ds:si, stores it at address es:di, and then increments or decrements the si and di registers by one. I know esi,si and edi,di registers, but not ds:si and es:di , what do they mean? 回答1: ds:si and es:di mean the segment:offset referred to by the registers in question. This is primarily important when you're working in real mode (where offsets are a maximum of 64K apiece). In real mode, the segment are offset are combined

What exactly does <puts@plt> mean?

拟墨画扇 提交于 2020-07-17 07:51:14
问题 at the moment i try to get a bit closer to assembler programming and therefore looked at the assembler code of an easy hello world program: #include <stdio.h> int main () { int i; for(i=0; i<10; i++) { printf("Hello, world!\n"); } return 0; } Now i try to understand how a fiew simple assembler commands work while going step by step through the assembler code and analyzing what exactly happens: 0x000000000040052d <+0>: push rbp 0x000000000040052e <+1>: mov rbp,rsp 0x0000000000400531 <+4>: sub

Caesar cipher encrypting a single character in MIPS

心不动则不痛 提交于 2020-07-16 10:22:00
问题 I'm having some problems in creating a program to encrypt a message. At this point i'm just trying to input a char and the output should be the char+5 positions in the alphabet. So the program should read the char in ASCII and add 5 to it and then print the letter. Ex.: Input: A Output: F It should only work for Capital letters, so every char should be >=65 and <=90. So, if I write 'Z' it should start the alphabet from the beginning and print 'E'. So far, my code looks like this: li $v0, 8

Caesar cipher encrypting a single character in MIPS

不想你离开。 提交于 2020-07-16 10:20:44
问题 I'm having some problems in creating a program to encrypt a message. At this point i'm just trying to input a char and the output should be the char+5 positions in the alphabet. So the program should read the char in ASCII and add 5 to it and then print the letter. Ex.: Input: A Output: F It should only work for Capital letters, so every char should be >=65 and <=90. So, if I write 'Z' it should start the alphabet from the beginning and print 'E'. So far, my code looks like this: li $v0, 8

How to get segment memory address, when i have physical address?

核能气质少年 提交于 2020-07-16 07:01:34
问题 The physical address of the memory cell is given in the form 1A32H. What is the address of the beginning of the memory segment. Or more exactly, the seg:off address I should use to access it. Can someone explain me step by step how to solve this problem? 回答1: In x86 real-mode, the physical address is calculated as: 16 * segment + offset So the physical address 1A32H can be accessed in different ways: Segment = 1A3H, Offset = 2 or Segment = 1A2H, Offset = 12H or Segment = 1A1H, Offset = 22H or

x86-64 canonical address?

放肆的年华 提交于 2020-07-15 07:08:08
问题 During reading of an Intel manual book I came across the following: On processors that support Intel 64 architecture, the IA32_SYSENTER_ESP field and the IA32_SYSENTER_EIP field must each contain a canonical address. What is a 'canonical address'? 回答1: I suggest that you download the full software developer's manual. The documentation is available in separate volumes, but that link gives you all seven volumes in a single massive PDF, which makes it easier to search for things. The answer is

x86-64 canonical address?

隐身守侯 提交于 2020-07-15 07:08:07
问题 During reading of an Intel manual book I came across the following: On processors that support Intel 64 architecture, the IA32_SYSENTER_ESP field and the IA32_SYSENTER_EIP field must each contain a canonical address. What is a 'canonical address'? 回答1: I suggest that you download the full software developer's manual. The documentation is available in separate volumes, but that link gives you all seven volumes in a single massive PDF, which makes it easier to search for things. The answer is

Assembly x86 - “leave” Instruction

不问归期 提交于 2020-07-14 18:10:05
问题 It's said that the "leave" instruction is similar to: movl %ebp, %esp popl %ebp I understand the movl %ebp, %esp part, and that it acts to release stored up memory (as discussed in this question). But what is the purpose of the popl %ebp code? 回答1: LEAVE is the counterpart to ENTER . The ENTER instruction sets up a stack frame by first pushing EBP onto the stack and then copies ESP into EBP , so LEAVE has to do the opposite, i.e. copy EBP to ESP and then restore the old EBP from the stack.

self-modifying code on MacOS Catalina / x64

孤者浪人 提交于 2020-07-10 10:28:39
问题 As part as porting a forth compiler, I'm trying to create a binary that allows for self modifying code. Gory details at https://github.com/klapauciusisgreat/jonesforth-MacOS-x64 Ideally, I create a bunch of pages for user definitions and call mprotect like so: #define __NR_exit 0x2000001 #define __NR_open 0x2000005 #define __NR_close 0x2000006 #define __NR_read 0x2000003 #define __NR_write 0x2000004 #define __NR_mprotect 0x200004a #define PROT_READ 0x01 #define PROT_WRITE 0x02 #define PROT

self-modifying code on MacOS Catalina / x64

Deadly 提交于 2020-07-10 10:28:00
问题 As part as porting a forth compiler, I'm trying to create a binary that allows for self modifying code. Gory details at https://github.com/klapauciusisgreat/jonesforth-MacOS-x64 Ideally, I create a bunch of pages for user definitions and call mprotect like so: #define __NR_exit 0x2000001 #define __NR_open 0x2000005 #define __NR_close 0x2000006 #define __NR_read 0x2000003 #define __NR_write 0x2000004 #define __NR_mprotect 0x200004a #define PROT_READ 0x01 #define PROT_WRITE 0x02 #define PROT