@@ -86,7 +86,7 @@ def handle_vmlinux_struct_field(
8686 globvar_ir , field_data = self .get_field_type (
8787 python_type .__name__ , field_name
8888 )
89- builder .function .args [0 ].type = ir .PointerType (ir .IntType (8 ))
89+ builder .function .args [0 ].type = ir .PointerType (ir .IntType (64 ))
9090 print (builder .function .args [0 ])
9191 field_ptr = self .load_ctx_field (builder , builder .function .args [0 ], globvar_ir )
9292 print (field_ptr )
@@ -113,18 +113,18 @@ def load_ctx_field(builder, ctx_arg, offset_global):
113113 offset = builder .load (offset_global )
114114
115115 # Ensure ctx_arg is treated as i8* (byte pointer)
116- i8_type = ir .IntType (8 )
117- i8_ptr_type = ir .PointerType (i8_type )
116+ # i8_type = ir.IntType(8)
117+ i8_ptr_type = ir .PointerType ()
118118
119119 # Cast ctx_arg to i8* if it isn't already
120- if str (ctx_arg .type ) != str (i8_ptr_type ):
121- ctx_i8_ptr = builder .bitcast (ctx_arg , i8_ptr_type )
122- else :
123- ctx_i8_ptr = ctx_arg
120+ # if str(ctx_arg.type) != str(i8_ptr_type):
121+ # ctx_i8_ptr = builder.bitcast(ctx_arg, i8_ptr_type)
122+ # else:
123+ # ctx_i8_ptr = ctx_arg
124124
125125 # GEP with explicit type - this is the key fix
126126 field_ptr = builder .gep (
127- ctx_i8_ptr ,
127+ ctx_arg ,
128128 [offset ],
129129 inbounds = False ,
130130 )
@@ -138,19 +138,20 @@ def load_ctx_field(builder, ctx_arg, offset_global):
138138 raise KeyError
139139 except (KeyError , AttributeError ):
140140 passthrough_type = ir .FunctionType (
141- i8_ptr_type ,
142- [ir .IntType (32 ), i8_ptr_type ]
141+ ir . PointerType () ,
142+ [ir .IntType (32 ), ir . PointerType ()],
143143 )
144144 passthrough_fn = ir .Function (
145145 module ,
146146 passthrough_type ,
147- name = 'llvm.bpf.passthrough.p0.p0'
147+ name = 'llvm.bpf.passthrough.p0.p0' ,
148148 )
149149
150150 # Call passthrough to satisfy BPF verifier
151151 verified_ptr = builder .call (
152152 passthrough_fn ,
153153 [ir .Constant (ir .IntType (32 ), 0 ), field_ptr ],
154+ tail = True
154155 )
155156
156157 # Bitcast to i64* (assuming field is 64-bit, adjust if needed)
0 commit comments