Rev 2233 | Rev 3104 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2233 | Rev 2701 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /* |
1 | /* |
| 2 | * Copyright (c) 2001-2004 Jakub Jermar |
2 | * Copyright (c) 2008 Jakub Jermar |
| 3 | * Copyright (c) 2005-2006 Ondrej Palkovsky |
3 | * Copyright (c) 2005-2006 Ondrej Palkovsky |
| 4 | * All rights reserved. |
4 | * All rights reserved. |
| 5 | * |
5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions |
7 | * modification, are permitted provided that the following conditions |
| Line 52... | Line 52... | ||
| 52 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, |
52 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, |
| 53 | /* KTEXT descriptor */ |
53 | /* KTEXT descriptor */ |
| 54 | { .limit_0_15 = 0xffff, |
54 | { .limit_0_15 = 0xffff, |
| 55 | .base_0_15 = 0, |
55 | .base_0_15 = 0, |
| 56 | .base_16_23 = 0, |
56 | .base_16_23 = 0, |
| 57 | .access = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE , |
57 | .access = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE, |
| 58 | .limit_16_19 = 0xf, |
58 | .limit_16_19 = 0xf, |
| 59 | .available = 0, |
59 | .available = 0, |
| 60 | .longmode = 1, |
60 | .longmode = 1, |
| 61 | .special = 0, |
61 | .special = 0, |
| 62 | .granularity = 1, |
62 | .granularity = 1, |
| Line 109... | Line 109... | ||
| 109 | * on AMD64 it is 64-bit - 2 items in table */ |
109 | * on AMD64 it is 64-bit - 2 items in table */ |
| 110 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, |
110 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, |
| 111 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, |
111 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, |
| 112 | /* VESA Init descriptor */ |
112 | /* VESA Init descriptor */ |
| 113 | #ifdef CONFIG_FB |
113 | #ifdef CONFIG_FB |
| 114 | { 0xffff, 0, VESA_INIT_SEGMENT>>12, AR_PRESENT | AR_CODE | DPL_KERNEL, 0xf, 0, 0, 0, 0, 0 } |
114 | { 0xffff, 0, VESA_INIT_SEGMENT >> 12, AR_PRESENT | AR_CODE | DPL_KERNEL, |
| - | 115 | 0xf, 0, 0, 0, 0, 0 |
|
| - | 116 | } |
|
| 115 | #endif |
117 | #endif |
| 116 | }; |
118 | }; |
| 117 | 119 | ||
| 118 | idescriptor_t idt[IDT_ITEMS]; |
120 | idescriptor_t idt[IDT_ITEMS]; |
| 119 | 121 | ||
| 120 | ptr_16_64_t gdtr = {.limit = sizeof(gdt), .base= (uint64_t) gdt }; |
122 | ptr_16_64_t gdtr = {.limit = sizeof(gdt), .base = (uint64_t) gdt }; |
| 121 | ptr_16_64_t idtr = {.limit = sizeof(idt), .base= (uint64_t) idt }; |
123 | ptr_16_64_t idtr = {.limit = sizeof(idt), .base = (uint64_t) idt }; |
| 122 | 124 | ||
| 123 | static tss_t tss; |
125 | static tss_t tss; |
| 124 | tss_t *tss_p = NULL; |
126 | tss_t *tss_p = NULL; |
| 125 | 127 | ||
| 126 | void gdt_tss_setbase(descriptor_t *d, uintptr_t base) |
128 | void gdt_tss_setbase(descriptor_t *d, uintptr_t base) |
| Line 171... | Line 173... | ||
| 171 | d->selector = gdtselector(KTEXT_DES); |
173 | d->selector = gdtselector(KTEXT_DES); |
| 172 | 174 | ||
| 173 | d->present = 1; |
175 | d->present = 1; |
| 174 | d->type = AR_INTERRUPT; /* masking interrupt */ |
176 | d->type = AR_INTERRUPT; /* masking interrupt */ |
| 175 | 177 | ||
| 176 | idt_setoffset(d, ((uintptr_t) interrupt_handlers) + i*interrupt_handler_size); |
178 | idt_setoffset(d, ((uintptr_t) interrupt_handlers) + |
| - | 179 | i * interrupt_handler_size); |
|
| 177 | } |
180 | } |
| 178 | } |
181 | } |
| 179 | 182 | ||
| 180 | /** Initialize segmentation - code/data/idt tables |
183 | /** Initialize segmentation - code/data/idt tables |
| 181 | * |
184 | * |