1 /**
2  * \file
3  * \brief  Low-level kernel debugger functions.
4  */
5 #pragma once
6 
7 #include <l4/sys/ipc.h>
8 
9 L4_INLINE l4_msgtag_t
l4_invoke_debugger(l4_cap_idx_t obj,l4_msgtag_t tag,l4_utcb_t * utcb)10 l4_invoke_debugger(l4_cap_idx_t obj, l4_msgtag_t tag, l4_utcb_t *utcb) L4_NOTHROW
11 {
12   l4_msgtag_t t2;
13   unsigned const words = l4_msgtag_words(tag);
14   l4_msg_regs_t *mr = l4_utcb_mr_u(utcb);
15 
16   if (l4_is_invalid_cap(obj))
17     return l4_msgtag(-L4_EINVAL, 0, 0, 0);
18 
19   if (words + 2 > L4_UTCB_GENERIC_DATA_SIZE)
20     return l4_msgtag(-L4_EMSGTOOLONG, 0, 0, 0);
21 
22   mr->mr[0] += 0x100;
23   mr->mr[words]     = L4_ITEM_MAP;
24   mr->mr[words + 1] = l4_obj_fpage(obj, 0, L4_CAP_FPAGE_RWS).raw;
25   t2 = l4_msgtag(L4_PROTO_DEBUGGER, words, 1, l4_msgtag_flags(tag));
26 
27   return l4_ipc_call(L4_BASE_DEBUGGER_CAP, utcb, t2, L4_IPC_NEVER);
28 }
29 
30