Ensuring CPU run function starts at the beggining of a page

This commit is contained in:
Sergio Martin 2024-01-14 09:17:06 +01:00
parent dee398c8f7
commit 37acae846c
2 changed files with 7 additions and 8 deletions

View File

@ -4,6 +4,10 @@ project('quickerNES','c','cpp',
default_options : ['cpp_std=c++20', 'default_library=shared', 'buildtype=release']
)
# Getting page alignment
getConfCommand = run_command('getconf', 'PAGESIZE', check: true)
pageSize = getConfCommand.stdout().strip()
# quickerNES Core sources
quickerNESCoreSrc = [
@ -41,7 +45,7 @@ quickerNESCoreSrc = [
# quickerNES Core Configuration
quickerNESCoreDependency = declare_dependency(
compile_args : [ '-Wfatal-errors', '-Wall', '-Werror', '-Wno-multichar' ],
compile_args : [ '-Wfatal-errors', '-Wall', '-Werror', '-Wno-multichar', '-D_PAGE_SIZE="' + pageSize + '"'],
include_directories : include_directories(['source', 'source/core', 'extern']),
sources : [ quickerNESCoreSrc, 'extern/metrohash128/metrohash128.cpp' ]
)

View File

@ -231,11 +231,8 @@ constexpr uint8_t clock_table [256] = {
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7 // F
};
#pragma GCC push_options
#pragma GCC optimize ("align-functions=1024")
Nes_Cpu::result_t Nes_Cpu::run ( nes_time_t end )
__attribute__((optimize("align-functions=" _PAGE_SIZE)))
Nes_Cpu::result_t Nes_Cpu::run ( nes_time_t end )
{
set_end_time_( end );
clock_count = 0;
@ -1180,5 +1177,3 @@ end:
return result;
}
#pragma GCC pop_options