mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 03:12:44 +00:00 
			
		
		
		
	 a15857ea28
			
		
	
	
		a15857ea28
		
	
	
	
	
		
			
			I'm not sure who is responsible for clearing this, but IIUC the C++ ABI expects it to be clear on function entry, so just to be on the safe side..
		
			
				
	
	
		
			66 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			ArmAsm
		
	
	
	
	
	
			
		
		
	
	
			66 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			ArmAsm
		
	
	
	
	
	
| .set MULTIBOOT_MAGIC,         0x1badb002
 | |
| .set MULTIBOOT_PAGE_ALIGN,    0x1
 | |
| .set MULTIBOOT_MEMORY_INFO,   0x2
 | |
| .set MULTIBOOT_VIDEO_MODE,    0x4
 | |
| .set multiboot_flags,         MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_VIDEO_MODE
 | |
| .set multiboot_checksum,      -(MULTIBOOT_MAGIC + multiboot_flags)
 | |
| 
 | |
| .section .multiboot
 | |
| .align 4
 | |
| 
 | |
| .long MULTIBOOT_MAGIC
 | |
| .long multiboot_flags
 | |
| .long multiboot_checksum
 | |
| 
 | |
| 
 | |
| /* for MULTIBOOT_MEMORY_INFO */
 | |
| .long 0x00000000    /* header_addr */
 | |
| .long 0x00000000    /* load_addr */
 | |
| .long 0x00000000    /* load_end_addr */
 | |
| .long 0x00000000    /* bss_end_addr */
 | |
| .long 0x00000000    /* entry_addr */
 | |
| 
 | |
| /* for MULTIBOOT_VIDEO_MODE */
 | |
| .long 0x00000000    /* mode_type */
 | |
| .long 0             /* width */
 | |
| .long 0             /* height */
 | |
| .long 32            /* depth */
 | |
| 
 | |
| .section .stack, "aw", @nobits
 | |
| stack_bottom:
 | |
| .skip 32768
 | |
| stack_top:
 | |
| 
 | |
| .section .text
 | |
| 
 | |
| .global start
 | |
| .type start, @function
 | |
| 
 | |
| .extern init 
 | |
| .type init, @function
 | |
| 
 | |
| start:
 | |
|     cli
 | |
|     cld
 | |
| 
 | |
|     mov $stack_top, %esp
 | |
| 
 | |
|     and $-16, %esp
 | |
| 
 | |
|     pushl %esp
 | |
|     pushl %eax /* Multiboot header magic */
 | |
|     pushl %ebx /* Multiboot header pointer */
 | |
| 
 | |
|     call init
 | |
| 
 | |
|     pushl $exit_message
 | |
|     call kprintf
 | |
| 
 | |
|     cli
 | |
| 
 | |
| loop:
 | |
|     hlt
 | |
|     jmp loop
 | |
| 
 | |
| exit_message:
 | |
|     .asciz "Kernel exited."
 |