From cadeb57f90a6e25d6010c7362353c153e6bb88bc Mon Sep 17 00:00:00 2001 From: Jo Van Bulck Date: Thu, 18 Jan 2024 20:51:26 +0100 Subject: [PATCH] Fix compatibility with Linux 6.5 and later Attempt to fix issue #70 --- kernel/sgxstep.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/sgxstep.c b/kernel/sgxstep.c index 0ef7762..1fdb67e 100644 --- a/kernel/sgxstep.c +++ b/kernel/sgxstep.c @@ -117,8 +117,8 @@ int save_idt(void) */ int save_apic(void) { - g_apic_lvtt_copy = apic_read(APIC_LVTT); - g_apic_tdcr_copy = apic_read(APIC_TDCR); + g_apic_lvtt_copy = apic->read(APIC_LVTT); + g_apic_tdcr_copy = apic->read(APIC_TDCR); log("original APIC_LVTT=%#x/TDCR=%#x)", g_apic_lvtt_copy, g_apic_tdcr_copy); return 0; @@ -174,8 +174,8 @@ void restore_apic(void) { int delta = 100; - apic_write(APIC_LVTT, g_apic_lvtt_copy); - apic_write(APIC_TDCR, g_apic_tdcr_copy); + apic->write(APIC_LVTT, g_apic_lvtt_copy); + apic->write(APIC_TDCR, g_apic_tdcr_copy); log("restored APIC_LVTT=%#x/TDCR=%#x)", g_apic_lvtt_copy, g_apic_tdcr_copy); /* In xAPIC mode the memory-mapped write to LVTT needs to be serialized. */ @@ -190,7 +190,7 @@ void restore_apic(void) else { log("restoring APIC timer one-shot/periodic operation"); - apic_write(APIC_TMICT, delta); + apic->write(APIC_TMICT, delta); } } @@ -271,7 +271,7 @@ long sgx_step_get_pt_mapping(struct file *filep, unsigned int cmd, unsigned long if ( !pmd_present( *pmd ) ) return 0; - pte = pte_offset_map( pmd, virt ); + pte = pte_offset_kernel( pmd, virt ); map->pte = *((uint64_t *) pte); if ( !pte_present( *pte ) )