Messages in this thread |  | | From | (H. Peter Anvin) | Subject | Re: what is wrong with this? | Date | 7 Jan 1997 05:21:44 GMT |
| |
Followup to: <Mutt.19970106024153.todd@LightHouse.localhost> By author: friest@acm.org (Todd T. Fries) In newsgroup: linux.dev.kernel > > #include <asm/io.h> > void main() > { > long port; > short data; > > port = 0x8370; > data = 0; > iopl(3); > (*(volatile unsigned short *)(port))=0; > } > > running this as root should not segv. However, it does. Why? > > tried linux 2.1.14 and 2.1.20... >
Sure it should... you're writing into null memory (on Linux, the first megabyte of memory is unmapped to catch null pointer references.) If you want to access I/O ports use the I/O functions:
out[bwl](val,port) out[bwl]_p(val,port) in[bwl](port) in[bwl]_p(port)
-hpa
-- This space intentionally has nothing but text explaining why this space has nothing but text explaining why this space would otherwise have been left blank, and would otherwise have been left blank.
|  |