lguest: remove RESERVE_MEM constant.

We can use switcher_addr directly.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2013-04-22 14:10:37 +09:30
Родитель 68a644d734
Коммит c215a8b9eb
1 изменённых файлов: 11 добавлений и 7 удалений

Просмотреть файл

@ -63,10 +63,8 @@
*/ */
#ifdef CONFIG_X86_PAE #ifdef CONFIG_X86_PAE
#define SWITCHER_PMD_INDEX (PTRS_PER_PMD - 1) #define SWITCHER_PMD_INDEX (PTRS_PER_PMD - 1)
#define RESERVE_MEM 2U
#define CHECK_GPGD_MASK _PAGE_PRESENT #define CHECK_GPGD_MASK _PAGE_PRESENT
#else #else
#define RESERVE_MEM 4U
#define CHECK_GPGD_MASK _PAGE_TABLE #define CHECK_GPGD_MASK _PAGE_TABLE
#endif #endif
@ -977,15 +975,21 @@ int init_guest_pagetable(struct lguest *lg)
/*H:508 When the Guest calls LHCALL_LGUEST_INIT we do more setup. */ /*H:508 When the Guest calls LHCALL_LGUEST_INIT we do more setup. */
void page_table_guest_data_init(struct lg_cpu *cpu) void page_table_guest_data_init(struct lg_cpu *cpu)
{ {
/*
* We tell the Guest that it can't use the virtual addresses
* used by the Switcher. This trick is equivalent to 4GB -
* switcher_addr.
*/
u32 top = ~switcher_addr + 1;
/* We get the kernel address: above this is all kernel memory. */ /* We get the kernel address: above this is all kernel memory. */
if (get_user(cpu->lg->kernel_address, if (get_user(cpu->lg->kernel_address,
&cpu->lg->lguest_data->kernel_address) &cpu->lg->lguest_data->kernel_address)
/* /*
* We tell the Guest that it can't use the top 2 or 4 MB * We tell the Guest that it can't use the top virtual
* of virtual addresses used by the Switcher. * addresses (used by the Switcher).
*/ */
|| put_user(RESERVE_MEM * 1024 * 1024, || put_user(top, &cpu->lg->lguest_data->reserve_mem)) {
&cpu->lg->lguest_data->reserve_mem)) {
kill_guest(cpu, "bad guest page %p", cpu->lg->lguest_data); kill_guest(cpu, "bad guest page %p", cpu->lg->lguest_data);
return; return;
} }