assembly

Do I have to keep changing sectors or can I load multiple

我的梦境 提交于 2020-03-03 12:55:07
问题 So I finally found an example on how to leave the first sector so I can continue to load code. Do I have to keep changing sectors every time I use 512 bytes? Can I load multiple sectors at once, aka all of them? and if so is there a limit to how many sectors I can load at once? I'm calling this to load the next sector load_sector1: xor ah, ah int 0x13 clc mov bx, 0x07E0 mov es, bx xor bx, bx mov ah, 0x02 mov al, 0x1 mov ch, 0x0 mov cl, 0x2 ; Sector mov dh, 0x0 int 0x13 jmp 0x0:0x7E00 If I can

Need Help Manipulating Registers in Inline Assembly (STM32F103 “BluePill”)

时间秒杀一切 提交于 2020-03-03 12:21:18
问题 I have some simple code I want to get working. What I'm trying to do is to switch Pin PA8 ON and OFF as fast as possible on the STM32F103 "BluePill" using Assembly. I'm having trouble with the correct syntax. __asm__ volatile ( "ldr r2, = (1<<8) \n\t" "str r2, = [odr] \n\t" "ldr r2, = ~(1<<8) \n\t" "str r2, = [odr] \n\t" : [odr] "=r" (GPIOA->regs->ODR) ); The compiler throws this error: Compiling .pio/build/genericSTM32F103C8/src/main.ino.cpp.o /tmp/ccLofo6i.s: Assembler messages: /tmp

Math.h library functions in assembly x86? [duplicate]

て烟熏妆下的殇ゞ 提交于 2020-03-03 06:01:11
问题 This question already has answers here : How does C compute sin() and other math functions? (22 answers) Closed 6 days ago . I tried to convert C code that is written under Linux (fedora 9) to assembly x86 code, however, I have problem in a Math.h functions. The functions in this library such as ceil, floor, log, log10, pow are undefined in the assembly x86. Can you please help me to solve this problem? Thanks. 回答1: Most library functions won't be defined in assembly language, at least not in

Linux /proc/kallsyms file, where does kernel save core symbols list?

女生的网名这么多〃 提交于 2020-03-02 05:36:25
问题 To display symbols in /proc/kallsyms , for the module symbols, kernel loops over module objects headed by modules kernel variable, and iterate over each module's symbol table. But for the 'core' kernel built-in symbols, it uses a bunch of kernel variables, demonstrated in this function: static unsigned long kallsyms_sym_address(int idx) { if (!IS_ENABLED(CONFIG_KALLSYMS_BASE_RELATIVE)) return kallsyms_addresses[idx]; /* values are unsigned offsets if --absolute-percpu is not in effect */ if (

Understanding the difference between ++i and i++ at the Assembly Level

▼魔方 西西 提交于 2020-03-01 14:37:27
问题 I know that variations of this question has been asked here multiple times, but I'm not asking what is the difference between the two. Just would like some help understanding the assembly behind both forms. I think my question is more related to the whys than to the what of the difference. I'm reading Prata's C Primer Plus and in the part dealing with the increment operator ++ and the difference between using i++ or ++i the author says that if the operator is used by itself, such as ego++; it

Understanding the difference between ++i and i++ at the Assembly Level

最后都变了- 提交于 2020-03-01 14:35:07
问题 I know that variations of this question has been asked here multiple times, but I'm not asking what is the difference between the two. Just would like some help understanding the assembly behind both forms. I think my question is more related to the whys than to the what of the difference. I'm reading Prata's C Primer Plus and in the part dealing with the increment operator ++ and the difference between using i++ or ++i the author says that if the operator is used by itself, such as ego++; it

Binary Bomb Phase 3 Assembly

孤者浪人 提交于 2020-02-29 04:39:31
问题 Yes, this is homework, and no I'm not asking you to do my homework. I need help with phase 3 of this binary bomb. I didn't have any trouble with phases 1 and 2 but phase 3 is just too much for me. I understand that there should be 3 inputs. I'm pretty sure one of them is a character input and two of them are integers, but I'm not sure in what order. Firstly, here is the disassembled code: 0x0000000000401163 <phase_3+0>: sub $0x18,%rsp 0x0000000000401167 <phase_3+4>: lea 0xf(%rsp),%rcx

Why flush the pipeline for Memory Order Violation caused by other logical processors?

ぐ巨炮叔叔 提交于 2020-02-28 04:02:50
问题 The Memory Order Machine Clear performance event is described by the vTune documentation as: The memory ordering (MO) machine clear happens when a snoop request from another processor matches a source for a data operation in the pipeline. In this situation the pipeline is cleared before the loads and stores in progress are retired. However I don't see why that should be the case. There is no synchronisation order between loads and stores on different logical processors. The processor could

Unrolling 1-cycle loop reduces performance by 25% on Skylake. uops scheduling issue?

陌路散爱 提交于 2020-02-28 03:08:41
问题 TL;DR I have a loop that takes 1 cycle to execute on Skylake (it does 3 additions + 1 inc/jump). When I unroll it more than 2 times (no matter how much), my program runs about 25% slower. It might have something to do with alignment, but I don't clearly see what. EDIT: this question used to ask about why uops were delivered by the DSB rather than the MITE. This has now be moved to this question. I was trying to benchmark a loop which does 3 additions on my Skylake. This loop should execute in

How Windows thread stack guard page mechanism works in case of uninitialized local variables?

生来就可爱ヽ(ⅴ<●) 提交于 2020-02-27 07:55:23
问题 On Windows OS for x86-32/x86-64 architecture thread stack virtual memory consist of "Reserved Part" "Commit Part", "Guard Page" and "Reserved Page". Question: Imagine that I have 1 page of commit memory, and 1MB of reserve memory for thread stack. I allocate on the stack some memory equal to K Pages without initialization. K is equal for example 10. It seems that in start of stack frame memory on the stack will be allocated by user space code like this: sub esp, K*4096 Guard Page mechanism