[syslinux] Sending UDP packets from comboot

Stefan Thomanek stefan at thomanek.eu
Sat May 30 13:17:00 PDT 2009


H. Peter Anvin schrieb:
> Stefan Thomanek wrote:
>   
>> struct teststruct {
>>    uint16_t var1;
>>    uint8_t var2;
>>    uint16_t var3; };
>>
>>     
>
> That's a 6-byte structure, unless you specify __attribute__((packed)).
>
>   
>> Could anyone please take a look inside the text file and tell me where
>> i've made mistakes?
>>     
>
> You're overwriting your test data structure with your parameter structure:
>
>
>     // Bounce testdata
>     memcpy(__com32.cs_bounce, &test, sizeof(test));
>
>    [...]
>
>     // Bounce send struct
>     memcpy(__com32.cs_bounce, &args, sizeof(args));
>
>
> One way to do this is to put both your args and your data structure into
> a bigger structure; another option is to calculate where in the bounce
> buffer you can put your data.  The former is easier when you have
> fixed-size data, the latter can be more general.
>
> 	-hpa
>
>   
Ok, got it. Stupid me ><..
Changed the 2nd call to

	memcpy(__com32.cs_bounce + sizeof(test), &args, sizeof(args));

and the SEG/OFFS call to

	inputRegs.es = SEG(__com32.cs_bounce + sizeof(test));
	inputRegs.edi.w[0] = OFFS(__com32.cs_bounce + sizeof(test));

It works :)




More information about the Syslinux mailing list