Re: [ES40-developers] CDROM issue
Status: Alpha
Brought to you by:
iamcamiel
|
From: Camiel V. <iam...@gm...> - 2008-03-21 14:29:13
|
Hi Brian,
On Thu, Mar 20, 2008 at 7:36 PM, Brian Wheeler <bdw...@in...> wrote:
> Camiel, is it possible (and/or legitimate) to do something like this:
>
> {
> SCOPED_WRITE_LOCK(some_rwlock);
> .
> .
> .
> some_rwlock->unlock();
> a_long_running_function_like_fread();
> some_rwlock->writeLock();
> .
> .
> .
> }
>
> So I can release my lock while trying to run the fread() on physical
> devices?
Yes, that should be possible. Just make sure that you always lock it
again in this case. The destructor on the ScopedLock will always try
to unlock it, and not all implementations like trying to unlock an
already unlocked mutex.
> Where does one put the -DDEBUG_IDE style flags when using configure?
This is something I've given considerable thought. I wanted to have a
couple of questions about this when running configure. At first I
wanted to do this from the configure script itself; I've been playing
around with a couple of m4 macro's that should do this, but never
managed to get it working. Using read failed because stdin was no
longer the terminal. So instead, I've changed the reconf script in
such a way that it renames the original configure script to
configure_2.sh; then it creates a script called configure_1.sh that
contains questions for debugging flags, and finally creates a new
configure script that calls configure_1.sh followed by configure_2.sh.
This is all in CVS now.
When you run ./configure now, you get a couple of questions such as:
camiel@linux-laptop:~/es40> ./configure
This is the debug-options configuration script for the ES40 emulator
If you don't want any debugging options enabled, answer YES to the
following question
Do you want the defaults for all options? [yes]: no
Do you want to show the cycle counter? [yes]:
Do you want to enable VGA debugging? [no]: yes
Do you want to enable Serial Port debugging? [no]: no
Do you want to enable one or more IDE debugging options? [no]: yes
Do you want to enable all IDE debugging? [no]: yes
Do you want to enable unknown memory access debugging? [no]: no
After which the normal configure script runs. If you ever want to
change debugging flags without running configure, simply run
./configure_1.sh
The debugging flags are stored in src/config_debug.h:
camiel@linux-laptop:~/es40> cat src/config_debug.h
// This file contains the debug configuration options.
// This file was generated by configure_1.sh
// Enable the cycle counter
//#define HIDE_COUNTER 1
// Enable VGA debugging
#define DEBUG_VGA 1
// Disable Serial Port debugging
//#define DEBUG_SERIAL 1
// Enable all IDE debugging
#define DEBUG_IDE 1
// Disable unknown memory access debugging
//#define DEBUG_UNKMEM 1
If you want to add debugging flags, don't change configure_1.sh
directly; instead, edit configure_1.m4; it has a list of debugging
options like this:
ES_ASK_DEBUG_Q(IDE Busmaster, IDE_BUSMASTER)
ES_ASK_DEBUG_Q(IDE Command, IDE_COMMAND)
ES_ASK_DEBUG_Q(IDE DMA, IDE_DMA)
ES_ASK_DEBUG_Q(IDE Interrupt, IDE_INTERRUPT)
ES_ASK_DEBUG_Q(IDE Command Register, IDE_REG_COMMAND)
ES_ASK_DEBUG_Q(IDE Control Register, IDE_REG_CONTROL)
ES_ASK_DEBUG_Q(IDE ATAPI Packet, IDE_PACKET)
ES_ASK_DEBUG_Q(IDE Thread, IDE_THREADS)
ES_ASK_DEBUG_Q(IDE Mutexes, IDE_LOCKS)
Then run ./reconfig, and you should have up-to-date configure scripts.
You should have Automake (1.10), Autoconf (2.61) and m4 (1.4.10). The
version numbers are those on my linux box, older versions might not
work with our scripts.
I'm pretty fond of this solution, but if there's anything in here
you're not happy with, please let me know.
Camiel.
|