assembly

68hc11 assembly (first steps) - sorting

雨燕双飞 提交于 2020-06-14 09:10:08
问题 I just fell in love with this particular microcontroller, 68hc11 has an amazing architecture. I'm not an expert but i want to improve, assembly is kinda hard but i want to program this microcontroller. This assembly code will execute from $100, will allocate a 200-byte array at $800, and will initialize that array with the values 200, 199, … 1. (descending order). Vreset equ $FFFE RAM equ $800 ROM equ $100 ARRAY_SIZE equ 200 org RAM array rmb ARRAY_SIZE org ROM Start ldx #array ldaa #ARRAY

How to use Cmake to build binaries with NASM

孤者浪人 提交于 2020-06-12 12:17:34
问题 I'm learning x64 and I hate make, so I'm trying to get cmake to build binaries with NASM. This is roughly supported by cmake but the documentation is crap. This is what I have working right now by cobbling together stuff from stack overflow and then cutting out everything that doesn't break the build: cmake_minimum_required(VERSION 3.14) set(CMAKE_ASM_NASM_LINK_EXECUTABLE "ld <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64) project(test_project ASM

How to use Cmake to build binaries with NASM

こ雲淡風輕ζ 提交于 2020-06-12 12:16:35
问题 I'm learning x64 and I hate make, so I'm trying to get cmake to build binaries with NASM. This is roughly supported by cmake but the documentation is crap. This is what I have working right now by cobbling together stuff from stack overflow and then cutting out everything that doesn't break the build: cmake_minimum_required(VERSION 3.14) set(CMAKE_ASM_NASM_LINK_EXECUTABLE "ld <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64) project(test_project ASM

How to use Cmake to build binaries with NASM

假如想象 提交于 2020-06-12 12:15:12
问题 I'm learning x64 and I hate make, so I'm trying to get cmake to build binaries with NASM. This is roughly supported by cmake but the documentation is crap. This is what I have working right now by cobbling together stuff from stack overflow and then cutting out everything that doesn't break the build: cmake_minimum_required(VERSION 3.14) set(CMAKE_ASM_NASM_LINK_EXECUTABLE "ld <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64) project(test_project ASM

Assemble far calls or far jumps (j* instructions)

我怕爱的太早我们不能终老 提交于 2020-06-12 09:11:27
问题 I'm trying to create a dispatch table which changes the location of some instruction in another address which is allocated by AllocateMemoryOnRemoteProcess . One of the problems that I encountered was almost all of Calls and all kind of Jumps are near and relative and as long as I load the assemblies in new location, then these instructions won't work. As I know I should convert these instructions to far jump or far call one of the solutions that I saw during my googling was using push and

Assemble far calls or far jumps (j* instructions)

断了今生、忘了曾经 提交于 2020-06-12 09:10:49
问题 I'm trying to create a dispatch table which changes the location of some instruction in another address which is allocated by AllocateMemoryOnRemoteProcess . One of the problems that I encountered was almost all of Calls and all kind of Jumps are near and relative and as long as I load the assemblies in new location, then these instructions won't work. As I know I should convert these instructions to far jump or far call one of the solutions that I saw during my googling was using push and

How syscall knows where to jump? [closed]

三世轮回 提交于 2020-06-12 04:42:48
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 11 months ago . How does Linux determine the address of another process to execute with a syscall? Like in this example? mov rax, 59 mov rdi, progName syscall It seems there is a bit of confusion with my question, to clarify, what I was asking is how does syscall works, independently of the

Compile assembler in nasm on mac os

两盒软妹~` 提交于 2020-06-10 05:52:41
问题 So, i write some instruction on asm, and compile them. nasm -f macho test.asm Now, nasm generate obj file, test.o gcc test.o Returned next error: ld: warning: ignoring file test.o, file was built for unsupported file format which is not the architecture being linked (x86_64) Undefined symbols for architecture x86_64: "_main", referenced from: start in crt1.10.6.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status in gcc line, i used -arch i386 (x86_64),

Why does CLFLUSH exist in x86?

眉间皱痕 提交于 2020-06-09 17:57:45
问题 I recently learned about the row hammer attack. In order to perform this attack the programmer needs to flush the complete cache hierarchy of a CPU for a specific number of addresses. My question is: why is CLFLUSH necessary in x86? What are the reasons for ever using this instruction, if all L* caches act transparently (i.e., no explicit cache invalidation needed)? Besides that: isn't the CPU free to speculate memory access patterns, and thereby ignore the instruction altogether? 回答1: I

gdb with assembler: Print status of carry flag

蓝咒 提交于 2020-06-09 08:39:07
问题 I've got an x86 assembler program which I'm debugging with gdb. Is there a way to print the status of the carry flag inside gdb with, like, "print $cf"? 回答1: You can use: info registers eflags to get the entire set of flags. You'll see a line like: eflags 0x41 [ CF ZF ] which means that the eflags register is set to 0x41 , with the carry and zero flags set. 回答2: I check the EFLAGS register using (gdb) p $eflags $3 = [ PF ZF IF ] where "p" is just short for the "print" command. I also find it