From 6785767528f35471f00574763ed2a04bbafac181 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Wed, 8 Jan 2020 21:10:24 +0100 Subject: [PATCH] Resolved #76... --- Makefile | 2 +- include/io/spkr.h | 8 ++++---- kaleid/kernel/io/spkr.c | 18 +++++++----------- kaleid/kernel/mm/paging.c | 2 +- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index e304613..05c091e 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ CCNAME=x86_64-elf-gcc ASMFLAGS=-f elf64 LDFLAGS=-melf_x86_64 COPTIM=-O2 -CWARNS=-Wall -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough -Werror=implicit-function-declaration -Werror=return-type -Wpadded +CWARNS=-Wall -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough -Werror=implicit-function-declaration -Werror=return-type #-Wpadded CINCLUDES=-Iinclude CFLAGS1=-nostdlib -ffreestanding -mcmodel=large -std=gnu11 -fstack-protector-all -fdump-rtl-expand CFLAGS2= -c -mno-red-zone -mno-mmx -mno-sse -mno-sse2 diff --git a/include/io/spkr.h b/include/io/spkr.h index e1f8514..be9eea5 100644 --- a/include/io/spkr.h +++ b/include/io/spkr.h @@ -31,17 +31,17 @@ //----------------------------------------------------------------------------// -void IoStartSpeaker(int); +void IoStartSpeaker(ulong); void IoDoBeep(void); -void IoDoTone(uint tone, uint time); +void IoDoTone(ulong tone, ulong time); void IoDoBeepNoIdt(void); void IoDoStarWars(void); struct Note { - uint tone; - uint time; + ulong tone; + ulong time; }; //----------------------------------------------------------------------------// diff --git a/kaleid/kernel/io/spkr.c b/kaleid/kernel/io/spkr.c index c2a4fce..66a7f5c 100644 --- a/kaleid/kernel/io/spkr.c +++ b/kaleid/kernel/io/spkr.c @@ -28,7 +28,7 @@ extern bool KeIdtIsInitialized; -const struct Note score[40] = { {440, 200}, {110, 200}, {440, 200}, {110, 200}, +struct Note score[40] = { {440, 200}, {110, 200}, {440, 200}, {110, 200}, {440, 200}, {110, 200}, {349, 140}, {87, 100}, {523, 60}, {87, 100}, {440, 200}, {110, 200}, {349, 140}, {87, 100}, {523, 60}, {87, 100}, @@ -37,13 +37,12 @@ const struct Note score[40] = { {440, 200}, {110, 200}, {440, 200}, {110, 200}, {659, 200}, {87, 200}, {698, 140}, {87, 100}, {523, 60}, {87, 100}, {415, 200}, {87, 200}, {349, 140}, {87, 100}, {523, 60}, {87, 100}, - {440, 200}, {110, 200}, {110, 200}, {110, 200} -}; + {440, 200}, {110, 200}, {110, 200}, {110, 200} }; -void IoStartSpeaker(int freq) +void IoStartSpeaker(ulong freq) { uchar temp; - uint pitf = 1193180 / freq; + ulong pitf = 1193180 / freq; ulong flags = KePauseIRQs(); IoWriteByteOnPort(0x43, 0xB6); @@ -64,13 +63,13 @@ static inline void IoQuietSpeaker(void) KeRestoreIRQs(flags); } -void IoDoTone(uint tone, uint time) +void IoDoTone(ulong tone, ulong time) { IoStartSpeaker(tone); KeSleep(time); } -static void IoDoToneNoIdt(uint tone, uint time) +static void IoDoToneNoIdt(ulong tone, ulong time) { extern void temporize(void); IoStartSpeaker(tone); @@ -94,10 +93,7 @@ void IoDoBeepNoIdt(void) void IoDoStarWars(void) { for (uint i = 0; i < 40; i++) { - //IoDoTone(score[i].tone, score[i].time); - bprintf(BStdOut, "At %p : %u\n", &(score[i].tone), score[i].tone); - bprintf(BStdOut, "At %p : %u\n", &(score[i].time), score[i].time); - BStdOut->flusher(BStdOut); + IoDoTone(score[i].tone, score[i].time); } IoQuietSpeaker(); diff --git a/kaleid/kernel/mm/paging.c b/kaleid/kernel/mm/paging.c index dbd0110..1b7ff74 100644 --- a/kaleid/kernel/mm/paging.c +++ b/kaleid/kernel/mm/paging.c @@ -59,7 +59,7 @@ void MmInitPaging(void) // STACK GUARD PAGE if ((ulong)(i*KPAGESIZE) == (ulong)BtLoaderInfo.stackEndAddr) { MmPT[i] = ((ulong)(i*KPAGESIZE)); - MmStackGuards[0] = ((ulong)(i*KPAGESIZE)); + MmStackGuards[0] = ((ulong)(i*KPAGESIZE )); continue; }