Refactoring_1
This commit is contained in:
parent
d5912f4a7a
commit
6321366a24
|
@ -0,0 +1,17 @@
|
|||
global hal_spin_lock;
|
||||
global hal_spin_unlock;
|
||||
|
||||
;void hal_spin_lock(uint32_t * lock)
|
||||
hal_spin_lock:
|
||||
xor rcx,rcx
|
||||
inc rcx
|
||||
.spin:
|
||||
xor rax,rax
|
||||
lock cmpxchg dword [rdi],ecx
|
||||
jnz .spin
|
||||
ret
|
||||
|
||||
;void hal_spin_unlock(uint32_t * lock)
|
||||
hal_spin_unlock:
|
||||
mov dword [rdi],0
|
||||
ret
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef HAL_API_H
|
||||
#define HAL_API_H
|
||||
|
||||
#include "../common/kdef.h"
|
||||
#include "../common/type.h"
|
||||
//INTERRUPT
|
||||
void NATIVE64 hal_set_interrupt_handler(uint64_t index, void (*handler)(void));
|
||||
void NATIVE64 hal_enable_interrupt();
|
||||
void NATIVE64 hal_disable_interrupt();
|
||||
|
||||
//concurrency
|
||||
extern void NATIVE64 hal_spin_lock(uint32_t * lock);
|
||||
extern void NATIVE64 hal_spin_unlock(uint32_t * lock);
|
||||
|
||||
//output
|
||||
void NATIVE64 hal_printf();
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue