assembly

Tool to Debug Guest OS in Virtual Box

假装没事ソ 提交于 2020-04-10 07:10:30
问题 I'm just cross posting the same question I did on virtualbox.org. http://forums.virtualbox.org/viewtopic.php?f=9&t=26702&p=119139#p119139 If not breaking any rule, I'd appreciate to kwon more about it since stackoverflow promisses to be more dynamic! "Hi, I did some search and could not find any tool to debug a guest system from the early boot in virtual box. Although, I came across JCP, a x86 emulator in java that is not so powerful and beautyful but has a debug mode where one can view the

Why do I have PUSH ecx?

独自空忆成欢 提交于 2020-04-10 03:41:30
问题 Could somebody please tell me what is the purpose of the two push ecx instructions below? I can't understand what they are supposed to be doing? I realise the push epb is saving the stack base pointer and then mov epb, esp is assigning the stack pointer to the previous stack base pointer. int main(){ 01301190 push ebp 01301191 mov ebp,esp 01301193 push ecx ;here?? 01301194 mov dword ptr [h],0CCCCCCCCh int h = my_func(1,3); int my_func(int a, int b){ 01301160 push ebp 01301161 mov ebp,esp

How can I make gdb print unprintable characters of a string in hex instead of octal while preserving the ascii characters in ascii form?

落爺英雄遲暮 提交于 2020-04-08 08:51:48
问题 Suppose I have a buffer buf whose c string representation is char* buf = "Hello World \x1c" When I print this buf in gdb using the command p buf , I get the following $1 = "Hello World \034" Is there a print command or a gdb setting that will print the following instead? $1 = "Hello World \x1c" I have tried various format parameters such as /c and /x , but none of them get the effect that I am looking for. I have also played with printf but was unable to achieve the desired effect. Update: I

How to read input from STDIN in x86_64 assembly?

倾然丶 夕夏残阳落幕 提交于 2020-04-07 18:51:09
问题 I am trying to learn x86_64 assembly and I was trying standard input output today and stumbled upon this post Learning assembly - echo program name How would I do the same for reading the input from STDIN (using SYSCALL instruction)? Especially if I know that the input will always be an integer and I want to read it to a register? EDIT: @Daniel Kozar's answer below helped me understand how STDIN and STDOUT stuff work with the SYSCALL instruction on Linux. I attempted to write a small program,

How to read input from STDIN in x86_64 assembly?

落花浮王杯 提交于 2020-04-07 18:48:24
问题 I am trying to learn x86_64 assembly and I was trying standard input output today and stumbled upon this post Learning assembly - echo program name How would I do the same for reading the input from STDIN (using SYSCALL instruction)? Especially if I know that the input will always be an integer and I want to read it to a register? EDIT: @Daniel Kozar's answer below helped me understand how STDIN and STDOUT stuff work with the SYSCALL instruction on Linux. I attempted to write a small program,

How to Solve 'bootloader.asm:30: error: TIMES value -44 is negative' Problem in NASM

一个人想着一个人 提交于 2020-04-07 10:29:22
问题 I'm developing a Hello World kernel and bootloader...I wrote this code but when I try to compile it via NASM It says : "bootloader.asm:30: error: TIMES value -44 is negative". bootloader.asm: [BITS 16] [ORG 0x7C00] MOV DL, 0x80 MOV DH, 0x0 MOV CH, 0x0 MOV CL, 0x02 MOV BX, 0x1000 MOV ES, BX MOV BX, 0x0 ReadFloppy: MOV AH, 0x02 MOV AL, 0x01 INT 0x13 JC ReadFloppy MOV AX, 0x1000 MOV DS, AX MOV ES, AX MOV FS, AX MOV GS, AX MOV SS, AX JMP 0x1000:0x0 TIMES 510 - ($ - $$) db 0 DW 0xAA55 kernel.asm:

Variable in memory not updated by a store to that symbol

妖精的绣舞 提交于 2020-04-07 07:49:50
问题 When I run the emu8086, this result(ans) return to me 0 ..Why ? data segment ans dw ? ends stack segment dw 128 dup(0) ends code segment start: mov ax,@data mov dx,ax mov ax,2 mov bl,2 mul bl mov ans,ax mov ax, 4c00h int 21h ends end start 回答1: mov ax,@data mov dx,ax This part of the code must setup the DS segment register. You made a typo and wrote DX instead! mov ax, @data mov ds, ax Because of this error, the result of your AL * BL multiplication (4) was still written in memory by mov ans

linux x86_64 nasm assembly syscalls

萝らか妹 提交于 2020-04-07 06:29:53
问题 I have found charts online showing various syscalls for x86_64 linux nasm assembly and there appears to be 380ish total syscalls, however every book or tutorial I can find only "how a few of the syscalls work and what they do?" Does anyone know where I can find information on every single syscall for x86_64 linux assembly using the nasm assembler? Any help would be great. 回答1: Look at the Linux man pages (section 2). http://man7.org/linux/man-pages/dir_section_2.html It doesn't matter what

C++ - second level of protected code in user space code

♀尐吖头ヾ 提交于 2020-04-07 06:25:48
问题 Given this code: class module { public: virtual void run(void (*callback)(int)) = 0; byte* memory; } int main() { module m1 = loadSomeUntrustedModule(); module m2 = loadSomeUntrustedModule(); m1.memory[31] = 5; //m1.run(); //? return m1.memory[32]; } I want to execute run in module that cannot access code outside of itself, isolating it with its own private memory space, only accessible from the main process. Safe from memory leaks, and potentially from malicious code. The code does not need

C++ - second level of protected code in user space code

孤街醉人 提交于 2020-04-07 06:24:46
问题 Given this code: class module { public: virtual void run(void (*callback)(int)) = 0; byte* memory; } int main() { module m1 = loadSomeUntrustedModule(); module m2 = loadSomeUntrustedModule(); m1.memory[31] = 5; //m1.run(); //? return m1.memory[32]; } I want to execute run in module that cannot access code outside of itself, isolating it with its own private memory space, only accessible from the main process. Safe from memory leaks, and potentially from malicious code. The code does not need