Remove uncessesary asm files

This commit is contained in:
pjht 2020-07-24 10:50:06 -05:00
parent bb7682186d
commit 9f77482506
6 changed files with 13 additions and 38 deletions

View File

@ -1,4 +1,3 @@
#include "seg_upd.h"
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
@ -129,8 +128,17 @@ void gdt_init() {
write_tss(5,0x10,int_stack_top+0xC0000000); write_tss(5,0x10,int_stack_top+0xC0000000);
gdt_desc.size=(sizeof(gdt_entry)*NUM_ENTRIES)-1; gdt_desc.size=(sizeof(gdt_entry)*NUM_ENTRIES)-1;
gdt_desc.address=gdt; gdt_desc.address=gdt;
asm volatile("lgdt (%%eax)"::"a"((uint32_t)&gdt_desc)); asm volatile(" \
seg_upd(); lgdt (%%eax); \
jmp $0x8,$gdt_init_asm_code_upd; \
gdt_init_asm_code_upd: \
mov $0x10, %%ax; \
mov %%ax, %%ds; \
mov %%ax, %%ss; \
mov %%ax, %%es; \
mov %%ax, %%fs; \
mov %%ax, %%gs; \
"::"a"((uint32_t)&gdt_desc));
asm volatile("mov $0x2B, %ax; \ asm volatile("mov $0x2B, %ax; \
ltr %ax; \ ltr %ax; \
"); ");

View File

@ -3,7 +3,6 @@
#include "../halt.h" #include "../halt.h"
#include "../paging.h" #include "../paging.h"
#include "arch_consts.h" #include "arch_consts.h"
#include "paging_helpers.h"
#include <klog.h> #include <klog.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
@ -136,7 +135,7 @@ void* paging_new_address_space() {
} }
void load_address_space(void* cr3) { void load_address_space(void* cr3) {
load_page_directory((uint32_t*)cr3); asm volatile("movl %0, %%eax; movl %%eax, %%cr3;":"=m"(cr3)::"%eax");
} }
void unmap_pages(void* start_virt,int num_pages) { void unmap_pages(void* start_virt,int num_pages) {
@ -176,7 +175,7 @@ void paging_init() {
page_directory[i+1018]=(entry_virt-0xC0000000)|0x3; page_directory[i+1018]=(entry_virt-0xC0000000)|0x3;
} }
page_directory[1023]=((uint32_t)page_directory-0xC0000000)|0x3; page_directory[1023]=((uint32_t)page_directory-0xC0000000)|0x3;
load_page_directory((uint32_t*)((uint32_t)page_directory-0xC0000000)); load_address_space((uint32_t*)((uint32_t)page_directory-0xC0000000));
} }
void* get_cr3() { void* get_cr3() {

View File

@ -1,9 +0,0 @@
global load_page_directory
load_page_directory:
push ebp
mov ebp, esp
mov eax, [esp+8]
mov cr3, eax
mov esp, ebp
pop ebp
ret

View File

@ -1,6 +0,0 @@
#ifndef PAGING_HELPERS_H
#define PAGING_HELPERS_H
void load_page_directory(void* dir);
#endif

View File

@ -1,11 +0,0 @@
global seg_upd
seg_upd:
jmp 0x8:code_upd
code_upd:
mov ax, 0x10
mov ds, ax
mov ss, ax
mov es, ax
mov fs, ax
mov gs, ax
ret

View File

@ -1,6 +0,0 @@
#ifndef SEG_UPD_H
#define SEG_UPD_H
void seg_upd();
#endif