Remove segments from push_all

This commit is contained in:
Justin C. Miller
2019-03-13 22:45:02 -07:00
parent 81162f30dc
commit 49bdf47514
4 changed files with 24 additions and 27 deletions

View File

@@ -4,7 +4,6 @@
struct cpu_state
{
uint64_t ds;
uint64_t r15, r14, r13, r12, r11, r10, r9, r8;
uint64_t rdi, rsi, rbp, rbx, rdx, rcx, rax;
uint64_t interrupt, errorcode;

View File

@@ -34,7 +34,6 @@ print_regs(const cpu_state &regs)
print_reg("sp0", tss_get_stack(0));
cons->puts("\n");
print_reg(" ds", regs.ds);
print_reg(" cs", regs.cs);
print_reg(" ss", regs.ss);

View File

@@ -1,32 +1,31 @@
%macro push_all_and_segments 0
push rax
push rcx
push rdx
push rbx
push rbp
push rsi
push rdi
; ss ; rsp + a8
; rsp ; rsp + a0
; rflags ; rsp + 98
; cs ; rsp + 90
; rip ; rsp + 88
; error ; rsp + 80
; vector ; rsp + 78
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
push rax ; rsp + 70
push rcx ; rsp + 68
push rdx ; rsp + 60
push rbx ; rsp + 58
push rbp ; rsp + 50
push rsi ; rsp + 48
push rdi ; rsp + 40
mov ax, ds
push rax
push r8 ; rsp + 38
push r9 ; rsp + 30
push r10 ; rsp + 28
push r11 ; rsp + 20
push r12 ; rsp + 18
push r13 ; rsp + 10
push r14 ; rsp + 08
push r15 ; rsp + 00
%endmacro
%macro pop_all_and_segments 0
pop rax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
pop r15
pop r14
pop r13

View File

@@ -141,7 +141,7 @@ scheduler::load_process(const char *name, const void *data, size_t size)
// Highest state in the stack is the process' kernel stack for the loader
// to iret to:
state->ds = state->ss = ss;
state->ss = ss;
state->cs = cs;
state->rflags = rflags_int;
state->rip = 0; // to be filled by the loader
@@ -151,7 +151,7 @@ scheduler::load_process(const char *name, const void *data, size_t size)
// iret to this which will kick off the loading:
cpu_state *loader_state = reinterpret_cast<cpu_state *>(sp0) - 2;
loader_state->ds = loader_state->ss = kss;
loader_state->ss = kss;
loader_state->cs = kcs;
loader_state->rflags = rflags_noint;
loader_state->rip = reinterpret_cast<uint64_t>(ramdisk_process_loader);