Import backup from 2005-12-31

This commit is contained in:
josh committed 2017-07-25 22:23:52 -04:00
1 parent 712337c485
commit 89d962e33a
20 files changed
+521 -78

No files matched your search

+37
View File
@@ -3,6 +3,7 @@
; Created: 10/23/03
; Modified: 12/30/04
[bits 32]
%macro jzfar 1
jnz %%skip
@@ -11,6 +12,42 @@
%endmacro
;implements a lock
[global _lock]
_lock:
push ebp
mov ebp, esp
push eax
push ebx
push esi
mov esi, [ebp + 8]
_lock_loop0:
xor eax, eax
mov ebx, 1
cmpxchg [esi], ebx
jnz _lock_loop0 ; failed to acquire lock
pop esi
pop ebx
pop eax
pop ebp
ret
;releases a lock
[global _unlock]
_unlock:
push ebp
mov ebp, esp
push esi
mov esi, [ebp + 8]
mov [esi], dword 0
pop esi
pop ebp
ret
;returns the value in the CR0 register
;extern dword read_cr0();
[global _read_cr0]
+2
View File
@@ -9,6 +9,8 @@
#include "hos_defines.h"
/* lang.asm */
void lock(lock_t *addr);
void unlock(lock_t *addr);
u32_t read_cr0();
u32_t write_cr0(u32_t cr0);
u32_t read_cr2();