- Log_Warning("Arch", "TODO: Impliment memory map sorting");
- // TODO: Sort memory map
+ // Use a selection/swap sort
+ for( int i = 0; i < NEnts; i ++ )
+ {
+ int sel = i;
+ for( int j = i+1; j < NEnts; j ++ )
+ {
+ if( map[j].Start < map[sel].Start )
+ sel = j;
+ }
+ if( sel != i ) {
+ LOG("Swapping %i and %i", i, sel);
+ LOG(" - %llx+%llx", map[i].Start, map[i].Length);
+ LOG(" - %llx+%llx", map[sel].Start, map[sel].Length);
+ tPMemMapEnt tmp = map[i];
+ map[i] = map[sel];
+ map[sel] = tmp;
+ }
+ }