Register the commpage as an image and its entries as symbols.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27722 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-09-24 14:41:42 +00:00
parent fec47a5702
commit 8a85be4636
4 changed files with 36 additions and 3 deletions
+2
View File
@@ -5,6 +5,7 @@
#ifndef _KERNEL_COMMPAGE_H
#define _KERNEL_COMMPAGE_H
#include <image.h>
#include <SupportDefs.h>
#include <commpage_defs.h>
@@ -17,6 +18,7 @@ extern "C" {
status_t commpage_init(void);
void* allocate_commpage_entry(int entry, size_t size);
void* fill_commpage_entry(int entry, const void* copyFrom, size_t size);
image_id get_commpage_image();
status_t arch_commpage_init(void);
// implemented in the architecture specific part
@@ -11,6 +11,7 @@
#include <KernelExport.h>
#include <cpu.h>
#include <elf.h>
#include <smp.h>
@@ -90,6 +91,12 @@ initialize_commpage_syscall(void)
size_t len = (size_t)((addr_t)syscallCodeEnd - (addr_t)syscallCode);
fill_commpage_entry(COMMPAGE_ENTRY_X86_SYSCALL, syscallCode, len);
// add syscall to the commpage image
image_id image = get_commpage_image();
elf_add_memory_image_symbol(image, "commpage_syscall",
((addr_t*)USER_COMMPAGE_ADDR)[COMMPAGE_ENTRY_X86_SYSCALL], len,
B_SYMBOL_TYPE_TEXT);
return B_OK;
}
+11 -3
View File
@@ -18,6 +18,7 @@
#include <boot_device.h>
#include <commpage.h>
#include <debug.h>
#include <elf.h>
#include <smp.h>
#include <tls.h>
#include <vm.h>
@@ -607,9 +608,16 @@ arch_cpu_init_post_modules(kernel_args *args)
}
// put the optimized functions into the commpage
fill_commpage_entry(COMMPAGE_ENTRY_X86_MEMCPY, (const void *)gOptimizedFunctions.memcpy,
(addr_t)gOptimizedFunctions.memcpy_end
- (addr_t)gOptimizedFunctions.memcpy);
size_t memcpyLen = (addr_t)gOptimizedFunctions.memcpy_end
- (addr_t)gOptimizedFunctions.memcpy;
fill_commpage_entry(COMMPAGE_ENTRY_X86_MEMCPY,
(const void*)gOptimizedFunctions.memcpy, memcpyLen);
// add the functions to the commpage image
image_id image = get_commpage_image();
elf_add_memory_image_symbol(image, "commpage_memcpy",
((addr_t*)USER_COMMPAGE_ADDR)[COMMPAGE_ENTRY_X86_MEMCPY], memcpyLen,
B_SYMBOL_TYPE_TEXT);
return B_OK;
}
+16
View File
@@ -9,6 +9,7 @@
#include <KernelExport.h>
#include <elf.h>
#include <vm.h>
#include <vm_types.h>
@@ -18,6 +19,7 @@ static area_id sUserCommPageArea;
static addr_t* sCommPageAddress;
static addr_t* sUserCommPageAddress;
static void* sFreeCommPageSpace;
static image_id sCommPageImage;
#define ALIGN_ENTRY(pointer) (void*)ROUNDUP((addr_t)(pointer), 8)
@@ -44,6 +46,13 @@ fill_commpage_entry(int entry, const void* copyFrom, size_t size)
}
image_id
get_commpage_image()
{
return sCommPageImage;
}
status_t
commpage_init(void)
{
@@ -68,6 +77,13 @@ commpage_init(void)
// the next slot to allocate space is after the table
sFreeCommPageSpace = ALIGN_ENTRY(&sCommPageAddress[COMMPAGE_TABLE_ENTRIES]);
// create the image for the commpage
sCommPageImage = elf_create_memory_image("commpage", USER_COMMPAGE_ADDR,
COMMPAGE_SIZE, 0, 0);
elf_add_memory_image_symbol(sCommPageImage, "commpage_table",
USER_COMMPAGE_ADDR, COMMPAGE_TABLE_ENTRIES * sizeof(addr_t),
B_SYMBOL_TYPE_DATA);
arch_commpage_init();
return B_OK;