diff --git a/LICENSE b/LICENSE index 5c22cee..91eac64 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 Return Infinity +Copyright (c) 2026 Return Infinity Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/docs/CREDITS.TXT b/docs/CREDITS.TXT index c632931..f6c2652 100644 --- a/docs/CREDITS.TXT +++ b/docs/CREDITS.TXT @@ -1,17 +1,17 @@ -=============================================================================== -Pure64 -- a 64-bit loader written in Assembly for x86-64 systems -Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT -=============================================================================== - - -PROJECT ADMIN (MAIN CODE AND DOCUMENTATION) - - * Ian Seyler -- ian.seyler@returninfinity.com - - -DEVELOPMENT AND TESTING - - * Members of OSDev.org - - -=============================================================================== +=============================================================================== +Pure64 -- a 64-bit loader written in Assembly for x86-64 systems +Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT +=============================================================================== + + +PROJECT ADMIN (MAIN CODE AND DOCUMENTATION) + + * Ian Seyler -- ian.seyler@returninfinity.com + + +DEVELOPMENT AND TESTING + + * Members of OSDev.org + + +=============================================================================== diff --git a/src/boot/bios-floppy.asm b/src/boot/bios-floppy.asm index c34b315..8565cea 100644 --- a/src/boot/bios-floppy.asm +++ b/src/boot/bios-floppy.asm @@ -1,6 +1,6 @@ ; ============================================================================= ; Pure64 MBR -- a 64-bit OS/software loader written in Assembly for x86-64 systems -; Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT +; Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT ; ; This Master Boot Record will load Pure64 from a pre-defined location on the ; floppy drive without making use of the file system. @@ -149,13 +149,13 @@ VBESearch: ; Read the 2nd stage boot loader into memory. ; Load 4 cylinders - 7 sectors - mov byte [cylinder], 0 + mov byte [cylinder], 0 mov word [sec_buff], 0x7E00 ; For simplicity load whole cylinder but jump to 0x8000 call load_sector mov byte [head], 1 mov word [sec_buff], 0xA200 call load_sector - mov byte [cylinder], 1 + mov byte [cylinder], 1 mov byte [head], 0 mov word [sec_buff], 0xC600 call load_sector diff --git a/src/boot/bios-novideo.asm b/src/boot/bios-novideo.asm index 6b06766..5b0e86d 100644 --- a/src/boot/bios-novideo.asm +++ b/src/boot/bios-novideo.asm @@ -1,6 +1,6 @@ ; ============================================================================= ; Pure64 MBR -- a 64-bit OS/software loader written in Assembly for x86-64 systems -; Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT +; Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT ; ; This Master Boot Record will load Pure64 from a pre-defined location on the ; hard drive without making use of the file system. diff --git a/src/boot/bios-pxe.asm b/src/boot/bios-pxe.asm index 184e5b9..8152094 100644 --- a/src/boot/bios-pxe.asm +++ b/src/boot/bios-pxe.asm @@ -1,6 +1,6 @@ ; ============================================================================= ; Pure64 PXE Start -- a 64-bit OS/software loader written in Assembly for x86-64 systems -; Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT +; Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT ; ; This is a stub file for loading Pure64 and a kernel/software package via PXE. ; diff --git a/src/boot/bios.asm b/src/boot/bios.asm index 8d96404..b927e31 100644 --- a/src/boot/bios.asm +++ b/src/boot/bios.asm @@ -1,6 +1,6 @@ ; ============================================================================= ; Pure64 MBR -- a 64-bit OS/software loader written in Assembly for x86-64 systems -; Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT +; Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT ; ; This Master Boot Record will load Pure64 from a pre-defined location on the ; hard drive without making use of the file system. diff --git a/src/boot/uefi.asm b/src/boot/uefi.asm index 0a8e366..72b806d 100644 --- a/src/boot/uefi.asm +++ b/src/boot/uefi.asm @@ -1,6 +1,6 @@ ; ============================================================================= ; UEFI loader for Pure64 -; Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT +; Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT ; ; Adapted from https://stackoverflow.com/questions/72947069/how-to-write-hello-world-efi-application-in-nasm ; and https://github.com/charlesap/nasm-uefi/blob/master/shoe-x64.asm diff --git a/src/fdc/dma.asm b/src/fdc/dma.asm index 16ee24a..cd2bc1a 100644 --- a/src/fdc/dma.asm +++ b/src/fdc/dma.asm @@ -1,6 +1,6 @@ ; ============================================================================= ; DMA Driver -; Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT +; Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT ; Implemented by Isa Isoux -- https://github.com/isoux/BMFLFS ; The DMA controller performs data transfers: @@ -31,7 +31,7 @@ DMA1_CHR_ADDR EQU 0x81 ; bl = channel ; bh = 1 = read, 0 = write ; esi = count -dma_IO: +dma_IO: ; Examine whether it is writing or reading ; what_mode diff --git a/src/fdc/fdc_64.asm b/src/fdc/fdc_64.asm index c166dc5..e8c1418 100644 --- a/src/fdc/fdc_64.asm +++ b/src/fdc/fdc_64.asm @@ -1,12 +1,12 @@ ; ============================================================================= ; Floppy Disk Driver -; Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT +; Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT ; Implemented by Isa Isoux -- https://github.com/isoux/BMFLFS -; Here is a minimal simplified version intended only for reading whole floppy +; Here is a minimal simplified version intended only for reading whole floppy ; disk into memory or writing back image from memory to whole disk at once. -; Errors are poorly handled due to the simplicity of the handling, one thing -; that can be easily noticed is that the disk is damaged and does not load +; Errors are poorly handled due to the simplicity of the handling, one thing +; that can be easily noticed is that the disk is damaged and does not load ; completely. ; FDC - Floppy Disk Controler diff --git a/src/init/acpi.asm b/src/init/acpi.asm index 7cbdcf3..4aa928f 100644 --- a/src/init/acpi.asm +++ b/src/init/acpi.asm @@ -1,6 +1,6 @@ ; ============================================================================= ; Pure64 -- a 64-bit OS/software loader written in Assembly for x86-64 systems -; Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT +; Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT ; ; INIT ACPI ; diff --git a/src/init/cpu.asm b/src/init/cpu.asm index 75b4f00..3dd992f 100644 --- a/src/init/cpu.asm +++ b/src/init/cpu.asm @@ -1,6 +1,6 @@ ; ============================================================================= ; Pure64 -- a 64-bit OS/software loader written in Assembly for x86-64 systems -; Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT +; Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT ; ; INIT CPU - This code is called by all activated CPU cores in the system ; ============================================================================= diff --git a/src/init/serial.asm b/src/init/serial.asm index c4c674d..73e730f 100644 --- a/src/init/serial.asm +++ b/src/init/serial.asm @@ -1,6 +1,6 @@ ; ============================================================================= ; Pure64 -- a 64-bit OS/software loader written in Assembly for x86-64 systems -; Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT +; Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT ; ; INIT SERIAL - 115200 bps, 8N1 (8 data bits, no parity, and 1 stop bit) ; ============================================================================= diff --git a/src/init/smp.asm b/src/init/smp.asm index 7d4d511..40810e8 100644 --- a/src/init/smp.asm +++ b/src/init/smp.asm @@ -1,6 +1,6 @@ ; ============================================================================= ; Pure64 -- a 64-bit OS/software loader written in Assembly for x86-64 systems -; Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT +; Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT ; ; INIT SMP ; ============================================================================= diff --git a/src/init/smp_ap.asm b/src/init/smp_ap.asm index cc73ff9..26376a9 100644 --- a/src/init/smp_ap.asm +++ b/src/init/smp_ap.asm @@ -1,6 +1,6 @@ ; ============================================================================= ; Pure64 -- a 64-bit OS/software loader written in Assembly for x86-64 systems -; Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT +; Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT ; ; INIT SMP AP ; ============================================================================= diff --git a/src/init/timer.asm b/src/init/timer.asm index d629359..b5027d7 100644 --- a/src/init/timer.asm +++ b/src/init/timer.asm @@ -1,6 +1,6 @@ ; ============================================================================= ; Pure64 -- a 64-bit OS/software loader written in Assembly for x86-64 systems -; Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT +; Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT ; ; INIT TIMER ; ============================================================================= diff --git a/src/interrupt.asm b/src/interrupt.asm index dda8092..8cbbd1f 100644 --- a/src/interrupt.asm +++ b/src/interrupt.asm @@ -1,6 +1,6 @@ ; ============================================================================= ; Pure64 -- a 64-bit OS/software loader written in Assembly for x86-64 systems -; Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT +; Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT ; ; Interrupts ; ============================================================================= diff --git a/src/pure64.asm b/src/pure64.asm index e402ab9..f466aa8 100644 --- a/src/pure64.asm +++ b/src/pure64.asm @@ -1,6 +1,6 @@ ; ============================================================================= ; Pure64 -- a 64-bit OS/software loader written in Assembly for x86-64 systems -; Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT +; Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT ; ; The first stage loader is required to gather information about the system ; while the BIOS or UEFI is still available and load the Pure64 binary to @@ -68,6 +68,12 @@ bootmode: mov [0x5FFC], edx mov [0x5FF8], eax + ; Set up the Page Attribute Table (PAT). This will happen twice for the BSP. + mov edx, 0x00000105 ; PA7 UC (00), PA6 UC (00), PA5 WC (01), PA4 WP (05) + mov eax, 0x00070406 ; PA3 UC (00), PA2 UC- (07), PA1 WT (04), PA0 WB (06) + mov ecx, IA32_PAT + wrmsr + mov eax, 16 ; Set the correct segment registers mov ds, ax mov es, ax @@ -117,7 +123,7 @@ bootmode: stosw ; BitsPerPixel %endif - ; Clear memory for the Page Descriptor Entries (0x210000 - 0x25FFFF) + ; Clear memory for the temporary Page Descriptor Entries (0x210000 - 0x25FFFF) mov edi, 0x00210000 mov ecx, 320 * 1024 / 4 rep stosd ; Write 320KiB @@ -168,6 +174,28 @@ pde_low_32: ; Create a 2 MiB page cmp ecx, 2048 jne pde_low_32 ; Create 2048 2 MiB page maps. +%ifndef NOVIDEO +; Set the Linear Frame Buffer memory to WC +lfb_twc_2MB: + mov ecx, 4 ; 4 2MiB pages - TODO only set the pages needed + mov edi, 0x00210000 + mov eax, [0x00005F00] ; Base address of video memory + shr eax, 18 + add edi, eax +lfb_twc_2MB_nextpage: + mov eax, [edi] ; Load the 8-byte value + or ax, 0x1008 ; Set bits 12 (PAT) and 3 (PWT) + and ax, 0xFFEF ; Clear bit 4 (PCD) + mov [edi], eax ; Write it back + add edi, 8 + sub ecx, 1 + jnz lfb_twc_2MB_nextpage +lfb_twc_end: + mov eax, cr3 ; Flush TLB + mov cr3, eax + wbinvd ; Flush Cache +%endif + ; Load the GDT lgdt [tGDTR64] diff --git a/src/sysvar.asm b/src/sysvar.asm index eb46fa2..4cfaad3 100644 --- a/src/sysvar.asm +++ b/src/sysvar.asm @@ -1,6 +1,6 @@ ; ============================================================================= ; Pure64 -- a 64-bit OS/software loader written in Assembly for x86-64 systems -; Copyright (C) 2008-2025 Return Infinity -- see LICENSE.TXT +; Copyright (C) 2008-2026 Return Infinity -- see LICENSE.TXT ; ; System Variables ; =============================================================================