- create GDTs for user applications (ring 3)
- rename section osstart to multiboot git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@43 315a16e6-25f9-4109-90ae-ca3045a26c18
This commit is contained in:
parent
7294c47c98
commit
a9043ebf72
3 changed files with 13 additions and 3 deletions
|
@ -24,7 +24,7 @@
|
|||
[BITS 32]
|
||||
; We use a special name to map this section at the begin of our kernel
|
||||
; => Multiboot needs its magic number at the begin of the kernel
|
||||
SECTION .osstart
|
||||
SECTION multiboot
|
||||
global start
|
||||
start:
|
||||
mov esp, _sys_stack ; This points the stack to our new stack area
|
||||
|
|
|
@ -34,7 +34,7 @@ struct gdt_ptr {
|
|||
unsigned int base;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define GDT_ENTRIES 3
|
||||
#define GDT_ENTRIES 5
|
||||
|
||||
struct gdt_entry gdt[GDT_ENTRIES];
|
||||
struct gdt_ptr gp;
|
||||
|
@ -94,6 +94,16 @@ void gdt_install(void)
|
|||
*/
|
||||
gdt_set_gate(2, 0, 0xFFFFFFFF, 0x92, 0xCF);
|
||||
|
||||
/*
|
||||
* Create code segement for userspace applications (ring 3)
|
||||
*/
|
||||
gdt_set_gate(3, 0, 0xFFFFFFFF, 0xFA, 0xCF);
|
||||
|
||||
/*
|
||||
* Create data segement for userspace applications (ring 3)
|
||||
*/
|
||||
gdt_set_gate(4, 0, 0xFFFFFFFF, 0xF2, 0xCF);
|
||||
|
||||
/* Flush out the old GDT and install the new changes! */
|
||||
gdt_flush();
|
||||
}
|
||||
|
|
2
link.ld
2
link.ld
|
@ -6,7 +6,7 @@ SECTIONS
|
|||
{
|
||||
.text phys : AT(phys) {
|
||||
code = .;
|
||||
*(.osstart)
|
||||
*(multiboot)
|
||||
*(.text)
|
||||
*(.rodata)
|
||||
. = ALIGN(4096);
|
||||
|
|
Loading…
Add table
Reference in a new issue