Skip to content

Commit ee7491e

Browse files
authored
Add missing generated test program files. (#4637)
1 parent ab51ca3 commit ee7491e

File tree

3 files changed

+1175
-0
lines changed

3 files changed

+1175
-0
lines changed
Lines changed: 360 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,360 @@
1+
// Copyright (c) eBPF for Windows contributors
2+
// SPDX-License-Identifier: MIT
3+
4+
// Do not alter this generated file.
5+
// This file was generated from map_synchronized_update.o
6+
7+
#include "bpf2c.h"
8+
9+
#include <stdio.h>
10+
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
11+
#include <windows.h>
12+
13+
#define metadata_table map_synchronized_update##_metadata_table
14+
extern metadata_table_t metadata_table;
15+
16+
bool APIENTRY
17+
DllMain(_In_ HMODULE hModule, unsigned int ul_reason_for_call, _In_ void* lpReserved)
18+
{
19+
UNREFERENCED_PARAMETER(hModule);
20+
UNREFERENCED_PARAMETER(lpReserved);
21+
switch (ul_reason_for_call) {
22+
case DLL_PROCESS_ATTACH:
23+
case DLL_THREAD_ATTACH:
24+
case DLL_THREAD_DETACH:
25+
case DLL_PROCESS_DETACH:
26+
break;
27+
}
28+
return TRUE;
29+
}
30+
31+
__declspec(dllexport) metadata_table_t*
32+
get_metadata_table()
33+
{
34+
return &metadata_table;
35+
}
36+
37+
#include "bpf2c.h"
38+
39+
static void
40+
_get_hash(_Outptr_result_buffer_maybenull_(*size) const uint8_t** hash, _Out_ size_t* size)
41+
{
42+
*hash = NULL;
43+
*size = 0;
44+
}
45+
46+
#pragma data_seg(push, "maps")
47+
static map_entry_t _maps[] = {
48+
{
49+
{0, 0},
50+
{
51+
1, // Current Version.
52+
80, // Struct size up to the last field.
53+
80, // Total struct size including padding.
54+
},
55+
{
56+
BPF_MAP_TYPE_HASH, // Type of map.
57+
4, // Size in bytes of a map key.
58+
4, // Size in bytes of a map value.
59+
1, // Maximum number of entries allowed in the map.
60+
0, // Inner map index.
61+
LIBBPF_PIN_NONE, // Pinning type for the map.
62+
8, // Identifier for a map template.
63+
0, // The id of the inner map template.
64+
},
65+
"map_1"},
66+
{
67+
{0, 0},
68+
{
69+
1, // Current Version.
70+
80, // Struct size up to the last field.
71+
80, // Total struct size including padding.
72+
},
73+
{
74+
BPF_MAP_TYPE_ARRAY, // Type of map.
75+
4, // Size in bytes of a map key.
76+
4, // Size in bytes of a map value.
77+
1, // Maximum number of entries allowed in the map.
78+
0, // Inner map index.
79+
LIBBPF_PIN_NONE, // Pinning type for the map.
80+
12, // Identifier for a map template.
81+
0, // The id of the inner map template.
82+
},
83+
"failure_stats"},
84+
{
85+
{0, 0},
86+
{
87+
1, // Current Version.
88+
80, // Struct size up to the last field.
89+
80, // Total struct size including padding.
90+
},
91+
{
92+
BPF_MAP_TYPE_HASH, // Type of map.
93+
4, // Size in bytes of a map key.
94+
4, // Size in bytes of a map value.
95+
1, // Maximum number of entries allowed in the map.
96+
0, // Inner map index.
97+
LIBBPF_PIN_NONE, // Pinning type for the map.
98+
14, // Identifier for a map template.
99+
0, // The id of the inner map template.
100+
},
101+
"map_2"},
102+
};
103+
#pragma data_seg(pop)
104+
105+
static void
106+
_get_maps(_Outptr_result_buffer_maybenull_(*count) map_entry_t** maps, _Out_ size_t* count)
107+
{
108+
*maps = _maps;
109+
*count = 3;
110+
}
111+
112+
static void
113+
_get_global_variable_sections(
114+
_Outptr_result_buffer_maybenull_(*count) global_variable_section_info_t** global_variable_sections,
115+
_Out_ size_t* count)
116+
{
117+
*global_variable_sections = NULL;
118+
*count = 0;
119+
}
120+
121+
static helper_function_entry_t lookup_helpers[] = {
122+
{
123+
{1, 40, 40}, // Version header.
124+
1,
125+
"helper_id_1",
126+
},
127+
};
128+
129+
static GUID lookup_program_type_guid = {0xf788ef4a, 0x207d, 0x4dc3, {0x85, 0xcf, 0x0f, 0x2e, 0xa1, 0x07, 0x21, 0x3c}};
130+
static GUID lookup_attach_type_guid = {0xf788ef4b, 0x207d, 0x4dc3, {0x85, 0xcf, 0x0f, 0x2e, 0xa1, 0x07, 0x21, 0x3c}};
131+
static uint16_t lookup_maps[] = {
132+
0,
133+
1,
134+
2,
135+
};
136+
137+
#pragma code_seg(push, "sample~1")
138+
static uint64_t
139+
lookup(void* context, const program_runtime_context_t* runtime_context)
140+
#line 42 "sample/undocked/map_synchronized_update.c"
141+
{
142+
#line 42 "sample/undocked/map_synchronized_update.c"
143+
// Prologue.
144+
#line 42 "sample/undocked/map_synchronized_update.c"
145+
uint64_t stack[(UBPF_STACK_SIZE + 7) / 8];
146+
#line 42 "sample/undocked/map_synchronized_update.c"
147+
register uint64_t r0 = 0;
148+
#line 42 "sample/undocked/map_synchronized_update.c"
149+
register uint64_t r1 = 0;
150+
#line 42 "sample/undocked/map_synchronized_update.c"
151+
register uint64_t r2 = 0;
152+
#line 42 "sample/undocked/map_synchronized_update.c"
153+
register uint64_t r3 = 0;
154+
#line 42 "sample/undocked/map_synchronized_update.c"
155+
register uint64_t r4 = 0;
156+
#line 42 "sample/undocked/map_synchronized_update.c"
157+
register uint64_t r5 = 0;
158+
#line 42 "sample/undocked/map_synchronized_update.c"
159+
register uint64_t r6 = 0;
160+
#line 42 "sample/undocked/map_synchronized_update.c"
161+
register uint64_t r10 = 0;
162+
163+
#line 42 "sample/undocked/map_synchronized_update.c"
164+
r1 = (uintptr_t)context;
165+
#line 42 "sample/undocked/map_synchronized_update.c"
166+
r10 = (uintptr_t)((uint8_t*)stack + sizeof(stack));
167+
168+
// EBPF_OP_MOV64_IMM pc=0 dst=r6 src=r0 offset=0 imm=0
169+
#line 42 "sample/undocked/map_synchronized_update.c"
170+
r6 = IMMEDIATE(0);
171+
// EBPF_OP_STXW pc=1 dst=r10 src=r6 offset=-4 imm=0
172+
#line 44 "sample/undocked/map_synchronized_update.c"
173+
WRITE_ONCE_32(r10, (uint32_t)r6, OFFSET(-4));
174+
// EBPF_OP_MOV64_REG pc=2 dst=r2 src=r10 offset=0 imm=0
175+
#line 44 "sample/undocked/map_synchronized_update.c"
176+
r2 = r10;
177+
// EBPF_OP_ADD64_IMM pc=3 dst=r2 src=r0 offset=0 imm=-4
178+
#line 44 "sample/undocked/map_synchronized_update.c"
179+
r2 += IMMEDIATE(-4);
180+
// EBPF_OP_LDDW pc=4 dst=r1 src=r1 offset=0 imm=1
181+
#line 49 "sample/undocked/map_synchronized_update.c"
182+
r1 = POINTER(runtime_context->map_data[0].address);
183+
// EBPF_OP_CALL pc=6 dst=r0 src=r0 offset=0 imm=1
184+
#line 49 "sample/undocked/map_synchronized_update.c"
185+
r0 = runtime_context->helper_data[0].address(r1, r2, r3, r4, r5, context);
186+
#line 49 "sample/undocked/map_synchronized_update.c"
187+
if ((runtime_context->helper_data[0].tail_call) && (r0 == 0)) {
188+
#line 49 "sample/undocked/map_synchronized_update.c"
189+
return 0;
190+
#line 49 "sample/undocked/map_synchronized_update.c"
191+
}
192+
// EBPF_OP_JNE_IMM pc=7 dst=r0 src=r0 offset=9 imm=0
193+
#line 50 "sample/undocked/map_synchronized_update.c"
194+
if (r0 != IMMEDIATE(0)) {
195+
#line 50 "sample/undocked/map_synchronized_update.c"
196+
goto label_1;
197+
#line 50 "sample/undocked/map_synchronized_update.c"
198+
}
199+
// EBPF_OP_MOV64_IMM pc=8 dst=r1 src=r0 offset=0 imm=0
200+
#line 50 "sample/undocked/map_synchronized_update.c"
201+
r1 = IMMEDIATE(0);
202+
// EBPF_OP_STXW pc=9 dst=r10 src=r1 offset=-8 imm=0
203+
#line 52 "sample/undocked/map_synchronized_update.c"
204+
WRITE_ONCE_32(r10, (uint32_t)r1, OFFSET(-8));
205+
// EBPF_OP_MOV64_REG pc=10 dst=r2 src=r10 offset=0 imm=0
206+
#line 52 "sample/undocked/map_synchronized_update.c"
207+
r2 = r10;
208+
// EBPF_OP_ADD64_IMM pc=11 dst=r2 src=r0 offset=0 imm=-8
209+
#line 52 "sample/undocked/map_synchronized_update.c"
210+
r2 += IMMEDIATE(-8);
211+
// EBPF_OP_LDDW pc=12 dst=r1 src=r1 offset=0 imm=2
212+
#line 53 "sample/undocked/map_synchronized_update.c"
213+
r1 = POINTER(runtime_context->map_data[1].address);
214+
// EBPF_OP_CALL pc=14 dst=r0 src=r0 offset=0 imm=1
215+
#line 53 "sample/undocked/map_synchronized_update.c"
216+
r0 = runtime_context->helper_data[0].address(r1, r2, r3, r4, r5, context);
217+
#line 53 "sample/undocked/map_synchronized_update.c"
218+
if ((runtime_context->helper_data[0].tail_call) && (r0 == 0)) {
219+
#line 53 "sample/undocked/map_synchronized_update.c"
220+
return 0;
221+
#line 53 "sample/undocked/map_synchronized_update.c"
222+
}
223+
// EBPF_OP_JEQ_IMM pc=15 dst=r0 src=r0 offset=16 imm=0
224+
#line 54 "sample/undocked/map_synchronized_update.c"
225+
if (r0 == IMMEDIATE(0)) {
226+
#line 54 "sample/undocked/map_synchronized_update.c"
227+
goto label_3;
228+
#line 54 "sample/undocked/map_synchronized_update.c"
229+
}
230+
// EBPF_OP_JA pc=16 dst=r0 src=r0 offset=13 imm=0
231+
#line 54 "sample/undocked/map_synchronized_update.c"
232+
goto label_2;
233+
label_1:
234+
// EBPF_OP_LDDW pc=17 dst=r1 src=r1 offset=0 imm=3
235+
#line 61 "sample/undocked/map_synchronized_update.c"
236+
r1 = POINTER(runtime_context->map_data[2].address);
237+
// EBPF_OP_MOV64_REG pc=19 dst=r2 src=r0 offset=0 imm=0
238+
#line 61 "sample/undocked/map_synchronized_update.c"
239+
r2 = r0;
240+
// EBPF_OP_CALL pc=20 dst=r0 src=r0 offset=0 imm=1
241+
#line 61 "sample/undocked/map_synchronized_update.c"
242+
r0 = runtime_context->helper_data[0].address(r1, r2, r3, r4, r5, context);
243+
#line 61 "sample/undocked/map_synchronized_update.c"
244+
if ((runtime_context->helper_data[0].tail_call) && (r0 == 0)) {
245+
#line 61 "sample/undocked/map_synchronized_update.c"
246+
return 0;
247+
#line 61 "sample/undocked/map_synchronized_update.c"
248+
}
249+
// EBPF_OP_JNE_IMM pc=21 dst=r0 src=r0 offset=11 imm=0
250+
#line 62 "sample/undocked/map_synchronized_update.c"
251+
if (r0 != IMMEDIATE(0)) {
252+
#line 62 "sample/undocked/map_synchronized_update.c"
253+
goto label_4;
254+
#line 62 "sample/undocked/map_synchronized_update.c"
255+
}
256+
// EBPF_OP_MOV64_IMM pc=22 dst=r1 src=r0 offset=0 imm=0
257+
#line 62 "sample/undocked/map_synchronized_update.c"
258+
r1 = IMMEDIATE(0);
259+
// EBPF_OP_STXW pc=23 dst=r10 src=r1 offset=-12 imm=0
260+
#line 64 "sample/undocked/map_synchronized_update.c"
261+
WRITE_ONCE_32(r10, (uint32_t)r1, OFFSET(-12));
262+
// EBPF_OP_MOV64_REG pc=24 dst=r2 src=r10 offset=0 imm=0
263+
#line 64 "sample/undocked/map_synchronized_update.c"
264+
r2 = r10;
265+
// EBPF_OP_ADD64_IMM pc=25 dst=r2 src=r0 offset=0 imm=-12
266+
#line 64 "sample/undocked/map_synchronized_update.c"
267+
r2 += IMMEDIATE(-12);
268+
// EBPF_OP_LDDW pc=26 dst=r1 src=r1 offset=0 imm=2
269+
#line 65 "sample/undocked/map_synchronized_update.c"
270+
r1 = POINTER(runtime_context->map_data[1].address);
271+
// EBPF_OP_CALL pc=28 dst=r0 src=r0 offset=0 imm=1
272+
#line 65 "sample/undocked/map_synchronized_update.c"
273+
r0 = runtime_context->helper_data[0].address(r1, r2, r3, r4, r5, context);
274+
#line 65 "sample/undocked/map_synchronized_update.c"
275+
if ((runtime_context->helper_data[0].tail_call) && (r0 == 0)) {
276+
#line 65 "sample/undocked/map_synchronized_update.c"
277+
return 0;
278+
#line 65 "sample/undocked/map_synchronized_update.c"
279+
}
280+
// EBPF_OP_JEQ_IMM pc=29 dst=r0 src=r0 offset=2 imm=0
281+
#line 66 "sample/undocked/map_synchronized_update.c"
282+
if (r0 == IMMEDIATE(0)) {
283+
#line 66 "sample/undocked/map_synchronized_update.c"
284+
goto label_3;
285+
#line 66 "sample/undocked/map_synchronized_update.c"
286+
}
287+
label_2:
288+
// EBPF_OP_MOV64_IMM pc=30 dst=r1 src=r0 offset=0 imm=1
289+
#line 66 "sample/undocked/map_synchronized_update.c"
290+
r1 = IMMEDIATE(1);
291+
// EBPF_OP_ATOMIC_ADD pc=31 dst=r0 src=r1 offset=0 imm=0
292+
#line 66 "sample/undocked/map_synchronized_update.c"
293+
InterlockedExchangeAdd((volatile long*)(uintptr_t)(r0 + OFFSET(0)), (uint32_t)r1);
294+
label_3:
295+
// EBPF_OP_MOV64_IMM pc=32 dst=r6 src=r0 offset=0 imm=1
296+
#line 66 "sample/undocked/map_synchronized_update.c"
297+
r6 = IMMEDIATE(1);
298+
label_4:
299+
// EBPF_OP_MOV64_REG pc=33 dst=r0 src=r6 offset=0 imm=0
300+
#line 73 "sample/undocked/map_synchronized_update.c"
301+
r0 = r6;
302+
// EBPF_OP_EXIT pc=34 dst=r0 src=r0 offset=0 imm=0
303+
#line 73 "sample/undocked/map_synchronized_update.c"
304+
return r0;
305+
#line 42 "sample/undocked/map_synchronized_update.c"
306+
}
307+
#pragma code_seg(pop)
308+
#line __LINE__ __FILE__
309+
310+
#pragma data_seg(push, "programs")
311+
static program_entry_t _programs[] = {
312+
{
313+
0,
314+
{1, 144, 144}, // Version header.
315+
lookup,
316+
"sample~1",
317+
"sample_ext",
318+
"lookup",
319+
lookup_maps,
320+
3,
321+
lookup_helpers,
322+
1,
323+
35,
324+
&lookup_program_type_guid,
325+
&lookup_attach_type_guid,
326+
},
327+
};
328+
#pragma data_seg(pop)
329+
330+
static void
331+
_get_programs(_Outptr_result_buffer_(*count) program_entry_t** programs, _Out_ size_t* count)
332+
{
333+
*programs = _programs;
334+
*count = 1;
335+
}
336+
337+
static void
338+
_get_version(_Out_ bpf2c_version_t* version)
339+
{
340+
version->major = 0;
341+
version->minor = 22;
342+
version->revision = 0;
343+
}
344+
345+
static void
346+
_get_map_initial_values(_Outptr_result_buffer_(*count) map_initial_values_t** map_initial_values, _Out_ size_t* count)
347+
{
348+
*map_initial_values = NULL;
349+
*count = 0;
350+
}
351+
352+
metadata_table_t map_synchronized_update_metadata_table = {
353+
sizeof(metadata_table_t),
354+
_get_programs,
355+
_get_maps,
356+
_get_hash,
357+
_get_version,
358+
_get_map_initial_values,
359+
_get_global_variable_sections,
360+
};

0 commit comments

Comments
 (0)