Skip to content

Commit

Permalink
x86_64: allocate signal trampoline in thread user space
Browse files Browse the repository at this point in the history
  • Loading branch information
jewelcodes committed Nov 26, 2024
1 parent f756686 commit 2eae8de
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/platform/x86_64/ipc/signal.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* lux - a lightweight unix-like operating system
* Omar Elghoul, 2024
*
* Platform-Specific Code for x86_64
*/

#include <stdlib.h>
#include <string.h>
#include <platform/platform.h>
#include <platform/context.h>
#include <kernel/signal.h>
#include <kernel/sched.h>

extern size_t sigstubSize;
extern uint8_t sigstub[];

/* platformSignalSetup(): sets up the signal trampoline code in a user process
* params: t - thread structure
* returns: zero on success
*/

int platformSignalSetup(Thread *t) {
void *trampoline = uxmalloc(sigstubSize);
if(!trampoline) return -1;

memcpy(trampoline, sigstub, sigstubSize);
t->signalTrampoline = (uintptr_t) trampoline;
return 0;
}

0 comments on commit 2eae8de

Please sign in to comment.