Reputation: 67
I'm trying to port a project from Windows to Linux. I host the code in the following repo: Nspire Emu. I was able to fix some compilation errors but a lot of functions need to be reimplemented and there are some parts I'm not able understand.
frame
variable type definition:
typedef struct { void *prev, *function; } os_exception_frame_t;
Piece of inline assemble I don't understand:
asm ("movl %%fs:(%1), %0" : "=r" (frame->prev) : "r" (0));
asm ("movl %0, %%fs:(%1)" : : "r" (frame), "r" (0));
I would really appreciate if anyone would help me understand the previous code. Thanks in advance.
Upvotes: 0
Views: 126
Reputation: 126203
This inline asm is popping a windows exception handler frame from the structured exception handler stack. Linux doesn't use structured exception handlers, so this code needs to be removed for linux and replaced by something completely different that does the same thing. What that is depends on what the code is trying to achieve by manipulating the SEH stack. The equivalent in Linux likely involves registering some signal handlers.
Upvotes: 2