assembly

What is causing this bootloader to fail on hardware but not in DOSBOX? It displays all registers

时光毁灭记忆、已成空白 提交于 2020-12-11 08:53:29
问题 I recently wrote an x86 'bootloader' program that shows the values of the hardware registers after the BIOS jumps to my program. For the purpose of testing, I set the AX register to a known value to ensure that the program runs correctly. BITS 16 %macro pad 1-2 0 times %1 - ($ - $$) db %2 %endmacro [org 0x7C00] CLD ; clear direction flag (forward direction) CLI ; clear interrupt flag (disable interrupts, opposite of 65xx) MOV [0x8000], AX ; display all registers, MOV [0x8004], BX ; including

Gdb jumping some parts of the assembly codes

不打扰是莪最后的温柔 提交于 2020-12-10 07:45:24
问题 I'm having a difficult to debug a program at assembly level because GDB is jumping some parts of the code. The code is: #include <stdio.h> #define BUF_SIZE 8 void getInput(){ char buf[BUF_SIZE]; gets(buf); puts(buf); } int main(int argc, char* argv){ printf("Digite alguma coisa, tamanho do buffer eh: %d\n", BUF_SIZE); getInput(); return 0; } The program was compiled with gcc -ggdb -fno-stack-protector -mpreferred-stack-boundary=4 -o exploit1 exploit1.c In gdb, I added break getInput and when

Gdb jumping some parts of the assembly codes

妖精的绣舞 提交于 2020-12-10 07:44:04
问题 I'm having a difficult to debug a program at assembly level because GDB is jumping some parts of the code. The code is: #include <stdio.h> #define BUF_SIZE 8 void getInput(){ char buf[BUF_SIZE]; gets(buf); puts(buf); } int main(int argc, char* argv){ printf("Digite alguma coisa, tamanho do buffer eh: %d\n", BUF_SIZE); getInput(); return 0; } The program was compiled with gcc -ggdb -fno-stack-protector -mpreferred-stack-boundary=4 -o exploit1 exploit1.c In gdb, I added break getInput and when

Assembly - Round floating point number to .001 precision toward -∞

核能气质少年 提交于 2020-12-10 06:30:28
问题 I am trying to write all my floating point numbers to .001 precision toward -∞. I have set the RC field to 01 binary, but I am only able to print out the initial floating point number with the wanted precision and thereafter it disregards the rounding. I think I might be missing something obvious in how I am handling the precision towards -∞, but I am not sure. INCLUDE Irvine32.inc .data ctrlWord WORD 010000000000b ; set the RC field to round down toward -∞. .code fild sum ; load integer into

Are x86 Assembly Mnemonic standarized?

蓝咒 提交于 2020-12-10 05:47:42
问题 Does the x86 standard include Mnemonics or does it just define the opcodes? If it does not include them, is there another standard for the different assemblers? 回答1: Mnemonics are not standardised and different assemblers use different mnemonics. Some examples: AT&T-style assemblers apply b , w , l , and q suffixes to all mnemonics to indicate operand size. Intel-style assemblers typically indicate this with the keywords byte , word , dword , and qword AT&T-style assemblers recognise cbtw ,

Are x86 Assembly Mnemonic standarized?

大憨熊 提交于 2020-12-10 05:47:04
问题 Does the x86 standard include Mnemonics or does it just define the opcodes? If it does not include them, is there another standard for the different assemblers? 回答1: Mnemonics are not standardised and different assemblers use different mnemonics. Some examples: AT&T-style assemblers apply b , w , l , and q suffixes to all mnemonics to indicate operand size. Intel-style assemblers typically indicate this with the keywords byte , word , dword , and qword AT&T-style assemblers recognise cbtw ,

Buffer overflow Attack (The Attack Lab phase 2)

六月ゝ 毕业季﹏ 提交于 2020-12-09 08:37:25
问题 I have a buffer overflow lab I have to do for a project called The Attack Lab. I'm on phase 2 of the lab, and I have to inject code as part of my exploit string in order to make the program point to the address of the function touch2(). I've gotten to the point where the output says that its a valid solution for phase 2, but then it says I caused a seg fault and then says I failed the phase. This is the error message I receive cookie: 0x2d6fc2d5 Type string:Touch2!: You called touch2

Is there a ARM processor support on-chip hardware random number generator?

梦想与她 提交于 2020-12-08 08:00:30
问题 Intel supports RDRAND (also known as Intel secure key) instruction for returning random numbers. And it's available in Ivy Bridge processors. I wonder, is there any ARM processor featuring instructions for on-chip hw random number generator functionally similar to RDRAND? And I have an additional question. In the Linux kernel (version 3.10), there are driver sources for hw random number generators in /linux/drivers/char/hw_random . (http://lxr.free-electrons.com/source/drivers/char/hw_random/

How to convert an integer to a floating point value in x86 ASM?

牧云@^-^@ 提交于 2020-12-06 04:20:13
问题 I need to multiply an integer (two's compliment) by a floating point constant. Here is what I have: .data pi dd 3.14 int dd 0ah .code fld pi ??? fmul ST(1), ST How can I convert int to a floating point value for multiplying against pi ? 回答1: You need the fild instruction. Here's one reference: http://www.website.masmforum.com/tutorials/fptute/fpuchap5.htm 回答2: Using the x86 FPU is really outdated now and way slower than SSE/AVX/etc. Better to use at least SSE with cvtdq2ps doc ex: .data int

How to convert an integer to a floating point value in x86 ASM?

最后都变了- 提交于 2020-12-06 04:17:32
问题 I need to multiply an integer (two's compliment) by a floating point constant. Here is what I have: .data pi dd 3.14 int dd 0ah .code fld pi ??? fmul ST(1), ST How can I convert int to a floating point value for multiplying against pi ? 回答1: You need the fild instruction. Here's one reference: http://www.website.masmforum.com/tutorials/fptute/fpuchap5.htm 回答2: Using the x86 FPU is really outdated now and way slower than SSE/AVX/etc. Better to use at least SSE with cvtdq2ps doc ex: .data int