From 8d697ae25256f5801ed957d2fff4b29f36a09c8c Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Wed, 9 Nov 2016 13:38:00 +0100 Subject: [PATCH] x86_64: kernel: fix handle_vnode_identify to not do superfluous switch on objtype Signed-off-by: Simon Gerber --- kernel/arch/x86_64/syscall.c | 20 ++------------------ 1 files changed, 2 insertions(+), 18 deletions(-) diff --git a/kernel/arch/x86_64/syscall.c b/kernel/arch/x86_64/syscall.c index 699aead..6145909 100644 --- a/kernel/arch/x86_64/syscall.c +++ b/kernel/arch/x86_64/syscall.c @@ -573,24 +573,8 @@ static struct sysret handle_vnode_identify(struct capability *to, to->type == ObjType_VNode_x86_64_pdpt || to->type == ObjType_VNode_x86_64_pdir || to->type == ObjType_VNode_x86_64_ptable); - - uint64_t base_addr = 0; - switch (to->type) { - case ObjType_VNode_x86_64_pml4: - base_addr = (uint64_t)(to->u.vnode_x86_64_pml4.base); - break; - case ObjType_VNode_x86_64_pdpt: - base_addr = (uint64_t)(to->u.vnode_x86_64_pdpt.base); - break; - case ObjType_VNode_x86_64_pdir: - base_addr = (uint64_t)(to->u.vnode_x86_64_pdir.base); - break; - case ObjType_VNode_x86_64_ptable: - base_addr = (uint64_t)(to->u.vnode_x86_64_ptable.base); - break; - default: - break; - } + + genpaddr_t base_addr = get_address(to); assert((base_addr & BASE_PAGE_MASK) == 0); return (struct sysret) { -- 1.7.2.5