Make copy_data a syscall
This commit is contained in:
parent
3856a5dc0a
commit
2497befcea
@ -1,6 +1,6 @@
|
||||
#include "paging.h"
|
||||
|
||||
void copy_data(void* cr3, void* data,uint32_t size,void* virt_addr) {
|
||||
void address_spaces_copy_data(void* cr3, void* data,uint32_t size,void* virt_addr) {
|
||||
uint32_t old_cr3;
|
||||
asm volatile("movl %%cr3, %%eax; movl %%eax, %0;":"=m"(old_cr3)::"%eax");
|
||||
void* phys_addr=virt_to_phys(data);
|
||||
|
@ -3,6 +3,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void copy_data(void* cr3, void* data,uint32_t size,void* virt_addr);
|
||||
void address_spaces_copy_data(void* cr3, void* data,uint32_t size,void* virt_addr);
|
||||
|
||||
#endif
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "../../drivers/vga.h"
|
||||
#include "../tasking.h"
|
||||
#include "interrupt.h"
|
||||
#include "address_spaces.h"
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
void irq_handler(registers_t r);
|
||||
@ -187,6 +188,8 @@ void isr_handler(registers_t r) {
|
||||
r.ebx=(uint32_t)paging_new_address_space();
|
||||
} else if (r.eax==9) {
|
||||
tasking_createTaskCr3((void*)r.ebx,(void*)r.ecx);
|
||||
} else if (r.eax==10) {
|
||||
address_spaces_copy_data((void*)r.ebx,(void*)r.ecx,r.edx,(void*)r.esi);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
BIN
initrd/init
BIN
initrd/init
Binary file not shown.
@ -24,3 +24,16 @@ void* new_address_space() {
|
||||
":"=b"(cr3));
|
||||
return cr3;
|
||||
}
|
||||
|
||||
void copy_data(void* cr3, void* data,uint32_t size,void* virt_addr) {
|
||||
asm volatile(" \
|
||||
mov $10, %%eax; \
|
||||
int $80; \
|
||||
"::"b"(cr3),"c"(data),"d"(size),"S"(virt_addr));
|
||||
// uint32_t old_cr3;
|
||||
// asm volatile("movl %%cr3, %%eax; movl %%eax, %0;":"=m"(old_cr3)::"%eax");
|
||||
// void* phys_addr=virt_to_phys(data);
|
||||
// load_address_space(cr3);
|
||||
// map_pages(virt_addr,phys_addr,(size/4096)+1,1,1);
|
||||
// load_address_space(old_cr3);
|
||||
}
|
||||
|
@ -8,5 +8,6 @@
|
||||
void* alloc_memory(uint32_t num_pages);
|
||||
void alloc_memory_virt(uint32_t num_pages,void* addr);
|
||||
void* new_address_space();
|
||||
void copy_data(void* cr3, void* data,uint32_t size,void* virt_addr);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user