|
From: <fd...@us...> - 2008-04-17 22:06:37
|
Revision: 3964
http://jnode.svn.sourceforge.net/jnode/?rev=3964&view=rev
Author: fduminy
Date: 2008-04-17 15:06:36 -0700 (Thu, 17 Apr 2008)
Log Message:
-----------
initial version of vbe/vesa driver
Modified Paths:
--------------
trunk/core/src/core/org/jnode/vm/Unsafe.java
trunk/core/src/core/org/jnode/vm/x86/UnsafeX86.java
trunk/core/src/native/x86/i386.h
trunk/core/src/native/x86/kernel.asm
trunk/core/src/native/x86/unsafe.asm
trunk/core/src/native/x86/unsafex86.asm
Added Paths:
-----------
trunk/core/src/native/x86/utils.h
Modified: trunk/core/src/core/org/jnode/vm/Unsafe.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/Unsafe.java 2008-04-17 22:00:46 UTC (rev 3963)
+++ trunk/core/src/core/org/jnode/vm/Unsafe.java 2008-04-17 22:06:36 UTC (rev 3964)
@@ -749,5 +749,7 @@
* @return nanosecond accurate time
*/
public static native long getCpuCycles();
-
+
+
+ public static native int callVbeFunction(Address codePtr, int function, Address bufferPtr);
}
Modified: trunk/core/src/core/org/jnode/vm/x86/UnsafeX86.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/x86/UnsafeX86.java 2008-04-17 22:00:46 UTC (rev 3963)
+++ trunk/core/src/core/org/jnode/vm/x86/UnsafeX86.java 2008-04-17 22:06:36 UTC (rev 3964)
@@ -76,6 +76,11 @@
*/
static final native int getMultibootMMapLength();
+ public static final native Address getVbeInfos();
+ public static final native Address getVbeControlInfos();
+ public static final native Address getVbeModeInfos();
+ public static final native Address getMultibootInfos();
+
/**
* Merge 32-bit ARGB values at the given memory address.
* @param src The source address (points to 32-bit ARGB int's)
Modified: trunk/core/src/native/x86/i386.h
===================================================================
(Binary files differ)
Modified: trunk/core/src/native/x86/kernel.asm
===================================================================
--- trunk/core/src/native/x86/kernel.asm 2008-04-17 22:00:46 UTC (rev 3963)
+++ trunk/core/src/native/x86/kernel.asm 2008-04-17 22:06:36 UTC (rev 3964)
@@ -1,4 +1,3 @@
-; -----------------------------------------------
; $Id$
;
; Main kernel startup code
@@ -22,13 +21,20 @@
align 4
mb_header:
dd 0x1BADB002 ; Magic
- dd 0x00010003 ; Feature flags
- dd 0-0x1BADB002-0x00010003 ; Checksum
+ dd 0x00010007 ; Feature flags
+ dd 0-0x1BADB002-0x00010007 ; Checksum
dd mb_header ; header_addr
dd sys_start ; load_addr
dd 0 ; load_end_addr (patched up by BootImageBuilder)
dd 0 ; bss_end_addr
dd real_start ; entry_addr
+ dd 0 ; mode_type
+; dd 1024 ; width
+; dd 768 ; height
+; dd 32 ; depth
+ dd 0 ; width
+ dd 0 ; height
+ dd 0 ; depth
real_start:
mov esp,Lkernel_esp
@@ -42,6 +48,7 @@
multiboot_ok:
; Copy the multiboot info block
cld
+ mov [multiboot_infos], ebx
mov esi,ebx
mov edi,multiboot_info
mov ecx,MBI_SIZE
@@ -92,6 +99,34 @@
jb multiboot_mmap_copy
multiboot_mmap_done:
+ ; Copy vbe infos (if any)
+ test dword [multiboot_info+MBI_FLAGS],MBF_VBE
+ jz vbe_info_done
+ ; Get start address
+ mov esi,[multiboot_info+MBI_VBECTRLINFO]
+ ; Get destination address
+ mov edi,multiboot_vbe
+ ; Copy the VBE_ESIZE bytes
+ mov ecx,VBE_ESIZE
+ rep movsb
+
+ ; Get start address
+ mov esi,[multiboot_info+MBI_VBECTRLINFO]
+ ; Get destination address
+ mov edi,vbe_control_info
+ ; Copy the VBECTRLINFO_SIZE bytes
+ mov ecx,VBECTRLINFO_SIZE
+ rep movsb
+
+ ; Get start address
+ mov esi,[multiboot_info+MBI_VBEMODEINFO]
+ ; Get destination address
+ mov edi,vbe_mode_info
+ ; Copy the VBEMODEINFO_SIZE bytes
+ mov ecx,VBEMODEINFO_SIZE
+ rep movsb
+vbe_info_done:
+
; Initialize initial jarfile
mov esi,[multiboot_info+MBI_MODSCOUNT]
test esi,esi
@@ -278,3 +313,19 @@
multiboot_mmap:
dd 0 ; Entries
times (MBI_MMAP_MAX * MBMMAP_ESIZE) db 0
+
+multiboot_vbe:
+ dd 0 ; Entries
+ times (VBE_ESIZE) db 0
+
+vbe_control_info:
+ dd 0 ; Entries
+ times (VBECTRLINFO_SIZE) db 0
+
+vbe_mode_info:
+ dd 0 ; Entries
+ times (VBEMODEINFO_SIZE) db 0
+
+multiboot_infos:
+ dd 0
+
\ No newline at end of file
Modified: trunk/core/src/native/x86/unsafe.asm
===================================================================
--- trunk/core/src/native/x86/unsafe.asm 2008-04-17 22:00:46 UTC (rev 3963)
+++ trunk/core/src/native/x86/unsafe.asm 2008-04-17 22:06:36 UTC (rev 3964)
@@ -6,6 +6,8 @@
; Author : E. Prangsma
; -----------------------------------------------
+%include "utils.h"
+
extern VmThread_runThread
extern bootHeapStart
extern bootHeapEnd
@@ -44,39 +46,10 @@
push ADI
push ASI
push ACX
+
+ ; COPY_MEMORY srcMemPtr destMemPtr size
+ COPY_MEMORY [ABX+(4*SLOT_SIZE)], [ABX+(3*SLOT_SIZE)], [ABX+(2*SLOT_SIZE)]
- mov ASI,[ABX+(4*SLOT_SIZE)] ; srcMemPtr
- mov ADI,[ABX+(3*SLOT_SIZE)] ; destMemPtr
- mov ACX,[ABX+(2*SLOT_SIZE)] ; size
-
- ; Test the direction for copying
- cmp ASI,ADI
- jl copy_reverse
-
- ; Copy from left to right
- cld
-copy_bytes:
- test ACX,3 ; Test for size multiple of 4-byte
- jz copy_dwords
- dec ACX
- movsb ; Not yet multiple of 4, copy a single byte and test again
- jmp copy_bytes
-copy_dwords:
- shr ACX,2
- rep movsd
- jmp copy_done
-
-copy_reverse:
- ; Copy from right to left
- pushf
- cli
- std
- lea ASI,[ASI+ACX-1]
- lea ADI,[ADI+ACX-1]
- rep movsb
- popf
-
-copy_done:
pop ACX
pop ASI
pop ADI
@@ -361,3 +334,21 @@
rdtsc
ret
+
+; int callVbeFunction(Address codePtr, int function, Address bufferPtr)
+GLABEL Q43org5jnode2vm6Unsafe23callVbeFunction2e28Lorg2fvmmagic2funboxed2fAddress3bILorg2fvmmagic2funboxed2fAddress3b29I
+ push EDI
+ mov EAX,[ESP+(3*SLOT_SIZE)] ; function
+ mov EDI,[ESP+(2*SLOT_SIZE)] ; bufferPtr
+
+ ; move higher 16 bits of EDI to ES
+ mov EBX, EDI
+ shr EBX, 16
+ mov ES, EBX
+
+ ; keep only lower 16 bits of EDI
+ and EDI, 0x0000FFFF
+
+ call dword far [ESP+(4*SLOT_SIZE)] ; codePtr
+ pop EDI
+ ret SLOT_SIZE*3
\ No newline at end of file
Modified: trunk/core/src/native/x86/unsafex86.asm
===================================================================
--- trunk/core/src/native/x86/unsafex86.asm 2008-04-17 22:00:46 UTC (rev 3963)
+++ trunk/core/src/native/x86/unsafex86.asm 2008-04-17 22:06:36 UTC (rev 3964)
@@ -82,6 +82,26 @@
mov eax,[multiboot_mmap]
ret
+; Address getVbeInfos();
+GLABEL Q53org5jnode2vm3x869UnsafeX8623getVbeInfos2e2829Lorg2fvmmagic2funboxed2fAddress3b
+ mov AAX,multiboot_vbe
+ ret
+
+; Address getVbeControlInfos();
+GLABEL Q53org5jnode2vm3x869UnsafeX8623getVbeControlInfos2e2829Lorg2fvmmagic2funboxed2fAddress3b
+ mov AAX,vbe_control_info
+ ret
+
+; Address getVbeModeInfos();
+GLABEL Q53org5jnode2vm3x869UnsafeX8623getVbeModeInfos2e2829Lorg2fvmmagic2funboxed2fAddress3b
+ mov AAX,vbe_mode_info
+ ret
+
+; Address getMultibootInfos();
+GLABEL Q53org5jnode2vm3x869UnsafeX8623getMultibootInfos2e2829Lorg2fvmmagic2funboxed2fAddress3b
+ mov AAX,multiboot_infos
+ ret
+
; void setupBootCode(Address memory, int[] gdtBase, int[] tss);
GLABEL Q53org5jnode2vm3x869UnsafeX8623setupBootCode2e28Lorg2fvmmagic2funboxed2fAddress3b5bI5bI29V
push ABX
Added: trunk/core/src/native/x86/utils.h
===================================================================
--- trunk/core/src/native/x86/utils.h (rev 0)
+++ trunk/core/src/native/x86/utils.h 2008-04-17 22:06:36 UTC (rev 3964)
@@ -0,0 +1,43 @@
+; -----------------------------------------------
+; $Id: console.h 1661 2005-05-21 07:51:46Z epr $
+;
+; Kernel console macro's
+;
+; Author : E.Prangsma
+; -----------------------------------------------
+
+; Copy a memory block
+%macro COPY_MEMORY 3
+ mov ASI,%1 ; srcMemPtr
+ mov ADI,%2 ; destMemPtr
+ mov ACX,%3 ; size
+
+ ; Test the direction for copying
+ cmp ASI,ADI
+ jl copy_reverse
+
+ ; Copy from left to right
+ cld
+copy_bytes:
+ test ACX,3 ; Test for size multiple of 4-byte
+ jz copy_dwords
+ dec ACX
+ movsb ; Not yet multiple of 4, copy a single byte and test again
+ jmp copy_bytes
+copy_dwords:
+ shr ACX,2
+ rep movsd
+ jmp copy_done
+
+copy_reverse:
+ ; Copy from right to left
+ pushf
+ cli
+ std
+ lea ASI,[ASI+ACX-1]
+ lea ADI,[ADI+ACX-1]
+ rep movsb
+ popf
+
+copy_done:
+%endmacro
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|