RE: Segmentation fault with outb()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think you need to refer COM3 (0x0100) in reference to ES (Extra
Segment) register.

You first copy 0x00 to es register and then refer in COM3 inrelation to
es, bye es:COM3

I don't know the syntax of Linux Assmbly, but I hope you got my point.

I think you need to add following code before refering COM3

movl $(0x00) %eax

movl %eax %es

After refering refer COM3 in reference to es register.

I might be wrong, if I am wrong please correct me.

Regards,

Gaurav


No, no,
Linux works on protected mode. You cannot load segment registers as in real mode. In protected mode, They are called selecters which select the GDT entry. In kernel mode (Linux), segment registers are always (cs=0x08 and ds,es,fs,gs... = 0x10) and in user mode (cs= 0x23 ds,es,fs,gs...=0x2b).





I am trying to to set up my ports for IO with the low level inb() and
outb() in the code below. However, as soon as I write to the COM port, I
get a segmentation fault. The hardware uses a lava card with 8 COM ports
available.

I know that similar code works in module form, whereby I insmod the
module, and set up my ports using in the init_module() function. Here,
however, I am trying to build it into a regular executable. But is that
the reason?

TIA.

Raja Hayek.




The problem is with the I/o permission. If you know about Intels TSS(Task State Segment), It contains a bitmap which decides which i/o address the user can accrss from ring 3. So, first you need to change that using ioperm system call.
see man ioperm


regards manish

_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail



-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux