git.ucc.asn.au
/
tpg
/
acess2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d9d6e13
)
Kernel - Fixed compilation of x86_64 and armv7
author
John Hodge
<
[email protected]
>
Thu, 19 Sep 2013 04:30:57 +0000
(12:30 +0800)
committer
John Hodge
<
[email protected]
>
Thu, 19 Sep 2013 04:30:57 +0000
(12:30 +0800)
KernelLand/Kernel/arch/armv6/proc.S
patch
|
blob
|
history
KernelLand/Kernel/arch/armv7/proc.S
patch
|
blob
|
history
KernelLand/Kernel/arch/x86_64/proc.asm
patch
|
blob
|
history
KernelLand/Kernel/arch/x86_64/time.c
patch
|
blob
|
history
diff --git
a/KernelLand/Kernel/arch/armv6/proc.S
b/KernelLand/Kernel/arch/armv6/proc.S
index
1979058
..
6287314
100644
(file)
--- a/
KernelLand/Kernel/arch/armv6/proc.S
+++ b/
KernelLand/Kernel/arch/armv6/proc.S
@@
-95,6
+95,16
@@
Proc_int_DropToUser:
cps #16
mov sp, r1
mov pc, r0
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:
.section .rodata
csProc_CloneInt_NewTaskMessage:
diff --git
a/KernelLand/Kernel/arch/armv7/proc.S
b/KernelLand/Kernel/arch/armv7/proc.S
index
1979058
..
d7cc2c2
100644
(file)
--- a/
KernelLand/Kernel/arch/armv7/proc.S
+++ b/
KernelLand/Kernel/arch/armv7/proc.S
@@
-95,6
+95,15
@@
Proc_int_DropToUser:
cps #16
mov sp, r1
mov pc, r0
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:
.section .rodata
csProc_CloneInt_NewTaskMessage:
diff --git
a/KernelLand/Kernel/arch/x86_64/proc.asm
b/KernelLand/Kernel/arch/x86_64/proc.asm
index
f3b3a28
..
aff670a
100644
(file)
--- a/
KernelLand/Kernel/arch/x86_64/proc.asm
+++ b/
KernelLand/Kernel/arch/x86_64/proc.asm
@@
-147,4
+147,15
@@
Proc_RestoreSSE:
fxrstor [rdi]
ret
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
; vim: ft=nasm
diff --git
a/KernelLand/Kernel/arch/x86_64/time.c
b/KernelLand/Kernel/arch/x86_64/time.c
index
03c889f
..
fabd928
100644
(file)
--- a/
KernelLand/Kernel/arch/x86_64/time.c
+++ b/
KernelLand/Kernel/arch/x86_64/time.c
@@
-5,12
+5,14
@@
*/
#include <acess.h>
#include <arch_config.h>
*/
#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)
// === 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;
// === IMPORTS ===
extern volatile Sint64 giTimestamp;
@@
-103,6
+105,21
@@
void Time_TimerThread(void)
}
#endif
}
#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;
Uint64 Time_ReadTSC(void)
{
Uint32 a, d;
UCC
git Repository :: git.ucc.asn.au