vom
01.05.2013, 14:31 -
RE: Total Spam
Themen: 68
Beiträge: 1.566
Registriert seit: Mar 2006
PTC-Name: Nerymon (1426)
ok, klingt nach nem fairen Deal :3
vom
01.05.2013, 14:35 -
RE: Total Spam
Themen: 240
Beiträge: 4.064
Registriert seit: Feb 2008
PTC-Name: Schaf (4374)
vom
01.05.2013, 16:27 -
RE: Total Spam
Themen: 68
Beiträge: 1.566
Registriert seit: Mar 2006
PTC-Name: Nerymon (1426)
vom
01.05.2013, 17:37 -
RE: Total Spam
Themen: 21
Beiträge: 108
Registriert seit: Jun 2012
PTC-Name: Morten (10150)
Hmm, kompiliert krig ichs...
Code: /**
* MTGos - LowLevel OS
* Copyright (C) 2013 Morten Delenk
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* Please Read "LICENSE" for the Complete License
**/
#include "Video.hpp" // Video Klasse
#include "multiboot.hpp" // Multiboot header
unsigned long long gdt[7]; // Die GDT long long array
unsigned long long idt[256]; // Das IDT long long array
extern "C" void set_entry(int i, unsigned int base, unsigned int limit, int flags); // GDT Entry
extern "C" void new_int(int i,unsigned int offset, unsigned int Selector, unsigned int flags); // IDT Entry
extern "C" void kernelMain(const Multiboot& multiboot_structur, unsigned int multiboot_magic); // Main
extern "C" void divide_zero(); // Interrupt 0
extern "C" void FATAL(); // Interrupt 2
struct {
unsigned short limit; // Pointer
void * pointer;
} PACKED gdtp; //GDT
void kernelMain(const Multiboot& multiboot_structur, unsigned int multiboot_magic)
{
screen << "[INFO] Set Up GDT\n"; // Info
set_entry(0,0,0,0); //Nullsegment
set_entry(1,0,0xFFFF,0x9A); //Kernel-Codesegment
set_entry(2,0,0xFFFF,0x92); //Kernel-Datensegment
set_entry(3,0,0xFFFF,0xFA); //User-Codesegment
set_entry(4,0,0xFFFF,0xF2); //User-Datensegment
set_entry(5,0,0xFFFF,0xE9); //TSS
set_entry(6,0,0xFFFF,0xE9); //TSS
gdtp.limit=7*8-1; // länge
gdtp.pointer=gdt; // gdt pointer
asm volatile("lgdt %0" : : "m" (gdtp)); // Eingabe
screen << "[INFO] GDT setted\n"; // Info
FATAL(); // Fehler
int zeiger=divide_zero; // Interrupt 0
new_int(0,zeiger,1,0xF7); // Setze
zeiger=FATAL; // Interrupt 2
new_int(2,zeiger,1,0x97); //setze
for(;;); // cli; hlt
}
void set_entry(int i, unsigned int base, unsigned int limit, int flags)
{
gdt[i]=limit&0xFFFFLL;
gdt[i]|=(base&0xFFFFFFLL)<<16;
gdt[i]|=(flags&0xFFLL)<<40;
gdt[i]|=((limit>>16) & 0xFLL) << 48;
gdt[i]|=((flags>>8)&0xFFLL)<<52;
gdt[i]|=((base>>24)&0xFFLL)<<56;
}
void new_int(int i, unsigned int offset, unsigned int Selector, unsigned int flags)
{
idt[i]=offset&0xFFFFLL;
idt[i]|=(Selector&0xFFFFLL)<<16;
idt[i]|=(flags&0xFFLL)<<40;
idt[i]|=((offset>>16)&0xFFFF)<<48;
}
void divide_zero()
{
screen << "[WARNING] Divide by Zero!\n";
asm("int $0x04;iret");
}
void FATAL()
{
screen << background(color::blue) << color::white << " " << background(color::white) << color::blue << "FATAL ERROR" << background(color::blue) << color::white << "\nMTGos has stopped running because it encountered a Problem:\n";
screen << "UNKNOWN FATAL ERROR\n";
asm(".p:\n\tcli;hlt;jmp .p");
}
(Dieser Beitrag wurde zuletzt bearbeitet: 01.05.2013, 17:56 von darklink. )
Die Playstation ist ein bisschen besser als der Philips CDi. DAS sollte NICHT als Lob interpretiert werden!^^
vom
01.05.2013, 17:42 -
RE: Total Spam
Themen: 53
Beiträge: 982
Registriert seit: Apr 2006
PTC-Name:
vom
01.05.2013, 17:52 -
RE: Total Spam
Themen: 21
Beiträge: 108
Registriert seit: Jun 2012
PTC-Name: Morten (10150)
Mr. Mortens Sources ohne Kommis :P
(01.05.2013, 17:37)Morten schrieb: Hmm, kompiliert krig ichs...
Code: /**
* MTGos - LowLevel OS
* Copyright (C) 2013 Morten Delenk
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* Please Read "LICENSE" for the Complete License
**/
#include "Video.hpp" // Video Klasse
#include "multiboot.hpp" // Multiboot header
unsigned long long gdt[7]; // Die GDT long long array
unsigned long long idt[256]; // Das IDT long long array
extern "C" void set_entry(int i, unsigned int base, unsigned int limit, int flags); // GDT Entry
extern "C" void new_int(int i,unsigned int offset, unsigned int Selector, unsigned int flags); // IDT Entry
extern "C" void kernelMain(const Multiboot& multiboot_structur, unsigned int multiboot_magic); // Main
extern "C" void divide_zero(); // Interrupt 0
extern "C" void FATAL(); // Interrupt 2
struct {
unsigned short limit; // Pointer
void * pointer;
} PACKED gdtp; //GDT
void kernelMain(const Multiboot& multiboot_structur, unsigned int multiboot_magic)
{
screen << "[INFO] Set Up GDT\n"; // Info
set_entry(0,0,0,0); //Nullsegment
set_entry(1,0,0xFFFF,0x9A); //Kernel-Codesegment
set_entry(2,0,0xFFFF,0x92); //Kernel-Datensegment
set_entry(3,0,0xFFFF,0xFA); //User-Codesegment
set_entry(4,0,0xFFFF,0xF2); //User-Datensegment
set_entry(5,0,0xFFFF,0xE9); //TSS
set_entry(6,0,0xFFFF,0xE9); //TSS
gdtp.limit=7*8-1; // länge
gdtp.pointer=gdt; // gdt pointer
asm volatile("lgdt %0" : : "m" (gdtp)); // Eingabe
screen << "[INFO] GDT setted\n"; // Info
FATAL(); // Fehler
int zeiger=divide_zero; // Interrupt 0
new_int(0,zeiger,1,0xF7); // Setze
zeiger=FATAL; // Interrupt 2
new_int(2,zeiger,1,0x97); //setze
for(;;); // cli; hlt
}
void set_entry(int i, unsigned int base, unsigned int limit, int flags)
{
gdt[i]=limit&0xFFFFLL;
gdt[i]|=(base&0xFFFFFFLL)<<16;
gdt[i]|=(flags&0xFFLL)<<40;
gdt[i]|=((limit>>16) & 0xFLL) << 48;
gdt[i]|=((flags>>8)&0xFFLL)<<52;
gdt[i]|=((base>>24)&0xFFLL)<<56;
}
void new_int(int i, unsigned int offset, unsigned int Selector, unsigned int flags)
{
idt[i]=offset&0xFFFFLL;
idt[i]|=(Selector&0xFFFFLL)<<16;
idt[i]|=(flags&0xFFLL)<<40;
idt[i]|=((offset>>16)&0xFFFF)<<48;
}
void divide_zero()
{
screen << "[WARNING] Divide by Zero!\n";
asm("int $0x04;iret");
}
void FATAL()
{
screen << background(color::blue) << color::white << " " << background(color::white) << color::blue << "FATAL ERROR" << background(color::blue) << color::white << "\nMTGos has stopped running because it encountered a Problem:\n";
screen << "UNKNOWN FATAL ERROR\n";
asm(".p:\n\tcli;hlt;jmp .p");
}
Jetzt mit Kommi s :P
19:00
(Dieser Beitrag wurde zuletzt bearbeitet: 01.05.2013, 18:03 von darklink. )
Die Playstation ist ein bisschen besser als der Philips CDi. DAS sollte NICHT als Lob interpretiert werden!^^
vom
01.05.2013, 19:11 -
RE: Total Spam
Themen: 68
Beiträge: 1.566
Registriert seit: Mar 2006
PTC-Name: Nerymon (1426)
vom
01.05.2013, 19:54 -
RE: Total Spam
Themen: 16
Beiträge: 363
Registriert seit: Jan 2012
PTC-Name: Doflamingo (10070)
Ich bin satt und happy und müde. :3
|| Wir suchen neue Mitglieder, PN an mich!||
vom
02.05.2013, 07:41 -
RE: Total Spam
Themen: 53
Beiträge: 982
Registriert seit: Apr 2006
PTC-Name:
vom
02.05.2013, 11:32 -
RE: Total Spam
Themen: 53
Beiträge: 982
Registriert seit: Apr 2006
PTC-Name:
Vorerst zu Hause!
Was ein Wetter draußen!
|