diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2013-04-22 00:40:37 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-04-22 02:01:35 -0400 |
commit | c215a8b9eb17739c01d59faa7db9d1ef162a82a8 (patch) | |
tree | 915c1175bb30c25462f39c9450899368d383c411 /drivers/lguest | |
parent | 68a644d734e61f38b686cb755bd2a3f43d9372f4 (diff) |
lguest: remove RESERVE_MEM constant.
We can use switcher_addr directly.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest')
-rw-r--r-- | drivers/lguest/page_tables.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c index a2454a24a10c..27cbb186a911 100644 --- a/drivers/lguest/page_tables.c +++ b/drivers/lguest/page_tables.c | |||
@@ -63,10 +63,8 @@ | |||
63 | */ | 63 | */ |
64 | #ifdef CONFIG_X86_PAE | 64 | #ifdef CONFIG_X86_PAE |
65 | #define SWITCHER_PMD_INDEX (PTRS_PER_PMD - 1) | 65 | #define SWITCHER_PMD_INDEX (PTRS_PER_PMD - 1) |
66 | #define RESERVE_MEM 2U | ||
67 | #define CHECK_GPGD_MASK _PAGE_PRESENT | 66 | #define CHECK_GPGD_MASK _PAGE_PRESENT |
68 | #else | 67 | #else |
69 | #define RESERVE_MEM 4U | ||
70 | #define CHECK_GPGD_MASK _PAGE_TABLE | 68 | #define CHECK_GPGD_MASK _PAGE_TABLE |
71 | #endif | 69 | #endif |
72 | 70 | ||
@@ -977,15 +975,21 @@ int init_guest_pagetable(struct lguest *lg) | |||
977 | /*H:508 When the Guest calls LHCALL_LGUEST_INIT we do more setup. */ | 975 | /*H:508 When the Guest calls LHCALL_LGUEST_INIT we do more setup. */ |
978 | void page_table_guest_data_init(struct lg_cpu *cpu) | 976 | void page_table_guest_data_init(struct lg_cpu *cpu) |
979 | { | 977 | { |
978 | /* | ||
979 | * We tell the Guest that it can't use the virtual addresses | ||
980 | * used by the Switcher. This trick is equivalent to 4GB - | ||
981 | * switcher_addr. | ||
982 | */ | ||
983 | u32 top = ~switcher_addr + 1; | ||
984 | |||
980 | /* We get the kernel address: above this is all kernel memory. */ | 985 | /* We get the kernel address: above this is all kernel memory. */ |
981 | if (get_user(cpu->lg->kernel_address, | 986 | if (get_user(cpu->lg->kernel_address, |
982 | &cpu->lg->lguest_data->kernel_address) | 987 | &cpu->lg->lguest_data->kernel_address) |
983 | /* | 988 | /* |
984 | * We tell the Guest that it can't use the top 2 or 4 MB | 989 | * We tell the Guest that it can't use the top virtual |
985 | * of virtual addresses used by the Switcher. | 990 | * addresses (used by the Switcher). |
986 | */ | 991 | */ |
987 | || put_user(RESERVE_MEM * 1024 * 1024, | 992 | || put_user(top, &cpu->lg->lguest_data->reserve_mem)) { |
988 | &cpu->lg->lguest_data->reserve_mem)) { | ||
989 | kill_guest(cpu, "bad guest page %p", cpu->lg->lguest_data); | 993 | kill_guest(cpu, "bad guest page %p", cpu->lg->lguest_data); |
990 | return; | 994 | return; |
991 | } | 995 | } |