Questions tagged [no-op]

No-op (also spelled as "noop" and "nop") is an abbreviation for "no-operation". It is code that does nothing and has no effect. It is used for filling space (adding padding) and/or wasting time. "nop" is a common instruction in assembly language.

The great art of doing nothing

What is it, and how did it come to be?

No-OPeration (nop, no-op) is the proper instruction to instruct a processor to do nothing (but waste time).
Just about every has at least some s which have no effect at all. They naturally occur because it pays to build a regular IS, which leads to curiosities like exchange A for A, assign A to A, bitwise-and/or A and A.

While some of those may be redefined for better instruction density, one will be chosen as intended nop.

Purpose/Uses

There are a great many uses for doing nothing. Some examples:

  • Reserving space for adding patches

    Some Windows system binariesreserve space to allow live-patching.

  • Neutralizing code

    An example is an implementation of a seldom changed flag in high-performance-code: Either there's an unconditional jump to additional code, or there's a single, efficient nop

  • Aligning code for better caching

    If a function begins at the start of a cache-line (or even memory-page), there will often be fewer cache-misses

  • Wasting time

    Counting instructions and busy-Loops for delaying are getting less common in high-end systems, though they are still alive and well on slower machines.

  • (Attacking) Making a bigger target for a (semi-)blind jump by building a nop-slide.

References

115 questions
0
votes
1 answer

Trying to implement a cleanup in a useEffect to prevent no-op memory leak error

I am trying to update a piece of UI based on a conditional. The conditional is set by a database call in a separate component. It sometimes works, but often doesn't. When it doesn't work, it gets this error: Warning: Can't perform a React state…
deadant88
  • 920
  • 9
  • 24
0
votes
1 answer

Cannot print NOP ('\x90') in terminal

I have a C program that writes a NOP character to stdout: #include int main(char *argc, char *argv[]) { fwrite("\x90", 1, sizeof(char), stdout); return 0; } I also have another program that takes input, which i am runnning in…
0
votes
0 answers

Performance comparison if / else vs state change vs noop in HTMLCanvasElement render loop

In a project related to HTMLCanvasElement, I have a base class Object2d which stores object's state with many options, e.g. rotation, debug, etc., that affect the rendering phase. A typical render function for the instances of this class would…
Benoît Lahoz
  • 1,270
  • 1
  • 18
  • 43
0
votes
1 answer

IceFaces javascript won't works in a liferay portlet

I deployed an application (made with ice faces 1.8) that works on Liferay5 in a weblogic into a Liferay6 with tomcat. The application and everything seems good....the only thing that won't works is the javascript...when i click on a button, change a…
rascio
  • 8,968
  • 19
  • 68
  • 108
0
votes
2 answers

Risc-V Assembly - amount of bubbles needed to make the code operational - [Hypothetical]

I want to know why when executing this assembly code on a pipelined RiscV - that does not stall automatically - with forwarding (except for internal register file WB->DEC forwarding) we need to place two NOP commands immediatly after the third…
kal_elk122
  • 143
  • 6
0
votes
0 answers

how to "nop ptr[eax + 0x00]" on C++ _asm inline

i have this code in asm: cmp ecx,46DC0E00 je 1A380021 nop dword ptr [eax+00] mov [edx+00000584],ecx mov [edx+00000584],00000000 jmp game.exe+A42067 mov [edx+00000584],ecx jmp game.exe+A42067 and i have this code on C++: __asm { cmp ecx,…
0
votes
1 answer

How to use NOP sled to bypass ASLR

I'm trying to bypass ASLR with NOP sled. Here's the assembly for vuln(), sorry I don't have the source code: 0804878a : 804878a: 55 push %ebp 804878b: 89 e5 mov %esp,%ebp 804878d: 53 …
null
  • 57
  • 1
  • 7
0
votes
4 answers

firmware _nop() in c#

I am porting part of firmware to a gui written in c#. I found out that nop() is a function that actually does nothing and delays the execution by some number of clock cycles. Lets say if I use nop() it will delay the execution in firmware by two…
Vikyboss
  • 940
  • 2
  • 11
  • 23
0
votes
1 answer

What's the logic behind the noop functions in Wordpress

while browsing Wordpress core I came across a file called noop.php that hosts a bunch of empty functions. /* Noop functions for load-scripts.php and load-styles.php */ /** * @ignore */ function home_url() {} /** * @ignore */ function…
kapreski
  • 761
  • 5
  • 19
0
votes
1 answer

i am trying to using git rebase -i but i am getting a noop error

i have successfully merged my test branch to my master however when i try to use git rebase -i i get an error noop and i cant re order any of my commits this is the result from my git log please ignore the last code line
0
votes
3 answers

How can I add a space between them and keep text same line

how can I add a space between those 2 images and dont allow the text to break on the center of the page? It's for a college project and I've never programmed before. i actually dont know whats going on on this template i have to edit.. i just need…
0
votes
1 answer

Date in Crontab email subject

I have an ubuntu server where I schedule crontab processes like the following. 59 2 * * * : Backup Settings; ~/backup_settings.sh At the conclusion of the process, I will get an email with the subject line "Backup Settings ...". Essentially the…
Spinor8
  • 1,587
  • 4
  • 21
  • 48
0
votes
1 answer

javamail idle stops triggering messagesAdded after a while, thread locked

I'm developing an android app that receives and processes mail messages. The app must be connected to an IMAP server and keep the connection alive, so it can see and process new mail messages instantly (mails contains json data from a mail api…
Raymond Arteaga
  • 4,355
  • 19
  • 35
0
votes
1 answer

How to get the Python interpreter to emit a NOP instruction?

Is there any way to get Python's interpreter to compile any Python code into a NOP instruction? (I'm specifically talking about obtaining bytecode via compiling Python code, not generating it directly.)
user541686
  • 205,094
  • 128
  • 528
  • 886
0
votes
0 answers

JavaScript to perform NOP that takes a long time (milliseconds)

Let's say I am forced to sleep in this barbaric way. I cannot use events (such as setTimeout), it isn't in the constraints of the problem and doing such a thing has already been previously discussed in depth. function sleep(milliseconds) { var…
Ziggy
  • 95
  • 1
  • 5