L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
obj_info.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023 Kernkonzept GmbH.
3 * Author(s): Frank Mehnert <frank.mehnert@kernkonzept.com>
4 *
5 * License: see LICENSE.spdx (in this directory or the directories above)
6 */
7
14
15#pragma once
16
17#include <l4/sys/compiler.h>
18#include <l4/sys/debugger.h>
19#include <l4/sys/l4int.h>
20
21struct L4_kobj_info
22{
23 // Type_mapping: See Jdb_mapdb::info_obj_mapping().
24 struct Mapping
25 {
26 enum { Type = 0 };
27 l4_uint64_t mapping_ptr;
28 char space_name[16];
29 l4_uint32_t cap_idx;
30 l4_uint16_t entry_rights;
31 l4_uint16_t entry_flags;
32 l4_uint64_t entry_ptr;
33 };
34
35 // Type_thread: See Jdb_tcb::info_kobject().
36 struct Thread
37 {
38 enum { Type = 1 };
39 bool is_kernel;
40 bool is_current;
41 bool in_ready_list;
42 bool is_kernel_task;
43 l4_uint32_t home_cpu;
44 l4_uint32_t current_cpu;
45 l4_int64_t ref_cnt;
46 l4_uint64_t space_id;
47 };
48
49 // Type_space: See Jdb_space::info_kobject().
50 struct Space
51 {
52 enum { Type = 2 };
53 bool is_kernel;
54 l4_int64_t ref_cnt;
55 };
56
57 // Type_vm: See Jdb_vm::info_kobject().
58 struct Vm
59 {
60 enum { Type = 3 };
61 l4_uint64_t utcb;
62 l4_uint64_t pc;
63 };
64
65 // Type_ipc_gate: See Jdb_ipc_gate::info_kobject().
66 struct Ipc_gate
67 {
68 enum { Type = 4 };
69 l4_uint64_t label;
70 l4_uint64_t thread_id;
71 };
72
73 // Type_irq: See Jdb_kobject_irq::info_kobject().
74 struct Irq_sender
75 {
76 enum { Type = 5 };
77 char chip_type[10];
78 l4_uint16_t flags;
79 l4_uint32_t pin;
80 l4_uint64_t label;
81 l4_uint64_t target_id;
82 l4_int64_t queued;
83 };
84
85 // Type_irq: See Jdb_kobject_irq::info_kobject().
86 struct Irq_semaphore
87 {
88 enum { Type = 6 };
89 char chip_type[10];
90 l4_uint16_t flags;
91 l4_uint32_t pin;
92 l4_uint64_t sender_id;
93 l4_uint64_t target_id;
94 l4_int64_t queued;
95 };
96
97 // Type_factory: See Jdb_factory::info_kobject().
98 struct Factory
99 {
100 enum { Type = 7 };
101 l4_uint64_t current;
102 l4_uint64_t limit;
103 };
104
105 struct Jdb { enum { Type = 8 }; };
106 struct Scheduler { enum { Type = 9 }; };
107 struct Vlog { enum { Type = 10 }; };
108 struct Pfc { enum { Type = 11 }; };
109 struct Dmar_space { enum { Type = 12 }; };
110 struct Iommu { enum { Type = 13 }; };
111 struct Smmu { enum { Type = 14 }; };
112
113 l4_uint64_t type:5;
114 l4_uint64_t id:59;
115 l4_uint64_t mapping_ptr;
116 l4_uint64_t ref_cnt;
117 union
118 {
119 Thread thread;
120 Space space;
121 Vm vm;
122 Ipc_gate ipc_gate;
123 Irq_sender irq_sender;
124 Irq_semaphore irq_semaphore;
125 Factory factory;
126 Mapping mapping;
127 l4_uint64_t raw[5];
128 };
129};
130
131static_assert(sizeof(L4_kobj_info) == 64, "Size of Jobj_info");
132
153 l4_size_t ku_mem_size, l4_umword_t skip,
154 l4_umword_t *result_cnt, l4_umword_t *result_all)
156
158l4_debugger_query_obj_infos_u(l4_cap_idx_t cap, l4_addr_t ku_mem_addr,
159 l4_size_t ku_mem_size, l4_umword_t skip,
160 l4_umword_t *result_cnt, l4_umword_t *result_all,
161 l4_utcb_t *utcb) L4_NOTHROW
162{
164 l4_utcb_mr()->mr[1] = ku_mem_addr;
165 l4_utcb_mr()->mr[2] = ku_mem_size;
166 l4_utcb_mr()->mr[3] = skip;
167
168 l4_msgtag_t tag = l4_invoke_debugger(cap, l4_msgtag(0, 4, 0, 0), utcb);
169
170 *result_cnt = l4_utcb_mr()->mr[0];
171 *result_all = l4_utcb_mr()->mr[1];
172
173 return tag;
174}
175
178 l4_size_t ku_mem_size, l4_umword_t skip,
179 l4_umword_t *result_cnt, l4_umword_t *result_all)
181{
182 return l4_debugger_query_obj_infos_u(cap, ku_mem_addr, ku_mem_size, skip,
183 result_cnt, result_all, l4_utcb());
184}
L4 compiler related defines.
Debugger related definitions.
@ L4_DEBUGGER_OBJ_INFO_OP
Query information about all kernel objects.
Definition debugger.h:256
unsigned int l4_size_t
Unsigned size type.
Definition l4int.h:24
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
unsigned long l4_addr_t
Address type.
Definition l4int.h:34
signed long long l4_int64_t
Signed 64bit value.
Definition l4int.h:30
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition l4int.h:29
unsigned short int l4_uint16_t
Unsigned 16bit value.
Definition l4int.h:27
unsigned long long l4_uint64_t
Unsigned 64bit value.
Definition l4int.h:31
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:336
l4_msgtag_t l4_msgtag(long label, unsigned words, unsigned items, unsigned flags) L4_NOTHROW
Create a message tag from the specified values.
Definition types.h:405
l4_msg_regs_t * l4_utcb_mr(void) L4_NOTHROW L4_PURE
Get the message-register block of a UTCB.
Definition utcb.h:358
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:56
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition utcb.h:346
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:161
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
Fixed sized integer types, generic version.
l4_msgtag_t l4_debugger_query_obj_infos(l4_cap_idx_t cap, l4_addr_t ku_mem_addr, l4_size_t ku_mem_size, l4_umword_t skip, l4_umword_t *result_cnt, l4_umword_t *result_all) L4_NOTHROW
Retrieve information from the kernel about all objects in the mapping database and write data to the ...
Definition obj_info.h:177
Message tag data structure.
Definition types.h:154
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition utcb.h:69