L4Re Operating System Framework
Interface and Usage Documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
15#pragma once
16
17#include <l4/sys/compiler.h>
18#include <l4/sys/l4int.h>
19
20struct L4_kobj_info
21{
22 // Type_mapping: See Jdb_mapdb::info_obj_mapping().
23 struct Mapping
24 {
25 enum { Type = 0 };
26 l4_uint64_t mapping_ptr;
27 char space_name[16];
28 l4_uint32_t cap_idx;
29 l4_uint16_t entry_rights;
30 l4_uint16_t entry_flags;
31 l4_uint64_t entry_ptr;
32 };
33
34 // Type_thread: See Jdb_tcb::info_kobject().
35 struct Thread
36 {
37 enum { Type = 1 };
38 bool is_kernel;
39 bool is_current;
40 bool in_ready_list;
41 bool is_kernel_task;
42 l4_uint32_t home_cpu;
43 l4_uint32_t current_cpu;
44 l4_int64_t ref_cnt;
45 l4_uint64_t space_id;
46 };
47
48 // Type_space: See Jdb_space::info_kobject().
49 struct Space
50 {
51 enum { Type = 2 };
52 bool is_kernel;
53 l4_int64_t ref_cnt;
54 };
55
56 // Type_vm: See Jdb_vm::info_kobject().
57 struct Vm
58 {
59 enum { Type = 3 };
60 l4_uint64_t utcb;
61 l4_uint64_t pc;
62 };
63
64 // Type_ipc_gate: See Jdb_ipc_gate::info_kobject().
65 struct Ipc_gate
66 {
67 enum { Type = 4 };
68 l4_uint64_t label;
69 l4_uint64_t thread_id;
70 };
71
72 // Type_irq: See Jdb_kobject_irq::info_kobject().
73 struct Irq_sender
74 {
75 enum { Type = 5 };
76 char chip_type[10];
77 l4_uint16_t flags;
78 l4_uint32_t pin;
79 l4_uint64_t label;
80 l4_uint64_t target_id;
81 l4_int64_t queued;
82 };
83
84 // Type_irq: See Jdb_kobject_irq::info_kobject().
85 struct Irq_semaphore
86 {
87 enum { Type = 6 };
88 char chip_type[10];
89 l4_uint16_t flags;
90 l4_uint32_t pin;
91 l4_uint64_t sender_id;
92 l4_uint64_t target_id;
93 l4_int64_t queued;
94 };
95
96 // Type_factory: See Jdb_factory::info_kobject().
97 struct Factory
98 {
99 enum { Type = 7 };
100 l4_uint64_t current;
101 l4_uint64_t limit;
102 };
103
104 struct Jdb { enum { Type = 8 }; };
105 struct Scheduler { enum { Type = 9 }; };
106 struct Vlog { enum { Type = 10 }; };
107 struct Pfc { enum { Type = 11 }; };
108 struct Dmar_space { enum { Type = 12 }; };
109 struct Iommu { enum { Type = 13 }; };
110 struct Smmu { enum { Type = 14 }; };
111
112 l4_uint64_t type:5;
113 l4_uint64_t id:59;
114 l4_uint64_t mapping_ptr;
115 l4_uint64_t ref_cnt;
116 union
117 {
118 Thread thread;
119 Space space;
120 Vm vm;
121 Ipc_gate ipc_gate;
122 Irq_sender irq_sender;
123 Irq_semaphore irq_semaphore;
124 Factory factory;
125 Mapping mapping;
126 l4_uint64_t raw[5];
127 };
128};
129
130static_assert(sizeof(L4_kobj_info) == 64, "Size of Jobj_info");
131
152 l4_size_t ku_mem_size, l4_umword_t skip,
153 l4_umword_t *result_cnt, l4_umword_t *result_all)
155
157l4_debugger_query_obj_infos_u(l4_cap_idx_t cap, l4_addr_t ku_mem_addr,
158 l4_size_t ku_mem_size, l4_umword_t skip,
159 l4_umword_t *result_cnt, l4_umword_t *result_all,
160 l4_utcb_t *utcb) L4_NOTHROW
161{
162 l4_utcb_mr()->mr[0] = 16;
163 l4_utcb_mr()->mr[1] = ku_mem_addr;
164 l4_utcb_mr()->mr[2] = ku_mem_size;
165 l4_utcb_mr()->mr[3] = skip;
166
167 l4_msgtag_t tag = l4_invoke_debugger(cap, l4_msgtag(0, 4, 0, 0), utcb);
168
169 *result_cnt = l4_utcb_mr()->mr[0];
170 *result_all = l4_utcb_mr()->mr[1];
171
172 return tag;
173}
174
177 l4_size_t ku_mem_size, l4_umword_t skip,
178 l4_umword_t *result_cnt, l4_umword_t *result_all)
180{
181 return l4_debugger_query_obj_infos_u(cap, ku_mem_addr, ku_mem_size, skip,
182 result_cnt, result_all, l4_utcb());
183}
L4 compiler related defines.
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:335
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:404
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:159
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
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:176
Message tag data structure.
Definition types.h:153
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition utcb.h:69