Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualfir

Posted 27 February 2014 - 04:15 PM

You can really put anything you want in sections of the executable, it's all just bytes anyway. The sections can be called anything also. The only difference is the flags that the OS uses to allocate the memory. Pure data sections could for example be allocated as non-executable or read-only.

This is the function that Windows uses to allocate memory when it loads executables, it might give you some hints about this.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366887(v=vs.85).aspx

I'm not sure what he's on about when he says that data in the code section could give you performance issues. The data needs to be somewhere, and I don't see why loading it from one arbitrary memory address would be worse than doing it from another arbitrary address. It might even be beneficial to have it near the code, because the jump table data would likely end up in the same memory page as the code that uses it... But I'm not sure, so don't qote me on that. But the compiler writers are usually not morons, so it would be pretty safe to bet that they know what they are doing.

 

not always sometimes compilers do a really weak stuff...

i also sont know what he mean about this performance issues,

though i must say that year ot two years ago i was calling the data - i mean i wrote the procedures right in machine code in my prog like

 

char asmDot_SSE[] =
{
 
 0xC8, 0x00, 0x00, 0x00,
 0x8B, 0x45, 0x08,
 0x8B, 0x5D, 0x0C,
 0x8B, 0x4D, 0x10,
 0x0F, 0x10, 0x00,
 0x0F, 0x10, 0x0B,
 0x0F, 0x59, 0xC1,
 0x0F, 0x12, 0xC8,
 0x0F, 0x58, 0xC8,
 0x0F, 0x28, 0xC1,
 0x0F, 0xC6, 0xC9, 0x01,
 0xF3, 0x0F, 0x58, 0xC1,
 0xF3, 0x0F, 0x11, 0x01,
 0xC9,
 0xC3
 
};
 
and when counting the execution times it was much slower than 
executing it in normal code section - i dont know what was a reason of that but it worked but had a speed penalty sadly
 
mayve some guarding mechanism is involved ? maybe it works also in opossite way, i mean accessing data from .code pages.. dont know

#1fir

Posted 27 February 2014 - 04:13 PM

You can really put anything you want in sections of the executable, it's all just bytes anyway. The sections can be called anything also. The only difference is the flags that the OS uses to allocate the memory. Pure data sections could for example be allocated as non-executable or read-only.

This is the function that Windows uses to allocate memory when it loads executables, it might give you some hints about this.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366887(v=vs.85).aspx

I'm not sure what he's on about when he says that data in the code section could give you performance issues. The data needs to be somewhere, and I don't see why loading it from one arbitrary memory address would be worse than doing it from another arbitrary address. It might even be beneficial to have it near the code, because the jump table data would likely end up in the same memory page as the code that uses it... But I'm not sure, so don't qote me on that. But the compiler writers are usually not morons, so it would be pretty safe to bet that they know what they are doing.

 

not always sometimes compilers do a really weak stuff...

i also sont know what he mean about this performance issues,

though i must say that year ot two years ago i was calling the data - i mean i wrote the procedures right in machine code in my prog like

 

char asmDot_SSE[] =
{
 
 0xC8, 0x00, 0x00, 0x00,
 0x8B, 0x45, 0x08,
 0x8B, 0x5D, 0x0C,
 0x8B, 0x4D, 0x10,
 0x0F, 0x10, 0x00,
 0x0F, 0x10, 0x0B,
 0x0F, 0x59, 0xC1,
 0x0F, 0x12, 0xC8,
 0x0F, 0x58, 0xC8,
 0x0F, 0x28, 0xC1,
 0x0F, 0xC6, 0xC9, 0x01,
 0xF3, 0x0F, 0x58, 0xC1,
 0xF3, 0x0F, 0x11, 0x01,
 0xC9,
 0xC3
 
};
 
and when counting the execution times it was much slower than 
executing it in normal code section - i dont know what was a reason of that but it worked but had a speed penalty sadly

PARTNERS