Questions tagged [instruction-set]
Use for questions related to Instruction Set Architectures, ISA. For questions related to the inner workings of a CPU, use [cpu-architecture] instead.
743
questions
3
votes
0
answers
82
views
Why is the "mov" with complex addressing faster than the corresponding "lea"? [duplicate]
I looked up in the instruction tables and found that in Coffee Lake, the RThroughput of the lea with 3 components is 1. I think it’s very slow, so I guessed that the RThroughput of the mov with ...
0
votes
0
answers
52
views
Jump (jmp) in microcode with fetch, decode, execute and writeback
I was assigned to do a jump or not conditional jump ("jmp") in which it receives the OP code and a constant "k" variable in which it stores how many lines have to be added to ...
1
vote
0
answers
16
views
How to decide minimum pmp region for an architecture?
In RISCV architecture, there are pmp registers that define and control the memory regions. It is stated in the spec "Although the PMP mechanism supports regions as small as four bytes, platforms ...
0
votes
0
answers
32
views
Does RISCV SBI refers a hardware implementation or a software standard?
In the RISCV SBI, there are explanations about supervisor and machine communication. As an example, A0-A7 registers are filled with Function and extension ID and also return values for SBI functions. ...
0
votes
0
answers
35
views
In 6502 assembler, trying to output integers after log statement
I'm using 6502 emulator site to output a series of integers and a log statement. I have coded the first set of integers and a log statement to output. But I'm not sure how to set another string ...
0
votes
1
answer
69
views
How to compile for riscv zicond extension in gcc?
I wanted to use zicond extension for risc-v architecture. I read those messages. I couldn't understand how to compile for zicond extension. I tried in godbolt 1 and godbolt 2 with different march ...
1
vote
1
answer
42
views
Why there is different register address for sstatus an mstatus although they are different view of same register?
The sstatus register is a subset of the mstatus register.
In a straightforward implementation, reading or writing any field in sstatus is equivalent to
reading or writing the homonymous field in ...
0
votes
0
answers
52
views
How data dependency handled at cpu instructions pipeline parallelism
I am trying to understand the instructions parallelism in case of multi-core or multiprocessor CPUs.
In a modern CPU typically contains more CPUs which can execute the Instructions parallel. These ...
0
votes
1
answer
65
views
How does RESW in SIC machine works
This is instructions set give in the standard text of System program
( Leland L Beck )for transferring data 5 from accumulator to memory
As you all know SIC is a hypothetical machine
LDA FIVE Load ...
2
votes
0
answers
83
views
VM detection mechanisms for ARM
I'm currently developing a cross-platform VM detection library (for anti-cheat, not malware just to clarify) and I'm planning on adding cross-architecture support as well, specifically for ARM CPUs.
I'...
0
votes
1
answer
671
views
Why is there "syscall" instruction in the x86-64 ISA, if syscalls are OS related?
I am a bit confused about the use of syscalls in OSs, assembly, and machine code.
From what I have understood, syscalls are the interface for users and applications to request services and resources ...
0
votes
0
answers
40
views
ARMv8-a GNU assembler error : immediate out of range at operand 3 [duplicate]
I am having trouble performing logical instructions on the ARMv8-a architecture.
for example, "and x13, x13, #0x0000CCCC0000CCCC" or "and x13, x13, #0x0A0A0A0A0A0A0A0A" results in ...
0
votes
1
answer
75
views
SIMD _mm_store_si128 | _mm_storeu_si128 don't storing correctly
I have a string
const signed char From[] = {
0b00000000, 0b00000001, 0b00000010, 0b00000011,
0b00000100, 0b00000101, 0b00000110, 0b00000111,
0b00001000, 0b00001001, 0b00001010, 0b00001011,
...
1
vote
1
answer
29
views
Why mcyclecfg and minstretcfg is needed?
In RISC-V, new CSRs are planning to be added. This is the documentation on Github Page. It is addressed to two problems below.
• It introduces unpredictable noise to the counter values observed by
...
0
votes
1
answer
159
views
How does the control unit differentiate between Jr and the other R-type instructions if they have the same opCode?
Since the control unit takes one input which is opCode, Jr and other R type instructions passes to 000000 to control unit. But for Jr, RegWrite must be 0. How does the control unit differentiate ...
0
votes
0
answers
23
views
What is the writing instret when IR bit is cleared in mcounteren register?
In RISC-V architecture, there is an instret CS Register which counts the retired instructions. There is an enable bit for this register in another register called mcounteren. The IR bit of this ...
-1
votes
1
answer
366
views
How does arm svc instruction works? [duplicate]
How does SVC (SWI) instruction works? Where it puts supevisor call id and other data? Where to get a list of all supervisor call ids, its parameters and return types?
Im tried to find that all in ...
2
votes
1
answer
125
views
Arm64: What's the meaning of "HINT 0x1b" and "HINT 0x1F"?
In the disassembly of my C++ code, I see that in the prolog of the function, MSVC adds an initial HINT instruction such as:
HINT #0x1B
STP X29, X30, [SP,#-0x10+var_s0]!
...
...
...
2
votes
1
answer
188
views
What does the "P" prefix stand for in the x86 instruction PCLMULQDQ?
In the Carry-less Multiplication x86 instruction, PCLMULQDQ, what does the "P" prefix stand for?
I've looked in these sources, but none of them explain the mnemonics.
https://www.intel.com/...
0
votes
0
answers
177
views
how ALU Function code defined in RISC-V ISA?
In 'Computer Organization and Design' RISC-V version (by Patterson and Hennessy) ebook p1195, it has ALUControl module :
module ALUControl (
ALUOp,
FuncCode,
ALUCtl
);
input [1:0] ALUOp;
...
2
votes
1
answer
150
views
x86 rep prefix with a count of zero: what happens?
What happens for an initial count of zero for an x86 rep prefix?
Intel's manual says explicitly it’s a while count != 0 loop with the test at the top, which is the sane expected behaviour.
But most of ...
0
votes
0
answers
52
views
When using x86-64 instructions what is the best way to check for their availability without wiping out their entire performance benefit
I am writing some simple D (DLang) wrapper routines around various x86_64 instructions using inline asm. This is working well, but if I want to have an alternative path for older processors where ...
0
votes
1
answer
118
views
Why does RISC-V 'J-immediate' encode imm[11] in inst[20]?
Recently I was learning 'Computer Organization and Design RISC-V' book by David A. Patterson, and was stuck by some questions.
Why RISC-V 'J-immediate' put imm[11] in inst[20] instead of inst[24]?
Is ...
0
votes
0
answers
23
views
Why does x86 jump to a new address starting from the PC pointer's tail instead of the header's address? [duplicate]
in x86 why call or jump to another addr is start calucate from nows pc pointers tails address notfrom headers address? maybe x86 has instruction prefixs? can somebody tell me please?
the reason or ...
3
votes
1
answer
64
views
How are the bytecodes for MIPS nop and sll differentiated?
As far as I'm aware both instructions have opcode and function code of 0, so how does the computer know which one it's doing?
1
vote
2
answers
137
views
x86 LEA instruction doing ambiguous things [duplicate]
Here's the C code:
int baz(int a, int b)
{
return a * 11;
}
That is compiled to the following set of assembly instructions (with -O2 flag):
baz(int, int):
lea eax, [rdi+rdi*4]
...
0
votes
1
answer
105
views
Does FADDP ST(0), ST(1) make sense?
I have a question: does the FADDP ST(0), ST(1) instruction make sense in the assembly language?
As far as I know, in this instruction, we add ST(0) and ST(1) and write the result to ST(0), after which ...
3
votes
2
answers
180
views
Do all CPUs of the same architecture run the same Assembly instructions?
Recently, I saw a video of someone writing ASM, they only mentioned that the code is for the x86_64 architecture, with no mention of the specific CPU. At university I was taught to look at the CPU's ...
1
vote
0
answers
46
views
How does the processor distinguish between multiple possible instructions for a stream of binary? [duplicate]
According to this hex to instruction chart, it mentions that E9 maps to the jump instruction, and the DE instruction maps to the add instruction. But, it also mentions that DEE9 maps to the "...
3
votes
1
answer
198
views
Different encoding for arm64 "add x1, sp, x2, lsl #1" than with xzr
The add x1, sp, x2, lsl #1 instruction is supposed to be an "Add (shifted register)" but I have problems with the encoding to differentiate when SP and XZR is used. I'm astonished with the ...
1
vote
0
answers
68
views
When to use a block or a loop in webassembly?
It seems like blocks and loops can be synonymous to each other
block $loop
foo
br $loop
end
Here the branch instruction would transfer the control to the end which acts like a "break"....
0
votes
1
answer
48
views
Program implementation with using specific CPU instructions
I want to realize following steps:
unsigned c = 5
c=c*5
I must do this by using this architecture and using 3 instructions at MOST:
CPU Architecture
Sample instructions for the cpu are like:
...
0
votes
2
answers
65
views
STM32 sometimes hardfault on reboot (thumb instruction issue?)
STM32L496 micro is hard faulting when power is cycled, but only on some builds of firmware, others are ok. I've been able to track it down to a specific path in the assembly, what looks like is ...
1
vote
1
answer
65
views
Transform a stack using Java Virtual Machine Instruction Set
I need to transform 654321 into 654321321, using only DUP2_X1, POP, DUP_X2, POP2. I have a really difficult time with the DUP. Can anyone help?
I tried to go like this: 654321 DUP2_X1 654654321, then ...
0
votes
0
answers
170
views
What is the effect of nop instruction in instret CSR (in RISC-V architecture)?
In the RISC-V spec, there is a CSR called instret and variants of it for the privilege modes. The spec says that instret is the number of retired instructions. I wonder about the effect of nop ...
0
votes
1
answer
73
views
What is the difference between z extend and cast in LLVM
I need to turn the result of a comparison into an i32.
The clang compiler with optimizations seems to favor z extend. What do the z extend or s extend instructions do, and especially how are they ...
1
vote
0
answers
33
views
Systematic way to decide release date of specific Intel CPU features
I am recently developing a hypervisor. The Intel SDM lists a lot of VMX related CPU features, like "use MSR bitmaps", "virtualize APIC accesses", etc. Though I want to use these ...
4
votes
1
answer
86
views
How to read/pronounce a MIPS load-byte instruction in English?
In MIPS instruction set, we have instructions like "LB R1, 0(R2)", which means "load one byte from the memory address whose base address is stored in R2 register and plus an offset of 0,...
0
votes
2
answers
299
views
Z80 16-Bit Load Instruction and Endianness
I'm writing a ZX Spectrum emulator in C# "for fun" (I think I regret starting already).
I know the Z80 is little endian, so in RAM the low-order byte is stored first.
What I can't seem to ...
0
votes
0
answers
96
views
What is the actual behavior of the mov instruction? [duplicate]
Suppose you have mov rax, [rsi] from debugging.
So, how is this instruction actually executed?
Can the address pointed to by the rsi register be the L1 cache in the best case?
Or, when the address ...
0
votes
1
answer
198
views
Can a pointer point to cache memory? [duplicate]
With the mov rax, [rsi] instruction, can the address of rsi point to the L1 cache? Or, when evaluating this instruction, is it possible for the L1 cache hit to fail and point back to the L2 cache?
0
votes
1
answer
40
views
What is an instruction profile?
Here is the statement from my textbook that made me confused as to what "instruction profile" meant:
"...new peripheral devices constantly change the nature of
the demand on the system ...
0
votes
0
answers
71
views
Difference between `CMPXCHG8B m64` and `CMPXCHG r/m64, r64`?
According to https://www.agner.org/optimize/instruction_tables.pdf
They are different in zen4
LOCK CMPXCHG, Ops=5, Latency=9
LOCK CMPXCHG8B, Ops=15, Latency=10
instruction reference: // can't see ...
1
vote
2
answers
73
views
AND vs SUB when converting lowercase to uppercase in assembly
I was wondering why you would use the and instruction instead of the sub instruction when converting lowercase ASCII characters to uppercase ones.
mov dx, 'a'
sub dx, 32
vs
mov dx, 'a'
and dx, ...
0
votes
1
answer
159
views
Branch riscv instruction offset calculation on my emulator
I have wrote a riscv64 emulator but I have an issue on offset calculation for branch instructions (especially for bge).
For me , the formula to calculate offset to add to pc when condition is meet is :...
1
vote
1
answer
112
views
"error: operation size not specified" on push operation. Assembly x86
I'm trying to make a simple x86 program that reverses a string, in this case: "ciao".
section .data
msg db "ciao"
len equ $ - msg
section .text
global _start
...
0
votes
0
answers
132
views
How to decide if FF instruction is a call instruction or a jmp instruction in X86-64 ELF under linux? [duplicate]
I have such ELF in linux and I disassemble it to do some research. However, I get confused "How to decide if FF instruction is a call instruction or a jmp instruction?
For example, the ff ...
0
votes
0
answers
106
views
Can Cranelift or LLVM IRs be used to develop a simple OS from scratch?
I am curious if I can develop my own programming language to output Cranelift or LLVM IRs, then use it to make a simple OS from scratch?
Specifically, do the instruction sets of Cranelift/LLVM IRs ...
0
votes
1
answer
77
views
Is machine code and assembly code part of the architecture?
Is assembly code and machine code specified by the architecture? I know that how you implement the architecutre is uo to you(it is up the microarchitecture can implement the architecture). But I don't ...
4
votes
3
answers
206
views
Is it possible to implement subroutine call without a stack nor indirect addressing?
is it possible to use subroutine with a cpu that doesn't feature indirect addressing nor a way to store the program counter, it would only feature :
2 register A and B ( and a status register for ...