Skip to content

Commit

Permalink
remove the unnecessary print in the kernel module
Browse files Browse the repository at this point in the history
  • Loading branch information
Fly0307 committed Oct 8, 2023
1 parent 749d4bf commit 5866595
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 33 deletions.
6 changes: 0 additions & 6 deletions penglai-enclave-driver/penglai-enclave-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ int enclave_ioctl_init(void)
}

#if 1
printk("[Penglai KModule] before printk\n");
printk("[Penglai KModule]: mm_init addr: va: %lx, pa: %lx, __va(pa): %lx\n", addr, __pa(addr), (unsigned long)__va(__pa(addr)));
if(is_linear_mapping(addr))
printk("[Penglai KModule]: va: %lx is linear mapping\n", addr);
else
printk("[Penglai KModule]: va: %lx is kernel mapping\n", addr);
sbiret = SBI_CALL_2(SBI_SM_INIT, __pa(addr), 1 << (DEFAULT_SECURE_PAGES_ORDER + RISCV_PGSHIFT));
ret = sbiret.value;
//if(ret < 0)
Expand Down
16 changes: 2 additions & 14 deletions penglai-enclave-driver/penglai-enclave-elfloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,7 @@ int penglai_enclave_loadelf(enclave_mem_t*enclave_mem, void* __user elf_ptr, uns
printk("KERNEL MODULE: elf_hdr copy_from_user failed\n");
return -1;
}
printk("[Penglai Driver@%s] elf_hdr.e_type: %x\n", __func__, elf_hdr.e_type);
printk("[Penglai Driver@%s] elf_hdr.e_entry: %llx\n", __func__, elf_hdr.e_entry);
printk("[Penglai Driver@%s] elf_hdr.e_phoff: %llx\n", __func__, elf_hdr.e_phoff);
printk("[Penglai Driver@%s] elf_hdr.e_shoff: %llx\n", __func__, elf_hdr.e_shoff);
printk("[Penglai Driver@%s] elf_hdr.e_version: %x\n", __func__, elf_hdr.e_version);
printk("[Penglai Driver@%s] elf_hdr.e_flags: %x\n", __func__, elf_hdr.e_flags);
printk("[Penglai Driver@%s] elf_hdr.e_ehsize: %x\n", __func__, elf_hdr.e_ehsize);

*elf_entry_point = elf_hdr.e_entry;
elf_sect_ptr = (vaddr_t) elf_ptr + elf_hdr.e_shoff;

Expand Down Expand Up @@ -134,13 +128,7 @@ int penglai_enclave_elfmemsize(void* __user elf_ptr, int* size)
printk("[Penglai Driver@%s] elf_hdr copy_from_user failed\n", __func__);
return -1;
}
printk("[Penglai Driver@%s] elf_hdr.e_type: %x\n", __func__, elf_hdr.e_type);
printk("[Penglai Driver@%s] elf_hdr.e_entry: %llx\n", __func__, elf_hdr.e_entry);
printk("[Penglai Driver@%s] elf_hdr.e_phoff: %llx\n", __func__, elf_hdr.e_phoff);
printk("[Penglai Driver@%s] elf_hdr.e_shoff: %llx\n", __func__, elf_hdr.e_shoff);
printk("[Penglai Driver@%s] elf_hdr.e_version: %x\n", __func__, elf_hdr.e_version);
printk("[Penglai Driver@%s] elf_hdr.e_flags: %x\n", __func__, elf_hdr.e_flags);
printk("[Penglai Driver@%s] elf_hdr.e_ehsize: %x\n", __func__, elf_hdr.e_ehsize);

elf_sect_ptr = (vaddr_t) elf_ptr + elf_hdr.e_shoff;

for (i = 0; i < elf_hdr.e_shnum;i++)
Expand Down
5 changes: 0 additions & 5 deletions penglai-enclave-driver/penglai-enclave-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ int check_eapp_memory_size(long elf_size, long stack_size, long untrusted_mem_si
int penglai_enclave_create(struct file * filep, unsigned long args)
{
struct penglai_enclave_user_param* enclave_param = (struct penglai_enclave_user_param*)args;
printk("KERNEL MODULE: enclave_param->elf_ptr: %lx\n", enclave_param->elf_ptr);
printk("KERNEL MODULE: enclave_param->stack_size: %lx\n", enclave_param->stack_size);
printk("KERNEL MODULE: enclave_param->untrusted_mem_size: %lx\n", enclave_param->untrusted_mem_size);
printk("KERNEL MODULE: enclave_param->untrusted_mem_ptr: %lx\n", enclave_param->untrusted_mem_ptr);
void *elf_ptr = (void*)enclave_param->elf_ptr;
int elf_size = 0;
if(penglai_enclave_elfmemsize(elf_ptr, &elf_size) < 0)
Expand Down Expand Up @@ -297,7 +293,6 @@ int penglai_enclave_run(struct file *filep, unsigned long args)
int retval = 0;
int resume_id = 0;

printk("[Penglai Driver@%s] begin get_enclave_by_id\n", __func__);
acquire_big_lock(__func__);

enclave = get_enclave_by_id(eid);
Expand Down
9 changes: 1 addition & 8 deletions penglai-enclave-driver/penglai-enclave.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,7 @@ enclave_t* create_enclave(int total_pages)
__func__, total_pages, order);
//Note: SBI_SM_ALLOC_ENCLAVE_MEM's arg is the num of bytes instead of pages
require_sec_memory->size = total_pages << RISCV_PGSHIFT;
printk("[Penglai Driver] before printk\n");
printk("[Penglai Driver@%s] require_sec_memory va: %lx, pa: %lx, __va(pa): %lx\n",
__func__, (unsigned long)require_sec_memory, __pa(require_sec_memory), (unsigned long)__va(__pa(require_sec_memory)));
if(is_linear_mapping((unsigned long)require_sec_memory))
printk("[Penglai Driver]: va: %lx is linear mapping\n", (unsigned long)require_sec_memory);
else
printk("[Penglai Driver]: va: %lx is kernel mapping\n", (unsigned long)require_sec_memory);
printk("[Penglai Driver] after printk\n");

ret = SBI_CALL_1(SBI_SM_ALLOC_ENCLAVE_MEM, __pa(require_sec_memory));
pa = require_sec_memory->paddr;

Expand Down

0 comments on commit 5866595

Please sign in to comment.