[freenos] r407 committed - Committing more file changed from renaming KERNEL_STACK to KERN_STACK.

  • From: freenos@xxxxxxxxxxxxxx
  • To: freenos@xxxxxxxxxxxxx
  • Date: Tue, 19 Oct 2010 00:20:11 +0000

Revision: 407
Author: nieklinnenbank
Date: Mon Oct 18 17:03:00 2010
Log: Committing more file changed from renaming KERNEL_STACK to KERN_STACK.

http://code.google.com/p/freenos/source/detail?r=407

Modified:
 /branches/scratch/server/serial/main.c
 /branches/scratch/system/x86/pc/context_switch.S
 /branches/scratch/system/x86/pc/entry16.S
 /branches/scratch/system/x86/pc/entry32.S
 /branches/scratch/system/x86/pc/irq_table.S
 /branches/scratch/system/x86/pc/virt_memory.c

=======================================
--- /branches/scratch/server/serial/main.c      Sun Oct 10 16:06:55 2010
+++ /branches/scratch/server/serial/main.c      Mon Oct 18 17:03:00 2010
@@ -20,7 +20,6 @@

 int main(void)
 {
-    getpid();
+    for (;;);
     return 0;
 }
-
=======================================
--- /branches/scratch/system/x86/pc/context_switch.S Sun Oct 10 16:06:55 2010 +++ /branches/scratch/system/x86/pc/context_switch.S Mon Oct 18 17:03:00 2010
@@ -1,6 +1,6 @@
 /*
- * Copyright (C) 2009 Niek Linnenbank
- *
+ * Copyright (C) 2010 Niek Linnenbank
+ *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
@@ -10,20 +10,20 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */

 #include <FreeNOS/process.h>

-.global arch_context_switch
+.global context_switch
 .section ".text"

 /*
- * arch_context_switch(old_stack, old_flags, page_dir, user_stack)
+ * context_switch(old_stack, old_flags, page_dir, kern_stack)
  */
-arch_context_switch:
+context_switch:

     /* Setup correct stackframe. */
     push %ebp
@@ -32,7 +32,7 @@
     /* Saves the current process state, if any. */
     mov 8(%ebp), %eax
     cmpl $0, %eax
-    je restoreState
+    je restore_state

     /* Setup stack for IRETD later on. */
     pushf
@@ -63,13 +63,13 @@
     /*
      * Switch context to new process.
      */
-restoreState:
+restore_state:

     /* Retrieve arguments. */
     movl 16(%ebp), %eax /* page_dir */
     movl 20(%ebp), %ebx /* stack */

-    /* Reload page directory, stack and TSS. */
+    /* Reload page directory and stack. */
     movl %eax,     %cr3
     movl %ebx,     %esp

=======================================
--- /branches/scratch/system/x86/pc/entry16.S   Sun Oct 10 16:06:55 2010
+++ /branches/scratch/system/x86/pc/entry16.S   Mon Oct 18 17:03:00 2010
@@ -48,11 +48,11 @@
     movl %eax, %cr0

     /* Reload data segment. */
-    mov $KERNEL_DS_SEL, %ax
+    mov $KERN_DS_SEL, %ax
     mov %ax, %ds

     /* Reload code segment: jump to 32-bit entry point. */
-    ljmpl $KERNEL_CS_SEL, $loader
+    ljmpl $KERN_CS_SEL, $loader

 gdt16:
         .quad   0x0000000000000000 /* NULL descriptor. */
=======================================
--- /branches/scratch/system/x86/pc/entry32.S   Sun Oct 10 16:06:55 2010
+++ /branches/scratch/system/x86/pc/entry32.S   Mon Oct 18 17:03:00 2010
@@ -48,7 +48,6 @@
  * Enter the kernel main() in 32-bit protected mode.
  */
 loader:
-
     /* Disable interrupts. */
     cli

@@ -56,14 +55,14 @@
     lgdtl gdt_ptr

     /* Setup segments. */
-    movl $KERNEL_DS_SEL, %edx
+    movl $KERN_DS_SEL, %edx
     movl %edx, %ds
     movl %edx, %es
     movl %edx, %fs
     movl %edx, %gs

     /* Reload CS. */
-    ljmpl $KERNEL_CS_SEL, $loader2
+    ljmpl $KERN_CS_SEL, $loader2

 loader2:
     /* Setup stack. */
@@ -89,9 +88,9 @@
 .align PAGE_SIZE
 stack:    .fill STACK_SIZE, 1, 0
 stackptr: .long 0
-         .long KERNEL_DS_SEL
-
-/* Global Descriptor Table. */
+         .long KERN_DS_SEL
+
+/* Boot Global Descriptor Table. */
 gdt:
         .quad   0x0000000000000000 /* NULL descriptor. */
         .quad   0x00cf9a000000ffff /* Kernel CS. */
@@ -105,4 +104,3 @@
         .word gdt_end - gdt
         .long gdt
         .word 0
-
=======================================
--- /branches/scratch/system/x86/pc/irq_table.S Sun Oct 10 16:06:55 2010
+++ /branches/scratch/system/x86/pc/irq_table.S Mon Oct 18 17:03:00 2010
@@ -38,7 +38,7 @@

     /* Replace data segments. */
     pushl %eax
-    mov $KERNEL_DS_SEL, %ax
+    mov $KERN_DS_SEL, %ax
     mov %ax, %ds
     mov %ax, %es
     mov %ax, %fs
=======================================
--- /branches/scratch/system/x86/pc/virt_memory.c       Sun Oct 10 16:06:55 2010
+++ /branches/scratch/system/x86/pc/virt_memory.c       Mon Oct 18 17:03:00 2010
@@ -55,7 +55,7 @@
        {
            tab = (page_entry_t *) palloc(TAB_SIZE);
            memset(tab, 0, TAB_SIZE);
-           virt_dir_setmap(dir, i, (addr_t) tab, PAGE_PR|PAGE_WR);
+           virt_dir_setmap(dir, i, (addr_t) tab, PAGE_PR|PAGE_WR|PAGE_USER);
        }
        /* Map the page. */
        virt_tab_setmap(tab, i, addr + (i - addr), PAGE_PR|PAGE_WR);
@@ -70,7 +70,7 @@
     memset(dir, 0, DIR_SIZE);

     /* Map kernel, APIC, initial stack and page directory. */
-    virt_ident_map(dir, KERNEL_VADDR, kernel_size);
+    virt_ident_map(dir, KERN_VADDR, kernel_size);
     virt_ident_map(dir, APIC_BASE, PAGE_SIZE);
     virt_ident_map(dir, smp_cpu()->stack, STACK_SIZE);
     virt_dir_setmap(dir, DIR_VADDR, (addr_t) dir, PAGE_PR|PAGE_WR);
@@ -102,7 +102,7 @@
            {
                return ENOMEM;
            }
-           virt_dir_setmap(dir, i, new_tab, PAGE_PR|PAGE_WR);
+           virt_dir_setmap(dir, i, new_tab, PAGE_PR|PAGE_WR|PAGE_USER);
            virt_reload_addr(tab);
            memset(tab, 0, TAB_SIZE);
        }
@@ -172,14 +172,14 @@
     virt_map_remote_dir(proc);

     /* Map kernel, APIC, initial stack and page directory. */
-    virt_map(RDIR_VADDR, KERNEL_VADDR, KERNEL_VADDR,
+    virt_map(RDIR_VADDR, KERN_VADDR, KERN_VADDR,
             kernel_size, PAGE_PR|PAGE_WR);
     virt_map(RDIR_VADDR, APIC_BASE, APIC_BASE,
             PAGE_SIZE, PAGE_PR|PAGE_WR);
-    virt_map(RDIR_VADDR, KERNEL_STACK, kern_stack,
+    virt_map(RDIR_VADDR, KERN_STACK, kern_stack,
             STACK_SIZE, PAGE_PR|PAGE_WR);
     virt_map(RDIR_VADDR, USER_STACK, user_stack,
-            STACK_SIZE, PAGE_PR|PAGE_WR);
+            STACK_SIZE, PAGE_PR|PAGE_WR|PAGE_USER);

     /* Done. */
     virt_unmap_remote_dir(proc);

Other related posts:

  • » [freenos] r407 committed - Committing more file changed from renaming KERNEL_STACK to KERN_STACK. - freenos