[main] Moving some stuff
This commit is contained in:
parent
a633c34e39
commit
def0d9ba32
4
fs/usr/share/cat
Normal file
4
fs/usr/share/cat
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
\ /\
|
||||||
|
) ( ')
|
||||||
|
( / )
|
||||||
|
\(__)|
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include <system.h>
|
#include <system.h>
|
||||||
|
|
||||||
|
#define MULTIBOOT_MAGIC 0x1BADB002
|
||||||
|
#define MULTIBOOT_EAX_MAGIC 0x2BADB002
|
||||||
#define MULTIBOOT_FLAG_MEM 0x001
|
#define MULTIBOOT_FLAG_MEM 0x001
|
||||||
#define MULTIBOOT_FLAG_DEVICE 0x002
|
#define MULTIBOOT_FLAG_DEVICE 0x002
|
||||||
#define MULTIBOOT_FLAG_CMDLINE 0x004
|
#define MULTIBOOT_FLAG_CMDLINE 0x004
|
||||||
|
35
main.c
35
main.c
@ -54,17 +54,20 @@
|
|||||||
* multiboot data from the bootloader. It will then proceed to print
|
* multiboot data from the bootloader. It will then proceed to print
|
||||||
* out the contents of the initial ramdisk image.
|
* out the contents of the initial ramdisk image.
|
||||||
*/
|
*/
|
||||||
int main(struct multiboot *mboot_ptr)
|
int main(struct multiboot *mboot_ptr, uint32_t mboot_mag)
|
||||||
{
|
{
|
||||||
|
int using_multiboot = 0;
|
||||||
/* Realing memory to the end of the multiboot modules */
|
if (mboot_mag == MULTIBOOT_EAX_MAGIC) {
|
||||||
if (mboot_ptr->mods_count > 0) {
|
using_multiboot = 1;
|
||||||
uint32_t module_end = *(uint32_t *) (mboot_ptr->mods_addr + 4);
|
/* Realing memory to the end of the multiboot modules */
|
||||||
kmalloc_startat(module_end);
|
if (mboot_ptr->mods_count > 0) {
|
||||||
}
|
uint32_t module_end = *(uint32_t *) (mboot_ptr->mods_addr + 4);
|
||||||
#if 0
|
kmalloc_startat(module_end);
|
||||||
mboot_ptr = copy_multiboot(mboot_ptr);
|
}
|
||||||
|
#if 1
|
||||||
|
mboot_ptr = copy_multiboot(mboot_ptr);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize core modules */
|
/* Initialize core modules */
|
||||||
gdt_install(); /* Global descriptor table */
|
gdt_install(); /* Global descriptor table */
|
||||||
@ -85,13 +88,17 @@ int main(struct multiboot *mboot_ptr)
|
|||||||
settextcolor(12, 0);
|
settextcolor(12, 0);
|
||||||
kprintf("[%s %s]\n", KERNEL_UNAME, KERNEL_VERSION_STRING);
|
kprintf("[%s %s]\n", KERNEL_UNAME, KERNEL_VERSION_STRING);
|
||||||
|
|
||||||
/* Print multiboot information */
|
if (using_multiboot) {
|
||||||
dump_multiboot(mboot_ptr);
|
/* Print multiboot information */
|
||||||
|
dump_multiboot(mboot_ptr);
|
||||||
|
|
||||||
uint32_t module_start = *((uint32_t *) mboot_ptr->mods_addr);
|
if (mboot_ptr->mods_count > 0) {
|
||||||
uint32_t module_end = *(uint32_t *) (mboot_ptr->mods_addr + 4);
|
uint32_t module_start = *((uint32_t *) mboot_ptr->mods_addr);
|
||||||
|
uint32_t module_end = *(uint32_t *) (mboot_ptr->mods_addr + 4);
|
||||||
|
|
||||||
initrd_mount(module_start, module_end);
|
initrd_mount(module_start, module_end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
start_shell();
|
start_shell();
|
||||||
|
|
||||||
|
@ -22,9 +22,10 @@ mboot:
|
|||||||
; Main entrypoint
|
; Main entrypoint
|
||||||
global start
|
global start
|
||||||
start:
|
start:
|
||||||
mov esp, _sys_stack
|
mov esp, 0x7FFFF ; grub likes this
|
||||||
; Push the incoming mulitboot headers
|
; Push the incoming mulitboot headers
|
||||||
push ebx
|
push eax ; Magic
|
||||||
|
push ebx ; Header pointer
|
||||||
; Disable interrupts
|
; Disable interrupts
|
||||||
cli
|
cli
|
||||||
; Call the C entry
|
; Call the C entry
|
||||||
@ -192,6 +193,4 @@ irq_common_stub:
|
|||||||
; BSS Section
|
; BSS Section
|
||||||
SECTION .bss
|
SECTION .bss
|
||||||
resb 8192 ; 8KB of memory reserved
|
resb 8192 ; 8KB of memory reserved
|
||||||
_sys_stack:
|
|
||||||
; This line intentionally left blank
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user