* Add atari memory map defs.

* Add osheader defs.
* Check for FPU.
* note on prg vs bootsector.
* mmu stuff.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23468 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2008-01-13 01:07:20 +00:00
parent 98456ae281
commit 246ab5c53f
6 changed files with 84 additions and 34 deletions

View File

@ -0,0 +1,23 @@
/*
* Copyright 2008, François Revol, revol@free.fr. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef ATARI_MEMORY_MAP_H
#define ATARI_MEMORY_MAP_H
#define ATARI_CHIPRAM_TOP_TT 0x00a00000
/* -> e00000 is VME for MegaST*/
#define ATARI_CHIPRAM_TOP_FALCON 0x00e00000
#define ATARI_ROM_BASE ATARI_CHIPRAM_TOP_FALCON
#define ATARI_ROM_TOP 0x00f00000
#define ATARI_IO_BASE ATARI_ROM_TOP
#define ATARI_CARTRIDGE_BASE 0x00fa0000
#define ATARI_OLD_ROM_BASE 0x00fc0000
#define ATARI_IO_TOP 0x01000000
#define ATARI_FASTRAM_TOP ATARI_IO_TOP
#define ATARI_SHADOW_BASE 0xff000000
#endif /* ATARI_MEMORY_MAP_H */

View File

@ -29,12 +29,15 @@
# define TRACE(x) ;
#endif
#warning M68K: add set_vbr()
static status_t
check_cpu_features()
{
#warning M68K: TODO: probe ourselves, we shouldn't trust the TOS!
const tos_cookie *c = tos_find_cookie('_CPU');
const tos_cookie *c;
c = tos_find_cookie('_CPU');
if (!c) {
panic("can't get a cookie (_CPU)! Mum, I'm hungry!");
return EINVAL;
@ -47,6 +50,18 @@ check_cpu_features()
gKernelArgs.arch_args.has_lpstop = (c->ivalue >= 60)?true:false;
#warning M68K: add cpu type to kern args
c = tos_find_cookie('_FPU');
if (!c) {
panic("can't get a cookie (_FPU)! Mum, I'm hungry!");
return EINVAL;
}
#warning M68K: check for fpu in detail
if (c->ivalue < 2 || c->ivalue > 7) {
panic("bad fpu");
return EINVAL;
}
return B_OK;
}

View File

@ -48,36 +48,6 @@
# define TRACE(x) ;
#endif
struct gdt_idt_descr {
uint16 limit;
uint32 *base;
} _PACKED;
// memory structure returned by int 0x15, ax 0xe820
struct extended_memory {
uint64 base_addr;
uint64 length;
uint32 type;
};
#ifdef _PXE_ENV
static const uint32 kDefaultPageTableFlags = 0x07; // present, user, R/W
static const size_t kMaxKernelSize = 0x100000; // 1 MB for the kernel
// working page directory and page table
static uint32 *sPageDirectory = 0;
static addr_t sNextPhysicalAddress = 0x112000;
static addr_t sNextVirtualAddress = KERNEL_BASE + kMaxKernelSize;
static addr_t sMaxVirtualAddress = KERNEL_BASE + 0x400000;
static addr_t sNextPageTableAddress = 0x7d000;
static const uint32 kPageTableRegionEnd = 0x8b000;
// we need to reserve 2 pages for the SMP trampoline code
#else
static const uint32 kDefaultPageTableFlags = 0x07; // present, user, R/W
static const size_t kMaxKernelSize = 0x100000; // 1 MB for the kernel
@ -92,9 +62,6 @@ static addr_t sNextPageTableAddress = 0x90000;
static const uint32 kPageTableRegionEnd = 0x9e000;
// we need to reserve 2 pages for the SMP trampoline code
#endif
static addr_t
get_next_virtual_address(size_t size)
{

View File

@ -22,6 +22,12 @@ extern addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size, uint3
extern void *mmu_allocate(void *virtualAddress, size_t size);
extern void mmu_free(void *virtualAddress, size_t size);
struct boot_mmu_ops {
// len=0 to disable
status_t (*set_tt)(int which, addr_t pa, size_t len, uint32 perms);
};
#ifdef __cplusplus
}
#endif

View File

@ -73,6 +73,12 @@
#define S_IFDIR 00000040000o
// NOTE: normal programs (.prg) run as user mode,
// while boot sector is chained in supervisor mode.
// this means using Super(SUP_INQUIRE) we can know
// from the same entry point if we were run from boot code or prg.
//Pterm0
//move.w #1,%d0
//trap #1

View File

@ -129,6 +129,12 @@ extern int32 xbios(uint16 nr, ...);
extern int32 gemdos(uint16 nr, ...);
#define SUP_USER 0
#define SUP_SUPER 1
#define SUP_SET (void *)0
#define SUP_INQUIRE (void *)1
// official names
#define Pterm0() gemdos(0)
#define Cconin() gemdos(1)
@ -167,6 +173,33 @@ static inline const tos_cookie *tos_find_cookie(uint32 what)
return NULL;
}
/*
* OSHEADER access
*/
typedef struct tos_osheader {
uint16 os_entry;
uint16 os_version;
void *reseth;
struct tos_osheader *os_beg;
void *os_end;
void *os_rsv1;
void *os_magic;
uint32 os_date;
uint32 os_conf;
//uint32/16? os_dosdate;
// ... more stuff we don't care about
} tos_osheader;
#define tos_sysbase ((const struct tos_osheader **)0x4F2)
static inline const struct tos_osheader *tos_get_osheader()
{
if (!(*tos_sysbase))
return NULL;
return (*tos_sysbase)->os_beg;
}
#endif /* __ASSEMBLER__ */
#ifdef __cplusplus