Merge pull request #2 from BriceBoisson/brice-paging
Add: Set same memory space for userland and kernel using paging
This commit is contained in:
commit
37a2be9c6c
|
@ -78,20 +78,20 @@ void init_gdt(void)
|
|||
// Code
|
||||
gdt[1] = init_descriptor((struct segment_desc_param) { .Limit_1 = 0xFFFF,
|
||||
.Base = 0, .Type = 0x0B, .S = 1, .DPL = 0, .P = 1,
|
||||
.Limit_2 = 0x02, .AVL = 0, .L = 0, .D_B = 1, .G = 1 });
|
||||
.Limit_2 = 0x0F, .AVL = 0, .L = 0, .D_B = 1, .G = 1 });
|
||||
// Data
|
||||
gdt[2] = init_descriptor((struct segment_desc_param) { .Limit_1 = 0xFFFF,
|
||||
.Base = 0, .Type = 2, .S = 1, .DPL = 0, .P = 1,
|
||||
.Limit_2 = 0x02, .AVL = 0, .L = 0, .D_B = 1, .G = 1 });
|
||||
.Limit_2 = 0x0F, .AVL = 0, .L = 0, .D_B = 1, .G = 1 });
|
||||
|
||||
// Code
|
||||
gdt[3] = init_descriptor((struct segment_desc_param) { .Limit_1 = 0xFFFF,
|
||||
.Base = 0x30000, .Type = 0x0B, .S = 1, .DPL = 3, .P = 1,
|
||||
.Base = 0, .Type = 0x0B, .S = 1, .DPL = 3, .P = 1,
|
||||
.Limit_2 = 0x0F, .AVL = 0, .L = 0, .D_B = 1, .G = 1 });
|
||||
|
||||
// Data
|
||||
gdt[4] = init_descriptor((struct segment_desc_param) { .Limit_1 = 0xFFFF,
|
||||
.Base = 0x30000, .Type = 2, .S = 1, .DPL = 3, .P = 1,
|
||||
.Base = 0, .Type = 2, .S = 1, .DPL = 3, .P = 1,
|
||||
.Limit_2 = 0x0F, .AVL = 0, .L = 0, .D_B = 1, .G = 1 });
|
||||
|
||||
user_land_tss.ssp = 0x0;
|
||||
|
|
|
@ -26,7 +26,7 @@ void launch_process(int tss, int memory_start, int userland_stack, int userland_
|
|||
and $0xffffbfff, %%eax \n \
|
||||
push %%eax \n \
|
||||
push %5 \n \
|
||||
push $0x0 \n \
|
||||
push $0x30000 \n \
|
||||
movl $0x20000, %6 \n \
|
||||
movw %7, %%ax \n \
|
||||
movw %%ax, %%ds \n \
|
||||
|
|
|
@ -7,14 +7,14 @@ void userland(void)
|
|||
// asm volatile ("movl $2, %eax; int $0x30");
|
||||
// asm("movl %%eax,%0" : "=r"(res));
|
||||
// asm volatile ("int $0x30");
|
||||
char *str = (void *) 0x100;
|
||||
char *str = (void *) 0x30100;
|
||||
str[0] = 'H';
|
||||
str[1] = 'e';
|
||||
str[2] = 'l';
|
||||
str[3] = 'l';
|
||||
str[4] = 'o';
|
||||
str[5] = '\0';
|
||||
asm volatile ("mov $1, %%eax; movl $0x30100, %%ebx; int $0x30; movl %%eax, %0" : "=r" (res));
|
||||
asm volatile ("mov $1, %%eax; movl $0x30100, %%ebx; int $0x30; movl %%eax, %1" : "=m" (str), "=r" (res));
|
||||
// asm volatile ("mov $1, %%eax; movl %0, %%ebx; int $0x30" : "=m" (str));
|
||||
// asm ("mov $1, %eax; int $0x30");
|
||||
// asm ("movl %0, %eax; int $0x30" : "=m" (res));
|
||||
|
|
Loading…
Reference in New Issue