1. Mapping C to Assembly Write x86 assembly code for the body of the following function. You do not need to write the code to set up or tear down the stack frame, but must save and restore any callee-saved registers yourself (if you need to use them). Include comments in your assembly to show the correspondence between the C code and the x86.

typedef int (*func_t)(int arg);

extern func_t jump_table[32];

int dispatch(int bitmask, int arg)

{

int bit = 1;

for(int i = 0; i

{

if(bitmask & bit)

{

return (jump_table[i])(arg);

}

bit = bit

}

return 0;

}



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *