This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
599 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#ifndef FAT32_H | ||
#define FAT32_H | ||
|
||
#include "types.h" | ||
|
||
typedef struct fat_bpb | ||
{ | ||
unsigned char bootjmp[3]; | ||
unsigned char oem_name[8]; | ||
unsigned short bytes_per_sector; | ||
unsigned char sectors_per_cluster; | ||
unsigned short reserved_sector_count; | ||
unsigned char table_count; | ||
unsigned short root_entry_count; | ||
unsigned short total_sectors_16; | ||
unsigned char media_type; | ||
unsigned short table_size_16; | ||
unsigned short sectors_per_track; | ||
unsigned short head_side_count; | ||
unsigned int hidden_sector_count; | ||
unsigned int total_sectors_32; | ||
//Fat32 Extended BPBL | ||
unsigned int table_size_32; | ||
unsigned short extended_flags; | ||
unsigned short fat_version; | ||
unsigned int root_cluster; | ||
unsigned short fat_info; | ||
unsigned short backup_BS_sector; | ||
unsigned char reserved_0[12]; | ||
unsigned char drive_number; | ||
unsigned char reserved_1; | ||
unsigned char boot_signature; | ||
unsigned int volume_id; | ||
unsigned char volume_label[11]; | ||
unsigned char fat_type_label[8]; | ||
|
||
}__attribute__((packed)) fat_bpb; | ||
|
||
typedef struct | ||
{ | ||
uint8 Name[11]; | ||
uint8 Attributes; | ||
uint8 Reserved; | ||
uint8 CreatedTimeTenths; | ||
uint16 CreatedTime; | ||
uint16 CreatedDate; | ||
uint16 AccessedDate; | ||
uint16 FirstClusterHigh; | ||
uint16 ModifiedTime; | ||
uint16 ModifiedDate; | ||
uint16 FirstClusterLow; | ||
uint32 Size; | ||
} __attribute__((packed)) FAT_dirent; | ||
|
||
typedef struct fat_file | ||
{ | ||
BOOL is_dir; | ||
uint32 position; | ||
uint32 size; | ||
} fat_file; | ||
|
||
void fat_init(); | ||
char* fat_read_file(char* fpath); | ||
uint32 fat_path_to_cluster(const char* path); | ||
void fat_dir_ls(uint32 cluster); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
qemu: fatal: invalid tss type | ||
EAX=00000000 EBX=0010b000 ECX=0000000f EDX=0010886e | ||
ESI=00000000 EDI=00000000 EBP=0014385c ESP=0000080a | ||
EIP=00001eb9 EFL=000a0002 [-------] CPL=3 II=0 A20=1 SMM=0 HLT=0 | ||
ES =0a1e 0000a1e0 0000ffff 0000f300 DPL=3 DS16 [-WA] | ||
CS =b000 000b0000 0000ffff 0000f300 DPL=3 DS16 [-WA] | ||
SS =7527 00075270 0000ffff 0000f300 DPL=3 DS16 [-WA] | ||
DS =b000 000b0000 0000ffff 0000f300 DPL=3 DS16 [-WA] | ||
FS =3908 00039080 0000ffff 0000f300 DPL=3 DS16 [-WA] | ||
GS =01c7 00001c70 0000ffff 0000f300 DPL=3 DS16 [-WA] | ||
LDT=0000 00000000 0000ffff 00008200 DPL=0 LDT | ||
TR =0000 00000000 0000ffff 00008b00 DPL=0 TSS32-busy | ||
GDT= 00127880 0000003f | ||
IDT= 001278e0 000007ff | ||
CR0=00000011 CR2=00000000 CR3=00000000 CR4=00000000 | ||
DR0=00000000 DR1=00000000 DR2=00000000 DR3=00000000 | ||
DR6=ffff0ff0 DR7=00000400 | ||
CCS=00000000 CCD=00143870 CCO=EFLAGS | ||
EFER=0000000000000000 | ||
FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80 | ||
FPR0=0000000000000000 0000 FPR1=0000000000000000 0000 | ||
FPR2=0000000000000000 0000 FPR3=0000000000000000 0000 | ||
FPR4=0000000000000000 0000 FPR5=0000000000000000 0000 | ||
FPR6=0000000000000000 0000 FPR7=0000000000000000 0000 | ||
XMM00=0000000000000000 0000000000000000 XMM01=0000000000000000 0000000000000000 | ||
XMM02=0000000000000000 0000000000000000 XMM03=0000000000000000 0000000000000000 | ||
XMM04=0000000000000000 0000000000000000 XMM05=0000000000000000 0000000000000000 | ||
XMM06=0000000000000000 0000000000000000 XMM07=0000000000000000 0000000000000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
global write_port | ||
extern timer_handler_main | ||
|
||
write_port: | ||
mov edx, [esp + 4] | ||
mov al, [esp + 4 + 4] | ||
out dx, al | ||
ret | ||
|
||
global timer_handler | ||
timer_handler: | ||
;cli ; no more interrupts | ||
|
||
pushad ; save all registers | ||
|
||
push esp ; send the ESP to timer_handler_main | ||
push ebp ; send the EBP to timer_handler_main | ||
|
||
call timer_handler_main | ||
;hlt ; we should not get here, halt the cpu | ||
|
||
global switch_stack_and_jump | ||
switch_stack_and_jump: | ||
mov ebx, [esp + 8] ; second argument, the function pointer | ||
mov eax, [esp + 4] ; first argument, a location to build a stack | ||
mov esp, eax ; set the stack pointer to the location | ||
mov ebp, esp ; by setting the EBP to the ESP, we configure a new stack | ||
sti ; enable interrupts | ||
jmp ebx ; jump to the function pointer | ||
|
||
global switch_stack | ||
switch_stack: | ||
mov ebx, [esp + 8] ; second argument, the stack frame pointer | ||
mov eax, [esp + 4] ; first argument, the stack pointer | ||
|
||
mov ebp, ebx ; restore the stack frame | ||
mov esp, eax ; restore the top of the stack | ||
|
||
popad ; restore all registers | ||
|
||
sti ; OK for interupts at this point | ||
iretd ; perform a return from interrupt since the last task was interrupted | ||
|
Oops, something went wrong.