Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 15 → Rev 16

/SPARTAN/trunk/arch/ia32/boot/boot.ld
1,3 → 1,5
OUTPUT_FORMAT(binary)
ENTRY(main)
SECTIONS {
.text 0x7c00 : AT (0x0) { *(.text) }
}
/SPARTAN/trunk/arch/ia32/include/smp/apic.h
95,6 → 95,8
/* Local APIC ID Register */
#define L_APIC_ID (0x020/sizeof(__u32))
#define L_APIC_IDClear (~(0xf<<24))
#define L_APIC_IDShift 24
#define L_APIC_IDMask 0xf
 
/* IO APIC */
#define IOREGSEL (0x00/sizeof(__u32))
120,6 → 122,7
extern int l_apic_send_init_ipi(__u8 apicid);
extern void l_apic_debug(void);
extern void l_apic_timer_interrupt(__u8 n, __u32 stack[]);
extern __u8 l_apic_id(void);
 
extern __u32 io_apic_read(__u8 address);
extern void io_apic_write(__u8 address , __u32 x);
/SPARTAN/trunk/arch/ia32/include/cpu.h
29,9 → 29,16
#ifndef __ia32_CPU_H__
#define __ia32_CPU_H__
 
#include <config.h>
#include <typedefs.h>
#include <arch/pm.h>
 
#ifdef __SMP__
#define CPU_ID_ARCH (config.cpu_count>1?l_apic_id():0)
#else
#define CPU_ID_ARCH (0)
#endif
 
struct cpu_arch {
int vendor;
int family;
/SPARTAN/trunk/arch/ia32/Makefile.inc
13,7 → 13,7
endif
 
CPPFLAGS=$(DEFS) -nostdinc -I../include
CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -fomit-frame-pointer -Wmissing-prototypes -Werror -O3
CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -fomit-frame-pointer -Wmissing-prototypes -Werror -O1
LFLAGS=-M -no-check-sections -T ../arch/ia32/_link.ld
 
arch_sources= \
/SPARTAN/trunk/arch/ia32/src/smp/apic.c
26,8 → 26,6
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#ifdef __SMP__
 
#include <arch/types.h>
#include <arch/smp/apic.h>
#include <arch/smp/ap.h>
39,6 → 37,8
#include <arch/asm.h>
#include <arch.h>
 
#ifdef __SMP__
 
/*
* This is functional, far-from-general-enough interface to the APIC.
* Advanced Programmable Interrupt Controller for MP systems.
221,8 → 221,20
void l_apic_init(void)
{
__u32 tmp, t1, t2;
int cpu_id = config.cpu_active - 1;
 
/*
* Here we set local APIC ID's so that they match operating system's CPU ID's
* This operation is dangerous as it is model specific.
* TODO: some care should be taken.
* NOTE: CPU may not be used to define APIC ID
*/
if (l_apic_id() != cpu_id) {
l_apic[L_APIC_ID] &= L_APIC_IDClear;
l_apic[L_APIC_ID] |= (l_apic[L_APIC_ID]&L_APIC_IDClear)|((cpu_id)<<L_APIC_IDShift);
}
 
l_apic[LVT_Err] |= (1<<16);
l_apic[LVT_LINT0] |= (1<<16);
l_apic[LVT_LINT1] |= (1<<16);
270,7 → 282,7
#ifdef LAPIC_VERBOSE
int i, lint;
 
printf("LVT on cpu%d, LAPIC ID: %d\n", CPU->id, (l_apic[L_APIC_ID] >> 24)&0xf);
printf("LVT on cpu%d, LAPIC ID: %d\n", CPU->id, l_apic_id());
 
printf("LVT_Tm: ");
if (l_apic[LVT_Tm] & (1<<17)) printf("periodic"); else printf("one-shot"); putchar(',');
304,7 → 316,7
/*
* This register is supported only on P6 and higher.
*/
if (CPU->family > 5) {
if (CPU->arch.family > 5) {
printf("LVT_PCINT: ");
if (l_apic[LVT_PCINT] & (1<<16)) printf("masked"); else printf("not masked"); putchar(',');
if (l_apic[LVT_PCINT] & (1<<12)) printf("send pending"); else printf("idle"); putchar(',');
325,6 → 337,11
clock();
}
 
__u8 l_apic_id(void)
{
return (l_apic[L_APIC_ID] >> L_APIC_IDShift)&L_APIC_IDMask;
}
 
__u32 io_apic_read(__u8 address)
{
__u32 tmp;
/SPARTAN/trunk/arch/ia32/src/cpu/cpu.c
35,6 → 35,8
#include <print.h>
#include <typedefs.h>
 
#include <arch/smp/apic.h>
 
/*
* Identification of CPUs.
* Contains only non-MP-Specification specific SMP code.
/SPARTAN/trunk/arch/ia32/src/pm.c
66,7 → 66,7
struct tss *tss_p = NULL;
 
/* gdtr changes everytime new CPU is initialized */
struct ptr_16_32 gdtr = { .limit = sizeof(gdt), .base = (__address) gdt };
struct ptr_16_32 gdtr __attribute__ ((section ("K_DATA_START"))) = { .limit = sizeof(gdt), .base = (__address) gdt };
struct ptr_16_32 idtr = { .limit = sizeof(idt), .base = (__address) idt };
 
void gdt_setbase(struct descriptor *d, __address base)
/SPARTAN/trunk/arch/ia32/_link.ld
13,11 → 13,13
.image 0x8000: AT (0x8000) {
ktext_start = .;
*(K_TEXT_START);
delta_start = .;
*(K_DATA_START);
delta_end = .;
*(.text);
ktext_end = .;
 
kdata_start = .;
*(K_DATA_START);
*(.data); /* initialized data */
*(.rodata*); /* string literals */
*(COMMON); /* global variables */
28,12 → 30,12
 
. = ABSOLUTE(hardcoded_ktext_size);
.patch_1 : {
LONG(ktext_end - ktext_start);
LONG(ktext_end - ktext_start - (delta_end - delta_start));
}
 
. = ABSOLUTE(hardcoded_kdata_size);
.patch_2 : {
LONG(kdata_end - kdata_start);
LONG(kdata_end - kdata_start + (delta_end - delta_start));
}
 
. = ABSOLUTE(hardcoded_load_address);