Merge branch 'master' of github.com:MTGos/kernel
This commit is contained in:
commit
79f6f3bcda
16 changed files with 30 additions and 23 deletions
|
@ -18,7 +18,7 @@ include gmp.mk
|
||||||
include isl.mk
|
include isl.mk
|
||||||
include cloog.mk
|
include cloog.mk
|
||||||
|
|
||||||
fetch: gawk.tar.xz gcc.tar.bz2 binutils.tar.bz2 mpc.tar.gz mpfr.tar.xz gmp.tar.xz isl.tar.xz cloog.tar.gz
|
fetch: gawk.tar.xz gcc.tar.xz binutils.tar.bz2 mpc.tar.gz mpfr.tar.xz gmp.tar.xz isl.tar.xz cloog.tar.gz
|
||||||
|
|
||||||
extract: gawk/ binutils/ gcc/mpc/ gcc/mpfr/ gcc/gmp/ gcc/isl/ gcc/cloog/
|
extract: gawk/ binutils/ gcc/mpc/ gcc/mpfr/ gcc/gmp/ gcc/isl/ gcc/cloog/
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
BINUTILS_VERSION=2.28
|
BINUTILS_VERSION=2.29.1
|
||||||
binutils.tar.bz2: binutils-$(BINUTILS_VERSION).tar.bz2
|
binutils.tar.bz2: binutils-$(BINUTILS_VERSION).tar.bz2
|
||||||
mv $^ $@
|
mv $^ $@
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
GAWK_VERSION=4.1.4
|
GAWK_VERSION=4.2.0
|
||||||
gawk.tar.xz: gawk-$(GAWK_VERSION).tar.xz
|
gawk.tar.xz: gawk-$(GAWK_VERSION).tar.xz
|
||||||
mv $^ $@
|
mv $^ $@
|
||||||
|
|
||||||
|
|
13
cross/gcc.mk
13
cross/gcc.mk
|
@ -1,15 +1,15 @@
|
||||||
GCC_VERSION=7.1.0
|
GCC_VERSION=7.2.0
|
||||||
GCC_MAJOR_VERSION=7.1.0
|
GCC_MAJOR_VERSION=7.2.0
|
||||||
gcc.tar.bz2: gcc-$(GCC_VERSION).tar.bz2
|
gcc.tar.xz: gcc-$(GCC_VERSION).tar.xz
|
||||||
mv $^ $@
|
mv $^ $@
|
||||||
|
|
||||||
gcc-$(GCC_VERSION).tar.bz2:
|
gcc-$(GCC_VERSION).tar.xz:
|
||||||
wget https://ftp.gnu.org/gnu/gcc/gcc-$(GCC_MAJOR_VERSION)/$@
|
wget https://ftp.gnu.org/gnu/gcc/gcc-$(GCC_MAJOR_VERSION)/$@
|
||||||
|
|
||||||
gcc/: gcc-$(GCC_VERSION)/
|
gcc/: gcc-$(GCC_VERSION)/
|
||||||
mv $^ $@
|
mv $^ $@
|
||||||
|
|
||||||
gcc-$(GCC_VERSION)/: gcc.tar.bz2
|
gcc-$(GCC_VERSION)/: gcc.tar.xz
|
||||||
tar -xf $^
|
tar -xf $^
|
||||||
|
|
||||||
gcc-patch:
|
gcc-patch:
|
||||||
|
@ -28,4 +28,5 @@ gcc-make: gcc-configure
|
||||||
$(MAKE) -C builddir all-target-libgcc
|
$(MAKE) -C builddir all-target-libgcc
|
||||||
|
|
||||||
gcc-install: gcc-make
|
gcc-install: gcc-make
|
||||||
$(MAKE) -C builddir install-gcc install-target-libgcc
|
$(MAKE) -C builddir install-gcc
|
||||||
|
$(MAKE) -C builddir install-target-libgcc
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
MPFR_VERSION=3.1.5
|
MPFR_VERSION=3.1.6
|
||||||
mpfr.tar.xz: mpfr-$(MPFR_VERSION).tar.xz
|
mpfr.tar.xz: mpfr-$(MPFR_VERSION).tar.xz
|
||||||
mv $^ $@
|
mv $^ $@
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@ buildtools/sighax-firm.sh &&
|
||||||
mv sighax.firm out/ &&
|
mv sighax.firm out/ &&
|
||||||
cp -v build/kernel/kernel out/arm11loaderhax.elf
|
cp -v build/kernel/kernel out/arm11loaderhax.elf
|
||||||
|
|
||||||
|
cat > /dev/null << EOF
|
||||||
{
|
{
|
||||||
echo 2
|
echo 2
|
||||||
echo 1
|
echo 1
|
||||||
|
@ -75,3 +76,4 @@ cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/arm-none-eabi.cmake .. &&
|
||||||
make -j$(nproc) &&
|
make -j$(nproc) &&
|
||||||
popd &&
|
popd &&
|
||||||
cp -v build/kernel/kernel out/raspi2.elf
|
cp -v build/kernel/kernel out/raspi2.elf
|
||||||
|
EOF
|
||||||
|
|
|
@ -42,7 +42,10 @@ f.write("char font_data[] = {\n")
|
||||||
for i,c in enumerate(fontbytes):
|
for i,c in enumerate(fontbytes):
|
||||||
if not i % 32:
|
if not i % 32:
|
||||||
f.write(" ")
|
f.write(" ")
|
||||||
|
if c < 0x80:
|
||||||
f.write(hex(c)+", ")
|
f.write(hex(c)+", ")
|
||||||
|
else:
|
||||||
|
f.write("(char)"+hex(127-c^0x7F)+", ")
|
||||||
if i % 32 == 31:
|
if i % 32 == 31:
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
f.write("\n};\n")
|
f.write("\n};\n")
|
||||||
|
|
|
@ -30,8 +30,8 @@ LOAD_PROFILE(${ARCH} ${SYSTEM})
|
||||||
ADD_EXECUTABLE(kernel ${PLATFORM_SRCS} ${ISA_SRCS} ${GENERIC_SRCS})
|
ADD_EXECUTABLE(kernel ${PLATFORM_SRCS} ${ISA_SRCS} ${GENERIC_SRCS})
|
||||||
SET(CMAKE_ASM-ATT_COMPILE_OBJECT
|
SET(CMAKE_ASM-ATT_COMPILE_OBJECT
|
||||||
"<CMAKE_C_COMPILER> -g -x assembler-with-cpp -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_ASM_FLAGS} ${PLATFORM_ASM_FLAGS} -c -o <OBJECT> <SOURCE>")
|
"<CMAKE_C_COMPILER> -g -x assembler-with-cpp -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_ASM_FLAGS} ${PLATFORM_ASM_FLAGS} -c -o <OBJECT> <SOURCE>")
|
||||||
SET(CMAKE_C_FLAGS "-g -w -Werror -Wno-unused -Wno-unused-variable -fno-use-cxa-atexit -std=c11 -ffreestanding -ffunction-sections -fdata-sections -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_C_FLAGS} ${PLATFORM_C_FLAGS}")
|
SET(CMAKE_C_FLAGS "-g --all-warnings -Werror -Wno-error=reorder -Wno-unused -Wno-unused-variable -fno-use-cxa-atexit -std=c11 -ffreestanding -ffunction-sections -fdata-sections -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_C_FLAGS} ${PLATFORM_C_FLAGS}")
|
||||||
SET(CMAKE_CXX_FLAGS "-g -w -Werror -Wno-unused -Wno-unused-variable -fno-use-cxa-atexit -ffreestanding -fno-rtti -fno-exceptions -std=gnu++17 -ffunction-sections -fdata-sections -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_CXX_FLAGS} ${PLATFORM_CXX_FLAGS}")
|
SET(CMAKE_CXX_FLAGS "-g --all-warnings -Werror -Wno-error=reorder -Wno-unused -Wno-unused-variable -fno-use-cxa-atexit -ffreestanding -fno-rtti -fno-exceptions -std=gnu++17 -ffunction-sections -fdata-sections -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_CXX_FLAGS} ${PLATFORM_CXX_FLAGS}")
|
||||||
SET_TARGET_PROPERTIES(kernel PROPERTIES LINK_FLAGS
|
SET_TARGET_PROPERTIES(kernel PROPERTIES LINK_FLAGS
|
||||||
"-T ../../kernel/${PLATFORM_LAYOUT} -N ${ISA_LINKER_FLAGS} ${PLATFORM_LINKER_FLAGS} -nostdlib -nodefaultlibs -Wl,--gc-sections -ffreestanding")
|
"-T ../../kernel/${PLATFORM_LAYOUT} -N ${ISA_LINKER_FLAGS} ${PLATFORM_LINKER_FLAGS} -nostdlib -nodefaultlibs -Wl,--gc-sections -ffreestanding")
|
||||||
TARGET_LINK_LIBRARIES(kernel gcc)
|
TARGET_LINK_LIBRARIES(kernel gcc)
|
||||||
|
|
|
@ -22,7 +22,7 @@ void print_regdump(cpu_state *state) {
|
||||||
(*out << " returnAddr: ").puti(state->returnAddr);
|
(*out << " returnAddr: ").puti(state->returnAddr);
|
||||||
*out << "\n";
|
*out << "\n";
|
||||||
}
|
}
|
||||||
extern "C" void panic2(char *msg, cpu_state *state);
|
extern "C" void panic2(const char *msg, cpu_state *state);
|
||||||
extern "C" cpu_state *handleINT(int number, cpu_state *state) {
|
extern "C" cpu_state *handleINT(int number, cpu_state *state) {
|
||||||
*out << "Interrupt";
|
*out << "Interrupt";
|
||||||
out->puti(number);
|
out->puti(number);
|
||||||
|
@ -49,7 +49,7 @@ extern "C" cpu_state *handleINT(int number, cpu_state *state) {
|
||||||
}
|
}
|
||||||
return new_cpu;
|
return new_cpu;
|
||||||
}
|
}
|
||||||
extern "C" void panic2(char *msg, cpu_state *state) {
|
extern "C" void panic2(const char *msg, cpu_state *state) {
|
||||||
out->setColor(Color::RED);
|
out->setColor(Color::RED);
|
||||||
*out << "KERNEL PANIC: " << msg << "\n";
|
*out << "KERNEL PANIC: " << msg << "\n";
|
||||||
print_regdump(state);
|
print_regdump(state);
|
||||||
|
|
|
@ -47,7 +47,7 @@ paging_context_x86::paging_context_x86(): paging_context() {
|
||||||
continue;
|
continue;
|
||||||
if(i == 1 || i == 2 || i == 3)
|
if(i == 1 || i == 2 || i == 3)
|
||||||
continue;
|
continue;
|
||||||
pagetbl *pagetbl_start = (pagetbl *)(0x800000 + i << 22);
|
pagetbl *pagetbl_start = (pagetbl *)(0x800000 + (i << 22));
|
||||||
for(int j=0;j<1024;j++) {
|
for(int j=0;j<1024;j++) {
|
||||||
if(!pagetbl_start[j].active)
|
if(!pagetbl_start[j].active)
|
||||||
continue;
|
continue;
|
||||||
|
@ -147,7 +147,7 @@ paging_context_x86::~paging_context_x86() {
|
||||||
for(int i=256;i<1024;i++) {
|
for(int i=256;i<1024;i++) {
|
||||||
if(!pd[i].active)
|
if(!pd[i].active)
|
||||||
continue;
|
continue;
|
||||||
pagetbl *pt = (pagetbl*)(0xC00000+i<<12);
|
pagetbl *pt = (pagetbl*)(0xC00000+(i<<12));
|
||||||
for(int j=0;j<1024;j++) {
|
for(int j=0;j<1024;j++) {
|
||||||
if(!pt[j].active)
|
if(!pt[j].active)
|
||||||
continue;
|
continue;
|
||||||
|
@ -161,7 +161,7 @@ paging_context_x86::~paging_context_x86() {
|
||||||
for(int i=1;i<3;i++) {
|
for(int i=1;i<3;i++) {
|
||||||
if(!pd[i].active)
|
if(!pd[i].active)
|
||||||
continue;
|
continue;
|
||||||
pagetbl *pt = (pagetbl*)(0xC00000+i<<12);
|
pagetbl *pt = (pagetbl*)(0xC00000+(i<<12));
|
||||||
for(int j=0;j<1024;j++) {
|
for(int j=0;j<1024;j++) {
|
||||||
if(!pt[j].active)
|
if(!pt[j].active)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -16,7 +16,7 @@ auto I2C::getResult() -> bool {
|
||||||
waitBusy();
|
waitBusy();
|
||||||
return buses[busID]->ctl & 0x10;
|
return buses[busID]->ctl & 0x10;
|
||||||
}
|
}
|
||||||
auto I2C::stop() -> bool {
|
auto I2C::stop() -> void {
|
||||||
buses[busID]->ctl = 0xC0;
|
buses[busID]->ctl = 0xC0;
|
||||||
waitBusy();
|
waitBusy();
|
||||||
buses[busID]->ctl = 0xC5;
|
buses[busID]->ctl = 0xC5;
|
||||||
|
|
|
@ -15,7 +15,7 @@ class I2C {
|
||||||
~I2C();
|
~I2C();
|
||||||
auto waitBusy() -> void; ///< Waits for the currently selected device to finish
|
auto waitBusy() -> void; ///< Waits for the currently selected device to finish
|
||||||
auto getResult() -> bool; ///< Returns true when the device sent a ACK
|
auto getResult() -> bool; ///< Returns true when the device sent a ACK
|
||||||
auto stop() -> bool; ///< Stops the current transfer
|
auto stop() -> void; ///< Stops the current transfer
|
||||||
auto selectDev(int dev) -> bool; ///< Selects current I2C device
|
auto selectDev(int dev) -> bool; ///< Selects current I2C device
|
||||||
auto selectReg(int reg) -> bool; ///< Selects current register
|
auto selectReg(int reg) -> bool; ///< Selects current register
|
||||||
auto write(uint8_t data) -> bool; ///< Sends 8 bits of data
|
auto write(uint8_t data) -> bool; ///< Sends 8 bits of data
|
||||||
|
|
|
@ -51,7 +51,7 @@ auto getRTC(RTC_date *date) -> void {
|
||||||
date->years = bcdToVal(read(0x36));
|
date->years = bcdToVal(read(0x36));
|
||||||
}
|
}
|
||||||
auto setRTC(RTC_date *date) -> void {
|
auto setRTC(RTC_date *date) -> void {
|
||||||
auto valToBCD = [](unsigned char c) -> unsigned char { return (c % 10) + (c / 10) << 4; };
|
auto valToBCD = [](unsigned char c) -> unsigned char { return (c % 10) + ((c / 10) << 4); };
|
||||||
write(0x30, valToBCD(date->seconds));
|
write(0x30, valToBCD(date->seconds));
|
||||||
write(0x31, valToBCD(date->minutes));
|
write(0x31, valToBCD(date->minutes));
|
||||||
write(0x32, valToBCD(date->hours));
|
write(0x32, valToBCD(date->hours));
|
||||||
|
|
|
@ -32,7 +32,7 @@ IRQ_IO::IRQ_IO() {
|
||||||
*((volatile uint32_t*)(0x17E01100+i))=~0;
|
*((volatile uint32_t*)(0x17E01100+i))=~0;
|
||||||
}
|
}
|
||||||
uint32_t intid;
|
uint32_t intid;
|
||||||
while((intid=*((volatile uint32_t*)0x17E00118))&1023!=1023) {
|
while(((intid=*((volatile uint32_t*)0x17E00118))&1023)!=1023) {
|
||||||
*((volatile uint32_t*)0x17E00110)=intid;
|
*((volatile uint32_t*)0x17E00110)=intid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ void setIDTEntry(int i, void *entry) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void initIDT() {
|
void initIDT() {
|
||||||
void *start_vectors = (void *)&intr_stub_0;
|
char *start_vectors = (char *)&intr_stub_0;
|
||||||
for (int i = 0; i < 256; i++) setIDTEntry(i, start_vectors + 16 * i);
|
for (int i = 0; i < 256; i++) setIDTEntry(i, start_vectors + 16 * i);
|
||||||
struct {
|
struct {
|
||||||
uint16_t size;
|
uint16_t size;
|
||||||
|
|
|
@ -23,4 +23,5 @@ extern "C" int __cxa_guard_acquire(__guard *g) {
|
||||||
}
|
}
|
||||||
extern "C" int __cxa_guard_release(__guard *g) {
|
extern "C" int __cxa_guard_release(__guard *g) {
|
||||||
*(char *)g = 1;
|
*(char *)g = 1;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue