change function names
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
(X86_CPU_LOCAL_OFFSET_TSS + X86_TSS_OFFSET_SP0)
|
||||
|
||||
.text
|
||||
.globl aal_mc_switch_context
|
||||
aal_mc_switch_context:
|
||||
.globl ihk_mc_switch_context
|
||||
ihk_mc_switch_context:
|
||||
pushfq
|
||||
popq %rax
|
||||
testq %rdi, %rdi
|
||||
|
||||
@@ -250,9 +250,9 @@ static void init_smp_processor(void)
|
||||
|
||||
static char *trampoline_va, *first_page_va;
|
||||
|
||||
void aal_mc_init_ap(void)
|
||||
void ihk_mc_init_ap(void)
|
||||
{
|
||||
struct aal_mc_cpu_info *cpu_info = aal_mc_get_cpu_info();
|
||||
struct ihk_mc_cpu_info *cpu_info = ihk_mc_get_cpu_info();
|
||||
|
||||
trampoline_va = map_fixed_area(AP_TRAMPOLINE, AP_TRAMPOLINE_SIZE,
|
||||
0);
|
||||
@@ -270,7 +270,7 @@ void aal_mc_init_ap(void)
|
||||
extern void init_page_table(void);
|
||||
|
||||
extern char x86_syscall[];
|
||||
long (*__x86_syscall_handler)(int, aal_mc_user_context_t *);
|
||||
long (*__x86_syscall_handler)(int, ihk_mc_user_context_t *);
|
||||
|
||||
void init_syscall(void)
|
||||
{
|
||||
@@ -344,10 +344,10 @@ void arch_show_interrupt_context(const void *reg);
|
||||
|
||||
void handle_interrupt(int vector, struct x86_regs *regs)
|
||||
{
|
||||
struct aal_mc_interrupt_handler *h;
|
||||
struct ihk_mc_interrupt_handler *h;
|
||||
|
||||
dkprintf("CPU[%d] got interrupt, vector: %d, RIP: 0x%lX\n",
|
||||
aal_mc_get_processor_id(), vector, regs->rip);
|
||||
ihk_mc_get_processor_id(), vector, regs->rip);
|
||||
|
||||
if (vector < 0 || vector > 255) {
|
||||
panic("Invalid interrupt vector.");
|
||||
@@ -439,7 +439,7 @@ static void __x86_wakeup(int apicid, unsigned long ip)
|
||||
}
|
||||
}
|
||||
|
||||
/** AAL Functions **/
|
||||
/** IHK Functions **/
|
||||
|
||||
void cpu_halt(void)
|
||||
{
|
||||
@@ -475,8 +475,8 @@ unsigned long cpu_disable_interrupt_save(void)
|
||||
return flags;
|
||||
}
|
||||
|
||||
int aal_mc_register_interrupt_handler(int vector,
|
||||
struct aal_mc_interrupt_handler *h)
|
||||
int ihk_mc_register_interrupt_handler(int vector,
|
||||
struct ihk_mc_interrupt_handler *h)
|
||||
{
|
||||
if (vector < 32 || vector > 255) {
|
||||
return -EINVAL;
|
||||
@@ -486,8 +486,8 @@ int aal_mc_register_interrupt_handler(int vector,
|
||||
|
||||
return 0;
|
||||
}
|
||||
int aal_mc_unregister_interrupt_handler(int vector,
|
||||
struct aal_mc_interrupt_handler *h)
|
||||
int ihk_mc_unregister_interrupt_handler(int vector,
|
||||
struct ihk_mc_interrupt_handler *h)
|
||||
{
|
||||
list_del(&h->list);
|
||||
|
||||
@@ -496,7 +496,7 @@ int aal_mc_unregister_interrupt_handler(int vector,
|
||||
|
||||
extern unsigned long __page_fault_handler_address;
|
||||
|
||||
void aal_mc_set_page_fault_handler(void (*h)(unsigned long, void *))
|
||||
void ihk_mc_set_page_fault_handler(void (*h)(unsigned long, void *))
|
||||
{
|
||||
__page_fault_handler_address = (unsigned long)h;
|
||||
}
|
||||
@@ -505,7 +505,7 @@ extern char trampoline_code_data[], trampoline_code_data_end[];
|
||||
struct page_table *get_init_page_table(void);
|
||||
unsigned long get_transit_page_table(void);
|
||||
|
||||
void aal_mc_boot_cpu(int cpuid, unsigned long pc)
|
||||
void ihk_mc_boot_cpu(int cpuid, unsigned long pc)
|
||||
{
|
||||
unsigned long *p;
|
||||
|
||||
@@ -532,7 +532,7 @@ void aal_mc_boot_cpu(int cpuid, unsigned long pc)
|
||||
}
|
||||
}
|
||||
|
||||
void aal_mc_init_context(aal_mc_kernel_context_t *new_ctx,
|
||||
void ihk_mc_init_context(ihk_mc_kernel_context_t *new_ctx,
|
||||
void *stack_pointer, void (*next_function)(void))
|
||||
{
|
||||
unsigned long *sp;
|
||||
@@ -542,7 +542,7 @@ void aal_mc_init_context(aal_mc_kernel_context_t *new_ctx,
|
||||
}
|
||||
|
||||
sp = stack_pointer;
|
||||
memset(new_ctx, 0, sizeof(aal_mc_kernel_context_t));
|
||||
memset(new_ctx, 0, sizeof(ihk_mc_kernel_context_t));
|
||||
|
||||
/* Set the return address */
|
||||
new_ctx->rsp = (unsigned long)(sp - 1);
|
||||
@@ -551,43 +551,43 @@ void aal_mc_init_context(aal_mc_kernel_context_t *new_ctx,
|
||||
|
||||
extern char enter_user_mode[];
|
||||
|
||||
void aal_mc_init_user_process(aal_mc_kernel_context_t *ctx,
|
||||
aal_mc_user_context_t **puctx,
|
||||
void ihk_mc_init_user_process(ihk_mc_kernel_context_t *ctx,
|
||||
ihk_mc_user_context_t **puctx,
|
||||
void *stack_pointer, unsigned long new_pc,
|
||||
unsigned long user_sp)
|
||||
{
|
||||
char *sp;
|
||||
aal_mc_user_context_t *uctx;
|
||||
ihk_mc_user_context_t *uctx;
|
||||
|
||||
sp = stack_pointer;
|
||||
sp -= sizeof(aal_mc_user_context_t);
|
||||
uctx = (aal_mc_user_context_t *)sp;
|
||||
sp -= sizeof(ihk_mc_user_context_t);
|
||||
uctx = (ihk_mc_user_context_t *)sp;
|
||||
|
||||
*puctx = uctx;
|
||||
|
||||
memset(uctx, 0, sizeof(aal_mc_user_context_t));
|
||||
memset(uctx, 0, sizeof(ihk_mc_user_context_t));
|
||||
uctx->cs = USER_CS;
|
||||
uctx->rip = new_pc;
|
||||
uctx->ss = USER_DS;
|
||||
uctx->rsp = user_sp;
|
||||
uctx->rflags = RFLAGS_IF;
|
||||
|
||||
aal_mc_init_context(ctx, sp, (void (*)(void))enter_user_mode);
|
||||
ihk_mc_init_context(ctx, sp, (void (*)(void))enter_user_mode);
|
||||
ctx->rsp0 = (unsigned long)stack_pointer;
|
||||
}
|
||||
|
||||
void aal_mc_modify_user_context(aal_mc_user_context_t *uctx,
|
||||
enum aal_mc_user_context_regtype reg,
|
||||
void ihk_mc_modify_user_context(ihk_mc_user_context_t *uctx,
|
||||
enum ihk_mc_user_context_regtype reg,
|
||||
unsigned long value)
|
||||
{
|
||||
if (reg == AAL_UCR_STACK_POINTER) {
|
||||
if (reg == IHK_UCR_STACK_POINTER) {
|
||||
uctx->rsp = value;
|
||||
} else if (reg == AAL_UCR_PROGRAM_COUNTER) {
|
||||
} else if (reg == IHK_UCR_PROGRAM_COUNTER) {
|
||||
uctx->rip = value;
|
||||
}
|
||||
}
|
||||
|
||||
void aal_mc_print_user_context(aal_mc_user_context_t *uctx)
|
||||
void ihk_mc_print_user_context(ihk_mc_user_context_t *uctx)
|
||||
{
|
||||
kprintf("CS:RIP = %04lx:%16lx\n", uctx->cs, uctx->rip);
|
||||
kprintf("%16lx %16lx %16lx %16lx\n%16lx %16lx %16lx\n",
|
||||
@@ -595,12 +595,12 @@ void aal_mc_print_user_context(aal_mc_user_context_t *uctx)
|
||||
uctx->rsi, uctx->rdi, uctx->rsp);
|
||||
}
|
||||
|
||||
void aal_mc_set_syscall_handler(long (*handler)(int, aal_mc_user_context_t *))
|
||||
void ihk_mc_set_syscall_handler(long (*handler)(int, ihk_mc_user_context_t *))
|
||||
{
|
||||
__x86_syscall_handler = handler;
|
||||
}
|
||||
|
||||
void aal_mc_delay_us(int us)
|
||||
void ihk_mc_delay_us(int us)
|
||||
{
|
||||
arch_delay(us);
|
||||
}
|
||||
@@ -629,12 +629,12 @@ void arch_show_interrupt_context(const void *reg)
|
||||
kprintf_unlock(irqflags);
|
||||
}
|
||||
|
||||
int aal_mc_arch_set_special_register(enum aal_asr_type type,
|
||||
int ihk_mc_arch_set_special_register(enum ihk_asr_type type,
|
||||
unsigned long value)
|
||||
{
|
||||
/* GS modification is not permitted */
|
||||
switch (type) {
|
||||
case AAL_ASR_X86_FS:
|
||||
case IHK_ASR_X86_FS:
|
||||
wrmsr(MSR_FS_BASE, value);
|
||||
return 0;
|
||||
default:
|
||||
@@ -642,12 +642,12 @@ int aal_mc_arch_set_special_register(enum aal_asr_type type,
|
||||
}
|
||||
}
|
||||
|
||||
int aal_mc_arch_get_special_register(enum aal_asr_type type,
|
||||
int ihk_mc_arch_get_special_register(enum ihk_asr_type type,
|
||||
unsigned long *value)
|
||||
{
|
||||
/* GS modification is not permitted */
|
||||
switch (type) {
|
||||
case AAL_ASR_X86_FS:
|
||||
case IHK_ASR_X86_FS:
|
||||
*value = rdmsr(MSR_FS_BASE);
|
||||
return 0;
|
||||
default:
|
||||
@@ -655,9 +655,9 @@ int aal_mc_arch_get_special_register(enum aal_asr_type type,
|
||||
}
|
||||
}
|
||||
|
||||
int aal_mc_interrupt_cpu(int cpu, int vector)
|
||||
int ihk_mc_interrupt_cpu(int cpu, int vector)
|
||||
{
|
||||
kprintf("[%d] aal_mc_interrupt_cpu: %d\n", aal_mc_get_processor_id(), cpu);
|
||||
kprintf("[%d] ihk_mc_interrupt_cpu: %d\n", ihk_mc_get_processor_id(), cpu);
|
||||
|
||||
wait_icr_idle();
|
||||
x86_issue_ipi(cpu, vector);
|
||||
|
||||
@@ -12,17 +12,17 @@
|
||||
int __kprintf(const char *format, ...);
|
||||
#endif
|
||||
|
||||
typedef int aal_spinlock_t;
|
||||
typedef int ihk_spinlock_t;
|
||||
|
||||
#define AAL_STATIC_SPINLOCK_FUNCS
|
||||
#define IHK_STATIC_SPINLOCK_FUNCS
|
||||
|
||||
static void aal_mc_spinlock_init(aal_spinlock_t *lock)
|
||||
static void ihk_mc_spinlock_init(ihk_spinlock_t *lock)
|
||||
{
|
||||
*lock = 0;
|
||||
}
|
||||
#define SPIN_LOCK_UNLOCKED 0
|
||||
|
||||
static unsigned long aal_mc_spinlock_lock(aal_spinlock_t *lock)
|
||||
static unsigned long ihk_mc_spinlock_lock(ihk_spinlock_t *lock)
|
||||
{
|
||||
int inc = 0x00010000;
|
||||
int tmp;
|
||||
@@ -46,7 +46,7 @@ static unsigned long aal_mc_spinlock_lock(aal_spinlock_t *lock)
|
||||
|
||||
#ifdef DEBUG_SPINLOCK
|
||||
__kprintf("[%d] trying to grab lock: 0x%lX\n",
|
||||
aal_mc_get_processor_id(), lock);
|
||||
ihk_mc_get_processor_id(), lock);
|
||||
#endif
|
||||
asm volatile("lock; xaddl %0, %1\n"
|
||||
"movzwl %w0, %2\n\t"
|
||||
@@ -64,19 +64,19 @@ static unsigned long aal_mc_spinlock_lock(aal_spinlock_t *lock)
|
||||
: "memory", "cc");
|
||||
|
||||
#ifdef DEBUG_SPINLOCK
|
||||
__kprintf("[%d] holding lock: 0x%lX\n", aal_mc_get_processor_id(), lock);
|
||||
__kprintf("[%d] holding lock: 0x%lX\n", ihk_mc_get_processor_id(), lock);
|
||||
#endif
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
static void aal_mc_spinlock_unlock(aal_spinlock_t *lock, unsigned long flags)
|
||||
static void ihk_mc_spinlock_unlock(ihk_spinlock_t *lock, unsigned long flags)
|
||||
{
|
||||
asm volatile ("lock incw %0" : "+m"(*lock) : : "memory", "cc");
|
||||
|
||||
cpu_restore_interrupt(flags);
|
||||
#ifdef DEBUG_SPINLOCK
|
||||
__kprintf("[%d] released lock: 0x%lX\n", aal_mc_get_processor_id(), lock);
|
||||
__kprintf("[%d] released lock: 0x%lX\n", ihk_mc_get_processor_id(), lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
#define PFL1_KERN_ATTR (PFL1_PRESENT | PFL1_WRITABLE)
|
||||
|
||||
/* For easy conversion, it is better to be the same as architecture's ones */
|
||||
enum aal_mc_pt_attribute {
|
||||
enum ihk_mc_pt_attribute {
|
||||
PTATTR_ACTIVE = 0x01,
|
||||
PTATTR_WRITABLE = 0x02,
|
||||
PTATTR_USER = 0x04,
|
||||
@@ -104,5 +104,5 @@ void *map_fixed_area(unsigned long phys, unsigned long size, int uncachable);
|
||||
#define AP_TRAMPOLINE_SIZE 0x4000
|
||||
|
||||
/* Local is cachable */
|
||||
#define AAL_IKC_QUEUE_PT_ATTR (PTATTR_WRITABLE | PTATTR_UNCACHABLE)
|
||||
#define IHK_IKC_QUEUE_PT_ATTR (PTATTR_WRITABLE | PTATTR_UNCACHABLE)
|
||||
#endif
|
||||
|
||||
@@ -1,50 +1,50 @@
|
||||
#ifndef HEADER_X86_COMMON_AAL_ATOMIC_H
|
||||
#define HEADER_X86_COMMON_AAL_ATOMIC_H
|
||||
#ifndef HEADER_X86_COMMON_IHK_ATOMIC_H
|
||||
#define HEADER_X86_COMMON_IHK_ATOMIC_H
|
||||
|
||||
typedef struct {
|
||||
int counter;
|
||||
} aal_atomic_t;
|
||||
} ihk_atomic_t;
|
||||
|
||||
#define AAL_ATOMIC_INIT(i) { (i) }
|
||||
#define IHK_ATOMIC_INIT(i) { (i) }
|
||||
|
||||
|
||||
static inline int aal_atomic_read(const aal_atomic_t *v)
|
||||
static inline int ihk_atomic_read(const ihk_atomic_t *v)
|
||||
{
|
||||
return (*(volatile int *)&(v)->counter);
|
||||
}
|
||||
|
||||
static inline void aal_atomic_set(aal_atomic_t *v, int i)
|
||||
static inline void ihk_atomic_set(ihk_atomic_t *v, int i)
|
||||
{
|
||||
v->counter = i;
|
||||
}
|
||||
|
||||
static inline void aal_atomic_add(int i, aal_atomic_t *v)
|
||||
static inline void ihk_atomic_add(int i, ihk_atomic_t *v)
|
||||
{
|
||||
asm volatile("lock addl %1,%0"
|
||||
: "+m" (v->counter)
|
||||
: "ir" (i));
|
||||
}
|
||||
|
||||
static inline void aal_atomic_sub(int i, aal_atomic_t *v)
|
||||
static inline void ihk_atomic_sub(int i, ihk_atomic_t *v)
|
||||
{
|
||||
asm volatile("lock subl %1,%0"
|
||||
: "+m" (v->counter)
|
||||
: "ir" (i));
|
||||
}
|
||||
|
||||
static inline void aal_atomic_inc(aal_atomic_t *v)
|
||||
static inline void ihk_atomic_inc(ihk_atomic_t *v)
|
||||
{
|
||||
asm volatile("lock incl %0"
|
||||
: "+m" (v->counter));
|
||||
}
|
||||
|
||||
static inline void aal_atomic_dec(aal_atomic_t *v)
|
||||
static inline void ihk_atomic_dec(ihk_atomic_t *v)
|
||||
{
|
||||
asm volatile("lock decl %0"
|
||||
: "+m" (v->counter));
|
||||
}
|
||||
|
||||
static inline int aal_atomic_dec_and_test(aal_atomic_t *v)
|
||||
static inline int ihk_atomic_dec_and_test(ihk_atomic_t *v)
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
@@ -54,7 +54,7 @@ static inline int aal_atomic_dec_and_test(aal_atomic_t *v)
|
||||
return c != 0;
|
||||
}
|
||||
|
||||
static inline int aal_atomic_inc_and_test(aal_atomic_t *v)
|
||||
static inline int ihk_atomic_inc_and_test(ihk_atomic_t *v)
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
@@ -64,7 +64,7 @@ static inline int aal_atomic_inc_and_test(aal_atomic_t *v)
|
||||
return c != 0;
|
||||
}
|
||||
|
||||
static inline int aal_atomic_add_return(int i, aal_atomic_t *v)
|
||||
static inline int ihk_atomic_add_return(int i, ihk_atomic_t *v)
|
||||
{
|
||||
int __i;
|
||||
|
||||
@@ -75,12 +75,12 @@ static inline int aal_atomic_add_return(int i, aal_atomic_t *v)
|
||||
return i + __i;
|
||||
}
|
||||
|
||||
static inline int aal_atomic_sub_return(int i, aal_atomic_t *v)
|
||||
static inline int ihk_atomic_sub_return(int i, ihk_atomic_t *v)
|
||||
{
|
||||
return aal_atomic_add_return(-i, v);
|
||||
return ihk_atomic_add_return(-i, v);
|
||||
}
|
||||
|
||||
#define aal_atomic_inc_return(v) (aal_atomic_add_return(1, v))
|
||||
#define aal_atomic_dec_return(v) (aal_atomic_sub_return(1, v))
|
||||
#define ihk_atomic_inc_return(v) (ihk_atomic_add_return(1, v))
|
||||
#define ihk_atomic_dec_return(v) (ihk_atomic_sub_return(1, v))
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,20 +8,20 @@ struct x86_kregs {
|
||||
unsigned long rsp0;
|
||||
};
|
||||
|
||||
typedef struct x86_kregs aal_mc_kernel_context_t;
|
||||
typedef struct x86_kregs ihk_mc_kernel_context_t;
|
||||
/* XXX: User context should contain floating point registers */
|
||||
typedef struct x86_regs aal_mc_user_context_t;
|
||||
typedef struct x86_regs ihk_mc_user_context_t;
|
||||
|
||||
#define aal_mc_syscall_arg0(uc) (uc)->rdi
|
||||
#define aal_mc_syscall_arg1(uc) (uc)->rsi
|
||||
#define aal_mc_syscall_arg2(uc) (uc)->rdx
|
||||
#define aal_mc_syscall_arg3(uc) (uc)->r10
|
||||
#define aal_mc_syscall_arg4(uc) (uc)->r8
|
||||
#define aal_mc_syscall_arg5(uc) (uc)->r9
|
||||
#define ihk_mc_syscall_arg0(uc) (uc)->rdi
|
||||
#define ihk_mc_syscall_arg1(uc) (uc)->rsi
|
||||
#define ihk_mc_syscall_arg2(uc) (uc)->rdx
|
||||
#define ihk_mc_syscall_arg3(uc) (uc)->r10
|
||||
#define ihk_mc_syscall_arg4(uc) (uc)->r8
|
||||
#define ihk_mc_syscall_arg5(uc) (uc)->r9
|
||||
|
||||
#define aal_mc_syscall_ret(uc) (uc)->rax
|
||||
#define ihk_mc_syscall_ret(uc) (uc)->rax
|
||||
|
||||
#define aal_mc_syscall_pc(uc) (uc)->rip
|
||||
#define aal_mc_syscall_sp(uc) (uc)->rsp
|
||||
#define ihk_mc_syscall_pc(uc) (uc)->rip
|
||||
#define ihk_mc_syscall_sp(uc) (uc)->rsp
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef HEADER_X86_COMMON_AAL_IKC_H
|
||||
#define HEADER_X86_COMMON_AAL_IKC_H
|
||||
#ifndef HEADER_X86_COMMON_IHK_IKC_H
|
||||
#define HEADER_X86_COMMON_IHK_IKC_H
|
||||
|
||||
#include <ikc/ihk.h>
|
||||
|
||||
/* manycore side */
|
||||
int aal_mc_ikc_init_first(struct aal_ikc_channel_desc *,
|
||||
aal_ikc_ph_t handler);
|
||||
int ihk_mc_ikc_init_first(struct ihk_ikc_channel_desc *,
|
||||
ihk_ikc_ph_t handler);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ static unsigned long read_perfctr(int counter)
|
||||
return rdpmc(counter);
|
||||
}
|
||||
|
||||
#define aal_mc_mb() asm volatile("mfence" : : : "memory");
|
||||
#define ihk_mc_mb() asm volatile("mfence" : : : "memory");
|
||||
|
||||
struct x86_desc_ptr {
|
||||
uint16_t size;
|
||||
|
||||
@@ -11,7 +11,7 @@ struct x86_cpu_local_variables *locals;
|
||||
void init_processors_local(int max_id)
|
||||
{
|
||||
/* Is contiguous allocating adequate?? */
|
||||
locals = aal_mc_alloc_pages(max_id, 0);
|
||||
locals = ihk_mc_alloc_pages(max_id, 0);
|
||||
memset(locals, 0, PAGE_SIZE * max_id);
|
||||
|
||||
kprintf("locals = %p\n", locals);
|
||||
@@ -30,14 +30,14 @@ static void *get_x86_cpu_local_kstack(int id)
|
||||
|
||||
struct x86_cpu_local_variables *get_x86_this_cpu_local(void)
|
||||
{
|
||||
int id = aal_mc_get_processor_id();
|
||||
int id = ihk_mc_get_processor_id();
|
||||
|
||||
return get_x86_cpu_local_variable(id);
|
||||
}
|
||||
|
||||
void *get_x86_this_cpu_kstack(void)
|
||||
{
|
||||
int id = aal_mc_get_processor_id();
|
||||
int id = ihk_mc_get_processor_id();
|
||||
|
||||
return get_x86_cpu_local_kstack(id);
|
||||
}
|
||||
@@ -52,14 +52,14 @@ static void set_gs_base(void *address)
|
||||
wrmsr(MSR_GS_BASE, (unsigned long)address);
|
||||
}
|
||||
|
||||
static aal_atomic_t last_processor_id = AAL_ATOMIC_INIT(-1);
|
||||
static ihk_atomic_t last_processor_id = IHK_ATOMIC_INIT(-1);
|
||||
|
||||
void assign_processor_id(void)
|
||||
{
|
||||
int id;
|
||||
struct x86_cpu_local_variables *v;
|
||||
|
||||
id = aal_atomic_inc_return(&last_processor_id);
|
||||
id = ihk_atomic_inc_return(&last_processor_id);
|
||||
|
||||
v = get_x86_cpu_local_variable(id);
|
||||
set_gs_base(v);
|
||||
@@ -67,8 +67,8 @@ void assign_processor_id(void)
|
||||
v->processor_id = id;
|
||||
}
|
||||
|
||||
/** AAL **/
|
||||
int aal_mc_get_processor_id(void)
|
||||
/** IHK **/
|
||||
int ihk_mc_get_processor_id(void)
|
||||
{
|
||||
int id;
|
||||
|
||||
@@ -77,7 +77,7 @@ int aal_mc_get_processor_id(void)
|
||||
return id;
|
||||
}
|
||||
|
||||
int aal_mc_get_hardware_processor_id(void)
|
||||
int ihk_mc_get_hardware_processor_id(void)
|
||||
{
|
||||
struct x86_cpu_local_variables *v = get_x86_this_cpu_local();
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
#if 0
|
||||
|
||||
void aal_mc_spinlock_init(aal_spinlock_t *lock)
|
||||
void ihk_mc_spinlock_init(ihk_spinlock_t *lock)
|
||||
{
|
||||
*lock = 0;
|
||||
}
|
||||
|
||||
void aal_mc_spinlock_lock(aal_spinlock_t *lock, unsigned long *flags)
|
||||
void ihk_mc_spinlock_lock(ihk_spinlock_t *lock, unsigned long *flags)
|
||||
{
|
||||
int inc = 0x00010000;
|
||||
int tmp;
|
||||
@@ -26,7 +26,7 @@ void aal_mc_spinlock_lock(aal_spinlock_t *lock, unsigned long *flags)
|
||||
: "+Q" (inc), "+m" (*lock), "=r" (tmp) : : "memory", "cc");
|
||||
}
|
||||
|
||||
void aal_mc_spinlock_unlock(aal_spinlock_t *lock, unsigned long *flags)
|
||||
void ihk_mc_spinlock_unlock(ihk_spinlock_t *lock, unsigned long *flags)
|
||||
{
|
||||
asm volatile ("lock incw %0" : "+m"(*lock) : : "memory", "cc");
|
||||
cpu_restore_interrupt(*flags);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
static char *last_page;
|
||||
extern char _head[], _end[];
|
||||
|
||||
struct aal_mc_pa_ops *pa_ops;
|
||||
struct ihk_mc_pa_ops *pa_ops;
|
||||
|
||||
extern unsigned long x86_kernel_phys_base;
|
||||
|
||||
@@ -32,7 +32,7 @@ void *early_alloc_page(void)
|
||||
return p;
|
||||
}
|
||||
|
||||
void *arch_alloc_page(enum aal_mc_ap_flag flag)
|
||||
void *arch_alloc_page(enum ihk_mc_ap_flag flag)
|
||||
{
|
||||
if (pa_ops)
|
||||
return pa_ops->alloc_page(1, flag);
|
||||
@@ -45,7 +45,7 @@ void arch_free_page(void *ptr)
|
||||
pa_ops->free_page(ptr, 1);
|
||||
}
|
||||
|
||||
void *aal_mc_alloc_pages(int npages, enum aal_mc_ap_flag flag)
|
||||
void *ihk_mc_alloc_pages(int npages, enum ihk_mc_ap_flag flag)
|
||||
{
|
||||
if (pa_ops)
|
||||
return pa_ops->alloc_page(npages, flag);
|
||||
@@ -53,26 +53,26 @@ void *aal_mc_alloc_pages(int npages, enum aal_mc_ap_flag flag)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void aal_mc_free_pages(void *p, int npages)
|
||||
void ihk_mc_free_pages(void *p, int npages)
|
||||
{
|
||||
if (pa_ops)
|
||||
pa_ops->free_page(p, npages);
|
||||
}
|
||||
|
||||
void *aal_mc_allocate(int size, enum aal_mc_ap_flag flag)
|
||||
void *ihk_mc_allocate(int size, enum ihk_mc_ap_flag flag)
|
||||
{
|
||||
if (pa_ops && pa_ops->alloc)
|
||||
return pa_ops->alloc(size, flag);
|
||||
else
|
||||
return aal_mc_alloc_pages(1, flag);
|
||||
return ihk_mc_alloc_pages(1, flag);
|
||||
}
|
||||
|
||||
void aal_mc_free(void *p)
|
||||
void ihk_mc_free(void *p)
|
||||
{
|
||||
if (pa_ops && pa_ops->free)
|
||||
return pa_ops->free(p);
|
||||
else
|
||||
return aal_mc_free_pages(p, 1);
|
||||
return ihk_mc_free_pages(p, 1);
|
||||
}
|
||||
|
||||
void *get_last_early_heap(void)
|
||||
@@ -146,8 +146,8 @@ static void init_normal_area(struct page_table *pt)
|
||||
unsigned long map_start, map_end, phys, pt_phys;
|
||||
int ident_index, virt_index;
|
||||
|
||||
map_start = aal_mc_get_memory_address(AAL_MC_GMA_MAP_START, 0);
|
||||
map_end = aal_mc_get_memory_address(AAL_MC_GMA_MAP_END, 0);
|
||||
map_start = ihk_mc_get_memory_address(IHK_MC_GMA_MAP_START, 0);
|
||||
map_end = ihk_mc_get_memory_address(IHK_MC_GMA_MAP_END, 0);
|
||||
|
||||
kprintf("map_start = %lx, map_end = %lx\n", map_start, map_end);
|
||||
ident_index = map_start >> PTL4_SHIFT;
|
||||
@@ -180,15 +180,15 @@ static struct page_table *__alloc_new_pt(void)
|
||||
*/
|
||||
|
||||
#define ATTR_MASK (PTATTR_WRITABLE | PTATTR_USER | PTATTR_ACTIVE)
|
||||
static unsigned long attr_to_l4attr(enum aal_mc_pt_attribute attr)
|
||||
static unsigned long attr_to_l4attr(enum ihk_mc_pt_attribute attr)
|
||||
{
|
||||
return (attr & ATTR_MASK) | PFL4_PRESENT;
|
||||
}
|
||||
static unsigned long attr_to_l3attr(enum aal_mc_pt_attribute attr)
|
||||
static unsigned long attr_to_l3attr(enum ihk_mc_pt_attribute attr)
|
||||
{
|
||||
return (attr & ATTR_MASK) | PFL3_PRESENT;
|
||||
}
|
||||
static unsigned long attr_to_l2attr(enum aal_mc_pt_attribute attr)
|
||||
static unsigned long attr_to_l2attr(enum ihk_mc_pt_attribute attr)
|
||||
{
|
||||
unsigned long r = (attr & (ATTR_MASK | PTATTR_LARGEPAGE));
|
||||
|
||||
@@ -197,7 +197,7 @@ static unsigned long attr_to_l2attr(enum aal_mc_pt_attribute attr)
|
||||
}
|
||||
return r;
|
||||
}
|
||||
static unsigned long attr_to_l1attr(enum aal_mc_pt_attribute attr)
|
||||
static unsigned long attr_to_l1attr(enum ihk_mc_pt_attribute attr)
|
||||
{
|
||||
if (attr & PTATTR_UNCACHABLE) {
|
||||
return (attr & ATTR_MASK) | PFL1_PWT | PFL1_PWT;
|
||||
@@ -398,7 +398,7 @@ static int __clear_pt_page(struct page_table *pt, void *virt, int largepage)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int aal_mc_pt_virt_to_phys(struct page_table *pt,
|
||||
int ihk_mc_pt_virt_to_phys(struct page_table *pt,
|
||||
void *virt, unsigned long *phys)
|
||||
{
|
||||
int l4idx, l3idx, l2idx, l1idx;
|
||||
@@ -438,7 +438,7 @@ int aal_mc_pt_virt_to_phys(struct page_table *pt,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int aal_mc_pt_print_pte(struct page_table *pt, void *virt)
|
||||
int ihk_mc_pt_print_pte(struct page_table *pt, void *virt)
|
||||
{
|
||||
int l4idx, l3idx, l2idx, l1idx;
|
||||
unsigned long v = (unsigned long)virt;
|
||||
@@ -483,33 +483,33 @@ int aal_mc_pt_print_pte(struct page_table *pt, void *virt)
|
||||
}
|
||||
|
||||
int set_pt_large_page(struct page_table *pt, void *virt, unsigned long phys,
|
||||
enum aal_mc_pt_attribute attr)
|
||||
enum ihk_mc_pt_attribute attr)
|
||||
{
|
||||
return __set_pt_page(pt, virt, phys, attr | PTATTR_LARGEPAGE
|
||||
| PTATTR_ACTIVE);
|
||||
}
|
||||
|
||||
int aal_mc_pt_set_large_page(page_table_t pt, void *virt,
|
||||
unsigned long phys, enum aal_mc_pt_attribute attr)
|
||||
int ihk_mc_pt_set_large_page(page_table_t pt, void *virt,
|
||||
unsigned long phys, enum ihk_mc_pt_attribute attr)
|
||||
{
|
||||
return __set_pt_page(pt, virt, phys, attr | PTATTR_LARGEPAGE
|
||||
| PTATTR_ACTIVE);
|
||||
}
|
||||
|
||||
int aal_mc_pt_set_page(page_table_t pt, void *virt,
|
||||
unsigned long phys, enum aal_mc_pt_attribute attr)
|
||||
int ihk_mc_pt_set_page(page_table_t pt, void *virt,
|
||||
unsigned long phys, enum ihk_mc_pt_attribute attr)
|
||||
{
|
||||
return __set_pt_page(pt, virt, phys, attr | PTATTR_ACTIVE);
|
||||
}
|
||||
|
||||
int aal_mc_pt_prepare_map(page_table_t p, void *virt, unsigned long size,
|
||||
enum aal_mc_pt_prepare_flag flag)
|
||||
int ihk_mc_pt_prepare_map(page_table_t p, void *virt, unsigned long size,
|
||||
enum ihk_mc_pt_prepare_flag flag)
|
||||
{
|
||||
int l4idx, l4e, ret = 0;
|
||||
unsigned long v = (unsigned long)virt;
|
||||
struct page_table *pt = p, *newpt;
|
||||
unsigned long l;
|
||||
enum aal_mc_pt_attribute attr = PTATTR_WRITABLE;
|
||||
enum ihk_mc_pt_attribute attr = PTATTR_WRITABLE;
|
||||
|
||||
if (!pt) {
|
||||
pt = init_pt;
|
||||
@@ -517,7 +517,7 @@ int aal_mc_pt_prepare_map(page_table_t p, void *virt, unsigned long size,
|
||||
|
||||
l4idx = ((v) >> PTL4_SHIFT) & (PT_ENTRIES - 1);
|
||||
|
||||
if (flag == AAL_MC_PT_FIRST_LEVEL) {
|
||||
if (flag == IHK_MC_PT_FIRST_LEVEL) {
|
||||
l4e = ((v + size) >> PTL4_SHIFT) & (PT_ENTRIES - 1);
|
||||
|
||||
for (; l4idx <= l4e; l4idx++) {
|
||||
@@ -545,9 +545,9 @@ int aal_mc_pt_prepare_map(page_table_t p, void *virt, unsigned long size,
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct page_table *aal_mc_pt_create(void)
|
||||
struct page_table *ihk_mc_pt_create(void)
|
||||
{
|
||||
struct page_table *pt = aal_mc_alloc_pages(1, 0);
|
||||
struct page_table *pt = ihk_mc_alloc_pages(1, 0);
|
||||
|
||||
memset(pt->entry, 0, PAGE_SIZE);
|
||||
/* Copy the kernel space */
|
||||
@@ -557,7 +557,7 @@ struct page_table *aal_mc_pt_create(void)
|
||||
return pt;
|
||||
}
|
||||
|
||||
int aal_mc_pt_clear_page(page_table_t pt, void *virt)
|
||||
int ihk_mc_pt_clear_page(page_table_t pt, void *virt)
|
||||
{
|
||||
return __clear_pt_page(pt, virt, 0);
|
||||
}
|
||||
@@ -575,7 +575,7 @@ void load_page_table(struct page_table *pt)
|
||||
asm volatile ("movq %0, %%cr3" : : "r"(pt_addr) : "memory");
|
||||
}
|
||||
|
||||
void aal_mc_load_page_table(struct page_table *pt)
|
||||
void ihk_mc_load_page_table(struct page_table *pt)
|
||||
{
|
||||
load_page_table(pt);
|
||||
}
|
||||
@@ -668,7 +668,7 @@ void init_page_table(void)
|
||||
extern void __reserve_arch_pages(unsigned long, unsigned long,
|
||||
void (*)(unsigned long, unsigned long, int));
|
||||
|
||||
void aal_mc_reserve_arch_pages(unsigned long start, unsigned long end,
|
||||
void ihk_mc_reserve_arch_pages(unsigned long start, unsigned long end,
|
||||
void (*cb)(unsigned long, unsigned long, int))
|
||||
{
|
||||
/* Reserve Text + temporal heap */
|
||||
@@ -681,7 +681,7 @@ void aal_mc_reserve_arch_pages(unsigned long start, unsigned long end,
|
||||
__reserve_arch_pages(start, end, cb);
|
||||
}
|
||||
|
||||
void aal_mc_set_page_allocator(struct aal_mc_pa_ops *ops)
|
||||
void ihk_mc_set_page_allocator(struct ihk_mc_pa_ops *ops)
|
||||
{
|
||||
last_page = NULL;
|
||||
pa_ops = ops;
|
||||
|
||||
@@ -5,29 +5,29 @@
|
||||
#include <string.h>
|
||||
|
||||
extern void arch_set_mikc_queue(void *r, void *w);
|
||||
aal_ikc_ph_t arch_master_channel_packet_handler;
|
||||
ihk_ikc_ph_t arch_master_channel_packet_handler;
|
||||
|
||||
int aal_mc_ikc_init_first_local(struct aal_ikc_channel_desc *channel,
|
||||
aal_ikc_ph_t packet_handler)
|
||||
int ihk_mc_ikc_init_first_local(struct ihk_ikc_channel_desc *channel,
|
||||
ihk_ikc_ph_t packet_handler)
|
||||
{
|
||||
struct aal_ikc_queue_head *rq, *wq;
|
||||
struct ihk_ikc_queue_head *rq, *wq;
|
||||
|
||||
aal_ikc_system_init(NULL);
|
||||
ihk_ikc_system_init(NULL);
|
||||
|
||||
memset(channel, 0, sizeof(struct aal_ikc_channel_desc));
|
||||
memset(channel, 0, sizeof(struct ihk_ikc_channel_desc));
|
||||
|
||||
/* Place both sides in this side */
|
||||
rq = arch_alloc_page(0);
|
||||
wq = arch_alloc_page(0);
|
||||
|
||||
aal_ikc_init_queue(rq, 0, 0, PAGE_SIZE, MASTER_IKCQ_PKTSIZE);
|
||||
aal_ikc_init_queue(wq, 0, 0, PAGE_SIZE, MASTER_IKCQ_PKTSIZE);
|
||||
ihk_ikc_init_queue(rq, 0, 0, PAGE_SIZE, MASTER_IKCQ_PKTSIZE);
|
||||
ihk_ikc_init_queue(wq, 0, 0, PAGE_SIZE, MASTER_IKCQ_PKTSIZE);
|
||||
|
||||
arch_master_channel_packet_handler = packet_handler;
|
||||
|
||||
aal_ikc_init_desc(channel, IKC_OS_HOST, 0, rq, wq,
|
||||
aal_ikc_master_channel_packet_handler);
|
||||
aal_ikc_enable_channel(channel);
|
||||
ihk_ikc_init_desc(channel, IKC_OS_HOST, 0, rq, wq,
|
||||
ihk_ikc_master_channel_packet_handler);
|
||||
ihk_ikc_enable_channel(channel);
|
||||
|
||||
/* Set boot parameter */
|
||||
arch_set_mikc_queue(rq, wq);
|
||||
|
||||
@@ -48,7 +48,7 @@ static int set_perfctr_x86(int counter, int event, int mask, int inv, int count,
|
||||
CVAL2(event, mask, inv, count));
|
||||
}
|
||||
|
||||
int aal_mc_perfctr_init(int counter, enum aal_perfctr_type type, int mode)
|
||||
int ihk_mc_perfctr_init(int counter, enum ihk_perfctr_type type, int mode)
|
||||
{
|
||||
if (counter < 0 || counter >= X86_IA32_NUM_PERF_COUNTERS) {
|
||||
return -EINVAL;
|
||||
@@ -67,7 +67,7 @@ int aal_mc_perfctr_init(int counter, enum aal_perfctr_type type, int mode)
|
||||
extern void x86_march_perfctr_start(unsigned long counter_mask);
|
||||
#endif
|
||||
|
||||
int aal_mc_perfctr_start(unsigned long counter_mask)
|
||||
int ihk_mc_perfctr_start(unsigned long counter_mask)
|
||||
{
|
||||
unsigned int value = 0;
|
||||
|
||||
@@ -82,7 +82,7 @@ int aal_mc_perfctr_start(unsigned long counter_mask)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int aal_mc_perfctr_stop(unsigned long counter_mask)
|
||||
int ihk_mc_perfctr_stop(unsigned long counter_mask)
|
||||
{
|
||||
unsigned int value;
|
||||
|
||||
@@ -94,7 +94,7 @@ int aal_mc_perfctr_stop(unsigned long counter_mask)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int aal_mc_perfctr_reset(int counter)
|
||||
int ihk_mc_perfctr_reset(int counter)
|
||||
{
|
||||
if (counter < 0 || counter >= X86_IA32_NUM_PERF_COUNTERS) {
|
||||
return -EINVAL;
|
||||
@@ -105,7 +105,7 @@ int aal_mc_perfctr_reset(int counter)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int aal_mc_perfctr_read_mask(unsigned long counter_mask, unsigned long *value)
|
||||
int ihk_mc_perfctr_read_mask(unsigned long counter_mask, unsigned long *value)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
@@ -118,7 +118,7 @@ int aal_mc_perfctr_read_mask(unsigned long counter_mask, unsigned long *value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long aal_mc_perfctr_read(int counter)
|
||||
unsigned long ihk_mc_perfctr_read(int counter)
|
||||
{
|
||||
if (counter < 0 || counter >= X86_IA32_NUM_PERF_COUNTERS) {
|
||||
return -EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user