Compare commits
2 commits
899e456249
...
c84e5b55e4
Author | SHA1 | Date | |
---|---|---|---|
d0p1 🏳️⚧️ | c84e5b55e4 | ||
d0p1 🏳️⚧️ | e0ab3e5c1a |
|
@ -5,6 +5,7 @@ LOADER_SRCS = loader.asm \
|
|||
../common/bootinfo.inc \
|
||||
../../kernel/sys/bootinfo.inc \
|
||||
../../kernel/sys/register.inc \
|
||||
fat.inc \
|
||||
video.inc \
|
||||
memory.inc \
|
||||
logger.inc \
|
||||
|
|
30
boot/loader/fat.inc
Normal file
30
boot/loader/fat.inc
Normal file
|
@ -0,0 +1,30 @@
|
|||
;; File: fat.inc
|
||||
|
||||
include '../common/fat12.inc'
|
||||
|
||||
fat_read_bpb:
|
||||
mov ax, DISK_BUFFER/0x10
|
||||
mov es, ax
|
||||
xor bx, bx
|
||||
mov ax, 0
|
||||
mov cx, 1
|
||||
call disk_read_sectors
|
||||
|
||||
mov word ax, [DISK_BUFFER + fat_bpb.sects_per_track]
|
||||
mov word [sectors_per_track], ax
|
||||
mov word ax, [DISK_BUFFER + fat_bpb.heads_per_cyl]
|
||||
mov word [heads_per_cylinder], ax
|
||||
mov word ax, [DISK_BUFFER + fat_bpb.bytes_per_sects]
|
||||
mov word [bytes_per_sector], ax
|
||||
mov word ax, [DISK_BUFFER + fat_bpb.sects_per_FAT]
|
||||
mov word [sectors_per_FAT], ax
|
||||
mov byte al, [DISK_BUFFER + fat_bpb.FAT_count]
|
||||
mov byte [FAT_count], al
|
||||
mov word ax, [DISK_BUFFER + fat_bpb.reserved_sects]
|
||||
mov word [reserved_sectors], ax
|
||||
mov word ax, [DISK_BUFFER + fat_bpb.root_dir_entries]
|
||||
mov word [root_dir_entries], ax
|
||||
mov byte al, [DISK_BUFFER + fat_bpb.sects_per_clust]
|
||||
mov byte [sectors_per_cluster], al
|
||||
ret
|
||||
|
|
@ -80,29 +80,7 @@ _start:
|
|||
; for now fat12 is asumed
|
||||
.fat_fallback:
|
||||
; get bpb
|
||||
mov ax, DISK_BUFFER/0x10
|
||||
mov es, ax
|
||||
xor bx, bx
|
||||
mov ax, 0
|
||||
mov cx, 1
|
||||
call disk_read_sectors
|
||||
|
||||
mov word ax, [DISK_BUFFER + fat_bpb.sects_per_track]
|
||||
mov word [sectors_per_track], ax
|
||||
mov word ax, [DISK_BUFFER + fat_bpb.heads_per_cyl]
|
||||
mov word [heads_per_cylinder], ax
|
||||
mov word ax, [DISK_BUFFER + fat_bpb.bytes_per_sects]
|
||||
mov word [bytes_per_sector], ax
|
||||
mov word ax, [DISK_BUFFER + fat_bpb.sects_per_FAT]
|
||||
mov word [sectors_per_FAT], ax
|
||||
mov byte al, [DISK_BUFFER + fat_bpb.FAT_count]
|
||||
mov byte [FAT_count], al
|
||||
mov word ax, [DISK_BUFFER + fat_bpb.reserved_sects]
|
||||
mov word [reserved_sectors], ax
|
||||
mov word ax, [DISK_BUFFER + fat_bpb.root_dir_entries]
|
||||
mov word [root_dir_entries], ax
|
||||
mov byte al, [DISK_BUFFER + fat_bpb.sects_per_clust]
|
||||
mov byte [sectors_per_cluster], al
|
||||
call fat_read_bpb
|
||||
|
||||
call fat_load_root
|
||||
|
||||
|
@ -177,7 +155,7 @@ _start:
|
|||
|
||||
include 'a20.inc'
|
||||
include '../common/bios.inc'
|
||||
include '../common/fat12.inc'
|
||||
include 'fat.inc'
|
||||
include 'disk.inc'
|
||||
include 'logger.inc'
|
||||
include 'memory.inc'
|
||||
|
|
|
@ -3,6 +3,21 @@
|
|||
|
||||
# include <stdint.h>
|
||||
|
||||
# define ELF_MAG0 0x7F
|
||||
# define ELF_MAG1 0x45
|
||||
# define ELF_MAG2 0x4C
|
||||
# define ELF_MAG3 0x46
|
||||
|
||||
# define EI_NIDENT 16
|
||||
|
||||
struct elf_header
|
||||
{
|
||||
uint8_t e_ident[EI_NIDENT];
|
||||
uint16_t e_type;
|
||||
uint16_t e_machine;
|
||||
uint32_t e_version;
|
||||
};
|
||||
|
||||
/* TODO */
|
||||
|
||||
#endif /* !ELF_H */
|
||||
|
|
|
@ -32,6 +32,21 @@ proc_alloc:
|
|||
pop eax
|
||||
ret
|
||||
|
||||
context_switch:
|
||||
mov ax, 0x23
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax
|
||||
|
||||
mov eax, esp
|
||||
push 0x23
|
||||
push eax
|
||||
pushf
|
||||
push 0x1b
|
||||
; push addr
|
||||
iret
|
||||
|
||||
uNextpid dd 1
|
||||
uProcLock dd 0
|
||||
pCurrentProc dd 0
|
||||
|
|
5
kernel/sched.inc
Normal file
5
kernel/sched.inc
Normal file
|
@ -0,0 +1,5 @@
|
|||
;; File: shed.inc
|
||||
|
||||
;; Function: schedule
|
||||
schedule:
|
||||
ret
|
|
@ -1,9 +1,22 @@
|
|||
struc Context {
|
||||
.edi dd ?
|
||||
.esi dd ?
|
||||
.gs dw ?
|
||||
.fs dw ?
|
||||
.es dw ?
|
||||
.ds dw ?
|
||||
.ss dw ?
|
||||
|
||||
.eax dd ?
|
||||
.ebx dd ?
|
||||
.ecx dd ?
|
||||
.edx dd ?
|
||||
.esi dd ?
|
||||
.edi dd ?
|
||||
.ebp dd ?
|
||||
|
||||
.error dd ?
|
||||
.eip dd ?
|
||||
.cs dd ?
|
||||
.eflags dd ?
|
||||
}
|
||||
DEFN Context
|
||||
|
||||
|
|
Loading…
Reference in a new issue