[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lost] [PATCH] ! Stack ist nach VM86-Syscall nicht mehr ganz so kaputt wie vorher., ! VM86-Tasks koennen jetzt wieder auf BIOS zugreifen., ! vm86test kompiliert wieder.



Das hier fixt den VM86-Syscall.

From 898c6522bca2ce7b6793efb74049d9094534b40c Mon Sep 17 00:00:00 2001
From: Mathias Gottschlag <mathias-go@xxxxxx>
Date: Thu, 9 Oct 2008 12:48:50 +0200
Subject: [PATCH] ! Stack ist nach VM86-Syscall nicht mehr ganz so kaputt wie vorher.
 ! VM86-Tasks koennen jetzt wieder auf BIOS zugreifen.
 ! vm86test kompiliert wieder.

---
 src/kernel/src/vm86.c               |    3 ++-
 src/modules/c/vm86test/Makefile.all |    5 ++---
 src/modules/c/vm86test/main.c       |    1 -
 src/modules/lib/syscalls/vm86.c     |    1 +
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/kernel/src/vm86.c b/src/kernel/src/vm86.c
index 60d1d4a..89e6a7b 100644
--- a/src/kernel/src/vm86.c
+++ b/src/kernel/src/vm86.c
@@ -155,7 +155,7 @@ struct task * create_vm86_task(word interrupt, vm86_regs_t *regs, dword *meminfo
     pagedir[0] |= 0x4;
     
     map_page_range(kernel_page_directory, (paddr_t)0xC0000, (vaddr_t)0xC0000, PTE_P | PTE_U, 0x40);
-    
+    kernel_page_directory[0] |= PTE_U;
     
     // Speicher fuer die Stacks allokieren
     // Stack im PD des neuen Tasks mappen
@@ -316,6 +316,7 @@ bool vm86_exception(dword *esp)
                 map_page(kernel_page_directory, page_table, (dword*)(((dword*)task->cr3)[0] & ~0xFFF), PTE_P | PTE_W);
                 page_table[0] = 0;
                 unmap_page(kernel_page_directory, page_table);
+                kernel_page_directory[0] &= ~PTE_U;
                 // - BIOS
                 dword i;
                 for (i = 0; i < 0x40; i++) {
diff --git a/src/modules/c/vm86test/Makefile.all b/src/modules/c/vm86test/Makefile.all
index e8545be..c128e45 100644
--- a/src/modules/c/vm86test/Makefile.all
+++ b/src/modules/c/vm86test/Makefile.all
@@ -3,7 +3,6 @@ source $LOST_BUILDMK_ROOT/config.sh
 
 echo "LD   $1/apps/vm86test"
 
-LOST_TOOLS_LD -ovm86test -Ttext=0x40000000 *.o --start-group $2 --end-group
+$LOST_TOOLS_LD -ovm86test -Ttext=0x40000000 --start-group *.o $2 --end-group
 
-
-mv vm86test $1/apps/
+$LOST_TOOLS_STRIP -s vm86test -o $1/apps/vm86test
diff --git a/src/modules/c/vm86test/main.c b/src/modules/c/vm86test/main.c
index df0df30..8590183 100644
--- a/src/modules/c/vm86test/main.c
+++ b/src/modules/c/vm86test/main.c
@@ -37,7 +37,6 @@
 #include "stdio.h"
 #include "syscall.h"
 
-#define _USE_START_
 #include "init.h"
 
 typedef struct vesa_info_t
diff --git a/src/modules/lib/syscalls/vm86.c b/src/modules/lib/syscalls/vm86.c
index 16fe95f..570558b 100644
--- a/src/modules/lib/syscalls/vm86.c
+++ b/src/modules/lib/syscalls/vm86.c
@@ -9,6 +9,7 @@ bool vm86_int(vm86_regs_t *regs, dword *shm)
         "pushl %2;"
         "mov %1, %%eax;"
         "int $0x30;"
+        "add $0x8, %%esp;"
     : "=a"(result): "i" (SYSCALL_VM86), "r"(regs), "r"(shm) );
     return (bool)result;
 }
-- 
1.5.4.3