INT 3
-
Hi!
Gibt es irgendeine Erklärung dafür, das der Interrupt 3 einen eigenen Opcode hat?lg, phreaking
-
Ja, der Code ist kuerzer
So wird dieser Interrupt z.B. oft von Debuggern fuer Breakpointgenerierung benutzt.
-
Den kann man dann auch so schön beim debuggen in jeglichen code reinwerfen ohne angst zu haben was kaputt zu machen, weil jede instruktion mindestens 1 Byte lang sein muss
-
Also, hier mal ein kleiner Auszug aus dem Intel Developer Manual 2:
The INT 3 instruction generates a special one byte opcode (CC) that is intended for calling the
debug exception handler. (This one byte form is valuable because it can be used to replace the
first byte of any instruction with a breakpoint, including other one byte instructions, without
over-writing other code). To further support its function as a debug breakpoint, the interrupt
generated with the CC opcode also differs from the regular software interrupts as follows:
• Interrupt redirection does not happen when in VME mode; the interrupt is handled by a
protected-mode handler.
• The virtual-8086 mode IOPL checks do not occur. The interrupt is taken without faulting at
any IOPL level.
Note that the “normal” 2-byte opcode for INT 3 (CD03) does not have these special features.
Intel and Microsoft assemblers will not generate the CD03 opcode from any mnemonic, but this
opcode can be created by direct numeric code definition or by self-modifying code.
The action of the INT n instruction (including the INTO and INT 3 instructions) is similar to that
of a far call made with the CALL instruction. The primary difference is that with the INT n
instruction, the EFLAGS register is pushed onto the stack before the return address. (The return
address is a far address consisting of the current values of the CS and EIP registers.) Returns
from interrupt procedures are handled with the IRET instruction, which pops the EFLAGS
information and return address from the stack.Heißt das, bei INT3 werden EFlags und RET-Adresse in umgekehrter Reihenfolge gepusht? Wie funktioniert denn dann der Return?
lg, phreaking
-
Eventuell haben dies nur etwas missverständlich geschrieben...da alle Interrupt-Prozeduren mit iret aufhören, wird wohl zwischen int 3 und allen anderen ints kein Unterschied sein.
Ich glaube das mit dem Unterschied bezog sich auf "The action of the INT n instruction (including the INTO and INT 3 instructions) is similar to that of a far call made with the CALL instruction." D.h. ein Int-Call (ob nun int n oder int 3) legt immer noch die EFLAGS aufn Stack und zwar alle Ints gleich. CALLs machen das eben nicht.
-
The action of the INT n instruction (including the INTO and INT 3 instructions) is similar to that
of a far call made with the CALL instruction. The primary difference is that with the INT n
instruction, the EFLAGS register is pushed onto the stack before the return address. (The return
address is a far address consisting of the current values of the CS and EIP registers.) Returns
from interrupt procedures are handled with the IRET instruction, which pops the EFLAGS
information and return address from the stack.Das bezieht sich auf alle INT Funktionen.
Dieser Abschnitt erläutert KEINE Besonderheiten des INT3 sondern nur allgem. Unterschiede zwischen INTs und CALLs, und die daraus resultierenden Unterschiede zw. IRET und RET.
D.h. bei ALLEN INTs (auch INT3) wird erst das EFLAGS reg. gepusht, dann die Rücksprungadresse.mfg
-bg-
-
Aha! Danke, und sorry, aber ich habe wirklich nicht erkannt, dass es sich auf den vorhergehenden Satz bezogen hat...
lg, phreaking