[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH 10/11] cpu: Variablennamen die Register wiederspiegeln umbenannt
* Beispiel: rax und eax in ax umbenannt
Signed-off-by: Andreas Freimuth <m.nemo@xxxxxxx>
--HG--
extra : rebase_source : 59882b153d42cfac24a0dd15b25fe28d70af0ced
---
src/kernel2/include/arch/amd64/cpu.h | 20 ++++++------
src/kernel2/include/arch/i386/cpu.h | 22 +++++++-------
src/kernel2/src/arch/amd64/cpu.c | 40 ++++++++++++------------
src/kernel2/src/arch/i386/cpu.c | 22 +++++++-------
src/kernel2/src/arch/i386/debug.c | 2 +-
src/kernel2/src/arch/i386/syscall.c | 22 +++++++-------
src/kernel2/src/arch/i386/vm86.c | 56 +++++++++++++++++-----------------
src/kernel2/src/interrupts/im.c | 16 +++++-----
src/kernel2/src/syscalls/rpc.c | 44 +++++++++++++-------------
src/kernel2/src/tasks/modules.c | 2 +-
src/kernel2/src/tasks/thread.c | 17 ++++------
11 files changed, 130 insertions(+), 133 deletions(-)
diff --git a/src/kernel2/include/arch/amd64/cpu.h b/src/kernel2/include/arch/amd64/cpu.h
index bd60f26..67fb194 100644
--- a/src/kernel2/include/arch/amd64/cpu.h
+++ b/src/kernel2/include/arch/amd64/cpu.h
@@ -48,25 +48,25 @@ typedef struct {
} cpu_t;
typedef struct {
- uint64_t rbx;
- uint64_t rcx;
- uint64_t rdx;
- uint64_t rsi;
- uint64_t rdi;
- uint64_t rbp;
+ uint64_t bx;
+ uint64_t cx;
+ uint64_t dx;
+ uint64_t si;
+ uint64_t di;
+ uint64_t bp;
uint64_t r[8];
uint64_t ds;
uint64_t es;
- uint64_t rax;
+ uint64_t ax;
uint64_t interrupt_number;
uint64_t error_code;
- uint64_t rip;
+ uint64_t ip;
uint64_t cs;
- uint64_t rflags;
- uint64_t rsp;
+ uint64_t flags;
+ uint64_t sp;
uint64_t ss;
uint64_t fs, gs;
diff --git a/src/kernel2/include/arch/i386/cpu.h b/src/kernel2/include/arch/i386/cpu.h
index 9b9acbd..666a7a7 100644
--- a/src/kernel2/include/arch/i386/cpu.h
+++ b/src/kernel2/include/arch/i386/cpu.h
@@ -44,26 +44,26 @@
typedef uint8_t cpu_id_t;
typedef struct {
- uint32_t ebx;
- uint32_t ecx;
- uint32_t edx;
- uint32_t esi;
- uint32_t edi;
- uint32_t ebp;
-
+ uint32_t bx;
+ uint32_t cx;
+ uint32_t dx;
+ uint32_t si;
+ uint32_t di;
+ uint32_t bp;
+
uint32_t ds;
uint32_t es;
uint32_t fs;
uint32_t gs;
- uint32_t eax;
+ uint32_t ax;
uint32_t interrupt_number;
uint32_t error_code;
- uint32_t eip;
+ uint32_t ip;
uint32_t cs;
- uint32_t eflags;
- uint32_t esp;
+ uint32_t flags;
+ uint32_t sp;
uint32_t ss;
} __attribute__((packed)) interrupt_stack_frame_t;
diff --git a/src/kernel2/src/arch/amd64/cpu.c b/src/kernel2/src/arch/amd64/cpu.c
index b9f2b7d..6634c36 100644
--- a/src/kernel2/src/arch/amd64/cpu.c
+++ b/src/kernel2/src/arch/amd64/cpu.c
@@ -124,24 +124,24 @@ uint64_t cpu_read_msr(uint32_t msr)
void cpu_dump(machine_state_t* machine_state)
{
kprintf("RAX=0x%08x%08x RBX=0x%08x%08x RCX=0x%08x%08x\n",
- (uint32_t) (machine_state->rax >> 32),
- (uint32_t) (machine_state->rax & 0xFFFFFFFF),
- (uint32_t) (machine_state->rbx >> 32),
- (uint32_t) (machine_state->rbx & 0xFFFFFFFF),
- (uint32_t) (machine_state->rcx >> 32),
- (uint32_t) (machine_state->rcx & 0xFFFFFFFF));
+ (uint32_t) (machine_state->ax >> 32),
+ (uint32_t) (machine_state->ax & 0xFFFFFFFF),
+ (uint32_t) (machine_state->bx >> 32),
+ (uint32_t) (machine_state->bx & 0xFFFFFFFF),
+ (uint32_t) (machine_state->cx >> 32),
+ (uint32_t) (machine_state->cx & 0xFFFFFFFF));
kprintf("RDX=0x%08x%08x RSI=0x%08x%08x RDI=0x%08x%08x\n",
- (uint32_t) (machine_state->rdx >> 32),
- (uint32_t) (machine_state->rdx & 0xFFFFFFFF),
- (uint32_t) (machine_state->rsi >> 32),
- (uint32_t) (machine_state->rsi & 0xFFFFFFFF),
- (uint32_t) (machine_state->rdi >> 32),
- (uint32_t) (machine_state->rdi & 0xFFFFFFFF));
+ (uint32_t) (machine_state->dx >> 32),
+ (uint32_t) (machine_state->dx & 0xFFFFFFFF),
+ (uint32_t) (machine_state->si >> 32),
+ (uint32_t) (machine_state->si & 0xFFFFFFFF),
+ (uint32_t) (machine_state->di >> 32),
+ (uint32_t) (machine_state->di & 0xFFFFFFFF));
kprintf("RSP=0x%08x%08x RBP=0x%08x%08x R08=0x%08x%08x\n",
- (uint32_t) (machine_state->rsp >> 32),
- (uint32_t) (machine_state->rsp & 0xFFFFFFFF),
- (uint32_t) (machine_state->rbp >> 32),
- (uint32_t) (machine_state->rbp & 0xFFFFFFFF),
+ (uint32_t) (machine_state->sp >> 32),
+ (uint32_t) (machine_state->sp & 0xFFFFFFFF),
+ (uint32_t) (machine_state->bp >> 32),
+ (uint32_t) (machine_state->bp & 0xFFFFFFFF),
(uint32_t) (machine_state->r[0] >> 32),
(uint32_t) (machine_state->r[0] & 0xFFFFFFFF));
kprintf("R09=0x%08x%08x R10=0x%08x%08x R11=0x%08x%08x\n",
@@ -161,10 +161,10 @@ void cpu_dump(machine_state_t* machine_state)
kprintf("R15=0x%08x%08x RIP=0x%08x%08x RFL=0x%08x%08x\n",
(uint32_t) (machine_state->r[7] >> 32),
(uint32_t) (machine_state->r[7] & 0xFFFFFFFF),
- (uint32_t) (machine_state->rip >> 32),
- (uint32_t) (machine_state->rip & 0xFFFFFFFF),
- (uint32_t) (machine_state->rflags >> 32),
- (uint32_t) (machine_state->rflags & 0xFFFFFFFF));
+ (uint32_t) (machine_state->ip >> 32),
+ (uint32_t) (machine_state->ip & 0xFFFFFFFF),
+ (uint32_t) (machine_state->flags >> 32),
+ (uint32_t) (machine_state->flags & 0xFFFFFFFF));
kprintf("CS=0x%04x DS=0x%04x ES=0x%04x FS=0x%04x GS=0x%04x "
"SS=0x%04x\n",
diff --git a/src/kernel2/src/arch/i386/cpu.c b/src/kernel2/src/arch/i386/cpu.c
index 102c585..e3701e9 100644
--- a/src/kernel2/src/arch/i386/cpu.c
+++ b/src/kernel2/src/arch/i386/cpu.c
@@ -132,19 +132,19 @@ uint64_t cpu_read_msr(uint32_t msr)
void cpu_dump(machine_state_t* machine_state)
{
// TODO: ID der CPU
- kprintf("EAX=0x%016x EBX=0x%016x ECX=0x%016x\n", machine_state->eax,
- machine_state->ebx, machine_state->ecx);
- kprintf("EDX=0x%016x ESI=0x%016x EDI=0x%016x\n", machine_state->edx,
- machine_state->esi, machine_state->esi);
- kprintf("ESP=0x%016x EBP=0x%016x RIP=0x%016x\n", machine_state->esp,
- machine_state->ebp, machine_state->eip);
+ kprintf("EAX=0x%016x EBX=0x%016x ECX=0x%016x\n", machine_state->ax,
+ machine_state->bx, machine_state->cx);
+ kprintf("EDX=0x%016x ESI=0x%016x EDI=0x%016x\n", machine_state->dx,
+ machine_state->si, machine_state->si);
+ kprintf("ESP=0x%016x EBP=0x%016x RIP=0x%016x\n", machine_state->sp,
+ machine_state->bp, machine_state->ip);
uint32_t cr2, cr3;
asm volatile("movl %%cr2, %0;"
"movl %%cr3, %1;"
: "=r"(cr2), "=r"(cr3));
- kprintf("EFL=0x%016x CR2=0x%016x CR3=0x%016x\n", machine_state->eflags,
+ kprintf("EFL=0x%016x CR2=0x%016x CR3=0x%016x\n", machine_state->flags,
cr2, cr3);
kprintf("CS=0x%04x DS=0x%04x ES=0x%04x FS=0x%04x GS=0x%04x "
@@ -162,7 +162,7 @@ void cpu_prepare_current_task(void)
interrupt_stack_frame_t* user_isf = thread->user_isf;
cpu_get_current()->tss.ss0 = 2 << 3;
- if (user_isf->eflags & 0x20000) {
+ if (user_isf->flags & 0x20000) {
cpu_get_current()->tss.esp0 =
(uintptr_t) user_isf + sizeof(struct vm86_isf);
} else {
@@ -186,9 +186,9 @@ int arch_init_ppb(pm_process_t* process, int shm_id, void* ptr, size_t size)
pm_thread_t* thread = list_get_element_at(process->threads, 0);
interrupt_stack_frame_t* user_isf = thread->user_isf;
- user_isf->eax = shm_id;
- user_isf->ebx = (uintptr_t) ptr;
- user_isf->ecx = size;
+ user_isf->ax = shm_id;
+ user_isf->bx = (uintptr_t) ptr;
+ user_isf->cx = size;
return 0;
}
diff --git a/src/kernel2/src/arch/i386/debug.c b/src/kernel2/src/arch/i386/debug.c
index 6d4ef54..173ad4f 100644
--- a/src/kernel2/src/arch/i386/debug.c
+++ b/src/kernel2/src/arch/i386/debug.c
@@ -208,7 +208,7 @@ void print_tasks_backtrace(void)
for (j = 0; (thread = list_get_element_at(process->threads, j)); j++) {
kprintf("Thread %d: Status %d\n", j, thread->status);
isf = (machine_state_t*) thread->kernel_stack;
- stack_backtrace(isf->ebp, isf->eip);
+ stack_backtrace(isf->bp, isf->ip);
}
}
diff --git a/src/kernel2/src/arch/i386/syscall.c b/src/kernel2/src/arch/i386/syscall.c
index 7f4a45e..ae83e56 100644
--- a/src/kernel2/src/arch/i386/syscall.c
+++ b/src/kernel2/src/arch/i386/syscall.c
@@ -62,8 +62,8 @@ void syscall_arch(machine_state_t* isf)
// "Kompatibel" zu kernel1
void syscall_arch(machine_state_t* isf)
{
- uint32_t* stack = (uint32_t*) isf->esp;
- uint32_t number = isf->eax;
+ uint32_t* stack = (uint32_t*) isf->sp;
+ uint32_t number = isf->ax;
//kprintf("Syscall %d", number);
if ((number >= SYSCALL_MAX) || (syscalls[number].handler == NULL)) {
@@ -76,13 +76,13 @@ void syscall_arch(machine_state_t* isf)
// FIXME Das ist alles nur bedingt ueberzeugend...
if (handler == syscall_fastrpc) {
- pid_t callee_pid = *((uint32_t*) isf->esp);
- uint32_t metadata_size = *((uint32_t*) (isf->esp + 4));
- void* metadata = *((void**) (isf->esp + 8));
- uint32_t data_size = *((uint32_t*) (isf->esp + 12));
- void* data = *((void**) (isf->esp + 16));
+ pid_t callee_pid = *((uint32_t*) isf->sp);
+ uint32_t metadata_size = *((uint32_t*) (isf->sp + 4));
+ void* metadata = *((void**) (isf->sp + 8));
+ uint32_t data_size = *((uint32_t*) (isf->sp + 12));
+ void* data = *((void**) (isf->sp + 16));
- isf->eax = syscall_fastrpc(
+ isf->ax = syscall_fastrpc(
callee_pid,
metadata_size, metadata,
data_size, data);
@@ -93,7 +93,7 @@ void syscall_arch(machine_state_t* isf)
} else if (handler == syscall_mem_info) {
- syscall_mem_info(&isf->eax, &isf->edx);
+ syscall_mem_info(&isf->ax, &isf->dx);
} else {
uint32_t eax, edx;
@@ -110,9 +110,9 @@ void syscall_arch(machine_state_t* isf)
: "S" (stack), "r" (handler), "c" (syscalls[number].arg_count * 4)
: "edi", "ebx", "memory");
- isf->eax = eax;
+ isf->ax = eax;
if (handler == syscall_get_tick_count) {
- isf->edx = edx;
+ isf->dx = edx;
}
}
}
diff --git a/src/kernel2/src/arch/i386/vm86.c b/src/kernel2/src/arch/i386/vm86.c
index 3594378..7752585 100644
--- a/src/kernel2/src/arch/i386/vm86.c
+++ b/src/kernel2/src/arch/i386/vm86.c
@@ -128,18 +128,18 @@ static int create_vm86_task(int intr, vm86_regs_t* regs, uintptr_t stack)
// Register setzen
- isf->eflags = 0x20202;
+ isf->flags = 0x20202;
isf->cs = ivt_entry[1];
isf->ss = stack / 16;
- isf->eax = regs->ax;
- isf->ebx = regs->bx;
- isf->ecx = regs->cx;
- isf->edx = regs->dx;
- isf->esi = regs->si;
- isf->edi = regs->di;
- isf->esp = PAGE_SIZE - 16;
- isf->ebp = 0;
+ isf->ax = regs->ax;
+ isf->bx = regs->bx;
+ isf->cx = regs->cx;
+ isf->dx = regs->dx;
+ isf->si = regs->si;
+ isf->di = regs->di;
+ isf->sp = PAGE_SIZE - 16;
+ isf->bp = 0;
// Segmentregister setzen
// Dabei wird der bisherige Kernelstack in die temporaere
@@ -310,12 +310,12 @@ static void destroy_vm86_task(interrupt_stack_frame_t* isf)
// Register sichern
vm86_regs_t* regs = vm86_status.regs;
- regs->ax = isf->eax;
- regs->bx = isf->ebx;
- regs->cx = isf->ecx;
- regs->dx = isf->edx;
- regs->si = isf->esi;
- regs->di = isf->edi;
+ regs->ax = isf->ax;
+ regs->bx = isf->bx;
+ regs->cx = isf->cx;
+ regs->dx = isf->dx;
+ regs->si = isf->si;
+ regs->di = isf->di;
regs->ds = visf->ds;
regs->es = visf->es;
@@ -327,15 +327,15 @@ static void destroy_vm86_task(interrupt_stack_frame_t* isf)
/** Pusht einen Wert auf den Stack des VM86-Tasks */
static inline void emulator_push(interrupt_stack_frame_t* isf, uint16_t value)
{
- isf->esp -= 2;
- ((uint16_t*)(isf->esp + (isf->ss << 4)))[0] = value;
+ isf->sp -= 2;
+ ((uint16_t*)(isf->sp + (isf->ss << 4)))[0] = value;
}
/** Popt einen Wert vom Stack des VM86-Tasks */
static inline uint16_t emulator_pop(interrupt_stack_frame_t* isf)
{
- uint16_t res = ((uint16_t*)(isf->esp + (isf->ss << 4)))[0];
- isf->esp += 2;
+ uint16_t res = ((uint16_t*)(isf->sp + (isf->ss << 4)))[0];
+ isf->sp += 2;
return res;
}
@@ -357,19 +357,19 @@ int vm86_exception(interrupt_stack_frame_t* isf)
}
// Ein toller Emulator fuer privilegierte Instruktionen
- uint8_t* ops = (uint8_t*)(isf->eip + (isf->cs << 4));
+ uint8_t* ops = (uint8_t*)(isf->ip + (isf->cs << 4));
switch (ops[0]) {
case 0x9c: /* pushf */
- emulator_push(isf, isf->eflags);
- isf->eip++;
+ emulator_push(isf, isf->flags);
+ isf->ip++;
break;
case 0x9d: /* popf */
// So tun, als würden wir die EFLAGS wiederherstellen.
// Das hier ist wohl alles andere als korrekt, aber funzt erstmal.
emulator_pop(isf);
- isf->eip++;
+ isf->ip++;
break;
case 0xcd: /* int */
@@ -377,11 +377,11 @@ int vm86_exception(interrupt_stack_frame_t* isf)
uint16_t intr = ops[1] & 0xff;
uint16_t* ivt_entry = bios_data.ivt[intr];
- emulator_push(isf, isf->eip + 2);
+ emulator_push(isf, isf->ip + 2);
emulator_push(isf, isf->cs);
- emulator_push(isf, isf->eflags);
+ emulator_push(isf, isf->flags);
- isf->eip = ivt_entry[0];
+ isf->ip = ivt_entry[0];
isf->cs = ivt_entry[1];
break;
}
@@ -389,7 +389,7 @@ int vm86_exception(interrupt_stack_frame_t* isf)
case 0xcf: /* iret */
// Wenn es das finale iret ist, koennen wir den VM86-Task beenden
- if (isf->esp == PAGE_SIZE - 16) {
+ if (isf->sp == PAGE_SIZE - 16) {
destroy_vm86_task(isf);
return 1;
}
@@ -397,7 +397,7 @@ int vm86_exception(interrupt_stack_frame_t* isf)
// Ansonsten muss es ganz normal emuliert werden
emulator_pop(isf);
isf->cs = emulator_pop(isf);
- isf->eip = emulator_pop(isf);
+ isf->ip = emulator_pop(isf);
break;
default:
diff --git a/src/kernel2/src/interrupts/im.c b/src/kernel2/src/interrupts/im.c
index d266959..7ab6a89 100644
--- a/src/kernel2/src/interrupts/im.c
+++ b/src/kernel2/src/interrupts/im.c
@@ -75,7 +75,7 @@ static void handle_exception(interrupt_stack_frame_t* isf, uint8_t int_num)
#if CONFIG_ARCH == ARCH_I386
// Pruefen, ob ein VM86-Task die Exception ausgeloest hat
// Falls ja lassen wir sie vom VM86-Code behandeln, wenn er kann
- if (isf->eflags & 0x20000) {
+ if (isf->flags & 0x20000) {
if (vm86_exception(isf)) {
return;
}
@@ -96,7 +96,7 @@ static void handle_exception(interrupt_stack_frame_t* isf, uint8_t int_num)
if (int_num == 0x0e) {
// Ueberprüfen ob der Pagefault durch einen Stackoverflow
// hervorgerufen wurde. Falls ja: Stack vergroessern und weitermachen
- if ((cr2 <= isf->esp + 0x800) && (cr2 >= isf->esp - 0x20)
+ if ((cr2 <= isf->sp + 0x800) && (cr2 >= isf->sp - 0x20)
&& (current_thread != NULL)
&& ((void*) cr2 >= current_thread->user_stack_bottom - 0x1000000)
&& ((void*) cr2 < current_thread->user_stack_bottom))
@@ -118,11 +118,11 @@ static void handle_exception(interrupt_stack_frame_t* isf, uint8_t int_num)
// Ein Stacktrace duerfen wir nur ausgeben, wenn kein Pagefault wegen
// dem Stack aufgetreten ist!
- if (!((cr2 < isf->esp + 800) && (cr2 >= isf->esp -0x20))) {
+ if (!((cr2 < isf->sp + 800) && (cr2 >= isf->sp -0x20))) {
// Und fuer VM86 muessten wir wenigstens noch das Segment
// beruecksichtigen, aber eigentlich brauchen wir ihn da gar nicht
- if ((isf->eflags & 0x20000) == 0) {
- stack_backtrace(isf->ebp, isf->eip);
+ if ((isf->flags & 0x20000) == 0) {
+ stack_backtrace(isf->bp, isf->ip);
}
}
@@ -156,7 +156,7 @@ interrupt_stack_frame_t* im_handler(interrupt_stack_frame_t* isf)
interrupt_stack_frame_t* new_isf = isf;
uintptr_t isf_addr = (uintptr_t) isf;
#ifndef CONFIG_RELEASE_VERSION
- uint32_t eax = isf->eax;
+ uint32_t ax = isf->ax;
#endif
if ((isf_addr < (uintptr_t) thread->kernel_stack_bottom) ||
@@ -168,7 +168,7 @@ interrupt_stack_frame_t* im_handler(interrupt_stack_frame_t* isf)
}
// Wenn der Int aus dem Userspace kommt, legen wir den zugehoerigen ISF ab
- if ((isf->cs & 0x3) || (isf->eflags & 0x20000)) {
+ if ((isf->cs & 0x3) || (isf->flags & 0x20000)) {
thread->user_isf = isf;
}
@@ -221,7 +221,7 @@ interrupt_stack_frame_t* im_handler(interrupt_stack_frame_t* isf)
if (thread->status != PM_STATUS_RUNNING) {
panic("Aktiver Task hat nicht PM_STATUS_RUNNING: "
"PID %d, int %x, eax = %d\n",
- thread->process->pid, int_num, eax);
+ thread->process->pid, int_num, ax);
}
#endif
diff --git a/src/kernel2/src/syscalls/rpc.c b/src/kernel2/src/syscalls/rpc.c
index 382c882..0d36e72 100644
--- a/src/kernel2/src/syscalls/rpc.c
+++ b/src/kernel2/src/syscalls/rpc.c
@@ -48,12 +48,12 @@
#include "im.h"
typedef struct {
- uintptr_t old_eip;
- uintptr_t old_esp;
+ uintptr_t old_ip;
+ uintptr_t old_sp;
// FIXME Das tut nur fuer i386...
- uint32_t eflags;
- uint32_t eax;
+ uint32_t flags;
+ uint32_t ax;
uint8_t reenable_irq;
@@ -80,12 +80,12 @@ static void adjust_stack_size(pm_thread_t* callee,
{
// Falls der Stack nicht ausreicht, vergrößern
size_t pages_count = ((rounded_data_size + PAGE_SIZE - 1) / PAGE_SIZE);
- if ((rounded_data_size % PAGE_SIZE) > (callee_isf->esp % PAGE_SIZE)) {
+ if ((rounded_data_size % PAGE_SIZE) > (callee_isf->sp % PAGE_SIZE)) {
pages_count++;
}
if(mmc_resolve(&callee->process->context,
- (vaddr_t) callee_isf->esp - rounded_data_size) == (paddr_t) NULL)
+ (vaddr_t) callee_isf->sp - rounded_data_size) == (paddr_t) NULL)
{
// TODO Das könnte bis zu (pages_count - 1) Pages zu viel reservieren
increase_user_stack_size(callee, pages_count);
@@ -208,11 +208,11 @@ int do_fastrpc(pid_t callee_pid, size_t metadata_size, void* metadata,
interrupt_stack_frame_t* callee_isf = callee->user_isf;
rpc_t* rpc = malloc(sizeof(rpc_t));
- rpc->old_eip = callee_isf->eip;
- rpc->old_esp = callee_isf->esp;
- rpc->eax = callee_isf->eax;
- rpc->eflags = callee_isf->eflags;
- rpc->caller = current_thread;
+ rpc->old_ip = callee_isf->ip;
+ rpc->old_sp = callee_isf->sp;
+ rpc->ax = callee_isf->ax;
+ rpc->flags = callee_isf->flags;
+ rpc->caller = current_thread;
if ((callee == current_thread) && syscall) {
// Bei einem Self-RPC, der ein Syscall war (kein kernelinterner Aufruf
@@ -220,7 +220,7 @@ int do_fastrpc(pid_t callee_pid, size_t metadata_size, void* metadata,
// des RPC-Syscalls in eax stehen. Ein IRQ erscheint auch
// als Self-RPC, darf aber eax nicht kaputt machen, da dort kein
// Rueckgabewert erwartet wird, sondern der vorherige Wert.
- rpc->eax = 0;
+ rpc->ax = 0;
}
rpc->reenable_irq = 0;
@@ -237,16 +237,16 @@ int do_fastrpc(pid_t callee_pid, size_t metadata_size, void* metadata,
// Dazu wird der Stack des aufgerufenen Tasks temporaer gemappt
adjust_stack_size(callee, callee_isf, rounded_data_size);
- callee_isf->esp -= rounded_data_size;
+ callee_isf->sp -= rounded_data_size;
void* first_stack_page = mmc_automap_user(
&mmc_current_context(),
&callee->process->context,
- (vaddr_t) PAGE_ALIGN_ROUND_DOWN(callee_isf->esp),
- NUM_PAGES(rounded_data_size + ((uintptr_t) callee_isf->esp % PAGE_SIZE)),
+ (vaddr_t) PAGE_ALIGN_ROUND_DOWN(callee_isf->sp),
+ NUM_PAGES(rounded_data_size + ((uintptr_t) callee_isf->sp % PAGE_SIZE)),
KERNEL_MEM_START, KERNEL_MEM_END,
MM_FLAGS_KERNEL_DATA);
- void* stack = first_stack_page + ((uintptr_t) callee_isf->esp % PAGE_SIZE);
+ void* stack = first_stack_page + ((uintptr_t) callee_isf->sp % PAGE_SIZE);
((uint32_t*) stack)[0] = data_size + metadata_size;
((uint32_t*) stack)[1] = current_process->pid;
@@ -266,7 +266,7 @@ int do_fastrpc(pid_t callee_pid, size_t metadata_size, void* metadata,
// Zum RPC-Handler springen
- callee_isf->eip = (uintptr_t) callee->process->rpc_handler;
+ callee_isf->ip = (uintptr_t) callee->process->rpc_handler;
// Temporaere Mappings wieder aufheben
mmc_unmap(&mmc_current_context(), first_stack_page,
@@ -355,7 +355,7 @@ void syscall_fastrpc_ret(void)
if (rpc == NULL) {
#if 0
if(debug_test_flag(DEBUG_FLAG_STACK_BACKTRACE)) {
- stack_backtrace_ebp(callee_isf->ebp, callee_isf->eip);
+ stack_backtrace_ebp(callee_isf->ebp, callee_isf->ip);
}
#endif
panic("Unerwartete Rueckkehr vom RPC-Handler\n");
@@ -364,10 +364,10 @@ void syscall_fastrpc_ret(void)
}
// Wiederherstellen der Register
- callee_isf->eip = rpc->old_eip;
- callee_isf->esp = rpc->old_esp;
- callee_isf->eax = rpc->eax;
- callee_isf->eflags = rpc->eflags;
+ callee_isf->ip = rpc->old_ip;
+ callee_isf->sp = rpc->old_sp;
+ callee_isf->ax = rpc->ax;
+ callee_isf->flags = rpc->flags;
// kprintf("[%d => %d] RPC fertig.\n",
// rpc->caller->process->pid,
diff --git a/src/kernel2/src/tasks/modules.c b/src/kernel2/src/tasks/modules.c
index f5a839f..84f3783 100644
--- a/src/kernel2/src/tasks/modules.c
+++ b/src/kernel2/src/tasks/modules.c
@@ -177,7 +177,7 @@ void load_multiboot_modules(struct multiboot_info* multiboot_info)
interrupt_stack_frame_t* init_isf = (interrupt_stack_frame_t*)
init_thread->kernel_stack;
- init_isf->esp -= 8;
+ init_isf->sp -= 8;
// Das unterste dword auf der Page mit der Liste beinhaltet die
// Anzahl der Module
diff --git a/src/kernel2/src/tasks/thread.c b/src/kernel2/src/tasks/thread.c
index 618d369..7521cb6 100644
--- a/src/kernel2/src/tasks/thread.c
+++ b/src/kernel2/src/tasks/thread.c
@@ -85,31 +85,28 @@ pm_thread_t* pm_thread_create(pm_process_t* process, vaddr_t entry)
memset(isf, 0, sizeof(interrupt_stack_frame_t));
#if CONFIG_ARCH == ARCH_I386
- isf->esp = (uint32_t) process->next_stack;
- isf->eip = (uint32_t) entry;
-
// Flags: Interrupts aktivieren, und PL fuer IO-Operationen auf 3
// setzen.
- isf->eflags = 0x0202;
-
+ isf->flags = 0x0202;
+
isf->cs = 0x1B;
isf->ds = 0x23;
isf->es = 0x23;
isf->fs = 0x23;
isf->gs = 0x23;
isf->ss = 0x23;
- #else
- isf->rsp = (uint64_t) process->next_stack;
- isf->rip = (uint64_t) entry;
#endif
-
+
+ isf->sp = (uintptr_t) process->next_stack;
+ isf->ip = (uintptr_t) entry;
+
process->next_stack = (vaddr_t) ((uintptr_t) process->next_stack -
USER_STACK_SIZE);
// Page fuer den Userspace-Stack allozieren
paddr_t stack_phys = pmm_alloc(NUM_PAGES(USER_STACK_SIZE));
- thread->user_stack_bottom = (vaddr_t) (isf->esp - USER_STACK_SIZE);
+ thread->user_stack_bottom = (vaddr_t) (isf->sp - USER_STACK_SIZE);
mmc_map(&process->context, thread->user_stack_bottom,
stack_phys, MM_FLAGS_USER_DATA, NUM_PAGES(USER_STACK_SIZE));
--
1.7.3.4