nasm

64-BIT mode do not support PUSH and POP instructions [duplicate]

主宰稳场 提交于 2020-12-27 17:54:43
问题 This question already has answers here : Push and Pop on AMD64 [duplicate] (1 answer) Does each PUSH instruction push a multiple of 8 bytes on x64? (2 answers) Closed 3 years ago . NASM returns an error like: "instruction not supported in 64-bit mode" and I couldn't figure out what to do. The subject instruction is pop ecx and push ecx instructions. What can I use instead of them or is there an other way to fix this issue? 回答1: The general idea is that you normally push and pop full registers

64-BIT mode do not support PUSH and POP instructions [duplicate]

半世苍凉 提交于 2020-12-27 17:45:59
问题 This question already has answers here : Push and Pop on AMD64 [duplicate] (1 answer) Does each PUSH instruction push a multiple of 8 bytes on x64? (2 answers) Closed 3 years ago . NASM returns an error like: "instruction not supported in 64-bit mode" and I couldn't figure out what to do. The subject instruction is pop ecx and push ecx instructions. What can I use instead of them or is there an other way to fix this issue? 回答1: The general idea is that you normally push and pop full registers

64-BIT mode do not support PUSH and POP instructions [duplicate]

人走茶凉 提交于 2020-12-27 17:41:50
问题 This question already has answers here : Push and Pop on AMD64 [duplicate] (1 answer) Does each PUSH instruction push a multiple of 8 bytes on x64? (2 answers) Closed 3 years ago . NASM returns an error like: "instruction not supported in 64-bit mode" and I couldn't figure out what to do. The subject instruction is pop ecx and push ecx instructions. What can I use instead of them or is there an other way to fix this issue? 回答1: The general idea is that you normally push and pop full registers

not able to write make file

被刻印的时光 ゝ 提交于 2020-12-26 11:04:20
问题 I have made a small program in assembly language which is executing fine. I also have the commands to execute it but I don't know how to make a makefile to automate the same. The command I used is: nasm -f bin boot2.asm -o boot2.bin && qemu-system-x86_64 -fda boot2.bin How do I make a makefile for the same? 回答1: Simple version: all: build run build: boot2.bin boot2.bin: boot2.asm nasm -f bin boot2.asm -o boot2.bin run: boot2.bin qemu-system-x86_64 -fda boot2.bin clean: -rm boot2.bin 来源: https

Can i use binary to write integer constants in assembly?

我怕爱的太早我们不能终老 提交于 2020-12-25 01:23:04
问题 i have an assignment that asks to define 4 integers, each of a different byte length (1, 2, 4, 8) would this code work? segment .data one db 1 two dw 01 four dd 1011 eight dq 01101110 global _start _start: mov rax, [one] ; mov rbx, [two] ; im also curious if i can safely store these values into registers to be used for addition in the future. I'm supposed to use sign extension for the shorter values, but could use some direction 回答1: You're writing constants in decimal. If you want the digits

Can i use binary to write integer constants in assembly?

℡╲_俬逩灬. 提交于 2020-12-25 01:22:48
问题 i have an assignment that asks to define 4 integers, each of a different byte length (1, 2, 4, 8) would this code work? segment .data one db 1 two dw 01 four dd 1011 eight dq 01101110 global _start _start: mov rax, [one] ; mov rbx, [two] ; im also curious if i can safely store these values into registers to be used for addition in the future. I'm supposed to use sign extension for the shorter values, but could use some direction 回答1: You're writing constants in decimal. If you want the digits

自己制作一个简单的操作系统一[环境搭建]

穿精又带淫゛_ 提交于 2020-12-24 01:06:44
自己制作一个简单的操作系统一[环境搭建] 环境搭建好了? 直接上手 自己制作一个简单的操作系统二[CherryOS] 一. 软硬件需求 1. 硬件   一台电脑, 我使用的是win10(本来想用linux可是没找到linux版的扇区读写工具) 2. 软件    汇编编译器:NASM 点击下载   软盘绝对扇区读写工具:FloppyWriter 点击下载   虚拟机:Oracle VirtualBox 点击下载 二. 配置虚拟机   安装好VirtualBox后就可以对虚拟机进行配置了: 下面是配置过程 ( 我使用的是截止2019-9最新的VirtualBox ) 首先是新建一个虚拟机, 按照下图进行选择;    之后点击下一步 再次选择下一步 创建虚拟硬盘, 使用默认选项, 点击下一步 动态分配, 下一步 依然使用默认选项, 点击创建 之后添加软盘控制器 设置>>存储>>选择添加软盘控制器 OK! 目前简单的环境就搭建好了, 下一篇文章 自己制作一个简单的操作系统二[CherryOS] 我们来写一个最简单的hello cherryos 操作系统 来源: oschina 链接: https://my.oschina.net/u/4388787/blog/3385284

Linux default behavior against `.data` section

戏子无情 提交于 2020-12-23 09:31:49
问题 Story Case 1 I accidentally wrote my Assembly code in the .data section. I compiled it and executed it. The program ran normally under Linux 5.4.0-53-generic even though I didn't specify a flag like execstack . Case 2: After that, I executed the program under Linux 5.9.0-050900rc5-generic . The program got SIGSEGV . I inspected the virtual memory permission by reading /proc/$pid/maps . It turned out that the section is not executable. I think there is a configuration on Linux that manages

Assembler output does not run on my Linux machine

我们两清 提交于 2020-12-13 04:54:00
问题 I followed up this page and compiled the following code ; assembly program that calls a C function on 64-bit Linux ; ; int main(void) { ; printf(fmt, 1, msg1); ; printf(fmt, 2, msg2); ; return 0; ; ; Assemble in 64-bit: nasm -f elf64 -o hp64.o -l hp64.lst hello-printf-64.asm ; ; Link: ld hp64.o -o hp64 -lc --dynamic-linker /lib/ld-2.7.so ; or maybe ld hp64.o -o hp64 -lc --dynamic-linker /lib/ld-linux-x86-64.so.2 ; (the "-lc" option is needed to resolve "printf") ;-----------------------------

Assembler output does not run on my Linux machine

霸气de小男生 提交于 2020-12-13 04:50:05
问题 I followed up this page and compiled the following code ; assembly program that calls a C function on 64-bit Linux ; ; int main(void) { ; printf(fmt, 1, msg1); ; printf(fmt, 2, msg2); ; return 0; ; ; Assemble in 64-bit: nasm -f elf64 -o hp64.o -l hp64.lst hello-printf-64.asm ; ; Link: ld hp64.o -o hp64 -lc --dynamic-linker /lib/ld-2.7.so ; or maybe ld hp64.o -o hp64 -lc --dynamic-linker /lib/ld-linux-x86-64.so.2 ; (the "-lc" option is needed to resolve "printf") ;-----------------------------