chore: sorry
This commit is contained in:
parent
2386bcc417
commit
0cf565c93c
|
@ -109,8 +109,8 @@ _start:
|
||||||
include '../common/bios.inc'
|
include '../common/bios.inc'
|
||||||
include '../common/fat12.inc'
|
include '../common/fat12.inc'
|
||||||
|
|
||||||
msg_error db "ERROR: ", 0
|
msg_error db "ERROR: ", 0
|
||||||
msg_not_found db " not found", CR, LF, 0
|
msg_not_found db " not found", CR, LF, 0
|
||||||
|
|
||||||
kernel_file db "VMSTUPIDSYS", 0
|
kernel_file db "VMSTUPIDSYS", 0
|
||||||
stage1_file db "STPDLDR SYS", 0
|
stage1_file db "STPDLDR SYS", 0
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
;; File: bios.inc
|
;; File: bios.inc
|
||||||
|
|
||||||
|
|
||||||
;; Function: bios_print
|
;; Function: bios_print
|
||||||
;;
|
;;
|
||||||
;; Parameters:
|
;; Parameters:
|
||||||
|
|
|
@ -48,6 +48,8 @@ efimain:
|
||||||
section '.data' data readable writeable
|
section '.data' data readable writeable
|
||||||
|
|
||||||
hello_msg du 'StupidOS EFI Bootloader', 13, 10, 0
|
hello_msg du 'StupidOS EFI Bootloader', 13, 10, 0
|
||||||
|
|
||||||
|
; Search path: / /boot /boot/efi
|
||||||
kernel_file du 'vmstupid.sys', 0
|
kernel_file du 'vmstupid.sys', 0
|
||||||
|
|
||||||
handle dd ?
|
handle dd ?
|
||||||
|
|
|
@ -2,6 +2,20 @@ File: Introduction
|
||||||
|
|
||||||
About: Legacy
|
About: Legacy
|
||||||
|
|
||||||
|
>
|
||||||
|
> +------------+
|
||||||
|
> | bootsector |---+
|
||||||
|
> +------------+ | +-------------+ +--------------+
|
||||||
|
> +------>| stpdldr.sys |------>| vmstupid.sys |
|
||||||
|
> +-----------+ | +-------------+ +--------------+
|
||||||
|
> | multiboot |----+
|
||||||
|
> +-----------+
|
||||||
|
>
|
||||||
|
|
||||||
About: UEFI
|
About: UEFI
|
||||||
|
|
||||||
|
>
|
||||||
|
> +--------------+ +--------------+
|
||||||
|
> | BOOTIA32.EFI |----->| vmstupid.sys |
|
||||||
|
> +--------------+ +--------------+
|
||||||
|
>
|
||||||
|
|
|
@ -18,6 +18,7 @@ _start:
|
||||||
je multiboot
|
je multiboot
|
||||||
|
|
||||||
use16
|
use16
|
||||||
|
align 2
|
||||||
|
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
; real mode code
|
; real mode code
|
||||||
|
@ -28,19 +29,34 @@ _start:
|
||||||
mov si, msg_stage2
|
mov si, msg_stage2
|
||||||
call bios_print
|
call bios_print
|
||||||
|
|
||||||
|
; enable A20 line
|
||||||
call a20_enable
|
call a20_enable
|
||||||
jc .error_a20
|
jc .error_a20
|
||||||
|
|
||||||
; detect memory
|
; fetch memory map from bios
|
||||||
call memory_get_map
|
call memory_get_map
|
||||||
jc .error_memory
|
jc .error_memory
|
||||||
|
|
||||||
|
; video information
|
||||||
call video_setup
|
call video_setup
|
||||||
|
xchg bx, bx
|
||||||
|
|
||||||
;cli
|
; load GDT and enter Protected-Mode
|
||||||
;lgdt [gdt_ptr]
|
lgdt [gdt_ptr]
|
||||||
;jmp 0x8:common32
|
|
||||||
;jmp $
|
; enable protected mode
|
||||||
|
mov eax, cr0
|
||||||
|
or al, 1
|
||||||
|
mov cr0, eax
|
||||||
|
|
||||||
|
; reload ds, es, fs, gs, ss
|
||||||
|
mov ax, 0x10
|
||||||
|
mov ds, ax
|
||||||
|
mov es, ax
|
||||||
|
mov fs, ax
|
||||||
|
mov gs, ax
|
||||||
|
mov ss, ax
|
||||||
|
jmp 0x8:common32
|
||||||
|
|
||||||
.error_memory:
|
.error_memory:
|
||||||
mov si, msg_error_memory
|
mov si, msg_error_memory
|
||||||
|
@ -59,23 +75,26 @@ _start:
|
||||||
include 'video.inc'
|
include 'video.inc'
|
||||||
include 'gdt.inc'
|
include 'gdt.inc'
|
||||||
|
|
||||||
msg_stage2 db "StupidOS Bootloader (Stage 1)", CR, LF, 0
|
msg_stage2 db "StupidOS Loader", CR, LF, 0
|
||||||
msg_error_a20 db "ERROR: can't enable a20 line", CR, LF, 0
|
msg_error_a20 db "ERROR: can't enable a20 line", CR, LF, 0
|
||||||
msg_error_memory db "ERROR: can't detect available memory", CR, LF, 0
|
msg_error_memory db "ERROR: can't detect available memory", CR, LF, 0
|
||||||
|
|
||||||
;;
|
|
||||||
bi_screen_width: dw 0
|
|
||||||
bi_screen_height: dw 0
|
|
||||||
|
|
||||||
use32
|
use32
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
; protected mode code
|
; protected mode code
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
multiboot:
|
multiboot:
|
||||||
|
; https://www.gnu.org/software/grub/manual/multiboot/multiboot.html#Machine-state
|
||||||
|
|
||||||
|
; get screen information
|
||||||
|
|
||||||
|
; get memory map
|
||||||
|
|
||||||
|
; get kernel from module
|
||||||
|
|
||||||
common32:
|
common32:
|
||||||
;mov bx, 0x0f01
|
mov dword [0xb8000], 0x07690748
|
||||||
;mov word [eax], bx
|
|
||||||
; paging
|
; paging
|
||||||
; identity map first 1MB
|
; identity map first 1MB
|
||||||
; map kernel to 0xC0000000
|
; map kernel to 0xC0000000
|
||||||
|
@ -86,13 +105,12 @@ hang:
|
||||||
|
|
||||||
_edata:
|
_edata:
|
||||||
|
|
||||||
|
boot_structure:
|
||||||
|
|
||||||
align 4096
|
align 4096
|
||||||
boot_page_directory:
|
boot_page_directory:
|
||||||
rb 4096
|
rb 4096
|
||||||
|
|
||||||
boot_0_page_table:
|
|
||||||
rb 4096
|
|
||||||
|
|
||||||
boot_768_page_table:
|
boot_768_page_table:
|
||||||
rb 4096
|
rb 4096
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Format: 1.51
|
Format: 1.52
|
||||||
|
|
||||||
|
|
||||||
Title: StupidOS
|
Title: StupidOS
|
||||||
|
@ -17,6 +17,11 @@ Timestamp: Updated yyyy/mm/dd
|
||||||
# yyyy - Four digit year. 2006 is "2006"
|
# yyyy - Four digit year. 2006 is "2006"
|
||||||
# year - Four digit year. 2006 is "2006"
|
# year - Four digit year. 2006 is "2006"
|
||||||
|
|
||||||
|
# These are indexes you deleted, so Natural Docs will not add them again
|
||||||
|
# unless you remove them from this line.
|
||||||
|
|
||||||
|
Don't Index: Macros, Variables, Classes
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -45,7 +50,7 @@ File: FAQ (docs/faq.txt)
|
||||||
|
|
||||||
Group: BootLoader {
|
Group: BootLoader {
|
||||||
|
|
||||||
File: Introduction (boot/intro.txt)
|
File: Introduction (boot/intro.txt)
|
||||||
|
|
||||||
Group: BootSector {
|
Group: BootSector {
|
||||||
|
|
||||||
|
@ -57,15 +62,15 @@ Group: BootLoader {
|
||||||
File: loader.asm (boot/loader/loader.asm)
|
File: loader.asm (boot/loader/loader.asm)
|
||||||
} # Group: Loader
|
} # Group: Loader
|
||||||
|
|
||||||
Group: Common {
|
Group: Common {
|
||||||
|
|
||||||
File: bios.inc (boot/common/bios.inc)
|
File: bios.inc (boot/common/bios.inc)
|
||||||
} # Group: Common
|
} # Group: Common
|
||||||
|
|
||||||
|
|
||||||
Group: EFI {
|
Group: EFI {
|
||||||
|
|
||||||
File: bootia32.asm (boot/efi/bootia32.asm)
|
File: bootia32.asm (boot/efi/bootia32.asm)
|
||||||
|
File: uefi.inc (boot/efi/uefi.inc)
|
||||||
} # Group: EFI
|
} # Group: EFI
|
||||||
|
|
||||||
} # Group: BootLoader
|
} # Group: BootLoader
|
||||||
|
@ -84,6 +89,16 @@ Group: Lib {
|
||||||
|
|
||||||
Group: Crypto {
|
Group: Crypto {
|
||||||
|
|
||||||
|
Group: chacha20 {
|
||||||
|
|
||||||
|
File: chacha20.asm (lib/crypto/chacha20/chacha20.asm)
|
||||||
|
} # Group: chacha20
|
||||||
|
|
||||||
|
Group: Dilithium {
|
||||||
|
|
||||||
|
File: ntt.asm (lib/crypto/dilithium/ntt.asm)
|
||||||
|
} # Group: Dilithium
|
||||||
|
|
||||||
Group: SHA2 {
|
Group: SHA2 {
|
||||||
|
|
||||||
File: sha256.asm (lib/crypto/sha2/sha256.asm)
|
File: sha256.asm (lib/crypto/sha2/sha256.asm)
|
||||||
|
|
|
@ -3,9 +3,4 @@ free_block_head dd 0x0
|
||||||
mm_init:
|
mm_init:
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
kernel_page_directory:
|
|
||||||
dd 0x1000 dup 0x0
|
|
||||||
kernel_page_table:
|
|
||||||
dd 0x1000 dup 0x0
|
|
4
kernel/vfs.inc
Normal file
4
kernel/vfs.inc
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
vfs_init:
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,10 @@ TARGET = libcrypto.a
|
||||||
OBJS = sha2/sha256.o sha2/sha512.o \
|
OBJS = sha2/sha256.o sha2/sha512.o \
|
||||||
chacha20/chacha20.o
|
chacha20/chacha20.o
|
||||||
INCS = sha2/sha2.h \
|
INCS = sha2/sha2.h \
|
||||||
chacha20/chacha20.h
|
chacha20/chacha20.h \
|
||||||
|
dilithium/dilithium.h \
|
||||||
|
falcon/falcon.h \
|
||||||
|
keccak/keccak.h
|
||||||
ASMS = sha2/sha2.inc \
|
ASMS = sha2/sha2.inc \
|
||||||
chacha20/chacha20.inc
|
chacha20/chacha20.inc
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
;; File: chacha20.asm
|
||||||
|
|
||||||
; https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant
|
; https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant
|
||||||
; https://datatracker.ietf.org/doc/html/rfc7539
|
; https://datatracker.ietf.org/doc/html/rfc7539
|
||||||
; https://cr.yp.to/chacha/chacha-20080120.pdf
|
; https://cr.yp.to/chacha/chacha-20080120.pdf
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
# include <stdint.h>
|
# include <stdint.h>
|
||||||
|
|
||||||
# define CHACHA20_KEY_BYTES 32
|
# define CHACHA20_KEY_BYTES 32
|
||||||
# define CHACHA20_NONCE_BYTES 12
|
# define CHACHA20_NONCE_BYTES 12
|
||||||
# define CHACHA20_BLOCK_BYTES 64
|
# define CHACHA20_BLOCK_BYTES 64
|
||||||
|
|
||||||
|
|
13
lib/crypto/dilithium/dilithium.h
Normal file
13
lib/crypto/dilithium/dilithium.h
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#ifndef CRYPTO_DILITHIUM_H
|
||||||
|
# define CRYPTO_DILITHIUM_H 1
|
||||||
|
|
||||||
|
# define DILITHIUM2_PUBLICKEY_BYTES 1312
|
||||||
|
# define DILITHIUM2_PRIVATEKEY_BYTES 2560
|
||||||
|
|
||||||
|
# define DILITHIUM3_PUBLICKEY_BYTES 1952
|
||||||
|
# define DILITHIUM3_PRIVATEKEY_BYTES 4032
|
||||||
|
|
||||||
|
# define DILITHIUM5_PUBLICKEY_BYTES 2592
|
||||||
|
# define DILITHIUM5_PRIVATEKEY_BYTES 4896
|
||||||
|
|
||||||
|
#endif /* !CRYPTO_DILITHIUM_H */
|
40
lib/crypto/dilithium/ntt.asm
Normal file
40
lib/crypto/dilithium/ntt.asm
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
;; File: ntt.asm
|
||||||
|
|
||||||
|
format COFF
|
||||||
|
use32
|
||||||
|
|
||||||
|
section '.data' data
|
||||||
|
;; Constant: zetas
|
||||||
|
zetas:
|
||||||
|
dd 0, 25847, -2608894, -518909, 237124, -777960, -876248, 466468,
|
||||||
|
dd 1826347, 2353451, -359251, -2091905, 3119733, -2884855, 3111497, 2680103,
|
||||||
|
dd 2725464, 1024112, -1079900, 3585928, -549488, -1119584, 2619752, -2108549,
|
||||||
|
dd -2118186, -3859737, -1399561, -3277672, 1757237, -19422, 4010497, 280005,
|
||||||
|
dd 2706023, 95776, 3077325, 3530437, -1661693, -3592148, -2537516, 3915439,
|
||||||
|
dd -3861115, -3043716, 3574422, -2867647, 3539968, -300467, 2348700, -539299,
|
||||||
|
dd -1699267, -1643818, 3505694, -3821735, 3507263, -2140649, -1600420, 3699596,
|
||||||
|
dd 811944, 531354, 954230, 3881043, 3900724, -2556880, 2071892, -2797779,
|
||||||
|
dd -3930395, -1528703, -3677745, -3041255, -1452451, 3475950, 2176455, -1585221,
|
||||||
|
dd -1257611, 1939314, -4083598, -1000202, -3190144, -3157330, -3632928, 126922,
|
||||||
|
dd 3412210, -983419, 2147896, 2715295, -2967645, -3693493, -411027, -2477047,
|
||||||
|
dd -671102, -1228525, -22981, -1308169, -381987, 1349076, 1852771, -1430430,
|
||||||
|
dd -3343383, 264944, 508951, 3097992, 44288, -1100098, 904516, 3958618,
|
||||||
|
dd -3724342, -8578, 1653064, -3249728, 2389356, -210977, 759969, -1316856,
|
||||||
|
dd 189548, -3553272, 3159746, -1851402, -2409325, -177440, 1315589, 1341330,
|
||||||
|
dd 1285669, -1584928, -812732, -1439742, -3019102, -3881060, -3628969, 3839961,
|
||||||
|
dd 2091667, 3407706, 2316500, 3817976, -3342478, 2244091, -2446433, -3562462,
|
||||||
|
dd 266997, 2434439, -1235728, 3513181, -3520352, -3759364, -1197226, -3193378,
|
||||||
|
dd 900702, 1859098, 909542, 819034, 495491, -1613174, -43260, -522500,
|
||||||
|
dd -655327, -3122442, 2031748, 3207046, -3556995, -525098, -768622, -3595838,
|
||||||
|
dd 342297, 286988, -2437823, 4108315, 3437287, -3342277, 1735879, 203044,
|
||||||
|
dd 2842341, 2691481, -2590150, 1265009, 4055324, 1247620, 2486353, 1595974,
|
||||||
|
dd -3767016, 1250494, 2635921, -3548272, -2994039, 1869119, 1903435, -1050970,
|
||||||
|
dd -1333058, 1237275, -3318210, -1430225, -451100, 1312455, 3306115, -1962642,
|
||||||
|
dd -1279661, 1917081, -2546312, -1374803, 1500165, 777191, 2235880, 3406031,
|
||||||
|
dd -542412, -2831860, -1671176, -1846953, -2584293, -3724270, 594136, -3776993,
|
||||||
|
dd -2013608, 2432395, 2454455, -164721, 1957272, 3369112, 185531, -1207385,
|
||||||
|
dd -3183426, 162844, 1616392, 3014001, 810149, 1652634, -3694233, -1799107,
|
||||||
|
dd -3038916, 3523897, 3866901, 269760, 2213111, -975884, 1717735, 472078,
|
||||||
|
dd -426683, 1723600, -1803090, 1910376, -1667432, -1104333, -260646, -3833893,
|
||||||
|
dd -2939036, -2235985, -420899, -2286327, 183443, -976891, 1612842, -3545687,
|
||||||
|
dd -554416, 3919660, -48306, -1362209, 3937738, 1400424, -846154, 1976782
|
10
lib/crypto/falcon/falcon.h
Normal file
10
lib/crypto/falcon/falcon.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#ifndef CRYPTO_FALCON_H
|
||||||
|
# define CRYPTO_FALCON_H 1
|
||||||
|
|
||||||
|
# define FALCON512_PUBLICKEY_BYTES 897
|
||||||
|
# define FALCON512_PRIVATEKEY_BYTES 1281
|
||||||
|
|
||||||
|
# define FALCON1024_PUBLICKEY_BYTES 1793
|
||||||
|
# define FALCON1024_PRIVATEKEY_BYTES 2305
|
||||||
|
|
||||||
|
#endif /* !CRYPTO_FALCON_H */
|
6
lib/crypto/keccak/keccak.h
Normal file
6
lib/crypto/keccak/keccak.h
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef CRYPTO_KECCAK_H
|
||||||
|
# define CRYPTO_KECCAK_H 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* !CRYPTO_KECCAK_H */
|
|
@ -1,5 +1,4 @@
|
||||||
;; File: lzp.asm
|
;; File: lzp.asm
|
||||||
|
|
||||||
|
|
||||||
; Lempel-Ziv + Prediction (a fast, efficient, and memory-use
|
; Lempel-Ziv + Prediction (a fast, efficient, and memory-use
|
||||||
; conservative compression algorithm)
|
; conservative compression algorithm)
|
||||||
|
@ -9,10 +8,11 @@
|
||||||
|
|
||||||
;; https://hugi.scene.org/online/coding/hugi%2012%20-%20colzp.htm
|
;; https://hugi.scene.org/online/coding/hugi%2012%20-%20colzp.htm
|
||||||
|
|
||||||
include 'lzp.inc'
|
LZP_HASH_ORDER = 16
|
||||||
|
LZP_HASH_SIZE = (1 shl LZP_HASH_ORDER)
|
||||||
|
|
||||||
LZP_HASH_ORDER = 16
|
public lzp_compress
|
||||||
LZP_HASH_SIZE = (1 shl LZP_HASH_ORDER)
|
public lzp_decompress
|
||||||
|
|
||||||
; hash(h, x) (h = (h << 4) ^ x)
|
; hash(h, x) (h = (h << 4) ^ x)
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
public lzp_compress
|
extrn lzp_compress
|
||||||
public lzp_decompress
|
extrn lzp_decompress
|
||||||
|
|
4
tests/Makefile
Normal file
4
tests/Makefile
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
TOPGOALS = all clean install
|
||||||
|
|
||||||
|
.PHONY: $(TOPGOALS)
|
||||||
|
$(TOPGOALS):
|
|
@ -7,6 +7,7 @@ static char *outfile = "a.out";
|
||||||
|
|
||||||
typedef struct section
|
typedef struct section
|
||||||
{
|
{
|
||||||
|
|
||||||
} Section;
|
} Section;
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,6 +46,7 @@ main(int argc, char **argv)
|
||||||
SCNHDR shdr;
|
SCNHDR shdr;
|
||||||
uint8_t *buffer;
|
uint8_t *buffer;
|
||||||
SYM entry;
|
SYM entry;
|
||||||
|
RELOC reloc;
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
prg_name = argv[0];
|
prg_name = argv[0];
|
||||||
|
|
Loading…
Reference in a new issue