Skip to content

Commit c125c5f

Browse files
authored
Merge pull request #1640 from fwsGonzo/dev
Various fixes to x86 platform
2 parents f31c697 + 26fd0de commit c125c5f

6 files changed

Lines changed: 16 additions & 7 deletions

File tree

lib/uplink/ws_uplink.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,9 @@ namespace uplink {
393393
writer.Key("arch");
394394
writer.String(OS::arch());
395395

396+
writer.Key("physical_ram");
397+
writer.Uint64(sysinfo.physical_memory);
398+
396399
// CPU Features
397400
auto features = CPUID::detect_features_str();
398401
writer.Key("cpu_features");

src/arch/x86_64/arch_start.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extern __multiboot_addr
2525
%define P2_TAB 0x3000 ;; - 0x7fff
2626
%define NUM_P3_ENTRIES 5
2727
%define NUM_P2_ENTRIES 2560
28-
%define STACK_LOCATION 0x9F7F0
28+
%define STACK_LOCATION 0x9D3F0
2929

3030
[BITS 32]
3131
__arch_start:

src/platform/x86_pc/os.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ void OS::start(uint32_t boot_magic, uint32_t boot_addr)
127127
memmap.assign_range({0x8000, 0xffff, "Statman", "Statistics"});
128128
#if defined(ARCH_x86_64)
129129
memmap.assign_range({0x1000, 0x6fff, "Pagetables", "System page tables"});
130-
memmap.assign_range({0x10000, 0x9f7ff, "Stack", "System main stack"});
130+
memmap.assign_range({0x10000, 0x9d3ff, "Stack", "System main stack"});
131131
#elif defined(ARCH_i686)
132-
memmap.assign_range({0x10000, 0x9f7ff, "Stack", "System main stack"});
132+
memmap.assign_range({0x10000, 0x9d3ff, "Stack", "System main stack"});
133133
#endif
134-
//memmap.assign_range({0x9f800, 0x9ffff, "Multiboot", "Multiboot reserved area"});
134+
//memmap.assign_range({0x9d400, 0x9ffff, "Multiboot", "Multiboot reserved area"});
135135
memmap.assign_range({(uintptr_t)&_LOAD_START_, (uintptr_t)&_end - 1,
136136
"ELF", "Your service binary including OS"});
137137

src/platform/x86_pc/platform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void __platform_init()
8686
initialize_gdt_for_cpu(APIC::get().get_id());
8787
#ifdef ARCH_x86_64
8888
// setup Interrupt Stack Table
89-
x86::ist_initialize_for_cpu(0, 0xA00000);
89+
x86::ist_initialize_for_cpu(0, 0x9D3F0);
9090
#endif
9191

9292
// IDT manager: Interrupt and exception handlers

src/platform/x86_pc/smbios.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <cstring>
2121
#include <cstdio>
2222
#include <info>
23+
#include <kernel/os.hpp>
2324

2425
namespace x86
2526
{
@@ -148,6 +149,11 @@ namespace x86
148149
hdr = hdr->next();
149150
if (hdr->type == 0) break;
150151
}
152+
153+
// salvage operation for when no memory array found
154+
if (sysinfo.physical_memory == 0) {
155+
sysinfo.physical_memory = OS::memory_end()+1;
156+
}
151157
}
152158

153159
static uint8_t checksum(const char* addr, int length)

src/platform/x86_pc/start.asm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ global __avx_enabled
2828
%define MB_FLAGS 0x3 ;; ALIGN + MEMINFO
2929

3030
;; stack base address at EBDA border
31-
;; NOTE: Multiboot can use 9f800 to 9ffff
32-
%define STACK_LOCATION 0x9F7F0
31+
;; NOTE: Multiboot can use 9d400 to 9ffff
32+
%define STACK_LOCATION 0x9D3F0
3333

3434
extern _MULTIBOOT_START_
3535
extern _LOAD_START_

0 commit comments

Comments
 (0)