Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 May 1997 14:47:58 +0930 (CST)
From:      Michael Smith <msmith@atrad.adelaide.edu.au>
To:        emulation@freebsd.org
Subject:   Linux-emul LDT support (implementation question(s))
Message-ID:  <199705070517.OAA18353@genesis.atrad.adelaide.edu.au>

next in thread | raw e-mail | index | archive | help

Hokay, following through on the question raised the other day about 
emulating the Linux i386_modify_ldt() function, I'm prodding at it 
currently and have the odd question or two...

Firstly, the BSD functions i386_get_ldt() and i386_set_ldt() use
copyin/copyout on their parameters.  Is this going to be a problem 
if the parameters are alreay in the kernel (I expect not, as otherwise
it would be a horrific problem for many other functions).

Secondly, Linux has :

#define MODIFY_LDT_CONTENTS_DATA	0
#define MODIFY_LDT_CONTENTS_STACK	1
#define MODIFY_LDT_CONTENTS_CODE	2

Where we have :

        /* memory segment types */
#define SDT_MEMRO       16      /* memory read only */
#define SDT_MEMROA      17      /* memory read only accessed */
#define SDT_MEMRW       18      /* memory read write */
#define SDT_MEMRWA      19      /* memory read write accessed */
#define SDT_MEMROD      20      /* memory read only expand dwn limit */
#define SDT_MEMRODA     21      /* memory read only expand dwn limit accessed */
#define SDT_MEMRWD      22      /* memory read write expand dwn limit */
#define SDT_MEMRWDA     23      /* memory read write expand dwn limit accessed *
/
#define SDT_MEME        24      /* memory execute only */
#define SDT_MEMEA       25      /* memory execute only accessed */
#define SDT_MEMER       26      /* memory execute read */
#define SDT_MEMERA      27      /* memory execute read accessed */
#define SDT_MEMEC       28      /* memory execute only conforming */
#define SDT_MEMEAC      29      /* memory execute only accessed conforming */
#define SDT_MEMERC      30      /* memory execute read conforming */
#define SDT_MEMERAC     31      /* memory execute read accessed conforming */

Govelling in i386/i386/machdep.c suggests that data should be MEMRWA
and code should be MEMERA.  How about the stack?  Is it the same as
the data segment?

There's also a 'read_exec_only' flag; anyone with the Linux kernel source
care to shed some light on how this is translated to a "real" LDT?

-- 
]] Mike Smith, Software Engineer        msmith@gsoft.com.au             [[
]] Genesis Software                     genesis@gsoft.com.au            [[
]] High-speed data acquisition and      (GSM mobile)     0411-222-496   [[
]] realtime instrument control.         (ph)          +61-8-8267-3493   [[
]] Unix hardware collector.             "Where are your PEZ?" The Tick  [[



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705070517.OAA18353>