How are atomic operations implemented at a hardware level?

Here is an article over at software.intel.com on that sheds little light on user level locks: User level locks involve utilizing the atomic instructions of processor to atomically update a memory space. The atomic instructions involve utilizing a lock prefix on the instruction and having the destination operand assigned to a memory address. The following … Read more

Why is x86 little endian?

Largely, for the same reason you start at the least significant digit (the right end) when you add—because carries propagate toward the more significant digits. Putting the least significant byte first allows the processor to get started on the add after having read only the first byte of an offset. After you’ve done enough assembly … Read more

How Do You Make An Assembler? [closed]

This is what you are looking for: Assemblers And Loaders – By David Salomon. Published February, 1993 – Freely available (download here) Of course, you are going to need the following: Intel® 64 and IA-32 Architectures Software Developer’s Manuals AMD-64 Architecture Programmers manual Linkers and Loaders by John R. Levine (freely available) ELF File Format … Read more

How to write a disassembler? [closed]

Take a look at section 17.2 of the 80386 Programmer’s Reference Manual. A disassembler is really just a glorified finite-state machine. The steps in disassembly are: Check if the current byte is an instruction prefix byte (F3, F2, or F0); if so, then you’ve got a REP/REPE/REPNE/LOCK prefix. Advance to the next byte. Check to … Read more

How does x86 paging work?

Version of this answer with a nice TOC and more content. I will correct any error reported. If you want to make large modifications or add a missing aspect, make them on your own answers to get well deserved rep. Minor edits can be merged directly in. Sample code Minimal example: https://github.com/cirosantilli/x86-bare-metal-examples/blob/5c672f73884a487414b3e21bd9e579c67cd77621/paging.S Like everything else … Read more

What is the meaning of “non temporal” memory accesses in x86

Non-Temporal SSE instructions (MOVNTI, MOVNTQ, etc.), don’t follow the normal cache-coherency rules. Therefore non-temporal stores must be followed by an SFENCE instruction in order for their results to be seen by other processors in a timely fashion. When data is produced and not (immediately) consumed again, the fact that memory store operations read a full … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)