kernel: add a compatibility commpage on x86_64.

* x86 uses a commpage with 32-bit addresses, incompatible with the one used for
x86_64. For this reason, a compatibility commpage is needed to support a 32-bit
userland on x86_64.
* define ADDRESS_TYPE as a macro for addr_t (default) or uint32 (for the 32-bit
commpage).
* team_create_thread_start_internal() will use clone_commpage_area() with
KERNEL_USER_DATA_BASE or clone_commpage_compat_area() with
KERNEL_USER32_DATA_BASE, to setup the correct commpage.
* real_time_clock (in compatibility mode) also updates the compatibility
commpage with real time data.

Change-Id: I61605077ce0beabab4439ef54edd1eae26f26fd2
This commit is contained in:
Jérôme Duval
2018-05-18 05:11:07 +00:00
parent cd6365c7ce
commit db9b70ee54
8 changed files with 157 additions and 4 deletions
+39
View File
@@ -0,0 +1,39 @@
/*
* Copyright 2018 Haiku Inc. All Rights Reserved.
* Copyright 2007, Travis Geiselbrecht. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_COMMPAGE_COMPAT_H
#define _KERNEL_COMMPAGE_COMPAT_H
#include <image.h>
#include <SupportDefs.h>
#define COMMPAGE_COMPAT
#include <commpage_defs.h>
#ifdef __cplusplus
extern "C" {
#endif
status_t commpage_compat_init(void);
status_t commpage_compat_init_post_cpus(void);
void* allocate_commpage_compat_entry(int entry, size_t size);
addr_t fill_commpage_compat_entry(int entry, const void* copyFrom,
size_t size);
image_id get_commpage_compat_image();
area_id clone_commpage_compat_area(team_id team, void** address);
// implemented in the architecture specific part
status_t arch_commpage_compat_init(void);
status_t arch_commpage_compat_init_post_cpus(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* _KERNEL_COMMPAGE_COMPAT_H */
@@ -1,4 +1,5 @@
/*
* Copyright 2018 Haiku Inc. All Rights Reserved.
* Copyright 2006, Ingo Weinhold <[email protected]>.
* All rights reserved. Distributed under the terms of the MIT License.
*/
@@ -12,6 +13,7 @@
struct arch_real_time_data {
bigtime_t system_time_offset;
uint32 system_time_conversion_factor;
uint32 _padding;
};
#endif /* _KERNEL_ARCH_REAL_TIME_DATA_H */
+5
View File
@@ -1,4 +1,5 @@
/*
* Copyright 2018 Haiku Inc. All Rights Reserved.
* Copyright 2007, Travis Geiselbrecht. All rights reserved.
* Distributed under the terms of the MIT License.
*/
@@ -19,6 +20,10 @@
#define COMMPAGE_SIGNATURE 'COMM'
#define COMMPAGE_VERSION 1
#ifdef COMMPAGE_COMPAT
#include <arch/x86/arch_commpage_defs.h>
#else
#include <arch_commpage_defs.h>
#endif
#endif /* _SYSTEM_COMMPAGE_DEFS_H */