mirror of
https://github.com/clearlinux/graphene.git
synced 2026-09-03 12:21:37 +00:00
Change log (most important only):
- unify CPU context structures - now we have only one version -
`PAL_CONTEXT` - which is shared between LibOS and PALs and it should
depend only on the host architecture (not OS),
- syscalls emulation changed:
- dedicated LibOS stack is now used for syscalls emulation,
- removed one indirection level in syscalls table - now it stores
`shim_do_*` functions directly,
- signal handling - completely rewritten:
- all signal queues use proper locking schemes now,
- signals are handled *only* when returning to the user app from LibOS
or PAL,
- nested signals are now possible,
- the app is allowed to jump out of signal handler with the same
sematics as on normal Linux,
- signal altstack is now fully supported,
- syscall restarting is now supported,
- doing a backtrace from the signal handler works properly,
- disallow injecting host-level signals, with one exception, see
`sys.enable_sigterm_injection` manifest option for more details.
35 lines
689 B
C
35 lines
689 B
C
#include <stdbool.h>
|
|
|
|
#include "pal.h"
|
|
#include "pal_debug.h"
|
|
|
|
int count = 0;
|
|
int i = 0;
|
|
|
|
static void handler(bool is_in_pal, PAL_NUM arg, PAL_CONTEXT* context) {
|
|
__UNUSED(is_in_pal);
|
|
|
|
pal_printf("failure in the handler: 0x%08lx\n", arg);
|
|
count++;
|
|
|
|
if (count == 30)
|
|
DkProcessExit(0);
|
|
}
|
|
|
|
int main(void) {
|
|
pal_printf("Enter Main Thread\n");
|
|
|
|
DkSetExceptionHandler(handler, PAL_EVENT_ARITHMETIC_ERROR);
|
|
|
|
__asm__ volatile (
|
|
"movq $1, %%rax\n"
|
|
"cqo\n"
|
|
"movq $0, %%rbx\n"
|
|
"divq %%rbx\n"
|
|
"nop\n"
|
|
::: "rax", "rbx", "rdx", "cc");
|
|
|
|
pal_printf("Leave Main Thread\n");
|
|
return 0;
|
|
}
|