Added integer hash function. Other minor changes.
This commit is contained in:
parent
d8750b74f8
commit
fad439c25e
9
kernel/arch/i386/hash.nim
Normal file
9
kernel/arch/i386/hash.nim
Normal file
@ -0,0 +1,9 @@
|
||||
const
|
||||
FNVPrime = 16777619'u32
|
||||
FNVOffsetBasis = 0x811c9dc5'u32
|
||||
|
||||
proc fnv1a*(data: varargs[uint8]): uint32 =
|
||||
result = FNVOffsetBasis
|
||||
for i in data:
|
||||
result = result xor i
|
||||
result = result * FNVPrime
|
@ -56,7 +56,7 @@ proc isrCommon(){.asmNoStackFrame,exportc.} =
|
||||
"""
|
||||
]#
|
||||
|
||||
macro generateISR(code: static[uint8], isError: static[bool]): typed =
|
||||
macro generateISR(code: static[int], isError: static[bool]): typed =
|
||||
result = nnkStmtList.newTree(
|
||||
nnkProcDef.newTree(
|
||||
newIdentNode("isr" & $code),
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* http://wiki.osdev.org/Bare_Bones#Linking_the_Kernel */
|
||||
ENTRY(_start)
|
||||
OUTPUT_FORMAT(elf32-i386)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
@ -1,16 +0,0 @@
|
||||
import io
|
||||
|
||||
const keyboardAddress = 0x60
|
||||
|
||||
type
|
||||
KeypressEvent* = tuple
|
||||
character: char
|
||||
pressed: bool
|
||||
|
||||
proc getScancode(): char =
|
||||
while true:
|
||||
let c = io.inb(keyboardAddress)
|
||||
if(c > 0): return c
|
||||
|
||||
proc getChar*(): char =
|
||||
discard # TODO: Implement lookup to a scan table to get actual character
|
@ -7,4 +7,5 @@ deadCodeElim=on
|
||||
boundChecks=on
|
||||
gc=regions
|
||||
cpu=i386
|
||||
os=standalone
|
||||
os=standalone
|
||||
verbosity=2
|
Loading…
Reference in New Issue
Block a user