Refactoring_1

This commit is contained in:
HyperAssembler 2015-04-19 23:39:33 -07:00
parent d5912f4a7a
commit 6321366a24
2 changed files with 35 additions and 0 deletions

View File

@ -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

18
x64/src/c/hal/api.h Normal file
View File

@ -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