forked from apache/nuttx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arch/intel64: convert __nxstart to C function and move appropriate fu…
…nctions there to follow the approach in other architectures Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
- Loading branch information
1 parent
f76017c
commit b4b96a6
Showing
6 changed files
with
162 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
/**************************************************************************** | ||
* arch/x86_64/src/intel64/intel64_start.c | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. The | ||
* ASF licenses this file to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance with the | ||
* License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
****************************************************************************/ | ||
|
||
/**************************************************************************** | ||
* Included Files | ||
****************************************************************************/ | ||
|
||
#include <nuttx/config.h> | ||
|
||
#include <nuttx/init.h> | ||
|
||
#include <arch/board/board.h> | ||
#include <arch/multiboot2.h> | ||
|
||
#include "x86_64_internal.h" | ||
#include "intel64.h" | ||
|
||
/**************************************************************************** | ||
* Public Data | ||
****************************************************************************/ | ||
|
||
/* This holds information passed by the multiboot2 bootloader */ | ||
|
||
uint32_t mb_magic __attribute__((section(".loader.bss"))); | ||
uint32_t mb_info_struct __attribute__((section(".loader.bss"))); | ||
|
||
/**************************************************************************** | ||
* Private Functions | ||
****************************************************************************/ | ||
|
||
#ifdef CONFIG_ARCH_MULTIBOOT2 | ||
/**************************************************************************** | ||
* Name: x86_64_mb2_config | ||
* | ||
* Description: | ||
* Parse multiboot2 info. | ||
* | ||
****************************************************************************/ | ||
|
||
static void x86_64_mb2_config(void) | ||
{ | ||
struct multiboot_tag *tag; | ||
|
||
/* Check that we were actually booted by a multiboot2 bootloader */ | ||
|
||
if (mb_magic != MULTIBOOT2_BOOTLOADER_MAGIC) | ||
{ | ||
return; | ||
} | ||
|
||
for (tag = (struct multiboot_tag *)(uintptr_t)(mb_info_struct + 8); | ||
tag->type != MULTIBOOT_TAG_TYPE_END; | ||
tag = (struct multiboot_tag *)((uint8_t *)tag + | ||
((tag->size + 7) & ~7))) | ||
{ | ||
switch (tag->type) | ||
{ | ||
case MULTIBOOT_TAG_TYPE_EFI64: | ||
{ | ||
break; | ||
} | ||
|
||
#ifdef CONFIG_MULTBOOT2_FB_TERM | ||
case MULTIBOOT_TAG_TYPE_FRAMEBUFFER: | ||
{ | ||
x86_64_mb2_fbinitialize( | ||
(struct multiboot_tag_framebuffer *)tag); | ||
break; | ||
} | ||
#endif | ||
|
||
default: | ||
break; | ||
} | ||
} | ||
} | ||
#endif | ||
|
||
/**************************************************************************** | ||
* Public Functions | ||
****************************************************************************/ | ||
|
||
/**************************************************************************** | ||
* Name: __nxstart | ||
* | ||
* Description: | ||
* Do low-level initialization and call nx_start. | ||
* | ||
****************************************************************************/ | ||
|
||
void __nxstart(void) | ||
{ | ||
/* Low-level, pre-OS initialization */ | ||
|
||
intel64_lowsetup(); | ||
|
||
#ifdef CONFIG_ARCH_MULTIBOOT2 | ||
/* Handle multiboot2 info */ | ||
|
||
x86_64_mb2_config(); | ||
#endif | ||
|
||
/* perform board-specific initializations */ | ||
|
||
x86_64_boardinitialize(); | ||
|
||
#ifdef USE_EARLYSERIALINIT | ||
/* Early serial driver initialization */ | ||
|
||
x86_64_earlyserialinit(); | ||
#endif | ||
|
||
x86_64_timer_calibrate_freq(); | ||
|
||
#ifdef CONFIG_LIB_SYSCALL | ||
enable_syscall(); | ||
#endif | ||
|
||
/* Start NuttX */ | ||
|
||
nx_start(); | ||
|
||
/* Shouldn't get here */ | ||
|
||
for (; ; ); | ||
} |