Hello Isaac and all<br><br>I have read the challenges discussed.<br><br>I summarize the issues may occurred in the followings:<br><br>Would you mind to give some advise?<br><br><span> 1. </span><span>struct layout may be not static, which means that struct field 
offset are no longer constant in this model. <br><br>Such like the following 
example:</span><span><br><br>struct S{</span><span><br>    void* x;</span><span><span><br>    </span>int e;</span><span><br>};</span><span><span><br></span><br>struct size(S) is 5 byte for 32-bit processor and 9 byte for 64-bit processor, it also effect the struct field c offset.</span><span><br>
<br>sol.<br><br>We can use the natural indexing in EBC specification to solve this issue.<br><br></span><span>Assume BASE be the address of c in R0, then the address of c.e is 
content of R0 add (0 + 1 * sizeof(void*)). <br><br>If the EFI C code is c.e = 4,
 the assembly generated is MOVI @R0(1, 0), 4 after compiled. <br><br>(Notation 
@R1 (+n, +c) means the memory which address is content of R1 add (c + 
n*sizeof(void*)). <br><br>The EBC assembly above indicate move immediate value 4
 to memory which address is content of <br><br>R0 add (0 + 1*sizeof(void*)).</span><br><span><br>2. sizeof is evaluated at runtime because the pointer size (void*) is determined at runtime.</span><span><br><br>sol.<br></span><br>
This issue could be solved by implementing sizeof as an intrinsic, and the code of sizeof intrinsic could be as follows:<span><br><br></span><span></span>            MOVI           R1, 0<span></span><span></span><br>            MOVI           R2, Label<span></span><span></span><br>
            ADD32         R1, @R2 (1, 0)<br>Label: <span> </span> UINT32<span><span></span><span></span><span><br>            </span>UINT32   4<span></span><span></span><span></span></span><span><br>            UINT32   8</span><span><br>
<br>R1 ends up with the size of the void*.</span><span><br><br>3. void*-typed automatic variables cause dynamic activation record.</span><span><br><br>sol.<br><br>Consider a Function call of function foo() which does not have any
 parameter. <br><br>Although there is only return address in the activation 
record (which type is void*), the activation record <br><br>size is determined 
at runtime. It doesn’t know how many bytes should be subtracted from <br><br>sp 
(stack pointer register). With natural indexing, we can just generate 
assembly such like <br><br>SUB SP, R1, with R1= sizeof(void*) and can be 
calculated as above.</span><br><br>thanks<br><br>yi-hong<br>