gas

以太坊区块链说的gas/gas price/gas cost是什么?

眉间皱痕 提交于 2020-12-24 10:39:04
https://www.reddit.com/r/ethereum/comments/271qdz/can_someone_explain_the_concept_of_gas_in_ethereum/ https://www.reddit.com/r/ethereum/comments/3fnpr1/can_someone_possibly_explain_the_concept_of/ https://www.reddit.com/r/ethereum/comments/49gol3/can_ether_be_used_as_a_currency_eli5_ether_gas/ Operation Name Gas Cost Remark step 1 default amount per execution cycle stop 0 free suicide 0 free sha3 20 sload 20 get from permanent storage sstore 100 put into permanent storage balance 20 create 100 contract creation call 20 initiating a read-only call memory 1 every additional word when expanding

relocation R_X86_64_8 against undefined symbol `ELF' can not be used when making a PIE object

冷暖自知 提交于 2020-07-09 11:55:27
问题 Having this in gas: .text .globl main main: xor %eax, %eax lea str(%rip), %rdi call printf call exit str: .byte 0x7F, "ELF", 1,1,1,0 I thought the .byte directive could be concatenate as in nasm db 0x7F, "ELF", 1, 1, 1, 0 ; e_ident source : http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html 回答1: In GAS syntax, "ELF" is a symbol reference to the symbol name ELF , not a multi-char string. In the context of .byte directive, it's only looking for a number, not a possible string. And

relocation R_X86_64_8 against undefined symbol `ELF' can not be used when making a PIE object

假装没事ソ 提交于 2020-07-09 11:55:09
问题 Having this in gas: .text .globl main main: xor %eax, %eax lea str(%rip), %rdi call printf call exit str: .byte 0x7F, "ELF", 1,1,1,0 I thought the .byte directive could be concatenate as in nasm db 0x7F, "ELF", 1, 1, 1, 0 ; e_ident source : http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html 回答1: In GAS syntax, "ELF" is a symbol reference to the symbol name ELF , not a multi-char string. In the context of .byte directive, it's only looking for a number, not a possible string. And

Building Jonesforth - asm/unistd.h: No such file or directory

前提是你 提交于 2020-07-09 03:23:12
问题 When attempting to build Jonesforth (32-bit GNU Assembler program) on Ubuntu 16.04.4 64-bit (Xenial Xerus), I'm seeing the following: ~/src/jonesforth $ make gcc -m32 -nostdlib -static -o jonesforth jonesforth.S jonesforth.S:1154:24: fatal error: asm/unistd.h: No such file or directory compilation terminated. Makefile:11: recipe for target 'jonesforth' failed Looking in the file jonesforth.S , I noticed the following lines: //#include <asm-i386/unistd.h> // You might need this instead

storage register for scanf call in gas

倖福魔咒の 提交于 2020-06-17 15:47:06
问题 I am trying to understand scanf function a have 3 question regarding it. this is c file: #include <stdio.h> #include <stdlib.h> int main(){ int x; printf("Enter X:\n"); scanf("%i",&x); printf("You entered %d...\n",x); return 0; } and here is gas: .text .section .rodata .LC0: .string "Enter X:" .LC1: .string "%i" .LC2: .string "You entered %d...\n" .text .globl main .type main, @function main: pushq %rbp # movq %rsp, %rbp #, subq $16, %rsp #, # a.c:5: printf("Enter X:\n"); leaq .LC0(%rip),

GNU GAS: Label is not relatively referenced

烈酒焚心 提交于 2020-06-09 04:32:30
问题 I am writing a little bootsector for learning purpose. Here is boot.S .code16 .text movw $0xB800, %ax /* 0xB000 is the text screen video memory */ movw %ax, %es /* set it as the %es segment */ movb label, %al movb %al, %es:0x0 /* screen[0] = 'A' */ movb $0x07, %es:0x1 /* white on black */ jmp . label: .byte 'A .=510 .byte 0x55 .byte 0xAA and here is the Makefile I use to compile it to a raw binary file hdd.img: boot.S as $< -o boot.o ld --oformat binary -Ttext 0x7c00 boot.o -o hdd.img I face

Different behavior calling JMP with register vs value

你。 提交于 2020-06-01 05:54:29
问题 I'm trying to perform an absolute jump to the address 0x7C00 as part of a procedure in a hobby OS. I'm using intel syntax in GAS and testing in QEMU. I tried two methods: jmp 0x00007c00 and mov eax, 0x00007C00 jmp eax The second method seems to work as I intended and jumps to 0x7C00, but the first method causes QEMU to crash stating that it's "trying to execute code outside RAM or ROM at 0x40007c00". Does anyone know why it's jumping to a different address and the upper bytes are being set to

Assembly executing a long jump with an offset with different syntax

為{幸葍}努か 提交于 2020-05-23 06:53:34
问题 I am writing a GDT for a Kernel and all is going well, I'm following this tutorial. http://www.osdever.net/bkerndev/Docs/gdt.htm When link the C code to the assembly code he uses this piece of code. ; This will set up our new segment registers. We need to do ; something special in order to set CS. We do what is called a ; far jump. A jump that includes a segment as well as an offset. ; This is declared in C as 'extern void gdt_flush();' global _gdt_flush ; Allows the C code to link to this

What's the difference between the .ascii and the .string assembler directives?

≡放荡痞女 提交于 2020-05-12 16:41:32
问题 I know that the .ascii directive doesn't put a null character at the end of the string. The .asciz directive is used for that purpose. However, I don't know whether the .string directive puts a null character at the end of the string. If it does, then what's the difference between the .asciz and the .string directives? To me, having both .ascii and .string seems redundant. 回答1: Just so this question no longer shows up in "Unanswered"... According to the binutils docs: .ascii (Here for

What's the difference between the .ascii and the .string assembler directives?

风流意气都作罢 提交于 2020-05-12 16:41:17
问题 I know that the .ascii directive doesn't put a null character at the end of the string. The .asciz directive is used for that purpose. However, I don't know whether the .string directive puts a null character at the end of the string. If it does, then what's the difference between the .asciz and the .string directives? To me, having both .ascii and .string seems redundant. 回答1: Just so this question no longer shows up in "Unanswered"... According to the binutils docs: .ascii (Here for