1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Rename useresp to esp and userrsp to rsp.

This commit is contained in:
Jonas 'Sortie' Termansen 2014-02-12 22:35:00 +01:00
parent 8c00a4145c
commit e941ff0430
8 changed files with 46 additions and 46 deletions

View file

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2013.
Copyright(C) Jonas 'Sortie' Termansen 2013, 2014.
This file is part of Sortix.
@ -463,7 +463,7 @@ int main_rs(int /*argc*/, char* /*argv*/[])
Print("rdx=0x%lx, ", regs.rdx);
Print("rdi=0x%lx, ", regs.rdi);
Print("rsi=0x%lx, ", regs.rsi);
Print("rsp=0x%lx, ", regs.userrsp);
Print("rsp=0x%lx, ", regs.rsp);
Print("rbp=0x%lx, ", regs.rbp);
Print("r8=0x%lx, ", regs.r8);
Print("r9=0x%lx, ", regs.r9);
@ -490,7 +490,7 @@ int main_rs(int /*argc*/, char* /*argv*/[])
Print("edx=0x%lx, ", regs.edx);
Print("edi=0x%lx, ", regs.edi);
Print("esi=0x%lx, ", regs.esi);
Print("esp=0x%lx, ", regs.useresp);
Print("esp=0x%lx, ", regs.esp);
Print("ebp=0x%lx, ", regs.ebp);
Print("eip=0x%lx, ", regs.eip);
Print("eflags=0x%lx, ", regs.eflags);

View file

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014.
This file is part of Sortix.
@ -78,9 +78,9 @@ struct InterruptRegisters
{
uint32_t signal_pending, kerrno, cr2;
uint32_t ds; // Data segment selector
uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax; // Pushed by pusha.
uint32_t edi, esi, ebp, not_esp, ebx, edx, ecx, eax; // Pushed by pusha.
uint32_t int_no, err_code; // Interrupt number and error code (if applicable)
uint32_t eip, cs, eflags, useresp, ss; // Pushed by the processor automatically.
uint32_t eip, cs, eflags, esp, ss; // Pushed by the processor automatically.
public:
void LogRegisters() const;
@ -97,10 +97,10 @@ struct InterruptRegisters
{
uint64_t signal_pending, kerrno, cr2;
uint64_t ds; // Data segment selector
uint64_t rdi, rsi, rbp, rsp, rbx, rdx, rcx, rax;
uint64_t rdi, rsi, rbp, not_rsp, rbx, rdx, rcx, rax;
uint64_t r8, r9, r10, r11, r12, r13, r14, r15;
uint64_t int_no, err_code; // Interrupt number and error code (if applicable)
uint64_t rip, cs, rflags, userrsp, ss; // Pushed by the processor automatically.
uint64_t rip, cs, rflags, rsp, ss; // Pushed by the processor automatically.
public:
void LogRegisters() const;

View file

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2014.
This file is part of Sortix.
@ -47,8 +47,8 @@ void Process::ExecuteCPU(int argc, char** argv, int envc, char** envp,
regs->rdx = envc;
regs->rcx = (size_t) envp;
regs->rip = entry;
regs->userrsp = stackpos & ~15UL;
regs->rbp = regs->userrsp;
regs->rsp = stackpos & ~15UL;
regs->rbp = regs->rsp;
regs->cs = CS | RPL;
regs->ds = DS | RPL;
regs->ss = DS | RPL;
@ -60,7 +60,7 @@ void InitializeThreadRegisters(CPU::InterruptRegisters* regs,
{
memset(regs, 0, sizeof(*regs));
regs->rip = requested->rip;
regs->userrsp = requested->rsp;
regs->rsp = requested->rsp;
regs->rax = requested->rax;
regs->rbx = requested->rbx;
regs->rcx = requested->rcx;

View file

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2014.
This file is part of Sortix.
@ -33,7 +33,7 @@ namespace Sortix {
void Thread::SaveRegisters(const CPU::InterruptRegisters* src)
{
registers.rip = src->rip;
registers.userrsp = src->userrsp;
registers.rsp = src->rsp;
registers.rax = src->rax;
registers.rbx = src->rbx;
registers.rcx = src->rcx;
@ -60,7 +60,7 @@ void Thread::SaveRegisters(const CPU::InterruptRegisters* src)
void Thread::LoadRegisters(CPU::InterruptRegisters* dest)
{
dest->rip = registers.rip;
dest->userrsp = registers.userrsp;
dest->rsp = registers.rsp;
dest->rax = registers.rax;
dest->rbx = registers.rbx;
dest->rcx = registers.rcx;
@ -92,8 +92,8 @@ void SetupKernelThreadRegs(CPU::InterruptRegisters* regs, ThreadEntry entry,
// the entry function returns. Note that since we use a register based
// calling convention, we call BootstrapKernelThread directly.
regs->rip = (addr_t) BootstrapKernelThread;
regs->userrsp = stack + stacksize - sizeof(size_t);
*((size_t*) regs->userrsp) = 0; /* back tracing stops at NULL rip */
regs->rsp = stack + stacksize - sizeof(size_t);
*((size_t*) regs->rsp) = 0; /* back tracing stops at NULL rip */
regs->rax = 0;
regs->rbx = 0;
regs->rcx = 0;
@ -123,7 +123,7 @@ void Thread::HandleSignalFixupRegsCPU(CPU::InterruptRegisters* regs)
return;
regs->rip = regs->rdi;
regs->rflags = regs->rsi;
regs->userrsp = regs->r8;
regs->rsp = regs->r8;
regs->cs = UCS | URPL;
regs->ds = UDS | URPL;
regs->ss = UDS | URPL;
@ -133,9 +133,9 @@ void Thread::HandleSignalCPU(CPU::InterruptRegisters* regs)
{
const size_t STACK_ALIGNMENT = 16UL;
const size_t RED_ZONE_SIZE = 128UL;
regs->userrsp -= RED_ZONE_SIZE;
regs->userrsp &= ~(STACK_ALIGNMENT-1UL);
regs->rbp = regs->userrsp;
regs->rsp -= RED_ZONE_SIZE;
regs->rsp &= ~(STACK_ALIGNMENT-1UL);
regs->rbp = regs->rsp;
regs->rdi = currentsignal;
regs->rip = (size_t) sighandler;
regs->rflags = FLAGS_RESERVED1 | FLAGS_INTERRUPT | FLAGS_ID;
@ -147,7 +147,7 @@ void Thread::GotoOnSigKill(CPU::InterruptRegisters* regs)
{
regs->rip = (unsigned long) Thread__OnSigKill;
regs->rdi = (unsigned long) this;
regs->userrsp = regs->rbp = kernelstackpos + kernelstacksize;
regs->rsp = regs->rbp = kernelstackpos + kernelstacksize;
regs->rflags = FLAGS_RESERVED1 | FLAGS_INTERRUPT | FLAGS_ID;
regs->cs = KCS | KRPL;
regs->ds = KDS | KRPL;

View file

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2014.
This file is part of Sortix.
@ -32,17 +32,17 @@ namespace X64 {
void InterruptRegisters::LogRegisters() const
{
Log::PrintF("[cr2=0x%zx,ds=0x%zx,rdi=0x%zx,rsi=0x%zx,rbp=0x%zx,"
"rsp=0x%zx,rbx=0x%zx,rdx=0x%zx,rcx=0x%zx,rax=0x%zx,"
"rbx=0x%zx,rdx=0x%zx,rcx=0x%zx,rax=0x%zx,"
"r8=0x%zx,r9=0x%zx,r10=0x%zx,r11=0x%zx,r12=0x%zx,"
"r13=0x%zx,r14=0x%zx,r15=0x%zx,int_no=0x%zx,"
"err_code=0x%zx,rip=0x%zx,cs=0x%zx,rflags=0x%zx,"
"userrsp=0x%zx,ss=0x%zx]",
"rsp=0x%zx,ss=0x%zx]",
cr2, ds, rdi, rsi, rbp,
rsp, rbx, rdx, rcx, rax,
rbx, rdx, rcx, rax,
r8, r9, r10, r11, r12,
r13, r14, r15, int_no,
err_code, rip, cs, rflags,
userrsp, ss);
rsp, ss);
}
} // namespace X64

View file

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2014.
This file is part of Sortix.
@ -43,8 +43,8 @@ void Process::ExecuteCPU(int argc, char** argv, int envc, char** envp,
regs->edx = envc;
regs->ecx = (size_t) envp;
regs->eip = entry;
regs->useresp = stackpos & ~(15UL);
regs->ebp = regs->useresp;
regs->esp = stackpos & ~(15UL);
regs->ebp = regs->esp;
regs->cs = UCS | URPL;
regs->ds = UDS | URPL;
regs->ss = UDS | URPL;
@ -56,7 +56,7 @@ void InitializeThreadRegisters(CPU::InterruptRegisters* regs,
{
memset(regs, 0, sizeof(*regs));
regs->eip = requested->eip;
regs->useresp = requested->esp;
regs->esp = requested->esp;
regs->eax = requested->eax;
regs->ebx = requested->ebx;
regs->ecx = requested->ecx;

View file

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2014.
This file is part of Sortix.
@ -33,7 +33,7 @@ namespace Sortix {
void Thread::SaveRegisters(const CPU::InterruptRegisters* src)
{
registers.eip = src->eip;
registers.useresp = src->useresp;
registers.esp = src->esp;
registers.eax = src->eax;
registers.ebx = src->ebx;
registers.ecx = src->ecx;
@ -52,7 +52,7 @@ void Thread::SaveRegisters(const CPU::InterruptRegisters* src)
void Thread::LoadRegisters(CPU::InterruptRegisters* dest)
{
dest->eip = registers.eip;
dest->useresp = registers.useresp;
dest->esp = registers.esp;
dest->eax = registers.eax;
dest->ebx = registers.ebx;
dest->ecx = registers.ecx;
@ -79,8 +79,8 @@ void SetupKernelThreadRegs(CPU::InterruptRegisters* regs, ThreadEntry entry,
// calling convention, we go through a proxy that uses %edi and %esi
// as parameters and pushes them to the stack and then does the call.
regs->eip = (addr_t) asm_call_BootstrapKernelThread;
regs->useresp = stack + stacksize - sizeof(size_t);
*((size_t*) regs->useresp) = 0; /* back tracing stops at NULL rip */
regs->esp = stack + stacksize - sizeof(size_t);
*((size_t*) regs->esp) = 0; /* back tracing stops at NULL rip */
regs->eax = 0;
regs->ebx = 0;
regs->ecx = 0;
@ -103,7 +103,7 @@ void Thread::HandleSignalFixupRegsCPU(CPU::InterruptRegisters* regs)
uint32_t* params = (uint32_t*) regs->ebx;
regs->eip = params[0];
regs->eflags = params[2];
regs->useresp = params[3];
regs->esp = params[3];
regs->cs = UCS | URPL;
regs->ds = UDS | URPL;
regs->ss = UDS | URPL;
@ -113,9 +113,9 @@ void Thread::HandleSignalCPU(CPU::InterruptRegisters* regs)
{
const size_t STACK_ALIGNMENT = 16UL;
const size_t RED_ZONE_SIZE = 128UL;
regs->useresp -= RED_ZONE_SIZE;
regs->useresp &= ~(STACK_ALIGNMENT-1UL);
regs->ebp = regs->useresp;
regs->esp -= RED_ZONE_SIZE;
regs->esp &= ~(STACK_ALIGNMENT-1UL);
regs->ebp = regs->esp;
regs->edi = currentsignal;
regs->eip = (size_t) sighandler;
regs->eflags = FLAGS_RESERVED1 | FLAGS_INTERRUPT | FLAGS_ID;
@ -133,7 +133,7 @@ void Thread::GotoOnSigKill(CPU::InterruptRegisters* regs)
// we currently are on, this may not be fully supported by interrupt.s
// that is quite aware of this (but isn't perfect). If our destination
// is further down the stack, then we are probably safe.
regs->useresp = regs->ebp = kernelstackpos + kernelstacksize - 256;
regs->esp = regs->ebp = kernelstackpos + kernelstacksize - 256;
regs->eflags = FLAGS_RESERVED1 | FLAGS_INTERRUPT | FLAGS_ID;
regs->cs = KCS | KRPL;
regs->ds = KDS | KRPL;

View file

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2014.
This file is part of Sortix.
@ -32,13 +32,13 @@ namespace X86 {
void InterruptRegisters::LogRegisters() const
{
Log::PrintF("[cr2=0x%zx,ds=0x%zx,edi=0x%zx,esi=0x%zx,ebp=0x%zx,"
"esp=0x%zx,ebx=0x%zx,edx=0x%zx,ecx=0x%zx,eax=0x%zx,"
"ebx=0x%zx,edx=0x%zx,ecx=0x%zx,eax=0x%zx,"
"int_no=0x%zx,err_code=0x%zx,eip=0x%zx,cs=0x%zx,"
"eflags=0x%zx,useresp=0x%zx,ss=0x%zx]",
"eflags=0x%zx,esp=0x%zx,ss=0x%zx]",
cr2, ds, edi, esi, ebp,
esp, ebx, edx, ecx, eax,
ebx, edx, ecx, eax,
int_no, err_code, eip, cs,
eflags, useresp, ss);
eflags, esp, ss);
}
} // namespace X86