return addr_col_mask;
}
+static int copy_mask_to_list(
+ uint64_t col_val, uint32_t *col_list, uint64_t col_num)
+{
+ unsigned int i, k;
+
+ if ( !col_list )
+ return -EINVAL;
+
+ for ( i = 0, k = 0; k < col_num; i++ )
+ if (col_val & (1 << i))
+ col_list[k++] = i;
+
+ return 0;
+}
+
bool __init coloring_init(void)
{
int i;
return true;
}
+uint32_t *setup_default_colors(unsigned int *col_num)
+{
+ uint32_t *col_list;
+
+ if ( dom0_colors_num )
+ {
+ *col_num = dom0_colors_num;
+ col_list = xzalloc_array(uint32_t, dom0_colors_num);
+ if ( !col_list )
+ {
+ C_DEBUG("setup_default_colors: Alloc failed\n");
+ return NULL;
+ }
+ copy_mask_to_list(dom0_colors_mask, col_list, dom0_colors_num);
+ return col_list;
+ }
+
+ return NULL;
+}
+
/**
* Compute color id from the page @param pg.
* Page size determines the lowest available bit, while add_col_mask is used to
/* Return the maximum available number of colors supported by the hardware */
uint64_t get_max_colors(void);
+/*
+ * Return an array with default colors selection and store the number of
+ * colors in @param col_num. The array selection will be equal to the dom0
+ * color configuration.
+ */
+uint32_t *setup_default_colors(unsigned int *col_num);
+
/* Colored allocator functions */
bool init_col_heap_pages(struct page_info *pg, unsigned long nr_pages);
struct page_info *alloc_col_domheap_page(