Import backup from 2004-12-17
This commit is contained in:
1 parent
11cc0c87f3
commit
3c531f3b7b
7 files changed
+80
-194
No files matched your search
+25
-26
@@ -72,34 +72,33 @@ segmented_start:
|
||||
call _k_mbsave ;save multiboot info structures
|
||||
add esp, 8
|
||||
|
||||
cmp eax, 0 ; eax = pointer to mb_module_t struct for rmmod
|
||||
cmp eax, 0 ; eax = pointer to mb_module_t struct for rmmod
|
||||
jz pm_return
|
||||
|
||||
;go back to real mode to initialize video mode
|
||||
mov ebx, eax ; pointer to mb_module_t
|
||||
mov ecx, [ebx+4] ; end of module
|
||||
mov eax, [ebx] ; start of module
|
||||
mov esi, eax ; start of module
|
||||
sub ecx, eax ; ecx = length of rmmod
|
||||
shr ecx, 2 ; ecx = length of rmmod in dwords
|
||||
mov edi, 0xC0005000 ; where to copy rmmod to (0x5000 physical)
|
||||
mov ebx, eax ; pointer to mb_module_t
|
||||
mov ecx, [ebx+4] ; end of module
|
||||
mov eax, [ebx] ; start of module
|
||||
mov esi, eax ; start of module
|
||||
sub ecx, eax ; ecx = length of rmmod
|
||||
shr ecx, 2 ; ecx = length of rmmod in dwords
|
||||
mov edi, 0xC0005000 ; where to copy rmmod to (0x5000 physical)
|
||||
|
||||
rep movsd ; copy rmmod to first 1mb
|
||||
rep movsd ; copy rmmod to first 1mb
|
||||
|
||||
mov ebx, pm_return ; return address
|
||||
mov ecx, _rm_params ; put real mode params here (video mode etc...)
|
||||
mov ebx, pm_return ; return address
|
||||
mov ecx, _rm_params ; put real mode params here (video mode etc...)
|
||||
sub ecx, VIRT_OFFSET
|
||||
mov edx, _initrd ; load the 'floppy' image here
|
||||
sub edx, VIRT_OFFSET
|
||||
|
||||
mov eax, cr0
|
||||
and eax, 0x7FFFFFFE ; leave PM
|
||||
and eax, 0x7FFFFFFE ; leave PM
|
||||
mov cr0, eax
|
||||
jmp 0x0:0x5010 ; jump to rmmod
|
||||
jmp 0x0:0x5010 ; jump to rmmod
|
||||
|
||||
;Next we enable paging with the first 4mb mapped 1:1 virtual:physical
|
||||
; and with the 4mb starting at 0xC000_0000 mapped to the first 4mb physical.
|
||||
pm_return:
|
||||
mov esp, STACK_V+0x1000 ;ok, now we can access our data again
|
||||
xor eax, eax
|
||||
mov edi, PDBR_V
|
||||
mov ecx, 1024 ;clear the PDBR
|
||||
@@ -133,28 +132,28 @@ fill_lopt_loop: ;fill the page table
|
||||
mov ecx, gdt_end-gdt
|
||||
rep movsb
|
||||
|
||||
mov edi, IDT_V ;destination
|
||||
mov esi, isr_0 ;address of isr0
|
||||
mov edx, isr_1-isr_0 ;distance between isr labels
|
||||
mov ecx, 50 ;number of isrlabels
|
||||
mov edi, IDT_V ;destination
|
||||
mov esi, isr_0 ;address of isr0
|
||||
mov edx, isr_1-isr_0 ;distance between isr labels
|
||||
mov ecx, 50 ;number of isrlabels
|
||||
fill_idt:
|
||||
mov ebx, esi
|
||||
mov ax, si
|
||||
stosw ;0 offset 15:0
|
||||
stosw ;0 offset 15:0
|
||||
mov ax, KERNEL_CODE
|
||||
stosw ;2 selector 15:0
|
||||
stosw ;2 selector 15:0
|
||||
mov ax, 0x8E00
|
||||
stosw ;4 [P][DPL][0][TYPE][0][0][0][0][0][0][0][0]
|
||||
stosw ;4 [P][DPL][0][TYPE][0][0][0][0][0][0][0][0]
|
||||
shr esi, 16
|
||||
mov ax, si
|
||||
stosw ;6 offset 31:16
|
||||
stosw ;6 offset 31:16
|
||||
mov esi, ebx
|
||||
add esi, edx
|
||||
loop fill_idt
|
||||
mov word [IDT_V+0x30*8+4], 0xEE00 ;interrupt 0x30 has user priviledges
|
||||
|
||||
;Then we can start using our "real" gdt, then unmap the lower 4mb.
|
||||
lgdt [gdtr] ;load gdt
|
||||
lgdt [gdtr] ;load gdt
|
||||
jmp KERNEL_CODE:newgdtcontinue
|
||||
newgdtcontinue:
|
||||
mov ax, KERNEL_DATA
|
||||
@@ -167,9 +166,9 @@ newgdtcontinue:
|
||||
lidt [idtr] ;load idt
|
||||
mov [PDBR_V], dword 0 ;unmap 0x0, we are running completely paged at 0xC000_0000
|
||||
|
||||
call _k_init ;C kernel initialization
|
||||
call _k_init ;C kernel initialization
|
||||
|
||||
idle_loop:
|
||||
idle_loop: ; system idle loop
|
||||
sti
|
||||
hlt
|
||||
jmp idle_loop
|
||||
|
||||
+5
-7
@@ -30,14 +30,13 @@ mb_mmap_t mb_mmap[MAX_MMAP];
|
||||
u32_t mmap_entries;
|
||||
mb_module_t mb_modules[MAX_MODULES];
|
||||
mb_apm_t mb_apm_table;
|
||||
mb_module_t *real_mode_module; // pointer to real mode module (if present)
|
||||
mb_module_t *real_mode_module; // pointer to real mode module (if present)
|
||||
real_mode_param_t rm_params;
|
||||
char mb_cmdline[256];
|
||||
int criticalCounter; // semaphore for if interrupts are disabled
|
||||
u32_t timer; // number of IRQ 0's
|
||||
int criticalCounter; // semaphore for if interrupts are disabled
|
||||
u32_t timer; // number of IRQ 0's
|
||||
minor_t devfs_minor = -1;
|
||||
minor_t initrd_minor = -1;
|
||||
byte initrd[2880*512]; // buffer in bss for loading a floppy image
|
||||
|
||||
extern u32_t mm_freepages;
|
||||
|
||||
@@ -115,12 +114,11 @@ void k_init()
|
||||
{
|
||||
if (rm_params.vid_mem) // there is video memory to map in
|
||||
vmm_mapn(0xF0000000, (u32_t)rm_params.vid_addr, (rm_params.vid_mem >> 12) + 1);
|
||||
if (rm_params.initrd_loaded) // there is an initrd to register
|
||||
initrd_minor = ramdisk_register(initrd, 2880*512);
|
||||
// initrd_minor = ramdisk_register(initrd, 2880*512);
|
||||
}
|
||||
display_init(); //get us some virtual consoles to look at
|
||||
display_activate(11);
|
||||
kprintf("HOS v0.15 initializing...\n");
|
||||
kprintf("HOS v0.16 initializing...\n");
|
||||
kprintf("Kernel load size: %d (0x%x) bytes (%d kb)\n", kernel_size(), kernel_size(), kernel_size() >> 10);
|
||||
kprintf("Kernel memory size: %d (0x%x) bytes (%d kb)\n", kernel_size_used(), kernel_size_used(), kernel_size_used() >> 10);
|
||||
if ((devfs_minor = ramdisk_new(4096)) < 0)
|
||||
|
||||
@@ -15,7 +15,6 @@ typedef struct {
|
||||
u32_t height; // height in pixels or columns if vid_mem == 0
|
||||
u32_t vid_mem; // amount of memory for video buffer
|
||||
u32_t bpp; // bits per pixel - 16/24/32
|
||||
byte initrd_loaded; // did we load an initrd?
|
||||
} __attribute__ ((packed)) real_mode_param_t;
|
||||
|
||||
/* returns true to callee if we should jump to a real mode module */
|
||||
|
||||
Reference in new issue
Block a user