-
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.
Scanning for RSD PTR. Updated bootloader code so that loads kernel at…
… a different address and don't clobber ACPI tables.
- Loading branch information
Showing
6 changed files
with
101 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/*****************************************************************************/ | ||
/* File: acpi.c */ | ||
/* */ | ||
/* Description: Source file for ACPI. */ | ||
/* */ | ||
/* Author: Shoily O Rahman <[email protected]> */ | ||
/* */ | ||
/* Date: Nov 3, 2020 */ | ||
/* */ | ||
/*****************************************************************************/ | ||
|
||
#include "acpi.h" | ||
#include "debug.h" | ||
#include "krnlconst.h" | ||
#include "debug.h" | ||
|
||
extern int ebda; | ||
|
||
void *rsd_ptr; | ||
|
||
#define CHECK_RSD_PTR(p) (((char*)p)[0]=='R' && \ | ||
((char*)p)[1]=='S' && \ | ||
((char*)p)[2]=='D' && \ | ||
((char*)p)[3]==' ' && \ | ||
((char*)p)[4]=='P' && \ | ||
((char*)p)[5]=='T' && \ | ||
((char*)p)[6]=='R' && \ | ||
((char*)p)[7]==' ') | ||
|
||
void acpi_find_rsdp() { | ||
|
||
int phase = 0; | ||
int cur, end; | ||
|
||
rsd_ptr = 0; | ||
|
||
cur = ebda + KERNEL_VIRT_ADDR; | ||
end = ebda + 1024; | ||
|
||
while(phase < 2) { | ||
|
||
if (cur == end) { | ||
|
||
phase++; | ||
|
||
if (phase == 1) { | ||
|
||
cur = 0xE0000 + KERNEL_VIRT_ADDR; | ||
end = cur + 0x20000; | ||
} | ||
} | ||
|
||
if (CHECK_RSD_PTR(cur)) { | ||
|
||
rsd_ptr = (void*)cur; | ||
printf(KERNEL_INFO, "RSD PTR: %p\n", rsd_ptr-KERNEL_VIRT_ADDR); | ||
break; | ||
} | ||
|
||
cur += 16; | ||
} | ||
} |
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,17 @@ | ||
/*****************************************************************************/ | ||
/* File: acpi.h */ | ||
/* */ | ||
/* Description: Header file for ACPI. */ | ||
/* */ | ||
/* Author: Shoily O Rahman <[email protected]> */ | ||
/* */ | ||
/* Date: Nov 3, 2020 */ | ||
/* */ | ||
/*****************************************************************************/ | ||
|
||
#ifndef _ACPI_H | ||
#define _ACPI_H | ||
|
||
void acpi_find_rsdp(); | ||
|
||
#endif |
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