Compare commits

..

No commits in common. "927aeb0872d723a92362c607df3d0d898873044b" and "f980acc1367821a03a8878d096bd56473a6ebfff" have entirely different histories.

2 changed files with 50 additions and 51 deletions

View File

@ -36,53 +36,6 @@ __attribute__((aligned(64))) static IDT_GATE IDTData[256] = {0};
__attribute__((aligned(4096))) static size_t FirstPageTable[512] = {0}; __attribute__((aligned(4096))) static size_t FirstPageTable[512] = {0};
/*
* Following section is taken from the OSDev Wiki page on PC Speaker.
* This is beeped first, before *anything* else.
* This way, we know that at least *something* works.
*/
//Play sound using built in speaker
static void play_sound(uint32_t nFrequence) {
uint32_t Div;
uint8_t tmp;
//Set the PIT to the desired frequency
Div = 1193180 / nFrequence;
WritePort(0x0043, 0xb6, 1);
WritePort(0x0042, (uint8_t) (Div), 1);
WritePort(0x0042, (uint8_t) (Div >> 8), 1);
//And play the sound using the PC speaker
tmp = ReadPort(0x0061, 1);
if (tmp != (tmp | 3)) {
WritePort(0x0061, tmp | 3, 1);
}
}
//make it shutup
static void nosound() {
uint8_t tmp = ReadPort(0x0061, 1) & 0xFC;
WritePort(0x0061, tmp, 1);
}
//Make a beep
void beep() {
play_sound(1000);
timer_wait(10);
nosound();
//set_PIT_2(old_frequency);
}
void timer_wait(int ticks){
uint64_t FinalTick = time + ticks;
while(time < FinalTick);
}
/* Main system handover from UEFI. /* Main system handover from UEFI.
* Prepares the processor, the screen, and memory. */ * Prepares the processor, the screen, and memory. */
void PrepareSystem(FILELOADER_PARAMS* FLOP) { void PrepareSystem(FILELOADER_PARAMS* FLOP) {
@ -158,6 +111,52 @@ void PrepareSystem(FILELOADER_PARAMS* FLOP) {
} }
/*
* Following section is taken from the OSDev Wiki page on PC Speaker.
* This is beeped first, before *anything* else.
* This way, we know that at least *something* works.
*/
//Play sound using built in speaker
static void play_sound(uint32_t nFrequence) {
uint32_t Div;
uint8_t tmp;
//Set the PIT to the desired frequency
Div = 1193180 / nFrequence;
WritePort(0x0043, 0xb6, 1);
WritePort(0x0042, (uint8_t) (Div), 1);
WritePort(0x0042, (uint8_t) (Div >> 8), 1);
//And play the sound using the PC speaker
tmp = ReadPort(0x0061, 1);
if (tmp != (tmp | 3)) {
WritePort(0x0061, tmp | 3, 1);
}
}
//make it shutup
static void nosound() {
uint8_t tmp = ReadPort(0x0061, 1) & 0xFC;
WritePort(0x0061, tmp, 1);
}
//Make a beep
void beep() {
play_sound(1000);
timer_wait(10);
nosound();
//set_PIT_2(old_frequency);
}
void timer_wait(int ticks){
uint64_t FinalTick = time + ticks;
while(time < FinalTick);
}
/* A temporary system for keeping track of system performance. */ /* A temporary system for keeping track of system performance. */

View File

@ -143,7 +143,7 @@ size_t FetchInstalledMemory() {
} }
// From Syncboot/memory.c // From Syncboot/memory.c
static const char Memory_Segments[20][27] = { static const char Memory_Segments[16][27] = {
"EfiReservedMemoryType ", "EfiReservedMemoryType ",
"EfiLoaderCode ", "EfiLoaderCode ",
"EfiLoaderData ", "EfiLoaderData ",
@ -173,17 +173,17 @@ void PrintMemoryMap() {
printf("MemMapSize: %qx, MemMapDescriptorSize: %1u, MemMapDescriptorVersion: %u\r\n", Memory_Info.MemoryMapSize, Memory_Info.MemoryMapDescriptorSize, Memory_Info.MemoryMapDescriptorVersion); printf(L"MemMapSize: %qx, MemMapDescriptorSize: %1u, MemMapDescriptorVersion: %u\r\n", Memory_Info.MemoryMapSize, Memory_Info.MemoryMapDescriptorSize, Memory_Info.MemoryMapDescriptorVersion);
for (Piece = Memory_Info.MemoryMap; for (Piece = Memory_Info.MemoryMap;
Piece < (EFI_MEMORY_DESCRIPTOR*)((uint8_t*)Memory_Info.MemoryMap + Memory_Info.MemoryMapSize); Piece < (EFI_MEMORY_DESCRIPTOR*)((uint8_t*)Memory_Info.MemoryMap + Memory_Info.MemoryMapSize);
Piece = (EFI_MEMORY_DESCRIPTOR*)((UINT8*)Piece + Memory_Info.MemoryMapDescriptorSize)) { Piece = (EFI_MEMORY_DESCRIPTOR*)((UINT8*)Piece + Memory_Info.MemoryMapDescriptorSize)) {
if (line % 20 == 0) { if (line % 20 == 0) {
printf("# Memory Type Phys Addr Start Num Of Pages Attr\r\n"); printf(L"# Memory Type Phys Addr Start Num Of Pages Attr\r\n");
} }
printf("%2hu: %s 0x%016qx 0x%qx 0x%qx\r\n", line, Memory_Segments[Piece->Type], Piece->PhysicalStart, Piece->NumberOfPages, Piece->Attribute); printf(L"%2hu: %s 0x%016qx 0x%qx 0x%qx\r\n", line, Memory_Segments[Piece->Type], Piece->PhysicalStart, Piece->NumberOfPages, Piece->Attribute);
line++; line++;
} }
} }