Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/drivers/bus/xhci.asm
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ xhci_init_msix_msi_done:
; Check for a valid version number
shr eax, 16 ; 16-bit version is in bits 31:16, shift to 15:0
cmp ax, 0x0100 ; Verify it is at least v1.0
jl xhci_init_error
jb xhci_init_error
mov eax, [rsi+xHCI_HCSPARAMS1] ; Gather MaxSlots (bits 7:0) and MaxPort (31:24)
mov byte [xhci_maxslots], al
rol eax, 8
Expand Down Expand Up @@ -1561,7 +1561,7 @@ xhci_check_command_event:
load_event:
call os_hpet_us
cmp rax, rdx
jg xhci_check_command_event_timeout
ja xhci_check_command_event_timeout
mov rax, [rsi]
cmp rax, 0
jne compare
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/ioapic.asm
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ os_ioapic_redirection:
and eax, 0x000000FF ; Clear the top 24 bits of EAX just in case
mov cl, [os_ioapic_mde] ; Get the Maximum amount of Redirection Entries
cmp al, cl ; Compare the Interrupt Vector to the MDE
jg os_ioapic_redirection_error ; If it is greater then bail out
ja os_ioapic_redirection_error ; If it is greater then bail out
mov ecx, eax
add eax, 0x20 ; Offset to start of Interrupts
push rcx
Expand Down
6 changes: 3 additions & 3 deletions src/drivers/lfb/lfb.asm
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ lfb_output_chars_nextchar:
dec rcx
lodsb ; Get char from string and store in AL
cmp al, 0x20
jge lfb_output_chars_nextchar_output
jae lfb_output_chars_nextchar_output
cmp al, 0x0A ; LF - Check if there was a newline (aka line feed) character in the string
je lfb_output_chars_newline ; If so then we print a new line
cmp al, 0x0D ; CR - Check if there was a carriage return character in the string
Expand Down Expand Up @@ -338,9 +338,9 @@ lfb_glyph:
; Filter out characters that can't be displayed
and eax, 0x000000FF ; Only keep AL
cmp al, 0x20
jl hidden
jb hidden
cmp al, 127
jg hidden
ja hidden
sub rax, 0x20
jmp load_char
hidden:
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/nvs/ahci.asm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ahci_init:
mov eax, [rsi+AHCI_VS]
ror eax, 16 ; Rotate EAX so MJR is bits 15:00
cmp al, 0x01
jl ahci_init_error
jb ahci_init_error
mov [os_AHCI_MJR], al
rol eax, 8 ; Rotate EAX so MNR is bits 07:00
mov [os_AHCI_MNR], al
Expand Down Expand Up @@ -247,7 +247,7 @@ ahci_io_prep_next_drive:
ahci_io_prep_good_drive_id:

cmp rcx, 8192 ; Are we trying to read more that 4MiB?
jge achi_io_error ; If so, bail out
jae achi_io_error ; If so, bail out

push rcx ; Save the sector count
push rdi ; Save the destination memory address
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/nvs/ata.asm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ata_io:

; A single request can read 128KiB
cmp rcx, 256
jg ata_io_fail ; Over 256? Fail!
ja ata_io_fail ; Over 256? Fail!
; TODO - Don't fail. Break the read into multiple requests
jne ata_io_skip ; Not 256? No need to modify CL
xor rcx, rcx ; 0 translates to 256
Expand Down Expand Up @@ -92,7 +92,7 @@ ata_io_wait:
jne ata_io_dataready
ata_io_retry:
dec rcx
jg ata_io_wait
ja ata_io_wait
ata_io_nextsector:
in al, dx ; Read status from 0x01F7
test al, 0x80 ; BSY flag set?
Expand Down
10 changes: 5 additions & 5 deletions src/drivers/nvs/nvme.asm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ nvme_init:
mov eax, [rsi+NVMe_VS]
ror eax, 16 ; Rotate EAX so MJR is bits 15:00
cmp al, 0x01
jl nvme_init_error
jb nvme_init_error
mov [os_NVMeMJR], al
rol eax, 8 ; Rotate EAX so MNR is bits 07:00
mov [os_NVMeMNR], al
Expand Down Expand Up @@ -163,7 +163,7 @@ nvme_init_LBA_next:
shr eax, 16 ; AL holds the LBADS
mov bl, al ; BL holds the highest LBADS so far
cmp al, bl
jle nvme_init_LBA_skip
jbe nvme_init_LBA_skip
mov bl, al ; BL holds the highest LBADS so far
nvme_init_LBA_skip:
dec cl
Expand Down Expand Up @@ -249,7 +249,7 @@ nvme_admin:
mov ecx, eax ; Save the old Admin tail value for reading from the completion ring
add al, 1 ; Add 1 to it
cmp al, 64 ; Is it 64 or greater?
jl nvme_admin_savetail
jb nvme_admin_savetail
xor eax, eax ; Is so, wrap around to 0
nvme_admin_savetail:
mov [os_NVMe_atail], al ; Save the tail for the next command
Expand Down Expand Up @@ -343,7 +343,7 @@ nvme_io_setup:
; For 8193+ bytes PRP2 points to a list of more PRPs
push rcx ; Save the requested sector count for later
cmp rcx, 2
jle nvme_io_calc_rpr2_skip
jbe nvme_io_calc_rpr2_skip
sub rcx, 1 ; Subtract one as PTR1 covers one 4K load
push rdi
mov rdi, os_nvme_rpr ; Space to build the RPR2 structure
Expand Down Expand Up @@ -381,7 +381,7 @@ nvme_io_calc_rpr2_end:
mov ecx, eax ; Save the old I/O tail value for reading from the completion ring
add al, 1 ; Add 1 to it
cmp al, 64 ; Is it 64 or greater?
jl nvme_io_savetail
jb nvme_io_savetail
xor eax, eax ; Is so, wrap around to 0
nvme_io_savetail:
mov [os_NVMe_iotail], al ; Save the tail for the next command
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/ps2.asm
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ mouse_skip_y_movement:
cmp ax, 0xF000 ; Check if it wrapped around below 0
ja checkx_min ; If so jump to min
cmp ax, bx ; Check X value against valid max pixel location
jle checkx_end ; If less or equal then mouse cursor is on screen
jbe checkx_end ; If less or equal then mouse cursor is on screen
checkx_max: ; If greater then mouse cursor has moved off the right edge
mov [os_ps2_mouse_x], bx ; Set the mouse X location to Screen X-1
jmp checkx_end
Expand All @@ -255,7 +255,7 @@ checkx_end:
cmp ax, 0xF000 ; Check if it wrapped around below 0
ja checky_min ; If so jump to min
cmp ax, bx ; Check Y value against valid max pixel location
jle checky_end ; If less or equal then mouse cursor is on screen
jbe checky_end ; If less or equal then mouse cursor is on screen
checky_max: ; If greater then mouse cursor has moved off the bottom edge
mov [os_ps2_mouse_y], bx ; Set the mouse Y location to Screen Y-1
jmp checky_end
Expand Down
4 changes: 2 additions & 2 deletions src/syscalls/debug.asm
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ os_debug_dump_al:
shr al, 4 ; Shift the high 4 bits into the low 4, high bits cleared
or al, '0' ; Add "0"
cmp al, '9'+1 ; Digit?
jl os_debug_dump_al_h ; Yes, store it
jb os_debug_dump_al_h ; Yes, store it
add al, 7 ; Add offset for character "A"
os_debug_dump_al_h:
mov [tchar+0], al ; Store first character
pop ax ; Restore AX
and al, 0x0F ; Keep only the low 4 bits
or al, '0' ; Add "0"
cmp al, '9'+1 ; Digit?
jl os_debug_dump_al_l ; Yes, store it
jb os_debug_dump_al_l ; Yes, store it
add al, 7 ; Add offset for character "A"
os_debug_dump_al_l:
mov [tchar+1], al ; Store second character
Expand Down
2 changes: 1 addition & 1 deletion src/syscalls/net.asm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ b_net_tx:

b_net_tx_maxcheck:
cmp rcx, 1522 ; Fail if more than 1522 bytes
jg b_net_tx_fail
ja b_net_tx_fail

mov rax, os_NetLock ; Lock the net so only one send can happen at a time
call b_smp_lock
Expand Down
2 changes: 1 addition & 1 deletion src/syscalls/smp.asm
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ b_smp_setflag:
push rax

cmp rcx, 4 ; If a value higher than 3 was chosen then bail out
jge b_smp_setflag_done
jae b_smp_setflag_done

call b_smp_get_id ; Return APIC ID in RAX

Expand Down
2 changes: 1 addition & 1 deletion src/syscalls/system.asm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
; All other registers preserved
b_system:
cmp rcx, 0x80
jge b_system_end
jae b_system_end

; Use CX register as an index to the function table
; To save memory, the functions are placed in 16-bit frames
Expand Down