Merged the signals branch into trunk, with these changes:

* The team and thread kernel structures have been renamed to Team and Thread
  respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
  private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40196 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2011-01-10 21:54:38 +00:00
parent ebf7db3afd
commit 4535495d80
139 changed files with 1303 additions and 1231 deletions
+1 -1
View File
@@ -227,7 +227,7 @@ AddFilesToHaikuImage system add-ons kernel busses usb
: <usb>uhci <usb>ohci <usb>ehci ; : <usb>uhci <usb>ohci <usb>ehci ;
AddFilesToHaikuImage system add-ons kernel console : vga_text ; AddFilesToHaikuImage system add-ons kernel console : vga_text ;
AddFilesToHaikuImage system add-ons kernel debugger AddFilesToHaikuImage system add-ons kernel debugger
: <kdebug>demangle $(X86_ONLY)<kdebug>disasm <kdebug>hangman : <kdebug>demangle $(X86_ONLY)<kdebug>disasm
<kdebug>invalidate_on_exit <kdebug>usb_keyboard <kdebug>run_on_exit ; <kdebug>invalidate_on_exit <kdebug>usb_keyboard <kdebug>run_on_exit ;
AddFilesToHaikuImage system add-ons kernel file_systems AddFilesToHaikuImage system add-ons kernel file_systems
: $(SYSTEM_ADD_ONS_FILE_SYSTEMS) ; : $(SYSTEM_ADD_ONS_FILE_SYSTEMS) ;
+10 -1
View File
@@ -35,6 +35,10 @@
* *
*/ */
#include <sys/cdefs.h>
#define STATE_CLEAR 0x0000 #define STATE_CLEAR 0x0000
#define STATE_SET 0x0004 #define STATE_SET 0x0004
#define NODE_IDS 0x0008 #define NODE_IDS 0x0008
@@ -209,6 +213,8 @@ struct crom_context {
struct crom_ptr stack[CROM_MAX_DEPTH]; struct crom_ptr stack[CROM_MAX_DEPTH];
}; };
__BEGIN_DECLS
void crom_init_context(struct crom_context *, uint32_t *); void crom_init_context(struct crom_context *, uint32_t *);
struct csrreg *crom_get(struct crom_context *); struct csrreg *crom_get(struct crom_context *);
void crom_next(struct crom_context *); void crom_next(struct crom_context *);
@@ -246,6 +252,9 @@ extern int crom_add_entry(struct crom_chunk *, int, int);
extern int crom_add_chunk(struct crom_src *src, struct crom_chunk *, extern int crom_add_chunk(struct crom_src *src, struct crom_chunk *,
struct crom_chunk *, int); struct crom_chunk *, int);
extern int crom_add_simple_text(struct crom_src *src, struct crom_chunk *, extern int crom_add_simple_text(struct crom_src *src, struct crom_chunk *,
struct crom_chunk *, char *); struct crom_chunk *, const char *);
extern int crom_load(struct crom_src *, uint32_t *, int); extern int crom_load(struct crom_src *, uint32_t *, int);
#endif #endif
__END_DECLS
@@ -22,9 +22,9 @@ struct iframe *arm_get_user_iframe(void);
/* as we won't support SMP on arm (yet?) we can use a global here */ /* as we won't support SMP on arm (yet?) we can use a global here */
/*TODO SMP-ARMS are comming..*/ /*TODO SMP-ARMS are comming..*/
extern struct thread *gCurrentThread; extern Thread *gCurrentThread;
extern inline struct thread * extern inline Thread *
arch_thread_get_current_thread(void) arch_thread_get_current_thread(void)
{ {
return gCurrentThread; return gCurrentThread;
@@ -32,7 +32,7 @@ arch_thread_get_current_thread(void)
extern inline void extern inline void
arch_thread_set_current_thread(struct thread *t) arch_thread_set_current_thread(Thread *t)
{ {
gCurrentThread = t; gCurrentThread = t;
} }
+7 -2
View File
@@ -16,7 +16,12 @@
struct kernel_args; struct kernel_args;
struct thread;
namespace BKernel {
struct Thread;
}
using BKernel::Thread;
// arch_debug_get_stack_trace() flags // arch_debug_get_stack_trace() flags
@@ -34,7 +39,7 @@ void *arch_debug_get_caller(void);
int32 arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount, int32 arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount,
int32 skipIframes, int32 skipFrames, uint32 flags); int32 skipIframes, int32 skipFrames, uint32 flags);
void* arch_debug_get_interrupt_pc(bool* _isSyscall); void* arch_debug_get_interrupt_pc(bool* _isSyscall);
bool arch_debug_contains_call(struct thread *thread, const char *symbol, bool arch_debug_contains_call(Thread *thread, const char *symbol,
addr_t start, addr_t end); addr_t start, addr_t end);
void arch_debug_save_registers(struct arch_debug_registers* registers); void arch_debug_save_registers(struct arch_debug_registers* registers);
void arch_debug_unset_current_thread(void); void arch_debug_unset_current_thread(void);
+2 -2
View File
@@ -517,7 +517,7 @@ extern int arch_machine;
Use of (some) special purpose registers. Use of (some) special purpose registers.
XXX: those regs aren't implemented/accessed the same way on different cpus... XXX: those regs aren't implemented/accessed the same way on different cpus...
SRP[63-32]: current struct thread* SRP[63-32]: current Thread*
SRP[31-0] : SRP[31-0] :
CAAR : can we use it ?? CAAR : can we use it ??
MSP : MSP :
@@ -526,7 +526,7 @@ extern int arch_machine;
SPRG0: per CPU physical address pointer to an ppc_cpu_exception_context SPRG0: per CPU physical address pointer to an ppc_cpu_exception_context
structure structure
SPRG1: scratch SPRG1: scratch
SPRG2: current struct thread* SPRG2: current Thread*
SPRG3: TLS base pointer (only for userland threads) SPRG3: TLS base pointer (only for userland threads)
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2006, Haiku Inc. All rights reserved. * Copyright 2003-2011, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -20,9 +20,9 @@ void m68k_pop_iframe(struct iframe_stack *stack);
struct iframe *m68k_get_user_iframe(void); struct iframe *m68k_get_user_iframe(void);
/* as we won't support SMP on m68k (yet?) we can use a global here */ /* as we won't support SMP on m68k (yet?) we can use a global here */
extern struct thread *gCurrentThread; extern Thread *gCurrentThread;
extern inline struct thread * extern inline Thread *
arch_thread_get_current_thread(void) arch_thread_get_current_thread(void)
{ {
return gCurrentThread; return gCurrentThread;
@@ -30,7 +30,7 @@ arch_thread_get_current_thread(void)
extern inline void extern inline void
arch_thread_set_current_thread(struct thread *t) arch_thread_set_current_thread(Thread *t)
{ {
gCurrentThread = t; gCurrentThread = t;
} }
@@ -38,17 +38,17 @@ arch_thread_set_current_thread(struct thread *t)
#if 0 #if 0
/* this would only work on 030... */ /* this would only work on 030... */
extern inline struct thread * extern inline Thread *
arch_thread_get_current_thread(void) arch_thread_get_current_thread(void)
{ {
uint64 v = 0; uint64 v = 0;
asm volatile("pmove %%srp,(%0)" : : "a"(&v)); asm volatile("pmove %%srp,(%0)" : : "a"(&v));
return (struct thread *)(uint32)(v & 0xffffffff); return (Thread *)(uint32)(v & 0xffffffff);
} }
extern inline void extern inline void
arch_thread_set_current_thread(struct thread *t) arch_thread_set_current_thread(Thread *t)
{ {
uint64 v; uint64 v;
asm volatile("pmove %%srp,(%0)\n" \ asm volatile("pmove %%srp,(%0)\n" \
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2009, Haiku Inc. All rights reserved. * Copyright 2003-2011, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -22,17 +22,17 @@ void mipsel_pop_iframe(struct iframe_stack* stack);
struct iframe* mipsel_get_user_iframe(void); struct iframe* mipsel_get_user_iframe(void);
static inline struct thread* static inline Thread*
arch_thread_get_current_thread(void) arch_thread_get_current_thread(void)
{ {
#warning IMPLEMENT arch_thread_get_current_thread #warning IMPLEMENT arch_thread_get_current_thread
struct thread* t; Thread* t;
return t; return t;
} }
static inline void static inline void
arch_thread_set_current_thread(struct thread* t) arch_thread_set_current_thread(Thread* t)
{ {
#warning IMPLEMENT arch_thread_set_current_thread #warning IMPLEMENT arch_thread_set_current_thread
} }
+1 -1
View File
@@ -206,7 +206,7 @@ enum ppc_processor_version {
SPRG0: per CPU physical address pointer to an ppc_cpu_exception_context SPRG0: per CPU physical address pointer to an ppc_cpu_exception_context
structure structure
SPRG1: scratch SPRG1: scratch
SPRG2: current struct thread* SPRG2: current Thread*
SPRG3: TLS base pointer (only for userland threads) SPRG3: TLS base pointer (only for userland threads)
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2006, Haiku Inc. All rights reserved. * Copyright 2003-2011, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -20,17 +20,17 @@ void ppc_pop_iframe(struct iframe_stack *stack);
struct iframe *ppc_get_user_iframe(void); struct iframe *ppc_get_user_iframe(void);
static inline struct thread * static inline Thread *
arch_thread_get_current_thread(void) arch_thread_get_current_thread(void)
{ {
struct thread *t; Thread *t;
asm volatile("mfsprg2 %0" : "=r"(t)); asm volatile("mfsprg2 %0" : "=r"(t));
return t; return t;
} }
static inline void static inline void
arch_thread_set_current_thread(struct thread *t) arch_thread_set_current_thread(Thread *t)
{ {
asm volatile("mtsprg2 %0" : : "r"(t)); asm volatile("mtsprg2 %0" : : "r"(t));
} }
+8 -8
View File
@@ -17,18 +17,18 @@ extern "C" {
#endif #endif
status_t arch_thread_init(struct kernel_args *args); status_t arch_thread_init(struct kernel_args *args);
status_t arch_team_init_team_struct(struct team *t, bool kernel); status_t arch_team_init_team_struct(Team *t, bool kernel);
status_t arch_thread_init_thread_struct(struct thread *t); status_t arch_thread_init_thread_struct(Thread *t);
status_t arch_thread_init_tls(struct thread *thread); status_t arch_thread_init_tls(Thread *thread);
void arch_thread_context_switch(struct thread *t_from, struct thread *t_to); void arch_thread_context_switch(Thread *t_from, Thread *t_to);
status_t arch_thread_init_kthread_stack(struct thread *t, status_t arch_thread_init_kthread_stack(Thread *t,
int (*start_func)(void), void (*entry_func)(void), void (*exit_func)(void)); int (*start_func)(void), void (*entry_func)(void), void (*exit_func)(void));
void arch_thread_dump_info(void *info); void arch_thread_dump_info(void *info);
status_t arch_thread_enter_userspace(struct thread *t, addr_t entry, status_t arch_thread_enter_userspace(Thread *t, addr_t entry,
void *args1, void *args2); void *args1, void *args2);
bool arch_on_signal_stack(struct thread *thread); bool arch_on_signal_stack(Thread *thread);
status_t arch_setup_signal_frame(struct thread *t, struct sigaction *sa, status_t arch_setup_signal_frame(Thread *t, struct sigaction *sa,
int signal, int signalMask); int signal, int signalMask);
int64 arch_restore_signal_frame(void); int64 arch_restore_signal_frame(void);
+3 -2
View File
@@ -1,10 +1,11 @@
/* /*
* Copyright 2005, Ingo Weinhold, [email protected]. * Copyright 2005-2011, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef KERNEL_ARCH_USER_DEBUGGER_H #ifndef KERNEL_ARCH_USER_DEBUGGER_H
#define KERNEL_ARCH_USER_DEBUGGER_H #define KERNEL_ARCH_USER_DEBUGGER_H
#include "kernel_debug_config.h" #include "kernel_debug_config.h"
#ifndef _ASSEMBLER #ifndef _ASSEMBLER
@@ -17,7 +18,7 @@ extern "C" {
struct arch_team_debug_info; struct arch_team_debug_info;
struct arch_thread_debug_info; struct arch_thread_debug_info;
struct thread;
void arch_clear_team_debug_info(struct arch_team_debug_info *info); void arch_clear_team_debug_info(struct arch_team_debug_info *info);
void arch_destroy_team_debug_info(struct arch_team_debug_info *info); void arch_destroy_team_debug_info(struct arch_team_debug_info *info);
@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2009, The Haiku Team. All rights reserved. * Copyright 2002-2011, The Haiku Team. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Copyright 2002, Travis Geiselbrecht. All rights reserved. * Copyright 2002, Travis Geiselbrecht. All rights reserved.
@@ -18,9 +18,9 @@ extern "C" {
struct iframe *i386_get_user_iframe(void); struct iframe *i386_get_user_iframe(void);
struct iframe *i386_get_current_iframe(void); struct iframe *i386_get_current_iframe(void);
struct iframe *i386_get_thread_user_iframe(struct thread *thread); struct iframe *i386_get_thread_user_iframe(Thread *thread);
uint32 x86_next_page_directory(struct thread *from, struct thread *to); uint32 x86_next_page_directory(Thread *from, Thread *to);
void x86_restart_syscall(struct iframe* frame); void x86_restart_syscall(struct iframe* frame);
@@ -33,16 +33,16 @@ void arch_syscall_64_bit_return_value(void);
static static
inline struct thread * inline Thread *
arch_thread_get_current_thread(void) arch_thread_get_current_thread(void)
{ {
struct thread *t; Thread *t;
read_dr3(t); read_dr3(t);
return t; return t;
} }
static inline void static inline void
arch_thread_set_current_thread(struct thread *t) arch_thread_set_current_thread(Thread *t)
{ {
write_dr3(t); write_dr3(t);
} }
@@ -1,14 +1,15 @@
/* /*
* Copyright 2005-2009, Ingo Weinhold, [email protected]. * Copyright 2005-2011, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _KERNEL_ARCH_X86_USER_DEBUGGER_H #ifndef _KERNEL_ARCH_X86_USER_DEBUGGER_H
#define _KERNEL_ARCH_X86_USER_DEBUGGER_H #define _KERNEL_ARCH_X86_USER_DEBUGGER_H
#define ARCH_INIT_USER_DEBUG x86_init_user_debug #define ARCH_INIT_USER_DEBUG x86_init_user_debug
// number of breakpoints the CPU supports // number of breakpoints the CPU supports
// Actually it supports 4, but DR3 is used to hold the struct thread*. // Actually it supports 4, but DR3 is used to hold the Thread*.
#define X86_BREAKPOINT_COUNT 3 #define X86_BREAKPOINT_COUNT 3
// debug status register DR6 // debug status register DR6
@@ -116,7 +117,6 @@ extern "C" {
#endif #endif
struct iframe; struct iframe;
struct thread;
extern void x86_init_user_debug_at_kernel_exit(struct iframe *frame); extern void x86_init_user_debug_at_kernel_exit(struct iframe *frame);
extern void x86_exit_user_debug_at_kernel_entry(); extern void x86_exit_user_debug_at_kernel_entry();
@@ -137,4 +137,5 @@ extern void x86_init_user_debug();
#define DEBUG_SOFTWARE_BREAKPOINT_SIZE 1 #define DEBUG_SOFTWARE_BREAKPOINT_SIZE 1
#define DEBUG_SHARED_BREAK_AND_WATCHPOINTS 1 #define DEBUG_SHARED_BREAK_AND_WATCHPOINTS 1
#endif // _KERNEL_ARCH_X86_USER_DEBUGGER_H #endif // _KERNEL_ARCH_X86_USER_DEBUGGER_H
+2 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2007-2008, Ingo Weinhold, [email protected].de. * Copyright 2007-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _KERNEL_CONDITION_VARIABLE_H #ifndef _KERNEL_CONDITION_VARIABLE_H
@@ -41,7 +41,7 @@ private:
private: private:
ConditionVariable* fVariable; ConditionVariable* fVariable;
struct thread* fThread; Thread* fThread;
status_t fWaitStatus; status_t fWaitStatus;
friend struct ConditionVariable; friend struct ConditionVariable;
+7 -2
View File
@@ -23,7 +23,12 @@
struct kernel_args; struct kernel_args;
struct thread;
namespace BKernel {
struct Thread;
}
using BKernel::Thread;
/* CPU local data structure */ /* CPU local data structure */
@@ -45,7 +50,7 @@ typedef struct cpu_ent {
addr_t fault_handler_stack_pointer; addr_t fault_handler_stack_pointer;
jmp_buf fault_jump_buffer; jmp_buf fault_jump_buffer;
struct thread* running_thread; Thread* running_thread;
bool invoke_scheduler; bool invoke_scheduler;
bool invoke_scheduler_if_idle; bool invoke_scheduler_if_idle;
bool disabled; bool disabled;
+20 -4
View File
@@ -17,6 +17,22 @@
#include "kernel_debug_config.h" #include "kernel_debug_config.h"
// We need the BKernel::Thread type below (opaquely) in the exported C
// functions below. Since this header is currently still included by plain C
// code, we define a dummy type BKernel_Thread in C mode and a equally named
// macro in C++ mode.
#ifdef __cplusplus
namespace BKernel {
struct Thread;
}
using BKernel::Thread;
# define BKernel_Thread Thread
#else
typedef struct BKernel_Thread BKernel_Thread;
#endif
/* KDEBUG /* KDEBUG
The kernel debug level. The kernel debug level.
Level 1 is usual asserts, > 1 should be used for very expensive runtime Level 1 is usual asserts, > 1 should be used for very expensive runtime
@@ -180,8 +196,8 @@ extern status_t debug_get_next_demangled_argument(uint32* _cookie,
const char* symbol, char* name, size_t nameSize, const char* symbol, char* name, size_t nameSize,
int32* _type, size_t* _argumentLength); int32* _type, size_t* _argumentLength);
extern struct thread* debug_set_debugged_thread(struct thread* thread); extern BKernel_Thread* debug_set_debugged_thread(BKernel_Thread* thread);
extern struct thread* debug_get_debugged_thread(); extern BKernel_Thread* debug_get_debugged_thread();
extern bool debug_is_debugged_team(team_id teamID); extern bool debug_is_debugged_team(team_id teamID);
extern struct arch_debug_registers* debug_get_debug_registers(int32 cpu); extern struct arch_debug_registers* debug_get_debug_registers(int32 cpu);
@@ -197,7 +213,7 @@ extern void _user_debug_output(const char *userString);
#ifdef __cplusplus #ifdef __cplusplus
struct DebuggedThreadSetter { struct DebuggedThreadSetter {
DebuggedThreadSetter(struct thread* thread) DebuggedThreadSetter(Thread* thread)
: :
fPreviousThread(debug_set_debugged_thread(thread)) fPreviousThread(debug_set_debugged_thread(thread))
{ {
@@ -209,7 +225,7 @@ struct DebuggedThreadSetter {
} }
private: private:
struct thread* fPreviousThread; Thread* fPreviousThread;
}; };
+3 -2
View File
@@ -20,7 +20,8 @@ struct kernel_args;
extern "C" { extern "C" {
#endif #endif
status_t elf_load_user_image(const char *path, struct team *team, int flags, addr_t *_entry); status_t elf_load_user_image(const char *path, Team *team, int flags,
addr_t *_entry);
// these two might get public one day: // these two might get public one day:
image_id load_kernel_add_on(const char *path); image_id load_kernel_add_on(const char *path);
@@ -29,7 +30,7 @@ status_t unload_kernel_add_on(image_id id);
status_t elf_debug_lookup_symbol_address(addr_t address, addr_t *_baseAddress, status_t elf_debug_lookup_symbol_address(addr_t address, addr_t *_baseAddress,
const char **_symbolName, const char **_imageName, const char **_symbolName, const char **_imageName,
bool *_exactMatch); bool *_exactMatch);
status_t elf_debug_lookup_user_symbol_address(struct team* team, addr_t address, status_t elf_debug_lookup_user_symbol_address(Team* team, addr_t address,
addr_t *_baseAddress, const char **_symbolName, addr_t *_baseAddress, const char **_symbolName,
const char **_imageName, bool *_exactMatch); const char **_imageName, bool *_exactMatch);
addr_t elf_debug_lookup_symbol(const char* searchName); addr_t elf_debug_lookup_symbol(const char* searchName);
+12 -6
View File
@@ -9,7 +9,13 @@
struct image; struct image;
struct team;
namespace BKernel {
struct Team;
}
using BKernel::Team;
#ifdef __cplusplus #ifdef __cplusplus
@@ -35,16 +41,16 @@ struct image {
extern "C" { extern "C" {
#endif #endif
extern image_id register_image(struct team *team, image_info *info, size_t size); extern image_id register_image(Team *team, image_info *info, size_t size);
extern status_t unregister_image(struct team *team, image_id id); extern status_t unregister_image(Team *team, image_id id);
extern int32 count_images(struct team *team); extern int32 count_images(Team *team);
extern status_t remove_images(struct team *team); extern status_t remove_images(Team *team);
typedef bool (*image_iterator_callback)(struct image* image, void* cookie); typedef bool (*image_iterator_callback)(struct image* image, void* cookie);
struct image* image_iterate_through_images(image_iterator_callback callback, struct image* image_iterate_through_images(image_iterator_callback callback,
void* cookie); void* cookie);
extern status_t image_debug_lookup_user_symbol_address(struct team *team, extern status_t image_debug_lookup_user_symbol_address(Team *team,
addr_t address, addr_t *_baseAddress, const char **_symbolName, addr_t address, addr_t *_baseAddress, const char **_symbolName,
const char **_imageName, bool *_exactMatch); const char **_imageName, bool *_exactMatch);
extern status_t image_init(void); extern status_t image_init(void);
+7 -8
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2008-2010, Ingo Weinhold, [email protected]. * Copyright 2008-2011, Ingo Weinhold, [email protected].
* Copyright 2005-2010, Axel Dörfler, [email protected]. * Copyright 2005-2010, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -14,25 +14,24 @@
struct scheduling_analysis; struct scheduling_analysis;
struct thread;
struct SchedulerListener; struct SchedulerListener;
struct scheduler_ops { struct scheduler_ops {
void (*enqueue_in_run_queue)(struct thread* thread); void (*enqueue_in_run_queue)(Thread* thread);
void (*reschedule)(void); void (*reschedule)(void);
void (*set_thread_priority)(struct thread* thread, int32 priority); void (*set_thread_priority)(Thread* thread, int32 priority);
bigtime_t (*estimate_max_scheduling_latency)(struct thread* thread); bigtime_t (*estimate_max_scheduling_latency)(Thread* thread);
void (*on_thread_create)(struct thread* thread); void (*on_thread_create)(Thread* thread);
// called when the thread structure is first created - // called when the thread structure is first created -
// initialization of per-thread housekeeping data structures should // initialization of per-thread housekeeping data structures should
// be done here // be done here
void (*on_thread_init)(struct thread* thread); void (*on_thread_init)(Thread* thread);
// called when a thread structure is initialized and made ready for // called when a thread structure is initialized and made ready for
// use - should be used to reset the housekeeping data structures // use - should be used to reset the housekeeping data structures
// if needed // if needed
void (*on_thread_destroy)(struct thread* thread); void (*on_thread_destroy)(Thread* thread);
// called when a thread structure is freed - freeing up any allocated // called when a thread structure is freed - freeing up any allocated
// mem on the scheduler's part should be done here // mem on the scheduler's part should be done here
+8 -1
View File
@@ -10,6 +10,13 @@
#include <signal.h> #include <signal.h>
namespace BKernel {
struct Thread;
}
using BKernel::Thread;
#define KILL_SIGNALS ((1L << (SIGKILL - 1)) | (1L << (SIGKILLTHR - 1))) #define KILL_SIGNALS ((1L << (SIGKILL - 1)) | (1L << (SIGKILLTHR - 1)))
#define SIGNAL_TO_MASK(signal) (1LL << (signal - 1)) #define SIGNAL_TO_MASK(signal) (1LL << (signal - 1))
@@ -24,7 +31,7 @@
extern "C" { extern "C" {
#endif #endif
extern bool handle_signals(struct thread *thread); extern bool handle_signals(Thread *thread);
extern bool is_kill_signal_pending(void); extern bool is_kill_signal_pending(void);
extern int has_signals_pending(void *_thread); extern int has_signals_pending(void *_thread);
extern bool is_signal_blocked(int signal); extern bool is_signal_blocked(int signal);
+6 -6
View File
@@ -1,10 +1,11 @@
/* /*
* Copyright 2009, Ingo Weinhold, [email protected]. * Copyright 2009-2011, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef KERNEL_LISTENERS_H #ifndef KERNEL_LISTENERS_H
#define KERNEL_LISTENERS_H #define KERNEL_LISTENERS_H
#include <KernelExport.h> #include <KernelExport.h>
#include <util/AutoLock.h> #include <util/AutoLock.h>
@@ -14,7 +15,6 @@
struct ConditionVariable; struct ConditionVariable;
struct mutex; struct mutex;
struct rw_lock; struct rw_lock;
struct thread;
// scheduler listeners // scheduler listeners
@@ -24,11 +24,11 @@ struct SchedulerListener : DoublyLinkedListLinkImpl<SchedulerListener> {
virtual ~SchedulerListener(); virtual ~SchedulerListener();
virtual void ThreadEnqueuedInRunQueue( virtual void ThreadEnqueuedInRunQueue(
struct thread* thread) = 0; Thread* thread) = 0;
virtual void ThreadRemovedFromRunQueue( virtual void ThreadRemovedFromRunQueue(
struct thread* thread) = 0; Thread* thread) = 0;
virtual void ThreadScheduled(struct thread* oldThread, virtual void ThreadScheduled(Thread* oldThread,
struct thread* newThread) = 0; Thread* newThread) = 0;
}; };
+1 -1
View File
@@ -32,7 +32,7 @@ extern "C" {
#endif #endif
status_t port_init(struct kernel_args *args); status_t port_init(struct kernel_args *args);
void delete_owned_ports(struct team* team); void delete_owned_ports(Team* team);
int32 port_max_ports(void); int32 port_max_ports(void);
int32 port_used_ports(void); int32 port_used_ports(void);
+8 -1
View File
@@ -14,10 +14,17 @@
#include <posix/xsi_semaphore_defs.h> #include <posix/xsi_semaphore_defs.h>
namespace BKernel {
struct Team;
}
using BKernel::Team;
__BEGIN_DECLS __BEGIN_DECLS
extern void xsi_sem_init(); extern void xsi_sem_init();
extern void xsi_sem_undo(struct team *team); extern void xsi_sem_undo(Team *team);
/* user calls */ /* user calls */
int _user_xsi_semget(key_t key, int numberOfSemaphores, int flags); int _user_xsi_semget(key_t key, int numberOfSemaphores, int flags);
+1 -1
View File
@@ -22,7 +22,7 @@ extern "C" {
#endif #endif
extern status_t haiku_sem_init(struct kernel_args *args); extern status_t haiku_sem_init(struct kernel_args *args);
extern void sem_delete_owned_sems(struct team* team); extern void sem_delete_owned_sems(Team* team);
extern int32 sem_used_sems(void); extern int32 sem_used_sems(void);
extern int32 sem_max_sems(void); extern int32 sem_max_sems(void);
+9 -8
View File
@@ -1,10 +1,11 @@
/* /*
* Copyright 2008, Haiku Inc. All rights reserved. * Copyright 2008-2011, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _KERNEL_SYSCALL_RESTART_H #ifndef _KERNEL_SYSCALL_RESTART_H
#define _KERNEL_SYSCALL_RESTART_H #define _KERNEL_SYSCALL_RESTART_H
#include <OS.h> #include <OS.h>
#include <thread.h> #include <thread.h>
@@ -20,7 +21,7 @@ syscall_restart_handle_timeout_pre(bigtime_t& timeout)
{ {
// If restarted, get the timeout from the restart parameters. Otherwise // If restarted, get the timeout from the restart parameters. Otherwise
// convert relative timeout to an absolute one. // convert relative timeout to an absolute one.
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
if ((thread->flags & THREAD_FLAGS_SYSCALL_RESTARTED) != 0) if ((thread->flags & THREAD_FLAGS_SYSCALL_RESTARTED) != 0)
timeout = *(bigtime_t*)thread->syscall_restart.parameters; timeout = *(bigtime_t*)thread->syscall_restart.parameters;
else if (timeout >= 0) { else if (timeout >= 0) {
@@ -44,7 +45,7 @@ syscall_restart_handle_timeout_pre(uint32& flags, bigtime_t& timeout)
// convert relative timeout to an absolute one. Note that we preserve // convert relative timeout to an absolute one. Note that we preserve
// relative 0 us timeouts, so that the syscall can still decide whether to // relative 0 us timeouts, so that the syscall can still decide whether to
// return B_WOULD_BLOCK instead of B_TIMED_OUT. // return B_WOULD_BLOCK instead of B_TIMED_OUT.
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
if ((thread->flags & THREAD_FLAGS_SYSCALL_RESTARTED) != 0) { if ((thread->flags & THREAD_FLAGS_SYSCALL_RESTARTED) != 0) {
timeout = *(bigtime_t*)thread->syscall_restart.parameters; timeout = *(bigtime_t*)thread->syscall_restart.parameters;
if (timeout > 0 && (flags & B_RELATIVE_TIMEOUT) != 0) if (timeout > 0 && (flags & B_RELATIVE_TIMEOUT) != 0)
@@ -67,7 +68,7 @@ syscall_restart_handle_timeout_post(status_t error, bigtime_t timeout)
{ {
if (error == B_INTERRUPTED) { if (error == B_INTERRUPTED) {
// interrupted -- store timeout and set flag for syscall restart // interrupted -- store timeout and set flag for syscall restart
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
*(bigtime_t*)thread->syscall_restart.parameters = timeout; *(bigtime_t*)thread->syscall_restart.parameters = timeout;
atomic_or(&thread->flags, THREAD_FLAGS_RESTART_SYSCALL); atomic_or(&thread->flags, THREAD_FLAGS_RESTART_SYSCALL);
} }
@@ -81,7 +82,7 @@ syscall_restart_handle_post(status_t error)
{ {
if (error == B_INTERRUPTED) { if (error == B_INTERRUPTED) {
// interrupted -- set flag for syscall restart // interrupted -- set flag for syscall restart
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
atomic_or(&thread->flags, THREAD_FLAGS_RESTART_SYSCALL); atomic_or(&thread->flags, THREAD_FLAGS_RESTART_SYSCALL);
} }
@@ -92,7 +93,7 @@ syscall_restart_handle_post(status_t error)
static inline bool static inline bool
syscall_restart_is_restarted() syscall_restart_is_restarted()
{ {
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
return (thread->flags & THREAD_FLAGS_SYSCALL) != 0 return (thread->flags & THREAD_FLAGS_SYSCALL) != 0
&& (thread->flags & THREAD_FLAGS_SYSCALL_RESTARTED) != 0; && (thread->flags & THREAD_FLAGS_SYSCALL_RESTARTED) != 0;
@@ -114,7 +115,7 @@ struct SyscallFlagUnsetter {
} }
private: private:
struct thread* fThread; Thread* fThread;
bool fWasSyscall; bool fWasSyscall;
}; };
@@ -148,7 +149,7 @@ struct SyscallRestartWrapper {
private: private:
Type fResult; Type fResult;
struct thread* fThread; Thread* fThread;
}; };
+12 -12
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2004-2009, Haiku Inc. All Rights Reserved. * Copyright 2004-2011, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _TEAM_H #ifndef _TEAM_H
@@ -22,34 +22,34 @@ extern "C" {
status_t team_init(struct kernel_args *args); status_t team_init(struct kernel_args *args);
status_t wait_for_team(team_id id, status_t *returnCode); status_t wait_for_team(team_id id, status_t *returnCode);
void team_remove_team(struct team *team); void team_remove_team(Team *team);
port_id team_shutdown_team(struct team *team, cpu_status& state); port_id team_shutdown_team(Team *team, cpu_status& state);
void team_delete_team(struct team *team, port_id debuggerPort); void team_delete_team(Team *team, port_id debuggerPort);
struct process_group *team_get_process_group_locked( struct process_group *team_get_process_group_locked(
struct process_session *session, pid_t id); struct process_session *session, pid_t id);
void team_delete_process_group(struct process_group *group); void team_delete_process_group(struct process_group *group);
struct team *team_get_kernel_team(void); Team *team_get_kernel_team(void);
team_id team_get_kernel_team_id(void); team_id team_get_kernel_team_id(void);
team_id team_get_current_team_id(void); team_id team_get_current_team_id(void);
status_t team_get_address_space(team_id id, status_t team_get_address_space(team_id id,
struct VMAddressSpace **_addressSpace); struct VMAddressSpace **_addressSpace);
char **user_team_get_arguments(void); char **user_team_get_arguments(void);
int user_team_get_arg_count(void); int user_team_get_arg_count(void);
struct job_control_entry* team_get_death_entry(struct team *team, struct job_control_entry* team_get_death_entry(Team *team,
thread_id child, bool* _deleteEntry); thread_id child, bool* _deleteEntry);
bool team_is_valid(team_id id); bool team_is_valid(team_id id);
struct team *team_get_team_struct_locked(team_id id); Team *team_get_team_struct_locked(team_id id);
int32 team_max_teams(void); int32 team_max_teams(void);
int32 team_used_teams(void); int32 team_used_teams(void);
typedef bool (*team_iterator_callback)(struct team* team, void* cookie); typedef bool (*team_iterator_callback)(Team* team, void* cookie);
struct team* team_iterate_through_teams(team_iterator_callback callback, Team* team_iterate_through_teams(team_iterator_callback callback,
void* cookie); void* cookie);
thread_id load_image_etc(int32 argCount, const char* const* args, thread_id load_image_etc(int32 argCount, const char* const* args,
const char* const* env, int32 priority, team_id parentID, uint32 flags); const char* const* env, int32 priority, team_id parentID, uint32 flags);
void team_set_job_control_state(struct team* team, job_control_state newState, void team_set_job_control_state(Team* team, job_control_state newState,
int signal, bool threadsLocked); int signal, bool threadsLocked);
void team_set_controlling_tty(int32 index); void team_set_controlling_tty(int32 index);
int32 team_get_controlling_tty(); int32 team_get_controlling_tty();
@@ -60,8 +60,8 @@ status_t start_watching_team(team_id team, void (*hook)(team_id, void *),
status_t stop_watching_team(team_id team, void (*hook)(team_id, void *), status_t stop_watching_team(team_id team, void (*hook)(team_id, void *),
void *data); void *data);
struct user_thread* team_allocate_user_thread(struct team* team); struct user_thread* team_allocate_user_thread(Team* team);
void team_free_user_thread(struct thread* thread); void team_free_user_thread(Thread* thread);
bool team_associate_data(AssociatedData* data); bool team_associate_data(AssociatedData* data);
bool team_dissociate_data(AssociatedData* data); bool team_dissociate_data(AssociatedData* data);
+20 -20
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2008-2009, Ingo Weinhold, [email protected]. * Copyright 2008-2011, Ingo Weinhold, [email protected].
* Copyright 2002-2007, Axel Dörfler, [email protected]. * Copyright 2002-2007, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
@@ -35,10 +35,10 @@ struct thread_creation_attributes;
extern "C" { extern "C" {
#endif #endif
void thread_enqueue(struct thread *t, struct thread_queue *q); void thread_enqueue(Thread *t, struct thread_queue *q);
struct thread *thread_lookat_queue(struct thread_queue *q); Thread *thread_lookat_queue(struct thread_queue *q);
struct thread *thread_dequeue(struct thread_queue *q); Thread *thread_dequeue(struct thread_queue *q);
struct thread *thread_dequeue_id(struct thread_queue *q, thread_id id); Thread *thread_dequeue_id(struct thread_queue *q, thread_id id);
void thread_at_kernel_entry(bigtime_t now); void thread_at_kernel_entry(bigtime_t now);
// called when the thread enters the kernel on behalf of the thread // called when the thread enters the kernel on behalf of the thread
@@ -54,32 +54,32 @@ void thread_exit(void);
int32 thread_max_threads(void); int32 thread_max_threads(void);
int32 thread_used_threads(void); int32 thread_used_threads(void);
const char* thread_state_to_text(struct thread* thread, int32 state); const char* thread_state_to_text(Thread* thread, int32 state);
int32 thread_get_io_priority(thread_id id); int32 thread_get_io_priority(thread_id id);
void thread_set_io_priority(int32 priority); void thread_set_io_priority(int32 priority);
#define thread_get_current_thread arch_thread_get_current_thread #define thread_get_current_thread arch_thread_get_current_thread
struct thread *thread_get_thread_struct(thread_id id); Thread *thread_get_thread_struct(thread_id id);
struct thread *thread_get_thread_struct_locked(thread_id id); Thread *thread_get_thread_struct_locked(thread_id id);
static thread_id thread_get_current_thread_id(void); static thread_id thread_get_current_thread_id(void);
static inline thread_id static inline thread_id
thread_get_current_thread_id(void) thread_get_current_thread_id(void)
{ {
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
return thread ? thread->id : 0; return thread ? thread->id : 0;
} }
static inline bool static inline bool
thread_is_idle_thread(struct thread *thread) thread_is_idle_thread(Thread *thread)
{ {
return thread->entry == NULL; return thread->entry == NULL;
} }
typedef bool (*thread_iterator_callback)(struct thread* thread, void* cookie); typedef bool (*thread_iterator_callback)(Thread* thread, void* cookie);
struct thread* thread_iterate_through_threads(thread_iterator_callback callback, Thread* thread_iterate_through_threads(thread_iterator_callback callback,
void* cookie); void* cookie);
thread_id allocate_thread_id(void); thread_id allocate_thread_id(void);
@@ -140,7 +140,7 @@ int _user_setrlimit(int resource, const struct rlimit * rlp);
Thread lock can be, but doesn't need to be held. Thread lock can be, but doesn't need to be held.
*/ */
static inline bool static inline bool
thread_is_interrupted(struct thread* thread, uint32 flags) thread_is_interrupted(Thread* thread, uint32 flags)
{ {
return ((flags & B_CAN_INTERRUPT) return ((flags & B_CAN_INTERRUPT)
&& (thread->sig_pending & ~thread->sig_block_mask) != 0) && (thread->sig_pending & ~thread->sig_block_mask) != 0)
@@ -150,7 +150,7 @@ thread_is_interrupted(struct thread* thread, uint32 flags)
static inline bool static inline bool
thread_is_blocked(struct thread* thread) thread_is_blocked(Thread* thread)
{ {
return thread->wait.status == 1; return thread->wait.status == 1;
} }
@@ -161,7 +161,7 @@ thread_is_blocked(struct thread* thread)
Thread lock can be, but doesn't need to be locked. Thread lock can be, but doesn't need to be locked.
*/ */
static inline void static inline void
thread_prepare_to_block(struct thread* thread, uint32 flags, uint32 type, thread_prepare_to_block(Thread* thread, uint32 flags, uint32 type,
const void* object) const void* object)
{ {
thread->wait.flags = flags; thread->wait.flags = flags;
@@ -174,7 +174,7 @@ thread_prepare_to_block(struct thread* thread, uint32 flags, uint32 type,
static inline status_t static inline status_t
thread_block_locked(struct thread* thread) thread_block_locked(Thread* thread)
{ {
if (thread->wait.status == 1) { if (thread->wait.status == 1) {
// check for signals, if interruptable // check for signals, if interruptable
@@ -191,7 +191,7 @@ thread_block_locked(struct thread* thread)
static inline void static inline void
thread_unblock_locked(struct thread* thread, status_t status) thread_unblock_locked(Thread* thread, status_t status)
{ {
if (atomic_test_and_set(&thread->wait.status, status, 1) != 1) if (atomic_test_and_set(&thread->wait.status, status, 1) != 1)
return; return;
@@ -203,7 +203,7 @@ thread_unblock_locked(struct thread* thread, status_t status)
static inline status_t static inline status_t
thread_interrupt(struct thread* thread, bool kill) thread_interrupt(Thread* thread, bool kill)
{ {
if ((thread->wait.flags & B_CAN_INTERRUPT) != 0 if ((thread->wait.flags & B_CAN_INTERRUPT) != 0
|| (kill && (thread->wait.flags & B_KILL_CAN_INTERRUPT) != 0)) { || (kill && (thread->wait.flags & B_KILL_CAN_INTERRUPT) != 0)) {
@@ -216,14 +216,14 @@ thread_interrupt(struct thread* thread, bool kill)
static inline void static inline void
thread_pin_to_current_cpu(struct thread* thread) thread_pin_to_current_cpu(Thread* thread)
{ {
thread->pinned_to_cpu++; thread->pinned_to_cpu++;
} }
static inline void static inline void
thread_unpin_from_current_cpu(struct thread* thread) thread_unpin_from_current_cpu(Thread* thread)
{ {
thread->pinned_to_cpu--; thread->pinned_to_cpu--;
} }
+45 -29
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2004-2010, Haiku Inc. * Copyright 2004-2011, Haiku, Inc.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Thread definition and structures * Thread definition and structures
@@ -58,14 +58,22 @@ typedef enum job_control_state {
} job_control_state; } job_control_state;
struct cpu_ent;
struct image; // defined in image.c struct image; // defined in image.c
struct io_context; struct io_context;
struct realtime_sem_context; // defined in realtime_sem.cpp struct realtime_sem_context; // defined in realtime_sem.cpp
struct scheduler_thread_data; struct scheduler_thread_data;
struct select_info; struct select_info;
struct user_thread; // defined in libroot/user_thread.h struct user_thread; // defined in libroot/user_thread.h
struct VMAddressSpace;
struct xsi_sem_context; // defined in xsi_semaphore.cpp struct xsi_sem_context; // defined in xsi_semaphore.cpp
namespace BKernel {
struct Team;
struct Thread;
}
struct death_entry { struct death_entry {
struct list_link link; struct list_link link;
pid_t group_id; pid_t group_id;
@@ -88,12 +96,12 @@ struct process_group {
struct process_session *session; struct process_session *session;
pid_t id; pid_t id;
int32 refs; int32 refs;
struct team *teams; BKernel::Team *teams;
bool orphaned; bool orphaned;
}; };
struct team_loading_info { struct team_loading_info {
struct thread *thread; // the waiting thread Thread* thread; // the waiting thread
status_t result; // the result of the loading status_t result; // the result of the loading
bool done; // set when loading is done/aborted bool done; // set when loading is done/aborted
}; };
@@ -117,7 +125,7 @@ struct job_control_entry : DoublyLinkedListLinkImpl<job_control_entry> {
bool has_group_ref; bool has_group_ref;
// valid while state != JOB_CONTROL_STATE_DEAD // valid while state != JOB_CONTROL_STATE_DEAD
struct team* team; BKernel::Team* team;
// valid when state == JOB_CONTROL_STATE_DEAD // valid when state == JOB_CONTROL_STATE_DEAD
pid_t group_id; pid_t group_id;
@@ -199,12 +207,20 @@ private:
}; };
struct team : AssociatedDataOwner { typedef int32 (*thread_entry_func)(thread_func, void *);
struct team *next; // next in hash
struct team *siblings_next; typedef bool (*page_fault_callback)(addr_t address, addr_t faultAddress,
struct team *parent; bool isWrite);
struct team *children;
struct team *group_next;
namespace BKernel {
struct Team : AssociatedDataOwner {
Team *next; // next in hash
Team *siblings_next;
Team *parent;
Team *children;
Team *group_next;
team_id id; team_id id;
pid_t group_id; pid_t group_id;
pid_t session_id; pid_t session_id;
@@ -221,16 +237,14 @@ struct team : AssociatedDataOwner {
struct list dead_threads; struct list dead_threads;
int dead_threads_count; int dead_threads_count;
// TODO: Remove the no longer necessary level of indirection for the team_dead_children dead_children;
// following members. team_job_control_children stopped_children;
team_dead_children *dead_children; team_job_control_children continued_children;
team_job_control_children *stopped_children;
team_job_control_children *continued_children;
struct job_control_entry* job_control_entry; struct job_control_entry* job_control_entry;
struct VMAddressSpace *address_space; VMAddressSpace *address_space;
struct thread *main_thread; Thread *main_thread;
struct thread *thread_list; Thread *thread_list;
struct team_loading_info *loading_info; struct team_loading_info *loading_info;
struct list image_list; struct list image_list;
struct list watcher_list; struct list watcher_list;
@@ -259,18 +273,14 @@ struct team : AssociatedDataOwner {
int supplementary_group_count; int supplementary_group_count;
}; };
typedef int32 (*thread_entry_func)(thread_func, void *);
typedef bool (*page_fault_callback)(addr_t address, addr_t faultAddress, struct Thread {
bool isWrite);
struct thread {
int32 flags; // summary of events relevant in interrupt int32 flags; // summary of events relevant in interrupt
// handlers (signals pending, user debugging // handlers (signals pending, user debugging
// enabled, etc.) // enabled, etc.)
struct thread *all_next; Thread *all_next;
struct thread *team_next; Thread *team_next;
struct thread *queue_next; /* i.e. run queue, release queue, etc. */ Thread *queue_next; /* i.e. run queue, release queue, etc. */
timer alarm; timer alarm;
thread_id id; thread_id id;
char name[B_OS_NAME_LENGTH]; char name[B_OS_NAME_LENGTH];
@@ -332,7 +342,7 @@ struct thread {
thread_entry_func entry; thread_entry_func entry;
void *args1, *args2; void *args1, *args2;
struct team *team; BKernel::Team *team;
struct { struct {
sem_id sem; sem_id sem;
@@ -370,9 +380,15 @@ struct thread {
struct arch_thread arch_info; struct arch_thread arch_info;
}; };
} // namespace BKernel
using BKernel::Team;
using BKernel::Thread;
struct thread_queue { struct thread_queue {
struct thread *head; Thread* head;
struct thread *tail; Thread* tail;
}; };
+2 -2
View File
@@ -100,8 +100,8 @@ class AbstractTraceEntry : public TraceEntry {
virtual void AddDump(TraceOutput& out); virtual void AddDump(TraceOutput& out);
thread_id Thread() const { return fThread; } thread_id ThreadID() const { return fThread; }
thread_id Team() const { return fTeam; } thread_id TeamID() const { return fTeam; }
bigtime_t Time() const { return fTime; } bigtime_t Time() const { return fTime; }
protected: protected:
+11 -5
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2005-2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2005-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Userland debugger support. * Userland debugger support.
@@ -24,7 +24,13 @@
struct BreakpointManager; struct BreakpointManager;
struct ConditionVariable; struct ConditionVariable;
struct function_profile_info; struct function_profile_info;
struct thread;
namespace BKernel {
struct Thread;
}
using BKernel::Thread;
// Team related debugging data. // Team related debugging data.
// //
@@ -235,15 +241,15 @@ void user_debug_team_exec();
void user_debug_update_new_thread_flags(thread_id threadID); void user_debug_update_new_thread_flags(thread_id threadID);
void user_debug_thread_created(thread_id threadID); void user_debug_thread_created(thread_id threadID);
void user_debug_thread_deleted(team_id teamID, thread_id threadID); void user_debug_thread_deleted(team_id teamID, thread_id threadID);
void user_debug_thread_exiting(struct thread* thread); void user_debug_thread_exiting(Thread* thread);
void user_debug_image_created(const image_info *imageInfo); void user_debug_image_created(const image_info *imageInfo);
void user_debug_image_deleted(const image_info *imageInfo); void user_debug_image_deleted(const image_info *imageInfo);
void user_debug_breakpoint_hit(bool software); void user_debug_breakpoint_hit(bool software);
void user_debug_watchpoint_hit(); void user_debug_watchpoint_hit();
void user_debug_single_stepped(); void user_debug_single_stepped();
void user_debug_thread_unscheduled(struct thread* thread); void user_debug_thread_unscheduled(Thread* thread);
void user_debug_thread_scheduled(struct thread* thread); void user_debug_thread_scheduled(Thread* thread);
// syscalls // syscalls
+9 -6
View File
@@ -5,12 +5,17 @@
#ifndef _KERNEL_USERGROUP_H #ifndef _KERNEL_USERGROUP_H
#define _KERNEL_USERGROUP_H #define _KERNEL_USERGROUP_H
#include <unistd.h> #include <unistd.h>
#include <SupportDefs.h> #include <SupportDefs.h>
struct team; namespace BKernel {
struct Team;
}
using BKernel::Team;
#ifdef __cplusplus #ifdef __cplusplus
@@ -19,11 +24,9 @@ extern "C" {
// kernel private functions // kernel private functions
void inherit_parent_user_and_group(struct team* team, void inherit_parent_user_and_group(Team* team, Team* parent);
struct team* parent); void inherit_parent_user_and_group_locked(Team* team, Team* parent);
void inherit_parent_user_and_group_locked(struct team* team, status_t update_set_id_user_and_group(Team* team, const char* file);
struct team* parent);
status_t update_set_id_user_and_group(struct team* team, const char* file);
// syscalls // syscalls
+4 -4
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2008-2009, Axel Dörfler, axeld@pinc-software.de. * Copyright 2008-2009, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2005-2007, Ingo Weinhold, bonefish@users.sf.net. All rights reserved. * Copyright 2005-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* *
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -162,19 +162,19 @@ typedef AutoLocker<spinlock, InterruptsSpinLocking> InterruptsSpinLocker;
class ThreadCPUPinLocking { class ThreadCPUPinLocking {
public: public:
inline bool Lock(struct thread* thread) inline bool Lock(Thread* thread)
{ {
thread_pin_to_current_cpu(thread); thread_pin_to_current_cpu(thread);
return true; return true;
} }
inline void Unlock(struct thread* thread) inline void Unlock(Thread* thread)
{ {
thread_unpin_from_current_cpu(thread); thread_unpin_from_current_cpu(thread);
} }
}; };
typedef AutoLocker<struct thread, ThreadCPUPinLocking> ThreadCPUPinner; typedef AutoLocker<Thread, ThreadCPUPinLocking> ThreadCPUPinner;
} // namespace BPrivate } // namespace BPrivate
+5 -4
View File
@@ -401,7 +401,7 @@ protected:
return true; return true;
} }
void _Resize(ValueType** newTable, size_t newSize, void** oldTable = NULL) void _Resize(ValueType** newTable, size_t newSize, void** _oldTable = NULL)
{ {
for (size_t i = 0; i < newSize; i++) for (size_t i = 0; i < newSize; i++)
newTable[i] = NULL; newTable[i] = NULL;
@@ -416,11 +416,12 @@ protected:
} }
} }
if (oldTable != NULL) if (_oldTable != NULL)
*oldTable = fTable; *_oldTable = fTable;
else else
fAllocator.Free(fTable); fAllocator.Free(fTable);
} } else if (_oldTable != NULL)
*_oldTable = NULL;
fTableSize = newSize; fTableSize = newSize;
fTable = newTable; fTable = newTable;
-1
View File
@@ -19,7 +19,6 @@ struct generic_io_vec;
struct kernel_args; struct kernel_args;
struct ObjectCache; struct ObjectCache;
struct system_memory_info; struct system_memory_info;
struct team;
struct VMAddressSpace; struct VMAddressSpace;
struct VMArea; struct VMArea;
struct VMCache; struct VMCache;
@@ -120,10 +120,10 @@
#include "acgcc.h" #include "acgcc.h"
#include <SupportDefs.h> #include <KernelExport.h>
#include "lock.h" struct mutex;
/* Host-dependent types and defines for user- and kernel-space ACPICA */ /* Host-dependent types and defines for user- and kernel-space ACPICA */
@@ -132,7 +132,7 @@
#define ACPI_USE_STANDARD_HEADERS #define ACPI_USE_STANDARD_HEADERS
#define ACPI_MUTEX_TYPE ACPI_OSL_MUTEX #define ACPI_MUTEX_TYPE ACPI_OSL_MUTEX
#define ACPI_MUTEX mutex * #define ACPI_MUTEX struct mutex *
#define ACPI_USE_NATIVE_DIVIDE #define ACPI_USE_NATIVE_DIVIDE
@@ -1000,7 +1000,7 @@ ATAChannel::_TransferPIOPhysical(ATARequest *request, addr_t physicalAddress,
// we must split up chunk into B_PAGE_SIZE blocks as we can map only // we must split up chunk into B_PAGE_SIZE blocks as we can map only
// one page into address space at once // one page into address space at once
while (length > 0) { while (length > 0) {
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
thread_pin_to_current_cpu(thread); thread_pin_to_current_cpu(thread);
void *handle; void *handle;
@@ -3,17 +3,17 @@ SubDir HAIKU_TOP src add-ons kernel bus_managers firewire ;
UseHeaders [ FDirName $(HAIKU_TOP) headers compatibility bsd ] : true ; UseHeaders [ FDirName $(HAIKU_TOP) headers compatibility bsd ] : true ;
UsePrivateHeaders firewire kernel ; UsePrivateHeaders firewire kernel ;
SubDirCcFlags [ FDefines _KERNEL=1 ] ; DEFINES += _KERNEL=1 ;
KernelAddon firewire : KernelAddon firewire :
util.c util.c
timer.c timer.cpp
firewire_module.c firewire_module.cpp
firewire.c firewire.cpp
fwdma.c fwdma.cpp
fwmem.c fwmem.cpp
fwohci.c fwohci.cpp
fwohci_pci.c fwohci_pci.cpp
fwcrom.c fwcrom.c
; ;
@@ -76,15 +76,16 @@ static int32 fw_bus_probe_thread(void *);
static void fw_vmaccess (struct fw_xfer *); static void fw_vmaccess (struct fw_xfer *);
#endif #endif
static int fw_bmr (struct firewire_comm *); static int fw_bmr (struct firewire_comm *);
static void fw_dump_hdr(struct fw_pkt *, char *); static void fw_dump_hdr(struct fw_pkt *, const char *);
char *linkspeed[] = { extern const char *const linkspeed[];
const char *const linkspeed[] = {
"S100", "S200", "S400", "S800", "S100", "S200", "S400", "S800",
"S1600", "S3200", "undef", "undef" "S1600", "S3200", "undef", "undef"
}; };
static char *tcode_str[] = { static const char *const tcode_str[] = {
"WREQQ", "WREQB", "WRES", "undef", "WREQQ", "WREQB", "WRES", "undef",
"RREQQ", "RREQB", "RRESQ", "RRESB", "RREQQ", "RREQB", "RRESQ", "RRESB",
"CYCS", "LREQ", "STREAM", "LRES", "CYCS", "LREQ", "STREAM", "LRES",
@@ -428,7 +429,7 @@ int
firewire_attach(struct firewire_comm *fc, struct firewire_softc *sc) firewire_attach(struct firewire_comm *fc, struct firewire_softc *sc)
{ {
sc->fc = fc; sc->fc = fc;
fc->status = FWBUSNOTREADY; fc->status = (uint)FWBUSNOTREADY;
// unit = device_get_unit(dev); // unit = device_get_unit(dev);
if( fc->nisodma > FWMAXNDMA) fc->nisodma = FWMAXNDMA; if( fc->nisodma > FWMAXNDMA) fc->nisodma = FWMAXNDMA;
@@ -494,7 +495,7 @@ firewire_attach(struct firewire_comm *fc, struct firewire_softc *sc)
/* bus_reset */ /* bus_reset */
FW_GLOCK(fc); FW_GLOCK(fc);
fw_busreset(fc, FWBUSNOTREADY); fw_busreset(fc, (uint)FWBUSNOTREADY);
FW_GUNLOCK(fc); FW_GUNLOCK(fc);
fc->ibr(fc); fc->ibr(fc);
@@ -514,7 +515,7 @@ firewire_detach(struct firewire_softc *sc)
fc = sc->fc; fc = sc->fc;
mtx_lock(&fc->wait_lock); mtx_lock(&fc->wait_lock);
fc->status = FWBUSDETACH; fc->status = (uint)FWBUSDETACH;
// wakeup(fc); // wakeup(fc);
release_sem(fc->Sem); release_sem(fc->Sem);
/* if (msleep(fc->probe_thread, &fc->wait_lock, PWAIT, "fwthr", hz * 60)) /* if (msleep(fc->probe_thread, &fc->wait_lock, PWAIT, "fwthr", hz * 60))
@@ -628,9 +629,9 @@ fw_reset_csr(struct firewire_comm *fc)
CSRARC(fc, NODE_IDS) = 0x3f; CSRARC(fc, NODE_IDS) = 0x3f;
CSRARC(fc, TOPO_MAP + 8) = 0; CSRARC(fc, TOPO_MAP + 8) = 0;
fc->irm = -1; fc->irm = (uint)-1;
fc->max_node = -1; fc->max_node = (uint)-1;
for(i = 2; i < 0x100/4 - 2 ; i++){ for(i = 2; i < 0x100/4 - 2 ; i++){
CSRARC(fc, SPED_MAP + i * 4) = 0; CSRARC(fc, SPED_MAP + i * 4) = 0;
@@ -748,7 +749,7 @@ fw_busreset(struct firewire_comm *fc, uint32_t new_status)
fc->status = new_status; fc->status = new_status;
fw_reset_csr(fc); fw_reset_csr(fc);
if (fc->status == FWBUSNOTREADY) if ((int32)fc->status == FWBUSNOTREADY)
fw_init_crom(fc); fw_init_crom(fc);
fw_reset_crom(fc); fw_reset_crom(fc);
@@ -788,7 +789,7 @@ fw_busreset(struct firewire_comm *fc, uint32_t new_status)
* Configuration ROM. * Configuration ROM.
*/ */
#define FW_MAX_GENERATION 0xF #define FW_MAX_GENERATION 0xF
newrom = malloc(CROMSIZE); newrom = (uint32_t*)malloc(CROMSIZE);
memset(newrom, 0, CROMSIZE); memset(newrom, 0, CROMSIZE);
src = &fc->crom_src_buf->src; src = &fc->crom_src_buf->src;
crom_load(src, newrom, CROMSIZE); crom_load(src, newrom, CROMSIZE);
@@ -1018,7 +1019,7 @@ fw_xferlist_add(struct fw_xferlist *q, int slen, int rlen, int n,
if (xfer == NULL) if (xfer == NULL)
return (n); return (n);
xfer->fc = fc; xfer->fc = fc;
xfer->sc = sc; xfer->sc = (caddr_t)sc;
xfer->hand = hand; xfer->hand = hand;
s = splfw(); s = splfw();
STAILQ_INSERT_TAIL(q, xfer, link); STAILQ_INSERT_TAIL(q, xfer, link);
@@ -1042,7 +1043,7 @@ fw_xferlist_remove(struct fw_xferlist *q)
* dump packet header * dump packet header
*/ */
static void static void
fw_dump_hdr(struct fw_pkt *fp, char *prefix) fw_dump_hdr(struct fw_pkt *fp, const char *prefix)
{ {
printf("%s: dst=0x%02x tl=0x%02x rt=%d tcode=0x%x pri=0x%x " printf("%s: dst=0x%02x tl=0x%02x rt=%d tcode=0x%x pri=0x%x "
"src=0x%03x\n", prefix, "src=0x%03x\n", prefix,
@@ -1103,7 +1104,7 @@ fw_tl2xfer(struct firewire_comm *fc, int node, int tlabel, int tcode)
mtx_lock(&fc->tlabel_lock); mtx_lock(&fc->tlabel_lock);
STAILQ_FOREACH(xfer, &fc->tlabels[tlabel], tlabel) STAILQ_FOREACH(xfer, &fc->tlabels[tlabel], tlabel)
if(xfer->send.hdr.mode.hdr.dst == node) { if((uint)xfer->send.hdr.mode.hdr.dst == (uint)node) {
mtx_unlock(&fc->tlabel_lock); mtx_unlock(&fc->tlabel_lock);
splx(s); splx(s);
KASSERT(xfer->tl == tlabel, KASSERT(xfer->tl == tlabel,
@@ -1136,7 +1137,7 @@ fw_xfer_alloc()
{ {
struct fw_xfer *xfer; struct fw_xfer *xfer;
xfer = malloc(sizeof(struct fw_xfer)); xfer = (fw_xfer*)malloc(sizeof(struct fw_xfer));
if (xfer == NULL) if (xfer == NULL)
return xfer; return xfer;
memset(xfer, 0, sizeof(struct fw_xfer)); memset(xfer, 0, sizeof(struct fw_xfer));
@@ -1394,9 +1395,9 @@ void fw_sidrcv(struct firewire_comm* fc, uint32_t *sid, u_int len)
continue; continue;
} }
*self_id = *((union fw_self_id *)sid); *self_id = *((union fw_self_id *)sid);
fc->topology_map->crc_len++; (void)(fc->topology_map->crc_len++);
if(self_id->p0.sequel == 0){ if(self_id->p0.sequel == 0){
fc->topology_map->node_count ++; (void)(fc->topology_map->node_count++);
c_port = 0; c_port = 0;
if (firewire_debug) if (firewire_debug)
fw_print_sid(sid[0]); fw_print_sid(sid[0]);
@@ -1411,10 +1412,10 @@ void fw_sidrcv(struct firewire_comm* fc, uint32_t *sid, u_int len)
for (j = 0; j < node; j ++) { for (j = 0; j < node; j ++) {
fc->speed_map->speed[j][node] fc->speed_map->speed[j][node]
= fc->speed_map->speed[node][j] = fc->speed_map->speed[node][j]
= min(fc->speed_map->speed[j][j], = min_c(fc->speed_map->speed[j][j],
self_id->p0.phy_speed); self_id->p0.phy_speed);
} }
if ((fc->irm == -1 || self_id->p0.phy_id > fc->irm) && if ((fc->irm == (u_int)-1 || self_id->p0.phy_id > fc->irm) &&
(self_id->p0.link_active && self_id->p0.contender)) { (self_id->p0.link_active && self_id->p0.contender)) {
fc->irm = self_id->p0.phy_id; fc->irm = self_id->p0.phy_id;
} }
@@ -1433,7 +1434,7 @@ void fw_sidrcv(struct firewire_comm* fc, uint32_t *sid, u_int len)
} }
sid += 2; sid += 2;
self_id++; self_id++;
fc->topology_map->self_id_count ++; (void)(fc->topology_map->self_id_count++);
} }
/* CRC */ /* CRC */
fc->topology_map->crc = fw_crc16( fc->topology_map->crc = fw_crc16(
@@ -1455,11 +1456,11 @@ void fw_sidrcv(struct firewire_comm* fc, uint32_t *sid, u_int len)
fc->max_hop = fc->max_node - i_branch; fc->max_hop = fc->max_node - i_branch;
device_printf(fc->bdev, "%d nodes, maxhop <= %d %s irm(%d) %s\n", device_printf(fc->bdev, "%d nodes, maxhop <= %d %s irm(%d) %s\n",
fc->max_node + 1, fc->max_hop, fc->max_node + 1, fc->max_hop,
(fc->irm == -1) ? "Not IRM capable" : "cable IRM", (fc->irm == (u_int)-1) ? "Not IRM capable" : "cable IRM",
fc->irm, fc->irm,
(fc->irm == fc->nodeid) ? " (me) " : ""); (fc->irm == fc->nodeid) ? " (me) " : "");
if (try_bmr && (fc->irm != -1) && (CSRARC(fc, BUS_MGR_ID) == 0x3f)) { if (try_bmr && (fc->irm != (u_int)-1) && (CSRARC(fc, BUS_MGR_ID) == 0x3f)) {
if (fc->irm == fc->nodeid) { if (fc->irm == fc->nodeid) {
fc->status = FWBUSMGRDONE; fc->status = FWBUSMGRDONE;
CSRARC(fc, BUS_MGR_ID) = fc->set_bmr(fc, fc->irm); CSRARC(fc, BUS_MGR_ID) = fc->set_bmr(fc, fc->irm);
@@ -1528,7 +1529,7 @@ fw_explore_read_quads(struct fw_device *fwdev, int offset,
int i, error; int i, error;
for (i = 0; i < length; i ++, offset += sizeof(uint32_t)) { for (i = 0; i < length; i ++, offset += sizeof(uint32_t)) {
xfer = fwmem_read_quad(fwdev, NULL, -1, xfer = fwmem_read_quad(fwdev, NULL, (uint8_t)-1,
0xffff, 0xf0000000 | offset, (void *)&tmp, 0xffff, 0xf0000000 | offset, (void *)&tmp,
fw_xferwake); fw_xferwake);
if (xfer == NULL) if (xfer == NULL)
@@ -1576,7 +1577,7 @@ fw_explore_csrblock(struct fw_device *fwdev, int offset, int recur)
if (recur == 0) if (recur == 0)
return (0); return (0);
for (i = 0; i < dir->crc_len; i ++, offset += sizeof(uint32_t)) { for (i = 0; (uint)i < dir->crc_len; i ++, offset += sizeof(uint32_t)) {
if ((reg[i].key & CSRTYPE_MASK) == CSRTYPE_D) if ((reg[i].key & CSRTYPE_MASK) == CSRTYPE_D)
recur = 1; recur = 1;
else if ((reg[i].key & CSRTYPE_MASK) == CSRTYPE_L) else if ((reg[i].key & CSRTYPE_MASK) == CSRTYPE_L)
@@ -1661,7 +1662,7 @@ fw_explore_node(struct fw_device *dfwdev)
break; break;
if (fwdev == NULL) { if (fwdev == NULL) {
/* new device */ /* new device */
fwdev = malloc(sizeof(struct fw_device)); fwdev = (fw_device*)malloc(sizeof(struct fw_device));
if (fwdev == NULL) { if (fwdev == NULL) {
device_printf(fc->bdev, "%s: node%d: no memory\n", device_printf(fc->bdev, "%s: node%d: no memory\n",
__func__, node); __func__, node);
@@ -1767,7 +1768,7 @@ fw_find_self_id(struct firewire_comm *fc, int node)
s = &fc->topology_map->self_id[i]; s = &fc->topology_map->self_id[i];
if (s->p0.sequel) if (s->p0.sequel)
continue; continue;
if (s->p0.phy_id == node) if ((int)s->p0.phy_id == node)
return s; return s;
} }
return 0; return 0;
@@ -1788,7 +1789,7 @@ fw_explore(struct firewire_comm *fc)
dfwdev.maxrec = 8; /* 512 */ dfwdev.maxrec = 8; /* 512 */
dfwdev.status = FWDEVINIT; dfwdev.status = FWDEVINIT;
for (node = 0; node <= fc->max_node; node ++) { for (node = 0; (uint)node <= fc->max_node; node ++) {
/* We don't probe myself and linkdown nodes */ /* We don't probe myself and linkdown nodes */
if (node == fc->nodeid) { if (node == fc->nodeid) {
if (firewire_debug) if (firewire_debug)
@@ -1839,7 +1840,7 @@ fw_bus_probe_thread(void *arg)
fc = (struct firewire_comm *)arg; fc = (struct firewire_comm *)arg;
mtx_lock(&fc->wait_lock); mtx_lock(&fc->wait_lock);
while (fc->status != FWBUSDETACH) { while (fc->status != (uint32_t)FWBUSDETACH) {
if (fc->status == FWBUSEXPLORE) { if (fc->status == FWBUSEXPLORE) {
mtx_unlock(&fc->wait_lock); mtx_unlock(&fc->wait_lock);
fw_explore(fc); fw_explore(fc);
@@ -2154,7 +2155,7 @@ fw_rcv(struct fw_rcv_buf *rb)
return; return;
} }
len = 0; len = 0;
for (i = 0; i < rb->nvec; i ++) for (i = 0; (uint)i < rb->nvec; i ++)
len += rb->vec[i].iov_len; len += rb->vec[i].iov_len;
rb->xfer = STAILQ_FIRST(&bind->xferlist); rb->xfer = STAILQ_FIRST(&bind->xferlist);
if (rb->xfer == NULL) { if (rb->xfer == NULL) {
@@ -38,7 +38,7 @@ dpc_module_info *gDpc;
struct supported_device{ struct supported_device{
uint16 vendor_id; uint16 vendor_id;
uint32 device_id; uint32 device_id;
char *name; const char *name;
}; };
struct supported_device supported_devices[] = { struct supported_device supported_devices[] = {
@@ -147,7 +147,7 @@ fw_module_init(void)
fwohci_softc_t *fwohci_sc; fwohci_softc_t *fwohci_sc;
struct firewire_softc *fw_sc; struct firewire_softc *fw_sc;
info = malloc(sizeof(pci_info)); info = (pci_info*)malloc(sizeof(pci_info));
if (!info) if (!info)
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -175,7 +175,7 @@ fw_module_init(void)
dprintf( "vendor=%x, device=%x, revision = %x\n", info->vendor_id, info->device_id, info->revision); dprintf( "vendor=%x, device=%x, revision = %x\n", info->vendor_id, info->device_id, info->revision);
pciInfo[found] = info; pciInfo[found] = info;
fwohci_sc = malloc(sizeof(fwohci_softc_t)); fwohci_sc = (fwohci_softc_t*)malloc(sizeof(fwohci_softc_t));
if (!fwohci_sc) { if (!fwohci_sc) {
free(info); free(info);
goto err_outofmem; goto err_outofmem;
@@ -183,7 +183,7 @@ fw_module_init(void)
memset(fwohci_sc, 0, sizeof(fwohci_softc_t)); memset(fwohci_sc, 0, sizeof(fwohci_softc_t));
gFwohci_softc[found] = fwohci_sc; gFwohci_softc[found] = fwohci_sc;
fw_sc = malloc(sizeof(struct firewire_softc)); fw_sc = (firewire_softc*)malloc(sizeof(struct firewire_softc));
if (!fw_sc) { if (!fw_sc) {
free(info); free(info);
free(fwohci_sc); free(fwohci_sc);
@@ -194,7 +194,7 @@ fw_module_init(void)
gFirewire_softc[found+1] = NULL; gFirewire_softc[found+1] = NULL;
found++; found++;
info = malloc(sizeof(pci_info)); info = (pci_info*)malloc(sizeof(pci_info));
if (!info) if (!info)
goto err_outofmem; goto err_outofmem;
@@ -68,8 +68,8 @@ fwmem_xfer_req(
if (spd < 0) if (spd < 0)
xfer->send.spd = fwdev->speed; xfer->send.spd = fwdev->speed;
else else
xfer->send.spd = min(spd, fwdev->speed); xfer->send.spd = min_c(spd, fwdev->speed);
xfer->hand = hand; xfer->hand = (void (*)(fw_xfer*))hand;
xfer->sc = sc; xfer->sc = sc;
xfer->send.pay_len = slen; xfer->send.pay_len = slen;
xfer->recv.pay_len = rlen; xfer->recv.pay_len = rlen;
@@ -90,7 +90,7 @@ fwmem_read_quad(
struct fw_xfer *xfer; struct fw_xfer *xfer;
struct fw_pkt *fp; struct fw_pkt *fp;
xfer = fwmem_xfer_req(fwdev, (void *)sc, spd, 0, 4, hand); xfer = fwmem_xfer_req(fwdev, (char *)sc, spd, 0, 4, (void*)hand);
if (xfer == NULL) { if (xfer == NULL) {
return NULL; return NULL;
} }
@@ -127,7 +127,7 @@ fwmem_write_quad(
struct fw_xfer *xfer; struct fw_xfer *xfer;
struct fw_pkt *fp; struct fw_pkt *fp;
xfer = fwmem_xfer_req(fwdev, sc, spd, 0, 0, hand); xfer = fwmem_xfer_req(fwdev, sc, spd, 0, 0, (void*)hand);
if (xfer == NULL) if (xfer == NULL)
return NULL; return NULL;
@@ -164,7 +164,7 @@ fwmem_read_block(
struct fw_xfer *xfer; struct fw_xfer *xfer;
struct fw_pkt *fp; struct fw_pkt *fp;
xfer = fwmem_xfer_req(fwdev, sc, spd, 0, roundup2(len, 4), hand); xfer = fwmem_xfer_req(fwdev, sc, spd, 0, roundup2(len, 4), (void*)hand);
if (xfer == NULL) if (xfer == NULL)
return NULL; return NULL;
@@ -176,7 +176,7 @@ fwmem_read_block(
fp->mode.rreqb.extcode = 0; fp->mode.rreqb.extcode = 0;
xfer->send.payload = NULL; xfer->send.payload = NULL;
xfer->recv.payload = data; xfer->recv.payload = (uint32_t*)data;
if (fwmem_debug) if (fwmem_debug)
printf("fwmem_read_block: %d %04x:%08x %d\n", fwdev->dst, printf("fwmem_read_block: %d %04x:%08x %d\n", fwdev->dst,
@@ -202,7 +202,7 @@ fwmem_write_block(
struct fw_xfer *xfer; struct fw_xfer *xfer;
struct fw_pkt *fp; struct fw_pkt *fp;
xfer = fwmem_xfer_req(fwdev, sc, spd, len, 0, hand); xfer = fwmem_xfer_req(fwdev, sc, spd, len, 0, (void*)hand);
if (xfer == NULL) if (xfer == NULL)
return NULL; return NULL;
@@ -213,7 +213,7 @@ fwmem_write_block(
fp->mode.wreqb.len = len; fp->mode.wreqb.len = len;
fp->mode.wreqb.extcode = 0; fp->mode.wreqb.extcode = 0;
xfer->send.payload = data; xfer->send.payload = (uint32_t*)data;
xfer->recv.payload = NULL; xfer->recv.payload = NULL;
if (fwmem_debug) if (fwmem_debug)
@@ -86,7 +86,7 @@ char fwohcicode[32][0x20]={
"Undef","ack data_err","ack type_err",""}; "Undef","ack data_err","ack type_err",""};
#define MAX_SPEED 3 #define MAX_SPEED 3
extern char *linkspeed[]; extern const char *const linkspeed[];
uint32_t tagbit[4] = { 1 << 28, 1 << 29, 1 << 30, 1 << 31}; uint32_t tagbit[4] = { 1 << 28, 1 << 29, 1 << 30, 1 << 31};
static struct tcode_info tinfo[] = { static struct tcode_info tinfo[] = {
@@ -113,17 +113,17 @@ static struct tcode_info tinfo[] = {
#define OHCI_READ_SIGMASK 0xffff0000 #define OHCI_READ_SIGMASK 0xffff0000
static void fwohci_ibr (struct firewire_comm *); static void fwohci_ibr (struct firewire_comm *);
static void fwohci_db_init (struct fwohci_softc *, struct fwohci_dbch *); static void fwohci_db_init (struct fwohci_softc *, fwohci_softc::fwohci_dbch *);
static void fwohci_db_free (struct fwohci_dbch *); static void fwohci_db_free (fwohci_softc::fwohci_dbch *);
static void fwohci_arcv (struct fwohci_softc *, struct fwohci_dbch *, int); static void fwohci_arcv (struct fwohci_softc *, fwohci_softc::fwohci_dbch *, int);
static void fwohci_txd (struct fwohci_softc *, struct fwohci_dbch *); static void fwohci_txd (struct fwohci_softc *, fwohci_softc::fwohci_dbch *);
static void fwohci_start_atq (struct firewire_comm *); static void fwohci_start_atq (struct firewire_comm *);
static void fwohci_start_ats (struct firewire_comm *); static void fwohci_start_ats (struct firewire_comm *);
static void fwohci_start (struct fwohci_softc *, struct fwohci_dbch *); static void fwohci_start (struct fwohci_softc *, fwohci_softc::fwohci_dbch *);
static uint32_t fwphy_wrdata ( struct fwohci_softc *, uint32_t, uint32_t); static uint32_t fwphy_wrdata ( struct fwohci_softc *, uint32_t, uint32_t);
static uint32_t fwphy_rddata ( struct fwohci_softc *, uint32_t); static uint32_t fwphy_rddata ( struct fwohci_softc *, uint32_t);
static int fwohci_rx_enable (struct fwohci_softc *, struct fwohci_dbch *); static int fwohci_rx_enable (struct fwohci_softc *, fwohci_softc::fwohci_dbch *);
static int fwohci_tx_enable (struct fwohci_softc *, struct fwohci_dbch *); static int fwohci_tx_enable (struct fwohci_softc *, fwohci_softc::fwohci_dbch *);
static int fwohci_irx_enable (struct firewire_comm *, int); static int fwohci_irx_enable (struct firewire_comm *, int);
static int fwohci_irx_disable (struct firewire_comm *, int); static int fwohci_irx_disable (struct firewire_comm *, int);
#if BYTE_ORDER == BIG_ENDIAN #if BYTE_ORDER == BIG_ENDIAN
@@ -135,7 +135,7 @@ static void fwohci_timeout (void *);
static void fwohci_set_intr (struct firewire_comm *, int); static void fwohci_set_intr (struct firewire_comm *, int);
static inline void fwohci_set_rx_buf(struct fw_xferq *, struct fwohcidb_tr *, bus_addr_t dbuf[], int dsiz[]); static inline void fwohci_set_rx_buf(struct fw_xferq *, struct fwohcidb_tr *, bus_addr_t dbuf[], int dsiz[]);
static int fwohci_add_tx_buf (struct fwohci_dbch *, struct fwohcidb_tr *, int); static int fwohci_add_tx_buf (fwohci_softc::fwohci_dbch *, struct fwohcidb_tr *, int);
static void dump_db (struct fwohci_softc *, uint32_t); static void dump_db (struct fwohci_softc *, uint32_t);
static void print_db (struct fwohcidb_tr *, struct fwohcidb *, uint32_t , uint32_t); static void print_db (struct fwohcidb_tr *, struct fwohcidb *, uint32_t , uint32_t);
static void dump_dma (struct fwohci_softc *, uint32_t); static void dump_dma (struct fwohci_softc *, uint32_t);
@@ -523,7 +523,7 @@ fwohci_reset(struct fwohci_softc *sc)
linkspeed[speed], MAXREC(max_rec)); linkspeed[speed], MAXREC(max_rec));
/* XXX fix max_rec */ /* XXX fix max_rec */
sc->fc.maxrec = sc->fc.speed + 8; sc->fc.maxrec = sc->fc.speed + 8;
if (max_rec != sc->fc.maxrec) { if ((uint32_t)max_rec != sc->fc.maxrec) {
reg2 = (reg2 & 0xffff0fff) | (sc->fc.maxrec << 12); reg2 = (reg2 & 0xffff0fff) | (sc->fc.maxrec << 12);
device_printf(dev, "max_rec %d -> %d\n", device_printf(dev, "max_rec %d -> %d\n",
MAXREC(max_rec), MAXREC(sc->fc.maxrec)); MAXREC(max_rec), MAXREC(sc->fc.maxrec));
@@ -563,11 +563,11 @@ fwohci_reset(struct fwohci_softc *sc)
sc->atrq.bottom = sc->atrq.top; sc->atrq.bottom = sc->atrq.top;
sc->atrs.bottom = sc->atrs.top; sc->atrs.bottom = sc->atrs.top;
for( i = 0, db_tr = sc->atrq.top; i < sc->atrq.ndb ; for( i = 0, db_tr = sc->atrq.top; (uint)i < sc->atrq.ndb ;
i ++, db_tr = STAILQ_NEXT(db_tr, link)){ i ++, db_tr = STAILQ_NEXT(db_tr, link)){
db_tr->xfer = NULL; db_tr->xfer = NULL;
} }
for( i = 0, db_tr = sc->atrs.top; i < sc->atrs.ndb ; for( i = 0, db_tr = sc->atrs.top; (uint)i < sc->atrs.ndb ;
i ++, db_tr = STAILQ_NEXT(db_tr, link)){ i ++, db_tr = STAILQ_NEXT(db_tr, link)){
db_tr->xfer = NULL; db_tr->xfer = NULL;
} }
@@ -704,13 +704,14 @@ fwohci_init(struct fwohci_softc *sc)
sc->fc.crom_sid_Area = alloc_mem(&buf_virt, &buf_phy, CROMSIZE+OHCI_SIDSIZE+sizeof(uint32_t), 0, "fwohci config etc. buf"); sc->fc.crom_sid_Area = alloc_mem(&buf_virt, &buf_phy, CROMSIZE+OHCI_SIDSIZE+sizeof(uint32_t), 0, "fwohci config etc. buf");
if (sc->fc.crom_sid_Area < B_OK) if (sc->fc.crom_sid_Area < B_OK)
return B_NO_MEMORY; return B_NO_MEMORY;
sc->sid_buf = sc->sid_dma.v_addr = buf_virt; sc->sid_buf = (uint32_t*)(sc->sid_dma.v_addr = buf_virt);
sc->sid_dma.bus_addr = (bus_addr_t)buf_phy; sc->sid_dma.bus_addr = (bus_addr_t)buf_phy;
sc->fc.config_rom = sc->crom_dma.v_addr = buf_virt + OHCI_SIDSIZE; sc->fc.config_rom
sc->crom_dma.bus_addr = (bus_addr_t)(buf_phy + OHCI_SIDSIZE); = (uint32_t*)(sc->crom_dma.v_addr = (char*)buf_virt + OHCI_SIDSIZE);
sc->dummy_dma.v_addr = buf_virt + OHCI_SIDSIZE + CROMSIZE; sc->crom_dma.bus_addr = (bus_addr_t)buf_phy + OHCI_SIDSIZE;
sc->dummy_dma.bus_addr = (bus_addr_t)(buf_phy + sc->dummy_dma.v_addr = (char*)buf_virt + OHCI_SIDSIZE + CROMSIZE;
OHCI_SIDSIZE + CROMSIZE); sc->dummy_dma.bus_addr = (bus_addr_t)buf_phy +
OHCI_SIDSIZE + CROMSIZE;
fwohci_db_init(sc, &sc->arrq); fwohci_db_init(sc, &sc->arrq);
if ((sc->arrq.flags & FWOHCI_DBCH_INIT) == 0) if ((sc->arrq.flags & FWOHCI_DBCH_INIT) == 0)
@@ -832,7 +833,7 @@ fwohci_detach(struct fwohci_softc *sc)
} while (0) } while (0)
static void static void
fwohci_execute_db(void *arg, struct send_recv *info) fwohci_execute_db(void *arg, fw_xfer::send_recv *info)
{ {
struct fwohcidb_tr *db_tr; struct fwohcidb_tr *db_tr;
struct fwohcidb *db; struct fwohcidb *db;
@@ -869,7 +870,7 @@ fwohci_execute_db2(void *arg, bus_dma_segment_t *segs, int nseg,
}*/ }*/
static void static void
fwohci_start(struct fwohci_softc *sc, struct fwohci_dbch *dbch) fwohci_start(struct fwohci_softc *sc, fwohci_softc::fwohci_dbch *dbch)
{ {
int i, s; int i, s;
int tcode, hdr_len, pl_off; int tcode, hdr_len, pl_off;
@@ -1074,7 +1075,7 @@ fwohci_start_ats(struct firewire_comm *fc)
} }
void void
fwohci_txd(struct fwohci_softc *sc, struct fwohci_dbch *dbch) fwohci_txd(struct fwohci_softc *sc, fwohci_softc::fwohci_dbch *dbch)
{ {
int s, ch, err = 0; int s, ch, err = 0;
struct fwohcidb_tr *tr; struct fwohcidb_tr *tr;
@@ -1215,7 +1216,7 @@ out:
} }
static void static void
fwohci_db_free(struct fwohci_dbch *dbch) fwohci_db_free(fwohci_softc::fwohci_dbch *dbch)
{ {
struct fwohcidb_tr *db_tr; struct fwohcidb_tr *db_tr;
// int idb; // int idb;
@@ -1248,7 +1249,7 @@ fwohci_db_free(struct fwohci_dbch *dbch)
} }
static void static void
fwohci_db_init(struct fwohci_softc *sc, struct fwohci_dbch *dbch) fwohci_db_init(struct fwohci_softc *sc, fwohci_softc::fwohci_dbch *dbch)
{ {
int idb; int idb;
struct fwohcidb_tr *db_tr; struct fwohcidb_tr *db_tr;
@@ -1294,7 +1295,7 @@ fwohci_db_init(struct fwohci_softc *sc, struct fwohci_dbch *dbch)
return; return;
} }
/* Attach DB to DMA ch. */ /* Attach DB to DMA ch. */
for(idb = 0 ; idb < dbch->ndb ; idb++){ for(idb = 0 ; (uint)idb < dbch->ndb ; idb++){
db_tr->dbcnt = 0; db_tr->dbcnt = 0;
db_tr->db = (struct fwohcidb *)fwdma_v_addr(dbch->am, idb); db_tr->db = (struct fwohcidb *)fwdma_v_addr(dbch->am, idb);
db_tr->bus_addr = fwdma_bus_addr(dbch->am, idb); db_tr->bus_addr = fwdma_bus_addr(dbch->am, idb);
@@ -1373,7 +1374,7 @@ fwohci_irx_post (struct firewire_comm *fc , uint32_t *qld)
#endif #endif
static int static int
fwohci_tx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch) fwohci_tx_enable(struct fwohci_softc *sc, fwohci_softc::fwohci_dbch *dbch)
{ {
int err = 0; int err = 0;
int idb, z, i, dmach = 0, ldesc; int idb, z, i, dmach = 0, ldesc;
@@ -1399,11 +1400,11 @@ fwohci_tx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch)
if(dbch->xferq.flag & FWXFERQ_RUNNING) if(dbch->xferq.flag & FWXFERQ_RUNNING)
return err; return err;
dbch->xferq.flag |= FWXFERQ_RUNNING; dbch->xferq.flag |= FWXFERQ_RUNNING;
for( i = 0, dbch->bottom = dbch->top; i < (dbch->ndb - 1); i++){ for( i = 0, dbch->bottom = dbch->top; (uint)i < (dbch->ndb - 1); i++){
dbch->bottom = STAILQ_NEXT(dbch->bottom, link); dbch->bottom = STAILQ_NEXT(dbch->bottom, link);
} }
db_tr = dbch->top; db_tr = dbch->top;
for (idb = 0; idb < dbch->ndb; idb ++) { for (idb = 0; (uint)idb < dbch->ndb; idb ++) {
fwohci_add_tx_buf(dbch, db_tr, idb); fwohci_add_tx_buf(dbch, db_tr, idb);
if(STAILQ_NEXT(db_tr, link) == NULL){ if(STAILQ_NEXT(db_tr, link) == NULL){
break; break;
@@ -1432,7 +1433,7 @@ fwohci_tx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch)
} }
static int static int
fwohci_rx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch) fwohci_rx_enable(struct fwohci_softc *sc, fwohci_softc::fwohci_dbch *dbch)
{ {
int err = 0; int err = 0;
int idb, z, i, dmach = 0, ldesc; int idb, z, i, dmach = 0, ldesc;
@@ -1472,7 +1473,7 @@ fwohci_rx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch)
} }
dbch->xferq.flag |= FWXFERQ_RUNNING; dbch->xferq.flag |= FWXFERQ_RUNNING;
dbch->top = STAILQ_FIRST(&dbch->db_trq); dbch->top = STAILQ_FIRST(&dbch->db_trq);
for( i = 0, dbch->bottom = dbch->top; i < (dbch->ndb - 1); i++){ for( i = 0, dbch->bottom = dbch->top; (uint)i < (dbch->ndb - 1); i++){
dbch->bottom = STAILQ_NEXT(dbch->bottom, link); dbch->bottom = STAILQ_NEXT(dbch->bottom, link);
} }
db_tr = dbch->top; db_tr = dbch->top;
@@ -1487,7 +1488,7 @@ fwohci_rx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch)
} }
} }
for (idb = 0; idb < dbch->ndb; idb ++) { for (idb = 0; (uint)idb < dbch->ndb; idb ++) {
//fwohci_add_rx_buf(dbch, db_tr, idb, &sc->dummy_dma); //fwohci_add_rx_buf(dbch, db_tr, idb, &sc->dummy_dma);
if(ir->buf == NULL && (ir->flag & FWXFERQ_EXTBUF) == 0) { if(ir->buf == NULL && (ir->flag & FWXFERQ_EXTBUF) == 0) {
db_tr->buf = (caddr_t)buf_virt; db_tr->buf = (caddr_t)buf_virt;
@@ -1495,15 +1496,15 @@ fwohci_rx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch)
db_tr->dbcnt = 1; db_tr->dbcnt = 1;
dsiz[0] = ir->psize; dsiz[0] = ir->psize;
buf_virt += ir->psize; buf_virt = (char*)buf_virt + ir->psize;
buf_phy += ir->psize; buf_phy = (char*)buf_phy + ir->psize;
} else { } else {
db_tr->dbcnt = 0; db_tr->dbcnt = 0;
dsiz[db_tr->dbcnt] = sizeof(uint32_t); dsiz[db_tr->dbcnt] = sizeof(uint32_t);
dbuf[db_tr->dbcnt++] = sc->dummy_dma.bus_addr; dbuf[db_tr->dbcnt++] = sc->dummy_dma.bus_addr;
dsiz[db_tr->dbcnt] = ir->psize; dsiz[db_tr->dbcnt] = ir->psize;
if (ir->buf != NULL) { if (ir->buf != NULL) {
db_tr->buf = fwdma_v_addr(ir->buf, idb); db_tr->buf = (char*)fwdma_v_addr(ir->buf, idb);
dbuf[db_tr->dbcnt] = fwdma_bus_addr( dbuf[db_tr->dbcnt] = fwdma_bus_addr(
ir->buf, idb); ir->buf, idb);
} }
@@ -1580,7 +1581,7 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach)
struct fwohci_softc *sc = (struct fwohci_softc *)fc; struct fwohci_softc *sc = (struct fwohci_softc *)fc;
int err = 0; int err = 0;
unsigned short tag, ich; unsigned short tag, ich;
struct fwohci_dbch *dbch; fwohci_softc::fwohci_dbch *dbch;
int cycle_match, cycle_now, s, ldesc; int cycle_match, cycle_now, s, ldesc;
uint32_t stat; uint32_t stat;
struct fw_bulkxfer *first, *chunk, *prev; struct fw_bulkxfer *first, *chunk, *prev;
@@ -1702,7 +1703,7 @@ fwohci_irx_enable(struct firewire_comm *fc, int dmach)
int err = 0, s, ldesc; int err = 0, s, ldesc;
unsigned short tag, ich; unsigned short tag, ich;
uint32_t stat; uint32_t stat;
struct fwohci_dbch *dbch; fwohci_softc::fwohci_dbch *dbch;
// struct fwohcidb_tr *db_tr; // struct fwohcidb_tr *db_tr;
struct fw_bulkxfer *first, *prev, *chunk; struct fw_bulkxfer *first, *prev, *chunk;
struct fw_xferq *ir; struct fw_xferq *ir;
@@ -1807,7 +1808,7 @@ fwohci_stop(struct fwohci_softc *sc)
OWRITE(sc, OHCI_ATQCTLCLR, OHCI_CNTL_DMA_RUN); OWRITE(sc, OHCI_ATQCTLCLR, OHCI_CNTL_DMA_RUN);
OWRITE(sc, OHCI_ATSCTLCLR, OHCI_CNTL_DMA_RUN); OWRITE(sc, OHCI_ATSCTLCLR, OHCI_CNTL_DMA_RUN);
for( i = 0 ; i < sc->fc.nisodma ; i ++ ){ for( i = 0 ; i < (uint)sc->fc.nisodma ; i ++ ){
OWRITE(sc, OHCI_IRCTLCLR(i), OHCI_CNTL_DMA_RUN); OWRITE(sc, OHCI_IRCTLCLR(i), OHCI_CNTL_DMA_RUN);
OWRITE(sc, OHCI_ITCTLCLR(i), OHCI_CNTL_DMA_RUN); OWRITE(sc, OHCI_ITCTLCLR(i), OHCI_CNTL_DMA_RUN);
} }
@@ -1954,8 +1955,8 @@ fwohci_intr_dma(struct fwohci_softc *sc, uint32_t stat, int count)
if (stat & OHCI_INT_DMA_IR) { if (stat & OHCI_INT_DMA_IR) {
irstat = atomic_readandclear_int(&sc->irstat); irstat = atomic_readandclear_int(&sc->irstat);
for(i = 0; i < fc->nisodma ; i++){ for(i = 0; i < (uint)fc->nisodma ; i++){
struct fwohci_dbch *dbch; fwohci_softc::fwohci_dbch *dbch;
if((irstat & (1 << i)) != 0){ if((irstat & (1 << i)) != 0){
dbch = &sc->ir[i]; dbch = &sc->ir[i];
@@ -1970,7 +1971,7 @@ fwohci_intr_dma(struct fwohci_softc *sc, uint32_t stat, int count)
} }
if (stat & OHCI_INT_DMA_IT) { if (stat & OHCI_INT_DMA_IT) {
itstat = atomic_readandclear_int(&sc->itstat); itstat = atomic_readandclear_int(&sc->itstat);
for(i = 0; i < fc->nisodma ; i++){ for(i = 0; i < (uint)fc->nisodma ; i++){
if((itstat & (1 << i)) != 0){ if((itstat & (1 << i)) != 0){
fwohci_tbuf_update(sc, i); fwohci_tbuf_update(sc, i);
} }
@@ -2325,7 +2326,7 @@ dump_dma(struct fwohci_softc *sc, uint32_t ch)
void void
dump_db(struct fwohci_softc *sc, uint32_t ch) dump_db(struct fwohci_softc *sc, uint32_t ch)
{ {
struct fwohci_dbch *dbch; fwohci_softc::fwohci_dbch *dbch;
struct fwohcidb_tr *cp = NULL, *pp, *np = NULL; struct fwohcidb_tr *cp = NULL, *pp, *np = NULL;
struct fwohcidb *curr = NULL, *prev, *next = NULL; struct fwohcidb *curr = NULL, *prev, *next = NULL;
int idb, jdb; int idb, jdb;
@@ -2357,14 +2358,14 @@ dump_db(struct fwohci_softc *sc, uint32_t ch)
} }
pp = dbch->top; pp = dbch->top;
prev = pp->db; prev = pp->db;
for(idb = 0 ; idb < dbch->ndb ; idb ++ ){ for(idb = 0 ; (uint)idb < dbch->ndb ; idb ++ ){
cp = STAILQ_NEXT(pp, link); cp = STAILQ_NEXT(pp, link);
if(cp == NULL){ if(cp == NULL){
curr = NULL; curr = NULL;
goto outdb; goto outdb;
} }
np = STAILQ_NEXT(cp, link); np = STAILQ_NEXT(cp, link);
for(jdb = 0 ; jdb < dbch->ndesc ; jdb ++ ){ for(jdb = 0 ; (uint)jdb < dbch->ndesc ; jdb ++ ){
if ((cmd & 0xfffffff0) == cp->bus_addr) { if ((cmd & 0xfffffff0) == cp->bus_addr) {
curr = cp->db; curr = cp->db;
if(np != NULL){ if(np != NULL){
@@ -2425,7 +2426,7 @@ print_db(struct fwohcidb_tr *db_tr, struct fwohcidb *db,
"Depend", "Depend",
"Stat", "Stat",
"Cnt"); "Cnt");
for( i = 0 ; i <= max ; i ++){ for( i = 0 ; (uint)i <= max ; i ++){
cmd = FWOHCI_DMA_READ(db[i].db.desc.cmd); cmd = FWOHCI_DMA_READ(db[i].db.desc.cmd);
res = FWOHCI_DMA_READ(db[i].db.desc.res); res = FWOHCI_DMA_READ(db[i].db.desc.res);
key = cmd & OHCI_KEY_MASK; key = cmd & OHCI_KEY_MASK;
@@ -2521,7 +2522,7 @@ void
fwohci_txbufdb(struct fwohci_softc *sc, int dmach, struct fw_bulkxfer *bulkxfer) fwohci_txbufdb(struct fwohci_softc *sc, int dmach, struct fw_bulkxfer *bulkxfer)
{ {
struct fwohcidb_tr *db_tr, *fdb_tr; struct fwohcidb_tr *db_tr, *fdb_tr;
struct fwohci_dbch *dbch; fwohci_softc::fwohci_dbch *dbch;
struct fwohcidb *db; struct fwohcidb *db;
struct fw_pkt *fp; struct fw_pkt *fp;
struct fwohci_txpkthdr *ohcifp; struct fwohci_txpkthdr *ohcifp;
@@ -2538,7 +2539,7 @@ fwohci_txbufdb(struct fwohci_softc *sc, int dmach, struct fw_bulkxfer *bulkxfer)
/* /*
device_printf(sc->fc.dev, "DB %08x %08x %08x\n", bulkxfer, db_tr->bus_addr, fdb_tr->bus_addr); device_printf(sc->fc.dev, "DB %08x %08x %08x\n", bulkxfer, db_tr->bus_addr, fdb_tr->bus_addr);
*/ */
for (idb = 0; idb < dbch->xferq.bnpacket; idb ++) { for (idb = 0; (uint)idb < dbch->xferq.bnpacket; idb ++) {
db = db_tr->db; db = db_tr->db;
fp = (struct fw_pkt *)db_tr->buf; fp = (struct fw_pkt *)db_tr->buf;
ohcifp = (struct fwohci_txpkthdr *) db[1].db.immed; ohcifp = (struct fwohci_txpkthdr *) db[1].db.immed;
@@ -2586,7 +2587,7 @@ device_printf(sc->fc.dev, "DB %08x %3d %08x %08x\n", bulkxfer, bulkxfer->npacket
} }
static int static int
fwohci_add_tx_buf(struct fwohci_dbch *dbch, struct fwohcidb_tr *db_tr, fwohci_add_tx_buf(fwohci_softc::fwohci_dbch *dbch, struct fwohcidb_tr *db_tr,
int poffset) int poffset)
{ {
struct fwohcidb *db = db_tr->db; struct fwohcidb *db = db_tr->db;
@@ -2598,7 +2599,7 @@ fwohci_add_tx_buf(struct fwohci_dbch *dbch, struct fwohcidb_tr *db_tr,
err = EINVAL; err = EINVAL;
return err; return err;
} }
db_tr->buf = fwdma_v_addr(it->buf, poffset); db_tr->buf = (char*)fwdma_v_addr(it->buf, poffset);
db_tr->dbcnt = 3; db_tr->dbcnt = 3;
FWOHCI_DMA_WRITE(db[0].db.desc.cmd, FWOHCI_DMA_WRITE(db[0].db.desc.cmd,
@@ -2689,7 +2690,7 @@ fwohci_arcv_swap(struct fw_pkt *fp, int len)
} }
static int static int
fwohci_get_plen(struct fwohci_softc *sc, struct fwohci_dbch *dbch, struct fw_pkt *fp) fwohci_get_plen(struct fwohci_softc *sc, fwohci_softc::fwohci_dbch *dbch, struct fw_pkt *fp)
{ {
struct tcode_info *info; struct tcode_info *info;
int r; int r;
@@ -2706,7 +2707,7 @@ fwohci_get_plen(struct fwohci_softc *sc, struct fwohci_dbch *dbch, struct fw_pkt
return (-1); return (-1);
} }
if (r > dbch->xferq.psize) { if ((uint)r > dbch->xferq.psize) {
device_printf(sc->fc.dev, "Invalid packet length %d\n", r); device_printf(sc->fc.dev, "Invalid packet length %d\n", r);
return (-1); return (-1);
/* panic ? */ /* panic ? */
@@ -2716,7 +2717,7 @@ fwohci_get_plen(struct fwohci_softc *sc, struct fwohci_dbch *dbch, struct fw_pkt
} }
static void static void
fwohci_arcv_free_buf(struct fwohci_softc *sc, struct fwohci_dbch *dbch, fwohci_arcv_free_buf(struct fwohci_softc *sc, fwohci_softc::fwohci_dbch *dbch,
struct fwohcidb_tr *db_tr, uint32_t off, int wake) struct fwohcidb_tr *db_tr, uint32_t off, int wake)
{ {
struct fwohcidb *db = &db_tr->db[0]; struct fwohcidb *db = &db_tr->db[0];
@@ -2732,7 +2733,7 @@ fwohci_arcv_free_buf(struct fwohci_softc *sc, struct fwohci_dbch *dbch,
} }
static void//to be done static void//to be done
fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) fwohci_arcv(struct fwohci_softc *sc, fwohci_softc::fwohci_dbch *dbch, int count)
{ {
struct fwohcidb_tr *db_tr; struct fwohcidb_tr *db_tr;
struct iovec vec[2]; struct iovec vec[2];
@@ -19,9 +19,18 @@
#ifndef __UTIL_H #ifndef __UTIL_H
#define __UTIL_H #define __UTIL_H
#include <sys/cdefs.h>
#include <OS.h> #include <OS.h>
__BEGIN_DECLS
area_id alloc_mem(void **virt, void **phy, size_t size, uint32 protection, const char *name); area_id alloc_mem(void **virt, void **phy, size_t size, uint32 protection, const char *name);
area_id map_mem(void **virt, void *phy, size_t size, uint32 protection, const char *name); area_id map_mem(void **virt, void *phy, size_t size, uint32 protection, const char *name);
__END_DECLS
#endif #endif
+2 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2004-2007, Haiku, Inc. All RightsReserved. * Copyright 2004-2011, Haiku, Inc. All rights reserved.
* Copyright 2002-2004, Thomas Kurschel. All rights reserved. * Copyright 2002-2004, Thomas Kurschel. All rights reserved.
* *
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
@@ -148,7 +148,7 @@ transfer_PIO_physcont(ide_device_info *device, addr_t physicalAddress,
void* handle; void* handle;
int page_left, cur_len; int page_left, cur_len;
status_t err; status_t err;
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
SHOW_FLOW(4, "Transmitting to/from physical address %lx, %d bytes left", SHOW_FLOW(4, "Transmitting to/from physical address %lx, %d bytes left",
physicalAddress, length); physicalAddress, length);
+1 -1
View File
@@ -12,6 +12,6 @@ KernelAddon ps2 :
ps2_standard_mouse.c ps2_standard_mouse.c
ps2_synaptics.c ps2_synaptics.c
ps2_trackpoint.c ps2_trackpoint.c
ps2_service.c ps2_service.cpp
movement_maker.c movement_maker.c
; ;
+12 -12
View File
@@ -10,19 +10,19 @@ if $(DEBUG) = 0 {
} }
KernelAddon scsi : KernelAddon scsi :
bus_raw.c bus_raw.cpp
busses.c busses.cpp
ccb.c ccb.cpp
device_scan.c device_scan.cpp
devices.c devices.cpp
dma_buffer.cpp dma_buffer.cpp
dpc.c dpc.cpp
emulation.cpp emulation.cpp
queuing.c queuing.cpp
scsi.c scsi.cpp
scsi_io.c scsi_io.cpp
scatter_gather.c scatter_gather.cpp
sim_interface.c sim_interface.cpp
virtual_memory.c virtual_memory.cpp
; ;
@@ -32,7 +32,7 @@ scsi_bus_raw_init(void *driverCookie, void **_cookie)
device_node *parent; device_node *parent;
bus_raw_info *bus; bus_raw_info *bus;
bus = malloc(sizeof(*bus)); bus = (bus_raw_info*)malloc(sizeof(*bus));
if (bus == NULL) if (bus == NULL)
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -81,14 +81,15 @@ scsi_bus_raw_free(void *cookie)
static status_t static status_t
scsi_bus_raw_control(void *_cookie, uint32 op, void *data, size_t length) scsi_bus_raw_control(void *_cookie, uint32 op, void *data, size_t length)
{ {
bus_raw_info *bus = _cookie; bus_raw_info *bus = (bus_raw_info*)_cookie;
switch (op) { switch (op) {
case B_SCSI_BUS_RAW_RESET: case B_SCSI_BUS_RAW_RESET:
return bus->interface->reset_bus(bus->cookie); return bus->interface->reset_bus(bus->cookie);
case B_SCSI_BUS_RAW_PATH_INQUIRY: case B_SCSI_BUS_RAW_PATH_INQUIRY:
return bus->interface->path_inquiry(bus->cookie, data); return bus->interface->path_inquiry(bus->cookie,
(scsi_path_inquiry*)data);
} }
return B_ERROR; return B_ERROR;
@@ -18,6 +18,8 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <algorithm>
/*! send TUR /*! send TUR
result: true, if device answered result: true, if device answered
@@ -113,7 +115,8 @@ scsi_scan_get_inquiry(scsi_ccb *worker_req, scsi_res_inquiry *new_inquiry_data)
// unfortunately, ATAPI CD-ROM drives tend to tell that they have // unfortunately, ATAPI CD-ROM drives tend to tell that they have
// only minimal info (36 bytes), but still they return (valid!) 96 bytes - // only minimal info (36 bytes), but still they return (valid!) 96 bytes -
// bad luck // bad luck
if (min(cmd->allocation_length, new_inquiry_data->additional_length + 4) if (std::min((int)cmd->allocation_length,
new_inquiry_data->additional_length + 4)
>= (int)offsetof(scsi_res_inquiry, version_descriptor[9])) { >= (int)offsetof(scsi_res_inquiry, version_descriptor[9])) {
int i, previousStandard = -1; int i, previousStandard = -1;
@@ -255,7 +258,7 @@ scsi_scan_bus(scsi_bus_info *bus)
// as this function is optional for SIM, we ignore its result // as this function is optional for SIM, we ignore its result
bus->interface->scan_bus(bus->sim_cookie); bus->interface->scan_bus(bus->sim_cookie);
for (target_id = 0; target_id < bus->max_target_count; ++target_id) { for (target_id = 0; target_id < (int)bus->max_target_count; ++target_id) {
int lun; int lun;
SHOW_FLOW(3, "target: %d", target_id); SHOW_FLOW(3, "target: %d", target_id);
@@ -19,6 +19,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <algorithm>
/** free autosense request of device */ /** free autosense request of device */
@@ -104,7 +106,7 @@ scsi_register_device(scsi_bus_info *bus, uchar target_id,
pnp->get_attr_uint32(bus->node, B_DMA_MAX_TRANSFER_BLOCKS, &orig_max_blocks, pnp->get_attr_uint32(bus->node, B_DMA_MAX_TRANSFER_BLOCKS, &orig_max_blocks,
true); true);
max_blocks = min(max_blocks, orig_max_blocks); max_blocks = std::min(max_blocks, orig_max_blocks);
{ {
char vendor_ident[sizeof( inquiry_data->vendor_ident ) + 1]; char vendor_ident[sizeof( inquiry_data->vendor_ident ) + 1];
@@ -291,7 +293,7 @@ scsi_init_device(device_node *node, void **cookie)
return B_NO_MEMORY; return B_NO_MEMORY;
// never mind if there is no path - it might be an emulated controller // never mind if there is no path - it might be an emulated controller
path_id = -1; path_id = (uint8)-1;
pnp->get_attr_uint8(node, SCSI_BUS_PATH_ID_ITEM, &path_id, true); pnp->get_attr_uint8(node, SCSI_BUS_PATH_ID_ITEM, &path_id, true);
@@ -16,6 +16,8 @@
#include <string.h> #include <string.h>
#include <iovec.h> #include <iovec.h>
#include <algorithm>
static locked_pool_cookie temp_sg_pool; static locked_pool_cookie temp_sg_pool;
@@ -27,7 +29,8 @@ fill_temp_sg(scsi_ccb *ccb)
scsi_bus_info *bus = ccb->bus; scsi_bus_info *bus = ccb->bus;
uint32 dma_boundary = bus->dma_params.dma_boundary; uint32 dma_boundary = bus->dma_params.dma_boundary;
uint32 max_sg_block_size = bus->dma_params.max_sg_block_size; uint32 max_sg_block_size = bus->dma_params.max_sg_block_size;
uint32 max_sg_blocks = min(bus->dma_params.max_sg_blocks, MAX_TEMP_SG_FRAGMENTS); uint32 max_sg_blocks = std::min(bus->dma_params.max_sg_blocks,
(uint32)MAX_TEMP_SG_FRAGMENTS);
iovec vec = { iovec vec = {
ccb->data, ccb->data,
ccb->data_length ccb->data_length
@@ -61,7 +64,7 @@ fill_temp_sg(scsi_ccb *ccb)
max_len = (dma_boundary + 1) - max_len = (dma_boundary + 1) -
(temp_sg[cur_idx].address & dma_boundary); (temp_sg[cur_idx].address & dma_boundary);
// restrict size per sg item // restrict size per sg item
max_len = min(max_len, max_sg_block_size); max_len = std::min(max_len, max_sg_block_size);
SHOW_FLOW(4, "addr=%#" B_PRIxPHYSADDR ", size=%x, max_len=%x, " SHOW_FLOW(4, "addr=%#" B_PRIxPHYSADDR ", size=%x, max_len=%x, "
"idx=%d, num=%d", temp_sg[cur_idx].address, "idx=%d, num=%d", temp_sg[cur_idx].address,
@@ -106,7 +109,7 @@ create_temp_sg(scsi_ccb *ccb)
SHOW_FLOW(3, "ccb=%p, data=%p, data_length=%lu", ccb, ccb->data, ccb->data_length); SHOW_FLOW(3, "ccb=%p, data=%p, data_length=%lu", ccb, ccb->data, ccb->data_length);
ccb->sg_list = temp_sg = locked_pool->alloc(temp_sg_pool); ccb->sg_list = temp_sg = (physical_entry*)locked_pool->alloc(temp_sg_pool);
if (temp_sg == NULL) { if (temp_sg == NULL) {
SHOW_ERROR0(2, "cannot allocate memory for IO request!"); SHOW_ERROR0(2, "cannot allocate memory for IO request!");
return false; return false;
@@ -13,6 +13,8 @@
#include <string.h> #include <string.h>
#include <algorithm>
/** put request back in queue because of device/bus overflow */ /** put request back in queue because of device/bus overflow */
@@ -177,7 +179,7 @@ finish_autosense(scsi_device_info *device)
int sense_len; int sense_len;
// we got sense data -> copy it to sense buffer // we got sense data -> copy it to sense buffer
sense_len = min(SCSI_MAX_SENSE_SIZE, sense_len = std::min((uint32)SCSI_MAX_SENSE_SIZE,
request->data_length - request->data_resid); request->data_length - request->data_resid);
SHOW_FLOW(3, "Got sense: %d bytes", sense_len); SHOW_FLOW(3, "Got sense: %d bytes", sense_len);
@@ -91,7 +91,7 @@ scsi_controller_register_raw_device(void *_cookie)
pnp->get_attr_uint8(node, SCSI_BUS_PATH_ID_ITEM, &pathID, false); pnp->get_attr_uint8(node, SCSI_BUS_PATH_ID_ITEM, &pathID, false);
// put that on heap to not overflow the limited kernel stack // put that on heap to not overflow the limited kernel stack
name = malloc(PATH_MAX + 1); name = (char*)malloc(PATH_MAX + 1);
if (name == NULL) if (name == NULL)
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -18,6 +18,8 @@
#include <string.h> #include <string.h>
#include <algorithm>
/** get sg list of iovec /** get sg list of iovec
* TBD: this should be moved to somewhere in kernel * TBD: this should be moved to somewhere in kernel
@@ -52,7 +54,7 @@ get_iovec_memory_map(iovec *vec, size_t vec_count, size_t vec_offset, size_t len
// map one iovec // map one iovec
range_start = (char *)vec->iov_base + vec_offset; range_start = (char *)vec->iov_base + vec_offset;
range_len = min( vec->iov_len - vec_offset, left_len ); range_len = std::min(vec->iov_len - vec_offset, left_len);
SHOW_FLOW( 3, "range_start=%x, range_len=%x", SHOW_FLOW( 3, "range_start=%x, range_len=%x",
(int)range_start, (int)range_len ); (int)range_start, (int)range_len );
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -7,7 +7,9 @@
#include <string.h> #include <string.h>
#include <debug.h> #ifdef _KERNEL_MODE
# include <debug.h>
#endif
static inline bool static inline bool
@@ -10,7 +10,9 @@
#include <TypeConstants.h> #include <TypeConstants.h>
#include <debug.h> #ifdef _KERNEL_MODE
# include <debug.h>
#endif
#include "demangle.h" #include "demangle.h"
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -13,7 +13,9 @@
#include <TypeConstants.h> #include <TypeConstants.h>
#include <debug_heap.h> #ifdef _KERNEL_MODE
# include <debug_heap.h>
#endif
#include "demangle.h" #include "demangle.h"
@@ -685,7 +685,7 @@ status_t
SessionGetter::New(const char *name, dev_t device, ino_t node, SessionGetter::New(const char *name, dev_t device, ino_t node,
Session **_session) Session **_session)
{ {
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
fSession = start_session(thread->team->id, device, node, name); fSession = start_session(thread->team->id, device, node, name);
if (fSession != NULL) { if (fSession != NULL) {
+2 -2
View File
@@ -83,7 +83,7 @@ get_log_entry()
mutex_lock(&sLock); mutex_lock(&sLock);
cache_log *log = &sLogEntries[sCurrentEntry++]; cache_log *log = &sLogEntries[sCurrentEntry++];
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
log->team = thread->team->id; log->team = thread->team->id;
strlcpy(log->team_name, thread->name, B_OS_NAME_LENGTH); strlcpy(log->team_name, thread->name, B_OS_NAME_LENGTH);
@@ -167,7 +167,7 @@ log_node_launched(size_t argCount, char * const *args)
for (uint32 i = 0; i < argCount; i++) { for (uint32 i = 0; i < argCount; i++) {
if (i == 0) { if (i == 0) {
// cut off path from parent team name // cut off path from parent team name
struct team *team = thread_get_current_thread()->team; Team *team = thread_get_current_thread()->team;
char name[B_OS_NAME_LENGTH]; char name[B_OS_NAME_LENGTH];
cpu_status state; cpu_status state;
@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2001-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -732,7 +732,7 @@ FileSystem::_NodeListenerEventOccurred(NodeListenerProxy* proxy,
if (error != B_OK) if (error != B_OK)
return; return;
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
request->team = thread->team->id; request->team = thread->team->id;
request->thread = thread->id; request->thread = thread->id;
request->user = geteuid(); request->user = geteuid();
@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2001-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -4386,7 +4386,7 @@ Volume::_SendRequest(RequestPort* port, RequestAllocator* allocator,
// fill in the caller info // fill in the caller info
KernelRequest* request = static_cast<KernelRequest*>( KernelRequest* request = static_cast<KernelRequest*>(
allocator->GetRequest()); allocator->GetRequest());
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
request->team = thread->team->id; request->team = thread->team->id;
request->thread = thread->id; request->thread = thread->id;
request->user = geteuid(); request->user = geteuid();
+4 -4
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved. * Copyright 2006-2011, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -698,7 +698,7 @@ uninit_timers(void)
bool bool
is_syscall(void) is_syscall(void)
{ {
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
return (thread->flags & THREAD_FLAGS_SYSCALL) != 0; return (thread->flags & THREAD_FLAGS_SYSCALL) != 0;
} }
@@ -713,7 +713,7 @@ is_restarted_syscall(void)
void void
store_syscall_restart_timeout(bigtime_t timeout) store_syscall_restart_timeout(bigtime_t timeout)
{ {
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
if ((thread->flags & THREAD_FLAGS_SYSCALL) != 0) if ((thread->flags & THREAD_FLAGS_SYSCALL) != 0)
*(bigtime_t*)thread->syscall_restart.parameters = timeout; *(bigtime_t*)thread->syscall_restart.parameters = timeout;
} }
@@ -722,7 +722,7 @@ store_syscall_restart_timeout(bigtime_t timeout)
bigtime_t bigtime_t
restore_syscall_restart_timeout(void) restore_syscall_restart_timeout(void)
{ {
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
return *(bigtime_t*)thread->syscall_restart.parameters; return *(bigtime_t*)thread->syscall_restart.parameters;
} }
-2
View File
@@ -3,8 +3,6 @@ SubDir HAIKU_TOP src apps debugger demangler ;
CCFLAGS += -Werror ; CCFLAGS += -Werror ;
C++FLAGS += -Werror ; C++FLAGS += -Werror ;
UsePrivateHeaders kernel ;
SEARCH_SOURCE SEARCH_SOURCE
+= [ FDirName $(HAIKU_TOP) src add-ons kernel debugger demangle ] ; += [ FDirName $(HAIKU_TOP) src add-ons kernel debugger demangle ] ;
+1 -1
View File
@@ -460,7 +460,7 @@ crom_add_chunk(struct crom_src *src, struct crom_chunk *parent,
#define MAX_TEXT ((CROM_MAX_CHUNK_LEN + 1) * 4 - sizeof(struct csrtext)) #define MAX_TEXT ((CROM_MAX_CHUNK_LEN + 1) * 4 - sizeof(struct csrtext))
int int
crom_add_simple_text(struct crom_src *src, struct crom_chunk *parent, crom_add_simple_text(struct crom_src *src, struct crom_chunk *parent,
struct crom_chunk *chunk, char *buf) struct crom_chunk *chunk, const char *buf)
{ {
struct csrtext *tl; struct csrtext *tl;
uint32_t *p; uint32_t *p;
+5 -5
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2009, Haiku Inc. All rights reserved. * Copyright 2003-2011, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -65,7 +65,7 @@ get_current_stack_frame()
static status_t static status_t
get_next_frame(addr_t framePointer, addr_t *next, addr_t *ip) get_next_frame(addr_t framePointer, addr_t *next, addr_t *ip)
{ {
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
addr_t oldFaultHandler = thread->fault_handler; addr_t oldFaultHandler = thread->fault_handler;
// set fault handler, so that we can safely access user stacks // set fault handler, so that we can safely access user stacks
@@ -88,7 +88,7 @@ error:
static void static void
print_stack_frame(struct thread *thread, addr_t ip, addr_t framePointer, print_stack_frame(Thread *thread, addr_t ip, addr_t framePointer,
addr_t nextFramePointer) addr_t nextFramePointer)
{ {
addr_t diff = nextFramePointer - framePointer; addr_t diff = nextFramePointer - framePointer;
@@ -128,7 +128,7 @@ stack_trace(int argc, char **argv)
{ {
uint32 previousLocations[NUM_PREVIOUS_LOCATIONS]; uint32 previousLocations[NUM_PREVIOUS_LOCATIONS];
struct iframe_stack *frameStack; struct iframe_stack *frameStack;
struct thread *thread; Thread *thread;
addr_t framePointer; addr_t framePointer;
int32 i, num = 0, last = 0; int32 i, num = 0, last = 0;
@@ -234,7 +234,7 @@ arch_debug_save_registers(struct arch_debug_registers* registers)
bool bool
arch_debug_contains_call(struct thread *thread, const char *symbol, arch_debug_contains_call(Thread *thread, const char *symbol,
addr_t start, addr_t end) addr_t start, addr_t end)
{ {
return false; return false;
+10 -10
View File
@@ -31,7 +31,7 @@
// a new thread structure. // a new thread structure.
static struct arch_thread sInitialState; static struct arch_thread sInitialState;
struct thread *gCurrentThread; Thread *gCurrentThread;
status_t status_t
@@ -45,7 +45,7 @@ arch_thread_init(struct kernel_args *args)
status_t status_t
arch_team_init_team_struct(struct team *team, bool kernel) arch_team_init_team_struct(Team *team, bool kernel)
{ {
// Nothing to do. The structure is empty. // Nothing to do. The structure is empty.
return B_OK; return B_OK;
@@ -53,7 +53,7 @@ arch_team_init_team_struct(struct team *team, bool kernel)
status_t status_t
arch_thread_init_thread_struct(struct thread *thread) arch_thread_init_thread_struct(Thread *thread)
{ {
// set up an initial state (stack & fpu) // set up an initial state (stack & fpu)
memcpy(&thread->arch_info, &sInitialState, sizeof(struct arch_thread)); memcpy(&thread->arch_info, &sInitialState, sizeof(struct arch_thread));
@@ -63,7 +63,7 @@ arch_thread_init_thread_struct(struct thread *thread)
status_t status_t
arch_thread_init_kthread_stack(struct thread *t, int (*start_func)(void), arch_thread_init_kthread_stack(Thread *t, int (*start_func)(void),
void (*entry_func)(void), void (*exit_func)(void)) void (*entry_func)(void), void (*exit_func)(void))
{ {
/* addr_t *kstack = (addr_t *)t->kernel_stack_base; /* addr_t *kstack = (addr_t *)t->kernel_stack_base;
@@ -107,7 +107,7 @@ arch_thread_init_kthread_stack(struct thread *t, int (*start_func)(void),
status_t status_t
arch_thread_init_tls(struct thread *thread) arch_thread_init_tls(Thread *thread)
{ {
// TODO: Implement! // TODO: Implement!
return B_OK; return B_OK;
@@ -115,7 +115,7 @@ arch_thread_init_tls(struct thread *thread)
void void
arch_thread_context_switch(struct thread *from, struct thread *to) arch_thread_context_switch(Thread *from, Thread *to)
{ {
/* addr_t newPageDirectory; /* addr_t newPageDirectory;
@@ -141,7 +141,7 @@ arch_thread_dump_info(void *info)
status_t status_t
arch_thread_enter_userspace(struct thread *thread, addr_t entry, void *arg1, void *arg2) arch_thread_enter_userspace(Thread *thread, addr_t entry, void *arg1, void *arg2)
{ {
panic("arch_thread_enter_uspace(): not yet implemented\n"); panic("arch_thread_enter_uspace(): not yet implemented\n");
return B_ERROR; return B_ERROR;
@@ -149,14 +149,14 @@ arch_thread_enter_userspace(struct thread *thread, addr_t entry, void *arg1, voi
bool bool
arch_on_signal_stack(struct thread *thread) arch_on_signal_stack(Thread *thread)
{ {
return false; return false;
} }
status_t status_t
arch_setup_signal_frame(struct thread *thread, struct sigaction *sa, int sig, int sigMask) arch_setup_signal_frame(Thread *thread, struct sigaction *sa, int sig, int sigMask)
{ {
return B_ERROR; return B_ERROR;
} }
@@ -170,7 +170,7 @@ arch_restore_signal_frame(void)
void void
arch_check_syscall_restart(struct thread *thread) arch_check_syscall_restart(Thread *thread)
{ {
} }
@@ -59,8 +59,7 @@ arch_get_debug_cpu_state(debug_cpu_state *cpuState)
status_t status_t
arch_get_thread_debug_cpu_state(struct thread *thread, arch_get_thread_debug_cpu_state(Thread *thread, debug_cpu_state *cpuState)
debug_cpu_state *cpuState)
{ {
return B_ERROR; return B_ERROR;
} }
@@ -1,6 +1,6 @@
/* /*
* Copyright 2010, Ithamar R. Adema, ithamar.adema@team-embedded.nl * Copyright 2010, Ithamar R. Adema, ithamar.adema@team-embedded.nl
* Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2008-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
@@ -184,7 +184,7 @@ ARMVMTranslationMap32Bit::Map(addr_t va, phys_addr_t pa, uint32 attributes,
} }
// now, fill in the pentry // now, fill in the pentry
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt( page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt(
@@ -229,7 +229,7 @@ ARMVMTranslationMap32Bit::Unmap(addr_t start, addr_t end)
continue; continue;
} }
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt( page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt(
@@ -360,7 +360,7 @@ ARMVMTranslationMap32Bit::UnmapPages(VMArea* area, addr_t base, size_t size,
continue; continue;
} }
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt( page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt(
@@ -570,7 +570,7 @@ ARMVMTranslationMap32Bit::Query(addr_t va, phys_addr_t *_physical,
return B_OK; return B_OK;
} }
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt( page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt(
@@ -675,7 +675,7 @@ ARMVMTranslationMap32Bit::Protect(addr_t start, addr_t end, uint32 attributes,
continue; continue;
} }
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt( page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt(
@@ -736,7 +736,7 @@ ARMVMTranslationMap32Bit::ClearFlags(addr_t va, uint32 flags)
#else #else
uint32 flagsToClear = 0; uint32 flagsToClear = 0;
#endif #endif
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt( page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt(
@@ -1,5 +1,5 @@
/* /*
* Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2008-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
@@ -95,7 +95,7 @@ ARMVMTranslationMap::Flush()
if (fInvalidPagesCount <= 0) if (fInvalidPagesCount <= 0)
return; return;
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
thread_pin_to_current_cpu(thread); thread_pin_to_current_cpu(thread);
if (fInvalidPagesCount > PAGE_INVALIDATE_CACHE_SIZE) { if (fInvalidPagesCount > PAGE_INVALIDATE_CACHE_SIZE) {
@@ -1,6 +1,6 @@
/* /*
* Copyright 2010, Ithamar R. Adema, ithamar.adema@team-embedded.nl * Copyright 2010, Ithamar R. Adema, ithamar.adema@team-embedded.nl
* Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2008-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -573,7 +573,7 @@ LargeMemoryPhysicalPageMapper::MemsetPhysical(phys_addr_t address, int value,
{ {
phys_addr_t pageOffset = address % B_PAGE_SIZE; phys_addr_t pageOffset = address % B_PAGE_SIZE;
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner _(thread); ThreadCPUPinner _(thread);
PhysicalPageSlotQueue* slotQueue = GetSlotQueue(thread->cpu->cpu_num, PhysicalPageSlotQueue* slotQueue = GetSlotQueue(thread->cpu->cpu_num,
@@ -604,7 +604,7 @@ LargeMemoryPhysicalPageMapper::MemcpyFromPhysical(void* _to, phys_addr_t from,
uint8* to = (uint8*)_to; uint8* to = (uint8*)_to;
phys_addr_t pageOffset = from % B_PAGE_SIZE; phys_addr_t pageOffset = from % B_PAGE_SIZE;
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner _(thread); ThreadCPUPinner _(thread);
PhysicalPageSlotQueue* slotQueue = GetSlotQueue(thread->cpu->cpu_num, user); PhysicalPageSlotQueue* slotQueue = GetSlotQueue(thread->cpu->cpu_num, user);
@@ -644,7 +644,7 @@ LargeMemoryPhysicalPageMapper::MemcpyToPhysical(phys_addr_t to,
const uint8* from = (const uint8*)_from; const uint8* from = (const uint8*)_from;
phys_addr_t pageOffset = to % B_PAGE_SIZE; phys_addr_t pageOffset = to % B_PAGE_SIZE;
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner _(thread); ThreadCPUPinner _(thread);
PhysicalPageSlotQueue* slotQueue = GetSlotQueue(thread->cpu->cpu_num, user); PhysicalPageSlotQueue* slotQueue = GetSlotQueue(thread->cpu->cpu_num, user);
@@ -681,7 +681,7 @@ void
LargeMemoryPhysicalPageMapper::MemcpyPhysicalPage(phys_addr_t to, LargeMemoryPhysicalPageMapper::MemcpyPhysicalPage(phys_addr_t to,
phys_addr_t from) phys_addr_t from)
{ {
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner _(thread); ThreadCPUPinner _(thread);
PhysicalPageSlotQueue* slotQueue = GetSlotQueue(thread->cpu->cpu_num, PhysicalPageSlotQueue* slotQueue = GetSlotQueue(thread->cpu->cpu_num,
+5 -5
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2010, Haiku Inc. All rights reserved. * Copyright 2003-2011, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -79,7 +79,7 @@ get_next_frame(addr_t framePointer, addr_t *next, addr_t *ip)
static void static void
print_stack_frame(struct thread *thread, addr_t ip, addr_t framePointer, print_stack_frame(Thread *thread, addr_t ip, addr_t framePointer,
addr_t nextFramePointer) addr_t nextFramePointer)
{ {
addr_t diff = nextFramePointer - framePointer; addr_t diff = nextFramePointer - framePointer;
@@ -119,7 +119,7 @@ stack_trace(int argc, char **argv)
{ {
uint32 previousLocations[NUM_PREVIOUS_LOCATIONS]; uint32 previousLocations[NUM_PREVIOUS_LOCATIONS];
struct iframe_stack *frameStack; struct iframe_stack *frameStack;
struct thread *thread; Thread *thread;
addr_t framePointer; addr_t framePointer;
int32 i, num = 0, last = 0; int32 i, num = 0, last = 0;
@@ -262,7 +262,7 @@ arch_debug_stack_trace(void)
bool bool
arch_debug_contains_call(struct thread *thread, const char *symbol, arch_debug_contains_call(Thread *thread, const char *symbol,
addr_t start, addr_t end) addr_t start, addr_t end)
{ {
return false; return false;
@@ -295,7 +295,7 @@ arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount,
if (skipIframes > 0) if (skipIframes > 0)
skipFrames = INT_MAX; skipFrames = INT_MAX;
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
framePointer = (addr_t)get_current_stack_frame(); framePointer = (addr_t)get_current_stack_frame();
bool onKernelStack = true; bool onKernelStack = true;
+2 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2010, Haiku Inc. All rights reserved. * Copyright 2003-2011, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -176,7 +176,7 @@ m68k_exception_entry(struct iframe *iframe)
"pc: %p\n", system_time(), vector, iframe, (void*)iframe->cpu.pc); "pc: %p\n", system_time(), vector, iframe, (void*)iframe->cpu.pc);
} }
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
// push iframe // push iframe
if (thread) if (thread)
+14 -14
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2010, Haiku Inc. All rights reserved. * Copyright 2003-2011, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -31,7 +31,7 @@
// a new thread structure. // a new thread structure.
static struct arch_thread sInitialState; static struct arch_thread sInitialState;
struct thread *gCurrentThread; Thread *gCurrentThread;
// Helper function for thread creation, defined in arch_asm.S. // Helper function for thread creation, defined in arch_asm.S.
extern "C" void m68k_kernel_thread_root(); extern "C" void m68k_kernel_thread_root();
@@ -61,7 +61,7 @@ m68k_pop_iframe(struct iframe_stack *stack)
static struct iframe * static struct iframe *
m68k_get_current_iframe(void) m68k_get_current_iframe(void)
{ {
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
ASSERT(thread->arch_info.iframes.index >= 0); ASSERT(thread->arch_info.iframes.index >= 0);
return thread->arch_info.iframes.frames[thread->arch_info.iframes.index - 1]; return thread->arch_info.iframes.frames[thread->arch_info.iframes.index - 1];
@@ -77,7 +77,7 @@ m68k_get_current_iframe(void)
struct iframe * struct iframe *
m68k_get_user_iframe(void) m68k_get_user_iframe(void)
{ {
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
int i; int i;
for (i = thread->arch_info.iframes.index - 1; i >= 0; i--) { for (i = thread->arch_info.iframes.index - 1; i >= 0; i--) {
@@ -91,7 +91,7 @@ m68k_get_user_iframe(void)
void * void *
m68k_next_page_directory(struct thread *from, struct thread *to) m68k_next_page_directory(Thread *from, Thread *to)
{ {
if (from->team->address_space != NULL && to->team->address_space != NULL) { if (from->team->address_space != NULL && to->team->address_space != NULL) {
// they are both user space threads // they are both user space threads
@@ -129,7 +129,7 @@ arch_thread_init(struct kernel_args *args)
status_t status_t
arch_team_init_team_struct(struct team *team, bool kernel) arch_team_init_team_struct(Team *team, bool kernel)
{ {
// Nothing to do. The structure is empty. // Nothing to do. The structure is empty.
return B_OK; return B_OK;
@@ -137,7 +137,7 @@ arch_team_init_team_struct(struct team *team, bool kernel)
status_t status_t
arch_thread_init_thread_struct(struct thread *thread) arch_thread_init_thread_struct(Thread *thread)
{ {
// set up an initial state (stack & fpu) // set up an initial state (stack & fpu)
memcpy(&thread->arch_info, &sInitialState, sizeof(struct arch_thread)); memcpy(&thread->arch_info, &sInitialState, sizeof(struct arch_thread));
@@ -147,7 +147,7 @@ arch_thread_init_thread_struct(struct thread *thread)
status_t status_t
arch_thread_init_kthread_stack(struct thread *t, int (*start_func)(void), arch_thread_init_kthread_stack(Thread *t, int (*start_func)(void),
void (*entry_func)(void), void (*exit_func)(void)) void (*entry_func)(void), void (*exit_func)(void))
{ {
addr_t *kstack = (addr_t *)t->kernel_stack_base; addr_t *kstack = (addr_t *)t->kernel_stack_base;
@@ -190,7 +190,7 @@ arch_thread_init_kthread_stack(struct thread *t, int (*start_func)(void),
status_t status_t
arch_thread_init_tls(struct thread *thread) arch_thread_init_tls(Thread *thread)
{ {
// TODO: Implement! // TODO: Implement!
return B_OK; return B_OK;
@@ -198,7 +198,7 @@ arch_thread_init_tls(struct thread *thread)
void void
arch_thread_context_switch(struct thread *from, struct thread *to) arch_thread_context_switch(Thread *from, Thread *to)
{ {
addr_t newPageDirectory; addr_t newPageDirectory;
@@ -222,7 +222,7 @@ arch_thread_dump_info(void *info)
status_t status_t
arch_thread_enter_userspace(struct thread *thread, addr_t entry, void *arg1, void *arg2) arch_thread_enter_userspace(Thread *thread, addr_t entry, void *arg1, void *arg2)
{ {
panic("arch_thread_enter_uspace(): not yet implemented\n"); panic("arch_thread_enter_uspace(): not yet implemented\n");
return B_ERROR; return B_ERROR;
@@ -230,14 +230,14 @@ arch_thread_enter_userspace(struct thread *thread, addr_t entry, void *arg1, voi
bool bool
arch_on_signal_stack(struct thread *thread) arch_on_signal_stack(Thread *thread)
{ {
return false; return false;
} }
status_t status_t
arch_setup_signal_frame(struct thread *thread, struct sigaction *sa, int sig, int sigMask) arch_setup_signal_frame(Thread *thread, struct sigaction *sa, int sig, int sigMask)
{ {
return B_ERROR; return B_ERROR;
} }
@@ -251,7 +251,7 @@ arch_restore_signal_frame(void)
void void
arch_check_syscall_restart(struct thread *thread) arch_check_syscall_restart(Thread *thread)
{ {
} }
@@ -44,7 +44,7 @@ void
arch_update_thread_single_step() arch_update_thread_single_step()
{ {
if (struct iframe* frame = m68k_get_user_iframe()) { if (struct iframe* frame = m68k_get_user_iframe()) {
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
// set/clear T1 in SR depending on if single stepping is desired // set/clear T1 in SR depending on if single stepping is desired
// T1 T0 // T1 T0
+9 -9
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2007-2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2007-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -28,14 +28,14 @@
void void
dummy() dummy()
{ {
// struct thread // struct Thread
DEFINE_OFFSET_MACRO(THREAD, thread, kernel_time); DEFINE_OFFSET_MACRO(THREAD, Thread, kernel_time);
DEFINE_OFFSET_MACRO(THREAD, thread, user_time); DEFINE_OFFSET_MACRO(THREAD, Thread, user_time);
DEFINE_OFFSET_MACRO(THREAD, thread, last_time); DEFINE_OFFSET_MACRO(THREAD, Thread, last_time);
DEFINE_OFFSET_MACRO(THREAD, thread, in_kernel); DEFINE_OFFSET_MACRO(THREAD, Thread, in_kernel);
DEFINE_OFFSET_MACRO(THREAD, thread, flags); DEFINE_OFFSET_MACRO(THREAD, Thread, flags);
DEFINE_OFFSET_MACRO(THREAD, thread, kernel_stack_top); DEFINE_OFFSET_MACRO(THREAD, Thread, kernel_stack_top);
DEFINE_OFFSET_MACRO(THREAD, thread, fault_handler); DEFINE_OFFSET_MACRO(THREAD, Thread, fault_handler);
// struct iframe // struct iframe
DEFINE_OFFSET_MACRO(IFRAME, iframe, fp); DEFINE_OFFSET_MACRO(IFRAME, iframe, fp);
+3 -3
View File
@@ -10,17 +10,17 @@ int arch_proc_init_proc_struct(struct proc *p, bool kernel)
return 0; return 0;
} }
int arch_thread_init_thread_struct(struct thread *t) int arch_thread_init_thread_struct(Thread *t)
{ {
return 0; return 0;
} }
int arch_thread_initialize_kthread_stack(struct thread *t, int (*start_func)(void), void (*entry_func)(void)) int arch_thread_initialize_kthread_stack(Thread *t, int (*start_func)(void), void (*entry_func)(void))
{ {
return 0; return 0;
} }
void arch_thread_context_switch(struct thread *t_from, struct thread *t_to) void arch_thread_context_switch(Thread *t_from, Thread *t_to)
{ {
#if 0 #if 0
int i; int i;
+2 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2009, Haiku Inc. All rights reserved. * Copyright 2003-201, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -42,7 +42,7 @@ arch_debug_save_registers(struct arch_debug_registers* registers)
bool bool
arch_debug_contains_call(struct thread* thread, const char* symbol, arch_debug_contains_call(Thread* thread, const char* symbol,
addr_t start, addr_t end) addr_t start, addr_t end)
{ {
#warning IMPLEMENT arch_debug_contains_call #warning IMPLEMENT arch_debug_contains_call
+10 -10
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2010 Haiku Inc. All rights reserved. * Copyright 2003-2011, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -71,7 +71,7 @@ arch_thread_init(struct kernel_args *args)
status_t status_t
arch_team_init_team_struct(struct team *team, bool kernel) arch_team_init_team_struct(Team *team, bool kernel)
{ {
#warning IMPLEMENT arch_team_init_team_struct #warning IMPLEMENT arch_team_init_team_struct
return B_ERROR; return B_ERROR;
@@ -79,7 +79,7 @@ arch_team_init_team_struct(struct team *team, bool kernel)
status_t status_t
arch_thread_init_thread_struct(struct thread *thread) arch_thread_init_thread_struct(Thread *thread)
{ {
#warning IMPLEMENT arch_thread_init_thread_struct #warning IMPLEMENT arch_thread_init_thread_struct
return B_ERROR; return B_ERROR;
@@ -87,7 +87,7 @@ arch_thread_init_thread_struct(struct thread *thread)
status_t status_t
arch_thread_init_kthread_stack(struct thread *t, int (*start_func)(void), arch_thread_init_kthread_stack(Thread *t, int (*start_func)(void),
void (*entry_func)(void), void (*exit_func)(void)) void (*entry_func)(void), void (*exit_func)(void))
{ {
#warning IMPLEMENT arch_thread_init_kthread_stack #warning IMPLEMENT arch_thread_init_kthread_stack
@@ -96,7 +96,7 @@ arch_thread_init_kthread_stack(struct thread *t, int (*start_func)(void),
status_t status_t
arch_thread_init_tls(struct thread *thread) arch_thread_init_tls(Thread *thread)
{ {
#warning IMPLEMENT arch_thread_init_tls #warning IMPLEMENT arch_thread_init_tls
return B_ERROR; return B_ERROR;
@@ -104,7 +104,7 @@ arch_thread_init_tls(struct thread *thread)
void void
arch_thread_context_switch(struct thread *from, struct thread *to) arch_thread_context_switch(Thread *from, Thread *to)
{ {
#warning IMPLEMENT arch_thread_context_switch #warning IMPLEMENT arch_thread_context_switch
} }
@@ -118,7 +118,7 @@ arch_thread_dump_info(void *info)
status_t status_t
arch_thread_enter_userspace(struct thread *thread, addr_t entry, void *arg1, arch_thread_enter_userspace(Thread *thread, addr_t entry, void *arg1,
void *arg2) void *arg2)
{ {
#warning IMPLEMENT arch_thread_enter_userspace #warning IMPLEMENT arch_thread_enter_userspace
@@ -128,7 +128,7 @@ arch_thread_enter_userspace(struct thread *thread, addr_t entry, void *arg1,
bool bool
arch_on_signal_stack(struct thread *thread) arch_on_signal_stack(Thread *thread)
{ {
#warning IMPLEMENT arch_on_signal_stack #warning IMPLEMENT arch_on_signal_stack
return false; return false;
@@ -136,7 +136,7 @@ arch_on_signal_stack(struct thread *thread)
status_t status_t
arch_setup_signal_frame(struct thread *thread, struct sigaction *sa, int sig, arch_setup_signal_frame(Thread *thread, struct sigaction *sa, int sig,
int sigMask) int sigMask)
{ {
#warning IMPLEMENT arch_setup_signal_frame #warning IMPLEMENT arch_setup_signal_frame
@@ -153,7 +153,7 @@ arch_restore_signal_frame(void)
void void
arch_check_syscall_restart(struct thread *thread) arch_check_syscall_restart(Thread *thread)
{ {
#warning IMPLEMENT arch_check_syscall_restart #warning IMPLEMENT arch_check_syscall_restart
} }
@@ -61,7 +61,7 @@ arch_get_debug_cpu_state(debug_cpu_state* cpuState)
status_t status_t
arch_get_thread_debug_cpu_state(struct thread* thread, arch_get_thread_debug_cpu_state(Thread* thread,
debug_cpu_state* cpuState) debug_cpu_state* cpuState)
{ {
#warning IMPLEMENT arch_get_thread_debug_cpu_state #warning IMPLEMENT arch_get_thread_debug_cpu_state
+4 -4
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2010, Haiku Inc. All rights reserved. * Copyright 2003-2011, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -78,7 +78,7 @@ get_next_frame(addr_t framePointer, addr_t *next, addr_t *ip)
static void static void
print_stack_frame(struct thread *thread, addr_t ip, addr_t framePointer, print_stack_frame(Thread *thread, addr_t ip, addr_t framePointer,
addr_t nextFramePointer) addr_t nextFramePointer)
{ {
addr_t diff = nextFramePointer - framePointer; addr_t diff = nextFramePointer - framePointer;
@@ -118,7 +118,7 @@ stack_trace(int argc, char **argv)
{ {
uint32 previousLocations[NUM_PREVIOUS_LOCATIONS]; uint32 previousLocations[NUM_PREVIOUS_LOCATIONS];
struct iframe_stack *frameStack; struct iframe_stack *frameStack;
struct thread *thread; Thread *thread;
addr_t framePointer; addr_t framePointer;
int32 i, num = 0, last = 0; int32 i, num = 0, last = 0;
@@ -273,7 +273,7 @@ arch_debug_stack_trace(void)
bool bool
arch_debug_contains_call(struct thread *thread, const char *symbol, arch_debug_contains_call(Thread *thread, const char *symbol,
addr_t start, addr_t end) addr_t start, addr_t end)
{ {
return false; return false;
+3 -3
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2010, Haiku Inc. All rights reserved. * Copyright 2003-2011, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -103,7 +103,7 @@ ppc_exception_entry(int vector, struct iframe *iframe)
"srr0: %p\n", system_time(), vector, iframe, (void*)iframe->srr0); "srr0: %p\n", system_time(), vector, iframe, (void*)iframe->srr0);
} }
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
// push iframe // push iframe
if (thread) if (thread)
@@ -132,7 +132,7 @@ ppc_exception_entry(int vector, struct iframe *iframe)
iframe->r1 = cpu->fault_handler_stack_pointer; iframe->r1 = cpu->fault_handler_stack_pointer;
break; break;
} }
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
if (thread && thread->fault_handler != 0) { if (thread && thread->fault_handler != 0) {
iframe->srr0 = thread->fault_handler; iframe->srr0 = thread->fault_handler;
break; break;
+11 -11
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2010, Haiku Inc. All rights reserved. * Copyright 2003-2011, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -56,7 +56,7 @@ ppc_pop_iframe(struct iframe_stack *stack)
static struct iframe * static struct iframe *
ppc_get_current_iframe(void) ppc_get_current_iframe(void)
{ {
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
ASSERT(thread->arch_info.iframes.index >= 0); ASSERT(thread->arch_info.iframes.index >= 0);
return thread->arch_info.iframes.frames[thread->arch_info.iframes.index - 1]; return thread->arch_info.iframes.frames[thread->arch_info.iframes.index - 1];
@@ -72,7 +72,7 @@ ppc_get_current_iframe(void)
struct iframe * struct iframe *
ppc_get_user_iframe(void) ppc_get_user_iframe(void)
{ {
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
int i; int i;
for (i = thread->arch_info.iframes.index - 1; i >= 0; i--) { for (i = thread->arch_info.iframes.index - 1; i >= 0; i--) {
@@ -99,7 +99,7 @@ arch_thread_init(struct kernel_args *args)
status_t status_t
arch_team_init_team_struct(struct team *team, bool kernel) arch_team_init_team_struct(Team *team, bool kernel)
{ {
// Nothing to do. The structure is empty. // Nothing to do. The structure is empty.
return B_OK; return B_OK;
@@ -107,7 +107,7 @@ arch_team_init_team_struct(struct team *team, bool kernel)
status_t status_t
arch_thread_init_thread_struct(struct thread *thread) arch_thread_init_thread_struct(Thread *thread)
{ {
// set up an initial state (stack & fpu) // set up an initial state (stack & fpu)
memcpy(&thread->arch_info, &sInitialState, sizeof(struct arch_thread)); memcpy(&thread->arch_info, &sInitialState, sizeof(struct arch_thread));
@@ -117,7 +117,7 @@ arch_thread_init_thread_struct(struct thread *thread)
status_t status_t
arch_thread_init_kthread_stack(struct thread *t, int (*start_func)(void), arch_thread_init_kthread_stack(Thread *t, int (*start_func)(void),
void (*entry_func)(void), void (*exit_func)(void)) void (*entry_func)(void), void (*exit_func)(void))
{ {
addr_t *kstack = (addr_t *)t->kernel_stack_base; addr_t *kstack = (addr_t *)t->kernel_stack_base;
@@ -160,7 +160,7 @@ arch_thread_init_kthread_stack(struct thread *t, int (*start_func)(void),
status_t status_t
arch_thread_init_tls(struct thread *thread) arch_thread_init_tls(Thread *thread)
{ {
// TODO: Implement! // TODO: Implement!
return B_OK; return B_OK;
@@ -168,7 +168,7 @@ arch_thread_init_tls(struct thread *thread)
void void
arch_thread_context_switch(struct thread *t_from, struct thread *t_to) arch_thread_context_switch(Thread *t_from, Thread *t_to)
{ {
// set the new kernel stack in the EAR register. // set the new kernel stack in the EAR register.
// this is used in the exception handler code to decide what kernel stack to // this is used in the exception handler code to decide what kernel stack to
@@ -199,7 +199,7 @@ arch_thread_dump_info(void *info)
status_t status_t
arch_thread_enter_userspace(struct thread *thread, addr_t entry, void *arg1, void *arg2) arch_thread_enter_userspace(Thread *thread, addr_t entry, void *arg1, void *arg2)
{ {
panic("arch_thread_enter_uspace(): not yet implemented\n"); panic("arch_thread_enter_uspace(): not yet implemented\n");
return B_ERROR; return B_ERROR;
@@ -207,14 +207,14 @@ arch_thread_enter_userspace(struct thread *thread, addr_t entry, void *arg1, voi
bool bool
arch_on_signal_stack(struct thread *thread) arch_on_signal_stack(Thread *thread)
{ {
return false; return false;
} }
status_t status_t
arch_setup_signal_frame(struct thread *thread, struct sigaction *sa, int sig, int sigMask) arch_setup_signal_frame(Thread *thread, struct sigaction *sa, int sig, int sigMask)
{ {
return B_ERROR; return B_ERROR;
} }
+18 -18
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2002-2008, Axel Dörfler, axeld@pinc-software.de. * Copyright 2002-2008, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
@@ -94,7 +94,7 @@ get_next_frame_debugger(addr_t ebp, addr_t *_next, addr_t *_eip)
static status_t static status_t
lookup_symbol(struct thread* thread, addr_t address, addr_t *_baseAddress, lookup_symbol(Thread* thread, addr_t address, addr_t *_baseAddress,
const char **_symbolName, const char **_imageName, bool *_exactMatch) const char **_symbolName, const char **_imageName, bool *_exactMatch)
{ {
status_t status = B_ENTRY_NOT_FOUND; status_t status = B_ENTRY_NOT_FOUND;
@@ -307,7 +307,7 @@ print_demangled_call(const char* image, const char* symbol, addr_t args,
static void static void
print_stack_frame(struct thread *thread, addr_t eip, addr_t ebp, addr_t nextEbp, print_stack_frame(Thread *thread, addr_t eip, addr_t ebp, addr_t nextEbp,
int32 callIndex, bool demangle) int32 callIndex, bool demangle)
{ {
const char *symbol, *image; const char *symbol, *image;
@@ -380,10 +380,10 @@ print_iframe(struct iframe *frame)
static bool static bool
setup_for_thread(char *arg, struct thread **_thread, uint32 *_ebp, setup_for_thread(char *arg, Thread **_thread, uint32 *_ebp,
uint32 *_oldPageDirectory) uint32 *_oldPageDirectory)
{ {
struct thread *thread = NULL; Thread *thread = NULL;
if (arg != NULL) { if (arg != NULL) {
thread_id id = strtoul(arg, NULL, 0); thread_id id = strtoul(arg, NULL, 0);
@@ -442,7 +442,7 @@ is_double_fault_stack_address(int32 cpu, addr_t address)
static bool static bool
is_kernel_stack_address(struct thread* thread, addr_t address) is_kernel_stack_address(Thread* thread, addr_t address)
{ {
// We don't have a thread pointer in the early boot process, but then we are // We don't have a thread pointer in the early boot process, but then we are
// on the kernel stack for sure. // on the kernel stack for sure.
@@ -462,7 +462,7 @@ is_kernel_stack_address(struct thread* thread, addr_t address)
static bool static bool
is_iframe(struct thread* thread, addr_t frame) is_iframe(Thread* thread, addr_t frame)
{ {
if (!is_kernel_stack_address(thread, frame)) if (!is_kernel_stack_address(thread, frame))
return false; return false;
@@ -473,7 +473,7 @@ is_iframe(struct thread* thread, addr_t frame)
static struct iframe * static struct iframe *
find_previous_iframe(struct thread *thread, addr_t frame) find_previous_iframe(Thread *thread, addr_t frame)
{ {
// iterate backwards through the stack frames, until we hit an iframe // iterate backwards through the stack frames, until we hit an iframe
while (is_kernel_stack_address(thread, frame)) { while (is_kernel_stack_address(thread, frame)) {
@@ -488,7 +488,7 @@ find_previous_iframe(struct thread *thread, addr_t frame)
static struct iframe* static struct iframe*
get_previous_iframe(struct thread* thread, struct iframe* frame) get_previous_iframe(Thread* thread, struct iframe* frame)
{ {
if (frame == NULL) if (frame == NULL)
return NULL; return NULL;
@@ -498,7 +498,7 @@ get_previous_iframe(struct thread* thread, struct iframe* frame)
static struct iframe* static struct iframe*
get_current_iframe(struct thread* thread) get_current_iframe(Thread* thread)
{ {
if (thread == thread_get_current_thread()) if (thread == thread_get_current_thread())
return i386_get_current_iframe(); return i386_get_current_iframe();
@@ -602,7 +602,7 @@ stack_trace(int argc, char **argv)
} }
uint32 previousLocations[NUM_PREVIOUS_LOCATIONS]; uint32 previousLocations[NUM_PREVIOUS_LOCATIONS];
struct thread *thread = NULL; Thread *thread = NULL;
uint32 oldPageDirectory = 0; uint32 oldPageDirectory = 0;
uint32 ebp = x86_read_ebp(); uint32 ebp = x86_read_ebp();
int32 num = 0, last = 0; int32 num = 0, last = 0;
@@ -676,7 +676,7 @@ stack_trace(int argc, char **argv)
static void static void
print_call(struct thread *thread, addr_t eip, addr_t ebp, addr_t nextEbp, print_call(Thread *thread, addr_t eip, addr_t ebp, addr_t nextEbp,
int32 argCount) int32 argCount)
{ {
const char *symbol, *image; const char *symbol, *image;
@@ -756,7 +756,7 @@ show_call(int argc, char **argv)
return 0; return 0;
} }
struct thread *thread = NULL; Thread *thread = NULL;
uint32 oldPageDirectory = 0; uint32 oldPageDirectory = 0;
addr_t ebp = x86_read_ebp(); addr_t ebp = x86_read_ebp();
int32 argCount = 0; int32 argCount = 0;
@@ -848,7 +848,7 @@ dump_iframes(int argc, char **argv)
return 0; return 0;
} }
struct thread *thread = NULL; Thread *thread = NULL;
if (argc < 2) { if (argc < 2) {
thread = thread_get_current_thread(); thread = thread_get_current_thread();
@@ -880,7 +880,7 @@ dump_iframes(int argc, char **argv)
static bool static bool
is_calling(struct thread *thread, addr_t eip, const char *pattern, is_calling(Thread *thread, addr_t eip, const char *pattern,
addr_t start, addr_t end) addr_t start, addr_t end)
{ {
if (pattern == NULL) if (pattern == NULL)
@@ -924,7 +924,7 @@ cmd_in_context(int argc, char** argv)
return 0; return 0;
// get the thread // get the thread
struct thread* thread = thread_get_thread_struct_locked(threadID); Thread* thread = thread_get_thread_struct_locked(threadID);
if (thread == NULL) { if (thread == NULL) {
kprintf("Could not find thread with ID \"%s\".\n", threadIDString); kprintf("Could not find thread with ID \"%s\".\n", threadIDString);
return 0; return 0;
@@ -976,7 +976,7 @@ arch_debug_stack_trace(void)
bool bool
arch_debug_contains_call(struct thread *thread, const char *symbol, arch_debug_contains_call(Thread *thread, const char *symbol,
addr_t start, addr_t end) addr_t start, addr_t end)
{ {
DebuggedThreadSetter threadSetter(thread); DebuggedThreadSetter threadSetter(thread);
@@ -1060,7 +1060,7 @@ arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount,
if (skipIframes > 0) if (skipIframes > 0)
skipFrames = INT_MAX; skipFrames = INT_MAX;
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
int32 count = 0; int32 count = 0;
addr_t ebp = x86_read_ebp(); addr_t ebp = x86_read_ebp();
bool onKernelStack = true; bool onKernelStack = true;
+5 -5
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2010, Clemens Zeidler, haiku@clemens-zeidler.de. * Copyright 2010, Clemens Zeidler, haiku@clemens-zeidler.de.
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2002-2010, Axel Dörfler, axeld@pinc-software.de. * Copyright 2002-2010, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
@@ -759,7 +759,7 @@ exception_name(int number, char *buffer, int32 bufferSize)
static void static void
invalid_exception(struct iframe* frame) invalid_exception(struct iframe* frame)
{ {
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
char name[32]; char name[32];
panic("unhandled trap 0x%lx (%s) at ip 0x%lx, thread %ld!\n", panic("unhandled trap 0x%lx (%s) at ip 0x%lx, thread %ld!\n",
frame->vector, exception_name(frame->vector, name, sizeof(name)), frame->vector, exception_name(frame->vector, name, sizeof(name)),
@@ -836,7 +836,7 @@ unexpected_exception(struct iframe* frame)
if (IFRAME_IS_USER(frame)) { if (IFRAME_IS_USER(frame)) {
struct sigaction action; struct sigaction action;
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
enable_interrupts(); enable_interrupts();
@@ -926,7 +926,7 @@ x86_page_fault_exception_double_fault(struct iframe* frame)
static void static void
page_fault_exception(struct iframe* frame) page_fault_exception(struct iframe* frame)
{ {
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
uint32 cr2; uint32 cr2;
addr_t newip; addr_t newip;
@@ -1011,7 +1011,7 @@ hardware_interrupt(struct iframe* frame)
{ {
int32 vector = frame->vector - ARCH_INTERRUPT_BASE; int32 vector = frame->vector - ARCH_INTERRUPT_BASE;
bool levelTriggered = false; bool levelTriggered = false;
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
if (sCurrentPIC->is_spurious_interrupt(vector)) { if (sCurrentPIC->is_spurious_interrupt(vector)) {
TRACE(("got spurious interrupt at vector %ld\n", vector)); TRACE(("got spurious interrupt at vector %ld\n", vector));
+2 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008, The Haiku Team. All rights reserved. * Copyright 2002-2011, The Haiku Team. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Copyright 2001, Travis Geiselbrecht. All rights reserved. * Copyright 2001, Travis Geiselbrecht. All rights reserved.
@@ -852,7 +852,7 @@ FUNCTION(x86_vm86_enter):
// get pointers // get pointers
movl 32(%esp), %esi // vm86 iframe movl 32(%esp), %esi // vm86 iframe
push %esi // ... store iframe addr for x86_vm86_return push %esi // ... store iframe addr for x86_vm86_return
movl %dr3, %edi // struct thread movl %dr3, %edi // Thread*
// make sure eflags are in right shape // make sure eflags are in right shape
movl VM86_IFRAME_flags(%esi), %eax movl VM86_IFRAME_flags(%esi), %eax
+17 -17
View File
@@ -93,7 +93,7 @@ arch_thread_init(struct kernel_args *args)
static struct iframe * static struct iframe *
find_previous_iframe(struct thread *thread, addr_t frame) find_previous_iframe(Thread *thread, addr_t frame)
{ {
// iterate backwards through the stack frames, until we hit an iframe // iterate backwards through the stack frames, until we hit an iframe
while (frame >= thread->kernel_stack_base while (frame >= thread->kernel_stack_base
@@ -161,7 +161,7 @@ i386_get_user_iframe(void)
The thread must not be running and the threads spinlock must be held. The thread must not be running and the threads spinlock must be held.
*/ */
struct iframe * struct iframe *
i386_get_thread_user_iframe(struct thread *thread) i386_get_thread_user_iframe(Thread *thread)
{ {
if (thread->state == B_THREAD_RUNNING) if (thread->state == B_THREAD_RUNNING)
return NULL; return NULL;
@@ -190,7 +190,7 @@ i386_get_current_iframe(void)
uint32 uint32
x86_next_page_directory(struct thread *from, struct thread *to) x86_next_page_directory(Thread *from, Thread *to)
{ {
VMAddressSpace* toAddressSpace = to->team->address_space; VMAddressSpace* toAddressSpace = to->team->address_space;
if (from->team->address_space == toAddressSpace) { if (from->team->address_space == toAddressSpace) {
@@ -214,7 +214,7 @@ set_fs_register(uint32 segment)
static void static void
set_tls_context(struct thread *thread) set_tls_context(Thread *thread)
{ {
int entry = smp_get_current_cpu() + TLS_BASE_SEGMENT; int entry = smp_get_current_cpu() + TLS_BASE_SEGMENT;
@@ -226,7 +226,7 @@ set_tls_context(struct thread *thread)
void void
x86_restart_syscall(struct iframe* frame) x86_restart_syscall(struct iframe* frame)
{ {
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
atomic_and(&thread->flags, ~THREAD_FLAGS_RESTART_SYSCALL); atomic_and(&thread->flags, ~THREAD_FLAGS_RESTART_SYSCALL);
atomic_or(&thread->flags, THREAD_FLAGS_SYSCALL_RESTARTED); atomic_or(&thread->flags, THREAD_FLAGS_SYSCALL_RESTARTED);
@@ -242,7 +242,7 @@ x86_restart_syscall(struct iframe* frame)
static uint32 * static uint32 *
get_signal_stack(struct thread *thread, struct iframe *frame, int signal) get_signal_stack(Thread *thread, struct iframe *frame, int signal)
{ {
// use the alternate signal stack if we should and can // use the alternate signal stack if we should and can
if (thread->signal_stack_enabled if (thread->signal_stack_enabled
@@ -262,14 +262,14 @@ get_signal_stack(struct thread *thread, struct iframe *frame, int signal)
status_t status_t
arch_team_init_team_struct(struct team *p, bool kernel) arch_team_init_team_struct(Team *p, bool kernel)
{ {
return B_OK; return B_OK;
} }
status_t status_t
arch_thread_init_thread_struct(struct thread *thread) arch_thread_init_thread_struct(Thread *thread)
{ {
// set up an initial state (stack & fpu) // set up an initial state (stack & fpu)
memcpy(&thread->arch_info, &sInitialState, sizeof(struct arch_thread)); memcpy(&thread->arch_info, &sInitialState, sizeof(struct arch_thread));
@@ -278,7 +278,7 @@ arch_thread_init_thread_struct(struct thread *thread)
status_t status_t
arch_thread_init_kthread_stack(struct thread *t, int (*start_func)(void), arch_thread_init_kthread_stack(Thread *t, int (*start_func)(void),
void (*entry_func)(void), void (*exit_func)(void)) void (*entry_func)(void), void (*exit_func)(void))
{ {
addr_t *kstack = (addr_t *)t->kernel_stack_base; addr_t *kstack = (addr_t *)t->kernel_stack_base;
@@ -338,7 +338,7 @@ arch_thread_init_kthread_stack(struct thread *t, int (*start_func)(void),
*/ */
status_t status_t
arch_thread_init_tls(struct thread *thread) arch_thread_init_tls(Thread *thread)
{ {
uint32 tls[TLS_USER_THREAD_SLOT + 1]; uint32 tls[TLS_USER_THREAD_SLOT + 1];
@@ -356,7 +356,7 @@ arch_thread_init_tls(struct thread *thread)
void void
arch_thread_context_switch(struct thread *from, struct thread *to) arch_thread_context_switch(Thread *from, Thread *to)
{ {
i386_set_tss_and_kstack(to->kernel_stack_top); i386_set_tss_and_kstack(to->kernel_stack_top);
x86_set_syscall_stack(to->kernel_stack_top); x86_set_syscall_stack(to->kernel_stack_top);
@@ -415,7 +415,7 @@ arch_thread_dump_info(void *info)
*/ */
status_t status_t
arch_thread_enter_userspace(struct thread *t, addr_t entry, void *args1, arch_thread_enter_userspace(Thread *t, addr_t entry, void *args1,
void *args2) void *args2)
{ {
addr_t stackTop = t->user_stack_base + t->user_stack_size; addr_t stackTop = t->user_stack_base + t->user_stack_size;
@@ -462,7 +462,7 @@ arch_thread_enter_userspace(struct thread *t, addr_t entry, void *args1,
bool bool
arch_on_signal_stack(struct thread *thread) arch_on_signal_stack(Thread *thread)
{ {
struct iframe *frame = get_current_iframe(); struct iframe *frame = get_current_iframe();
@@ -473,7 +473,7 @@ arch_on_signal_stack(struct thread *thread)
status_t status_t
arch_setup_signal_frame(struct thread *thread, struct sigaction *action, arch_setup_signal_frame(Thread *thread, struct sigaction *action,
int signal, int signalMask) int signal, int signalMask)
{ {
struct iframe *frame = get_current_iframe(); struct iframe *frame = get_current_iframe();
@@ -559,7 +559,7 @@ arch_setup_signal_frame(struct thread *thread, struct sigaction *action,
int64 int64
arch_restore_signal_frame(void) arch_restore_signal_frame(void)
{ {
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
struct iframe *frame = get_current_iframe(); struct iframe *frame = get_current_iframe();
int32 signalMask; int32 signalMask;
uint32 *userStack; uint32 *userStack;
@@ -648,7 +648,7 @@ arch_store_fork_frame(struct arch_fork_arg *arg)
void void
arch_restore_fork_frame(struct arch_fork_arg *arg) arch_restore_fork_frame(struct arch_fork_arg *arg)
{ {
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
disable_interrupts(); disable_interrupts();
@@ -664,6 +664,6 @@ arch_restore_fork_frame(struct arch_fork_arg *arg)
void void
arch_syscall_64_bit_return_value(void) arch_syscall_64_bit_return_value(void)
{ {
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
atomic_or(&thread->flags, THREAD_FLAGS_64_BIT_SYSCALL_RETURN); atomic_or(&thread->flags, THREAD_FLAGS_64_BIT_SYSCALL_RETURN);
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright 2005-2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2005-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -101,7 +101,7 @@ install_breakpoints(const arch_team_debug_info &teamInfo)
asm("movl %0, %%dr1" : : "r"(teamInfo.breakpoints[1].address)); asm("movl %0, %%dr1" : : "r"(teamInfo.breakpoints[1].address));
asm("movl %0, %%dr2" : : "r"(teamInfo.breakpoints[2].address)); asm("movl %0, %%dr2" : : "r"(teamInfo.breakpoints[2].address));
// asm("movl %0, %%dr3" : : "r"(teamInfo.breakpoints[3].address)); // asm("movl %0, %%dr3" : : "r"(teamInfo.breakpoints[3].address));
// DR3 is used to hold the current struct thread*. // DR3 is used to hold the current Thread*.
// enable breakpoints // enable breakpoints
asm("movl %0, %%dr7" : : "r"(teamInfo.dr7)); asm("movl %0, %%dr7" : : "r"(teamInfo.dr7));
@@ -207,7 +207,7 @@ set_breakpoint(void *address, uint32 type, uint32 length)
if (!address) if (!address)
return B_BAD_VALUE; return B_BAD_VALUE;
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
cpu_status state = disable_interrupts(); cpu_status state = disable_interrupts();
GRAB_TEAM_DEBUG_INFO_LOCK(thread->team->debug_info); GRAB_TEAM_DEBUG_INFO_LOCK(thread->team->debug_info);
@@ -228,7 +228,7 @@ clear_breakpoint(void *address, bool watchpoint)
if (!address) if (!address)
return B_BAD_VALUE; return B_BAD_VALUE;
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
cpu_status state = disable_interrupts(); cpu_status state = disable_interrupts();
GRAB_TEAM_DEBUG_INFO_LOCK(thread->team->debug_info); GRAB_TEAM_DEBUG_INFO_LOCK(thread->team->debug_info);
@@ -249,7 +249,7 @@ clear_breakpoint(void *address, bool watchpoint)
static void static void
install_breakpoints_per_cpu(void* /*cookie*/, int cpu) install_breakpoints_per_cpu(void* /*cookie*/, int cpu)
{ {
struct team* kernelTeam = team_get_kernel_team(); Team* kernelTeam = team_get_kernel_team();
GRAB_TEAM_DEBUG_INFO_LOCK(kernelTeam->debug_info); GRAB_TEAM_DEBUG_INFO_LOCK(kernelTeam->debug_info);
@@ -265,7 +265,7 @@ set_kernel_breakpoint(void *address, uint32 type, uint32 length)
if (!address) if (!address)
return B_BAD_VALUE; return B_BAD_VALUE;
struct team* kernelTeam = team_get_kernel_team(); Team* kernelTeam = team_get_kernel_team();
cpu_status state = disable_interrupts(); cpu_status state = disable_interrupts();
GRAB_TEAM_DEBUG_INFO_LOCK(kernelTeam->debug_info); GRAB_TEAM_DEBUG_INFO_LOCK(kernelTeam->debug_info);
@@ -289,7 +289,7 @@ clear_kernel_breakpoint(void *address, bool watchpoint)
if (!address) if (!address)
return B_BAD_VALUE; return B_BAD_VALUE;
struct team* kernelTeam = team_get_kernel_team(); Team* kernelTeam = team_get_kernel_team();
cpu_status state = disable_interrupts(); cpu_status state = disable_interrupts();
GRAB_TEAM_DEBUG_INFO_LOCK(kernelTeam->debug_info); GRAB_TEAM_DEBUG_INFO_LOCK(kernelTeam->debug_info);
@@ -357,7 +357,7 @@ check_watch_point_parameters(void* address, uint32 type, int32 length,
static int static int
debugger_breakpoints(int argc, char** argv) debugger_breakpoints(int argc, char** argv)
{ {
struct team* kernelTeam = team_get_kernel_team(); Team* kernelTeam = team_get_kernel_team();
arch_team_debug_info& info = kernelTeam->debug_info.arch_info; arch_team_debug_info& info = kernelTeam->debug_info.arch_info;
for (int32 i = 0; i < X86_BREAKPOINT_COUNT; i++) { for (int32 i = 0; i < X86_BREAKPOINT_COUNT; i++) {
@@ -569,7 +569,7 @@ void
arch_update_thread_single_step() arch_update_thread_single_step()
{ {
if (struct iframe* frame = i386_get_user_iframe()) { if (struct iframe* frame = i386_get_user_iframe()) {
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
// set/clear TF in EFLAGS depending on whether single stepping is // set/clear TF in EFLAGS depending on whether single stepping is
// desired // desired
@@ -592,7 +592,7 @@ arch_set_debug_cpu_state(const debug_cpu_state *cpuState)
// guaranteed passed buffer, we use our thread's fpu_state field as // guaranteed passed buffer, we use our thread's fpu_state field as
// temporary buffer. We need to disable interrupts to make use of // temporary buffer. We need to disable interrupts to make use of
// it. // it.
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
InterruptsLocker locker; InterruptsLocker locker;
memcpy(thread->arch_info.fpu_state, &cpuState->extended_registers, memcpy(thread->arch_info.fpu_state, &cpuState->extended_registers,
sizeof(cpuState->extended_registers)); sizeof(cpuState->extended_registers));
@@ -636,7 +636,7 @@ arch_get_debug_cpu_state(debug_cpu_state *cpuState)
// Since fxsave requires 16-byte alignment and this isn't guaranteed // Since fxsave requires 16-byte alignment and this isn't guaranteed
// passed buffer, we use our thread's fpu_state field as temporary // passed buffer, we use our thread's fpu_state field as temporary
// buffer. We need to disable interrupts to make use of it. // buffer. We need to disable interrupts to make use of it.
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
InterruptsLocker locker; InterruptsLocker locker;
i386_fxsave(thread->arch_info.fpu_state); i386_fxsave(thread->arch_info.fpu_state);
// unlike fnsave, fxsave doesn't reinit the FPU state // unlike fnsave, fxsave doesn't reinit the FPU state
@@ -773,7 +773,7 @@ arch_clear_kernel_watchpoint(void *address)
void void
x86_init_user_debug_at_kernel_exit(struct iframe *frame) x86_init_user_debug_at_kernel_exit(struct iframe *frame)
{ {
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
if (!(thread->flags & THREAD_FLAGS_BREAKPOINTS_DEFINED)) if (!(thread->flags & THREAD_FLAGS_BREAKPOINTS_DEFINED))
return; return;
@@ -802,7 +802,7 @@ x86_init_user_debug_at_kernel_exit(struct iframe *frame)
void void
x86_exit_user_debug_at_kernel_entry() x86_exit_user_debug_at_kernel_entry()
{ {
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
// We need to save the current values of dr6 and dr7 in the CPU structure, // We need to save the current values of dr6 and dr7 in the CPU structure,
// since in case of a debug exception we might overwrite them before // since in case of a debug exception we might overwrite them before
@@ -821,7 +821,7 @@ x86_exit_user_debug_at_kernel_entry()
disable_breakpoints(); disable_breakpoints();
// install kernel breakpoints // install kernel breakpoints
struct team* kernelTeam = team_get_kernel_team(); Team* kernelTeam = team_get_kernel_team();
GRAB_TEAM_DEBUG_INFO_LOCK(kernelTeam->debug_info); GRAB_TEAM_DEBUG_INFO_LOCK(kernelTeam->debug_info);
install_breakpoints(kernelTeam->debug_info.arch_info); install_breakpoints(kernelTeam->debug_info.arch_info);
RELEASE_TEAM_DEBUG_INFO_LOCK(kernelTeam->debug_info); RELEASE_TEAM_DEBUG_INFO_LOCK(kernelTeam->debug_info);
@@ -838,7 +838,7 @@ x86_exit_user_debug_at_kernel_entry()
void void
x86_handle_debug_exception(struct iframe *frame) x86_handle_debug_exception(struct iframe *frame)
{ {
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
// Get dr6 and dr7. If the given iframe is a userland frame, the exception // Get dr6 and dr7. If the given iframe is a userland frame, the exception
// obviously occurred in userland. In that case // obviously occurred in userland. In that case
+9 -9
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2007-2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2007-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -33,14 +33,14 @@ dummy()
DEFINE_OFFSET_MACRO(CPU_ENT, cpu_ent, fault_handler); DEFINE_OFFSET_MACRO(CPU_ENT, cpu_ent, fault_handler);
DEFINE_OFFSET_MACRO(CPU_ENT, cpu_ent, fault_handler_stack_pointer); DEFINE_OFFSET_MACRO(CPU_ENT, cpu_ent, fault_handler_stack_pointer);
// struct thread // struct Thread
DEFINE_OFFSET_MACRO(THREAD, thread, kernel_time); DEFINE_OFFSET_MACRO(THREAD, Thread, kernel_time);
DEFINE_OFFSET_MACRO(THREAD, thread, user_time); DEFINE_OFFSET_MACRO(THREAD, Thread, user_time);
DEFINE_OFFSET_MACRO(THREAD, thread, last_time); DEFINE_OFFSET_MACRO(THREAD, Thread, last_time);
DEFINE_OFFSET_MACRO(THREAD, thread, in_kernel); DEFINE_OFFSET_MACRO(THREAD, Thread, in_kernel);
DEFINE_OFFSET_MACRO(THREAD, thread, flags); DEFINE_OFFSET_MACRO(THREAD, Thread, flags);
DEFINE_OFFSET_MACRO(THREAD, thread, kernel_stack_top); DEFINE_OFFSET_MACRO(THREAD, Thread, kernel_stack_top);
DEFINE_OFFSET_MACRO(THREAD, thread, fault_handler); DEFINE_OFFSET_MACRO(THREAD, Thread, fault_handler);
// struct iframe // struct iframe
DEFINE_OFFSET_MACRO(IFRAME, iframe, cs); DEFINE_OFFSET_MACRO(IFRAME, iframe, cs);
@@ -1,5 +1,5 @@
/* /*
* Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2008-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
@@ -183,7 +183,7 @@ X86VMTranslationMap32Bit::Map(addr_t va, phys_addr_t pa, uint32 attributes,
} }
// now, fill in the pentry // now, fill in the pentry
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt( page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt(
@@ -228,7 +228,7 @@ X86VMTranslationMap32Bit::Unmap(addr_t start, addr_t end)
continue; continue;
} }
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt( page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt(
@@ -356,7 +356,7 @@ X86VMTranslationMap32Bit::UnmapPages(VMArea* area, addr_t base, size_t size,
continue; continue;
} }
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt( page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt(
@@ -565,7 +565,7 @@ X86VMTranslationMap32Bit::Query(addr_t va, phys_addr_t *_physical,
return B_OK; return B_OK;
} }
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt( page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt(
@@ -663,7 +663,7 @@ X86VMTranslationMap32Bit::Protect(addr_t start, addr_t end, uint32 attributes,
continue; continue;
} }
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt( page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt(
@@ -722,7 +722,7 @@ X86VMTranslationMap32Bit::ClearFlags(addr_t va, uint32 flags)
uint32 flagsToClear = ((flags & PAGE_MODIFIED) ? X86_PTE_DIRTY : 0) uint32 flagsToClear = ((flags & PAGE_MODIFIED) ? X86_PTE_DIRTY : 0)
| ((flags & PAGE_ACCESSED) ? X86_PTE_ACCESSED : 0); | ((flags & PAGE_ACCESSED) ? X86_PTE_ACCESSED : 0);
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt( page_table_entry* pt = (page_table_entry*)fPageMapper->GetPageTableAt(
@@ -1,5 +1,5 @@
/* /*
* Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2008-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
@@ -95,7 +95,7 @@ X86VMTranslationMap::Flush()
if (fInvalidPagesCount <= 0) if (fInvalidPagesCount <= 0)
return; return;
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
thread_pin_to_current_cpu(thread); thread_pin_to_current_cpu(thread);
if (fInvalidPagesCount > PAGE_INVALIDATE_CACHE_SIZE) { if (fInvalidPagesCount > PAGE_INVALIDATE_CACHE_SIZE) {
@@ -1,5 +1,5 @@
/* /*
* Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2008-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2002-2010, Axel Dörfler, axeld@pinc-software.de. * Copyright 2002-2010, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
@@ -217,7 +217,7 @@ X86VMTranslationMapPAE::Map(addr_t virtualAddress, phys_addr_t physicalAddress,
} }
// now, fill in the page table entry // now, fill in the page table entry
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
pae_page_table_entry* pageTable pae_page_table_entry* pageTable
@@ -265,7 +265,7 @@ X86VMTranslationMapPAE::Unmap(addr_t start, addr_t end)
continue; continue;
} }
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
pae_page_table_entry* pageTable pae_page_table_entry* pageTable
@@ -398,7 +398,7 @@ X86VMTranslationMapPAE::UnmapPages(VMArea* area, addr_t base, size_t size,
continue; continue;
} }
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
pae_page_table_entry* pageTable pae_page_table_entry* pageTable
@@ -613,7 +613,7 @@ X86VMTranslationMapPAE::Query(addr_t virtualAddress,
} }
// get the page table entry // get the page table entry
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
pae_page_table_entry* pageTable pae_page_table_entry* pageTable
@@ -722,7 +722,7 @@ X86VMTranslationMapPAE::Protect(addr_t start, addr_t end, uint32 attributes,
continue; continue;
} }
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
pae_page_table_entry* pageTable pae_page_table_entry* pageTable
@@ -785,7 +785,7 @@ X86VMTranslationMapPAE::ClearFlags(addr_t address, uint32 flags)
uint64 flagsToClear = ((flags & PAGE_MODIFIED) ? X86_PAE_PTE_DIRTY : 0) uint64 flagsToClear = ((flags & PAGE_MODIFIED) ? X86_PAE_PTE_DIRTY : 0)
| ((flags & PAGE_ACCESSED) ? X86_PAE_PTE_ACCESSED : 0); | ((flags & PAGE_ACCESSED) ? X86_PAE_PTE_ACCESSED : 0);
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner pinner(thread); ThreadCPUPinner pinner(thread);
pae_page_table_entry* entry pae_page_table_entry* entry
@@ -1,5 +1,5 @@
/* /*
* Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2008-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -570,7 +570,7 @@ LargeMemoryPhysicalPageMapper::MemsetPhysical(phys_addr_t address, int value,
{ {
addr_t pageOffset = address % B_PAGE_SIZE; addr_t pageOffset = address % B_PAGE_SIZE;
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner _(thread); ThreadCPUPinner _(thread);
PhysicalPageSlotQueue* slotQueue = GetSlotQueue(thread->cpu->cpu_num, PhysicalPageSlotQueue* slotQueue = GetSlotQueue(thread->cpu->cpu_num,
@@ -601,7 +601,7 @@ LargeMemoryPhysicalPageMapper::MemcpyFromPhysical(void* _to, phys_addr_t from,
uint8* to = (uint8*)_to; uint8* to = (uint8*)_to;
addr_t pageOffset = from % B_PAGE_SIZE; addr_t pageOffset = from % B_PAGE_SIZE;
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner _(thread); ThreadCPUPinner _(thread);
PhysicalPageSlotQueue* slotQueue = GetSlotQueue(thread->cpu->cpu_num, user); PhysicalPageSlotQueue* slotQueue = GetSlotQueue(thread->cpu->cpu_num, user);
@@ -641,7 +641,7 @@ LargeMemoryPhysicalPageMapper::MemcpyToPhysical(phys_addr_t to,
const uint8* from = (const uint8*)_from; const uint8* from = (const uint8*)_from;
addr_t pageOffset = to % B_PAGE_SIZE; addr_t pageOffset = to % B_PAGE_SIZE;
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner _(thread); ThreadCPUPinner _(thread);
PhysicalPageSlotQueue* slotQueue = GetSlotQueue(thread->cpu->cpu_num, user); PhysicalPageSlotQueue* slotQueue = GetSlotQueue(thread->cpu->cpu_num, user);
@@ -678,7 +678,7 @@ void
LargeMemoryPhysicalPageMapper::MemcpyPhysicalPage(phys_addr_t to, LargeMemoryPhysicalPageMapper::MemcpyPhysicalPage(phys_addr_t to,
phys_addr_t from) phys_addr_t from)
{ {
struct thread* thread = thread_get_current_thread(); Thread* thread = thread_get_current_thread();
ThreadCPUPinner _(thread); ThreadCPUPinner _(thread);
PhysicalPageSlotQueue* slotQueue = GetSlotQueue(thread->cpu->cpu_num, PhysicalPageSlotQueue* slotQueue = GetSlotQueue(thread->cpu->cpu_num,
+3 -3
View File
@@ -536,7 +536,7 @@ vm86_fault_callback(addr_t address, addr_t faultAddress, bool isWrite)
extern "C" status_t extern "C" status_t
vm86_prepare(struct vm86_state *state, unsigned int ramSize) vm86_prepare(struct vm86_state *state, unsigned int ramSize)
{ {
struct team *team = thread_get_current_thread()->team; Team *team = thread_get_current_thread()->team;
status_t ret = B_OK; status_t ret = B_OK;
area_id vectors; area_id vectors;
@@ -603,7 +603,7 @@ error:
extern "C" void extern "C" void
vm86_cleanup(struct vm86_state *state) vm86_cleanup(struct vm86_state *state)
{ {
struct team *team = thread_get_current_thread()->team; Team *team = thread_get_current_thread()->team;
if (state->bios_area > B_OK) if (state->bios_area > B_OK)
vm_delete_area(team->id, state->bios_area, true); vm_delete_area(team->id, state->bios_area, true);
@@ -629,7 +629,7 @@ vm86_do_int(struct vm86_state *state, uint8 vec)
{ {
int8 *ip; int8 *ip;
int emuState = 0; int emuState = 0;
struct thread *thread = thread_get_current_thread(); Thread *thread = thread_get_current_thread();
status_t ret; status_t ret;
// prepare environment // prepare environment

Some files were not shown because too many files have changed in this diff Show More