summaryrefslogtreecommitdiff
path: root/asm/asm_start.h
blob: 8390b8a33663721778f8c062aff129020e48e2e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
  * @file
  *
  * START
  * =====
  *
  * Defines the following sections/functions, some are linked at 
  * specific addresses in the final ELF kernel binary.
  * This is specified in the _linker.ld_ file.
  *
  * * 0x007000  .smp - entry point for application processors (16bit code) _start_smp() calls finally smp_main()
  * * 0x100000  .multiboot - the multiboot header
  *
  * __TODO: Does this not kill the memory in-between?__
  *
  * * .text
  * * .bootstrap_stack
  * * _start() - main entry point for booting cpu, calls kernel_main().
  * 
  * The addresses for .smp and .multiboot are based on the assumption:
  * * 0x00000500 - 0x00007BFF : guaranteed free to use
  * * 0x00100000 - 0x00EFFFFF : free for use (if it exists) 
  *
  * References
  * ----------
  * * https://www.gnu.org/software/grub/manual/multiboot/multiboot.html#Boot-information-format
  * * http://wiki.osdev.org/Bare_Bones
  */

extern uint32_t kernel_start[];
extern uint32_t kernel_end[];



/** This will be called by a multiboot compilant boot-loader (i.e. grub2).
 *  Calls kernel_main() passing through eax and ebx:
 *  * eax - magic number
 *  * ebx - multiboot structure
 * */
void _start();

/** 16-bit entry point for application processors */
void _start_smp();

static uint32_t get_kernel_start(){return kernel_start;}
static uint32_t get_kernel_end(){return kernel_end;}