Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
xcap
xcap-capability-linux
Commits
39a20ffe
Commit
39a20ffe
authored
Feb 15, 2016
by
Charlie Jacobsen
Committed by
Vikram Narayanan
Oct 26, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
liblcd-v2: Add higher-level interface code for page allocator.
vmalloc is not implemented for now.
parent
fa0aea92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
0 deletions
+64
-0
lcd-domains/liblcd/lcd-domains/mem.c
lcd-domains/liblcd/lcd-domains/mem.c
+64
-0
No files found.
lcd-domains/liblcd/lcd-domains/mem.c
View file @
39a20ffe
...
...
@@ -294,6 +294,20 @@ static inline gva_t heap_struct_page_to_addr(struct page *p)
return
gva_add
(
LCD_HEAP_GV_ADDR
,
idx
*
PAGE_SIZE
);
}
static
inline
struct
page
*
heap_page_block_to_struct_page
(
struct
lcd_page_block
*
pb
)
{
return
heap_addr_to_struct_page
(
heap_page_block_to_addr
(
pb
));
}
static
inline
struct
lcd_page_block
*
heap_struct_page_to_page_block
(
struct
page
*
p
)
{
return
heap_addr_to_page_block
(
heap_struct_page_to_addr
(
p
));
}
static
int
setup_struct_page_array
(
void
)
{
struct
lcd_page_block
*
pb
;
...
...
@@ -381,6 +395,56 @@ fail1:
return
ret
;
}
/* PAGE ALLOC INTERFACE ---------------------------------------- */
struct
page
*
lcd_alloc_pages_exact_node
(
int
nid
,
unsigned
int
flags
,
unsigned
int
order
)
{
/*
* For now, we ignore the node id (not numa aware).
*/
return
lcd_alloc_pages
(
flags
,
order
);
}
struct
page
*
lcd_alloc_pages
(
unsigned
int
flags
,
unsigned
int
order
)
{
struct
lcd_page_block
*
pb
;
/*
* Do heap alloc. Flags are ignored for now.
*/
pb
=
lcd_page_allocator_alloc
(
heap_allocator
,
order
);
if
(
!
pb
)
{
LIBLCD_ERR
(
"alloc failed"
);
goto
fail1
;
}
/*
* Convert to struct page
*/
return
heap_page_block_to_struct_page
(
pb
);
fail1:
return
NULL
;
}
void
lcd_free_pages
(
struct
page
*
base
,
unsigned
int
order
)
{
lcd_page_allocator_free
(
heap_allocator
,
lcd_struct_page_to_page_block
(
base
),
order
);
}
void
*
lcd_vmalloc
(
unsigned
long
sz
)
{
/* Not implemented for now */
BUG
();
}
void
lcd_vfree
(
void
*
ptr
)
{
/* Not implemented for now */
BUG
();
}
/* VOLUNTEERING -------------------------------------------------- */
int
lcd_volunteer_pages
(
struct
page
*
base
,
unsigned
int
order
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment