[Solved] Paging problem + GPFs

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

jal wrote:
pcmattman wrote:This looks suspicious, but I'm not 100% sure:

Code: Select all

if ~ ( id > 7 & id < 15 ) 
Shouldn't that & be an &&? Or do I just not understand the syntax?
It looks suspicious indeed, but it works, since & has a low priority. So id > 7 and id < 15 are evaluated (yielding 0 or 1), and the result is 0 or 1.


JAL
Given that he's using ~ to mean NOT I see two possibilities:

(a) ~ = logical NOT, & = logical AND, the problem is elsewhere.
(b) ~ = one's complement, & = binary AND, the OP doesn't know the difference and the problem is here.

Being that I don't know the macro language being used I'll leave it up to someone more qualified to make the choice of those two!

Cheers,

James
White-spirit
Member
Member
Posts: 89
Joined: Sun Mar 23, 2008 2:23 pm
Location: [0x8:0x1000]

Post by White-spirit »

I've debugged my isr14 and it seems to be correct, it does just one push :

Code: Select all

(3219620396) Breakpoint 3219620264, in 0008:001031b1 (0x001031b1)
Next at t=298296331
(0) [0x001031b1] 0008:00000000001031b1 (unk. ctxt): cli                       ; fa
<bochs:5> s
Next at t=298296332
(0) [0x001031b2] 0008:00000000001031b2 (unk. ctxt): push 0x0000000e           ; 6a0e
<bochs:6>  
Next at t=298296333
(0) [0x001031b4] 0008:00000000001031b4 (unk. ctxt): jmp .+0x00000077 (0x0010322d) ; eb77
<bochs:7> 
So I think the macro is correct .
Working on multi-tasking support ...
White-spirit
Member
Member
Posts: 89
Joined: Sun Mar 23, 2008 2:23 pm
Location: [0x8:0x1000]

Post by White-spirit »

I corrected the macro and the "if" condition must be :

Code: Select all

if ~ ( id = 8 | id > 9 & id < 15 )
But it still doesn't work, I've also discovered that all the interrupts 8, 10-14 don't work, but the rest does his work perfectly ....

Can I post a floppy image here ?

Thanks :-)
Working on multi-tasking support ...
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Post by jal »

White-spirit wrote:But it still doesn't work, I've also discovered that all the interrupts 8, 10-14 don't work, but the rest does his work perfectly ....
I'd rather you disassemble the assembled code and look what the output is, so you can check whether the macro is assembled correctly (i.e. as you intended). A floppy image doesn't help at all, we really believe you when you say it doesn't work.


JAL
White-spirit
Member
Member
Posts: 89
Joined: Sun Mar 23, 2008 2:23 pm
Location: [0x8:0x1000]

Post by White-spirit »

Thanks, I've disassembled my idt.s.o and it seems that the interrupts 8, 10-14 are doing only one push ( so it's correct ) .

It has nothing to do with this ? AlfaOmega08 has a similar problem, and he uses also JamesM's macro : http://www.osdev.org/phpBB2/viewtopic.php?t=16922

Code: Select all

idt.s.o:     file format elf32-i386

Disassembly of section .flat:

00000000 <load_idt>:
   0:	55                   	push   %ebp
   1:	89 e5                	mov    %esp,%ebp
   3:	8b 5c 24 08          	mov    0x8(%esp),%ebx
   7:	0f 01 1b             	lidtl  (%ebx)
   a:	c9                   	leave  
   b:	c3                   	ret    

0000000c <isr0>:
   c:	fa                   	cli    
   d:	6a 00                	push   $0x0
   f:	6a 00                	push   $0x0
  11:	e9 f1 00 00 00       	jmp    107 <isr31+0x7>

00000016 <isr1>:
  16:	fa                   	cli    
  17:	6a 00                	push   $0x0
  19:	6a 01                	push   $0x1
  1b:	e9 e7 00 00 00       	jmp    107 <isr31+0x7>

00000020 <isr2>:
  20:	fa                   	cli    
  21:	6a 00                	push   $0x0
  23:	6a 02                	push   $0x2
  25:	e9 dd 00 00 00       	jmp    107 <isr31+0x7>

0000002a <isr3>:
  2a:	fa                   	cli    
  2b:	6a 00                	push   $0x0
  2d:	6a 03                	push   $0x3
  2f:	e9 d3 00 00 00       	jmp    107 <isr31+0x7>

00000034 <isr4>:
  34:	fa                   	cli    
  35:	6a 00                	push   $0x0
  37:	6a 04                	push   $0x4
  39:	e9 c9 00 00 00       	jmp    107 <isr31+0x7>

0000003e <isr5>:
  3e:	fa                   	cli    
  3f:	6a 00                	push   $0x0
  41:	6a 05                	push   $0x5
  43:	e9 bf 00 00 00       	jmp    107 <isr31+0x7>

00000048 <isr6>:
  48:	fa                   	cli    
  49:	6a 00                	push   $0x0
  4b:	6a 06                	push   $0x6
  4d:	e9 b5 00 00 00       	jmp    107 <isr31+0x7>

00000052 <isr7>:
  52:	fa                   	cli    
  53:	6a 00                	push   $0x0
  55:	6a 07                	push   $0x7
  57:	e9 ab 00 00 00       	jmp    107 <isr31+0x7>

0000005c <isr8>:
  5c:	fa                   	cli    
  5d:	6a 08                	push   $0x8
  5f:	e9 a3 00 00 00       	jmp    107 <isr31+0x7>

00000064 <isr9>:
  64:	fa                   	cli    
  65:	6a 00                	push   $0x0
  67:	6a 09                	push   $0x9
  69:	e9 99 00 00 00       	jmp    107 <isr31+0x7>

0000006e <isr10>:
  6e:	fa                   	cli    
  6f:	6a 0a                	push   $0xa
  71:	e9 91 00 00 00       	jmp    107 <isr31+0x7>

00000076 <isr11>:
  76:	fa                   	cli    
  77:	6a 0b                	push   $0xb
  79:	e9 89 00 00 00       	jmp    107 <isr31+0x7>

0000007e <isr12>:
  7e:	fa                   	cli    
  7f:	6a 0c                	push   $0xc
  81:	e9 81 00 00 00       	jmp    107 <isr31+0x7>

00000086 <isr13>:
  86:	fa                   	cli    
  87:	6a 0d                	push   $0xd
  89:	eb 7c                	jmp    107 <isr31+0x7>

0000008b <isr14>:
  8b:	fa                   	cli    
  8c:	6a 0e                	push   $0xe
  8e:	eb 77                	jmp    107 <isr31+0x7>

00000090 <isr15>:
  90:	fa                   	cli    
  91:	6a 00                	push   $0x0
  93:	6a 0f                	push   $0xf
  95:	eb 70                	jmp    107 <isr31+0x7>

00000097 <isr16>:
  97:	fa                   	cli    
  98:	6a 00                	push   $0x0
  9a:	6a 10                	push   $0x10
  9c:	eb 69                	jmp    107 <isr31+0x7>

0000009e <isr17>:
  9e:	fa                   	cli    
  9f:	6a 00                	push   $0x0
  a1:	6a 11                	push   $0x11
  a3:	eb 62                	jmp    107 <isr31+0x7>

000000a5 <isr18>:
  a5:	fa                   	cli    
  a6:	6a 00                	push   $0x0
  a8:	6a 12                	push   $0x12
  aa:	eb 5b                	jmp    107 <isr31+0x7>

000000ac <isr19>:
  ac:	fa                   	cli    
  ad:	6a 00                	push   $0x0
  af:	6a 13                	push   $0x13
  b1:	eb 54                	jmp    107 <isr31+0x7>

000000b3 <isr20>:
  b3:	fa                   	cli    
  b4:	6a 00                	push   $0x0
  b6:	6a 14                	push   $0x14
  b8:	eb 4d                	jmp    107 <isr31+0x7>

000000ba <isr21>:
  ba:	fa                   	cli    
  bb:	6a 00                	push   $0x0
  bd:	6a 15                	push   $0x15
  bf:	eb 46                	jmp    107 <isr31+0x7>

000000c1 <isr22>:
  c1:	fa                   	cli    
  c2:	6a 00                	push   $0x0
  c4:	6a 16                	push   $0x16
  c6:	eb 3f                	jmp    107 <isr31+0x7>

000000c8 <isr23>:
  c8:	fa                   	cli    
  c9:	6a 00                	push   $0x0
  cb:	6a 17                	push   $0x17
  cd:	eb 38                	jmp    107 <isr31+0x7>

000000cf <isr24>:
  cf:	fa                   	cli    
  d0:	6a 00                	push   $0x0
  d2:	6a 18                	push   $0x18
  d4:	eb 31                	jmp    107 <isr31+0x7>

000000d6 <isr25>:
  d6:	fa                   	cli    
  d7:	6a 00                	push   $0x0
  d9:	6a 19                	push   $0x19
  db:	eb 2a                	jmp    107 <isr31+0x7>

000000dd <isr26>:
  dd:	fa                   	cli    
  de:	6a 00                	push   $0x0
  e0:	6a 1a                	push   $0x1a
  e2:	eb 23                	jmp    107 <isr31+0x7>

000000e4 <isr27>:
  e4:	fa                   	cli    
  e5:	6a 00                	push   $0x0
  e7:	6a 1b                	push   $0x1b
  e9:	eb 1c                	jmp    107 <isr31+0x7>

000000eb <isr28>:
  eb:	fa                   	cli    
  ec:	6a 00                	push   $0x0
  ee:	6a 1c                	push   $0x1c
  f0:	eb 15                	jmp    107 <isr31+0x7>

000000f2 <isr29>:
  f2:	fa                   	cli    
  f3:	6a 00                	push   $0x0
  f5:	6a 1d                	push   $0x1d
  f7:	eb 0e                	jmp    107 <isr31+0x7>

000000f9 <isr30>:
  f9:	fa                   	cli    
  fa:	6a 00                	push   $0x0
  fc:	6a 1e                	push   $0x1e
  fe:	eb 07                	jmp    107 <isr31+0x7>

00000100 <isr31>:
 100:	fa                   	cli    
 101:	6a 00                	push   $0x0
 103:	6a 1f                	push   $0x1f
 105:	eb 00                	jmp    107 <isr31+0x7>
 107:	60                   	pusha  
 108:	66 8c d8             	mov    %ds,%ax
 10b:	50                   	push   %eax
 10c:	66 b8 10 00          	mov    $0x10,%ax
 110:	8e d8                	mov    %eax,%ds
 112:	8e c0                	mov    %eax,%es
 114:	8e e0                	mov    %eax,%fs
 116:	8e e8                	mov    %eax,%gs
 118:	e8 fc ff ff ff       	call   119 <isr31+0x19>
 11d:	5b                   	pop    %ebx
 11e:	8e db                	mov    %ebx,%ds
 120:	8e c3                	mov    %ebx,%es
 122:	8e e3                	mov    %ebx,%fs
 124:	8e eb                	mov    %ebx,%gs
 126:	61                   	popa   
 127:	83 c4 08             	add    $0x8,%esp
 12a:	fb                   	sti    
 12b:	cf                   	iret 
Working on multi-tasking support ...
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Hi,

My macro works perfectly.

Problem
Exists
Between
Keyboard
And
Chair

, IMHO. Why you are trying to trigger the exceptions which push an error code manually, I have no idea.

Cheers,

James
White-spirit
Member
Member
Posts: 89
Joined: Sun Mar 23, 2008 2:23 pm
Location: [0x8:0x1000]

Post by White-spirit »

JamesM wrote:Hi,

My macro works perfectly.

Problem
Exists
Between
Keyboard
And
Chair

, IMHO. Why you are trying to trigger the exceptions which push an error code manually, I have no idea.

Cheers,

James
Well, I just want to test a page fault exception by accessing to a non-present page .
Working on multi-tasking support ...
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

If I was debugging this, one of the first things I'd do would be to take out the call to isr_handler. When the first PFE occurs, your OS will then go in to an infinite loop, but at least you will find out if it's the stub causing the problem or not.

Cheers,
Adam
White-spirit
Member
Member
Posts: 89
Joined: Sun Mar 23, 2008 2:23 pm
Location: [0x8:0x1000]

Post by White-spirit »

I've removed the isr_handler call, and it still doesn't work, so the problem comes from the stub .
Working on multi-tasking support ...
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Wait a minute - the paging interupt is int 14. From your disassembly, the PFE ISR does not push a dummy error code and it should do.

Cheers,
Adam
White-spirit
Member
Member
Posts: 89
Joined: Sun Mar 23, 2008 2:23 pm
Location: [0x8:0x1000]

Post by White-spirit »

JamesM said that the interrupts 8, 10-14 push error codes, so I need to do only one push, or not ?
Working on multi-tasking support ...
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Bugg*r - sorry. My Mistake :oops:
White-spirit
Member
Member
Posts: 89
Joined: Sun Mar 23, 2008 2:23 pm
Location: [0x8:0x1000]

Post by White-spirit »

Here's a screenshot if it can help you .
Thanks :)

Image
Working on multi-tasking support ...
White-spirit
Member
Member
Posts: 89
Joined: Sun Mar 23, 2008 2:23 pm
Location: [0x8:0x1000]

Post by White-spirit »

With QEmu I get interrupts 14 instead of 13... Is that an emulator related issue ?
Working on multi-tasking support ...
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

It means you borked something else.

Are you perchance using an unlinked version of your code? The address of the call instruction is just pointing nowhere :roll:
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply