btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / system / kernel / arch / x86 / 64 / signals.cpp
blob06d41ac6b2a42a36750a76c0a217c11f91d8c40f
1 /*
2 * Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
3 * Distributed under the terms of the MIT License.
4 */
7 #include "x86_signals.h"
9 #include <string.h>
11 #include <KernelExport.h>
13 #include <commpage.h>
14 #include <cpu.h>
15 #include <elf.h>
16 #include <smp.h>
19 extern "C" void x86_64_user_signal_handler(void);
20 extern int x86_64_user_signal_handler_end;
23 void
24 x86_initialize_commpage_signal_handler()
26 void* handlerCode = (void*)&x86_64_user_signal_handler;
27 void* handlerCodeEnd = &x86_64_user_signal_handler_end;
29 // Copy the signal handler code to the commpage.
30 size_t len = (size_t)((addr_t)handlerCodeEnd - (addr_t)handlerCode);
31 addr_t position = fill_commpage_entry(COMMPAGE_ENTRY_X86_SIGNAL_HANDLER,
32 handlerCode, len);
34 // Add symbol to the commpage image.
35 image_id image = get_commpage_image();
36 elf_add_memory_image_symbol(image, "commpage_signal_handler", position,
37 len, B_SYMBOL_TYPE_TEXT);