Merge branch 'master' into ohligs
This commit is contained in:
commit
b25bd2d785
5 changed files with 31 additions and 33 deletions
|
@ -82,7 +82,6 @@ typedef struct {
|
|||
unsigned short base_hi;
|
||||
} __attribute__ ((packed)) idt_entry_t;
|
||||
|
||||
|
||||
/** @brief Defines the idt pointer structure.
|
||||
*
|
||||
* This structure keeps information about
|
||||
|
@ -95,8 +94,6 @@ typedef struct {
|
|||
unsigned int base;
|
||||
} __attribute__ ((packed)) idt_ptr_t;
|
||||
|
||||
|
||||
|
||||
/** @brief Installs IDT
|
||||
*
|
||||
* The installation involves the following steps:
|
||||
|
@ -113,7 +110,7 @@ void idt_install(void);
|
|||
* @param sel Segment the IDT will use
|
||||
* @param flags Flags this entry will have
|
||||
*/
|
||||
void idt_set_gate(unsigned char num, unsigned long base, unsigned short sel,
|
||||
void idt_set_gate(unsigned char num, size_t base, unsigned short sel,
|
||||
unsigned char flags);
|
||||
|
||||
/** @brief Configures and returns a IDT entry with chosen attributes
|
||||
|
@ -123,7 +120,7 @@ void idt_set_gate(unsigned char num, unsigned long base, unsigned short sel,
|
|||
*
|
||||
* @return a preconfigured idt descriptor
|
||||
*/
|
||||
idt_entry_t configure_idt_entry(unsigned long base, unsigned short sel,
|
||||
idt_entry_t configure_idt_entry(size_t base, unsigned short sel,
|
||||
unsigned char flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -327,7 +327,6 @@ void smp_start(uint32_t id)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if MAX_CORES > 1
|
||||
static unsigned int* search_apic(unsigned int base, unsigned int limit) {
|
||||
uint32_t* ptr;
|
||||
|
||||
|
@ -341,6 +340,7 @@ static unsigned int* search_apic(unsigned int base, unsigned int limit) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if MAX_CORES > 1
|
||||
int smp_init(void)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
@ -362,22 +362,22 @@ int smp_init(void)
|
|||
*/
|
||||
bootaddr = (char*) SMP_SETUP_ADDR;
|
||||
memcpy(bootaddr, boot_code, sizeof(boot_code));
|
||||
for(j=0; j<sizeof(boot_code)-4; j++)
|
||||
for(j=0; j<sizeof(boot_code)-sizeof(uint32_t); j++)
|
||||
{
|
||||
// replace 0xDEADC0DE with the address of the smp entry code
|
||||
if (*((size_t*) (bootaddr+j)) == 0xDEADC0DE) {
|
||||
*((size_t*) (bootaddr+j)) = (size_t) smp_start;
|
||||
if (*((uint32_t*) (bootaddr+j)) == 0xDEADC0DE) {
|
||||
*((uint32_t*) (bootaddr+j)) = (size_t) smp_start;
|
||||
kprintf("Set entry point of the application processors at 0x%x\n", (size_t) smp_start);
|
||||
}
|
||||
|
||||
// replace APIC ID 0xDEADDEAD
|
||||
if (*((size_t*) (bootaddr+j)) == 0xDEADDEAD)
|
||||
*((size_t*) (bootaddr+j)) = i;
|
||||
if (*((uint32_t*) (bootaddr+j)) == 0xDEADDEAD)
|
||||
*((uint32_t*) (bootaddr+j)) = i;
|
||||
|
||||
// replace 0xDEADBEEF with the addres of the stack
|
||||
if (*((size_t*) (bootaddr+j)) == 0xDEADBEEF) {
|
||||
uint32_t esp = get_idle_task(i);
|
||||
*((size_t*) (bootaddr+j)) = esp;
|
||||
if (*((uint32_t*) (bootaddr+j)) == 0xDEADBEEF) {
|
||||
size_t esp = get_idle_task(i);
|
||||
*((uint32_t*) (bootaddr+j)) = (uint32_t) esp;
|
||||
if ((int) esp < 0)
|
||||
kprintf("Invalid stack value\n");
|
||||
kprintf("Set stack of the application processors to 0x%x\n", esp);
|
||||
|
@ -559,7 +559,6 @@ static int apic_probe(void)
|
|||
uint32_t i, count;
|
||||
int isa_bus = -1;
|
||||
|
||||
#if MAX_CORES > 1
|
||||
apic_mp = (apic_mp_t*) search_apic(0xF0000, 0x100000);
|
||||
if (apic_mp)
|
||||
goto found_mp;
|
||||
|
@ -577,7 +576,7 @@ static int apic_probe(void)
|
|||
if (mmap->type == MULTIBOOT_MEMORY_RESERVED) {
|
||||
addr = mmap->addr;
|
||||
|
||||
for(i=0; i<mmap->len; i++, addr++) {
|
||||
for(i=0; i<mmap->len-sizeof(uint32_t); i++, addr++) {
|
||||
if (*((uint32_t*) addr) == MP_FLT_SIGNATURE) {
|
||||
apic_mp = (apic_mp_t*) addr;
|
||||
if (!(apic_mp->version > 4) && apic_mp->features[0])
|
||||
|
@ -591,7 +590,6 @@ static int apic_probe(void)
|
|||
}
|
||||
#endif
|
||||
found_mp:
|
||||
#endif
|
||||
if (!apic_mp)
|
||||
goto no_mp;
|
||||
|
||||
|
@ -752,10 +750,12 @@ int apic_init(void)
|
|||
return ret;
|
||||
|
||||
if (ioapic) {
|
||||
uint32_t i;
|
||||
|
||||
// enable timer interrupt
|
||||
ioapic_inton(0, apic_processors[boot_processor]->id);
|
||||
// now lets turn everything else off
|
||||
for(uint32_t i=1; i<24; i++)
|
||||
for(i=1; i<24; i++)
|
||||
ioapic_intoff(i, apic_processors[boot_processor]->id);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -41,17 +41,8 @@
|
|||
*/
|
||||
static idt_entry_t idt[256] = {[0 ... 255] = {0, 0, 0, 0, 0}};
|
||||
static idt_ptr_t idtp;
|
||||
/*
|
||||
* Use this function to set an entry in the IDT. Alot simpler
|
||||
* than twiddling with the GDT ;)
|
||||
*/
|
||||
void idt_set_gate(unsigned char num, unsigned long base, unsigned short sel,
|
||||
unsigned char flags)
|
||||
{
|
||||
idt[num] = configure_idt_entry(base, sel, flags);
|
||||
}
|
||||
|
||||
idt_entry_t configure_idt_entry(unsigned long base, unsigned short sel,
|
||||
idt_entry_t configure_idt_entry(size_t base, unsigned short sel,
|
||||
unsigned char flags)
|
||||
{
|
||||
idt_entry_t desc;
|
||||
|
@ -69,6 +60,16 @@ idt_entry_t configure_idt_entry(unsigned long base, unsigned short sel,
|
|||
return desc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Use this function to set an entry in the IDT. Alot simpler
|
||||
* than twiddling with the GDT ;)
|
||||
*/
|
||||
void idt_set_gate(unsigned char num, size_t base, unsigned short sel,
|
||||
unsigned char flags)
|
||||
{
|
||||
idt[num] = configure_idt_entry(base, sel, flags);
|
||||
}
|
||||
|
||||
extern void isrsyscall(void);
|
||||
|
||||
/* Installs the IDT */
|
||||
|
@ -84,7 +85,7 @@ void idt_install(void)
|
|||
idtp.base = (unsigned int)&idt;
|
||||
|
||||
/* Add any new ISRs to the IDT here using idt_set_gate */
|
||||
idt_set_gate(INT_SYSCALL, (unsigned int)isrsyscall, KERNEL_CODE_SELECTOR,
|
||||
idt_set_gate(INT_SYSCALL, (size_t)isrsyscall, KERNEL_CODE_SELECTOR,
|
||||
IDT_FLAG_PRESENT|IDT_FLAG_RING3|IDT_FLAG_32BIT|IDT_FLAG_TRAPGATE);
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ static void rtl8139if_handler(struct state* s)
|
|||
uint16_t isr_contents;
|
||||
|
||||
while (1) {
|
||||
isr_contents = inportw(rtl8139if->iobase + ISR);
|
||||
isr_contents = inportw(rtl8139if->iobase + ISR);
|
||||
if (isr_contents == 0)
|
||||
break;
|
||||
|
||||
|
@ -398,7 +398,7 @@ err_t rtl8139if_init(struct netif* netif)
|
|||
}
|
||||
|
||||
if (!tmp16) {
|
||||
// it seems not to work
|
||||
// it seems not to work
|
||||
kprintf("RTL8139 reset failed\n");
|
||||
return ERR_ARG;
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ err_t rtl8139if_init(struct netif* netif)
|
|||
outportb(rtl8139if->iobase + CONFIG1,
|
||||
(inportb(rtl8139if->iobase + CONFIG1) & ~(CONFIG1_DVRLOAD | CONFIG1_LWACT)) | CONFIG1_DVRLOAD);
|
||||
|
||||
// unlock config register
|
||||
// unlock config register
|
||||
outportb(rtl8139if->iobase + CR9346, 0);
|
||||
|
||||
/*
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
|
||||
* LWIP_RAW==0: speeds up input processing
|
||||
*/
|
||||
#define LWIP_RAW 0
|
||||
#define LWIP_RAW 1
|
||||
|
||||
/**
|
||||
* LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
|
||||
|
|
Loading…
Add table
Reference in a new issue