1/** \file
2 *  \brief A simple work stealing library based upon both cilk and wool.
3 */
4
5/*
6 * Copyright (c) 2010, ETH Zurich.
7 * All rights reserved.
8 *
9 * This file is distributed under the terms in the attached LICENSE file.
10 * If you do not find this file, copies can be found by writing to:
11 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
12 */
13
14#include <stdio.h>
15#include <stdlib.h>
16#include <string.h>
17#include <unwind.h>
18#include <barrelfish/barrelfish.h>
19#include <runetype.h>
20
21#define _CTYPE_A    0x00000100L     /* Alpha */
22#define _CTYPE_C    0x00000200L     /* Control */
23#define _CTYPE_D    0x00000400L     /* Digit */
24#define _CTYPE_G    0x00000800L     /* Graph */
25#define _CTYPE_L    0x00001000L     /* Lower */
26#define _CTYPE_P    0x00002000L     /* Punct */
27#define _CTYPE_S    0x00004000L     /* Space */
28#define _CTYPE_U    0x00008000L     /* Upper */
29#define _CTYPE_X    0x00010000L     /* X digit */
30#define _CTYPE_B    0x00020000L     /* Blank */
31#define _CTYPE_R    0x00040000L     /* Print */
32#define _CTYPE_I    0x00080000L     /* Ideogram */
33#define _CTYPE_T    0x00100000L     /* Special */
34#define _CTYPE_Q    0x00200000L     /* Phonogram */
35#define _CTYPE_SW0  0x20000000L     /* 0 width character */
36#define _CTYPE_SW1  0x40000000L     /* 1 width character */
37#define _CTYPE_SW2  0x80000000L     /* 2 width character */
38#define _CTYPE_SW3  0xc0000000L     /* 3 width character */
39#define _CTYPE_SWM  0xe0000000L     /* Mask for screen width data */
40#define _CTYPE_SWS  30          /* Bits to shift to get width */
41
42#include <barrelfish/barrelfish.h>
43
44void bf_unwind_get_eh(uint64_t *eh_frame, uint64_t *eh_frame_size);
45void bf_unwind_get_eh_hdr(uint64_t *eh_frame_hdr, uint64_t *eh_frame_hdr_size);
46
47void bf_unwind_get_eh(uint64_t *eh_frame, uint64_t *eh_frame_size)
48{
49    lvaddr_t eh;
50    size_t eh_size;
51
52    disp_get_eh_frame(&eh, &eh_size);
53
54    if (eh_frame) {
55        *eh_frame = eh;
56    }
57    if (eh_frame_size) {
58        *eh_frame_size = eh_size;
59    }
60}
61
62void bf_unwind_get_eh_hdr(uint64_t *eh_frame_hdr, uint64_t *eh_frame_hdr_size)
63{
64    lvaddr_t eh;
65    size_t eh_size;
66
67    disp_get_eh_frame_hdr(&eh, &eh_size);
68
69    if (eh_frame_hdr) {
70        *eh_frame_hdr = eh;
71    }
72    if (eh_frame_hdr_size) {
73        *eh_frame_hdr_size = eh_size;
74    }
75}
76