VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

Apparently, you can JMP to a call gate, but it doesn't save any return information? It's safe to do with task switches(which can't iret to the previous task because it's a JMP, but when using JMP to call a function, why would you want to do that? Unless you have far return data on the stack already?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 4, by peterferrie

User metadata
Rank Oldbie
Rank
Oldbie

Yes, if you have pushed the return address, perhaps as a tail-call optimisation (i.e. call to a function which links to a leaf function), then you can jump through the gate to save the size of the return instruction.

Reply 2 of 4, by superfury

User metadata
Rank l33t++
Rank
l33t++

And if you simply execute a JMP instead of a required CALL from a main(empty stack) routine? That will go wrong on RETF?

Also, JMP doesn't change CPL, while CALL does?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 4 of 4, by superfury

User metadata
Rank l33t++
Rank
l33t++

Just improved privilege levels for MAX(CPL,RPL)<=DPL requirement to apply to non-code segments as well(as wrll as removing the JMP specific check(might need reimplementing it on call gates). Might even remove that specific part altogether because it's already handled further upwards.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io