Kernel - Fixed compilation of x86_64 and armv7
authorJohn Hodge <[email protected]>
Thu, 19 Sep 2013 04:30:57 +0000 (12:30 +0800)
committerJohn Hodge <[email protected]>
Thu, 19 Sep 2013 04:30:57 +0000 (12:30 +0800)
KernelLand/Kernel/arch/armv6/proc.S
KernelLand/Kernel/arch/armv7/proc.S
KernelLand/Kernel/arch/x86_64/proc.asm
KernelLand/Kernel/arch/x86_64/time.c

index 1979058..6287314 100644 (file)
@@ -95,6 +95,16 @@ Proc_int_DropToUser:
        cps #16
        mov sp, r1
        mov pc, r0
+.globl User_Signal_Kill
+@ R0: Signal
+User_Signal_Kill:
+       mov r1, r0
+       and r1, 0x00FF
+       or r1, 0x0200
+       mov r0, 0
+       swi 0
+       b .
+
 
 .section .rodata
 csProc_CloneInt_NewTaskMessage:
index 1979058..d7cc2c2 100644 (file)
@@ -95,6 +95,15 @@ Proc_int_DropToUser:
        cps #16
        mov sp, r1
        mov pc, r0
+.globl User_Signal_Kill
+@ R0: Signal
+User_Signal_Kill:
+       mov r1, r0
+       and r1, #0x00FF
+       orr r1, #0x0200
+       mov r0, #0
+       swi 0
+       b .
 
 .section .rodata
 csProc_CloneInt_NewTaskMessage:
index f3b3a28..aff670a 100644 (file)
@@ -147,4 +147,15 @@ Proc_RestoreSSE:
        fxrstor [rdi]
        ret
 
+[section .usertext]
+
+[global User_Signal_Kill]
+User_Signal_Kill:
+       xor rax, rax
+       mov bx, di
+       mov bh, 0x02
+       int 0xAC
+       jmp $
+
+
 ; vim: ft=nasm
index 03c889f..fabd928 100644 (file)
@@ -5,12 +5,14 @@
  */
 #include <acess.h>
 #include <arch_config.h>
+#include <timers.h>
 
 // === MACROS ===
 #define        TIMER_QUANTUM   100
 #define TIMER_FREQ     PIT_TIMER_BASE_N/(PIT_TIMER_BASE_D*PIT_TIMER_DIVISOR)
 #define MS_PER_TICK_WHOLE      (1000*(PIT_TIMER_BASE_D*PIT_TIMER_DIVISOR)/PIT_TIMER_BASE_N)
 #define MS_PER_TICK_FRACT      ((0x80000000ULL*1000ULL*PIT_TIMER_BASE_D*PIT_TIMER_DIVISOR/PIT_TIMER_BASE_N)&0x7FFFFFFF)
+#define US_PER_TICK    (1000*1000/(TIMER_FREQ))
 
 // === IMPORTS ===
 extern volatile Sint64 giTimestamp;
@@ -103,6 +105,21 @@ void Time_TimerThread(void)
 }
 #endif
 
+void Time_MicroSleep(Uint16 Microsecs) // max 64 ms
+{
+       Uint64  cur_tsc = Time_ReadTSC();
+       // tsc_per_us * Microsec
+       Uint64  delta_tsc = (Uint64)Microsecs * giTime_TSCPerTick / US_PER_TICK;
+       Uint64  tgt_tsc = cur_tsc + delta_tsc;
+
+       if( tgt_tsc < cur_tsc )
+               while(Time_ReadTSC() > cur_tsc)
+                       ;       
+
+       while( Time_ReadTSC() < tgt_tsc )
+               ;
+}
+
 Uint64 Time_ReadTSC(void)
 {
        Uint32  a, d;

UCC git Repository :: git.ucc.asn.au